feat(tftf): new interface to get an invalid entrypoint address
TFTF test for invalid entry address in cpu hotplug, validates
for default entry address 0x0 which doesn't account for platforms
for which 0x0 is a valid address. Added function to retrieve invalid
entry address for default scenario and platform implementation to
retrieve specific custom invalid entry address.
Change-Id: I9f109acc8d0443dabd3088cb31852900e8e07853
Signed-off-by: Maheedhar Bollapalli <maheedharsai.bollapalli@amd.com>
diff --git a/include/plat/common/platform.h b/include/plat/common/platform.h
index 1a51823..8103335 100644
--- a/include/plat/common/platform.h
+++ b/include/plat/common/platform.h
@@ -201,4 +201,16 @@
*/
const struct pcie_info_table *plat_pcie_get_info_table(void);
+/*
+ * This function provides an address that is recognized as invalid for use
+ * as an entry point in the CPU_ON and CPU_SUSPEND calls on this platform.
+ * To be considered invalid, the address must fall within a range that is
+ * not accessible to the caller.
+ *
+ * Typically, most platforms designate address 0 for this purpose. However,
+ * on platforms where address 0 is a valid entry point, this function can
+ * be designed to return an alternative address.
+ */
+uintptr_t plat_get_invalid_addr(void);
+
#endif /* __PLATFORM_H__ */
diff --git a/plat/common/plat_common.c b/plat/common/plat_common.c
index a4195c3..da58579 100644
--- a/plat/common/plat_common.c
+++ b/plat/common/plat_common.c
@@ -25,6 +25,7 @@
#pragma weak tftf_plat_reset
#pragma weak plat_get_prot_regions
#pragma weak plat_pcie_get_info_table
+#pragma weak plat_get_invalid_addr
#if IMAGE_TFTF
@@ -154,3 +155,8 @@
{
return NULL;
}
+
+uintptr_t plat_get_invalid_addr(void)
+{
+ return (uintptr_t)0x0;
+}
diff --git a/tftf/tests/runtime_services/standard_service/psci/api_tests/cpu_hotplug/test_psci_hotplug_invalid.c b/tftf/tests/runtime_services/standard_service/psci/api_tests/cpu_hotplug/test_psci_hotplug_invalid.c
index 8d8758b..05dd73d 100644
--- a/tftf/tests/runtime_services/standard_service/psci/api_tests/cpu_hotplug/test_psci_hotplug_invalid.c
+++ b/tftf/tests/runtime_services/standard_service/psci/api_tests/cpu_hotplug/test_psci_hotplug_invalid.c
@@ -164,7 +164,7 @@
* Entry point address argument can be any invalid address.
*/
- psci_ret = tftf_psci_cpu_on(cpu_mpid, 0, 0);
+ psci_ret = tftf_psci_cpu_on(cpu_mpid, plat_get_invalid_addr(), 0);
if (psci_ret != PSCI_E_INVALID_ADDRESS) {
tftf_testcase_printf("CPU:0x%x Expected: %i Actual: %i\n",
cpu_mpid,