From nobody Sun Nov 9 22:30:05 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 1551982642771577.9546086803098; Thu, 7 Mar 2019 10:17:22 -0800 (PST) Received: from localhost ([127.0.0.1]:56768 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1xa2-00008X-HP for importer@patchew.org; Thu, 07 Mar 2019 13:17:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40061) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1wrR-0003v6-4i for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:31:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1wrQ-0000Dm-69 for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:31:13 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:39174) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h1wrP-0000D9-TV for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:31:12 -0500 Received: by mail-wr1-x432.google.com with SMTP id l12so1952282wrp.6 for ; Thu, 07 Mar 2019 09:31:11 -0800 (PST) Received: from 640k.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id d206sm9979753wmc.11.2019.03.07.09.31.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 09:31:10 -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=AQV/Hv4hmIISmxy4lWfaADhegjquDxkFpQ+v8CbihNI=; b=RRV0PAr7SCrzemkK6cmG1Syw0HMd8Mo1OQrDCjUXqaxOdp+a58Id5y6Z+zYNUGtLbk cC4GEVHfeVGaFHYB4RfshM0r4FuXwB0FeSQC/NuiFQVFoqM3R9JMXBghASOrMrrK0+vC 5IPwkTX3zex4VZ3Gf66HSpoIGi9ZrG+TZ1S5OQ/lGrtGq/Y9aIQGkpgOhoCwj8/rFsCr k46lJeEjXYhaej35rhpxIMJmnAZVOcI3+wChP+2QtrSpyObstejqGQ9nHhIitVWPsBPp ZllrhzesJhWX2nESD8RNQJqrFkbkzM1vyNY10MM+bnwJYsEWJTYCxWJuOFJIm7cWCs2a yzvQ== 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=AQV/Hv4hmIISmxy4lWfaADhegjquDxkFpQ+v8CbihNI=; b=dra7hgLW/vbPftvVAVHP9tE2jmWRt+vd86yzPWYT89u7LJFRvO80KzMGKsG6N/4qfV 4yZulcdn4dFaQOwjbEjMZmBlgL/TaDLzh+WUDfqrWpGx8f05IoSf5ikqCeyaX+dPrtRp a4LR+DNXw9u9sFjBtK9vJXeAqciVpNkIU6XmlOv6HUukddMpRXNI0Qn2b3LcChSsj151 LHFjItfM5EDUMvfQePm1WPCV/uIVPXRqQLzGbRGBJBfvFr4yM74q2sUuPJeExy0Ue/QG PqgsQU6Gnj5w1ByY74qMAQqWEKP+ahdL97Qhxp0z4NFPCZvGY3wYPBqYQH5RDGY7p/B5 ZRSw== X-Gm-Message-State: APjAAAUtBnKmbSxlXGKZXhfHD8f35DIg1JIUmf+hv7ui7gF2PWefmGqn HQofH2AK2Za5gBZdt280Ix6kDmbU X-Google-Smtp-Source: APXvYqw29TesZpkya2oc6mg/Q/sOhDp6fgXxkkmhgTV2ghl2Ha+V6SIo5OYAqdJE2DVsSuk4C9yP3g== X-Received: by 2002:adf:b687:: with SMTP id j7mr8113782wre.81.1551979870702; Thu, 07 Mar 2019 09:31:10 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 7 Mar 2019 18:30:02 +0100 Message-Id: <1551979804-6060-56-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::432 Subject: [Qemu-devel] [PULL 55/57] qos-test: eepro100 test 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 Convert tests/eepro100-test to a driver node; currently it runs the PCI nop test only, therefore we're not placing it in tests/libqos. For now, all nodes share the same constructor and destructor. Signed-off-by: Emanuele Giuseppe Esposito Signed-off-by: Paolo Bonzini --- tests/Makefile.include | 3 +-- tests/eepro100-test.c | 65 +++++++++++++++++++++++++++++++---------------= ---- 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 4a387b6..befeb8f 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -153,7 +153,6 @@ check-qtest-generic-y +=3D tests/cdrom-test$(EXESUF) =20 check-qtest-pci-y +=3D tests/e1000-test$(EXESUF) check-qtest-pci-$(CONFIG_RTL8139_PCI) +=3D tests/rtl8139-test$(EXESUF) -check-qtest-pci-$(CONFIG_EEPRO100_PCI) +=3D tests/eepro100-test$(EXESUF) check-qtest-pci-$(CONFIG_VGA) +=3D tests/display-vga-test$(EXESUF) check-qtest-pci-$(CONFIG_HDA) +=3D tests/intel-hda-test$(EXESUF) check-qtest-pci-$(CONFIG_IVSHMEM_DEVICE) +=3D tests/ivshmem-test$(EXESUF) @@ -744,6 +743,7 @@ qos-test-obj-y +=3D tests/libqos/x86_64_pc-machine.o # Tests qos-test-obj-y +=3D tests/ac97-test.o qos-test-obj-y +=3D tests/e1000e-test.o +qos-test-obj-y +=3D tests/eepro100-test.o qos-test-obj-y +=3D tests/es1370-test.o qos-test-obj-y +=3D tests/ipoctal232-test.o qos-test-obj-y +=3D tests/ne2000-test.o @@ -800,7 +800,6 @@ tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqo= s-pc-obj-y) tests/e1000-test$(EXESUF): tests/e1000-test.o tests/rtl8139-test$(EXESUF): tests/rtl8139-test.o $(libqos-pc-obj-y) tests/pnv-xscom-test$(EXESUF): tests/pnv-xscom-test.o -tests/eepro100-test$(EXESUF): tests/eepro100-test.o tests/wdt_ib700-test$(EXESUF): tests/wdt_ib700-test.o tests/tco-test$(EXESUF): tests/tco-test.o $(libqos-pc-obj-y) tests/virtio-ccw-test$(EXESUF): tests/virtio-ccw-test.o diff --git a/tests/eepro100-test.c b/tests/eepro100-test.c index bdc8a67..90b5c1a 100644 --- a/tests/eepro100-test.c +++ b/tests/eepro100-test.c @@ -9,23 +9,15 @@ =20 #include "qemu/osdep.h" #include "libqtest.h" +#include "libqos/qgraph.h" +#include "libqos/pci.h" =20 -static void test_device(gconstpointer data) -{ - const char *model =3D data; - QTestState *s; - char *args; - - args =3D g_strdup_printf("-device %s", model); - s =3D qtest_start(args); - - /* Tests only initialization so far. TODO: Implement functional tests = */ +typedef struct QEEPRO100 QEEPRO100; =20 - if (s) { - qtest_quit(s); - } - g_free(args); -} +struct QEEPRO100 { + QOSGraphObject obj; + QPCIDevice dev; +}; =20 static const char *models[] =3D { "i82550", @@ -43,19 +35,42 @@ static const char *models[] =3D { "i82801", }; =20 -int main(int argc, char **argv) +static void *eepro100_get_driver(void *obj, const char *interface) { - int i; + QEEPRO100 *eepro100 =3D obj; =20 - g_test_init(&argc, &argv, NULL); + if (!g_strcmp0(interface, "pci-device")) { + return &eepro100->dev; + } =20 - for (i =3D 0; i < ARRAY_SIZE(models); i++) { - char *path; + fprintf(stderr, "%s not present in eepro100\n", interface); + g_assert_not_reached(); +} =20 - path =3D g_strdup_printf("eepro100/%s", models[i]); - qtest_add_data_func(path, models[i], test_device); - g_free(path); - } +static void *eepro100_create(void *pci_bus, QGuestAllocator *alloc, void *= addr) +{ + QEEPRO100 *eepro100 =3D g_new0(QEEPRO100, 1); + QPCIBus *bus =3D pci_bus; + + qpci_device_init(&eepro100->dev, bus, addr); + eepro100->obj.get_driver =3D eepro100_get_driver; + + return &eepro100->obj; +} + +static void eepro100_register_nodes(void) +{ + int i; + QOSGraphEdgeOptions opts =3D { + .extra_device_opts =3D "addr=3D04.0", + }; =20 - return g_test_run(); + add_qpci_address(&opts, &(QPCIAddress) { .devfn =3D QPCI_DEVFN(4, 0) }= ); + for (i =3D 0; i < ARRAY_SIZE(models); i++) { + qos_node_create_driver(models[i], eepro100_create); + qos_node_consumes(models[i], "pci-bus", &opts); + qos_node_produces(models[i], "pci-device"); + } } + +libqos_init(eepro100_register_nodes); --=20 1.8.3.1