On Thu, 12 May 2016 10:40:57 +0800 Peter Xu <pet...@redhat.com> wrote:
> On Wed, May 11, 2016 at 04:53:54PM +0300, Michael S. Tsirkin wrote: > > On Wed, May 11, 2016 at 02:40:31PM +0800, Peter Xu wrote: > > > When there are devices under PCI bridge (or bridges), PCI requester ID > > > should be the one that hooked on the root PCI bus, not the PCI device > > > itself. > > > > > > Signed-off-by: Peter Xu <pet...@redhat.com> > > > > I think this is only correct for pci bridges, and wrong for pci express > > bridges. > > > > How exactly do you test this? > > I was using Radim's test case: > > bin=x86_64-softmmu/qemu-system-x86_64 > $bin -machine q35,iommu=on,intremap=on,kernel-irqchip=split \ > -smp cpus=2 -m 1024 -enable-kvm \ > -device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x1e \ > -device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x0 \ > -netdev user,id=user.0,hostfwd=tcp::5555-:22 \ > -device e1000,netdev=user.0,bus=pci.2,addr=0x1 \ > -drive > file=/var/lib/libvirt/images/vm1.qcow2,format=qcow2,if=none,id=drive-virtio-disk0 > \ > -device > virtio-blk-pci,scsi=off,bus=pci.2,addr=0x3,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 > > This does not boot on v6 series, but can boot with the patch > mentioned. > > Do you know where I can find any document on related topics? PCI Express to PCI/PCI-X Bridge Specification rev 1.0 2.3 Assignment of Requester ID and Tag by the Bridge PCIe-to-PCI bridges assign a requester ID composed of the secondary bus number with devfn = 0. Although often on real hardware, the root complex PCI bridge uses the actual bridge requester ID even though it's actually a PCIe bridge. Linux assume that if a bridge has a PCIe capability with type PCIe-to-PCI/X bridge we use the secondary bus requester ID, if it has a PCIe capability with type PCI/X-to-PCIe, we use the bridge requester ID. If it does not have a PCIe capability we use the bridge ID except for a few quirked devices known to use the secondary bus ID. Yay standards! Thanks, Alex