[PATCH] arm64: entry: always set GIC_PRIO_PSR_I_SET during entry
Marc Zyngier
maz at kernel.org
Wed May 5 07:41:43 PDT 2021
On Wed, 28 Apr 2021 16:29:39 +0100,
Mark Rutland <mark.rutland at arm.com> wrote:
>
> On Wed, Apr 28, 2021 at 04:19:11PM +0100, Mark Rutland wrote:
> > On Wed, Apr 28, 2021 at 03:41:17PM +0100, Marc Zyngier wrote:
> > > Hi Mark,
[...]
> > > I'm a bit worried about forcing PMR to IRQON at this stage. We could
> > > have been in IRQOFF state and entering the kernel because of a
> > > NMI. Don't we risk losing track of how we made it here?
> >
> > I also worried about this, but after digging for a while I convinced
> > myself there wasn't a problem, as:
> >
> > * This is what local_daif_mask() does today. It sets the PMR to
> > GIC_PRIO_IRQON | GIC_PRIO_PSR_I_SET regardless of its original state.
> >
> > * For checking how we got here, we use either:
> > - regs::pmr_save, which is sampled (immediately) before we alter HW PMR
> > in the asm above.
> > - DAIF, which is unaffected by this.
> >
> > * This is transparent to local_irq_save() .. local_irq_restore(), as
> > that blindly saves/restores the PMR.
> >
>
> ... oh, and within the GIC driver:
>
> * for a pNMI, we'll leave both PMR and DAIF as-is
>
> * for an IRQ, we'll set the PMU to GIC_PRIO_IRQOFF (regardless of the
> original value), then unmask DAIF.
>
> ... so that'll do the right thing even if we enter with PMR set to
> (GIC_PRIO_IRQON | CIG_PRIO_PSR_I_SET).
Fair enough. FWIW:
Acked-by: Marc Zyngier <maz at kernel.org>
M.
--
Without deviation from the norm, progress is not possible.
More information about the linux-arm-kernel
mailing list