[RFC PATCH 11/36] arm64: interrupts: introduce interrupt masking helpers for entry code

Vladimir Murzin vladimir.murzin at arm.com
Tue Jul 14 04:54:47 PDT 2026


On 7/10/26 10:19, Jinjie Ruan wrote:
>> diff --git a/arch/arm64/include/asm/interrupts/common_flags.h b/arch/arm64/include/asm/interrupts/common_flags.h
>> new file mode 100644
>> index 000000000000..6ce60d1519e8
>> --- /dev/null
>> +++ b/arch/arm64/include/asm/interrupts/common_flags.h
>> @@ -0,0 +1,197 @@
>> +/* SPDX-License-Identifier: GPL-2.0-only */
>> +/*
>> + * Copyright (C) 2025 Arm Ltd.
>> + */
>> +#ifndef __ASM_INTERRUPTS_COMMON_FLAGS_H
>> +#define __ASM_INTERRUPTS_COMMON_FLAGS_H
>> +
>> +#include <asm/arch_gicv3.h>
>> +#include <asm/bug.h>
>> +#include <asm/cpufeature.h>
>> +#include <asm/ptrace.h>
>> +#include <asm/sysreg.h>
>> +#include <asm/irqflags.h>
>> +
>> +#define DAIF_PROCCTX		0
>> +#define DAIF_PROCCTX_NOIRQ	(PSR_I_BIT | PSR_F_BIT)
>> +#define DAIF_ERRCTX		(PSR_A_BIT | PSR_I_BIT | PSR_F_BIT)
>> +#define DAIF_MASK		(PSR_D_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT)
>> +
>> +/*
>> + * Exception context mapping
>> + *
>> + * pseudo-NMI
>> + *
>> + * CRITICAL -> DAIF + IRQON  (corresponds to the state on exception entry)
>> + * ERROR    ->  AIF + IRQON
>> + * NONMI    ->   IF + IRQON
>> + * NOIRQ    ->    0 + IRQOFF
>> + * PROCESS  ->    0 + IRQON
>> + *
>> + * Otherwise
>> + *
>> + * CRITICAL -> DAIF           (corresponds to the state on exception entry)
>> + * ERROR    ->  AIF
>> + * NONMI    ->   IF
>> + * NOIRQ    ->   IF
>> + * PROCESS  ->    0
> without the allint of FEAT_NMI, the NONMI here is meaningless.
> 

We still have NONMI for the pNMI context and we better document that
NONMI is equivalent to NOIRQ on systems that do not implement any form
of NMI.

> With allint, maybe:
> 
> + * CRITICAL -> ALLINT + DAIF           (corresponds to the state on
> exception entry)
> + * ERROR    ->  ALLINT + AIF
> + * NONMI    ->  ALLINT + IF
> + * NOIRQ    ->   IF
> + * PROCESS  ->    0
> 

This is correct, but belong to future patch...

Cheers
Vladimir



More information about the linux-arm-kernel mailing list