# Re: \[PATCH\] arm64: entry: always set GIC\_PRIO\_PSR\_I\_SET during entry

- From: Marc Zyngier \<maz@kernel.org\>
- Date: 2021-05-05 14:43:49 
- List: linux-arm-kernel
- Page: https://ratatoskr.run/linux-arm-kernel/2021/05/8806629
- Thread: https://ratatoskr.run/linux-arm-kernel/2021/04/8806501/t.md

```text
On Wed, 28 Apr 2021 16:29:39 +0100,
Mark Rutland [ref] 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@kernel.org>

	M.

-- 
Without deviation from the norm, progress is not possible.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
```
