s390x/pci: forbid multifunction pci device
PATCH 1/1 s390x/pci: forbid multifunction pci device
Currently we don't support pci multifunction. If a pci with multifucntion is plugged, the guest will spin forever. This patch fixes this.
--- hw/s390x/s390-pci-bus.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
hw/s390x/s390-pci-bus.c +10 -0
@@ -816,6 +816,11 @@ static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev,PCIBridge *pb =PCI_BRIDGE (dev);PCIDevice *pdev =PCI_DEVICE (dev); +if (pdev->cap_present &QEMU_PCI_CAP_MULTIFUNCTION ) { +error_setg (errp,"multifunction not supported in s390" ); +return ; + } +pci_bridge_map_irq (pb, dev->id, s390_pci_map_irq);pci_setup_iommu (&pb->sec_bus, s390_pci_dma_iommu, s);
@@ -835,6 +840,11 @@ static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev, }else if (object_dynamic_cast (OBJECT (dev),TYPE_PCI_DEVICE )) { pdev =PCI_DEVICE (dev); +if (pdev->cap_present &QEMU_PCI_CAP_MULTIFUNCTION ) { +error_setg (errp,"multifunction not supported in s390" ); +return ; + } +if (!dev->id) {/* In the case the PCI device does not define an id */ /* we generate one based on the PCI address */
Signature · 1 line
2.14.3 (Apple Git-98)
Quoted 15 lines · Yi Min Zhao
Currently we don't support pci multifunction. If a pci with multifucntion is plugged, the guest will spin forever. This patch fixes this.
Signed-off-by Yi Min Zhao <[email protected]>Reviewed-by Pierre Morel <[email protected]>--- hw/s390x/s390-pci-bus.c | 10 ++++++++++ 1 file changed, 10 insertions(+)hw/s390x/s390-pci-bus.c +0
-0
hw/s390x/s390-pci-bus.c static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev, · line 817
Quoted 2 lines
hw/s390x/s390-pci-bus.c +0
-0@@ -816,6 +816,11 @@ static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev,PCIBridge *pb =PCI_BRIDGE (dev);PCIDevice *pdev =PCI_DEVICE (dev);
Off-topic: That "PCIDevice *pdev" shadows the pdev variable that is declared at the beginning of this function. So I think we should rather change the above line into "pdev = PCI_DEVICE(dev)" instead, without re-declaring a variable here. (i.e. we should do this in a separate patch later...).
Quoted 11 lines
hw/s390x/s390-pci-bus.c +5
-0+if (pdev->cap_present &QEMU_PCI_CAP_MULTIFUNCTION ) { +error_setg (errp,"multifunction not supported in s390" ); +return ; + } +pci_bridge_map_irq (pb, dev->id, s390_pci_map_irq);pci_setup_iommu (&pb->sec_bus, s390_pci_dma_iommu, s);@@ -835,6 +840,11 @@ static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev, }else if (object_dynamic_cast (OBJECT (dev),TYPE_PCI_DEVICE )) {
hw/s390x/s390-pci-bus.c static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev, · line 850
Quoted 10 lines
hw/s390x/s390-pci-bus.c +5
-0pdev =PCI_DEVICE (dev); +if (pdev->cap_present &QEMU_PCI_CAP_MULTIFUNCTION ) { +error_setg (errp,"multifunction not supported in s390" ); +return ; + } +if (!dev->id) {/* In the case the PCI device does not define an id */ /* we generate one based on the PCI address */
Quoted 11 lines · Thomas Huth
Quoted 10 lines · Yi Min Zhao
Currently we don't support pci multifunction. If a pci with multifucntion is plugged, the guest will spin forever. This patch fixes this.
Signed-off-by Yi Min Zhao <[email protected]>Reviewed-by Pierre Morel <[email protected]>--- hw/s390x/s390-pci-bus.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
Quoted 12 lines
hw/s390x/s390-pci-bus.c static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev, · line 817
Quoted 7 lines
hw/s390x/s390-pci-bus.c +0
-0@@ -816,6 +816,11 @@ static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev,PCIBridge *pb =PCI_BRIDGE (dev);PCIDevice *pdev =PCI_DEVICE (dev);Off-topic: That "PCIDevice *pdev" shadows the pdev variable that is declared at the beginning of this function. So I think we should rather change the above line into "pdev =
PCI_DEVICE(dev)" instead, without re-declaring a variable here. (i.e. we should do this in a separate patch later...).
Thanks for your reminder. Actually I have noticed this. But I thought this is not very urgent. I will do this later.
Quoted 25 lines
Quoted 12 lines
hw/s390x/s390-pci-bus.c +5
-0+if (pdev->cap_present &QEMU_PCI_CAP_MULTIFUNCTION ) { +error_setg (errp,"multifunction not supported in s390" ); +return ; + } +pci_bridge_map_irq (pb, dev->id, s390_pci_map_irq);pci_setup_iommu (&pb->sec_bus, s390_pci_dma_iommu, s);@@ -835,6 +840,11 @@ static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev, }else if (object_dynamic_cast (OBJECT (dev),TYPE_PCI_DEVICE )) {hw/s390x/s390-pci-bus.c static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev, · line 850
Quoted 10 lines
hw/s390x/s390-pci-bus.c +5
-0pdev =PCI_DEVICE (dev); +if (pdev->cap_present &QEMU_PCI_CAP_MULTIFUNCTION ) { +error_setg (errp,"multifunction not supported in s390" ); +return ; + } +if (!dev->id) {/* In the case the PCI device does not define an id */ /* we generate one based on the PCI address */ Reviewed-by Thomas Huth <[email protected]>
Christian Borntraeger
Appliedapplied to my s390-next branch.
Quoted 39 lines · Yi Min Zhao
Currently we don't support pci multifunction. If a pci with multifucntion is plugged, the guest will spin forever. This patch fixes this.
Signed-off-by Yi Min Zhao <[email protected]>Reviewed-by Pierre Morel <[email protected]>--- hw/s390x/s390-pci-bus.c | 10 ++++++++++ 1 file changed, 10 insertions(+)hw/s390x/s390-pci-bus.c +10
-0@@ -816,6 +816,11 @@ static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev,PCIBridge *pb =PCI_BRIDGE (dev);PCIDevice *pdev =PCI_DEVICE (dev); +if (pdev->cap_present &QEMU_PCI_CAP_MULTIFUNCTION ) { +error_setg (errp,"multifunction not supported in s390" ); +return ; + } +pci_bridge_map_irq (pb, dev->id, s390_pci_map_irq);pci_setup_iommu (&pb->sec_bus, s390_pci_dma_iommu, s);@@ -835,6 +840,11 @@ static void s390_pcihost_hot_plug(HotplugHandler *hotplug_dev, }else if (object_dynamic_cast (OBJECT (dev),TYPE_PCI_DEVICE )) { pdev =PCI_DEVICE (dev); +if (pdev->cap_present &QEMU_PCI_CAP_MULTIFUNCTION ) { +error_setg (errp,"multifunction not supported in s390" ); +return ; + } +if (!dev->id) {/* In the case the PCI device does not define an id */ /* we generate one based on the PCI address */