From 5bdafc4099b446609965f9132e6c52a7bdeb9ac8 Mon Sep 17 00:00:00 2001 From: Werner Lewis Date: Tue, 21 Feb 2023 14:40:12 +0000 Subject: [PATCH] fix(n1sdp): add platform-specific power domain functions Commit 4d8c18196378824e388cf31ef991ba8fbbb09cbf added a redistributor power off to resolve an error on N1SDP/Morello. Prior to this fix, turning off both cores in a cluster would cause a hang when powering back on either core. This change introduced issues on other platforms with a different GIC implementation, and was reverted in commit 60719e4e0965aead49d927f12bf2a37bd2629012. This commit uses the previous fix in platform-specific implementations of power domain off/suspend functions. Signed-off-by: Werner Lewis Change-Id: I52c463646c494fe931ff4ce47afb940a56978fcd --- plat/arm/board/n1sdp/n1sdp_bl31_setup.c | 5 ++++- plat/arm/board/n1sdp/n1sdp_pm.c | 29 +++++++++++++++++++++++++ plat/arm/board/n1sdp/n1sdp_private.h | 15 +++++++++++++ plat/arm/board/n1sdp/platform.mk | 1 + 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 plat/arm/board/n1sdp/n1sdp_pm.c create mode 100644 plat/arm/board/n1sdp/n1sdp_private.h diff --git a/plat/arm/board/n1sdp/n1sdp_bl31_setup.c b/plat/arm/board/n1sdp/n1sdp_bl31_setup.c index 4941a4bd4..ec2455f82 100644 --- a/plat/arm/board/n1sdp/n1sdp_bl31_setup.c +++ b/plat/arm/board/n1sdp/n1sdp_bl31_setup.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2022, Arm Limited. All rights reserved. + * Copyright (c) 2018-2023, Arm Limited. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -14,6 +14,7 @@ #include #include "n1sdp_def.h" +#include "n1sdp_private.h" #include /* @@ -69,6 +70,8 @@ scmi_channel_plat_info_t *plat_css_get_scmi_info(unsigned int channel_id) const plat_psci_ops_t *plat_arm_psci_override_pm_ops(plat_psci_ops_t *ops) { + ops->pwr_domain_off = n1sdp_pwr_domain_off; + ops->pwr_domain_suspend = n1sdp_pwr_domain_suspend; return css_scmi_override_pm_ops(ops); } diff --git a/plat/arm/board/n1sdp/n1sdp_pm.c b/plat/arm/board/n1sdp/n1sdp_pm.c new file mode 100644 index 000000000..e43832a23 --- /dev/null +++ b/plat/arm/board/n1sdp/n1sdp_pm.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2023, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include + +#include "n1sdp_private.h" + +/******************************************************************************* + * N1SDP specific functions called when turning off or suspending a power + * domain. Both additionally disable the GIC redistributor interface as cores + * are disabled to let cluster-PPU state transition to completion when a + * cluster is powered down. + ******************************************************************************/ +void n1sdp_pwr_domain_off(const psci_power_state_t *target_state) +{ + css_pwr_domain_off(target_state); + plat_arm_gic_redistif_off(); +} + +void n1sdp_pwr_domain_suspend(const psci_power_state_t *target_state) +{ + css_pwr_domain_suspend(target_state); + plat_arm_gic_redistif_off(); +} diff --git a/plat/arm/board/n1sdp/n1sdp_private.h b/plat/arm/board/n1sdp/n1sdp_private.h new file mode 100644 index 000000000..7a5c51d97 --- /dev/null +++ b/plat/arm/board/n1sdp/n1sdp_private.h @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2023, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef N1SDP_PRIVATE_H +#define N1SDP_PRIVATE_H + +#include + +void n1sdp_pwr_domain_off(const psci_power_state_t *target_state); +void n1sdp_pwr_domain_suspend(const psci_power_state_t *target_state); + +#endif /* N1SDP_PRIVATE_H */ diff --git a/plat/arm/board/n1sdp/platform.mk b/plat/arm/board/n1sdp/platform.mk index 9c0cc022c..bd6261454 100644 --- a/plat/arm/board/n1sdp/platform.mk +++ b/plat/arm/board/n1sdp/platform.mk @@ -47,6 +47,7 @@ BL31_SOURCES := ${N1SDP_CPU_SOURCES} \ ${INTERCONNECT_SOURCES} \ ${N1SDP_GIC_SOURCES} \ ${N1SDP_BASE}/n1sdp_bl31_setup.c \ + ${N1SDP_BASE}/n1sdp_pm.c \ ${N1SDP_BASE}/n1sdp_topology.c \ ${N1SDP_BASE}/n1sdp_security.c \ drivers/arm/css/sds/sds.c -- 2.39.5