[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 3/9] hw/loongarch: Add interrupt information to FDT table
From: |
Song Gao |
Subject: |
[PULL v2 3/9] hw/loongarch: Add interrupt information to FDT table |
Date: |
Tue, 20 Sep 2022 17:50:52 +0800 |
From: Xiaojuan Yang <yangxiaojuan@loongson.cn>
Add interrupt information to FDT table, such as interrupt
controller info, compatiable info, etc.
Signed-off-by: Xiaojuan Yang <yangxiaojuan@loongson.cn>
Acked-by: Song Gao <gaosong@loongson.cn>
Message-Id: <20220908094623.73051-4-yangxiaojuan@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
---
hw/loongarch/virt.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index 4f833a2044..68b59a6c9f 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -158,6 +158,33 @@ static void fdt_add_pcie_node(const LoongArchMachineState
*lams)
qemu_fdt_dumpdtb(ms->fdt, lams->fdt_size);
}
+static void fdt_add_irqchip_node(LoongArchMachineState *lams)
+{
+ MachineState *ms = MACHINE(lams);
+ char *nodename;
+ uint32_t irqchip_phandle;
+
+ irqchip_phandle = qemu_fdt_alloc_phandle(ms->fdt);
+ qemu_fdt_setprop_cell(ms->fdt, "/", "interrupt-parent", irqchip_phandle);
+
+ nodename = g_strdup_printf("/intc@%lx", VIRT_IOAPIC_REG_BASE);
+ qemu_fdt_add_subnode(ms->fdt, nodename);
+ qemu_fdt_setprop_cell(ms->fdt, nodename, "#interrupt-cells", 3);
+ qemu_fdt_setprop(ms->fdt, nodename, "interrupt-controller", NULL, 0);
+ qemu_fdt_setprop_cell(ms->fdt, nodename, "#address-cells", 0x2);
+ qemu_fdt_setprop_cell(ms->fdt, nodename, "#size-cells", 0x2);
+ qemu_fdt_setprop(ms->fdt, nodename, "ranges", NULL, 0);
+
+ qemu_fdt_setprop_string(ms->fdt, nodename, "compatible",
+ "loongarch,ls7a");
+
+ qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",
+ 2, VIRT_IOAPIC_REG_BASE,
+ 2, PCH_PIC_ROUTE_ENTRY_OFFSET);
+
+ qemu_fdt_setprop_cell(ms->fdt, nodename, "phandle", irqchip_phandle);
+ g_free(nodename);
+}
#define PM_BASE 0x10080000
#define PM_SIZE 0x100
@@ -697,6 +724,7 @@ static void loongarch_init(MachineState *machine)
}
/* Initialize the IO interrupt subsystem */
loongarch_irq_init(lams);
+ fdt_add_irqchip_node(lams);
lams->machine_done.notify = virt_machine_done;
qemu_add_machine_init_done_notifier(&lams->machine_done);
fdt_add_pcie_node(lams);
--
2.31.1
- [PULL v2 0/9] loongarch-to-apply queue, Song Gao, 2022/09/20
- [PULL v2 4/9] hw/loongarch: Add platform bus support, Song Gao, 2022/09/20
- [PULL v2 5/9] hw/loongarch: Add hotplug handler for machine, Song Gao, 2022/09/20
- [PULL v2 3/9] hw/loongarch: Add interrupt information to FDT table,
Song Gao <=
- [PULL v2 8/9] hw/loongarch: Support memory hotplug, Song Gao, 2022/09/20
- [PULL v2 1/9] hw/loongarch: Remove vga device when loongarch init, Song Gao, 2022/09/20
- [PULL v2 9/9] hw/loongarch: Improve acpi dsdt table, Song Gao, 2022/09/20
- [PULL v2 2/9] hw/loongarch: Support fw_cfg dma function, Song Gao, 2022/09/20
- [PULL v2 7/9] hw/loongarch: Fix acpi ged irq number in dsdt table, Song Gao, 2022/09/20
- [PULL v2 6/9] hw/loongarch: Add RAMFB to dynamic_sysbus_devices list, Song Gao, 2022/09/20
- Re: [PULL v2 0/9] loongarch-to-apply queue, Stefan Hajnoczi, 2022/09/20
- Re: [PULL v2 0/9] loongarch-to-apply queue, Stefan Hajnoczi, 2022/09/20