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
Reply to
Mark Rutland, 2021-04-28
On Wed, 28 Apr 2021 16:29:39 +0100,
Mark Rutland [off-list ref] wrote:
On Wed, Apr 28, 2021 at 04:19:11PM +0100, Mark Rutland wrote:
quoted
On Wed, Apr 28, 2021 at 03:41:17PM +0100, Marc Zyngier wrote:
quoted
Hi Mark,
[...]
quoted
quoted
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
Thread (6 messages) 6 messages, 3 authors, last reply 2021-05-05
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help