On 2/21/22 10:36, Ján Tomko wrote:
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
:(
Hmmm I don't think this is a hill I want to die on in this series.
This patch is already adding a "VIR_DOMAIN_DEF_FORMAT_EMPTY_PCI_ADDR" flag to force
the address formatting regardless of virPCIDeviceAddressIsEmpty(). I believe that
I can rename it to "VIR_DOMAIN_DEF_FORMAT_PCI_ADDR", making it clear that the idea is
to force the <addr> formatting at all times for the device, regardless of any assumptions
about the address being empty, or not assigned, or any other cases where
virPCIDeviceAddressIsEmpty() might apply.
Thanks,
Daniel
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@xxxxxxxxx>
---
src/conf/domain_conf.c | 25 ++++++++++++++++++++++++-
src/conf/domain_conf.h | 2 ++
2 files changed, 26 insertions(+), 1 deletion(-)