[Skiboot] [PATCH 10/60] xive: Add CPU node "interrupts" properties representing the IPIs

Benjamin Herrenschmidt benh at kernel.crashing.org
Thu Dec 22 14:16:18 AEDT 2016


This will be used in exploitation mode to request the IPIs for
the various threads. Each core node has an "interrupts" property
of the standard format for each thread of that core.

Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
 hw/xive.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/hw/xive.c b/hw/xive.c
index 980333b..395cb44 100644
--- a/hw/xive.c
+++ b/hw/xive.c
@@ -1979,6 +1979,26 @@ static void xive_init_cpu(struct cpu_thread *c)
 	xive_cpu_dbg(c, "CPU IPI is irq %08x\n", xs->ipi_irq);
 }
 
+static void xive_init_cpu_properties(struct cpu_thread *cpu)
+{
+	struct cpu_thread *t;
+	uint32_t iprop[8][2] = { };
+	uint32_t i;
+
+	assert(cpu_thread_count <= 8);
+
+	if (!cpu->node)
+		return;
+	for (i = 0; i < cpu_thread_count; i++) {
+		t = (i == 0) ? cpu : find_cpu_by_pir(cpu->pir + i);
+		if (!t)
+			continue;
+		iprop[i][0] = t->xstate->ipi_irq;
+		iprop[i][1] = 0; /* Edge */
+	}
+	dt_add_property(cpu->node, "interrupts", iprop, cpu_thread_count * 8);
+	dt_add_property_cells(cpu->node, "interrupt-parent", get_ics_phandle());
+}
 
 static uint32_t xive_read_eq(struct xive_cpu_state *xs, bool just_peek)
 {
@@ -2326,6 +2346,11 @@ void init_xive(void)
 	for_each_cpu(cpu) {
 		xive_init_cpu(cpu);
 	}
+	/* Add interrupts propertie to each CPU node */
+	for_each_cpu(cpu) {
+		if (cpu_is_thread0(cpu))
+			xive_init_cpu_properties(cpu);
+	}
 
 	/* Calling boot CPU */
 	xive_cpu_callin(this_cpu());
-- 
2.9.3



More information about the Skiboot mailing list