[PATCH v2 20/29] domain_conf: format pnv-phb3-root-port empty addr

Ján Tomko jtomko at redhat.com
Mon Feb 21 13:36:07 UTC 2022


On a Tuesday in 2022, Daniel Henrique Barboza wrote:
>Hiding the empty (0000:00:0.0) PCI address in the case of devices that
>will connect to slot 0x0 can be counterintuitive to the user, which will
>see something like this:
>
>    <controller type='pci' index='0' model='pcie-root'/>
>    <controller type='pci' index='1' model='pcie-root-port'>
>      <model name='pnv-phb3-root-port'/>
>      <target chassis='1' port='0x8'/>
>    </controller>
>
>Even if the user deliberately adds the root-port <address> element:
>
>    <address type='pci' domain='0x0000' bus='0x00' slot='0x00' function='0x0'/>
>
>We end up removing the <address> element after saving the domain file.
>This happens because virPCIDeviceAddressIsEmpty() can't distinguish
>between a zeroed address that was set by the user versus an address that
>wasn't filled at all.

I'm afraid this is incomplete.

virPCIDeviceAddressIsEmpty is for example used to figure out whether the
device needs an address assigned too.

So we'll need an extra field to distinguish between empty and
zero addresses, which will probably need adjustment in a lot of callers
:(

Jano

>
>Given that all root-ports of PowerNV domains will connect to slot 0 of
>the PHB, if the PHB controller has index = 0 this scenario will occur
>every time. This patch aims to alleaviate this behavior by adding a new
>virDomainDefFormatFlags that will allow an empty address to be formatted
>in the XML. This flag is then used only when formatting PowerNV root
>ports.
>
>Signed-off-by: Daniel Henrique Barboza <danielhb413 at gmail.com>
>---
> src/conf/domain_conf.c | 25 ++++++++++++++++++++++++-
> src/conf/domain_conf.h |  2 ++
> 2 files changed, 26 insertions(+), 1 deletion(-)
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20220221/017f4e2c/attachment-0001.sig>


More information about the libvir-list mailing list