[PATCH 3/9] arm64: alternatives: proton-pack: prepare for cap changes

Mark Rutland mark.rutland at arm.com
Mon Sep 5 01:46:29 PDT 2022


On Fri, Sep 02, 2022 at 05:19:32PM +0100, Joey Gouly wrote:
> Hi Mark,
> 
> On Thu, Sep 01, 2022 at 04:13:57PM +0100, Mark Rutland wrote:
> > The spectre patching callbacks use cpus_have_final_cap() internally within
> > has_vhe(), and subsequent patches will make it invalid to call
> 
> Remove the 'internally within has_vhe()', a copy paste error from the previous
> commit.

Whoops; removed.

> Otherwise:
> 
> Reviewed-by: Joey Gouly <joey.gouly at arm.com>

Thanks!

Mark.

> 
> > cpus_have_final_cap() before alternatives patching has completed.
> > 
> > In preparation for said change, this patch modifies the spectre patching
> > callbacks use cpus_have_cap(). This is not subject to patching, and will
> > dynamically check the cpu_hwcaps array, which is functionally equivalent
> > to the existing behaviour.
> > 
> > There should be no functional change as a result of this patch.
> > 
> > Signed-off-by: Mark Rutland <mark.rutland at arm.com>
> > Cc: Ard Biesheuvel <ardb at kernel.org>
> > Cc: Catalin Marinas <catalin.marinas at arm.com>
> > Cc: James Morse <james.morse at arm.com>
> > Cc: Joey Gouly <joey.gouly at arm.com>
> > Cc: Marc Zyngier <maz at kernel.org>
> > Cc: Will Deacon <will at kernel.org>
> > ---
> >  arch/arm64/kernel/proton-pack.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c
> > index 40be3a7c2c531..8010b2e573fac 100644
> > --- a/arch/arm64/kernel/proton-pack.c
> > +++ b/arch/arm64/kernel/proton-pack.c
> > @@ -586,7 +586,7 @@ void __init spectre_v4_patch_fw_mitigation_enable(struct alt_instr *alt,
> >  	if (spectre_v4_mitigations_off())
> >  		return;
> >  
> > -	if (cpus_have_final_cap(ARM64_SSBS))
> > +	if (cpus_have_cap(ARM64_SSBS))
> >  		return;
> >  
> >  	if (spectre_v4_mitigations_dynamic())
> > -- 
> > 2.30.2
> > 
> > 
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel at lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel



More information about the linux-arm-kernel mailing list