diff mbox

[1/4] hw/pxb: remove the built-in pci bridge

Message ID 1447341076-11573-2-git-send-email-marcel@redhat.com
State New
Headers show

Commit Message

Marcel Apfelbaum Nov. 12, 2015, 3:11 p.m. UTC
As part of porting the pxb device to Q35 remove the internal pci-2-pci
bridge. The only way to hot-pug devices on the extra PCI root buses
is by adding a pci-2-pci to the pxb before the firmware assign the
IO/mem resources.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
---
 hw/pci-bridge/pci_expander_bridge.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

Comments

Gerd Hoffmann Nov. 13, 2015, 9:13 a.m. UTC | #1
On Do, 2015-11-12 at 17:11 +0200, Marcel Apfelbaum wrote:
> As part of porting the pxb device to Q35 remove the internal pci-2-pci
> bridge. The only way to hot-pug devices on the extra PCI root buses
> is by adding a pci-2-pci to the pxb before the firmware assign the
> IO/mem resources.

I think this breaks live migration and is guest-visible too.  So not
going to fly without backward-compatibility mode for old machine
types ...

Possibly it is easier to just have have pci and pcie pxb devices look
differenty rather than adding all the compatibility fluff.

cheers,
  Gerd
Marcel Apfelbaum Nov. 13, 2015, 9:22 a.m. UTC | #2
On 11/13/2015 11:13 AM, Gerd Hoffmann wrote:
> On Do, 2015-11-12 at 17:11 +0200, Marcel Apfelbaum wrote:
>> As part of porting the pxb device to Q35 remove the internal pci-2-pci
>> bridge. The only way to hot-pug devices on the extra PCI root buses
>> is by adding a pci-2-pci to the pxb before the firmware assign the
>> IO/mem resources.
>
> I think this breaks live migration and is guest-visible too.  So not
> going to fly without backward-compatibility mode for old machine
> types ...
>
> Possibly it is easier to just have have pci and pcie pxb devices look
> differenty rather than adding all the compatibility fluff.
>

Hi Gerd,

Thank you for the review.

Yes, you are right about migration, but I prefer to add a compat-prop rather
than different devices because I do want to remove the internal pci-bridge
even for pxb PCI.
The reason is the feedback I got from libvirt that "composed" device are not recommended.

In conclusion, since I am going to get rid of the pci-bridge, the devices will be exactly
the same (except for the internal bus).

I want to use the same concept as virtio-pci devices that get to be "express" on PCIe,
but remain PCI on PCI buses.

Thanks,
Marcel


> cheers,
>    Gerd
>
>
diff mbox

Patch

diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c
index 57f8a37..0464dec 100644
--- a/hw/pci-bridge/pci_expander_bridge.c
+++ b/hw/pci-bridge/pci_expander_bridge.c
@@ -196,7 +196,7 @@  static gint pxb_compare(gconstpointer a, gconstpointer b)
 static int pxb_dev_initfn(PCIDevice *dev)
 {
     PXBDev *pxb = PXB_DEV(dev);
-    DeviceState *ds, *bds;
+    DeviceState *ds;
     PCIBus *bus;
     const char *dev_name = NULL;
 
@@ -211,18 +211,13 @@  static int pxb_dev_initfn(PCIDevice *dev)
     }
 
     ds = qdev_create(NULL, TYPE_PXB_HOST);
-    bus = pci_bus_new(ds, "pxb-internal", NULL, NULL, 0, TYPE_PXB_BUS);
+    bus = pci_bus_new(ds, dev_name, NULL, NULL, 0, TYPE_PXB_BUS);
 
     bus->parent_dev = dev;
     bus->address_space_mem = dev->bus->address_space_mem;
     bus->address_space_io = dev->bus->address_space_io;
     bus->map_irq = pxb_map_irq_fn;
 
-    bds = qdev_create(BUS(bus), "pci-bridge");
-    bds->id = dev_name;
-    qdev_prop_set_uint8(bds, PCI_BRIDGE_DEV_PROP_CHASSIS_NR, pxb->bus_nr);
-    qdev_prop_set_bit(bds, PCI_BRIDGE_DEV_PROP_SHPC, false);
-
     PCI_HOST_BRIDGE(ds)->bus = bus;
 
     if (pxb_register_bus(dev, bus)) {
@@ -230,7 +225,6 @@  static int pxb_dev_initfn(PCIDevice *dev)
     }
 
     qdev_init_nofail(ds);
-    qdev_init_nofail(bds);
 
     pci_word_test_and_set_mask(dev->config + PCI_STATUS,
                                PCI_STATUS_66MHZ | PCI_STATUS_FAST_BACK);