From 02a5bcb0bc3c8596894b6d0ec8c979b330db387a Mon Sep 17 00:00:00 2001 From: Werner Lewis Date: Wed, 15 Feb 2023 16:03:27 +0000 Subject: [PATCH] fix(morello): 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: Ib7689a5e08ada3862406fa92019a6f0bcfb48d79 --- plat/arm/board/morello/morello_bl31_setup.c | 3 +++ plat/arm/board/morello/morello_pm.c | 29 +++++++++++++++++++++ plat/arm/board/morello/morello_private.h | 15 +++++++++++ plat/arm/board/morello/platform.mk | 1 + 4 files changed, 48 insertions(+) create mode 100644 plat/arm/board/morello/morello_pm.c create mode 100644 plat/arm/board/morello/morello_private.h diff --git a/plat/arm/board/morello/morello_bl31_setup.c b/plat/arm/board/morello/morello_bl31_setup.c index cef42f46c..e13a38b32 100644 --- a/plat/arm/board/morello/morello_bl31_setup.c +++ b/plat/arm/board/morello/morello_bl31_setup.c @@ -12,6 +12,7 @@ #include #include "morello_def.h" +#include "morello_private.h" #include #ifdef TARGET_PLATFORM_SOC @@ -33,6 +34,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 = morello_pwr_domain_off; + ops->pwr_domain_suspend = morello_pwr_domain_suspend; return css_scmi_override_pm_ops(ops); } diff --git a/plat/arm/board/morello/morello_pm.c b/plat/arm/board/morello/morello_pm.c new file mode 100644 index 000000000..dda006eac --- /dev/null +++ b/plat/arm/board/morello/morello_pm.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2023, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include + +#include "morello_private.h" + +/******************************************************************************* + * Morello 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 morello_pwr_domain_off(const psci_power_state_t *target_state) +{ + css_pwr_domain_off(target_state); + plat_arm_gic_redistif_off(); +} + +void morello_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/morello/morello_private.h b/plat/arm/board/morello/morello_private.h new file mode 100644 index 000000000..ea2fce974 --- /dev/null +++ b/plat/arm/board/morello/morello_private.h @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2023, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef MORELLO_PRIVATE_H +#define MORELLO_PRIVATE_H + +#include + +void morello_pwr_domain_off(const psci_power_state_t *target_state); +void morello_pwr_domain_suspend(const psci_power_state_t *target_state); + +#endif /* MORELLO_PRIVATE_H */ diff --git a/plat/arm/board/morello/platform.mk b/plat/arm/board/morello/platform.mk index 0f0cabbad..0ae769338 100644 --- a/plat/arm/board/morello/platform.mk +++ b/plat/arm/board/morello/platform.mk @@ -49,6 +49,7 @@ BL31_SOURCES := ${MORELLO_CPU_SOURCES} \ ${INTERCONNECT_SOURCES} \ ${MORELLO_GIC_SOURCES} \ ${MORELLO_BASE}/morello_bl31_setup.c \ + ${MORELLO_BASE}/morello_pm.c \ ${MORELLO_BASE}/morello_topology.c \ ${MORELLO_BASE}/morello_security.c \ drivers/arm/css/sds/sds.c -- 2.39.5