fix(versal): handle invalid entry point in cpu hotplug scenario
Invalid addresses are from 2G-4G and also address where TF-A is.
Change-Id: I3d07808821da3bdd46be819ad829cb284f9d53d3
Signed-off-by: Maheedhar Bollapalli <maheedharsai.bollapalli@amd.com>
diff --git a/plat/xilinx/versal/plat_psci.c b/plat/xilinx/versal/plat_psci.c
index b976267..396d7c7 100644
--- a/plat/xilinx/versal/plat_psci.c
+++ b/plat/xilinx/versal/plat_psci.c
@@ -194,6 +194,18 @@
}
}
+static int32_t versal_validate_ns_entrypoint(uint64_t ns_entrypoint)
+{
+ int32_t ret = PSCI_E_SUCCESS;
+
+ if (((ns_entrypoint >= PLAT_DDR_LOWMEM_MAX) && (ns_entrypoint <= PLAT_DDR_HIGHMEM_MAX)) ||
+ ((ns_entrypoint >= BL31_BASE) && (ns_entrypoint <= BL31_LIMIT))) {
+ ret = PSCI_E_INVALID_ADDRESS;
+ }
+
+ return ret;
+}
+
/**
* versal_pwr_domain_off() - This function performs actions to turn off core.
* @target_state: Targated state.
@@ -291,6 +303,7 @@
.pwr_domain_suspend_finish = versal_pwr_domain_suspend_finish,
.system_off = versal_system_off,
.system_reset = versal_system_reset,
+ .validate_ns_entrypoint = versal_validate_ns_entrypoint,
.validate_power_state = versal_validate_power_state,
.get_sys_suspend_power_state = versal_get_sys_suspend_power_state,
};