When bringing up a secondary CPU, call_psci_cpu_on() returns the PSCI
result codes back to arch_cpu_up(). If the physical CPU is already powered
on (PSCI_ALREADY_ON) or is powering on (PSCI_ON_PENDING), these negative
codes are treated as fatal errors. This causes Xen to fail the CPU bring-up.
Map PSCI_ALREADY_ON and PSCI_ON_PENDING return codes to PSCI_SUCCESS
inside call_psci_cpu_on(). This allows arch_cpu_up() to succeed and
lets __cpu_up() proceed to poll until the CPU is fully active.
References: Arm Power State Coordination Interface (DEN0022) Section 5.6.2
"Caller responsibilities", Section 6.6 "Implementation CPU_ON/CPU_OFF races".
Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@epam.com>
---
Test CI pipeline: https://gitlab.com/xen-project/people/dimaprkp4k/xen/-/pipelines/2609141554
---
xen/arch/arm/psci.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/xen/arch/arm/psci.c b/xen/arch/arm/psci.c
index b6860a7760..6015bc0a5a 100644
--- a/xen/arch/arm/psci.c
+++ b/xen/arch/arm/psci.c
@@ -40,11 +40,16 @@ static uint32_t psci_cpu_on_nr;
int call_psci_cpu_on(int cpu)
{
struct arm_smccc_res res;
+ int32_t ret;
arm_smccc_smc(psci_cpu_on_nr, cpu_logical_map(cpu), __pa(init_secondary),
&res);
- return PSCI_RET(res);
+ ret = PSCI_RET(res);
+ if ( ret == PSCI_ALREADY_ON || ret == PSCI_ON_PENDING )
+ return PSCI_SUCCESS;
+
+ return ret;
}
void call_psci_cpu_off(void)
--
2.43.0