Skip to contentSkip to conversation

ARM: Use type override hacks only in NEON code

PATCH In review Ard Biesheuvel 4 participants 7 messages Sep 9 – Sep 18

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover ARM: Use type override hacks only in NEON code

From: Ard Biesheuvel <[email protected]>

Now that the RAID-6 code can no longer be built for user space, we can drop the direct dependency on the arm_neon.h system header, and include asm/neon-intrinsics.h instead.

Since asm/neon-intrinsics.h has all the type overrides needed to include arm_neon.h without conflicts in the uintXX_t types, those hacks can be dropped from asm/types.h, and so the file can be dropped entirely.

Cc Eric Biggers <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Russell King <[email protected]>
Cc Arnd Bergmann <[email protected]>

Ard Biesheuvel (2):
lib/raid6: Switch to Linux's NEON intrinsics header
ARM: Remove hacked-up asm/types.h header

 arch/arm/include/uapi/asm/types.h     | 41 --------------------
 lib/raid/raid6/arm/neon.uc            |  2 +-
 lib/raid/raid6/arm/recov_neon_inner.c |  2 +-
 3 files changed, 2 insertions(+), 43 deletions(-)
 delete mode 100644 arch/arm/include/uapi/asm/types.h
Signature · 1 line
2.55.0.1003.g10538fe699-goog
#1 lore raw

PATCH 1/2 lib/raid6: Switch to Linux's NEON intrinsics header

From: Ard Biesheuvel <[email protected]>

Including arm_neon.h directly requires workarounds in the types.h header that are ugly and should only be applied when actually building NEON code.

ARM and arm64 both have a asm/neon-intrinsics.h header that applies the same workarounds, but without propagating them to all other C files. So include that instead.

This will allow those type hacks to be dropped from the ARM tree.

---
 lib/raid/raid6/arm/neon.uc            | 2 +-
 lib/raid/raid6/arm/recov_neon_inner.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
lib/raid/raid6/arm/neon.uc +1 -1
index 14a9fc2c60fa..fb31cfac1f86 100644
@@ -24,7 +24,7 @@
  * This file is postprocessed using unroll.awk
  */
 
-#include <arm_neon.h>
+#include <asm/neon-intrinsics.h>
 #include "arm/neon.h"
 
 typedef uint8x16_t unative_t;
lib/raid/raid6/arm/recov_neon_inner.c +1 -1
index 53c355efa7ff..afd225a533cf 100644
@@ -4,7 +4,7 @@
  * Copyright (C) 2017 Linaro Ltd. <[email protected]>
  */
 
-#include <arm_neon.h>
+#include <asm/neon-intrinsics.h>
 #include "arm/neon.h"
 
 #ifdef CONFIG_ARM
Signature · 1 line
2.55.0.1003.g10538fe699-goog
#3 lore raw

PATCH 2/2 ARM: Remove hacked-up asm/types.h header

In reply to Ard Biesheuvel

From: Ard Biesheuvel <[email protected]>

ARM has a special version of asm/types.h which contains overrides for certain #define's related to the C types used to back C99 types such as uint32_t and uintptr_t.

This is only needed when pulling in system headers such as stdint.h during the build, and this only happens when using NEON intrinsics, for which there is now a dedicated header file.

So drop this header entirely, and revert to the asm-generic one.

---
 arch/arm/include/uapi/asm/types.h | 41 --------------------
 1 file changed, 41 deletions(-)
arch/arm/include/uapi/asm/types.h deleted +0 -41
deleted file mode 100644
index 1a667bc26510..000000000000
@@ -1,41 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-#ifndef _UAPI_ASM_TYPES_H
-#define _UAPI_ASM_TYPES_H
-
-#include <asm-generic/int-ll64.h>
-
-/*
- * The C99 types uintXX_t that are usually defined in 'stdint.h' are not as
- * unambiguous on ARM as you would expect. For the types below, there is a
- * difference on ARM between GCC built for bare metal ARM, GCC built for glibc
- * and the kernel itself, which results in build errors if you try to build with
- * -ffreestanding and include 'stdint.h' (such as when you include 'arm_neon.h'
- * in order to use NEON intrinsics)
- *
- * As the typedefs for these types in 'stdint.h' are based on builtin defines
- * supplied by GCC, we can tweak these to align with the kernel's idea of those
- * types, so 'linux/types.h' and 'stdint.h' can be safely included from the same
- * source file (provided that -ffreestanding is used).
- *
- *                    int32_t         uint32_t               uintptr_t
- * bare metal GCC     long            unsigned long          unsigned int
- * glibc GCC          int             unsigned int           unsigned int
- * kernel             int             unsigned int           unsigned long
- */
-
-#ifdef __INT32_TYPE__
-#undef __INT32_TYPE__
-#define __INT32_TYPE__		int
-#endif
-
-#ifdef __UINT32_TYPE__
-#undef __UINT32_TYPE__
-#define __UINT32_TYPE__	unsigned int
-#endif
-
-#ifdef __UINTPTR_TYPE__
-#undef __UINTPTR_TYPE__
-#define __UINTPTR_TYPE__	unsigned long
-#endif
-
-#endif /* _UAPI_ASM_TYPES_H */
Signature · 1 line
2.55.0.1003.g10538fe699-goog
Reviewed-by on the v1 series
#5 lore raw
In reply to Ard Biesheuvel
Quoted 10 lines · Ard Biesheuvel

From: Ard Biesheuvel <[email protected]>

Now that the RAID-6 code can no longer be built for user space, we can drop the direct dependency on the arm_neon.h system header, and include asm/neon-intrinsics.h instead.

Since asm/neon-intrinsics.h has all the type overrides needed to include arm_neon.h without conflicts in the uintXX_t types, those hacks can be dropped from asm/types.h, and so the file can be dropped entirely.

Quoted 8 lines
Cc Eric Biggers <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Russell King <[email protected]>
Cc Arnd Bergmann <[email protected]>

Ard Biesheuvel (2):
lib/raid6: Switch to Linux's NEON intrinsics header
ARM: Remove hacked-up asm/types.h header

- Eric

#6 lore raw
Quoted 16 lines · Eric Biggers
Quoted 15 lines · Ard Biesheuvel

From: Ard Biesheuvel <[email protected]>

Now that the RAID-6 code can no longer be built for user space, we can drop the direct dependency on the arm_neon.h system header, and include asm/neon-intrinsics.h instead.

Since asm/neon-intrinsics.h has all the type overrides needed to include arm_neon.h without conflicts in the uintXX_t types, those hacks can be dropped from asm/types.h, and so the file can be dropped entirely.

Cc Eric Biggers <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Russell King <[email protected]>
Cc Arnd Bergmann <[email protected]>
Quoted 6 lines
Quoted 3 lines

Ard Biesheuvel (2):
lib/raid6: Switch to Linux's NEON intrinsics header
ARM: Remove hacked-up asm/types.h header

Thanks.

I've dropped these into rmk's patch tracker.