From nobody Sun Nov 9 22:30:04 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1551983708023972.2486387982258; Thu, 7 Mar 2019 10:35:08 -0800 (PST) Received: from localhost ([127.0.0.1]:57043 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1xrB-0006VQ-R9 for importer@patchew.org; Thu, 07 Mar 2019 13:35:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1wrP-0003tR-Jh for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:31:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1wrO-0000Cf-OR for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:31:11 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:37351) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h1wrO-0000Bx-GK for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:31:10 -0500 Received: by mail-wr1-x431.google.com with SMTP id w6so18402177wrs.4 for ; Thu, 07 Mar 2019 09:31:10 -0800 (PST) Received: from 640k.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id d206sm9979753wmc.11.2019.03.07.09.31.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 09:31:08 -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=ZHhwnRHJEsoG4vIZAnHBm3h4uUH8V2/QXeg39Cfj7T0=; b=LThQrrVTs00urGzPiCb+IqzWKrpRuPuHN3mf+VT0M60oVhAA4lOLEaBZnodiTsD5Jx RR1b8/lBR9Z+APAgHvCZzajlnqqlwDK2vYiMZ1aek8mo2NaCkUiOq+VkUw0RSJwUFQXo Zfm2o3LQRE4bBy6Jhrbrrd49T0CZc69CEm2qfWtbQ/7iwMrtx0q3qxhAhu6sf67L39yD lzJbeSx5JychO1BzQrZaBQwO0U/UqvfQYvcYHX25HmV5Hqi95Pdj7fxJMvGMoOVMcJZy BaWgYOm4ZS2JIjA7pbQ1R8lul3GnWGT1cHE6FMOuPyaINPWVRyFLID8yiM0iiFV0jmLn KIgg== 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=ZHhwnRHJEsoG4vIZAnHBm3h4uUH8V2/QXeg39Cfj7T0=; b=Zo5iiNM7cgDgzytr1LwlWFpJs0PBwgKqbT6mmLmA4g0d9PiRq+JR26+qk7QlWFw2ai gEn0NlhBrtp5zM4pDdfUnVNiV4LDDTMWnRshM1oNtVySW+cQECr8wjAHbX3SNhzr0Ma2 uaNnhEnkFShnCzaMJP5YpmgIvPp1Iw8Z7J6yB8qNW+toBKCAwECe0IJyDYzM0sl9fiiU 8Vom+8ANMmb3BA6vwtZwuYsJUlGFFfFbVxRo11J+oY+CCDjPCZjuwBQn167UwF4ja2Tq wfNya8Wa40Z5falO2AF/8TE3FbiAXSdmsAqDhi+jiCayjy6kvrZ9JDDV7Hh0ucHCrIW6 ZitA== X-Gm-Message-State: APjAAAX49mS/6d6ieSj8yEhR/hhvGtzeqGps71zbl5NggBDz3HxT0oc5 42rPaxxDlv9MIm9LyLd99mVcIpTb X-Google-Smtp-Source: APXvYqw2/Up2P8QBv79yAVLY5OA5UaFQcNwTTRausqYScQFo981Q9CxmxSqT9H1HGsKGCRUZ0/zLMg== X-Received: by 2002:adf:d0c9:: with SMTP id z9mr7646414wrh.132.1551979869213; Thu, 07 Mar 2019 09:31:09 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 7 Mar 2019 18:30:01 +0100 Message-Id: <1551979804-6060-55-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::431 Subject: [Qemu-devel] [PULL 54/57] qos-test: es1370 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/es1370-test to a driver node; currently it runs the PCI nop test only, therefore we're not placing it in tests/libqos. Signed-off-by: Emanuele Giuseppe Esposito Signed-off-by: Paolo Bonzini --- tests/Makefile.include | 3 +-- tests/es1370-test.c | 46 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 5be98d7..4a387b6 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -154,7 +154,6 @@ check-qtest-generic-y +=3D tests/cdrom-test$(EXESUF) 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_ES1370) +=3D tests/es1370-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) @@ -745,6 +744,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/es1370-test.o qos-test-obj-y +=3D tests/ipoctal232-test.o qos-test-obj-y +=3D tests/ne2000-test.o qos-test-obj-y +=3D tests/nvme-test.o @@ -812,7 +812,6 @@ tests/device-plug-test$(EXESUF): tests/device-plug-test= .o tests/drive_del-test$(EXESUF): tests/drive_del-test.o tests/pvpanic-test$(EXESUF): tests/pvpanic-test.o tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o -tests/es1370-test$(EXESUF): tests/es1370-test.o tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o tests/usb-hcd-uhci-test$(EXESUF): tests/usb-hcd-uhci-test.o $(libqos-usb-o= bj-y) diff --git a/tests/es1370-test.c b/tests/es1370-test.c index 199fe19..d845cd0 100644 --- a/tests/es1370-test.c +++ b/tests/es1370-test.c @@ -9,23 +9,49 @@ =20 #include "qemu/osdep.h" #include "libqtest.h" +#include "libqos/qgraph.h" +#include "libqos/pci.h" =20 -/* Tests only initialization so far. TODO: Replace with functional tests */ -static void nop(void) +typedef struct QES1370 QES1370; + +struct QES1370 { + QOSGraphObject obj; + QPCIDevice dev; +}; + +static void *es1370_get_driver(void *obj, const char *interface) { + QES1370 *es1370 =3D obj; + + if (!g_strcmp0(interface, "pci-device")) { + return &es1370->dev; + } + + fprintf(stderr, "%s not present in e1000e\n", interface); + g_assert_not_reached(); } =20 -int main(int argc, char **argv) +static void *es1370_create(void *pci_bus, QGuestAllocator *alloc, void *ad= dr) { - int ret; + QES1370 *es1370 =3D g_new0(QES1370, 1); + QPCIBus *bus =3D pci_bus; =20 - g_test_init(&argc, &argv, NULL); - qtest_add_func("/es1370/nop", nop); + qpci_device_init(&es1370->dev, bus, addr); + es1370->obj.get_driver =3D es1370_get_driver; =20 - qtest_start("-device ES1370"); - ret =3D g_test_run(); + return &es1370->obj; +} =20 - qtest_end(); +static void es1370_register_nodes(void) +{ + QOSGraphEdgeOptions opts =3D { + .extra_device_opts =3D "addr=3D04.0", + }; + add_qpci_address(&opts, &(QPCIAddress) { .devfn =3D QPCI_DEVFN(4, 0) }= ); =20 - return ret; + qos_node_create_driver("ES1370", es1370_create); + qos_node_consumes("ES1370", "pci-bus", &opts); + qos_node_produces("ES1370", "pci-device"); } + +libqos_init(es1370_register_nodes); --=20 1.8.3.1