RE: [RESEND PATCH] Make Fujitsu Erratum 010001 patch can be applied on A64FX v1r0

From: Zhang, Lei
Date: Sun Mar 17 2019 - 23:05:16 EST


Hi guys,

> -----Original Message-----
> From: linux-arm-kernel <linux-arm-kernel-bounces@xxxxxxxxxxxxxxxxxxx> On
> Behalf Of Mark Rutland
> Sent: Saturday, March 16, 2019 12:13 AM
> To: Okamoto, Takayuki/岡本 高幸 <tokamoto@xxxxxxxxxxxxxx>
> Cc: 'Catalin Marinas' <catalin.marinas@xxxxxxx>; 'Will Deacon'
> <will.deacon@xxxxxxx>; 'linux-kernel@xxxxxxxxxxxxxxx'
> <linux-kernel@xxxxxxxxxxxxxxx>; Zhang, Lei/張 雷 <zhang.lei@xxxxxxxxxxxxxx>;
> 'James Morse' <james.morse@xxxxxxx>; hange-folder>?
> <toggle-mailboxes@xxxxxxxxxxxxxxxxxxxxxxxxx>;
> 'linux-arm-kernel@xxxxxxxxxxxxxxxxxxx' <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>
> Subject: Re: [RESEND PATCH] Make Fujitsu Erratum 010001 patch can be
> applied on A64FX v1r0
>
> On Fri, Mar 15, 2019 at 12:22:36PM +0000, Okamoto, Takayuki wrote:
> > I resend the patch due to whitespace munging.
> >
> > > -----Original Message-----
> > > From: James Morse <james.morse@xxxxxxx>
> > > Sent: Wednesday, February 27, 2019 3:44 AM
> > > To: james.morse@xxxxxxx; linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> > > Cc: linux-kernel@xxxxxxxxxxxxxxx; Catalin Marinas
> > > <catalin.marinas@xxxxxxx>; Mark Rutland <mark.rutland@xxxxxxx>; Will
> > > Deacon <will.deacon@xxxxxxx>; Zhang, Lei <zhang.lei@xxxxxxxxxxxxxx>
> > > Subject: [PATCH v5] arm64: Add workaround for Fujitsu A64FX erratum
> > > 010001
> > >
> > > +/* Fujitsu Erratum 010001 affects A64FX 1.0 and 1.1, (v0r0 and
> > > +v1r0) */ #define MIDR_FUJITSU_ERRATUM_010001
> > > MIDR_FUJITSU_A64FX
> > > +#define MIDR_FUJITSU_ERRATUM_010001_MASK
> > > (~MIDR_VARIANT(1))
> >
> > This workaround for the erratum should be applied for both A64FX v1r0
> > and v0r0, however, the patch v5 is only enabled on A64FX
> > v0r0(MIDR.Variant == 0 && MIDR.Revision == 0).
> > This issue is caused by the macro MIDR_FUJITSU_ERRATUM_010001_MASK.
> >
> > I have tested on both A64FX v1r0 and v0r0. This new patch will effect
> > only for A64FX.
> >
> > --
> > Changed to be applied for not only A64FX v0r0 but also v1r0.
> >
> > Signed-off-by: Zhang Lei <zhang.lei@xxxxxxxxxxxxxx>
> > ---
> > arch/arm64/include/asm/cputype.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/arm64/include/asm/cputype.h
> > b/arch/arm64/include/asm/cputype.h
> > index 2afb133..1fb47b5 100644
> > --- a/arch/arm64/include/asm/cputype.h
> > +++ b/arch/arm64/include/asm/cputype.h
> > @@ -129,7 +129,7 @@
> >
> > /* Fujitsu Erratum 010001 affects A64FX 1.0 and 1.1, (v0r0 and v1r0) */
> > #define MIDR_FUJITSU_ERRATUM_010001
> MIDR_FUJITSU_A64FX
> > -#define MIDR_FUJITSU_ERRATUM_010001_MASK
> (~MIDR_VARIANT(1))
>
> The bug is is that MIDR_VARIANT() is meant to extract the variant from a full
> MIDR value, not generate an in-place field value.
>
> > +#define MIDR_FUJITSU_ERRATUM_010001_MASK (~(0x1 <<
> MIDR_VARIANT_SHIFT))
>
> I beleive this can be:
>
> #define MIDR_FUJITSU_ERRATUM_010001_MASK (~MIDR_VAR_REV(1,
> 0))

Thanks for your comments.
I also have considered to use MIDR_CPU_VAR_REV macro,
but the implication of (~MIDR_CPU_VAR_REV(1, 0)) is "NOT v1r0".
I think it may cause confusion, so I choose the
simple way (~(0x1 << MIDR_VARIANT_SHIFT)).

> But otherwise this looks fine to me.

Will this patch be merged to v5.1?

Thanks,
Zhang Lei