From 262aceaac48b56eebf1dcf69601c98c01f6ae38d Mon Sep 17 00:00:00 2001 From: Sandeep Tripathy Date: Wed, 12 Aug 2020 18:42:13 +0530 Subject: [PATCH 1/2] ehf: use common priority level enumuration 'EHF' is used by RAS, SDEI, SPM_MM common frameworks. If platform needs to plug-in specific handlers then 'PLAT_EHF_DESC' can be used to populate platform specific priority levels. Signed-off-by: Sandeep Tripathy Change-Id: I37af7e0e48111f87b6982604bf5c15db3e05755d --- include/plat/arm/common/arm_def.h | 2 +- plat/arm/common/aarch64/arm_ehf.c | 33 --------------------------- plat/arm/common/arm_common.mk | 2 +- plat/common/aarch64/plat_ehf.c | 37 +++++++++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 35 deletions(-) delete mode 100644 plat/arm/common/aarch64/arm_ehf.c create mode 100644 plat/common/aarch64/plat_ehf.c diff --git a/include/plat/arm/common/arm_def.h b/include/plat/arm/common/arm_def.h index 293e7ce6f..c01864306 100644 --- a/include/plat/arm/common/arm_def.h +++ b/include/plat/arm/common/arm_def.h @@ -568,7 +568,7 @@ #define PLAT_SDEI_NORMAL_PRI 0x70 /* ARM platforms use 3 upper bits of secure interrupt priority */ -#define ARM_PRI_BITS 3 +#define PLAT_PRI_BITS 3 /* SGI used for SDEI signalling */ #define ARM_SDEI_SGI ARM_IRQ_SEC_SGI_0 diff --git a/plat/arm/common/aarch64/arm_ehf.c b/plat/arm/common/aarch64/arm_ehf.c deleted file mode 100644 index 69ebd798f..000000000 --- a/plat/arm/common/aarch64/arm_ehf.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include - -#include - -/* - * Enumeration of priority levels on ARM platforms. - */ -ehf_pri_desc_t arm_exceptions[] = { -#if RAS_EXTENSION - /* RAS Priority */ - EHF_PRI_DESC(ARM_PRI_BITS, PLAT_RAS_PRI), -#endif - -#if SDEI_SUPPORT - /* Critical priority SDEI */ - EHF_PRI_DESC(ARM_PRI_BITS, PLAT_SDEI_CRITICAL_PRI), - - /* Normal priority SDEI */ - EHF_PRI_DESC(ARM_PRI_BITS, PLAT_SDEI_NORMAL_PRI), -#endif -#if SPM_MM - EHF_PRI_DESC(ARM_PRI_BITS, PLAT_SP_PRI), -#endif -}; - -/* Plug in ARM exceptions to Exception Handling Framework. */ -EHF_REGISTER_PRIORITIES(arm_exceptions, ARRAY_SIZE(arm_exceptions), ARM_PRI_BITS); diff --git a/plat/arm/common/arm_common.mk b/plat/arm/common/arm_common.mk index 96ab2d300..78c0153d9 100644 --- a/plat/arm/common/arm_common.mk +++ b/plat/arm/common/arm_common.mk @@ -258,7 +258,7 @@ endif endif ifeq (${EL3_EXCEPTION_HANDLING},1) -BL31_SOURCES += plat/arm/common/aarch64/arm_ehf.c +BL31_SOURCES += plat/common/aarch64/plat_ehf.c endif ifeq (${SDEI_SUPPORT},1) diff --git a/plat/common/aarch64/plat_ehf.c b/plat/common/aarch64/plat_ehf.c new file mode 100644 index 000000000..da768843e --- /dev/null +++ b/plat/common/aarch64/plat_ehf.c @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2020, Broadcom + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include + +#include + +/* + * Enumeration of priority levels on ARM platforms. + */ +ehf_pri_desc_t plat_exceptions[] = { +#if RAS_EXTENSION + /* RAS Priority */ + EHF_PRI_DESC(PLAT_PRI_BITS, PLAT_RAS_PRI), +#endif + +#if SDEI_SUPPORT + /* Critical priority SDEI */ + EHF_PRI_DESC(PLAT_PRI_BITS, PLAT_SDEI_CRITICAL_PRI), + + /* Normal priority SDEI */ + EHF_PRI_DESC(PLAT_PRI_BITS, PLAT_SDEI_NORMAL_PRI), +#endif +#if SPM_MM + EHF_PRI_DESC(PLAT_PRI_BITS, PLAT_SP_PRI), +#endif + /* Plaform specific exceptions description */ +#ifdef PLAT_EHF_DESC + PLAT_EHF_DESC, +#endif +}; + +/* Plug in ARM exceptions to Exception Handling Framework. */ +EHF_REGISTER_PRIORITIES(plat_exceptions, ARRAY_SIZE(plat_exceptions), PLAT_PRI_BITS); From deb875b511acdfb02aed3142269162f23f4b57ee Mon Sep 17 00:00:00 2001 From: Sandeep Tripathy Date: Wed, 26 Aug 2020 19:54:41 +0530 Subject: [PATCH 2/2] plat: tegra: Use generic ehf defines Use common ehf file for generic frameworks like SDEI, RAS and extend plat specific defines using 'PLAT_EHF_DESC'. Signed-off-by: Sandeep Tripathy Change-Id: I8a8161c6030f8d226a8bdf0301e7fe6139f019a4 --- plat/nvidia/tegra/common/tegra_common.mk | 4 +++- plat/nvidia/tegra/common/tegra_ehf.c | 28 ------------------------ plat/nvidia/tegra/include/platform_def.h | 3 +++ 3 files changed, 6 insertions(+), 29 deletions(-) delete mode 100644 plat/nvidia/tegra/common/tegra_ehf.c diff --git a/plat/nvidia/tegra/common/tegra_common.mk b/plat/nvidia/tegra/common/tegra_common.mk index bb8bd7d89..c41fcd045 100644 --- a/plat/nvidia/tegra/common/tegra_common.mk +++ b/plat/nvidia/tegra/common/tegra_common.mk @@ -44,7 +44,6 @@ BL31_SOURCES += drivers/delay_timer/delay_timer.c \ ${TEGRA_LIBS}/debug/profiler.c \ ${TEGRA_COMMON}/tegra_bl31_setup.c \ ${TEGRA_COMMON}/tegra_delay_timer.c \ - ${TEGRA_COMMON}/tegra_ehf.c \ ${TEGRA_COMMON}/tegra_fiq_glue.c \ ${TEGRA_COMMON}/tegra_io_storage.c \ ${TEGRA_COMMON}/tegra_platform.c \ @@ -55,3 +54,6 @@ BL31_SOURCES += drivers/delay_timer/delay_timer.c \ ifneq ($(ENABLE_STACK_PROTECTOR), 0) BL31_SOURCES += ${TEGRA_COMMON}/tegra_stack_protector.c endif +ifeq (${EL3_EXCEPTION_HANDLING},1) +BL31_SOURCES += plat/common/aarch64/plat_ehf.c +endif diff --git a/plat/nvidia/tegra/common/tegra_ehf.c b/plat/nvidia/tegra/common/tegra_ehf.c deleted file mode 100644 index ea6e443f3..000000000 --- a/plat/nvidia/tegra/common/tegra_ehf.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2020, NVIDIA Corporation. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include - -#include - -/* - * Enumeration of priority levels on Tegra platforms. - */ -ehf_pri_desc_t tegra_exceptions[] = { - /* Watchdog priority */ - EHF_PRI_DESC(PLAT_PRI_BITS, PLAT_TEGRA_WDT_PRIO), - -#if SDEI_SUPPORT - /* Critical priority SDEI */ - EHF_PRI_DESC(PLAT_PRI_BITS, PLAT_SDEI_CRITICAL_PRI), - - /* Normal priority SDEI */ - EHF_PRI_DESC(PLAT_PRI_BITS, PLAT_SDEI_NORMAL_PRI), -#endif -}; - -/* Plug in Tegra exceptions to Exception Handling Framework. */ -EHF_REGISTER_PRIORITIES(tegra_exceptions, ARRAY_SIZE(tegra_exceptions), PLAT_PRI_BITS); diff --git a/plat/nvidia/tegra/include/platform_def.h b/plat/nvidia/tegra/include/platform_def.h index 2331869d2..1176cde82 100644 --- a/plat/nvidia/tegra/include/platform_def.h +++ b/plat/nvidia/tegra/include/platform_def.h @@ -100,6 +100,9 @@ #define PLAT_SDEI_NORMAL_PRI U(0x30) #define PLAT_TEGRA_WDT_PRIO U(0x40) +#define PLAT_EHF_DESC EHF_PRI_DESC(PLAT_PRI_BITS,\ + PLAT_TEGRA_WDT_PRIO) + /******************************************************************************* * SDEI events ******************************************************************************/