aboutsummaryrefslogtreecommitdiff
path: root/arch/arm64/kernel/psci.c
diff options
context:
space:
mode:
authorGravatar Sudeep Holla <sudeep.holla@arm.com> 2019-06-12 13:51:37 +0100
committerGravatar Will Deacon <will@kernel.org> 2019-08-15 11:12:03 +0100
commitd55c5f28afafb6b1f0a6978916b23338b383faab (patch)
treef9f03d19dc8328624ac57d92da43c8155561b8d5 /arch/arm64/kernel/psci.c
parentPSCI: cpuidle: Refactor CPU suspend power_state parameter handling (diff)
downloadlinux-d55c5f28afafb6b1f0a6978916b23338b383faab.tar.gz
linux-d55c5f28afafb6b1f0a6978916b23338b383faab.tar.bz2
linux-d55c5f28afafb6b1f0a6978916b23338b383faab.zip
arm64: smp: disable hotplug on trusted OS resident CPU
The trusted OS may reject CPU_OFF calls to its resident CPU, so we must avoid issuing those. We never migrate a Trusted OS and we already take care to prevent CPU_OFF PSCI call. However, this is not reflected explicitly to the userspace. Any user can attempt to hotplug trusted OS resident CPU. The entire motion of going through the various state transitions in the CPU hotplug state machine gets executed and the PSCI layer finally refuses to make CPU_OFF call. This results is unnecessary unwinding of CPU hotplug state machine in the kernel. Instead we can mark the trusted OS resident CPU as not available for hotplug, so that the user attempt or request to do the same will get immediately rejected. Cc: Mark Rutland <mark.rutland@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'arch/arm64/kernel/psci.c')
-rw-r--r--arch/arm64/kernel/psci.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c
index a543ab7e007c..c9f72b2665f1 100644
--- a/arch/arm64/kernel/psci.c
+++ b/arch/arm64/kernel/psci.c
@@ -46,6 +46,11 @@ static int cpu_psci_cpu_boot(unsigned int cpu)
}
#ifdef CONFIG_HOTPLUG_CPU
+static bool cpu_psci_cpu_can_disable(unsigned int cpu)
+{
+ return !psci_tos_resident_on(cpu);
+}
+
static int cpu_psci_cpu_disable(unsigned int cpu)
{
/* Fail early if we don't have CPU_OFF support */
@@ -109,6 +114,7 @@ const struct cpu_operations cpu_psci_ops = {
.cpu_prepare = cpu_psci_cpu_prepare,
.cpu_boot = cpu_psci_cpu_boot,
#ifdef CONFIG_HOTPLUG_CPU
+ .cpu_can_disable = cpu_psci_cpu_can_disable,
.cpu_disable = cpu_psci_cpu_disable,
.cpu_die = cpu_psci_cpu_die,
.cpu_kill = cpu_psci_cpu_kill,