Bug 1361405

Summary: pxb-pcie's busNr <=2 does not make much sense
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Yang Yang <yanyang>
Component: libvirtAssignee: Andrea Bolognani <abologna>
Status: CLOSED CURRENTRELEASE QA Contact: Meina Li <meili>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.0CC: dyuan, laine, lmen, rbalakri, xuzhang
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-11 15:58:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Yang Yang 2016-07-29 03:32:17 UTC
Description of problem:
Under q35, dmi-to-pci-bridge is always auto-added to the domain configuration even if all the devices are manually assigned to pcie-root. If pxb-pcie's busNr is configured to 1, there is no enough bus room for dmi-to-pci-bridge.

In general situation, if you do not manually assign address to devices, libvirt will auto-assign devices to pci-bridge. So both dmi-to-pci-bridge and pci-bridge are usually auto-added to the domain configuration. If pxb-pcie's busNr <=2, there is no enough bus room for dmi-to-pci-bridge and pci-bridge.

So pxb-pcie's busNr <=2 does not make much sense

Version-Release number of selected component (if applicable):
libvirt-2.0.0-3.el7.x86_64
qemu-kvm-rhev-2.6.0-15.el7.x86_64


How reproducible:
100%

Steps to Reproduce:
1. manually add 1 pxb-pcie in domain configuration and set busNr=1
<disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/mnt/nfs2/RHEL-7.3-latest.qcow2'/>
      <target dev='vda' bus='virtio'/>
      <boot order='1'/>
    </disk>

<controller type='pci' index='3' model='pcie-expander-bus'>
      <model name='pxb-pcie'/>
      <target busNr='1'/>
    </controller>

# virsh create vm1-q35-pxb.xml
Domain vm1-q35-pxb created from vm1-q35-pxb.xml

#virsh dumpxml vm1-q35-pxb
<disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/mnt/nfs2/RHEL-7.3-latest.qcow2'>
        <seclabel model='selinux' labelskip='yes'/>
      </source>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <boot order='1'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
    </disk>

 <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
      <model name='i82801b11-bridge'/>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
    </controller>
    <controller type='pci' index='2' model='pci-bridge'>
      <model name='pci-bridge'/>
      <target chassisNr='2'/>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </controller>
    <controller type='pci' index='3' model='pcie-expander-bus'>
      <model name='pxb-pcie'/>
      <target busNr='1'/>
      <alias name='pci.3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </controller>
2.
3.

Actual results:
no bootable device shows in guest seabios

Expected results:
disallow to configure pxb-pcie's busNr to an integer less than 3

Additional info:

Comment 2 Laine Stump 2016-08-06 02:41:36 UTC
While it is true that we *currently* always adda dmi-to-pci-bridge and pci-bridge to every Q35 configuration, that won't be the case in the future. So it's incorrect to suggest that busNr should *never* be <= 2.

However, it does make sense to do a validation after all addresses have been assigned to assure that each root bus has enough "busNr space" for all its subservient buses.

Comment 5 Andrea Bolognani 2020-02-11 15:58:02 UTC
(In reply to Laine Stump from comment #2)
> While it is true that we *currently* always adda dmi-to-pci-bridge and
> pci-bridge to every Q35 configuration, that won't be the case in the future.
> So it's incorrect to suggest that busNr should *never* be <= 2.

This change has been introduced into libvirt a long time ago now, so
the specific failure scenario described in this bug report no longer
applies.

> However, it does make sense to do a validation after all addresses have been
> assigned to assure that each root bus has enough "busNr space" for all its
> subservient buses.

Bug 1358994 is already tracking the more generic issue of libvirt not
doing a good enough job at validating the domain configuration to the
PCI topology, and bus numbers specifically.

Based on the above, I'm moving this to CLOSED CURRENTRELEASE.