From nobody Sun Nov 9 22:39:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1551980961455452.2879869117993; Thu, 7 Mar 2019 09:49:21 -0800 (PST) Received: from localhost ([127.0.0.1]:56331 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1x8t-00012P-Bh for importer@patchew.org; Thu, 07 Mar 2019 12:49:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39328) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1wqZ-0002vj-Se for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:30:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1wqY-0007v1-By for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:30:19 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:35868) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h1wqY-0007uE-3F for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:30:18 -0500 Received: by mail-wr1-x42a.google.com with SMTP id o17so18419085wrw.3 for ; Thu, 07 Mar 2019 09:30:18 -0800 (PST) Received: from 640k.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id d206sm9979753wmc.11.2019.03.07.09.30.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 09:30:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=w8UtGXHxxOD7uSjdCIM7I57GrVcLCDRxU8RwJ5uXpKg=; b=igyKSBLTyTHrrcFtC5g+Wa32PGVeYYnwC/wRoHyEa1Qa8mYbAtfskOXkU8PKFiwzzw Zl64CxpjXq+iXsdqB/yjWHwXl+jBCosxt3BweDBwyAtpuk3Nsv//nJVaDV/2EudEDs4T ++4b/oGK3eIOZWFkD335eCuW78i8OZWl2ebDyqGSFnnuHTgTRYkTA4kIlN8gwXXUwA1j dFty3EMxnTlv0ppiPTGk5t3WWg8Ks1x5cRGUSu7WKSnyLJXvFNDn2ovkf4/wrMQDkAZc FnQ7aB4SPaE248ssEiByewyugu9G+WgauWt7L32bq8033W+Lfw5s467G18YJE/mLn/VZ tb8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=w8UtGXHxxOD7uSjdCIM7I57GrVcLCDRxU8RwJ5uXpKg=; b=F3X2agzUVvBsU9bga8zdgXyAXK6Wd0ehiimKojlaMtrzG++uKV9odjEXB7wOY++V4L PGhBSUnUec0Qv8MHbS3RQCG5J1oYAuOthG87yC5SIXfcnN9+H611eJzPUv7JQLQhSf0N Ft8Sg2t0zwR4cfQ5NfDGIhTM4XWRnvUfys5jpqUEJXoY/NZazK6I3g9TfbkcRAUN47Gw gsk/QPMSQretT6JbuQQXtBH3VXqki4kNg5YoDKo/+j7AcWbsTzKdvxfCrbGsET4bEhK6 CPuJZgcRBiJmwT2EtTNLnoIM+DxpXbrCjMO426kPMpC+KPvpM3hodC0xvWSZR9WLj36G FqxA== X-Gm-Message-State: APjAAAWiCazgSLPDtQRelGFpIJPs03dbg1OgzN5mWxegEjXv+9J3vqD6 386rp1AuzEScxypNbsU7KG47Svhz X-Google-Smtp-Source: APXvYqxS1WMkMUuKIMhyCZkbESuDo9MG1kMRMrR/TddUTBXGnM9HzGBEkDOtBIp4QSoyEdvgPPou4Q== X-Received: by 2002:a5d:4804:: with SMTP id l4mr7970098wrq.177.1551979816656; Thu, 07 Mar 2019 09:30:16 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 7 Mar 2019 18:29:17 +0100 Message-Id: <1551979804-6060-11-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551979804-6060-1-git-send-email-pbonzini@redhat.com> References: <1551979804-6060-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42a Subject: [Qemu-devel] [PULL 10/57] tests/libqos: arm/smdkc210 machine node X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, Emanuele Giuseppe Esposito , lviver@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Emanuele Giuseppe Esposito Add arm/smdkc210 machine machine to the graph. This machine contains generi= c-sdhci, so its constructor must take care of setting it properly when called. Signed-off-by: Emanuele Giuseppe Esposito Signed-off-by: Paolo Bonzini --- tests/Makefile.include | 1 + tests/libqos/arm-smdkc210-machine.c | 91 +++++++++++++++++++++++++++++++++= ++++ 2 files changed, 92 insertions(+) create mode 100644 tests/libqos/arm-smdkc210-machine.c diff --git a/tests/Makefile.include b/tests/Makefile.include index 41d248d..959d026 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -756,6 +756,7 @@ qos-test-obj-y +=3D tests/libqos/sdhci.o =20 # Machines qos-test-obj-y +=3D tests/libqos/arm-raspi2-machine.o +qos-test-obj-y +=3D tests/libqos/arm-smdkc210-machine.o qos-test-obj-y +=3D tests/libqos/x86_64_pc-machine.o =20 check-unit-y +=3D tests/test-qgraph$(EXESUF) diff --git a/tests/libqos/arm-smdkc210-machine.c b/tests/libqos/arm-smdkc21= 0-machine.c new file mode 100644 index 0000000..1fb9dfc --- /dev/null +++ b/tests/libqos/arm-smdkc210-machine.c @@ -0,0 +1,91 @@ +/* + * libqos driver framework + * + * Copyright (c) 2018 Emanuele Giuseppe Esposito + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see + */ + +#include "qemu/osdep.h" +#include "libqtest.h" +#include "libqos/malloc.h" +#include "libqos/qgraph.h" +#include "sdhci.h" + +#define ARM_PAGE_SIZE 4096 +#define SMDKC210_RAM_ADDR 0x40000000ull +#define SMDKC210_RAM_SIZE 0x40000000ull + +typedef struct QSmdkc210Machine QSmdkc210Machine; + +struct QSmdkc210Machine { + QOSGraphObject obj; + QGuestAllocator alloc; + QSDHCI_MemoryMapped sdhci; +}; + +static void *smdkc210_get_driver(void *object, const char *interface) +{ + QSmdkc210Machine *machine =3D object; + if (!g_strcmp0(interface, "memory")) { + return &machine->alloc; + } + + fprintf(stderr, "%s not present in arm/smdkc210\n", interface); + g_assert_not_reached(); +} + +static QOSGraphObject *smdkc210_get_device(void *obj, const char *device) +{ + QSmdkc210Machine *machine =3D obj; + if (!g_strcmp0(device, "generic-sdhci")) { + return &machine->sdhci.obj; + } + + fprintf(stderr, "%s not present in arm/smdkc210\n", device); + g_assert_not_reached(); +} + +static void smdkc210_destructor(QOSGraphObject *obj) +{ + QSmdkc210Machine *machine =3D (QSmdkc210Machine *) obj; + alloc_destroy(&machine->alloc); +} + +static void *qos_create_machine_arm_smdkc210(QTestState *qts) +{ + QSmdkc210Machine *machine =3D g_new0(QSmdkc210Machine, 1); + + alloc_init(&machine->alloc, 0, + SMDKC210_RAM_ADDR, + SMDKC210_RAM_ADDR + SMDKC210_RAM_SIZE, + ARM_PAGE_SIZE); + machine->obj.get_device =3D smdkc210_get_device; + machine->obj.get_driver =3D smdkc210_get_driver; + machine->obj.destructor =3D smdkc210_destructor; + qos_init_sdhci_mm(&machine->sdhci, qts, 0x12510000, &(QSDHCIProperties= ) { + .version =3D 2, + .baseclock =3D 0, + .capab.sdma =3D true, + .capab.reg =3D 0x5e80080, + }); + return &machine->obj; +} + +static void smdkc210_register_nodes(void) +{ + qos_node_create_machine("arm/smdkc210", qos_create_machine_arm_smdkc21= 0); + qos_node_contains("arm/smdkc210", "generic-sdhci", NULL); +} + +libqos_init(smdkc210_register_nodes); --=20 1.8.3.1