fix: serialize powering on secondary CPUs

This patch provides a temporary workaround for the following issue
seen with a notifications test in SPM test suite.

ERROR:   Unexpected affinity info state.
PANIC in EL3.

The reason for assertion fail in warmboot entrypath for a secondary
CPU needs further investigation but we believe it is possibly related
to the more common issue in the PSCI library as described here [1]

In order to increase the time between cache line invalidations,
TFTF brings secondary CPUs online one after the other.

[1] https://review.trustedfirmware.org/plugins/gitiles/TF-A/trusted-firmware-a/+/a291687de235da617afe25ad5226f448cac5c567/lib/psci/psci_on.c#122

Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Change-Id: Ie523e40d4c90f52ecc8c7c42fce6ff214003ccc4
diff --git a/tftf/tests/common/test_helpers.c b/tftf/tests/common/test_helpers.c
index bd82fd9..46a376f 100644
--- a/tftf/tests/common/test_helpers.c
+++ b/tftf/tests/common/test_helpers.c
@@ -191,6 +191,7 @@
 		tftf_init_event(&cpu_done[i]);
 	}
 
+	 /* Power on each secondary CPU one after the other. */
 	for_each_cpu(cpu_node) {
 		mpidr = tftf_get_mpidr_from_node(cpu_node);
 		if (mpidr == lead_mpid) {
@@ -202,16 +203,8 @@
 			ERROR("tftf_cpu_on mpidr 0x%x returns %d\n",
 			      mpidr, ret);
 		}
-	}
 
-	VERBOSE("Waiting secondary CPUs to turn off ...\n");
-
-	for_each_cpu(cpu_node) {
-		mpidr = tftf_get_mpidr_from_node(cpu_node);
-		if (mpidr == lead_mpid) {
-			continue;
-		}
-
+		/* Wait for the secondary CPU to be ready. */
 		core_pos = platform_get_core_pos(mpidr);
 		tftf_wait_for_event(&cpu_done[core_pos]);
 	}