feat(smmu): separate out smmuv3_security_init from smmuv3_init
Split the smmuv3_init() to separate smmuv3_security_init() from it in
order to allow skipping the default deny policy on reset for certain
SMMUv3 implementations.
Additionally, fix a couple of MISRA warnings.
Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
Signed-off-by: Vivek Gautam <vivek.gautam@arm.com>
Change-Id: I2127943e709dd1ded34145bd022c930e351bbb4a
diff --git a/drivers/arm/smmu/smmu_v3.c b/drivers/arm/smmu/smmu_v3.c
index 29b1b5d..6932e61 100644
--- a/drivers/arm/smmu/smmu_v3.c
+++ b/drivers/arm/smmu/smmu_v3.c
@@ -69,17 +69,9 @@
return smmuv3_poll(smmu_base + SMMU_S_GBPA, SMMU_S_GBPA_UPDATE, 0U);
}
-/*
- * Initialize the SMMU by invalidating all secure caches and TLBs.
- * Abort all incoming transactions in order to implement a default
- * deny policy on reset
- */
+/* Initialize the SMMU by invalidating all secure caches and TLBs. */
int __init smmuv3_init(uintptr_t smmu_base)
{
- /* Abort all incoming transactions */
- if (smmuv3_security_init(smmu_base) != 0)
- return -1;
-
/*
* Initiate invalidation of secure caches and TLBs if the SMMU
* supports secure state. If not, it's implementation defined
diff --git a/plat/arm/board/fvp/fvp_bl31_setup.c b/plat/arm/board/fvp/fvp_bl31_setup.c
index e46dbc9..93289b6 100644
--- a/plat/arm/board/fvp/fvp_bl31_setup.c
+++ b/plat/arm/board/fvp/fvp_bl31_setup.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2024, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -73,8 +73,19 @@
fvp_timer_init();
/* On FVP RevC, initialize SMMUv3 */
- if ((arm_config.flags & ARM_CONFIG_FVP_HAS_SMMUV3) != 0U)
- smmuv3_init(PLAT_FVP_SMMUV3_BASE);
+ if ((arm_config.flags & ARM_CONFIG_FVP_HAS_SMMUV3) != 0U) {
+ if (smmuv3_security_init(PLAT_FVP_SMMUV3_BASE) != 0) {
+ /*
+ * Don't proceed for smmuv3 initialization if the
+ * security init failed.
+ */
+ return;
+ }
+ /* SMMUv3 initialization failure is not fatal */
+ if (smmuv3_init(PLAT_FVP_SMMUV3_BASE) != 0) {
+ WARN("Failed initializing SMMU.\n");
+ }
+ }
}
void __init bl31_plat_arch_setup(void)