From nobody Sat Apr 27 17:48:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1517846904818514.3340970633566; Mon, 5 Feb 2018 08:08:24 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6AFED61470; Mon, 5 Feb 2018 16:08:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C33C26046C; Mon, 5 Feb 2018 16:08:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BC5F018033D9; Mon, 5 Feb 2018 16:08:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w15G8JMW014566 for ; Mon, 5 Feb 2018 11:08:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 01D326064F; Mon, 5 Feb 2018 16:08:19 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.40.205.133]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D3CF6620D8 for ; Mon, 5 Feb 2018 16:08:14 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Mon, 5 Feb 2018 17:08:04 +0100 Message-Id: <20180205160805.29209-2-abologna@redhat.com> In-Reply-To: <20180205160805.29209-1-abologna@redhat.com> References: <20180205160805.29209-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH REBASE 1/2] tests: Add some tests for PCI controller options X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 05 Feb 2018 16:08:24 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The input configurations set all existing options for all PCI controllers, to see what ends up showing up in the output. Signed-off-by: Andrea Bolognani --- .../i440fx-controllers-pciopts.args | 24 +++++++ .../i440fx-controllers-pciopts.xml | 36 ++++++++++ .../pseries-controllers-pciopts.args | 22 +++++++ .../pseries-controllers-pciopts.xml | 35 ++++++++++ .../qemuxml2argvdata/q35-controllers-pciopts.args | 28 ++++++++ tests/qemuxml2argvdata/q35-controllers-pciopts.xml | 60 +++++++++++++++++ tests/qemuxml2argvtest.c | 17 +++++ .../i440fx-controllers-pciopts.xml | 45 +++++++++++++ .../pseries-controllers-pciopts.xml | 43 ++++++++++++ .../qemuxml2xmloutdata/q35-controllers-pciopts.xml | 76 ++++++++++++++++++= ++++ tests/qemuxml2xmltest.c | 17 +++++ 11 files changed, 403 insertions(+) create mode 100644 tests/qemuxml2argvdata/i440fx-controllers-pciopts.args create mode 100644 tests/qemuxml2argvdata/i440fx-controllers-pciopts.xml create mode 100644 tests/qemuxml2argvdata/pseries-controllers-pciopts.args create mode 100644 tests/qemuxml2argvdata/pseries-controllers-pciopts.xml create mode 100644 tests/qemuxml2argvdata/q35-controllers-pciopts.args create mode 100644 tests/qemuxml2argvdata/q35-controllers-pciopts.xml create mode 100644 tests/qemuxml2xmloutdata/i440fx-controllers-pciopts.xml create mode 100644 tests/qemuxml2xmloutdata/pseries-controllers-pciopts.xml create mode 100644 tests/qemuxml2xmloutdata/q35-controllers-pciopts.xml diff --git a/tests/qemuxml2argvdata/i440fx-controllers-pciopts.args b/tests= /qemuxml2argvdata/i440fx-controllers-pciopts.args new file mode 100644 index 000000000..d85fae5c9 --- /dev/null +++ b/tests/qemuxml2argvdata/i440fx-controllers-pciopts.args @@ -0,0 +1,24 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name guest \ +-S \ +-M pc \ +-m 1024 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-numa node,nodeid=3D0,cpus=3D0,mem=3D1024 \ +-uuid 496d7ea8-9739-544b-4ebd-ef08be936e8b \ +-nographic \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-guest/monitor.s= ock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-no-acpi \ +-boot c \ +-global i440FX-pcihost.pci-hole64-size=3D1024K \ +-device pci-bridge,chassis_nr=3D2,id=3Dpci.1,bus=3Dpci.0,addr=3D0x3 \ +-device pxb,bus_nr=3D3,id=3Dpci.2,numa_node=3D0,bus=3Dpci.0,addr=3D0x4 diff --git a/tests/qemuxml2argvdata/i440fx-controllers-pciopts.xml b/tests/= qemuxml2argvdata/i440fx-controllers-pciopts.xml new file mode 100644 index 000000000..861a66589 --- /dev/null +++ b/tests/qemuxml2argvdata/i440fx-controllers-pciopts.xml @@ -0,0 +1,36 @@ + + guest + 496d7ea8-9739-544b-4ebd-ef08be936e8b + 1048576 + 1 + + hvm + + + + + + + + /usr/bin/qemu-system-x86_64 + + + + 1024 + + + + + 0 + + + + + + 0 + + + + + + diff --git a/tests/qemuxml2argvdata/pseries-controllers-pciopts.args b/test= s/qemuxml2argvdata/pseries-controllers-pciopts.args new file mode 100644 index 000000000..5f1edfc83 --- /dev/null +++ b/tests/qemuxml2argvdata/pseries-controllers-pciopts.args @@ -0,0 +1,22 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-ppc64 \ +-name guest \ +-S \ +-M pseries \ +-m 1024 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-numa node,nodeid=3D0,cpus=3D0,mem=3D1024 \ +-uuid 496d7ea8-9739-544b-4ebd-ef08be936e8b \ +-nographic \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-guest/monitor.s= ock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-boot c \ +-device spapr-pci-host-bridge,index=3D1,id=3Dpci.1,numa_node=3D0 \ +-device pci-bridge,chassis_nr=3D3,id=3Dpci.2,bus=3Dpci.0,addr=3D0x1 diff --git a/tests/qemuxml2argvdata/pseries-controllers-pciopts.xml b/tests= /qemuxml2argvdata/pseries-controllers-pciopts.xml new file mode 100644 index 000000000..43353cba6 --- /dev/null +++ b/tests/qemuxml2argvdata/pseries-controllers-pciopts.xml @@ -0,0 +1,35 @@ + + guest + 496d7ea8-9739-544b-4ebd-ef08be936e8b + 1048576 + 1 + + hvm + + + + + + + + /usr/bin/qemu-system-ppc64 + + + + + + + + 0 + + + + + + 0 + + + + + + diff --git a/tests/qemuxml2argvdata/q35-controllers-pciopts.args b/tests/qe= muxml2argvdata/q35-controllers-pciopts.args new file mode 100644 index 000000000..44259f502 --- /dev/null +++ b/tests/qemuxml2argvdata/q35-controllers-pciopts.args @@ -0,0 +1,28 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name guest \ +-S \ +-M q35 \ +-m 1024 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-numa node,nodeid=3D0,cpus=3D0,mem=3D1024 \ +-uuid 496d7ea8-9739-544b-4ebd-ef08be936e8b \ +-nographic \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-guest/monitor.s= ock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-no-acpi \ +-boot c \ +-global q35-pcihost.pci-hole64-size=3D1024K \ +-device i82801b11-bridge,id=3Dpci.1,bus=3Dpcie.0,addr=3D0x1e \ +-device pci-bridge,chassis_nr=3D3,id=3Dpci.2,bus=3Dpci.1,addr=3D0x0 \ +-device pxb-pcie,bus_nr=3D4,id=3Dpci.3,numa_node=3D0,bus=3Dpcie.0,addr=3D0= x2 \ +-device pcie-root-port,port=3D0x5,chassis=3D5,id=3Dpci.4,bus=3Dpcie.0,addr= =3D0x3 \ +-device x3130-upstream,id=3Dpci.5,bus=3Dpci.4,addr=3D0x0 \ +-device xio3130-downstream,port=3D0x7,chassis=3D7,id=3Dpci.6,bus=3Dpci.5,a= ddr=3D0x0 diff --git a/tests/qemuxml2argvdata/q35-controllers-pciopts.xml b/tests/qem= uxml2argvdata/q35-controllers-pciopts.xml new file mode 100644 index 000000000..40db83615 --- /dev/null +++ b/tests/qemuxml2argvdata/q35-controllers-pciopts.xml @@ -0,0 +1,60 @@ + + guest + 496d7ea8-9739-544b-4ebd-ef08be936e8b + 1048576 + 1 + + hvm + + + + + + + + /usr/bin/qemu-system-x86_64 + + + + 1024 + + + + + 0 + + + + + + 0 + + + + + + 0 + + + + + + 0 + + + + + + 0 + + + + + + 0 + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index c8739909d..595b541d5 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2436,6 +2436,23 @@ mymain(void) QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_DEVICE_PXB_PCIE); =20 + DO_TEST("i440fx-controllers-pciopts", + QEMU_CAPS_I440FX_PCI_HOLE64_SIZE, + QEMU_CAPS_DEVICE_PCI_BRIDGE, + QEMU_CAPS_DEVICE_PXB); + DO_TEST("q35-controllers-pciopts", + QEMU_CAPS_Q35_PCI_HOLE64_SIZE, + QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, + QEMU_CAPS_DEVICE_PCI_BRIDGE, + QEMU_CAPS_DEVICE_PXB_PCIE, + QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, + QEMU_CAPS_DEVICE_X3130_UPSTREAM, + QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM); + DO_TEST("pseries-controllers-pciopts", + QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, + QEMU_CAPS_SPAPR_PCI_HOST_BRIDGE_NUMA_NODE, + QEMU_CAPS_DEVICE_PCI_BRIDGE); + DO_TEST("hostdev-scsi-lsi", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_DEVICE_SCSI_GENERIC); diff --git a/tests/qemuxml2xmloutdata/i440fx-controllers-pciopts.xml b/test= s/qemuxml2xmloutdata/i440fx-controllers-pciopts.xml new file mode 100644 index 000000000..d171d1370 --- /dev/null +++ b/tests/qemuxml2xmloutdata/i440fx-controllers-pciopts.xml @@ -0,0 +1,45 @@ + + guest + 496d7ea8-9739-544b-4ebd-ef08be936e8b + 1048576 + 1048576 + 1 + + hvm + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + 1024 + + + + + 0 + +
+ + + + + 0 + +
+ + + + + + + diff --git a/tests/qemuxml2xmloutdata/pseries-controllers-pciopts.xml b/tes= ts/qemuxml2xmloutdata/pseries-controllers-pciopts.xml new file mode 100644 index 000000000..bbe360e25 --- /dev/null +++ b/tests/qemuxml2xmloutdata/pseries-controllers-pciopts.xml @@ -0,0 +1,43 @@ + + guest + 496d7ea8-9739-544b-4ebd-ef08be936e8b + 1048576 + 1048576 + 1 + + hvm + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-ppc64 + + + + + + + + 0 + + + + + + 0 + +
+ + + + + + diff --git a/tests/qemuxml2xmloutdata/q35-controllers-pciopts.xml b/tests/q= emuxml2xmloutdata/q35-controllers-pciopts.xml new file mode 100644 index 000000000..5ef7aa564 --- /dev/null +++ b/tests/qemuxml2xmloutdata/q35-controllers-pciopts.xml @@ -0,0 +1,76 @@ + + guest + 496d7ea8-9739-544b-4ebd-ef08be936e8b + 1048576 + 1048576 + 1 + + hvm + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + 1024 + + + + + 0 + +
+ + + + + 0 + +
+ + + + + 0 + +
+ + + + + 0 + +
+ + + + + 0 + +
+ + + + + 0 + +
+ + + +
+ + + + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index d3544a1ef..48d774856 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1103,6 +1103,23 @@ mymain(void) QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_HDA_DUPLEX); =20 + DO_TEST("i440fx-controllers-pciopts", + QEMU_CAPS_I440FX_PCI_HOLE64_SIZE, + QEMU_CAPS_DEVICE_PCI_BRIDGE, + QEMU_CAPS_DEVICE_PXB); + DO_TEST("q35-controllers-pciopts", + QEMU_CAPS_Q35_PCI_HOLE64_SIZE, + QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, + QEMU_CAPS_DEVICE_PCI_BRIDGE, + QEMU_CAPS_DEVICE_PXB_PCIE, + QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, + QEMU_CAPS_DEVICE_X3130_UPSTREAM, + QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM); + DO_TEST("pseries-controllers-pciopts", + QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, + QEMU_CAPS_SPAPR_PCI_HOST_BRIDGE_NUMA_NODE, + QEMU_CAPS_DEVICE_PCI_BRIDGE); + DO_TEST("hostdev-scsi-vhost-scsi-ccw", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VHOST_SCSI, QEMU_CAPS_DEVICE_SCSI_GENERIC, QEMU_CAPS_VIRTIO_CCW); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 17:48:24 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1517846916078597.1209270876035; Mon, 5 Feb 2018 08:08:36 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7F05E83F46; Mon, 5 Feb 2018 16:08:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 458B45C54F; Mon, 5 Feb 2018 16:08:34 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CFCFF4A46D; Mon, 5 Feb 2018 16:08:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w15G8LKh014587 for ; Mon, 5 Feb 2018 11:08:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id AA11B60471; Mon, 5 Feb 2018 16:08:21 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.40.205.133]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0F2CB6064F for ; Mon, 5 Feb 2018 16:08:19 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Mon, 5 Feb 2018 17:08:05 +0100 Message-Id: <20180205160805.29209-3-abologna@redhat.com> In-Reply-To: <20180205160805.29209-1-abologna@redhat.com> References: <20180205160805.29209-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH REBASE 2/2] qemu: Clean up PCI controller options X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 05 Feb 2018 16:08:35 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Most of the options are only applicable to one or two controller types, so they should be filtered out everywhere else. This will reduce user confusion and, in at least one corner case, prevent guests from disappearing on daemon restart. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1483816 Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 117 +++++++++++++++++= ++++ .../pseries-controllers-pciopts.xml | 1 + .../i440fx-controllers-pciopts.xml | 7 +- tests/qemuxml2xmloutdata/pcie-expander-bus.xml | 4 +- .../pseries-controllers-pciopts.xml | 8 +- .../qemuxml2xmloutdata/q35-controllers-pciopts.xml | 21 +--- 6 files changed, 128 insertions(+), 30 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index df433c2f0..867f805bd 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4717,6 +4717,121 @@ qemuDomainShmemDefPostParse(virDomainShmemDefPtr sh= m) #define QEMU_USB_XHCI_MAXPORTS 15 =20 =20 +/** + * qemuDomainPCIControllerCleanupOpts: + * @cont: controller + * + * Clean up PCI options for @cont so that only options applicable to + * the controller model will actually be set. + */ +static void +qemuDomainPCIControllerCleanupOpts(const virDomainDef *def, + virDomainControllerDefPtr cont) +{ + if (cont->type !=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI) + return; + + /* pcihole64 and targetIndex */ + switch ((virDomainControllerModelPCI) cont->model) { + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: + /* These controllers support all options; however, + * targetIndex is only supported for pSeries guests and + * pcihole64 is only supported on x86 */ + if (!qemuDomainIsPSeries(def)) + cont->opts.pciopts.targetIndex =3D -1; + if (!ARCH_IS_X86(def->os.arch)) { + cont->opts.pciopts.pcihole64 =3D false; + cont->opts.pciopts.pcihole64size =3D 0; + } + break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: + case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS: + /* These controllers don't support any option */ + cont->opts.pciopts.pcihole64 =3D false; + cont->opts.pciopts.pcihole64size =3D 0; + ATTRIBUTE_FALLTHROUGH; + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: + /* These controllers support all options except targetIndex */ + cont->opts.pciopts.targetIndex =3D -1; + break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: + break; + } + + /* busNr and numaNode */ + switch ((virDomainControllerModelPCI) cont->model) { + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS: + /* These controllers support all options */ + break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: + case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT: + /* These controllers don't support any option */ + cont->opts.pciopts.numaNode =3D -1; + ATTRIBUTE_FALLTHROUGH; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: + /* These controllers support all options except busNr; however, + * numaNode is only supported for pSeries guests */ + cont->opts.pciopts.busNr =3D -1; + if (!qemuDomainIsPSeries(def)) + cont->opts.pciopts.numaNode =3D -1; + break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: + break; + } + + /* chassis and port */ + switch ((virDomainControllerModelPCI) cont->model) { + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT: + /* These controllers support all options */ + break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: + case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS: + /* These controllers don't support any option */ + cont->opts.pciopts.chassis =3D -1; + cont->opts.pciopts.port =3D -1; + break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: + break; + } + + /* chassisNr */ + switch ((virDomainControllerModelPCI) cont->model) { + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: + /* These controllers support all options */ + break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: + case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT: + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS: + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS: + /* These controllers don't support any option */ + cont->opts.pciopts.chassisNr =3D -1; + break; + case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST: + break; + } +} + + static int qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont, const virDomainDef *def, @@ -4799,6 +4914,8 @@ qemuDomainControllerDefPostParse(virDomainControllerD= efPtr cont, =20 case VIR_DOMAIN_CONTROLLER_TYPE_PCI: =20 + qemuDomainPCIControllerCleanupOpts(def, cont); + /* pSeries guests can have multiple pci-root controllers, * but other machine types only support a single one */ if (!qemuDomainIsPSeries(def) && diff --git a/tests/qemuxml2argvdata/pseries-controllers-pciopts.xml b/tests= /qemuxml2argvdata/pseries-controllers-pciopts.xml index 43353cba6..a3237ff2c 100644 --- a/tests/qemuxml2argvdata/pseries-controllers-pciopts.xml +++ b/tests/qemuxml2argvdata/pseries-controllers-pciopts.xml @@ -16,6 +16,7 @@ + 1024 diff --git a/tests/qemuxml2xmloutdata/i440fx-controllers-pciopts.xml b/test= s/qemuxml2xmloutdata/i440fx-controllers-pciopts.xml index d171d1370..d1868fdc2 100644 --- a/tests/qemuxml2xmloutdata/i440fx-controllers-pciopts.xml +++ b/tests/qemuxml2xmloutdata/i440fx-controllers-pciopts.xml @@ -20,19 +20,16 @@ /usr/bin/qemu-system-x86_64 - 1024 - - 0 - +
- + 0
diff --git a/tests/qemuxml2xmloutdata/pcie-expander-bus.xml b/tests/qemuxml= 2xmloutdata/pcie-expander-bus.xml index aaac423ca..b6498fd2e 100644 --- a/tests/qemuxml2xmloutdata/pcie-expander-bus.xml +++ b/tests/qemuxml2xmloutdata/pcie-expander-bus.xml @@ -36,9 +36,7 @@ - - 1 - +
diff --git a/tests/qemuxml2xmloutdata/pseries-controllers-pciopts.xml b/tes= ts/qemuxml2xmloutdata/pseries-controllers-pciopts.xml index bbe360e25..b5d646765 100644 --- a/tests/qemuxml2xmloutdata/pseries-controllers-pciopts.xml +++ b/tests/qemuxml2xmloutdata/pseries-controllers-pciopts.xml @@ -21,19 +21,17 @@ /usr/bin/qemu-system-ppc64 - + - + 0 - - 0 - +
diff --git a/tests/qemuxml2xmloutdata/q35-controllers-pciopts.xml b/tests/q= emuxml2xmloutdata/q35-controllers-pciopts.xml index 5ef7aa564..d8a014853 100644 --- a/tests/qemuxml2xmloutdata/q35-controllers-pciopts.xml +++ b/tests/qemuxml2xmloutdata/q35-controllers-pciopts.xml @@ -20,49 +20,36 @@ /usr/bin/qemu-system-x86_64 - 1024 - - 0 -
- - 0 - +
- + 0
- - 0 - +
- - 0 -
- - 0 - +
--=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list