This device is used by newer macOS guest releases.
Note that macOS does memory accesses through LDP
to this device that don't meet isv=1 conditions.
Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
---
hw/vmapple/vmapple.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/hw/vmapple/vmapple.c b/hw/vmapple/vmapple.c
index b1379eafef..8de7bbe6cd 100644
--- a/hw/vmapple/vmapple.c
+++ b/hw/vmapple/vmapple.c
@@ -83,6 +83,7 @@ enum {
VMAPPLE_MEM,
VMAPPLE_GIC_DIST,
VMAPPLE_GIC_REDIST,
+ VMAPPLE_GICV2M,
VMAPPLE_UART,
VMAPPLE_RTC,
VMAPPLE_PCIE,
@@ -104,6 +105,7 @@ static const MemMapEntry memmap[] = {
[VMAPPLE_GIC_DIST] = { 0x10000000, 0x00010000 },
[VMAPPLE_GIC_REDIST] = { 0x10010000, 0x00400000 },
+ [VMAPPLE_GICV2M] = { 0x1FFF0000, 0x00010000 },
[VMAPPLE_UART] = { 0x20010000, 0x00010000 },
[VMAPPLE_RTC] = { 0x20050000, 0x00001000 },
@@ -286,6 +288,26 @@ static void create_gic(VMAppleMachineState *vms, MemoryRegion *mem)
}
}
+#define NUM_GICV2M_SPIS 128
+
+static void create_gicv2m(VMAppleMachineState *vms)
+{
+ int i;
+ int irq = vms->irqmap[VMAPPLE_GICV2M];
+ DeviceState *dev;
+
+ dev = qdev_new("arm-gicv2m");
+ qdev_prop_set_uint32(dev, "base-spi", irq);
+ qdev_prop_set_uint32(dev, "num-spi", NUM_GICV2M_SPIS);
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, vms->memmap[VMAPPLE_GICV2M].base);
+
+ for (i = 0; i < NUM_GICV2M_SPIS; i++) {
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), i,
+ qdev_get_gpio_in(vms->gic, irq + i));
+ }
+}
+
static void create_uart(const VMAppleMachineState *vms, int uart,
MemoryRegion *mem, Chardev *chr)
{
@@ -496,6 +518,7 @@ static void mach_vmapple_init(MachineState *machine)
machine->ram);
create_gic(vms, sysmem);
+ create_gicv2m(vms);
create_bdif(vms, sysmem);
create_pvpanic(vms, sysmem);
create_aes(vms, sysmem);
--
2.50.1 (Apple Git-155)