From nobody Sat Feb 7 22:34:18 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 1642686870907836.7508985637677; Thu, 20 Jan 2022 05:54:30 -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-272-n5JJdCDZP0K7XHqeL9OskA-1; Thu, 20 Jan 2022 08:54:26 -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 075591091DA3; Thu, 20 Jan 2022 13:54:21 +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 D7F29108649F; Thu, 20 Jan 2022 13:54:20 +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 A66FA4A707; Thu, 20 Jan 2022 13:54:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20KDrUQD009251 for ; Thu, 20 Jan 2022 08:53:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7B9FF202660D; Thu, 20 Jan 2022 13:53:30 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast10.extmail.prod.ext.rdu2.redhat.com [10.11.55.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 76D15202660C for ; Thu, 20 Jan 2022 13:53:27 +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 640B11C00F6C for ; Thu, 20 Jan 2022 13:53:27 +0000 (UTC) Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-86-r5yHzlvNOWqkZzDHOIpPkA-1; Thu, 20 Jan 2022 08:53:25 -0500 Received: by mail-oi1-f180.google.com with SMTP id s9so8907024oib.11 for ; Thu, 20 Jan 2022 05:53:25 -0800 (PST) Received: from rekt.COMFAST ([191.8.61.226]) by smtp.gmail.com with ESMTPSA id a26sm1574102oiy.26.2022.01.20.05.53.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 05:53:24 -0800 (PST) X-MC-Unique: n5JJdCDZP0K7XHqeL9OskA-1 X-MC-Unique: r5yHzlvNOWqkZzDHOIpPkA-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=78pLDFFCiGiW4d3i5dTfEbuQcQcndYCdgfmWb1Fl/y4=; b=2m7mtQhgiP19HLa+UQBawMqa0Hie3cYjzQYBwx3+KoW+1ihxUynQl5h6IIE/bSmaMr 9fZiWiYBu5r5NWclMTL84Cx19YuH0DFsjfj6xsAndsTopC6xSbMTUSvHH25SvMntJmjW OLgGDJNgEGC8JSew7Mh+/xR/gy35sRcbPI0IvVQAXRwQalxC4j9bxUsR5hMTyhzhuNyL McUqmQmcGftzc4khnN8wF+ZaYE1cgF2WMH3jQcpvWX45RUFv8pdSXkDYM/oyOCdxA11T Hni53BgefZeZZLLnQKBOFYxFk5WLutAxVoScMCwWmYO/TjYdhN683de6NaP3FTmjyW7j /1WQ== X-Gm-Message-State: AOAM532R5s68LM/jlB+AfL6F7iTTRy2Y2oPrTnHOUBeIfBzD34kIbas8 aN9mhWtxEGH9M+P8gSUSwVE9GyXkGXs= X-Google-Smtp-Source: ABdhPJw8dv21AMqEkcCnTdTB3ZOL2oSicn+4qyovP2nL4fbkzf5FYQifFDij8bIi8Z3O3i7rbGOvyQ== X-Received: by 2002:a05:6808:1146:: with SMTP id u6mr7847577oiu.74.1642686804840; Thu, 20 Jan 2022 05:53:24 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 20/33] conf, qemu: add default 'targetIndex' value for pnv-phb3 devs Date: Thu, 20 Jan 2022 10:52:23 -0300 Message-Id: <20220120135236.719924-21-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.78 on 10.11.54.4 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: 1642686872272100001 Content-Type: text/plain; charset="utf-8" As done with the 'chip-id' attribute, use zero as a default targetIndex value for pnv-phb3 devices in case it's absent from the controller definition. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_domain_address.c | 2 ++ src/qemu/qemu_validate.c | 19 ++++++++++++++++++- tests/qemuxml2xmloutdata/powernv8-basic.xml | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 9c2ea5cf00..7ffdfa6478 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -2858,6 +2858,8 @@ qemuDomainAssignPCIAddresses(virDomainDef *def, if (options->chipId =3D=3D -1) options->chipId =3D 0; =20 + if (options->targetIndex =3D=3D -1) + options->targetIndex =3D 0; break; case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_TO_PCI_BRIDGE: diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index f7d73f7c2e..b101ea8064 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3733,6 +3733,24 @@ qemuValidateDomainDeviceDefControllerPCI(const virDo= mainControllerDef *cont, } break; =20 + case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: + /* PHBs for PowerNV domains must have a targetIndex */ + if (pciopts->targetIndex =3D=3D -1 && + virDomainControllerIsPowerNVPHB(cont)) { + virReportControllerMissingOption(cont, model, modelName, "targ= etIndex"); + return -1; + } + + /* + * targetIndex for pcie-root controllers only applies to + * PowerNV PHBs. + */ + if (pciopts->targetIndex !=3D -1 && + !virDomainControllerIsPowerNVPHB(cont)) { + virReportControllerInvalidOption(cont, model, modelName, "targ= etIndex"); + return -1; + } + 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: @@ -3740,7 +3758,6 @@ qemuValidateDomainDeviceDefControllerPCI(const virDom= ainControllerDef *cont, 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: - case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_TO_PCI_BRIDGE: if (pciopts->targetIndex !=3D -1) { virReportControllerInvalidOption(cont, model, modelName, "targ= etIndex"); diff --git a/tests/qemuxml2xmloutdata/powernv8-basic.xml b/tests/qemuxml2xm= loutdata/powernv8-basic.xml index 0a093367f2..fe918480eb 100644 --- a/tests/qemuxml2xmloutdata/powernv8-basic.xml +++ b/tests/qemuxml2xmloutdata/powernv8-basic.xml @@ -16,7 +16,7 @@ /usr/bin/qemu-system-ppc64 - + --=20 2.34.1