summaryrefslogtreecommitdiff
path: root/plat/common
diff options
context:
space:
mode:
authorJeenu Viswambharan <jeenu.viswambharan@arm.com>2017-09-22 08:32:09 +0100
committerJeenu Viswambharan <jeenu.viswambharan@arm.com>2017-10-16 16:50:02 +0100
commitfc529fee720de5fef8388c52bfefcb807ac764b0 (patch)
tree01378c294cf169c5fdf84e3bcab1295ce0bb4068 /plat/common
parent8db978b5a8606a658c65b16fab7edd7a17c7c940 (diff)
GIC: Add API to set interrupt routing
SPIs can be routed to either a specific PE, or to any one of all available PEs. API documentation updated. Change-Id: I28675f634568aaf4ea1aa8aa7ebf25b419a963ed Co-authored-by: Yousuf A <yousuf.sait@arm.com> Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Diffstat (limited to 'plat/common')
-rw-r--r--plat/common/plat_gicv2.c22
-rw-r--r--plat/common/plat_gicv3.c21
2 files changed, 43 insertions, 0 deletions
diff --git a/plat/common/plat_gicv2.c b/plat/common/plat_gicv2.c
index 5df9c79b..c30d872a 100644
--- a/plat/common/plat_gicv2.c
+++ b/plat/common/plat_gicv2.c
@@ -31,6 +31,7 @@
#pragma weak plat_ic_set_interrupt_priority
#pragma weak plat_ic_set_interrupt_type
#pragma weak plat_ic_raise_el3_sgi
+#pragma weak plat_ic_set_spi_routing
/*
* This function returns the highest priority pending interrupt at
@@ -240,3 +241,24 @@ void plat_ic_raise_el3_sgi(int sgi_num, u_register_t target)
assert(0);
#endif
}
+
+void plat_ic_set_spi_routing(unsigned int id, unsigned int routing_mode,
+ u_register_t mpidr)
+{
+ int proc_num = 0;
+
+ switch (routing_mode) {
+ case INTR_ROUTING_MODE_PE:
+ proc_num = plat_core_pos_by_mpidr(mpidr);
+ assert(proc_num >= 0);
+ break;
+ case INTR_ROUTING_MODE_ANY:
+ /* Bit mask selecting all 8 CPUs as candidates */
+ proc_num = -1;
+ break;
+ default:
+ assert(0);
+ }
+
+ gicv2_set_spi_routing(id, proc_num);
+}
diff --git a/plat/common/plat_gicv3.c b/plat/common/plat_gicv3.c
index 819ca451..7b3ea337 100644
--- a/plat/common/plat_gicv3.c
+++ b/plat/common/plat_gicv3.c
@@ -36,6 +36,7 @@
#pragma weak plat_ic_set_interrupt_priority
#pragma weak plat_ic_set_interrupt_type
#pragma weak plat_ic_raise_el3_sgi
+#pragma weak plat_ic_set_spi_routing
CASSERT((INTR_TYPE_S_EL1 == INTR_GROUP1S) &&
(INTR_TYPE_NS == INTR_GROUP1NS) &&
@@ -229,6 +230,26 @@ void plat_ic_raise_el3_sgi(int sgi_num, u_register_t target)
gicv3_raise_secure_g0_sgi(sgi_num, target);
}
+
+void plat_ic_set_spi_routing(unsigned int id, unsigned int routing_mode,
+ u_register_t mpidr)
+{
+ unsigned int irm = 0;
+
+ switch (routing_mode) {
+ case INTR_ROUTING_MODE_PE:
+ assert(plat_core_pos_by_mpidr(mpidr) >= 0);
+ irm = GICV3_IRM_PE;
+ break;
+ case INTR_ROUTING_MODE_ANY:
+ irm = GICV3_IRM_ANY;
+ break;
+ default:
+ assert(0);
+ }
+
+ gicv3_set_spi_routing(id, irm, mpidr);
+}
#endif
#ifdef IMAGE_BL32