From 028c4e42d8f632d40081b88f66d0d05c7d7c9b23 Mon Sep 17 00:00:00 2001 From: Boyan Karatotev Date: Wed, 5 Oct 2022 13:41:56 +0100 Subject: [PATCH] fix(rpi3): tighten platform pwr_domain_pwr_down_wfi behaviour Platforms which implement pwr_domain_pwr_down_wfi differ substantially in behaviour. However, different cpus require similar sequences to power down. This patch tightens the behaviour of these platforms to end on a wfi loop after performing platform power down. This is required so that platforms behave more consistently on power down, in cases where the wfi can fall through. Signed-off-by: Boyan Karatotev Change-Id: Ie29bd3a5e654780bacb4e07a6d123ac6d2467c1f --- docs/getting_started/porting-guide.rst | 3 ++- plat/rpi/common/rpi3_pm.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/getting_started/porting-guide.rst b/docs/getting_started/porting-guide.rst index be4833b48..6996c17db 100644 --- a/docs/getting_started/porting-guide.rst +++ b/docs/getting_started/porting-guide.rst @@ -2769,7 +2769,8 @@ must ensure that races between multiple CPUs cannot occur. The ``target_state`` has a similar meaning as described in the ``pwr_domain_off()`` operation and it encodes the platform coordinated target local power states for the CPU power domain and its parent power domain levels. This function must -not return back to the caller. +not return back to the caller (by calling wfi in an infinite loop to ensure +some CPUs power down mitigations work properly). If this function is not implemented by the platform, PSCI generic implementation invokes ``psci_power_down_wfi()`` for power down. diff --git a/plat/rpi/common/rpi3_pm.c b/plat/rpi/common/rpi3_pm.c index 2f86279c1..d98ac66f4 100644 --- a/plat/rpi/common/rpi3_pm.c +++ b/plat/rpi/common/rpi3_pm.c @@ -187,8 +187,9 @@ static void __dead2 rpi3_pwr_down_wfi( write_rmr_el3(RMR_EL3_RR_BIT | RMR_EL3_AA64_BIT); - while (1) - ; + while (1) { + wfi(); + } } /******************************************************************************* -- 2.39.5