From: Shawn Lin Date: Wed, 19 Feb 2025 00:58:09 +0000 (+0800) Subject: pmdomain: rockchip: Check if SMC could be handled by TA X-Git-Tag: v6.15-rc1~177^2~21^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61eeb9678789644f118eff608d9031b5de4f719d;p=thirdparty%2Fkernel%2Fstable.git pmdomain: rockchip: Check if SMC could be handled by TA Non-existent trusted-firmware could lead to SMC calls into some unset location, that breaks the system. Let's check that it's supported before executing the SMC. Reported-by: Steven Price Suggested-by: Heiko Stuebner Fixes: 58ebba35ddab ("pmdomain: rockchip: Add smc call to inform firmware") Signed-off-by: Shawn Lin Reviewed-by: Heiko Stuebner Tested-by: Steven Price Link: https://lore.kernel.org/r/1739926689-151827-1-git-send-email-shawn.lin@rock-chips.com Signed-off-by: Ulf Hansson --- diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c index 49842f16f33d0..27a5c68ff8ba0 100644 --- a/drivers/pmdomain/rockchip/pm-domains.c +++ b/drivers/pmdomain/rockchip/pm-domains.c @@ -572,9 +572,10 @@ static void rockchip_do_pmu_set_power_domain(struct rockchip_pm_domain *pd, } /* Inform firmware to keep this pd on or off */ - arm_smccc_smc(ROCKCHIP_SIP_SUSPEND_MODE, ROCKCHIP_SLEEP_PD_CONFIG, - pmu->info->pwr_offset + pd_pwr_offset, - pd->info->pwr_mask, on, 0, 0, 0, &res); + if (arm_smccc_1_1_get_conduit() != SMCCC_CONDUIT_NONE) + arm_smccc_smc(ROCKCHIP_SIP_SUSPEND_MODE, ROCKCHIP_SLEEP_PD_CONFIG, + pmu->info->pwr_offset + pd_pwr_offset, + pd->info->pwr_mask, on, 0, 0, 0, &res); } static int rockchip_pd_power(struct rockchip_pm_domain *pd, bool power_on)