summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoby Mathew <soby.mathew@arm.com>2015-07-15 13:36:24 +0100
committerAchin Gupta <achin.gupta@arm.com>2015-08-13 23:48:07 +0100
commitf9e858b1f7b27d8e0b89cc7e12e7a90755d0dd00 (patch)
treee327e8be35e4bb46c7d5342638348d522cf6d0aa
parent617540d860f24c324fbbf418388fb65c0ec83242 (diff)
PSCI: Validate non secure entrypoint on ARM platforms
This patch implements the platform power managment handler to verify non secure entrypoint for ARM platforms. The handler ensures that the entry point specified by the normal world during CPU_SUSPEND, CPU_ON or SYSTEM_SUSPEND PSCI API is a valid address within the non secure DRAM. Change-Id: I4795452df99f67a24682b22f0e0967175c1de429
-rw-r--r--include/plat/arm/common/plat_arm.h1
-rw-r--r--plat/arm/board/fvp/fvp_pm.c3
-rw-r--r--plat/arm/common/arm_pm.c21
-rw-r--r--plat/arm/css/common/css_pm.c3
4 files changed, 26 insertions, 2 deletions
diff --git a/include/plat/arm/common/plat_arm.h b/include/plat/arm/common/plat_arm.h
index 56b5eda5..823212cb 100644
--- a/include/plat/arm/common/plat_arm.h
+++ b/include/plat/arm/common/plat_arm.h
@@ -190,6 +190,7 @@ void arm_tzc_setup(void);
/* PM utility functions */
int arm_validate_power_state(unsigned int power_state,
psci_power_state_t *req_state);
+int arm_validate_ns_entrypoint(uintptr_t entrypoint);
/* Topology utility function */
int arm_check_mpidr(u_register_t mpidr);
diff --git a/plat/arm/board/fvp/fvp_pm.c b/plat/arm/board/fvp/fvp_pm.c
index 8be51054..9d6ab9ce 100644
--- a/plat/arm/board/fvp/fvp_pm.c
+++ b/plat/arm/board/fvp/fvp_pm.c
@@ -304,7 +304,8 @@ static const plat_psci_ops_t fvp_plat_psci_ops = {
.pwr_domain_suspend_finish = fvp_pwr_domain_suspend_finish,
.system_off = fvp_system_off,
.system_reset = fvp_system_reset,
- .validate_power_state = arm_validate_power_state
+ .validate_power_state = arm_validate_power_state,
+ .validate_ns_entrypoint = arm_validate_ns_entrypoint
};
/*******************************************************************************
diff --git a/plat/arm/common/arm_pm.c b/plat/arm/common/arm_pm.c
index 71fbf9f1..b2251700 100644
--- a/plat/arm/common/arm_pm.c
+++ b/plat/arm/common/arm_pm.c
@@ -29,6 +29,7 @@
*/
#include <arch_helpers.h>
+#include <arm_def.h>
#include <assert.h>
#include <errno.h>
#include <plat_arm.h>
@@ -123,3 +124,23 @@ int arm_validate_power_state(unsigned int power_state,
return PSCI_E_SUCCESS;
}
#endif /* __ARM_RECOM_STATE_ID_ENC__ */
+
+/*******************************************************************************
+ * ARM standard platform handler called to check the validity of the non secure
+ * entrypoint.
+ ******************************************************************************/
+int arm_validate_ns_entrypoint(uintptr_t entrypoint)
+{
+ /*
+ * Check if the non secure entrypoint lies within the non
+ * secure DRAM.
+ */
+ if ((entrypoint >= ARM_NS_DRAM1_BASE) && (entrypoint <
+ (ARM_NS_DRAM1_BASE + ARM_NS_DRAM1_SIZE)))
+ return PSCI_E_SUCCESS;
+ if ((entrypoint >= ARM_DRAM2_BASE) && (entrypoint <
+ (ARM_DRAM2_BASE + ARM_DRAM2_SIZE)))
+ return PSCI_E_SUCCESS;
+
+ return PSCI_E_INVALID_ADDRESS;
+}
diff --git a/plat/arm/css/common/css_pm.c b/plat/arm/css/common/css_pm.c
index 435ed2aa..cc64bf8b 100644
--- a/plat/arm/css/common/css_pm.c
+++ b/plat/arm/css/common/css_pm.c
@@ -267,7 +267,8 @@ static const plat_psci_ops_t css_ops = {
.pwr_domain_suspend_finish = css_pwr_domain_suspend_finish,
.system_off = css_system_off,
.system_reset = css_system_reset,
- .validate_power_state = arm_validate_power_state
+ .validate_power_state = arm_validate_power_state,
+ .validate_ns_entrypoint = arm_validate_ns_entrypoint
};
/*******************************************************************************