* [PATCH v2 1/2] tools: linux/types.h: Add 128-bit integer types for arm64 UAPI structures
2026-06-26 14:17 [PATCH v2 0/2] Use __u128 in arm64 UAPI headers Will Deacon
@ 2026-06-26 14:17 ` Will Deacon
2026-06-26 14:17 ` [PATCH v2 2/2] arm64: uapi: Use __u128 instead of __uint128_t in UAPI headers Will Deacon
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2026-06-26 14:17 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-kernel, Will Deacon, Arnd Bergmann,
Arnaldo Carvalho de Melo, David Matlack
The arm64 UAPI exposes some 128-bit integer types to represent things
such as fpsimd registers in the sigcontext. In preparation for defining
these using the '__u128' typedef implemented by uapi/linux/types.h, copy
that typedef over to the private linux/types.h header used by the tools
directory.
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Matlack <dmatlack@google.com>
Signed-off-by: Will Deacon <will@kernel.org>
---
tools/include/linux/types.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/include/linux/types.h b/tools/include/linux/types.h
index d41f8a261bce..b6c473b7920d 100644
--- a/tools/include/linux/types.h
+++ b/tools/include/linux/types.h
@@ -23,6 +23,11 @@ typedef enum {
__GFP_HIGH
} gfp_t;
+#ifdef __SIZEOF_INT128__
+typedef __signed__ __int128 __s128 __attribute__((aligned(16)));
+typedef unsigned __int128 __u128 __attribute__((aligned(16)));
+#endif
+
/*
* We define u64 as uint64_t for every architecture
* so that we can print it with "%"PRIx64 without getting warnings.
--
2.55.0.rc0.799.gd6f94ed593-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v2 2/2] arm64: uapi: Use __u128 instead of __uint128_t in UAPI headers
2026-06-26 14:17 [PATCH v2 0/2] Use __u128 in arm64 UAPI headers Will Deacon
2026-06-26 14:17 ` [PATCH v2 1/2] tools: linux/types.h: Add 128-bit integer types for arm64 UAPI structures Will Deacon
@ 2026-06-26 14:17 ` Will Deacon
2026-07-22 8:23 ` [PATCH v2 0/2] Use __u128 in arm64 " Will Deacon
2026-09-03 2:21 ` Jeremy Linton
3 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2026-06-26 14:17 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-kernel, Will Deacon, Arnd Bergmann, Nick Desaulniers,
Steffen Eiden, Andreas Grapentin, Catalin Marinas, Dave Martin,
Mark Rutland, Marc Zyngier
The arm64 UAPI exposes '__uint128_t' types in the members of
'struct user_fpsimd_state', 'struct user_pac_address_keys' and in the
signal frame via 'struct fpsimd_context'. Since the alignment of such
a type appears to be non-portable (16 bytes on arm64, 8 bytes on s390),
prefer the '__u128' typedef from uapi/linux/types.h, which makes the
alignment explicit and allows the definitions to be reused by other
host architectures.
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Nick Desaulniers <nick.desaulniers+lkml@gmail.com>
Cc: Steffen Eiden <seiden@linux.ibm.com>
Cc: Andreas Grapentin <gra@linux.ibm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dave Martin <dave.martin@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Marc Zyngier <maz@kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Will Deacon <will@kernel.org>
---
arch/arm64/include/uapi/asm/ptrace.h | 12 ++++++------
arch/arm64/include/uapi/asm/sigcontext.h | 6 +++---
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/arch/arm64/include/uapi/asm/ptrace.h b/arch/arm64/include/uapi/asm/ptrace.h
index 6fed93fb2536..15649a253a57 100644
--- a/arch/arm64/include/uapi/asm/ptrace.h
+++ b/arch/arm64/include/uapi/asm/ptrace.h
@@ -93,7 +93,7 @@ struct user_pt_regs {
};
struct user_fpsimd_state {
- __uint128_t vregs[32];
+ __u128 vregs[32];
__u32 fpsr;
__u32 fpcr;
__u32 __reserved[2];
@@ -258,14 +258,14 @@ struct user_pac_mask {
/* pointer authentication keys (NT_ARM_PACA_KEYS, NT_ARM_PACG_KEYS) */
struct user_pac_address_keys {
- __uint128_t apiakey;
- __uint128_t apibkey;
- __uint128_t apdakey;
- __uint128_t apdbkey;
+ __u128 apiakey;
+ __u128 apibkey;
+ __u128 apdakey;
+ __u128 apdbkey;
};
struct user_pac_generic_keys {
- __uint128_t apgakey;
+ __u128 apgakey;
};
/* ZA state (NT_ARM_ZA) */
diff --git a/arch/arm64/include/uapi/asm/sigcontext.h b/arch/arm64/include/uapi/asm/sigcontext.h
index e29bf3e2d0cc..d250ca7a1d46 100644
--- a/arch/arm64/include/uapi/asm/sigcontext.h
+++ b/arch/arm64/include/uapi/asm/sigcontext.h
@@ -78,7 +78,7 @@ struct fpsimd_context {
struct _aarch64_ctx head;
__u32 fpsr;
__u32 fpcr;
- __uint128_t vregs[32];
+ __u128 vregs[32];
};
/*
@@ -266,8 +266,8 @@ struct gcs_context {
* - ---- -----------
* REGS the entire SVE context
*
- * ZREGS __uint128_t[SVE_NUM_ZREGS][vq] all Z-registers
- * ZREG __uint128_t[vq] individual Z-register Zn
+ * ZREGS __u128[SVE_NUM_ZREGS][vq] all Z-registers
+ * ZREG __u128[vq] individual Z-register Zn
*
* PREGS uint16_t[SVE_NUM_PREGS][vq] all P-registers
* PREG uint16_t[vq] individual P-register Pn
--
2.55.0.rc0.799.gd6f94ed593-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v2 0/2] Use __u128 in arm64 UAPI headers
2026-06-26 14:17 [PATCH v2 0/2] Use __u128 in arm64 UAPI headers Will Deacon
2026-06-26 14:17 ` [PATCH v2 1/2] tools: linux/types.h: Add 128-bit integer types for arm64 UAPI structures Will Deacon
2026-06-26 14:17 ` [PATCH v2 2/2] arm64: uapi: Use __u128 instead of __uint128_t in UAPI headers Will Deacon
@ 2026-07-22 8:23 ` Will Deacon
2026-09-03 2:21 ` Jeremy Linton
3 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2026-07-22 8:23 UTC (permalink / raw)
To: linux-arm-kernel, Will Deacon
Cc: catalin.marinas, kernel-team, linux-kernel, Arnd Bergmann,
Arnaldo Carvalho de Melo, Nick Desaulniers, David Matlack,
Steffen Eiden, Andreas Grapentin, Dave Martin, Mark Rutland,
Marc Zyngier
On Fri, 26 Jun 2026 15:17:27 +0100, Will Deacon wrote:
> This is version two of the patch I previously sent here:
>
> https://lore.kernel.org/r/20260619130835.5678-1-will@kernel.org
>
> I even briefly queued that version up, but it exploded spectacularly
> when building the kselftests for arm64 [1] [2]. So the only change since
> v1 is the addition of a preliminary patch that adds the '__u128' typedef
> to the private copy of linux/types.h used by the tools/ directory.
>
> [...]
Applied to arm64 (for-next/uapi), thanks!
[1/2] tools: linux/types.h: Add 128-bit integer types for arm64 UAPI structures
https://git.kernel.org/arm64/c/10a47fb67340
[2/2] arm64: uapi: Use __u128 instead of __uint128_t in UAPI headers
https://git.kernel.org/arm64/c/d4bf9e08d412
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2 0/2] Use __u128 in arm64 UAPI headers
2026-06-26 14:17 [PATCH v2 0/2] Use __u128 in arm64 UAPI headers Will Deacon
` (2 preceding siblings ...)
2026-07-22 8:23 ` [PATCH v2 0/2] Use __u128 in arm64 " Will Deacon
@ 2026-09-03 2:21 ` Jeremy Linton
2026-09-03 10:55 ` Will Deacon
3 siblings, 1 reply; 6+ messages in thread
From: Jeremy Linton @ 2026-09-03 2:21 UTC (permalink / raw)
To: Will Deacon, linux-arm-kernel
Cc: linux-kernel, Arnd Bergmann, Arnaldo Carvalho de Melo,
Nick Desaulniers, David Matlack, Steffen Eiden, Andreas Grapentin,
Catalin Marinas, Dave Martin, Mark Rutland, Marc Zyngier
Hi,
On 6/26/26 9:17 AM, Will Deacon wrote:
> Hi folks,
>
> This is version two of the patch I previously sent here:
>
> https://lore.kernel.org/r/20260619130835.5678-1-will@kernel.org
>
> I even briefly queued that version up, but it exploded spectacularly
> when building the kselftests for arm64 [1] [2]. So the only change since
> v1 is the addition of a preliminary patch that adds the '__u128' typedef
> to the private copy of linux/types.h used by the tools/ directory.
>
> I plan to take this all via the arm64 tree unless anybody objects.
This seems to be creating a interesting situation that the follow-on
commit:
10a47fb67340 tools: linux/types.h: Add 128-bit integer types for arm64
UAPI structures
Is missing from older kernel tooling/etc, which means the tools that end
up pulling this header in won't build on machines running 7.3 kernel
headers.
AKA, build/install master, switch back to an older branch and discover
say bpftool won't build anymore.
Thanks,
>
> Cheers,
>
> Will
>
> [1] https://lore.kernel.org/r/202606240441.7eZ1TIRM-lkp@intel.com
> [2] https://lore.kernel.org/r/ajvGS7UBpWzJtzkw@sirena.org.uk
>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Nick Desaulniers <nick.desaulniers+lkml@gmail.com>
> Cc: David Matlack <dmatlack@google.com>
> Cc: Steffen Eiden <seiden@linux.ibm.com>
> Cc: Andreas Grapentin <gra@linux.ibm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Dave Martin <dave.martin@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Marc Zyngier <maz@kernel.org>
>
> --->8
>
> Will Deacon (2):
> tools: linux/types.h: Add 128-bit integer types for arm64 UAPI
> structures
> arm64: uapi: Use __u128 instead of __uint128_t in UAPI headers
>
> arch/arm64/include/uapi/asm/ptrace.h | 12 ++++++------
> arch/arm64/include/uapi/asm/sigcontext.h | 6 +++---
> tools/include/linux/types.h | 5 +++++
> 3 files changed, 14 insertions(+), 9 deletions(-)
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2 0/2] Use __u128 in arm64 UAPI headers
2026-09-03 2:21 ` Jeremy Linton
@ 2026-09-03 10:55 ` Will Deacon
0 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2026-09-03 10:55 UTC (permalink / raw)
To: Jeremy Linton
Cc: linux-arm-kernel, linux-kernel, Arnd Bergmann,
Arnaldo Carvalho de Melo, Nick Desaulniers, David Matlack,
Steffen Eiden, Andreas Grapentin, Catalin Marinas, Dave Martin,
Mark Rutland, Marc Zyngier
On Wed, Sep 02, 2026 at 09:21:32PM -0500, Jeremy Linton wrote:
> On 6/26/26 9:17 AM, Will Deacon wrote:
> > This is version two of the patch I previously sent here:
> >
> > https://lore.kernel.org/r/20260619130835.5678-1-will@kernel.org
> >
> > I even briefly queued that version up, but it exploded spectacularly
> > when building the kselftests for arm64 [1] [2]. So the only change since
> > v1 is the addition of a preliminary patch that adds the '__u128' typedef
> > to the private copy of linux/types.h used by the tools/ directory.
> >
> > I plan to take this all via the arm64 tree unless anybody objects.
>
> This seems to be creating a interesting situation that the follow-on commit:
> 10a47fb67340 tools: linux/types.h: Add 128-bit integer types for arm64 UAPI
> structures
>
> Is missing from older kernel tooling/etc, which means the tools that end up
> pulling this header in won't build on machines running 7.3 kernel headers.
>
> AKA, build/install master, switch back to an older branch and discover say
> bpftool won't build anymore.
Ah, I guess we need to backport 10a47fb67340 to stable, then?
Will
^ permalink raw reply [flat|nested] 6+ messages in thread