Re: [PATCH 01/17] arm64: Move DAIF macros to ptrace.h and use them centrally

From: Jinjie Ruan

Date: Mon Jul 06 2026 - 09:07:20 EST




On 7/4/2026 12:44 AM, Breno Leitao wrote:
> On Fri, Jul 03, 2026 at 06:01:19PM +0800, Jinjie Ruan wrote:
>> So move the definitions of DAIF_PROCCTX, DAIF_PROCCTX_NOIRQ, DAIF_ERRCTX,
>> and DAIF_MASK from <asm/daifflags.h> to <asm/ptrace.h>.
>
> This seems a bit counter intuitive, to have DAIF definitions at
> arm/ptrace.h instead of asm/daifflags.h, no?

If we keep them in <asm/daifflags.h>, we would hit a circular dependency
issue when <asm/daifflags.h> and <asm/ptrace.h> try to include each
other to resolve types.

>
>> diff --git a/arch/arm64/kvm/hyp/nvhe/host.S b/arch/arm64/kvm/hyp/nvhe/host.S
>> index 9393fe3ea6a1..cbe2a616c726 100644
>> --- a/arch/arm64/kvm/hyp/nvhe/host.S
>> +++ b/arch/arm64/kvm/hyp/nvhe/host.S
>> @@ -11,6 +11,7 @@
>> #include <asm/kvm_asm.h>
>> #include <asm/kvm_mmu.h>
>> #include <asm/kvm_ptrauth.h>
>> +#include <asm/ptrace.h>
>
> ..
>
>> diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-init.S b/arch/arm64/kvm/hyp/nvhe/hyp-init.S
>> index 89cb553be1e5..26ea02e7f5fd 100644
>> --- a/arch/arm64/kvm/hyp/nvhe/hyp-init.S
>> +++ b/arch/arm64/kvm/hyp/nvhe/hyp-init.S
>> @@ -15,6 +15,7 @@
>> #include <asm/kvm_asm.h>
>> #include <asm/kvm_mmu.h>
>> #include <asm/pgtable-hwdef.h>
>> +#include <asm/ptrace.h>
>
> And then you need to do this in many low level files, which sounds less
> intuitive to have to have ptrace.h include instead of asm/daifflags.h
> (which is clear why we need it).
>
> --breno