public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] arm64: Make sure SPsel is always set
@ 2017-09-26 14:57 Will Deacon
  2017-09-26 16:16 ` Catalin Marinas
  0 siblings, 1 reply; 2+ messages in thread
From: Will Deacon @ 2017-09-26 14:57 UTC (permalink / raw)
  To: linux-arm-kernel

From: Marc Zyngier <marc.zyngier@arm.com>

When the kernel is entered at EL2 on an ARMv8.0 system, we construct
the EL1 pstate and make sure this uses the the EL1 stack pointer
(we perform an exception return to EL1h).

But if the kernel is either entered at EL1 or stays at EL2 (because
we're on a VHE-capable system), we fail to set SPsel, and use whatever
stack selection the higher exception level has choosen for us.

Let's not take any chance, and make sure that SPsel is set to one
before we decide the mode we're going to run in.

Cc: <stable@vger.kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 arch/arm64/kernel/head.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 7434ec0c7a27..0b243ecaf7ac 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -384,6 +384,7 @@ ENTRY(kimage_vaddr)
  * booted in EL1 or EL2 respectively.
  */
 ENTRY(el2_setup)
+	msr	SPsel, #1			// We want to use SP_EL{1,2}
 	mrs	x0, CurrentEL
 	cmp	x0, #CurrentEL_EL2
 	b.eq	1f
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] arm64: Make sure SPsel is always set
  2017-09-26 14:57 [PATCH] arm64: Make sure SPsel is always set Will Deacon
@ 2017-09-26 16:16 ` Catalin Marinas
  0 siblings, 0 replies; 2+ messages in thread
From: Catalin Marinas @ 2017-09-26 16:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Sep 26, 2017 at 03:57:16PM +0100, Will Deacon wrote:
> From: Marc Zyngier <marc.zyngier@arm.com>
> 
> When the kernel is entered at EL2 on an ARMv8.0 system, we construct
> the EL1 pstate and make sure this uses the the EL1 stack pointer
> (we perform an exception return to EL1h).
> 
> But if the kernel is either entered at EL1 or stays at EL2 (because
> we're on a VHE-capable system), we fail to set SPsel, and use whatever
> stack selection the higher exception level has choosen for us.
> 
> Let's not take any chance, and make sure that SPsel is set to one
> before we decide the mode we're going to run in.
> 
> Cc: <stable@vger.kernel.org>
> Acked-by: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> Signed-off-by: Will Deacon <will.deacon@arm.com>

Queued for 4.14-rc3. Thanks.

-- 
Catalin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-26 16:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-26 14:57 [PATCH] arm64: Make sure SPsel is always set Will Deacon
2017-09-26 16:16 ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox