Skip to content
Commit 620a65dc authored by Michael S. Tsirkin's avatar Michael S. Tsirkin Committed by Michael Roth
Browse files

pci: fix error message for express slots



PCI Express downstream slot has a single PCI slot
behind it, using PCI_DEVFN(PCI_SLOT(devfn), 0)
does not give you function 0 in cases such as ARI
as well as some error cases.

This is exactly what we are hitting:
   $ qemu-system-x86_64 -machine q35 -readconfig docs/q35-chipset.cfg
-monitor stdio
   (qemu) device_add e1000e,bus=ich9-pcie-port-4,addr=00
   (qemu) device_add e1000e,bus=ich9-pcie-port-4,addr=08
   Segmentation fault (core dumped)

The fix is to use the pci_get_function_0 API.

Cc: qemu-stable@nongnu.org
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Reported-by: default avatarEduardo Habkost <ehabkost@redhat.com>
Tested-by: default avatarCao jin <caoj.fnst@cn.fujitsu.com>
Tested-by: default avatarEduardo Habkost <ehabkost@redhat.com>
Reviewed-by: default avatarEduardo Habkost <ehabkost@redhat.com>
(cherry picked from commit d93ddfb1)
Signed-off-by: default avatarMichael Roth <mdroth@linux.vnet.ibm.com>
parent 9d14f0cd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment