[RFC PATCH 23/36] arm64/efi: Implement override for IRQ flags checks

Jinjie Ruan ruanjinjie at huawei.com
Wed Jul 22 00:52:45 PDT 2026



On 7/15/2026 8:21 PM, Vladimir Murzin wrote:
> On 7/15/26 13:09, Jinjie Ruan wrote:
>>
>> On 7/15/2026 8:00 PM, Vladimir Murzin wrote:
>>> On 7/13/26 09:22, Jinjie Ruan wrote:
>>>>> diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h
>>>>> index e8a9783235cb..479741d52c90 100644
>>>>> --- a/arch/arm64/include/asm/efi.h
>>>>> +++ b/arch/arm64/include/asm/efi.h
>>>>> @@ -5,6 +5,7 @@
>>>>>  #include <asm/boot.h>
>>>>>  #include <asm/cpufeature.h>
>>>>>  #include <asm/fpsimd.h>
>>>>> +#include <asm/interrupts/common_flags.h>
>>>>>  #include <asm/io.h>
>>>>>  #include <asm/memory.h>
>>>>>  #include <asm/mmu_context.h>
>>>>> @@ -48,18 +49,43 @@ void arch_efi_call_virt_teardown(void);
>>>>>  	(efi_rt_stack_top != NULL &&					\
>>>>>  	 on_task_stack(current, READ_ONCE(efi_rt_stack_top[-1]), 1))
>>>>>  
>>>>> -#define ARCH_EFI_IRQ_FLAGS_MASK (PSR_D_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT)
>>>>> -
>>>>>  /*
>>>>>   * Even when Linux uses IRQ priorities for IRQ disabling, EFI does not.
>>>>>   * And EFI shouldn't really play around with priority masking as it is not aware
>>>>>   * which priorities the OS has assigned to its interrupts.
>>>> Can this comment be deleted?
>>> The comment still looks valid to me. Why should it be deleted?
>> The current implementation of arch_local_save_flags() can already know
>> the PMR status.
>>
>> 112 static __always_inline unsigned long arch_local_save_flags(void)
>> 113 {
>> 114 >-------arm64_exc_hwstate_t hwstate = { .daif = read_sysreg(daif) };
>> 115
>> 116 >-------if (system_uses_nmi())
>> 117 >------->-------hwstate.allint = read_sysreg_s(SYS_ALLINT);
>> 118
>> 119 >-------if (system_uses_irq_prio_masking())
>> 120 >------->-------hwstate.pmr = read_sysreg_s(SYS_ICC_PMR_EL1);
>> 121
>> 122 >-------return hwstate.flags;
>> 123 }
>>
>>
> 
> How is that related? Comment talks about EFI messing up with IRQs.

Not really.

The original comment implies "don't touch PMR, so there's no need to
save PMR.", so it only save daif.

Now the now code also save and restore PMR and allint, therefore, I
believe the comments should also be updated
Maybe,

/*
 * Even when Linux uses IRQ priorities for IRQ disabling, EFI does not.
 * EFI must not play around with priority masking (PMR), as it is unaware
 * of the priority levels the OS has assigned to its interrupts.
 *
 * However, since EFI may directly toggle DAIF and ALLINT (IRQ/FIQ
masking) during
 * runtime services, we must save and restore the full exception masking
 * state (DAIF, PMR, and ALLINT) across the EFI call. This guarantees that
 * the OS's GIC priority model remains consistent and correctly synchronized
 * with the DAIF state upon return from EFI, even though EFI itself never
 * touches the PMR register.
 *

> 
> Cheers
> Vladimir
> 
>>> Cheers
>>> Vladimir
>>>
> 
> 




More information about the linux-arm-kernel mailing list