On Tue, Nov 06, 2018 at 10:40:33AM +0000, Marc Zyngier wrote: > On Wed, 31 Oct 2018 13:56:58 +0000, > David Long <dave.long@xxxxxxxxxx> wrote: > > > > From: Russell King <rmk+kernel@xxxxxxxxxxxxxxx> > > > > Commit 10115105cb3aa17b5da1cb726ae8dd5f6854bd93 upstream. > > > > Add firmware based hardening for cores that require more complex > > handling in firmware. > > > > Signed-off-by: Russell King <rmk+kernel@xxxxxxxxxxxxxxx> > > Boot-tested-by: Tony Lindgren <tony@xxxxxxxxxxx> > > Reviewed-by: Tony Lindgren <tony@xxxxxxxxxxx> > > Reviewed-by: Marc Zyngier <marc.zyngier@xxxxxxx> > > Signed-off-by: David A. Long <dave.long@xxxxxxxxxx> > > --- > > arch/arm/mm/proc-v7-bugs.c | 60 ++++++++++++++++++++++++++++++++++++++ > > arch/arm/mm/proc-v7.S | 21 +++++++++++++ > > 2 files changed, 81 insertions(+) > > > > [...] > > > diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S > > index 2d2e5ae85816..8fde9edb4a48 100644 > > --- a/arch/arm/mm/proc-v7.S > > +++ b/arch/arm/mm/proc-v7.S > > @@ -9,6 +9,7 @@ > > * > > * This is the "shell" of the ARMv7 processor support. > > */ > > +#include <linux/arm-smccc.h> > > #include <linux/init.h> > > #include <linux/linkage.h> > > #include <asm/assembler.h> > > @@ -88,6 +89,26 @@ ENTRY(cpu_v7_dcache_clean_area) > > ret lr > > ENDPROC(cpu_v7_dcache_clean_area) > > > > +#ifdef CONFIG_ARM_PSCI > > + .arch_extension sec > > +ENTRY(cpu_v7_smc_switch_mm) > > + stmfd sp!, {r0 - r3} > > + movw r0, #:lower16:ARM_SMCCC_ARCH_WORKAROUND_1 > > + movt r0, #:upper16:ARM_SMCCC_ARCH_WORKAROUND_1 > > + smc #0 > > + ldmfd sp!, {r0 - r3} > > + b cpu_v7_switch_mm > > +ENDPROC(cpu_v7_smc_switch_mm) > > + .arch_extension virt > > +ENTRY(cpu_v7_hvc_switch_mm) > > + stmfd sp!, {r0 - r3} > > + movw r0, #:lower16:ARM_SMCCC_ARCH_WORKAROUND_1 > > + movt r0, #:upper16:ARM_SMCCC_ARCH_WORKAROUND_1 > > + hvc #0 > > + ldmfd sp!, {r0 - r3} > > + b cpu_v7_switch_mm > > +ENDPROC(cpu_v7_smc_switch_mm) > > As pointed out by Ard a while ago [1], this breaks Thumb-2 kernels. > Please keep this series on hold until this is fixed in mainline and > you can cherry-pick the corresponding patch. You have to wonder at the effectiveness of the autobooters if stuff like this is not caught. There's way too many configuration combinations and firmwares for individuals to be able to test every code path, we need autobooters to have sufficient diversity (and to pick up on failures better) to be able to exercise these in an automated fashion and report decent, reliable results. It's taken from May to November to find this, which is _way_ too long a timeframe. The Thumb annotations for functions are always going to be very troublesome as there's no automated way to validate them except by actually exercising the code. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up