Skip to contentSkip to conversation

Arm: constrain {,u}int64_aligned_t in public header

PATCH In review Jan Beulich 3 participants 3 messages Sep 5, 2023 – Sep 6, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Arm: constrain {,u}int64_aligned_t in public header

For using a GNU extension, it may not be exposed in general, just like is done on x86 (except that here we need to also work around not all of the tool stack actually defining __XEN_TOOLS__). External consumers (not using gcc or a compatible compiler) need to make this type available up front (just like we expect {,u}int<N>_t to be supplied) - unlike on x86 the type is actually needed outside of tools-only interfaces, because guest handle definitions use it.

While there also add underscores around "aligned".

---
v2: Also check for __GNUC__.

xen/include/public/arch-arm.h +4 -2
@@ -152,8 +152,10 @@
 
 #define XEN_HYPERCALL_TAG   0XEA1
 
-#define  int64_aligned_t  int64_t __attribute__((aligned(8)))
-#define uint64_aligned_t uint64_t __attribute__((aligned(8)))
+#if defined(__XEN__) || defined(__XEN_TOOLS__) || defined(__GNUC__)
+#define  int64_aligned_t  int64_t __attribute__((__aligned__(8)))
+#define uint64_aligned_t uint64_t __attribute__((__aligned__(8)))
+#endif
 
 #ifndef __ASSEMBLY__
 #define ___DEFINE_XEN_GUEST_HANDLE(name, type)                  \
Tested-by on v2 1/1
#1 lore raw

Hi Jan,

Quoted 10 lines · Jan Beulich

For using a GNU extension, it may not be exposed in general, just like is done on x86 (except that here we need to also work around not all of the tool stack actually defining __XEN_TOOLS__). External consumers (not using gcc or a compatible compiler) need to make this type available up front (just like we expect {,u}int<N>_t to be supplied) - unlike on x86 the type is actually needed outside of tools-only interfaces, because guest handle definitions use it.

Quoted 3 lines

While there also add underscores around "aligned".

I used the same testing approach to redo the test for v2, and everything works fine this time.

Kind regards,
Henry

Reviewed-by
#2 lore raw
Quoted 12 lines · Henry Wang

Hi Jan,

Quoted 10 lines · Jan Beulich

For using a GNU extension, it may not be exposed in general, just like is done on x86 (except that here we need to also work around not all of the tool stack actually defining __XEN_TOOLS__). External consumers (not using gcc or a compatible compiler) need to make this type available up front (just like we expect {,u}int<N>_t to be supplied) - unlike on x86 the type is actually needed outside of tools-only interfaces, because guest handle definitions use it.

Quoted 8 lines
Quoted 3 lines

While there also add underscores around "aligned".

I used the same testing approach to redo the test for v2, and everything works fine this time.