@samitouri / QOSamiQemu / commits / 5f8e903c02

hw/hexagon/virt: connect pl011 UART interrupt

Wire pl011's sysbus IRQ into l2vic at IRQ 15. Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Link: https://lore.kernel.org/qemu-devel/20260806042723.3785369-13-brian.cain@oss.qualcomm.com Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>

Brian Cain committed Aug 5, 2026 at 21:27 UTC 5f8e903c02404a8c880b4bfcfbe1589d0a36e911
1 file changed +8 -2
hw/hexagon/virt.c
+8 -2
@@ -39,6 +39,7 @@ enum {
39 * VIRTIO_IRQ_BASE + VIRTIO_DEV_COUNT - 1
40 */
41 static const int VIRTIO_IRQ_BASE = 16;
42 +static const int VIRT_UART0_IRQ = 15;
43
44 static const MemMapEntry base_memmap[] = {
45 [VIRT_UART0] = { 0x10000000, 0x00000200 },
@@ -143,7 +144,7 @@ static int32_t fdt_add_clocks(const HexagonVirtMachineState *vms)
144 }
145
146 static void fdt_add_uart(const HexagonVirtMachineState *vms, int uart,
146 - int32_t clk_phandle)
147 + int32_t clk_phandle, int32_t l2vic_phandle)
148 {
149 char *nodename;
150 hwaddr base = base_memmap[uart].base;
@@ -161,6 +162,8 @@ static void fdt_add_uart(const HexagonVirtMachineState *vms, int uart,
162 qdev_connect_clock_in(dev, "clk", vms->apb_clk);
163 sysbus_realize_and_unref(s, &error_fatal);
164 sysbus_mmio_map(s, 0, base);
165 + sysbus_connect_irq(s, 0,
166 + qdev_get_gpio_in(vms->parent_obj.l2vic, VIRT_UART0_IRQ));
167
168 nodename = g_strdup_printf("/pl011@%" PRIx64, base);
169 qemu_fdt_add_subnode(ms->fdt, nodename);
@@ -168,6 +171,9 @@ static void fdt_add_uart(const HexagonVirtMachineState *vms, int uart,
171 /* Note that we can't use setprop_string because of the embedded NUL */
172 qemu_fdt_setprop(ms->fdt, nodename, "compatible", compat, sizeof(compat));
173 qemu_fdt_setprop_cells(ms->fdt, nodename, "reg", 0, base, size);
174 + qemu_fdt_setprop_cell(ms->fdt, nodename, "interrupts", VIRT_UART0_IRQ);
175 + qemu_fdt_setprop_cell(ms->fdt, nodename, "interrupt-parent",
176 + l2vic_phandle);
177 qemu_fdt_setprop_cells(ms->fdt, nodename, "clocks", clk_phandle,
178 clk_phandle);
179 qemu_fdt_setprop(ms->fdt, nodename, "clock-names", clocknames,
@@ -342,7 +348,7 @@ static void virt_init(MachineState *ms)
348
349 fdt_add_cpu_nodes(vms);
350 clk_phandle = fdt_add_clocks(vms);
345 - fdt_add_uart(vms, VIRT_UART0, clk_phandle);
351 + fdt_add_uart(vms, VIRT_UART0, clk_phandle, l2vic_phandle);
352
353 hexagon_load_fdt(vms);
354 }