summaryrefslogtreecommitdiff
path: root/plat
diff options
context:
space:
mode:
authorMadhukar Pappireddy <madhukar.pappireddy@arm.com>2023-08-03 14:17:54 -0500
committerMadhukar Pappireddy <madhukar.pappireddy@arm.com>2023-09-25 17:09:04 -0500
commit632e5ffeb8f50a98090065b63d9d071b72acd23c (patch)
treeabedf049fe2a31a84714f2dc5616586cc4eebd34 /plat
parentab80cf35e7b7cc2730d1806348024416833e23f2 (diff)
fix(gicv3): map generic interrupt type to GICv3 group
The generic interrupt controller identifies an interrupt based on its type whereas the GIC uses the notion of groups to identify an interrupt. Currently, they are used interchangeably in GICv3 driver. It did not cause any functional issues since the matching type and group had the same value for corresponding macros. This patch makes the necessary fixes. The generic interrupt controller APIs, such as plat_ic_set_interrupt_type map interrupt type to interrupt group supported by the GICv3 IP. Similarly, other generic interrupt controller APIs map interrupt group to interrupt type as needed. This patch also changes the name of the helper functions to use group rather than type for handling interrupts. Change-Id: Ie2d88a3260c71e4ab9c8baacde24cc21e551de3d Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Diffstat (limited to 'plat')
-rw-r--r--plat/common/plat_gicv3.c44
1 files changed, 36 insertions, 8 deletions
diff --git a/plat/common/plat_gicv3.c b/plat/common/plat_gicv3.c
index e1420bb90..2739490da 100644
--- a/plat/common/plat_gicv3.c
+++ b/plat/common/plat_gicv3.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved.
* Portions copyright (c) 2021-2022, ProvenRun S.A.S. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -47,10 +47,6 @@
#pragma weak plat_ic_set_interrupt_pending
#pragma weak plat_ic_clear_interrupt_pending
-CASSERT((INTR_TYPE_S_EL1 == INTR_GROUP1S) &&
- (INTR_TYPE_NS == INTR_GROUP1NS) &&
- (INTR_TYPE_EL3 == INTR_GROUP0), assert_interrupt_type_mismatch);
-
/*
* This function returns the highest priority pending interrupt at
* the Interrupt controller
@@ -116,12 +112,26 @@ uint32_t plat_ic_acknowledge_interrupt(void)
/*
* This function returns the type of the interrupt `id`, depending on how
- * the interrupt has been configured in the interrupt controller
+ * the interrupt has been configured in the interrupt controller.
*/
uint32_t plat_ic_get_interrupt_type(uint32_t id)
{
+ unsigned int group;
+
assert(IS_IN_EL3());
- return gicv3_get_interrupt_type(id, plat_my_core_pos());
+ group = gicv3_get_interrupt_group(id, plat_my_core_pos());
+
+ switch (group) {
+ case INTR_GROUP0:
+ return INTR_TYPE_EL3;
+ case INTR_GROUP1S:
+ return INTR_TYPE_S_EL1;
+ case INTR_GROUP1NS:
+ return INTR_TYPE_NS;
+ default:
+ assert(false); /* Unreachable */
+ return INTR_TYPE_EL3;
+ }
}
/*
@@ -234,7 +244,25 @@ int plat_ic_has_interrupt_type(unsigned int type)
void plat_ic_set_interrupt_type(unsigned int id, unsigned int type)
{
- gicv3_set_interrupt_type(id, plat_my_core_pos(), type);
+ unsigned int group;
+
+ switch (type) {
+ case INTR_TYPE_EL3:
+ group = INTR_GROUP0;
+ break;
+ case INTR_TYPE_S_EL1:
+ group = INTR_GROUP1S;
+ break;
+ case INTR_TYPE_NS:
+ group = INTR_GROUP1NS;
+ break;
+ default:
+ assert(false); /* Unreachable */
+ group = INTR_GROUP0;
+ break;
+ }
+
+ gicv3_set_interrupt_group(id, plat_my_core_pos(), group);
}
void plat_ic_raise_el3_sgi(int sgi_num, u_register_t target)