From nobody Sun Nov 9 22:32:27 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 1551983541879527.2927188060133; Thu, 7 Mar 2019 10:32:21 -0800 (PST) Received: from localhost ([127.0.0.1]:57018 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1xoY-0004H4-RI for importer@patchew.org; Thu, 07 Mar 2019 13:32:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1wrE-0003hw-JY for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:31:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1wrD-0008VS-Lx for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:31:00 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:39943) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h1wrD-0008U1-EQ for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:30:59 -0500 Received: by mail-wr1-x433.google.com with SMTP id y6so3260281wrn.7 for ; Thu, 07 Mar 2019 09:30:59 -0800 (PST) Received: from 640k.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id d206sm9979753wmc.11.2019.03.07.09.30.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 09:30:57 -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=1kYiaIpsHJwbj1Nj0iQD3FOYpTsBVhgkygF1GiEoV2E=; b=Z1DZz2jHh0kUjh5q8UKgR7FQfMXo0PT5nuGehKzXyk5nhxNWCqaqXO28drpyYYnNzK JgzDMMNhaWx8tnZOd0TkzxOqprHwwIMsUalYN04DykeKUgtFEJV5OUvQYX0FuWp6wtIu cTx7z1qELJ8i2awmDYINGl3Dp7MKqLePAJslcNgG+K4q7cqJE9VwlWPT14zzhXR8+i/1 ThW51eifQS1cHu+GRaOPYQUuRf3Sv3Tn7AugL5+RtjJJfSWT3R9ZMK+NWYeeB+rsNhry 41ly516dq9jPekQsVRNvCxEboFNah4Wi/GVt2uENVHZ0ZYYrtng07areYcNRqpnBbVP8 3XXg== 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=1kYiaIpsHJwbj1Nj0iQD3FOYpTsBVhgkygF1GiEoV2E=; b=LQWtQBMZ2iN55/kQNeiI8tKS+DW3+ccIaUdGlXiLXHB859kumpH1qMtIMrlaydbZX9 cMCydJzf26G0XMH+fhE4zUc7qfJ11vB7zXkdYGqtM2uMUgdquqEvezgCcvMvlKu7Ut0R rfknxVM5M/zpulEav7rz+ngNvlWKjqk+MXTvWYrrddjj8mS2WQpiOjDRjRADHA7fkfxK n0tp3ofwhWsozuiyFeqkdategiWHGtRWlo7RkEDJGwW6zIoDdqRfYaMPSVlMSGJjZDM7 b6AAqWF2Ge1eqVPjmXoAKvbtV2T0NU9bbhYm8NanasTbnDZk25imiWFYt6xUe2E2znfD 9O8w== X-Gm-Message-State: APjAAAWnCidvQ+vlFf2wBxvB8pck2ojt32rMr9ddhRRcz3cBo8RJ8g24 O+ABawyn4+EeNlg2yIleSEDVRmcp X-Google-Smtp-Source: APXvYqxsDGulam3buY+MlZlfMxiMWz2qSiW8k8S+xA3czGq4KFgewe0zcoBYyVfRxW2tZMp4TG+EHg== X-Received: by 2002:adf:ec07:: with SMTP id x7mr7461080wrn.174.1551979858142; Thu, 07 Mar 2019 09:30:58 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 7 Mar 2019 18:29:52 +0100 Message-Id: <1551979804-6060-46-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::433 Subject: [Qemu-devel] [PULL 45/57] qos-test: ac97 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/ac97-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/ac97-test.c | 47 ++++++++++++++++++++++++++++++++++++----------- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index b4b53ca..954b06b 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -159,7 +159,6 @@ check-qtest-pci-$(CONFIG_PCNET_PCI) +=3D tests/pcnet-te= st$(EXESUF) check-qtest-pci-$(CONFIG_EEPRO100_PCI) +=3D tests/eepro100-test$(EXESUF) check-qtest-pci-$(CONFIG_NE2000_PCI) +=3D tests/ne2000-test$(EXESUF) check-qtest-pci-$(CONFIG_NVME_PCI) +=3D tests/nvme-test$(EXESUF) -check-qtest-pci-$(CONFIG_AC97) +=3D tests/ac97-test$(EXESUF) check-qtest-pci-$(CONFIG_ES1370) +=3D tests/es1370-test$(EXESUF) check-qtest-pci-$(CONFIG_IPACK) +=3D tests/tpci200-test$(EXESUF) check-qtest-pci-$(CONFIG_IPACK) +=3D $(check-qtest-ipack-y) @@ -754,6 +753,7 @@ qos-test-obj-y +=3D tests/libqos/ppc64_pseries-machine.o qos-test-obj-y +=3D tests/libqos/x86_64_pc-machine.o =20 # 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/pci-test.o qos-test-obj-y +=3D tests/sdhci-test.o @@ -822,7 +822,6 @@ tests/drive_del-test$(EXESUF): tests/drive_del-test.o tests/nvme-test$(EXESUF): tests/nvme-test.o $(libqos-pc-obj-y) tests/pvpanic-test$(EXESUF): tests/pvpanic-test.o tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o -tests/ac97-test$(EXESUF): tests/ac97-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 diff --git a/tests/ac97-test.c b/tests/ac97-test.c index e0d177b..532fb1c 100644 --- a/tests/ac97-test.c +++ b/tests/ac97-test.c @@ -9,23 +9,48 @@ =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 QAC97 QAC97; + +struct QAC97 { + QOSGraphObject obj; + QPCIDevice dev; +}; + +static void *ac97_get_driver(void *obj, const char *interface) { + QAC97 *ac97 =3D obj; + + if (!g_strcmp0(interface, "pci-device")) { + return &ac97->dev; + } + + fprintf(stderr, "%s not present in e1000e\n", interface); + g_assert_not_reached(); } =20 -int main(int argc, char **argv) +static void *ac97_create(void *pci_bus, QGuestAllocator *alloc, void *addr) { - int ret; + QAC97 *ac97 =3D g_new0(QAC97, 1); + QPCIBus *bus =3D pci_bus; =20 - g_test_init(&argc, &argv, NULL); - qtest_add_func("/ac97/nop", nop); - - qtest_start("-device AC97"); - ret =3D g_test_run(); + qpci_device_init(&ac97->dev, bus, addr); + ac97->obj.get_driver =3D ac97_get_driver; + return &ac97->obj; +} =20 - qtest_end(); +static void ac97_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("AC97", ac97_create); + qos_node_produces("AC97", "pci-device"); + qos_node_consumes("AC97", "pci-bus", &opts); } + +libqos_init(ac97_register_nodes); --=20 1.8.3.1