diff --git a/plat/xilinx/versal/include/platform_def.h b/plat/xilinx/versal/include/platform_def.h index 8cf8de0d4..a3886a4be 100644 --- a/plat/xilinx/versal/include/platform_def.h +++ b/plat/xilinx/versal/include/platform_def.h @@ -63,6 +63,12 @@ # define PLAT_ARM_NS_IMAGE_BASE U(PRELOADED_BL33_BASE) #endif +/******************************************************************************* + * HIGH and LOW DDR MAX definitions + ******************************************************************************/ +#define PLAT_DDR_LOWMEM_MAX U(0x80000000) +#define PLAT_DDR_HIGHMEM_MAX U(0x100000000) + /******************************************************************************* * TSP specific defines. ******************************************************************************/ diff --git a/plat/xilinx/versal/plat_psci.c b/plat/xilinx/versal/plat_psci.c index b9762675f..396d7c725 100644 --- a/plat/xilinx/versal/plat_psci.c +++ b/plat/xilinx/versal/plat_psci.c @@ -194,6 +194,18 @@ static void __dead2 versal_system_reset(void) } } +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 @@ static const struct plat_psci_ops versal_nopmc_psci_ops = { .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, }; diff --git a/plat/xilinx/versal_net/include/platform_def.h b/plat/xilinx/versal_net/include/platform_def.h index a7ff84ea5..ae4945060 100644 --- a/plat/xilinx/versal_net/include/platform_def.h +++ b/plat/xilinx/versal_net/include/platform_def.h @@ -72,6 +72,12 @@ # define PLAT_ARM_NS_IMAGE_BASE U(PRELOADED_BL33_BASE) #endif +/******************************************************************************* + * HIGH and LOW DDR MAX definitions + ******************************************************************************/ +#define PLAT_DDR_LOWMEM_MAX U(0x80000000) +#define PLAT_DDR_HIGHMEM_MAX U(0x100000000) + /******************************************************************************* * TSP specific defines. ******************************************************************************/ @@ -84,7 +90,6 @@ /******************************************************************************* * Platform specific page table and MMU setup constants ******************************************************************************/ -#define PLAT_DDR_LOWMEM_MAX U(0x80000000) #define PLAT_PHY_ADDR_SPACE_SIZE (1ULL << 32U) #define PLAT_VIRT_ADDR_SPACE_SIZE (1ULL << 32U) diff --git a/plat/xilinx/versal_net/plat_psci_pm.c b/plat/xilinx/versal_net/plat_psci_pm.c index a76832ee5..eb926eec6 100644 --- a/plat/xilinx/versal_net/plat_psci_pm.c +++ b/plat/xilinx/versal_net/plat_psci_pm.c @@ -103,6 +103,18 @@ exit_label: return; } +static int32_t versal_net_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_net_system_reset() - This function sends the reset request to firmware * for the system to reset. This function does not @@ -303,6 +315,7 @@ static const struct plat_psci_ops versal_net_nopmc_psci_ops = { .pwr_domain_suspend_finish = versal_net_pwr_domain_suspend_finish, .system_off = versal_net_system_off, .system_reset = versal_net_system_reset, + .validate_ns_entrypoint = versal_net_validate_ns_entrypoint, .validate_power_state = versal_net_validate_power_state, .get_sys_suspend_power_state = versal_net_get_sys_suspend_power_state, }; diff --git a/plat/xilinx/zynqmp/include/platform_def.h b/plat/xilinx/zynqmp/include/platform_def.h index 9a9c8d1ca..bf6ed58bb 100644 --- a/plat/xilinx/zynqmp/include/platform_def.h +++ b/plat/xilinx/zynqmp/include/platform_def.h @@ -74,6 +74,12 @@ # define PLAT_ARM_NS_IMAGE_BASE U(PRELOADED_BL33_BASE) #endif +/******************************************************************************* + * HIGH and LOW DDR MAX definitions. + ******************************************************************************/ +#define PLAT_DDR_LOWMEM_MAX U(0x80000000) +#define PLAT_DDR_HIGHMEM_MAX U(0x100000000) + /******************************************************************************* * TSP specific defines. ******************************************************************************/ @@ -87,7 +93,6 @@ * Platform specific page table and MMU setup constants ******************************************************************************/ #define XILINX_OF_BOARD_DTB_MAX_SIZE U(0x200000) -#define PLAT_DDR_LOWMEM_MAX U(0x80000000) #define PLAT_OCM_BASE U(0xFFFC0000) #define PLAT_OCM_LIMIT U(0xFFFFFFFF) diff --git a/plat/xilinx/zynqmp/plat_psci.c b/plat/xilinx/zynqmp/plat_psci.c index 3fae40778..d2faa37c7 100644 --- a/plat/xilinx/zynqmp/plat_psci.c +++ b/plat/xilinx/zynqmp/plat_psci.c @@ -193,6 +193,18 @@ static void __dead2 zynqmp_system_reset(void) } } +static int32_t zynqmp_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; +} + static int32_t zynqmp_validate_power_state(uint32_t power_state, psci_power_state_t *req_state) { @@ -235,6 +247,7 @@ static const struct plat_psci_ops zynqmp_psci_ops = { .pwr_domain_suspend_finish = zynqmp_pwr_domain_suspend_finish, .system_off = zynqmp_system_off, .system_reset = zynqmp_system_reset, + .validate_ns_entrypoint = zynqmp_validate_ns_entrypoint, .validate_power_state = zynqmp_validate_power_state, .get_sys_suspend_power_state = zynqmp_get_sys_suspend_power_state, };