Remove MPIDR_{CLUSTER,CPU}_ID macros from arch.h
Hardcoding CPU to affinity level 0 and cluster to level 1 isn't correct.
This patch removes the definitions from arch.h to prevent more tests from
making this assumption. It doesn't fix the tests that are already using
them as it may be needed to do more changes to make the tests truly
generic.
Change-Id: I3e5362ef7db7769f7db98ba68ad3842f5baa3e60
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
diff --git a/include/lib/aarch32/arch.h b/include/lib/aarch32/arch.h
index 7606627..3e5e3fb 100644
--- a/include/lib/aarch32/arch.h
+++ b/include/lib/aarch32/arch.h
@@ -51,9 +51,6 @@
#define MPIDR_AFF_ID(mpid, n) \
(((mpid) >> MPIDR_AFF_SHIFT(n)) & MPIDR_AFFLVL_MASK)
-#define MPIDR_CLUSTER_ID(mpid) MPIDR_AFF_ID(mpid, 1)
-#define MPIDR_CPU_ID(mpid) MPIDR_AFF_ID(mpid, 0)
-
#define MPID_MASK (MPIDR_MT_MASK |\
(MPIDR_AFFLVL_MASK << MPIDR_AFF2_SHIFT)|\
(MPIDR_AFFLVL_MASK << MPIDR_AFF1_SHIFT)|\
diff --git a/include/lib/aarch64/arch.h b/include/lib/aarch64/arch.h
index e85d22d..46cdf97 100644
--- a/include/lib/aarch64/arch.h
+++ b/include/lib/aarch64/arch.h
@@ -67,9 +67,6 @@
#define MPIDR_AFF_ID(mpid, n) \
(((mpid) >> MPIDR_AFF_SHIFT(n)) & MPIDR_AFFLVL_MASK)
-#define MPIDR_CLUSTER_ID(mpid) MPIDR_AFF_ID(mpid, 1)
-#define MPIDR_CPU_ID(mpid) MPIDR_AFF_ID(mpid, 0)
-
/*
* An invalid MPID. This value can be used by functions that return an MPID to
* indicate an error.
diff --git a/tftf/tests/runtime_services/standard_service/pmf/api_tests/runtime_instr/test_pmf_rt_instr.c b/tftf/tests/runtime_services/standard_service/pmf/api_tests/runtime_instr/test_pmf_rt_instr.c
index 624940e..ac811e2 100644
--- a/tftf/tests/runtime_services/standard_service/pmf/api_tests/runtime_instr/test_pmf_rt_instr.c
+++ b/tftf/tests/runtime_services/standard_service/pmf/api_tests/runtime_instr/test_pmf_rt_instr.c
@@ -160,8 +160,8 @@
}
printf("<RT_INSTR:%s\t%llu\t%llu\t%02llu\t%02llu\t%02llu/>\n", func_name,
- (unsigned long long)MPIDR_CLUSTER_ID(target_mpid),
- (unsigned long long)MPIDR_CPU_ID(target_mpid),
+ (unsigned long long)MPIDR_AFF_ID(target_mpid, 1),
+ (unsigned long long)MPIDR_AFF_ID(target_mpid, 0),
(unsigned long long)period[0],
(unsigned long long)period[1],
(unsigned long long)period[2]);
@@ -195,8 +195,8 @@
}
printf("<RT_INSTR:%s\t%llu\t%llu\t%02llu/>\n", func_name,
- (unsigned long long)MPIDR_CLUSTER_ID(target_mpid),
- (unsigned long long)MPIDR_CPU_ID(target_mpid),
+ (unsigned long long)MPIDR_AFF_ID(target_mpid, 1),
+ (unsigned long long)MPIDR_AFF_ID(target_mpid, 0),
(unsigned long long)period);
}
diff --git a/tftf/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c b/tftf/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c
index 5abb7f0..5f9393d 100644
--- a/tftf/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c
+++ b/tftf/tests/runtime_services/standard_service/psci/api_tests/affinity_info/test_psci_affinity_info.c
@@ -20,6 +20,11 @@
/* Special value used to terminate the array of expected return values */
#define END_OF_EXPECTED_VALUE 0xDEADBEEF
+
+/* TODO: Remove assumption that affinity levels always map to power levels. */
+#define MPIDR_CLUSTER_ID(mpid) MPIDR_AFF_ID(mpid, 1)
+#define MPIDR_CPU_ID(mpid) MPIDR_AFF_ID(mpid, 0)
+
/*
* Event used by test test_affinity_info_level0_powerdown() to synchronise
* CPUs
diff --git a/tftf/tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c b/tftf/tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c
index 04c5bf8..78e8799 100644
--- a/tftf/tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c
+++ b/tftf/tests/runtime_services/standard_service/psci/api_tests/system_suspend/test_psci_system_suspend.c
@@ -27,6 +27,10 @@
#define SUSPEND_TIME_10_SECS 10000
#define TEST_ITERATION_COUNT 0x5
+/* TODO: Remove assumption that affinity levels always map to power levels. */
+#define MPIDR_CLUSTER_ID(mpid) MPIDR_AFF_ID(mpid, 1)
+#define MPIDR_CPU_ID(mpid) MPIDR_AFF_ID(mpid, 0)
+
/* Helper macro to verify if system suspend API is supported */
#define is_psci_sys_susp64_supported() \
(tftf_get_psci_feature_info(SMC_PSCI_SYSTEM_SUSPEND64) != \
diff --git a/tftf/tests/runtime_services/standard_service/psci/system_tests/test_psci_hotplug_stress.c b/tftf/tests/runtime_services/standard_service/psci/system_tests/test_psci_hotplug_stress.c
index 3ac4bc5..be9b7d3 100644
--- a/tftf/tests/runtime_services/standard_service/psci/system_tests/test_psci_hotplug_stress.c
+++ b/tftf/tests/runtime_services/standard_service/psci/system_tests/test_psci_hotplug_stress.c
@@ -19,6 +19,10 @@
#define STRESS_TEST_COUNT 1000
+/* TODO: Remove assumption that affinity levels always map to power levels. */
+#define MPIDR_CLUSTER_ID(mpid) MPIDR_AFF_ID(mpid, 1)
+#define MPIDR_CPU_ID(mpid) MPIDR_AFF_ID(mpid, 0)
+
static event_t cpu_booted[PLATFORM_CORE_COUNT];
static event_t cluster_booted;