From nobody Sun Feb 8 16:30:57 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1645622583335961.2641779956919; Wed, 23 Feb 2022 05:23:03 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-531-fq45OaO1MM2c4tXS3ZG3yA-1; Wed, 23 Feb 2022 08:22:51 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 75A1F1091DB1; Wed, 23 Feb 2022 13:22:44 +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 4E78184974; Wed, 23 Feb 2022 13:22:44 +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 0EFA51807D67; Wed, 23 Feb 2022 13:22:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21NDKZ7N029842 for ; Wed, 23 Feb 2022 08:20:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9E839401DB1; Wed, 23 Feb 2022 13:20:35 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 999F95361F9 for ; Wed, 23 Feb 2022 13:20:35 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7DD42800883 for ; Wed, 23 Feb 2022 13:20:35 +0000 (UTC) Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-500-4XX1-wd5M-q-Sd3iuNeohg-1; Wed, 23 Feb 2022 08:20:33 -0500 Received: by mail-oi1-f175.google.com with SMTP id s5so18189910oic.10 for ; Wed, 23 Feb 2022 05:20:33 -0800 (PST) Received: from rekt.ibmuc.com ([191.193.99.92]) by smtp.gmail.com with ESMTPSA id a4sm27646154oaa.42.2022.02.23.05.20.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 05:20:32 -0800 (PST) X-MC-Unique: fq45OaO1MM2c4tXS3ZG3yA-1 X-MC-Unique: 4XX1-wd5M-q-Sd3iuNeohg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uAz5i9X8guNG/xwZMRIcTjIAD0gT/0oKIBYLNfqz/qg=; b=m8ZEq3/VvjifLp7OpeH5Wm2zv9L3FcKNCBTbwMAhy3TLmtMnDB+rULP0yMSrk6GlIy 7FzPCWYHfANliJlcklNWzHhuxCrplV6m3tyYGPG6AC/uvjt6JE6yPYcwVM7DORZkytbt 9KgYwazO7500PhBdWv5vqNBxLlRlCv5xc+WjiqzHm8RnCmku41LXejk4avkdu2E1WZUc 4/y0z9usvYDOYKgEfC/a4E+umIESms6OAaVJGSN5DWYLcpM01+pWL7Vx2Qae5Mu06SOS OHXNJXHBfgY4h8l/2EKGVibkDohHQ2SjH8T/44/DnjtMjjaUmwfEleGFx5QOo1qwSzls usTw== X-Gm-Message-State: AOAM533YxxLE7ALxinmTZqImVtZwa7ooZ0viXCy40Aw3EdwUpx4FRJNs nKIj8D5Ly+ydd759Z0K81mnXlw1PhLo= X-Google-Smtp-Source: ABdhPJxImg+N1UZN2Az/ZbR/jE9In847IN4YxLuv3h4DcwtUrSO/8JjC16rZB7ZoKtoot1quKT8UFA== X-Received: by 2002:a05:6808:1446:b0:2d5:281f:9cda with SMTP id x6-20020a056808144600b002d5281f9cdamr4564033oiv.13.1645622432943; Wed, 23 Feb 2022 05:20:32 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v3 22/29] domain_validate.c: allow targetIndex 0 out of idx 0 for PowerNV PHBs Date: Wed, 23 Feb 2022 10:19:45 -0300 Message-Id: <20220223131952.922228-23-danielhb413@gmail.com> In-Reply-To: <20220223131952.922228-1-danielhb413@gmail.com> References: <20220223131952.922228-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-loop: libvir-list@redhat.com Cc: danielhb413@gmail.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1645622585628100012 Content-Type: text/plain; charset="utf-8" PowerNV PHBs uses the 'targetIndex' attribute in a different manner than pSeries PHBs, having no restiction of targetIndex =3D 0 in controllers with non-zero indexes. This can happen when the domain has 2 or more sockets and the pnv-phb3 controller can have targetIndex=3D0 in a different chip-id. Signed-off-by: Daniel Henrique Barboza --- src/conf/domain_validate.c | 5 ++- src/qemu/qemu_domain.c | 2 +- src/qemu/qemu_validate.c | 5 +++ .../powernv8-two-sockets.ppc64-latest.args | 35 +++++++++++++++++ .../qemuxml2argvdata/powernv8-two-sockets.xml | 26 +++++++++++++ tests/qemuxml2argvtest.c | 1 + .../powernv8-two-sockets.ppc64-latest.xml | 39 +++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 8 files changed, 111 insertions(+), 3 deletions(-) create mode 100644 tests/qemuxml2argvdata/powernv8-two-sockets.ppc64-lates= t.args create mode 100644 tests/qemuxml2argvdata/powernv8-two-sockets.xml create mode 100644 tests/qemuxml2xmloutdata/powernv8-two-sockets.ppc64-lat= est.xml diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index f0b8aa2655..27febb7074 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -1055,8 +1055,9 @@ virDomainControllerDefValidate(const virDomainControl= lerDef *controller) return -1; } =20 - if ((controller->idx =3D=3D 0 && opts->targetIndex !=3D 0) || - (controller->idx !=3D 0 && opts->targetIndex =3D=3D 0)) { + if (!virDomainControllerIsPowerNVPHB(controller) && + ((controller->idx =3D=3D 0 && opts->targetIndex !=3D 0) || + (controller->idx !=3D 0 && opts->targetIndex =3D=3D 0))) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Only the PCI controller with index 0 can= " "have target index 0, and vice versa")); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 4cf030c485..2257419cbc 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5112,7 +5112,7 @@ qemuDomainControllerDefPostParse(virDomainControllerD= ef *cont, =20 /* pSeries guests can have multiple pci-root controllers, * but other machine types only support a single one */ - if (!qemuDomainIsPSeries(def) && + if (!qemuDomainIsPowerPC(def) && (cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT || cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) && cont->idx !=3D 0) { diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index ad1deb9b56..a172d395aa 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3701,6 +3701,11 @@ qemuValidateDomainDeviceDefControllerPCI(const virDo= mainControllerDef *cont, break; } =20 + /* PowerNV domains, like pSeries guest, can also have + * multiple PHBs. */ + if (virDomainControllerIsPowerNVPHB(cont)) + break; + /* For all other pci-root and pcie-root controllers, though, * the index must be zero */ if (cont->idx !=3D 0) { diff --git a/tests/qemuxml2argvdata/powernv8-two-sockets.ppc64-latest.args = b/tests/qemuxml2argvdata/powernv8-two-sockets.ppc64-latest.args new file mode 100644 index 0000000000..67f0611d79 --- /dev/null +++ b/tests/qemuxml2argvdata/powernv8-two-sockets.ppc64-latest.args @@ -0,0 +1,35 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-ppc64 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine powernv8,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpnv.ram= \ +-accel tcg \ +-cpu POWER8 \ +-m 2048 \ +-object '{"qom-type":"memory-backend-ram","id":"pnv.ram","size":2147483648= }' \ +-overcommit mem-lock=3Doff \ +-smp 2,sockets=3D2,dies=3D1,cores=3D1,threads=3D1 \ +-uuid b20fcfe3-4a0a-4039-8735-9e024256e0f7 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-device '{"driver":"pnv-phb3","index":0,"chip-id":0,"id":"pcie.0"}' \ +-device '{"driver":"pnv-phb3","index":0,"chip-id":1,"id":"pcie.1"}' \ +-usb \ +-chardev pty,id=3Dcharserial0 \ +-device '{"driver":"isa-serial","chardev":"charserial0","id":"serial0","in= dex":0}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/powernv8-two-sockets.xml b/tests/qemuxm= l2argvdata/powernv8-two-sockets.xml new file mode 100644 index 0000000000..c6f2024a33 --- /dev/null +++ b/tests/qemuxml2argvdata/powernv8-two-sockets.xml @@ -0,0 +1,26 @@ + + QEMUGuest1 + b20fcfe3-4a0a-4039-8735-9e024256e0f7 + 2097152 + 2 + + hvm + + + + + + /usr/bin/qemu-system-ppc64 + + + + + + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 2da767e2bc..d688004251 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2177,6 +2177,7 @@ mymain(void) =20 DO_TEST_CAPS_ARCH_LATEST("powernv8-basic", "ppc64"); DO_TEST_CAPS_ARCH_LATEST("powernv8-root-port", "ppc64"); + DO_TEST_CAPS_ARCH_LATEST("powernv8-two-sockets", "ppc64"); =20 DO_TEST("pseries-basic", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, diff --git a/tests/qemuxml2xmloutdata/powernv8-two-sockets.ppc64-latest.xml= b/tests/qemuxml2xmloutdata/powernv8-two-sockets.ppc64-latest.xml new file mode 100644 index 0000000000..5d48b79b9f --- /dev/null +++ b/tests/qemuxml2xmloutdata/powernv8-two-sockets.ppc64-latest.xml @@ -0,0 +1,39 @@ + + QEMUGuest1 + b20fcfe3-4a0a-4039-8735-9e024256e0f7 + 2097152 + 2097152 + 2 + + hvm + + + + POWER8 + + + + destroy + restart + destroy + + /usr/bin/qemu-system-ppc64 + + + + + + + + + + + + + + + + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 288e9698dc..4514b5a6b2 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -664,6 +664,7 @@ mymain(void) =20 DO_TEST_CAPS_ARCH_LATEST("powernv8-basic", "ppc64"); DO_TEST_CAPS_ARCH_LATEST("powernv8-root-port", "ppc64"); + DO_TEST_CAPS_ARCH_LATEST("powernv8-two-sockets", "ppc64"); =20 DO_TEST("pseries-nvram", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, --=20 2.35.1