From nobody Sun Nov 9 22:27: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 1551983331200289.1852570308971; Thu, 7 Mar 2019 10:28:51 -0800 (PST) Received: from localhost ([127.0.0.1]:56942 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1xl9-0001Ez-VJ for importer@patchew.org; Thu, 07 Mar 2019 13:28:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39934) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1wrF-0003jX-VD for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:31:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1wrE-0008WU-L2 for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:31:01 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:35880) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h1wrE-0008VW-Ct for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:31:00 -0500 Received: by mail-wr1-x431.google.com with SMTP id o17so18422043wrw.3 for ; Thu, 07 Mar 2019 09:31:00 -0800 (PST) Received: from 640k.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id d206sm9979753wmc.11.2019.03.07.09.30.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 09:30:58 -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=c8ylAQm2QIUCpEPMIiXz7S8toiAAcf2ahnhOxiZk3Qg=; b=ZQJC7IsOo1BV0U0IgoFOIOyCMLdLCkKTkpx3FrIrBodB2vwWDix5ZxT6onhEMa+rH5 pilI/FYHhKK773pTh7TQ75E+l6f93TsN6vg3d6C8DsZ80SRtGgQaM0okhYL/FuHbeEzq jUby9UFtO4EDBxLU9l8VwCTH2FzNv/0Z/XEQyAAllOpV4IzTdvJ2+eXDC3O06Q5tTxEL f9wJxVJKOzhy93tzfzcd2caEZihgmR7KbtHs76VVIp5t4pGkeuMkDMBb9mPasCZ7nnPl eW8TEubpI3J0r/Pia97y7KQg0fo8KtzboG9vuQa1U8ixvW+MArwSaYAgVpBNJFCVphWd VXVA== 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=c8ylAQm2QIUCpEPMIiXz7S8toiAAcf2ahnhOxiZk3Qg=; b=kNE8qS/GaCV9SGKYmsITcVMhYPTEYvoqKiHCOhRkg5k5xFCH2XD1r4RM9659kUMw2S zKV0Z61crsKk/A1SeAvqpynE4ailAgojwnf7XO6f3Ul7t9tCK3s7YD5wmWHEkHvB9Ruq EMydoscZwzKATmaXSuNXQP/JarFK5uHkOUo5IPQSsOnhnzQRJseP97pvIBudlIqC0Ae7 F3HzMFeK1VUNGmHMyEVQ220XZAcKG++QqrwWMkuqUtag3GSfTO0q4oaJSj/rDnAxqcaN 1mEyc9K/munC16w+/e7cU6Kqg/iKijA5/Kacb2xNamwmXqKPswFDRFWEyQ7S3nmhsh7d wfSw== X-Gm-Message-State: APjAAAU3R5eyeDfuYC95+0krNlSGORiRUQHMcE9jKbw0L7SBkhFz2SzT c1R+vtk/vj0y6WYVHGPwuyj47FVr X-Google-Smtp-Source: APXvYqxj+f8t5YYerXwRuxaIWnsLGpRd1PyQ/6kw3+PnruKe6yo5fsgChFEK8bivo83oimdduLhDcg== X-Received: by 2002:a5d:5042:: with SMTP id h2mr7728716wrt.12.1551979859031; Thu, 07 Mar 2019 09:30:59 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 7 Mar 2019 18:29:53 +0100 Message-Id: <1551979804-6060-47-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 46/57] qos-test: tpci200 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/tpci200-test to a driver node; currently it runs the PCI nop test only, but it also produces the ipack interface. Signed-off-by: Emanuele Giuseppe Esposito Signed-off-by: Paolo Bonzini --- tests/Makefile.include | 3 +-- tests/libqos/tpci200.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ tests/tpci200-test.c | 31 ------------------------ 3 files changed, 66 insertions(+), 33 deletions(-) create mode 100644 tests/libqos/tpci200.c delete mode 100644 tests/tpci200-test.c diff --git a/tests/Makefile.include b/tests/Makefile.include index 954b06b..905a361 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -160,7 +160,6 @@ check-qtest-pci-$(CONFIG_EEPRO100_PCI) +=3D tests/eepro= 100-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_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) check-qtest-pci-$(CONFIG_VGA) +=3D tests/display-vga-test$(EXESUF) check-qtest-pci-$(CONFIG_HDA) +=3D tests/intel-hda-test$(EXESUF) @@ -731,6 +730,7 @@ qos-test-obj-y =3D tests/qos-test.o $(libqgraph-obj-y) qos-test-obj-y +=3D $(libqos-pc-obj-y) $(libqos-spapr-obj-y) qos-test-obj-y +=3D tests/libqos/e1000e.o qos-test-obj-y +=3D tests/libqos/sdhci.o +qos-test-obj-y +=3D tests/libqos/tpci200.o qos-test-obj-y +=3D tests/libqos/virtio.o qos-test-obj-$(CONFIG_VIRTFS) +=3D tests/libqos/virtio-9p.o qos-test-obj-y +=3D tests/libqos/virtio-balloon.o @@ -811,7 +811,6 @@ tests/ne2000-test$(EXESUF): tests/ne2000-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 -tests/tpci200-test$(EXESUF): tests/tpci200-test.o tests/display-vga-test$(EXESUF): tests/display-vga-test.o tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o tests/qom-test$(EXESUF): tests/qom-test.o diff --git a/tests/libqos/tpci200.c b/tests/libqos/tpci200.c new file mode 100644 index 0000000..98dc532 --- /dev/null +++ b/tests/libqos/tpci200.c @@ -0,0 +1,65 @@ +/* + * QTest testcase for tpci200 PCI-IndustryPack bridge + * + * Copyright (c) 2014 SUSE LINUX Products GmbH + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "libqtest.h" +#include "libqos/qgraph.h" +#include "libqos/pci.h" + +typedef struct QTpci200 QTpci200; +typedef struct QIpack QIpack; + +struct QIpack { + +}; +struct QTpci200 { + QOSGraphObject obj; + QPCIDevice dev; + QIpack ipack; +}; + +/* tpci200 */ +static void *tpci200_get_driver(void *obj, const char *interface) +{ + QTpci200 *tpci200 =3D obj; + if (!g_strcmp0(interface, "ipack")) { + return &tpci200->ipack; + } + if (!g_strcmp0(interface, "pci-device")) { + return &tpci200->dev; + } + + fprintf(stderr, "%s not present in tpci200\n", interface); + g_assert_not_reached(); +} + +static void *tpci200_create(void *pci_bus, QGuestAllocator *alloc, void *a= ddr) +{ + QTpci200 *tpci200 =3D g_new0(QTpci200, 1); + QPCIBus *bus =3D pci_bus; + + qpci_device_init(&tpci200->dev, bus, addr); + tpci200->obj.get_driver =3D tpci200_get_driver; + return &tpci200->obj; +} + +static void tpci200_register_nodes(void) +{ + QOSGraphEdgeOptions opts =3D { + .extra_device_opts =3D "addr=3D04.0,id=3Dipack0", + }; + add_qpci_address(&opts, &(QPCIAddress) { .devfn =3D QPCI_DEVFN(4, 0) }= ); + + qos_node_create_driver("tpci200", tpci200_create); + qos_node_consumes("tpci200", "pci-bus", &opts); + qos_node_produces("tpci200", "ipack"); + qos_node_produces("tpci200", "pci-device"); +} + +libqos_init(tpci200_register_nodes); diff --git a/tests/tpci200-test.c b/tests/tpci200-test.c deleted file mode 100644 index 0321ec2..0000000 --- a/tests/tpci200-test.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * QTest testcase for tpci200 PCI-IndustryPack bridge - * - * Copyright (c) 2014 SUSE LINUX Products GmbH - * - * This work is licensed under the terms of the GNU GPL, version 2 or late= r. - * See the COPYING file in the top-level directory. - */ - -#include "qemu/osdep.h" -#include "libqtest.h" - -/* Tests only initialization so far. TODO: Replace with functional tests */ -static void nop(void) -{ -} - -int main(int argc, char **argv) -{ - int ret; - - g_test_init(&argc, &argv, NULL); - qtest_add_func("/tpci200/nop", nop); - - qtest_start("-device tpci200"); - ret =3D g_test_run(); - - qtest_end(); - - return ret; -} --=20 1.8.3.1