Skip to contentSkip to conversation

pci: split out bridge code into pci_bridge and make it library

PATCH Applied Isaku Yamahata 2 participants 9 messages Jul 13, 2010 – Jul 22, 2010 Kbuild

lore
Share & tools
lore
#2 lore raw

PATCH v3 2/4 pci_bridge: rename PCIBridge::bus -> PCIBridge::sec_bus.

In reply to Isaku Yamahata

To avoid confusion of primary bus with secondary bus, rename PCIBridge::bus to PCIBridge::sec_bus.

---
 hw/pci_bridge.c    |   10 ++++------
 hw/pci_internals.h |    2 +-
 2 files changed, 5 insertions(+), 7 deletions(-)
hw/pci_bridge.c +4 -6
index 7f27870..63052fe 100644
@@ -138,8 +138,7 @@ static void pci_bridge_write_config(PCIDevice *d,
            io base/limit upper 16 */
         ranges_overlap(address, len, PCI_MEMORY_BASE, 20)) {
         PCIBridge *s = container_of(d, PCIBridge, dev);
-        PCIBus *secondary_bus = &s->bus;
-        pci_bridge_update_mappings(secondary_bus);
+        pci_bridge_update_mappings(&s->sec_bus);
     }
 }
 
@@ -164,8 +163,7 @@ static int pci_bridge_initfn(PCIDevice *dev)
 static int pci_bridge_exitfn(PCIDevice *pci_dev)
 {
     PCIBridge *s = DO_UPCAST(PCIBridge, dev, pci_dev);
-    PCIBus *bus = &s->bus;
-    pci_unregister_secondary_bus(bus);
+    pci_unregister_secondary_bus(&s->sec_bus);
     return 0;
 }
 
@@ -182,8 +180,8 @@ PCIBus *pci_bridge_init(PCIBus *bus, int devfn, bool multifunction,
     qdev_init_nofail(&dev->qdev);
 
     s = DO_UPCAST(PCIBridge, dev, dev);
-    pci_register_secondary_bus(bus, &s->bus, &s->dev, map_irq, name);
-    return &s->bus;
+    pci_register_secondary_bus(bus, &s->sec_bus, &s->dev, map_irq, name);
+    return &s->sec_bus;
 }
 
 static PCIDeviceInfo bridge_info = {
hw/pci_internals.h +1 -1
index 8a3026b..fa844ab 100644
@@ -32,7 +32,7 @@ struct PCIBus {
 
 typedef struct {
     PCIDevice dev;
-    PCIBus bus;
+    PCIBus sec_bus;
     uint32_t vid;
     uint32_t did;
 } PCIBridge;
Signature · 1 line
1.7.1.1
#3 lore raw

PATCH v3 3/4 pci_bridge: clean up: remove pci_{register, unregister}_secondary_bus()

In reply to Isaku Yamahata

Remove pci_{register, unregister}_secondary_bus() by open code. They are old stype API and aren't used any more by others. So eliminate it.

---
 hw/pci_bridge.c |   32 ++++++++++----------------------
 1 files changed, 10 insertions(+), 22 deletions(-)
hw/pci_bridge.c +10 -22
index 63052fe..2f13c7d 100644
@@ -37,26 +37,6 @@ PCIDevice *pci_bridge_get_device(PCIBus *bus)
     return bus->parent_dev;
 }
 
-static void pci_register_secondary_bus(PCIBus *parent,
-                                       PCIBus *bus,
-                                       PCIDevice *dev,
-                                       pci_map_irq_fn map_irq,
-                                       const char *name)
-{
-    qbus_create_inplace(&bus->qbus, &pci_bus_info, &dev->qdev, name);
-    bus->map_irq = map_irq;
-    bus->parent_dev = dev;
-
-    QLIST_INIT(&bus->child);
-    QLIST_INSERT_HEAD(&parent->child, bus, sibling);
-}
-
-static void pci_unregister_secondary_bus(PCIBus *bus)
-{
-    assert(QLIST_EMPTY(&bus->child));
-    QLIST_REMOVE(bus, sibling);
-}
-
 static uint32_t pci_config_get_io_base(PCIDevice *d,
                                        uint32_t base, uint32_t base_upper16)
 {
@@ -163,7 +143,8 @@ static int pci_bridge_initfn(PCIDevice *dev)
 static int pci_bridge_exitfn(PCIDevice *pci_dev)
 {
     PCIBridge *s = DO_UPCAST(PCIBridge, dev, pci_dev);
-    pci_unregister_secondary_bus(&s->sec_bus);
+    assert(QLIST_EMPTY(&s->sec_bus.child));
+    QLIST_REMOVE(&s->sec_bus, sibling);
     return 0;
 }
 
@@ -173,6 +154,7 @@ PCIBus *pci_bridge_init(PCIBus *bus, int devfn, bool multifunction,
 {
     PCIDevice *dev;
     PCIBridge *s;
+    PCIBus *sec_bus;
 
     dev = pci_create_multifunction(bus, devfn, multifunction, "pci-bridge");
     qdev_prop_set_uint32(&dev->qdev, "vendorid", vid);
@@ -180,7 +162,13 @@ PCIBus *pci_bridge_init(PCIBus *bus, int devfn, bool multifunction,
     qdev_init_nofail(&dev->qdev);
 
     s = DO_UPCAST(PCIBridge, dev, dev);
-    pci_register_secondary_bus(bus, &s->sec_bus, &s->dev, map_irq, name);
+    sec_bus = &s->sec_bus;
+    qbus_create_inplace(&sec_bus->qbus, &pci_bus_info, &dev->qdev, name);
+    sec_bus->parent_dev = dev;
+    sec_bus->map_irq = map_irq;
+
+    QLIST_INIT(&sec_bus->child);
+    QLIST_INSERT_HEAD(&bus->child, sec_bus, sibling);
     return &s->sec_bus;
 }
 
Signature · 1 line
1.7.1.1
#4 lore raw

PATCH v3 4/4 pci_bridge: introduce pci bridge library.

In reply to Isaku Yamahata

introduce pci bridge library.
convert apb bridge and dec p2p bridge to use new pci bridge library. save/restore is supported as a side effect.
This is also preparation for pci express root/upstream/downstream port.

---
changes v2 -> v3:
eliminate pci_bridge_qdev_register(), pci_bridge_create(), pci_bridge_create_simple() by exporting PCIBus, PCIBridge.

---
 hw/apb_pci.c       |   55 ++++++++++++++++++------
 hw/dec_pci.c       |   45 +++++++++++++++----
 hw/pci_bridge.c    |  122 +++++++++++++++++++++++++++++----------------------
 hw/pci_bridge.h    |   24 ++++++++--
 hw/pci_internals.h |   15 +++++--
 qemu-common.h      |    1 +
 6 files changed, 178 insertions(+), 84 deletions(-)
hw/apb_pci.c +42 -13
index 88ee4a9..10a5baa 100644
@@ -30,6 +30,7 @@
 #include "pci.h"
 #include "pci_host.h"
 #include "pci_bridge.h"
+#include "pci_internals.h"
 #include "rwhandler.h"
 #include "apb_pci.h"
 #include "sysemu.h"
@@ -294,9 +295,17 @@ static void pci_apb_set_irq(void *opaque, int irq_num, int level)
     }
 }
 
-static void apb_pci_bridge_init(PCIBus *b)
+static int apb_pci_bridge_initfn(PCIDevice *dev)
 {
-    PCIDevice *dev = pci_bridge_get_device(b);
+    int rc;
+
+    rc = pci_bridge_initfn(dev);
+    if (rc < 0) {
+        return rc;
+    }
+
+    pci_config_set_vendor_id(dev->config, PCI_VENDOR_ID_SUN);
+    pci_config_set_device_id(dev->config, PCI_DEVICE_ID_SUN_SIMBA);
 
     /*
      * command register:
@@ -313,6 +322,7 @@ static void apb_pci_bridge_init(PCIBus *b)
                  PCI_STATUS_FAST_BACK | PCI_STATUS_66MHZ |
                  PCI_STATUS_DEVSEL_MEDIUM);
     pci_set_byte(dev->config + PCI_REVISION_ID, 0x11);
+    return 0;
 }
 
 PCIBus *pci_apb_init(target_phys_addr_t special_base,
@@ -323,6 +333,8 @@ PCIBus *pci_apb_init(target_phys_addr_t special_base,
     SysBusDevice *s;
     APBState *d;
     unsigned int i;
+    PCIDevice *pci_dev;
+    PCIBridge *br;
 
     /* Ultrasparc PBM main bus */
     dev = qdev_create(NULL, "pbm");
@@ -348,17 +360,21 @@ PCIBus *pci_apb_init(target_phys_addr_t special_base,
     pci_create_simple(d->bus, 0, "pbm");
 
     /* APB secondary busses */
-    *bus2 = pci_bridge_init(d->bus, PCI_DEVFN(1, 0), true,
-                            PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_SIMBA,
-                            pci_apb_map_irq,
-                            "Advanced PCI Bus secondary bridge 1");
-    apb_pci_bridge_init(*bus2);
-
-    *bus3 = pci_bridge_init(d->bus, PCI_DEVFN(1, 1), true,
-                            PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_SIMBA,
-                            pci_apb_map_irq,
-                            "Advanced PCI Bus secondary bridge 2");
-    apb_pci_bridge_init(*bus3);
+    pci_dev = pci_create_multifunction(d->bus, PCI_DEVFN(1, 0), true,
+                                   "pbm-bridge");
+    br = DO_UPCAST(PCIBridge, dev, dev);
+    pci_bridge_map_irq(br, "Advanced PCI Bus secondary bridge 1",
+                       pci_apb_map_irq);
+    qdev_init_nofail(&pci_dev->qdev);
+    *bus2 = pci_bridge_get_sec_bus(br);
+
+    pci_dev = pci_create_multifunction(d->bus, PCI_DEVFN(1, 1), true,
+                                   "pbm-bridge");
+    br = DO_UPCAST(PCIBridge, dev, dev);
+    pci_bridge_map_irq(br, "Advanced PCI Bus secondary bridge 2",
+                       pci_apb_map_irq);
+    qdev_init_nofail(&pci_dev->qdev);
+    *bus3 = pci_bridge_get_sec_bus(br);
 
     return d->bus;
 }
@@ -441,10 +457,23 @@ static SysBusDeviceInfo pbm_host_info = {
     .qdev.reset = pci_pbm_reset,
     .init = pci_pbm_init_device,
 };
+
+static PCIDeviceInfo pbm_pci_bridge_info = {
+    .qdev.name = "pbm-bridge",
+    .qdev.size = sizeof(PCIBridge),
+    .qdev.vmsd = &vmstate_pci_device,
+    .qdev.reset = pci_brdige_reset,
+    .init = apb_pci_bridge_initfn,
+    .exit = pci_bridge_exitfn,
+    .config_write = pci_bridge_write_config,
+    .is_bridge = 1,
+};
+
 static void pbm_register_devices(void)
 {
     sysbus_register_withprop(&pbm_host_info);
     pci_qdev_register(&pbm_pci_host_info);
+    pci_qdev_register(&pbm_pci_bridge_info);
 }
 
 device_init(pbm_register_devices)
hw/dec_pci.c +36 -9

66 lines not on this page · raw message

hw/pci_bridge.c +69 -53

185 lines not on this page · raw message

hw/pci_bridge.h +19 -5
index ddb2c82..63ada19 100644
@@ -29,13 +29,27 @@
 #include "pci.h"
 
 PCIDevice *pci_bridge_get_device(PCIBus *bus);
+PCIBus *pci_bridge_get_sec_bus(PCIBridge *br);
 
-pcibus_t pci_bridge_get_base(PCIDevice *bridge, uint8_t type);
-pcibus_t pci_bridge_get_limit(PCIDevice *bridge, uint8_t type);
+pcibus_t pci_bridge_get_base(const PCIDevice *bridge, uint8_t type);
+pcibus_t pci_bridge_get_limit(const PCIDevice *bridge, uint8_t type);
 
-PCIBus *pci_bridge_init(PCIBus *bus, int devfn, bool multifunction,
-                        uint16_t vid, uint16_t did,
-                        pci_map_irq_fn map_irq, const char *name);
+void pci_bridge_write_config(PCIDevice *d,
+                             uint32_t address, uint32_t val, int len);
+void pci_bridge_reset_reg(PCIDevice *dev);
+void pci_bridge_reset(DeviceState *qdev);
+
+int pci_bridge_initfn(PCIDevice *pci_dev);
+int pci_bridge_exitfn(PCIDevice *pci_dev);
+
+
+/*
+ * before qdev initialization(qdev_init()), this function sets bus_name and
+ * map_irq callback which are necessry for pci_bridge_initfn() to
+ * initialize bus.
+ */
+void pci_bridge_map_irq(PCIBridge *br, const char* bus_name,
+                        pci_map_irq_fn map_irq);
 
 #endif  /* QEMU_PCI_BRIDGE_H */
 /*
hw/pci_internals.h +11 -4
index fa844ab..e3c93a3 100644
@@ -5,6 +5,11 @@
  * This header files is private to pci.c and pci_bridge.c
  * So following structures are opaque to others and shouldn't be
  * accessed.
+ *
+ * For pci-to-pci bridge needs to include this header file to embed
+ * PCIBridge in its structure or to get sizeof(PCIBridge),
+ * However, they shouldn't access those following members directly.
+ * Use accessor function in pci.h, pci_bridge.h
  */
 
 extern struct BusInfo pci_bus_info;
@@ -30,11 +35,13 @@ struct PCIBus {
     int *irq_count;
 };
 
-typedef struct {
+struct PCIBridge {
     PCIDevice dev;
+
+    /* private member */
     PCIBus sec_bus;
-    uint32_t vid;
-    uint32_t did;
-} PCIBridge;
+    pci_map_irq_fn map_irq;
+    const char *bus_name;
+};
 
 #endif /* QEMU_PCI_INTERNALS_H */
qemu-common.h +1 -0
index 3fb2f0b..d735235 100644
@@ -219,6 +219,7 @@ typedef struct PCIHostState PCIHostState;
 typedef struct PCIExpressHost PCIExpressHost;
 typedef struct PCIBus PCIBus;
 typedef struct PCIDevice PCIDevice;
+typedef struct PCIBridge PCIBridge;
 typedef struct SerialState SerialState;
 typedef struct IRQState *qemu_irq;
 typedef struct PCMCIACardState PCMCIACardState;
Signature · 1 line
1.7.1.1
#0 lore raw

v3 cover pci: split out bridge code into pci_bridge and make it library

Changes v2 -> v1:
- dropped first patch as it is merdged.
- rebased to mst's pci branch.
- eliminated pci_brdige_qdev_register(), pci_brdige_create(), pci_brdige_create_simple() by exporting PCIBus and PCIBridge.

Patch description:
Now pci.c has grown. So split bridge related code into dedicated file for further extension to pci bridge. Further clean up and pcie port emulator. This make patch conflict less possible in future.

Clean up of pci host bus ans piix pci as discussed with v1 will be addressed after this patch set is accepted.

changes v1 -> v2:
- introduce pci_internals.h to accomodate pci internal strcutures to share between pci.c and pci_bridge.c
- don't make PCIBridge::bus pointer as suggested by
Michael S. Tsirkin <[email protected]>
- rename PCIBridge::bus -> PCIBridge::sec_bus
- eliminate pci_reguster_secondary_bus()/pci_unregister_secondary_bus()
- document pci bridge library functions.
- introduced pci bridge library.

Isaku Yamahata (4):
pci/bridge: split out pci bridge code into pci_bridge.c from pci.c
pci_bridge: rename PCIBridge::bus -> PCIBridge::sec_bus.
pci_bridge: clean up: remove pci_{register,
unregister}_secondary_bus()
pci_bridge: introduce pci bridge library.

 Makefile.objs      |    2 +-
 hw/apb_pci.c       |   56 +++++++++++---
 hw/dec_pci.c       |   46 +++++++++--
 hw/pci.c           |  177 +-------------------------------------------
 hw/pci.h           |    5 +-
 hw/pci_bridge.c    |  210 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/pci_bridge.h    |   62 +++++++++++++++
 hw/pci_internals.h |   17 +++-
 qemu-common.h      |    1 +
 9 files changed, 369 insertions(+), 207 deletions(-)
 create mode 100644 hw/pci_bridge.c
 create mode 100644 hw/pci_bridge.h
#1 lore raw

PATCH v3 1/4 pci/bridge: split out pci bridge code into pci_bridge.c from pci.c

Move pci bridge related code into pci_bridge.c from pci.c for further enhancement. pci.c is big enough now, so split it out. No code change but exporting some accesser functions.

In fact, few pci bridge functions stays in pci.c.

---
 Makefile.objs   |    2 +-
 hw/apb_pci.c    |    1 +
 hw/dec_pci.c    |    1 +
 hw/pci.c        |  177 +----------------------------------------------
 hw/pci.h        |    5 +-
 hw/pci_bridge.c |  208 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/pci_bridge.h |   48 +++++++++++++
 7 files changed, 262 insertions(+), 180 deletions(-)
 create mode 100644 hw/pci_bridge.c
 create mode 100644 hw/pci_bridge.h
Makefile.objs +1 -1
index 67f1b21..594894b 100644
@@ -139,7 +139,7 @@ user-obj-y += cutils.o cache-utils.o
 hw-obj-y =
 hw-obj-y += vl.o loader.o
 hw-obj-y += virtio.o virtio-console.o
-hw-obj-y += fw_cfg.o pci.o pci_host.o pcie_host.o
+hw-obj-y += fw_cfg.o pci.o pci_host.o pcie_host.o pci_bridge.o
 hw-obj-y += watchdog.o
 hw-obj-$(CONFIG_ISA_MMIO) += isa_mmio.o
 hw-obj-$(CONFIG_ECC) += ecc.o
hw/apb_pci.c +1 -0
index 0ecac55..88ee4a9 100644
@@ -29,6 +29,7 @@
 #include "sysbus.h"
 #include "pci.h"
 #include "pci_host.h"
+#include "pci_bridge.h"
 #include "rwhandler.h"
 #include "apb_pci.h"
 #include "sysemu.h"
hw/dec_pci.c +1 -0
index ee49d5a..f7a9cdc 100644
@@ -27,6 +27,7 @@
 #include "sysbus.h"
 #include "pci.h"
 #include "pci_host.h"
+#include "pci_bridge.h"
 
 /* debug DEC */
 //#define DEBUG_DEC
hw/pci.c +2 -175

216 lines not on this page · raw message

hw/pci.h +1 -4
index 1eab7e7..c551f96 100644
@@ -233,10 +233,7 @@ int pci_read_devaddr(Monitor *mon, const char *addr, int *domp, int *busp,
 
 void do_pci_info_print(Monitor *mon, const QObject *data);
 void do_pci_info(Monitor *mon, QObject **ret_data);
-PCIBus *pci_bridge_init(PCIBus *bus, int devfn, bool multifunction,
-                        uint16_t vid, uint16_t did,
-                        pci_map_irq_fn map_irq, const char *name);
-PCIDevice *pci_bridge_get_device(PCIBus *bus);
+void pci_bridge_update_mappings(PCIBus *b);
 
 static inline void
 pci_set_byte(uint8_t *config, uint8_t val)
hw/pci_bridge.c new file +208 -0

208 lines not on this page · raw message

hw/pci_bridge.h new file +48 -0

48 lines not on this page · raw message

Signature · 1 line
1.7.1.1
#5 lore raw
In reply to Isaku Yamahata

Ping?

Quoted 1 line · Isaku Yamahata

Changes v2 -> v1:

                v3
Quoted 44 lines

- dropped first patch as it is merdged.
- rebased to mst's pci branch.
- eliminated pci_brdige_qdev_register(), pci_brdige_create(), pci_brdige_create_simple() by exporting PCIBus and PCIBridge.

Patch description:
Now pci.c has grown. So split bridge related code into dedicated file for further extension to pci bridge. Further clean up and pcie port emulator. This make patch conflict less possible in future.

Clean up of pci host bus ans piix pci as discussed with v1 will be addressed after this patch set is accepted.

changes v1 -> v2:
- introduce pci_internals.h to accomodate pci internal strcutures to share between pci.c and pci_bridge.c
- don't make PCIBridge::bus pointer as suggested by
Michael S. Tsirkin <[email protected]>
- rename PCIBridge::bus -> PCIBridge::sec_bus
- eliminate pci_reguster_secondary_bus()/pci_unregister_secondary_bus()
- document pci bridge library functions.
- introduced pci bridge library.

Isaku Yamahata (4):
pci/bridge: split out pci bridge code into pci_bridge.c from pci.c
pci_bridge: rename PCIBridge::bus -> PCIBridge::sec_bus.
pci_bridge: clean up: remove pci_{register,
unregister}_secondary_bus()
pci_bridge: introduce pci bridge library.

 Makefile.objs      |    2 +-
 hw/apb_pci.c       |   56 +++++++++++---
 hw/dec_pci.c       |   46 +++++++++--
 hw/pci.c           |  177 +-------------------------------------------
 hw/pci.h           |    5 +-
 hw/pci_bridge.c    |  210 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/pci_bridge.h    |   62 +++++++++++++++
 hw/pci_internals.h |   17 +++-
 qemu-common.h      |    1 +
 9 files changed, 369 insertions(+), 207 deletions(-)
 create mode 100644 hw/pci_bridge.c
 create mode 100644 hw/pci_bridge.h
Signature · 1 line
yamahata
#6 lore raw
Quoted 1 line · Isaku Yamahata

Ping?

You said you will rebase and repost?

Quoted 50 lines · Isaku Yamahata
Quoted 1 line

Changes v2 -> v1:

                v3
Quoted 44 lines

- dropped first patch as it is merdged.
- rebased to mst's pci branch.
- eliminated pci_brdige_qdev_register(), pci_brdige_create(), pci_brdige_create_simple() by exporting PCIBus and PCIBridge.

Patch description:
Now pci.c has grown. So split bridge related code into dedicated file for further extension to pci bridge. Further clean up and pcie port emulator. This make patch conflict less possible in future.

Clean up of pci host bus ans piix pci as discussed with v1 will be addressed after this patch set is accepted.

changes v1 -> v2:
- introduce pci_internals.h to accomodate pci internal strcutures to share between pci.c and pci_bridge.c
- don't make PCIBridge::bus pointer as suggested by
Michael S. Tsirkin <[email protected]>
- rename PCIBridge::bus -> PCIBridge::sec_bus
- eliminate pci_reguster_secondary_bus()/pci_unregister_secondary_bus()
- document pci bridge library functions.
- introduced pci bridge library.

Isaku Yamahata (4):
pci/bridge: split out pci bridge code into pci_bridge.c from pci.c
pci_bridge: rename PCIBridge::bus -> PCIBridge::sec_bus.
pci_bridge: clean up: remove pci_{register,
unregister}_secondary_bus()
pci_bridge: introduce pci bridge library.

 Makefile.objs      |    2 +-
 hw/apb_pci.c       |   56 +++++++++++---
 hw/dec_pci.c       |   46 +++++++++--
 hw/pci.c           |  177 +-------------------------------------------
 hw/pci.h           |    5 +-
 hw/pci_bridge.c    |  210 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/pci_bridge.h    |   62 +++++++++++++++
 hw/pci_internals.h |   17 +++-
 qemu-common.h      |    1 +
 9 files changed, 369 insertions(+), 207 deletions(-)
 create mode 100644 hw/pci_bridge.c
 create mode 100644 hw/pci_bridge.h
Signature · 1 line
yamahata
#7 lore raw
Quoted 4 lines · Michael S. Tsirkin
Quoted 1 line · Isaku Yamahata

Ping?

You said you will rebase and repost?

This is it. Probably there was a race between them

Quoted 52 lines
Quoted 51 lines · Isaku Yamahata
Quoted 1 line

Changes v2 -> v1:

                v3
Quoted 44 lines

- dropped first patch as it is merdged.
- rebased to mst's pci branch.
- eliminated pci_brdige_qdev_register(), pci_brdige_create(), pci_brdige_create_simple() by exporting PCIBus and PCIBridge.

Patch description:
Now pci.c has grown. So split bridge related code into dedicated file for further extension to pci bridge. Further clean up and pcie port emulator. This make patch conflict less possible in future.

Clean up of pci host bus ans piix pci as discussed with v1 will be addressed after this patch set is accepted.

changes v1 -> v2:
- introduce pci_internals.h to accomodate pci internal strcutures to share between pci.c and pci_bridge.c
- don't make PCIBridge::bus pointer as suggested by
Michael S. Tsirkin <[email protected]>
- rename PCIBridge::bus -> PCIBridge::sec_bus
- eliminate pci_reguster_secondary_bus()/pci_unregister_secondary_bus()
- document pci bridge library functions.
- introduced pci bridge library.

Isaku Yamahata (4):
pci/bridge: split out pci bridge code into pci_bridge.c from pci.c
pci_bridge: rename PCIBridge::bus -> PCIBridge::sec_bus.
pci_bridge: clean up: remove pci_{register,
unregister}_secondary_bus()
pci_bridge: introduce pci bridge library.

 Makefile.objs      |    2 +-
 hw/apb_pci.c       |   56 +++++++++++---
 hw/dec_pci.c       |   46 +++++++++--
 hw/pci.c           |  177 +-------------------------------------------
 hw/pci.h           |    5 +-
 hw/pci_bridge.c    |  210 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/pci_bridge.h    |   62 +++++++++++++++
 hw/pci_internals.h |   17 +++-
 qemu-common.h      |    1 +
 9 files changed, 369 insertions(+), 207 deletions(-)
 create mode 100644 hw/pci_bridge.c
 create mode 100644 hw/pci_bridge.h
Signature · 1 line
yamahata
Signature · 1 line
yamahata
#8 lore raw
Quoted 7 lines · Isaku Yamahata
Quoted 4 lines · Michael S. Tsirkin
Quoted 1 line · Isaku Yamahata

Ping?

You said you will rebase and repost?

This is it. Probably there was a race between them

Applied, thanks!

Quoted 55 lines
Quoted 52 lines
Quoted 51 lines · Isaku Yamahata
Quoted 1 line

Changes v2 -> v1:

                v3
Quoted 44 lines

- dropped first patch as it is merdged.
- rebased to mst's pci branch.
- eliminated pci_brdige_qdev_register(), pci_brdige_create(), pci_brdige_create_simple() by exporting PCIBus and PCIBridge.

Patch description:
Now pci.c has grown. So split bridge related code into dedicated file for further extension to pci bridge. Further clean up and pcie port emulator. This make patch conflict less possible in future.

Clean up of pci host bus ans piix pci as discussed with v1 will be addressed after this patch set is accepted.

changes v1 -> v2:
- introduce pci_internals.h to accomodate pci internal strcutures to share between pci.c and pci_bridge.c
- don't make PCIBridge::bus pointer as suggested by
Michael S. Tsirkin <[email protected]>
- rename PCIBridge::bus -> PCIBridge::sec_bus
- eliminate pci_reguster_secondary_bus()/pci_unregister_secondary_bus()
- document pci bridge library functions.
- introduced pci bridge library.

Isaku Yamahata (4):
pci/bridge: split out pci bridge code into pci_bridge.c from pci.c
pci_bridge: rename PCIBridge::bus -> PCIBridge::sec_bus.
pci_bridge: clean up: remove pci_{register,
unregister}_secondary_bus()
pci_bridge: introduce pci bridge library.

 Makefile.objs      |    2 +-
 hw/apb_pci.c       |   56 +++++++++++---
 hw/dec_pci.c       |   46 +++++++++--
 hw/pci.c           |  177 +-------------------------------------------
 hw/pci.h           |    5 +-
 hw/pci_bridge.c    |  210 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/pci_bridge.h    |   62 +++++++++++++++
 hw/pci_internals.h |   17 +++-
 qemu-common.h      |    1 +
 9 files changed, 369 insertions(+), 207 deletions(-)
 create mode 100644 hw/pci_bridge.c
 create mode 100644 hw/pci_bridge.h
Signature · 1 line
yamahata
Signature · 1 line
yamahata