qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

xlnx-zynqmp-pmu: Connect the IPI device to the PMU

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>

authored by

Alistair Francis and committed by
Edgar E. Iglesias
07b30201 b350735e

+31
+31
hw/microblaze/xlnx-zynqmp-pmu.c
··· 24 24 #include "cpu.h" 25 25 #include "boot.h" 26 26 27 + #include "hw/intc/xlnx-zynqmp-ipi.h" 27 28 #include "hw/intc/xlnx-pmu-iomod-intc.h" 28 29 29 30 /* Define the PMU device */ ··· 37 38 #define XLNX_ZYNQMP_PMU_RAM_ADDR 0xFFDC0000 38 39 39 40 #define XLNX_ZYNQMP_PMU_INTC_ADDR 0xFFD40000 41 + 42 + #define XLNX_ZYNQMP_PMU_NUM_IPIS 4 43 + 44 + static const uint64_t ipi_addr[XLNX_ZYNQMP_PMU_NUM_IPIS] = { 45 + 0xFF340000, 0xFF350000, 0xFF360000, 0xFF370000, 46 + }; 47 + static const uint64_t ipi_irq[XLNX_ZYNQMP_PMU_NUM_IPIS] = { 48 + 19, 20, 21, 22, 49 + }; 40 50 41 51 typedef struct XlnxZynqMPPMUSoCState { 42 52 /*< private >*/ ··· 136 146 MemoryRegion *address_space_mem = get_system_memory(); 137 147 MemoryRegion *pmu_rom = g_new(MemoryRegion, 1); 138 148 MemoryRegion *pmu_ram = g_new(MemoryRegion, 1); 149 + XlnxZynqMPIPI *ipi[XLNX_ZYNQMP_PMU_NUM_IPIS]; 150 + qemu_irq irq[32]; 151 + int i; 139 152 140 153 /* Create the ROM */ 141 154 memory_region_init_rom(pmu_rom, NULL, "xlnx-zynqmp-pmu.rom", ··· 154 167 object_property_add_child(OBJECT(machine), "pmu", OBJECT(pmu), 155 168 &error_abort); 156 169 object_property_set_bool(OBJECT(pmu), true, "realized", &error_fatal); 170 + 171 + for (i = 0; i < 32; i++) { 172 + irq[i] = qdev_get_gpio_in(DEVICE(&pmu->intc), i); 173 + } 174 + 175 + /* Create and connect the IPI device */ 176 + for (i = 0; i < XLNX_ZYNQMP_PMU_NUM_IPIS; i++) { 177 + ipi[i] = g_new0(XlnxZynqMPIPI, 1); 178 + object_initialize(ipi[i], sizeof(XlnxZynqMPIPI), TYPE_XLNX_ZYNQMP_IPI); 179 + qdev_set_parent_bus(DEVICE(ipi[i]), sysbus_get_default()); 180 + } 181 + 182 + for (i = 0; i < XLNX_ZYNQMP_PMU_NUM_IPIS; i++) { 183 + object_property_set_bool(OBJECT(ipi[i]), true, "realized", 184 + &error_abort); 185 + sysbus_mmio_map(SYS_BUS_DEVICE(ipi[i]), 0, ipi_addr[i]); 186 + sysbus_connect_irq(SYS_BUS_DEVICE(ipi[i]), 0, irq[ipi_irq[i]]); 187 + } 157 188 158 189 /* Load the kernel */ 159 190 microblaze_load_kernel(&pmu->cpu, XLNX_ZYNQMP_PMU_RAM_ADDR,