Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vdso: Introduce vdso/cache.h

The vDSO implementation can only include headers from the vdso/
namespace. To enable the usage of ____cacheline_aligned from
the vDSO, move it and its dependencies into a new header vdso/cache.h.
Keep compatibility by including vdso/cache.h from linux/cache.h.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250303-vdso-clock-v1-1-c1b5c69a166f@linutronix.de

authored by

Thomas Weißschuh and committed by
Thomas Gleixner
0704bf43 8770a918

+16 -8
+1 -8
include/linux/cache.h
··· 3 3 #define __LINUX_CACHE_H 4 4 5 5 #include <uapi/linux/kernel.h> 6 + #include <vdso/cache.h> 6 7 #include <asm/cache.h> 7 8 8 9 #ifndef L1_CACHE_ALIGN 9 10 #define L1_CACHE_ALIGN(x) __ALIGN_KERNEL(x, L1_CACHE_BYTES) 10 - #endif 11 - 12 - #ifndef SMP_CACHE_BYTES 13 - #define SMP_CACHE_BYTES L1_CACHE_BYTES 14 11 #endif 15 12 16 13 /** ··· 58 61 */ 59 62 #ifndef __ro_after_init 60 63 #define __ro_after_init __section(".data..ro_after_init") 61 - #endif 62 - 63 - #ifndef ____cacheline_aligned 64 - #define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES))) 65 64 #endif 66 65 67 66 #ifndef ____cacheline_aligned_in_smp
+15
include/vdso/cache.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef __VDSO_CACHE_H 3 + #define __VDSO_CACHE_H 4 + 5 + #include <asm/cache.h> 6 + 7 + #ifndef SMP_CACHE_BYTES 8 + #define SMP_CACHE_BYTES L1_CACHE_BYTES 9 + #endif 10 + 11 + #ifndef ____cacheline_aligned 12 + #define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES))) 13 + #endif 14 + 15 + #endif /* __VDSO_ALIGN_H */