[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL for-2.9 8/9] pci: fix error message for express slots
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL for-2.9 8/9] pci: fix error message for express slots |
Date: |
Fri, 16 Dec 2016 23:17:39 +0200 |
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: address@hidden
Signed-off-by: Michael S. Tsirkin <address@hidden>
Reported-by: Eduardo Habkost <address@hidden>
Tested-by: Cao jin <address@hidden>
Tested-by: Eduardo Habkost <address@hidden>
Reviewed-by: Eduardo Habkost <address@hidden>
---
hw/pci/pci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 24fae16..637d545 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -982,8 +982,8 @@ static PCIDevice *do_pci_register_device(PCIDevice
*pci_dev, PCIBus *bus,
pci_get_function_0(pci_dev)) {
error_setg(errp, "PCI: slot %d function 0 already ocuppied by %s,"
" new func %s cannot be exposed to guest.",
- PCI_SLOT(devfn),
- bus->devices[PCI_DEVFN(PCI_SLOT(devfn), 0)]->name,
+ PCI_SLOT(pci_get_function_0(pci_dev)->devfn),
+ pci_get_function_0(pci_dev)->name,
name);
return NULL;
--
MST
- [Qemu-devel] [PULL for-2.9 0/9] virtio, vhost, pc: fixes, Michael S. Tsirkin, 2016/12/16
- [Qemu-devel] [PULL for-2.9 1/9] tests/vhost-user-bridge: remove false comment, Michael S. Tsirkin, 2016/12/16
- [Qemu-devel] [PULL for-2.9 2/9] tests/vhost-user-bridge: remove unnecessary dispatcher_remove, Michael S. Tsirkin, 2016/12/16
- [Qemu-devel] [PULL for-2.9 3/9] tests/vhost-user-bridge: indicate peer disconnected, Michael S. Tsirkin, 2016/12/16
- [Qemu-devel] [PULL for-2.9 4/9] tests/vhost-user-bridge: do not accept more than one connection, Michael S. Tsirkin, 2016/12/16
- [Qemu-devel] [PULL for-2.9 5/9] contrib: add libvhost-user, Michael S. Tsirkin, 2016/12/16
- [Qemu-devel] [PULL for-2.9 6/9] tests/vhost-user-bridge: use contrib/libvhost-user, Michael S. Tsirkin, 2016/12/16
- [Qemu-devel] [PULL for-2.9 7/9] i386: amd_iommu: fix MMIO register count and access, Michael S. Tsirkin, 2016/12/16
- [Qemu-devel] [PULL for-2.9 8/9] pci: fix error message for express slots,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL for-2.9 9/9] virtio: avoid using guest_notifier_mask in vhost-user mode, Michael S. Tsirkin, 2016/12/16
- Re: [Qemu-devel] [PULL for-2.9 0/9] virtio, vhost, pc: fixes, no-reply, 2016/12/16