[RFC PATCH 29/36] arm64: nmi: Manage masking for superpriority interrupts
Vladimir Murzin
vladimir.murzin at arm.com
Tue Jul 14 05:41:41 PDT 2026
On 7/10/26 11:08, Jinjie Ruan wrote:
>> diff --git a/arch/arm64/include/asm/interrupts/common_flags.h b/arch/arm64/include/asm/interrupts/common_flags.h
>> index 72ed6e75d146..315aaec3ea34 100644
>> --- a/arch/arm64/include/asm/interrupts/common_flags.h
>> +++ b/arch/arm64/include/asm/interrupts/common_flags.h
>> @@ -20,6 +20,14 @@
>> /*
>> * Exception context mapping
>> *
>> + * FEAT_NMI
>> + *
>> + * CRITICAL -> DAIF + AllInt (corresponds to the state on exception entry)
>> + * ERROR -> AIF + AllInt
>> + * NONMI -> IF + AllInt
>> + * NOIRQ -> IF
>> + * PROCESS -> 0
>> + *
>> * pseudo-NMI
>> *
>> * CRITICAL -> DAIF + IRQON (corresponds to the state on exception entry)
>> @@ -76,6 +84,7 @@ arm64_exc_hwstate_t __arm64_exc_hwstate_of_noirq_context(void)
>> return (arm64_exc_hwstate_t){.daif=DAIF_PROCCTX, .pmr=GIC_PRIO_IRQOFF};
>>
>> return (arm64_exc_hwstate_t){.daif=DAIF_PROCCTX_NOIRQ};
>> +
>> }
>>
>> static __always_inline
>> @@ -84,6 +93,9 @@ arm64_exc_hwstate_t __arm64_exc_hwstate_of_nonmi_context(void)
>> if (system_uses_irq_prio_masking())
>> return (arm64_exc_hwstate_t){.daif=DAIF_PROCCTX_NOIRQ, .pmr=GIC_PRIO_IRQON};
>>
>> + if (system_uses_nmi())
>> + return (arm64_exc_hwstate_t){.daif=DAIF_PROCCTX_NOIRQ, .allint=ALLINT_ALLINT};
>> +
>> return (arm64_exc_hwstate_t){.daif=DAIF_PROCCTX_NOIRQ};
>
> DAIF_PROCCTX_NOIRQ is universal; can it be initialized with a loal
> varible and set at the beginning?
>
> 90 static __always_inline
> 91 arm64_exc_hwstate_t __arm64_exc_hwstate_of_nonmi_context(void)
> 92 {
> 93 >-------arm64_exc_hwstate_t state = { .daif=DAIF_PROCCTX_NOIRQ };
> 94
> 95 >-------if (system_uses_irq_prio_masking())
> 96 >------->-------state.pmr = GIC_PRIO_IRQON;
> 97
> 98 >-------if (system_uses_nmi())
> 99 >------->-------state.allint = ALLINT_ALLINT;
> 100
> 101 >-------return state;
> 102 }
It can be, but I did it this way because it can be quickly and easily
matched with the exception context mapping documented at the top of
the file. I don't have a strong opinion - if others find a different
approach more helpful, I'm happy to change it.
Cheers
Vladimir
More information about the linux-arm-kernel
mailing list