From nobody Wed Nov 5 10:47:38 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1534155471685806.2150949313536; Mon, 13 Aug 2018 03:17:51 -0700 (PDT) Received: from localhost ([::1]:38499 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp9v4-00006R-HI for importer@patchew.org; Mon, 13 Aug 2018 06:17:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp9se-0007Av-7s for qemu-devel@nongnu.org; Mon, 13 Aug 2018 06:15:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fp9sc-00021b-Jf for qemu-devel@nongnu.org; Mon, 13 Aug 2018 06:15:20 -0400 Received: from mail-ed1-x544.google.com ([2a00:1450:4864:20::544]:36073) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fp9sc-00021H-CN; Mon, 13 Aug 2018 06:15:18 -0400 Received: by mail-ed1-x544.google.com with SMTP id k15-v6so7956602edr.3; Mon, 13 Aug 2018 03:15:18 -0700 (PDT) Received: from localhost.localdomain ([194.230.159.125]) by smtp.gmail.com with ESMTPSA id s27-v6sm11670006edb.73.2018.08.13.03.15.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Aug 2018 03:15:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Bb3sszE+EFrS+vfoKA0MZn6YKfDOmXnIhYEzeYILVlI=; b=VzsksFhZ9O7H3NEva/lpIbAqm4uLF/DkOvbQxjYnBLkhC6nHbOYczN4xH5TDFzvgyg hG21tE08UtEHsced6ZJM2WiUR2VK9rRKGQkv8JxZClELF14bHwf6zmzunVkqqM4ELYnz +JRYOCQ8lNMZ+MiZ/OQagE8opy2BLaAgi+y0X0RxB2+7/rfXNBCfSY92Szx2T4IkBBjv 0mhKvONkdKKUzbWc3l+bJsNiWIRxmkwW/Dym9AOmHEe+KgKmDqigxiKGwzpR4GolJCyE HCfvTXj4NmhLnzCkwIm5vqiv1TR2QkT6JNdxu6pj5Khmm7N9o95A9i8kCX0GJ0QhcoZI h/QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Bb3sszE+EFrS+vfoKA0MZn6YKfDOmXnIhYEzeYILVlI=; b=Wt4taNius+7niEryVXISWGj17KHLea44dKK/PbMEzEcmQbQq2dDR0zoqKhslsn21MR CqmRPxMNEN4yGvarylXwZVsmVlquU5/aFwlh/eZFHbCM6sSO6TxLPFZM8y2B1h2o2Hdt zne5PkMfiEwH+tWRPOL6o5iZ/fLk16zO43u/NSvNJ9mZjFrSiDmQhtuV5HAdWcf3cR7c zekWBCGJ4SwYxNDUjFOOsL/TbfTH1vF1RfiwLl00f1281VS1S8drC6KSqilLGtF6In+Z ucbpyZ8E1mPLhVmk38pTDHSJkpOzm4OdnlEL1BVvgz3xieEqMUbSSexxU6xrwKK5bq05 Kzag== X-Gm-Message-State: AOUpUlGyift4XOCDYkicvAwEI6q6px7NofOCat3l2mNK3M8B0cvCttZu PRNB5PLowrp/ltOhDyydoJczEte+SHI= X-Google-Smtp-Source: AA+uWPx8ZgR1kybzgEDw78MyM3mwjWMOWFfXHA5nrzNnV1TeyqtRNxcX/LkmuNGxT5V4SaUd4hNm3Q== X-Received: by 2002:a50:d1c7:: with SMTP id i7-v6mr21539516edg.169.1534155317082; Mon, 13 Aug 2018 03:15:17 -0700 (PDT) From: Emanuele Giuseppe Esposito To: qemu-devel@nongnu.org Date: Mon, 13 Aug 2018 12:14:27 +0200 Message-Id: <20180813101453.10200-8-e.emanuelegiuseppe@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180813101453.10200-1-e.emanuelegiuseppe@gmail.com> References: <20180813101453.10200-1-e.emanuelegiuseppe@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::544 Subject: [Qemu-devel] [PATCH 07/33] tests/qgraph: arm/raspi2 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: Laurent Vivier , Fam Zheng , qemu-block@nongnu.org, "Michael S. Tsirkin" , Jason Wang , Amit Shah , Emanuele Giuseppe Esposito , Alexander Graf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Greg Kurz , qemu-ppc@nongnu.org, Gerd Hoffmann , Stefan Hajnoczi , Paolo Bonzini , John Snow , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add arm/raspi2 machine to the graph. This machine contains a generic-sdhci,= so its constructor must take care of setting it properly when called. Signed-off-by: Emanuele Giuseppe Esposito --- tests/Makefile.include | 1 + tests/libqos/raspi2-machine.c | 82 +++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 tests/libqos/raspi2-machine.c diff --git a/tests/Makefile.include b/tests/Makefile.include index c4c7c8d56a..67dbec0d35 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -769,6 +769,7 @@ libqos-usb-obj-y =3D $(libqos-spapr-obj-y) $(libqos-pc-= obj-y) tests/libqos/usb.o libqos-virtio-obj-y =3D $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/lib= qos/virtio.o tests/libqos/virtio-pci.o tests/libqos/virtio-mmio.o tests/lib= qos/malloc-generic.o =20 libqgraph-machines-obj-y =3D tests/libqos/x86_64_pc-machine.o +libqgraph-machines-obj-y +=3D tests/libqos/raspi2-machine.o =20 libqgraph-pci-obj-y =3D $(libqos-pc-obj-y) libqgraph-pci-obj-y +=3D $(libqgraph-machines-obj-y) diff --git a/tests/libqos/raspi2-machine.c b/tests/libqos/raspi2-machine.c new file mode 100644 index 0000000000..72fe7f3d4f --- /dev/null +++ b/tests/libqos/raspi2-machine.c @@ -0,0 +1,82 @@ +/* + * 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" + +typedef struct QRaspi2Machine QRaspi2Machine; + +struct QRaspi2Machine { + QOSGraphObject obj; + QGuestAllocator *alloc; + QSDHCI_MemoryMapped sdhci; +}; + +static void raspi2_destructor(QOSGraphObject *obj) +{ + g_free(obj); +} + +static void *raspi2_get_driver(void *object, const char *interface) +{ + QRaspi2Machine *machine =3D object; + if (!g_strcmp0(interface, "memory")) { + return &machine->alloc; + } + + fprintf(stderr, "%s not present in arm/raspi2\n", interface); + g_assert_not_reached(); +} + +static QOSGraphObject *raspi2_get_device(void *obj, const char *device) +{ + QRaspi2Machine *machine =3D obj; + if (!g_strcmp0(device, "generic-sdhci")) { + return &machine->sdhci.obj; + } + + fprintf(stderr, "%s not present in arm/raspi2\n", device); + g_assert_not_reached(); +} + +static void *qos_create_machine_arm_raspi2(void) +{ + QRaspi2Machine *machine =3D g_new0(QRaspi2Machine, 1); + + machine->obj.get_device =3D raspi2_get_device; + machine->obj.get_driver =3D raspi2_get_driver; + machine->obj.destructor =3D raspi2_destructor; + qos_init_sdhci_smm(&machine->sdhci, 0x3f300000, &(QSDHCIProperties) { + .version =3D 3, + .baseclock =3D 52, + .capab.sdma =3D false, + .capab.reg =3D 0x052134b4 + }); + return &machine->obj; +} + +static void raspi2_register_nodes(void) +{ + qos_node_create_machine("arm/raspi2", qos_create_machine_arm_raspi2); + qos_node_contains("arm/raspi2", "generic-sdhci", NULL); +} + +libqos_init(raspi2_register_nodes); --=20 2.17.1