summaryrefslogtreecommitdiff
path: root/plat
diff options
context:
space:
mode:
authorOlivier Deprez <olivier.deprez@arm.com>2023-09-28 15:19:40 +0200
committerTrustedFirmware Code Review <review@review.trustedfirmware.org>2023-09-28 15:19:40 +0200
commit494babe05d0826efb2835b3fc5217068f4585c5e (patch)
tree62f9430631b469699b68f623c7b8a842a4ad6089 /plat
parentee7d7f66a7184bfdc0dda273eb66867d4cf21acd (diff)
parent1f6bb41dd951714b47bf07bb9a332346ca261033 (diff)
Merge changes from topic "mp/fix_interrupt_type" into integration
* changes: refactor(el3-runtime): plat_ic_has_interrupt_type returns bool fix(el3-runtime): leverage generic interrupt controller helpers fix(gicv3): map generic interrupt type to GICv3 group chore(gicv2): use interrupt group instead of type
Diffstat (limited to 'plat')
-rw-r--r--plat/common/plat_gicv2.c18
-rw-r--r--plat/common/plat_gicv3.c55
-rw-r--r--plat/rpi/rpi3/platform.mk3
3 files changed, 54 insertions, 22 deletions
diff --git a/plat/common/plat_gicv2.c b/plat/common/plat_gicv2.c
index 0f988dc74..f78d2dfc6 100644
--- a/plat/common/plat_gicv2.c
+++ b/plat/common/plat_gicv2.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
@@ -193,9 +193,9 @@ void plat_ic_set_interrupt_priority(unsigned int id, unsigned int priority)
gicv2_set_interrupt_priority(id, priority);
}
-int plat_ic_has_interrupt_type(unsigned int type)
+bool plat_ic_has_interrupt_type(unsigned int type)
{
- int has_interrupt_type = 0;
+ bool has_interrupt_type = false;
switch (type) {
#if GICV2_G0_FOR_EL3
@@ -204,7 +204,7 @@ int plat_ic_has_interrupt_type(unsigned int type)
case INTR_TYPE_S_EL1:
#endif
case INTR_TYPE_NS:
- has_interrupt_type = 1;
+ has_interrupt_type = true;
break;
default:
/* Do nothing in default case */
@@ -216,7 +216,7 @@ int plat_ic_has_interrupt_type(unsigned int type)
void plat_ic_set_interrupt_type(unsigned int id, unsigned int type)
{
- unsigned int gicv2_type = 0U;
+ unsigned int gicv2_group = 0U;
/* Map canonical interrupt type to GICv2 type */
switch (type) {
@@ -225,17 +225,17 @@ void plat_ic_set_interrupt_type(unsigned int id, unsigned int type)
#else
case INTR_TYPE_S_EL1:
#endif
- gicv2_type = GICV2_INTR_GROUP0;
+ gicv2_group = GICV2_INTR_GROUP0;
break;
case INTR_TYPE_NS:
- gicv2_type = GICV2_INTR_GROUP1;
+ gicv2_group = GICV2_INTR_GROUP1;
break;
default:
- assert(0); /* Unreachable */
+ assert(false); /* Unreachable */
break;
}
- gicv2_set_interrupt_type(id, gicv2_type);
+ gicv2_set_interrupt_group(id, gicv2_group);
}
void plat_ic_raise_el3_sgi(int sgi_num, u_register_t target)
diff --git a/plat/common/plat_gicv3.c b/plat/common/plat_gicv3.c
index e1420bb90..baa70e0ba 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;
+ }
}
/*
@@ -225,16 +235,37 @@ void plat_ic_set_interrupt_priority(unsigned int id, unsigned int priority)
gicv3_set_interrupt_priority(id, plat_my_core_pos(), priority);
}
-int plat_ic_has_interrupt_type(unsigned int type)
+bool plat_ic_has_interrupt_type(unsigned int type)
{
- assert((type == INTR_TYPE_EL3) || (type == INTR_TYPE_S_EL1) ||
- (type == INTR_TYPE_NS));
- return 1;
+ if ((type == INTR_TYPE_EL3) || (type == INTR_TYPE_S_EL1) ||
+ (type == INTR_TYPE_NS)) {
+ return true;
+ }
+
+ return false;
}
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)
diff --git a/plat/rpi/rpi3/platform.mk b/plat/rpi/rpi3/platform.mk
index 53c97e225..06393e40b 100644
--- a/plat/rpi/rpi3/platform.mk
+++ b/plat/rpi/rpi3/platform.mk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -44,6 +44,7 @@ BL2_SOURCES += common/desc_image_load.c \
plat/rpi/common/rpi3_io_storage.c
BL31_SOURCES += lib/cpus/aarch64/cortex_a53.S \
+ plat/common/plat_gicv2.c \
plat/common/plat_psci_common.c \
plat/rpi/rpi3/rpi3_bl31_setup.c \
plat/rpi/common/rpi3_pm.c \