From nobody Sun Feb 8 16:30:51 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 1645622602091414.42555090055225; Wed, 23 Feb 2022 05:23:22 -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-92-IbcPXFGrNcqIGjuWyDHeIA-1; Wed, 23 Feb 2022 08:23:19 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3C9431091DA3; Wed, 23 Feb 2022 13:23:14 +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 1968E832B0; Wed, 23 Feb 2022 13:23:14 +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 DD24F57DE6; Wed, 23 Feb 2022 13:23:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21NDKXg1029828 for ; Wed, 23 Feb 2022 08:20:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id 05DA1140240C; Wed, 23 Feb 2022 13:20:33 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0158E140240B for ; Wed, 23 Feb 2022 13:20:32 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 DE521802A6A for ; Wed, 23 Feb 2022 13:20:32 +0000 (UTC) Received: from mail-oo1-f42.google.com (mail-oo1-f42.google.com [209.85.161.42]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-182-eZlX-wmCNq-qECJgUtHNaQ-1; Wed, 23 Feb 2022 08:20:31 -0500 Received: by mail-oo1-f42.google.com with SMTP id x6-20020a4a4106000000b003193022319cso22219966ooa.4 for ; Wed, 23 Feb 2022 05:20:30 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 05:20:30 -0800 (PST) X-MC-Unique: IbcPXFGrNcqIGjuWyDHeIA-1 X-MC-Unique: eZlX-wmCNq-qECJgUtHNaQ-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=Ecd2+LIH0fca0tJkKoPlYIaqtrMQXOlSZRLVkm4M2K4=; b=4MMZ0hWvG09loTeT550lWpkMF04qwyIpQt2DDbkNhiVhvTCASbf4NwgShd4P0rqvDf KtQ+EXzYaeAiyE7u4H5eYt3hBrm7XTkuwcbFYbZtLwfMfgmoVBm45btAAcp0ld5xTLU9 oc3J2AwD3cdg5rXtUHx3Ta2thCkIwrnD0AglbY6pdsbKJQnRv0Mfliip8r5HtoElt+IN nNdzBMu+MYK60hgkF80c1iZcov/bPew77ZMyyZaTftyqlWvwRyvFBr6zsZehkf7zNqPg enxhJOC1D2wems6qRVplqMmfk63/XKrrTPDztD9nxdxSmhB/HVKvPmex0EGp8nxHr+7v xQcw== X-Gm-Message-State: AOAM532YK07sj8JJZGbfNKdEur97uF1UhLa3FwfunbL00ERFc+86tioG oTtwwy/UaGFKWQS3u/OHd47DF7Cr6K8= X-Google-Smtp-Source: ABdhPJygqDuQCcaoyy22dwSJAR30jO0Z/HNrl3OhCHXmzBKp0t8Ii7DTXJDFv2S5IU9gbXrn/ngr/g== X-Received: by 2002:a05:6870:b4aa:b0:d2:3f48:62b4 with SMTP id y42-20020a056870b4aa00b000d23f4862b4mr3820740oap.56.1645622430267; Wed, 23 Feb 2022 05:20:30 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v3 20/29] domain_conf: always format pnv-phb3-root-port address Date: Wed, 23 Feb 2022 10:19:43 -0300 Message-Id: <20220223131952.922228-21-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.7 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.15 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: 1645622603696100001 Content-Type: text/plain; charset="utf-8" pnv-phb3-root-ports can use an all zeroed address (0000:00:0.0) as a way of connecting to a PHB3 bus that has index 0. Today, these addresses aren't being displayed in the domain XML due to the use of virPCIDeviceAddressIsEmpty() inside virDomainDeviceInfoFormat(), where 0000:00:0.0 is considered an empty address and thus not displayed, regardless of the user manually adding
in the domain XML. Changing virPCIDeviceAddressIsEmpty() to recognize the difference between an user adding a zeroed address by hand, versus all the other current cases in which this function is used (e.g. to check whether an address should be assigned or not), is not trivial and will change a lot of existing, working code, to accomodate a niche case of a new device we want to add. Instead, this patch adds a new VIR_DOMAIN_DEF_FORMAT_PCI_ADDR_ALWAYS flag to be used by virDomainDefFormatFlags that will allow for an
element to always be formatted regardless of virPCIDeviceAddressIsEmpty() mechanics/semantics. Then we use this flag when formatting pnv-phb3-root-port devices. Signed-off-by: Daniel Henrique Barboza --- src/conf/domain_conf.c | 25 ++++++++++++++++++++++++- src/conf/domain_conf.h | 2 ++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f72045eb39..625949e44e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2466,6 +2466,25 @@ virDomainControllerIsPowerNVPHB(const virDomainContr= ollerDef *cont) } =20 =20 +static bool +virDomainControllerIsPowerNVRootPort(const virDomainControllerDef *cont) +{ + virDomainControllerPCIModelName name; + + if (cont->type !=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI || + cont->model !=3D VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT) { + return false; + } + + name =3D cont->opts.pciopts.modelName; + + if (name !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_PNV_PHB3_ROOT_PORT) + return false; + + return true; +} + + virDomainFSDef * virDomainFSDefNew(virDomainXMLOption *xmlopt) { @@ -6509,7 +6528,8 @@ virDomainDeviceInfoFormat(virBuffer *buf, =20 switch ((virDomainDeviceAddressType) info->type) { case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI: - if (!virPCIDeviceAddressIsEmpty(&info->addr.pci)) { + if (!virPCIDeviceAddressIsEmpty(&info->addr.pci) || + flags & VIR_DOMAIN_DEF_FORMAT_PCI_ADDR_ALWAYS) { virBufferAsprintf(&attrBuf, " domain=3D'0x%04x' bus=3D'0x%02x'= " "slot=3D'0x%02x' function=3D'0x%d'", info->addr.pci.domain, @@ -23911,6 +23931,9 @@ virDomainControllerDefFormat(virBuffer *buf, } } =20 + if (virDomainControllerIsPowerNVRootPort(def)) + flags |=3D VIR_DOMAIN_DEF_FORMAT_PCI_ADDR_ALWAYS; + virDomainControllerDriverFormat(&childBuf, def); =20 virDomainDeviceInfoFormat(&childBuf, &def->info, flags); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 404289aa26..835b8111e0 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3508,6 +3508,8 @@ typedef enum { VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM =3D 1 << 6, VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT =3D 1 << 7, VIR_DOMAIN_DEF_FORMAT_CLOCK_ADJUST =3D 1 << 8, + /* always format the PCI address */ + VIR_DOMAIN_DEF_FORMAT_PCI_ADDR_ALWAYS =3D 1 << 9, } virDomainDefFormatFlags; =20 /* Use these flags to skip specific domain ABI consistency checks done --=20 2.35.1