[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [RFC PATCH 18/26] ppc/xive: add device tree support
From: |
Cédric Le Goater |
Subject: |
[Qemu-ppc] [RFC PATCH 18/26] ppc/xive: add device tree support |
Date: |
Wed, 5 Jul 2017 19:13:31 +0200 |
As for XICS, the XIVE interface for the guest is described in the
device tree under the interrupt controller node. A couple of new
properties are specific to XIVE :
- "reg"
contains the base address and size of the thread interrupt
managnement areas (TIMA) for the user level for the OS level. Only
the OS level is taken into account.
- "ibm,xive-eq-sizes"
the size of the event queues.
- "ibm,xive-lisn-ranges"
the interrupt numbers ranges assigned to the guest. These are
allocated using a simple bitmap.
Signed-off-by: Cédric Le Goater <address@hidden>
---
hw/intc/xive_spapr.c | 36 ++++++++++++++++++++++++++++++++++++
include/hw/ppc/xive.h | 1 +
2 files changed, 37 insertions(+)
diff --git a/hw/intc/xive_spapr.c b/hw/intc/xive_spapr.c
index b634d1f28f10..64282cb4bfab 100644
--- a/hw/intc/xive_spapr.c
+++ b/hw/intc/xive_spapr.c
@@ -743,3 +743,39 @@ void xive_spapr_init(sPAPRMachineState *spapr)
spapr_register_hypercall(H_INT_SYNC, h_int_sync);
spapr_register_hypercall(H_INT_RESET, h_int_reset);
}
+
+void xive_spapr_populate(XIVE *x, void *fdt)
+{
+ int node;
+ uint64_t timas[2 * 2];
+ uint32_t lisn_ranges[] = {
+ cpu_to_be32(x->int_ipi_top - x->int_base - x->nr_targets), /* start */
+ cpu_to_be32(x->nr_targets), /* count */
+ };
+ uint32_t eq_sizes[] = {
+ cpu_to_be32(12), /* 4K */
+ cpu_to_be32(16), /* 64K */
+ cpu_to_be32(21), /* 2M */
+ cpu_to_be32(24), /* 16M */
+ };
+ int i;
+
+ /* Thread Interrupt Management Areas : User and OS */
+ for (i = 0; i < 2; i++) {
+ timas[i * 2] = cpu_to_be64(x->tm_base + i * (1 << x->tm_shift));
+ timas[i * 2 + 1] = cpu_to_be64(1 << x->tm_shift);
+ }
+
+ _FDT(node = fdt_add_subnode(fdt, 0, "interrupt-controller"));
+
+ _FDT(fdt_setprop_string(fdt, node, "name", "interrupt-controller"));
+ _FDT(fdt_setprop_string(fdt, node, "device_type", "power-ivpe"));
+ _FDT(fdt_setprop(fdt, node, "reg", timas, sizeof(timas)));
+
+ _FDT(fdt_setprop_string(fdt, node, "compatible", "ibm,power-ivpe"));
+ _FDT(fdt_setprop_cell(fdt, node, "#interrupt-cells", 2));
+ _FDT(fdt_setprop(fdt, node, "ibm,xive-eq-sizes", eq_sizes,
+ sizeof(eq_sizes)));
+ _FDT(fdt_setprop(fdt, node, "ibm,xive-lisn-ranges", lisn_ranges,
+ sizeof(lisn_ranges)));
+}
diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h
index af48d62cc776..288116aeb8f4 100644
--- a/include/hw/ppc/xive.h
+++ b/include/hw/ppc/xive.h
@@ -66,5 +66,6 @@ struct XiveICPState {
typedef struct sPAPRMachineState sPAPRMachineState;
void xive_spapr_init(sPAPRMachineState *spapr);
+void xive_spapr_populate(XIVE *x, void *fdt);
#endif /* PPC_XIVE_H */
--
2.7.5
- Re: [Qemu-ppc] [RFC PATCH 14/26] ppc/xive: add MMIO handlers to the XIVE interrupt presenter model, (continued)
[Qemu-ppc] [RFC PATCH 15/26] ppc/xive: push EQ data in OS event queues, Cédric Le Goater, 2017/07/05
[Qemu-ppc] [RFC PATCH 16/26] ppc/xive: notify CPU when interrupt priority is more privileged, Cédric Le Goater, 2017/07/05
[Qemu-ppc] [RFC PATCH 17/26] ppc/xive: add hcalls support, Cédric Le Goater, 2017/07/05
[Qemu-ppc] [RFC PATCH 18/26] ppc/xive: add device tree support,
Cédric Le Goater <=
[Qemu-ppc] [RFC PATCH 19/26] ppc/xive: introduce a helper to map the XIVE memory regions, Cédric Le Goater, 2017/07/05
[Qemu-ppc] [RFC PATCH 20/26] ppc/xive: introduce a helper to create XIVE interrupt source objects, Cédric Le Goater, 2017/07/05
[Qemu-ppc] [RFC PATCH 21/26] ppc/xive: introduce routines to allocate IRQ numbers, Cédric Le Goater, 2017/07/05
[Qemu-ppc] [RFC PATCH 22/26] ppc/xive: create an XIVE interrupt source to handle IPIs, Cédric Le Goater, 2017/07/05
[Qemu-ppc] [RFC PATCH 23/26] spapr: add a XIVE object to the sPAPR machine, Cédric Le Goater, 2017/07/05
[Qemu-ppc] [RFC PATCH 24/26] spapr: include the XIVE interrupt source for IPIs, Cédric Le Goater, 2017/07/05
[Qemu-ppc] [RFC PATCH 25/26] spapr: print the XIVE interrupt source for IPIs in the monitor, Cédric Le Goater, 2017/07/05