From: Catalin Marinas <catalin.marinas@arm.com>
To: Will Deacon <will@kernel.org>
Cc: Rob Herring <robh@kernel.org>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Marc Zyngier <maz@kernel.org>, James Morse <james.morse@arm.com>,
linux-arm-kernel@lists.infradead.org,
kvmarm@lists.cs.columbia.edu,
Julien Thierry <julien.thierry.kdev@gmail.com>
Subject: Re: [PATCH v5 2/2] arm64: Add workaround for Arm Cortex-A77 erratum 1508412
Date: Fri, 11 Sep 2020 16:41:43 +0100 [thread overview]
Message-ID: <20200911154142.GK12835@gaia> (raw)
In-Reply-To: <20200911152807.GA20527@willie-the-truck>
On Fri, Sep 11, 2020 at 04:28:07PM +0100, Will Deacon wrote:
> On Fri, Sep 11, 2020 at 11:37:14AM +0100, Catalin Marinas wrote:
> > On Wed, Sep 09, 2020 at 05:13:10PM -0600, Rob Herring wrote:
> > > diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
> > > index 554a7e8ecb07..55dfff8ca466 100644
> > > --- a/arch/arm64/include/asm/sysreg.h
> > > +++ b/arch/arm64/include/asm/sysreg.h
> > > @@ -943,6 +943,7 @@
> > >
> > > #include <linux/build_bug.h>
> > > #include <linux/types.h>
> > > +#include <asm/alternative.h>
> > >
> > > #define __DEFINE_MRS_MSR_S_REGNUM \
> > > " .irp num,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30\n" \
> > > @@ -1024,6 +1025,17 @@
> > > write_sysreg(__scs_new, sysreg); \
> > > } while (0)
> > >
> > > +#define read_sysreg_par() ({ \
> > > + unsigned long flags; \
> > > + u64 par; \
> > > + local_irq_save(flags); \
> > > + asm(ALTERNATIVE("nop", "dmb sy", ARM64_WORKAROUND_1508412)); \
> > > + par = read_sysreg(par_el1); \
> > > + asm(ALTERNATIVE("nop", "dmb sy", ARM64_WORKAROUND_1508412)); \
> > > + local_irq_restore(flags); \
> > > + par; \
> > > +})
> >
> > As an alternative to local_irq_save/restore, we could have added a dmb
> > in the kernel_exit macro. The minor nit here is that we always disable
> > interrupts even when the erratum doesn't apply.
> >
> > The EL1 code accessing PAR_EL1 already runs with interrupts disabled
> > (which covers the prior AT instruction). If that's the case for KVM as
> > well, we could drop the local_irq_* entirely and just leave the DMB in
> > the exit to guest code.
>
> I wonder if that's actually a more robust approach in the case of psuedo
> NMIs using ARM64_HAS_IRQ_PRIO_MASKING?
Good point, so better do the dmb on the return path for both kernel and
hyp.
--
Catalin
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2020-09-11 15:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-09 23:13 [PATCH v5 1/2] arm64: Add part number for Arm Cortex-A77 Rob Herring
2020-09-09 23:13 ` [PATCH v5 2/2] arm64: Add workaround for Arm Cortex-A77 erratum 1508412 Rob Herring
2020-09-11 10:37 ` Catalin Marinas
2020-09-11 15:28 ` Will Deacon
2020-09-11 15:41 ` Catalin Marinas [this message]
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=20200911154142.GK12835@gaia \
--to=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=julien.thierry.kdev@gmail.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.org \
--cc=robh@kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.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