From nobody Sun Feb 8 01:29:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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.129.124]) by mx.zohomail.com with SMTPS id 1642686873269731.8027692009424; Thu, 20 Jan 2022 05:54:33 -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-587-kkOPavR8O5iZU5sb7B9QSg-1; Thu, 20 Jan 2022 08:54:28 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AF20B101F7C3; Thu, 20 Jan 2022 13:54: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 8A9391091ED7; Thu, 20 Jan 2022 13:54:23 +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 5A1D818218B7; Thu, 20 Jan 2022 13:54:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20KDrZii009559 for ; Thu, 20 Jan 2022 08:53:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5F4D040F9D74; Thu, 20 Jan 2022 13:53:35 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5B39640F9D73 for ; Thu, 20 Jan 2022 13:53: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 44DDA1078461 for ; Thu, 20 Jan 2022 13:53:35 +0000 (UTC) Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-36-Bnsy2mxqMu-WAASFgmvkqg-2; Thu, 20 Jan 2022 08:53:33 -0500 Received: by mail-ot1-f52.google.com with SMTP id m8-20020a9d4c88000000b00592bae7944bso7670152otf.1 for ; Thu, 20 Jan 2022 05:53:33 -0800 (PST) Received: from rekt.COMFAST ([191.8.61.226]) by smtp.gmail.com with ESMTPSA id a26sm1574102oiy.26.2022.01.20.05.53.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 05:53:32 -0800 (PST) X-MC-Unique: kkOPavR8O5iZU5sb7B9QSg-1 X-MC-Unique: Bnsy2mxqMu-WAASFgmvkqg-2 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=7myBSPo2bJ+lu7WvI0cVZ5E3E1Ak2QruNamxzVstmHQ=; b=jCMqxIBBh04R2jj0uC/xhDqE1sURh8u/hdczrSKQ6+Nq8qn/87dtVB+abR1rTkwsYg q8Q9WZqqZrZTgjvcpc4DENIA1PlmexIuM4VeQQHkOKyosZLLqmryiLDOkzW1AzlqM+qG iMy+11QtkYDsw9c6cz6X11Y3fATJCU5HRme5H8Es4jarKVOOouFj9eMDfNkNwyzQEE8B CHGYpe6Av3YksRKkDgqioxEjnIyA9AWvU52zQJkaaJ/xnkA3Y1QswrJtuca261zUYT37 w3jH1IYKQufhQOXXP4mI1sjFg6/PspWt4BVN+H7Dzk5nMVmcrRCL/96wTtpGre5VFuLt UjRg== X-Gm-Message-State: AOAM532WqHdnzjX8ZzmI/O+16h3Uxdo9uA9mkONxrNgxkVYuh67Ys0Qa 7MZzxoHl8zT7T3zbGutc3hLDR9uZF7Q= X-Google-Smtp-Source: ABdhPJyaDTDniZlKPIVKTy7G+g6w40srMPHhd0F2YG+isombXCZK9U/wPCsVhymz1Szit8kUDOjKxQ== X-Received: by 2002:a05:6830:44a1:: with SMTP id r33mr12593425otv.251.1642686813054; Thu, 20 Jan 2022 05:53:33 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 25/33] domain_validate.c: allow targetIndex 0 out of idx 0 for PowerNV PHBs Date: Thu, 20 Jan 2022 10:52:28 -0300 Message-Id: <20220120135236.719924-26-danielhb413@gmail.com> In-Reply-To: <20220120135236.719924-1-danielhb413@gmail.com> References: <20220120135236.719924-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.84 on 10.11.54.1 X-loop: libvir-list@redhat.com Cc: fbarrat@linux.ibm.com, 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.84 on 10.5.11.22 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: 1642686874824100001 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 +++ .../qemuxml2argvdata/powernv8-two-sockets.xml | 26 +++++++++++++ .../powernv8-two-sockets.xml | 38 +++++++++++++++++++ tests/qemuxml2xmltest.c | 3 ++ 6 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 tests/qemuxml2argvdata/powernv8-two-sockets.xml create mode 100644 tests/qemuxml2xmloutdata/powernv8-two-sockets.xml diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index e9baf1d41a..5510cb073b 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 d0bb4938ec..25523a6020 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5100,7 +5100,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 b101ea8064..3be29af958 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3697,6 +3697,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.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/qemuxml2xmloutdata/powernv8-two-sockets.xml b/tests/qemu= xml2xmloutdata/powernv8-two-sockets.xml new file mode 100644 index 0000000000..10b4794877 --- /dev/null +++ b/tests/qemuxml2xmloutdata/powernv8-two-sockets.xml @@ -0,0 +1,38 @@ + + QEMUGuest1 + b20fcfe3-4a0a-4039-8735-9e024256e0f7 + 2097152 + 2097152 + 2 + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-ppc64 + + + + + + + + + + + + + + + + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 322a1b47cc..5ed8283546 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -644,6 +644,9 @@ mymain(void) QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_DEVICE_PNV_PHB3, QEMU_CAPS_DEVICE_PNV_PHB3_ROOT_PORT); + DO_TEST("powernv8-two-sockets", + QEMU_CAPS_DEVICE_ISA_SERIAL, + QEMU_CAPS_DEVICE_PNV_PHB3); =20 DO_TEST("pseries-nvram", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, --=20 2.34.1