qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 8/9] PPC: E500: Spawn PlatBus bridge for ppce500 mac


From: Alexander Graf
Subject: [Qemu-devel] [PATCH 8/9] PPC: E500: Spawn PlatBus bridge for ppce500 machine
Date: Mon, 22 Jul 2013 19:50:10 +0200

With the PV ppce500 we don't have to adhere to real hardware constraints,
but can instead layout the physical address space any way we like it.

So we can also add our fancy new platform bus to it. Through this we add
enablement to spawn platform devices with -M ppce500.

Signed-off-by: Alexander Graf <address@hidden>
---
 hw/ppc/e500.c     | 21 +++++++++++++++++++++
 hw/ppc/e500.h     |  1 +
 hw/ppc/e500plat.c |  1 +
 3 files changed, 23 insertions(+)

diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 904a1e7..8548622 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -36,6 +36,8 @@
 #include "exec/address-spaces.h"
 #include "qemu/host-utils.h"
 #include "hw/pci-host/ppce500.h"
+#include "hw/platbus/bridge.h"
+#include "hw/platbus/device.h"
 
 #define EPAPR_MAGIC                (0x45504150)
 #define BINARY_DEVICE_TREE_FILE    "mpc8544ds.dtb"
@@ -48,6 +50,10 @@
 
 #define RAM_SIZES_ALIGN            (64UL << 20)
 
+#define E500_PLATBUS_BASE          0xF0000000ULL
+#define E500_PLATBUS_FIRST_IRQ     5
+#define E500_PLATBUS_NUM_IRQS      10
+
 /* TODO: parameterize */
 #define MPC8544_CCSRBAR_BASE       0xE0000000ULL
 #define MPC8544_CCSRBAR_SIZE       0x00100000ULL
@@ -731,6 +737,21 @@ void ppce500_init(PPCE500Params *params)
     /* Register spinning region */
     sysbus_create_simple("e500-spin", MPC8544_SPIN_BASE, NULL);
 
+    /* Platform Bus */
+    if (params->has_platbus) {
+        dev = qdev_create(NULL, "platbus-bridge");
+        dev->id = "platbus";
+        qdev_prop_set_uint32(dev, "nr_irqs", E500_PLATBUS_NUM_IRQS);
+        qdev_init_nofail(dev);
+
+        s = SYS_BUS_DEVICE(dev);
+        for (i = 0; i < E500_PLATBUS_NUM_IRQS; i++) {
+            sysbus_connect_irq(s, i, mpic[E500_PLATBUS_FIRST_IRQ + i]);
+        }
+        memory_region_add_subregion(address_space_mem, E500_PLATBUS_BASE,
+                                    sysbus_mmio_get_region(s, 0));
+    }
+
     /* Load kernel. */
     if (params->kernel_filename) {
         kernel_size = load_uimage(params->kernel_filename, &entry,
diff --git a/hw/ppc/e500.h b/hw/ppc/e500.h
index 226c93d..1ed1f7e 100644
--- a/hw/ppc/e500.h
+++ b/hw/ppc/e500.h
@@ -18,6 +18,7 @@ typedef struct PPCE500Params {
     void (*fixup_devtree)(struct PPCE500Params *params, void *fdt);
 
     int mpic_version;
+    bool has_platbus;
 } PPCE500Params;
 
 void ppce500_init(PPCE500Params *params);
diff --git a/hw/ppc/e500plat.c b/hw/ppc/e500plat.c
index c852995..a373936 100644
--- a/hw/ppc/e500plat.c
+++ b/hw/ppc/e500plat.c
@@ -47,6 +47,7 @@ static void e500plat_init(QEMUMachineInitArgs *args)
         .pci_nr_slots = PCI_SLOT_MAX - 1,
         .fixup_devtree = e500plat_fixup_devtree,
         .mpic_version = OPENPIC_MODEL_FSL_MPIC_42,
+        .has_platbus = true,
     };
 
     /* Older KVM versions don't support EPR which breaks guests when we 
announce
-- 
1.8.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]