From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] arm64: psci: respect MIGRATE_INFO_TYPE
Date: Fri, 5 Sep 2014 12:22:18 +0100 [thread overview]
Message-ID: <1409916139-20127-2-git-send-email-mark.rutland@arm.com> (raw)
In-Reply-To: <1409916139-20127-1-git-send-email-mark.rutland@arm.com>
Commit e71246a23acb (PSCI: Add initial support for PSCIv0.2 functions)
added hooks for MIGRATE_INFO_TYPE, but didn't call it anywhere. This
means that currently a UP Trusted OS can reject CPU_OFF calls, which
will cause things to blow up.
This patch ensures we test MIGRATE_INFO_TYPE before calling CPU_OFF. If
there's a UP trusted OS hotplug is rejected. Full support for PSCI in
the presence of a UP trusted OS will require the use of MIGRATE and will
have to come as a later patch.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Ashwin Chaugule <ashwin.chaugule@linaro.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Christoffer Dall <christoffer.dall@linaro.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
---
arch/arm64/kernel/psci.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c
index 5539547..a5407af 100644
--- a/arch/arm64/kernel/psci.c
+++ b/arch/arm64/kernel/psci.c
@@ -386,6 +386,20 @@ static int cpu_psci_cpu_disable(unsigned int cpu)
/* Fail early if we don't have CPU_OFF support */
if (!psci_ops.cpu_off)
return -EOPNOTSUPP;
+
+ /*
+ * In the presence of a UP trusted OS, it might not be possible to
+ * hotplug certain CPUs, and CPU_OFF may return (which would be bad).
+ * Supporting a UP trusted OS requires careful use of
+ * MIGRATE_INFO_UP_CPU and MIGRATE, so for now fail in the presence of
+ * a UP Trusted OS.
+ */
+ if (psci_ops.migrate_info_type &&
+ psci_ops.migrate_info_type() != PSCI_0_2_TOS_MP) {
+ pr_warn("Unable to handle UP trusted OS\n");
+ return -EPERM;
+ }
+
return 0;
}
--
1.9.1
next prev parent reply other threads:[~2014-09-05 11:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-05 11:22 [PATCH 0/2] PSCI: don't call CPU_OFF when it might fail Mark Rutland
2014-09-05 11:22 ` Mark Rutland [this message]
2014-09-05 11:58 ` [PATCH 1/2] arm64: psci: respect MIGRATE_INFO_TYPE Sergei Shtylyov
2014-09-05 12:39 ` Mark Rutland
2014-09-05 11:22 ` [PATCH 2/2] arm: psci: don't call CPU_OFF blindly Mark Rutland
2014-09-05 20:48 ` Stefano Stabellini
2014-09-08 10:22 ` Mark Rutland
2014-09-05 20:53 ` [PATCH 0/2] PSCI: don't call CPU_OFF when it might fail Stefano Stabellini
2014-09-08 10:24 ` Mark Rutland
2014-09-08 21:44 ` Stefano Stabellini
[not found] <1409915540-20044-1-git-send-email-mark.rutland@arm.com>
[not found] ` <1409915540-20044-2-git-send-email-mark.rutland@arm.com>
[not found] ` <CAJ5Y-eZqWsLT1ERWsdzCQASgzCfFTgn6fCBCpc7ceMoU2ONkNA@mail.gmail.com>
[not found] ` <20140905141345.GF20164@leverpostej>
2014-09-05 18:22 ` [PATCH 1/2] arm64: psci: respect MIGRATE_INFO_TYPE Ashwin Chaugule
2014-09-08 14:14 ` Mark Rutland
2014-09-08 14:25 ` Ashwin Chaugule
2014-09-08 14:50 ` Mark Rutland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1409916139-20127-2-git-send-email-mark.rutland@arm.com \
--to=mark.rutland@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).