Re: [PATCH v3 2/3] arm64: entry: sdei: save and restore PMR for pseudo-NMI
From: Linus Walleij
Date: Sun Nov 29 2026 - 18:01:47 EST
On Mon, Nov 23, 2026 at 6:16 PM Ada Couprie Diaz
<ada.coupriediaz@xxxxxxx> wrote:
> When using pseudo-NMIs, the PMR affects if IRQs are disabled
> and is not updated by the CPU on exception entry/exit. It must be saved
> and restored to/from pt_regs, as the DAIF bits are, so that
> `regs_irqs_disabled()` can reliably work with pseudo-NMIs.
>
> We do so in the regular entry path, and set it to a known value
> reflecting that DAIF is masking all interrupts.
> Do the same for SDEI, as it can interrupt the kernel at any point
> and does not mandate firmware to touch PMR, but does mandate masking DAIF.
>
> This makes `regs_irqs_disabled()` reliable in the SDEI handler with
> pseudo-NMIs enabled, which is critical as the return path to the kernel
> depends on if the interrupted task had IRQs disabled or not.
> This also avoids returning to the interrupted task with a different PMR
> and a possible DAIF/PMR mismatch, as expected by the rest of the kernel.
>
> Fixes: 133d05186325 ("arm64: Make PMR part of task context")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Ada Couprie Diaz <ada.coupriediaz@xxxxxxx>
This looks right.
Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>
Yours,
Linus Walleij