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

vdso: Introduce vdso/page.h

The VDSO implementation includes headers from outside of the
vdso/ namespace.

Introduce vdso/page.h to make sure that the generic library
uses only the allowed namespace.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # m68k
Link: https://lore.kernel.org/all/20241014151340.1639555-3-vincenzo.frascino@arm.com

authored by

Vincenzo Frascino and committed by
Thomas Gleixner
efe8419a 8fd236b0

+60 -109
+1 -5
arch/alpha/include/asm/page.h
··· 4 4 5 5 #include <linux/const.h> 6 6 #include <asm/pal.h> 7 - 8 - /* PAGE_SHIFT determines the page size */ 9 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 10 - #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) 11 - #define PAGE_MASK (~(PAGE_SIZE-1)) 7 + #include <vdso/page.h> 12 8 13 9 #ifndef __ASSEMBLY__ 14 10
+3 -4
arch/arc/include/uapi/asm/page.h
··· 14 14 15 15 /* PAGE_SHIFT determines the page size */ 16 16 #ifdef __KERNEL__ 17 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 17 + #include <vdso/page.h> 18 18 #else 19 19 /* 20 20 * Default 8k ··· 24 24 * not available 25 25 */ 26 26 #define PAGE_SHIFT 13 27 + #define PAGE_SIZE _BITUL(PAGE_SHIFT) /* Default 8K */ 28 + #define PAGE_MASK (~(PAGE_SIZE-1)) 27 29 #endif 28 30 29 - #define PAGE_SIZE _BITUL(PAGE_SHIFT) /* Default 8K */ 30 31 #define PAGE_OFFSET _AC(0x80000000, UL) /* Kernel starts at 2G onwrds */ 31 - 32 - #define PAGE_MASK (~(PAGE_SIZE-1)) 33 32 34 33 #endif /* _UAPI__ASM_ARC_PAGE_H */
+1 -4
arch/arm/include/asm/page.h
··· 7 7 #ifndef _ASMARM_PAGE_H 8 8 #define _ASMARM_PAGE_H 9 9 10 - /* PAGE_SHIFT determines the page size */ 11 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 12 - #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) 13 - #define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) 10 + #include <vdso/page.h> 14 11 15 12 #ifndef __ASSEMBLY__ 16 13
+1 -4
arch/arm64/include/asm/page-def.h
··· 10 10 11 11 #include <linux/const.h> 12 12 13 - /* PAGE_SHIFT determines the page size */ 14 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 15 - #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) 16 - #define PAGE_MASK (~(PAGE_SIZE-1)) 13 + #include <vdso/page.h> 17 14 18 15 #endif /* __ASM_PAGE_DEF_H */
+2 -6
arch/csky/include/asm/page.h
··· 7 7 #include <asm/cache.h> 8 8 #include <linux/const.h> 9 9 10 - /* 11 - * PAGE_SHIFT determines the page size: 4KB 12 - */ 13 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 14 - #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) 15 - #define PAGE_MASK (~(PAGE_SIZE - 1)) 10 + #include <vdso/page.h> 11 + 16 12 #define THREAD_SIZE (PAGE_SIZE * 2) 17 13 #define THREAD_MASK (~(THREAD_SIZE - 1)) 18 14 #define THREAD_SHIFT (PAGE_SHIFT + 1)
+1 -3
arch/hexagon/include/asm/page.h
··· 45 45 #define HVM_HUGEPAGE_SIZE 0x5 46 46 #endif 47 47 48 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 49 - #define PAGE_SIZE (1UL << PAGE_SHIFT) 50 - #define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) 48 + #include <vdso/page.h> 51 49 52 50 #ifdef __KERNEL__ 53 51 #ifndef __ASSEMBLY__
+1 -6
arch/loongarch/include/asm/page.h
··· 8 8 #include <linux/const.h> 9 9 #include <asm/addrspace.h> 10 10 11 - /* 12 - * PAGE_SHIFT determines the page size 13 - */ 14 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 15 - #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) 16 - #define PAGE_MASK (~(PAGE_SIZE - 1)) 11 + #include <vdso/page.h> 17 12 18 13 #define HPAGE_SHIFT (PAGE_SHIFT + PAGE_SHIFT - 3) 19 14 #define HPAGE_SIZE (_AC(1, UL) << HPAGE_SHIFT)
+2 -4
arch/m68k/include/asm/page.h
··· 6 6 #include <asm/setup.h> 7 7 #include <asm/page_offset.h> 8 8 9 - /* PAGE_SHIFT determines the page size */ 10 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 11 - #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) 12 - #define PAGE_MASK (~(PAGE_SIZE-1)) 9 + #include <vdso/page.h> 10 + 13 11 #define PAGE_OFFSET (PAGE_OFFSET_RAW) 14 12 15 13 #ifndef __ASSEMBLY__
+1 -4
arch/microblaze/include/asm/page.h
··· 19 19 20 20 #ifdef __KERNEL__ 21 21 22 - /* PAGE_SHIFT determines the page size */ 23 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 24 - #define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT) 25 - #define PAGE_MASK (~(PAGE_SIZE-1)) 22 + #include <vdso/page.h> 26 23 27 24 #define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_KERNEL_BASE_ADDR)) 28 25
+1 -6
arch/mips/include/asm/page.h
··· 14 14 #include <linux/kernel.h> 15 15 #include <asm/mipsregs.h> 16 16 17 - /* 18 - * PAGE_SHIFT determines the page size 19 - */ 20 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 21 - #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) 22 - #define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) 17 + #include <vdso/page.h> 23 18 24 19 /* 25 20 * This is used for calculating the real page sizes
+1 -6
arch/nios2/include/asm/page.h
··· 18 18 #include <linux/pfn.h> 19 19 #include <linux/const.h> 20 20 21 - /* 22 - * PAGE_SHIFT determines the page size 23 - */ 24 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 25 - #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) 26 - #define PAGE_MASK (~(PAGE_SIZE - 1)) 21 + #include <vdso/page.h> 27 22 28 23 /* 29 24 * PAGE_OFFSET -- the first address of the first page of memory.
+1 -10
arch/openrisc/include/asm/page.h
··· 15 15 #ifndef __ASM_OPENRISC_PAGE_H 16 16 #define __ASM_OPENRISC_PAGE_H 17 17 18 - 19 - /* PAGE_SHIFT determines the page size */ 20 - 21 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 22 - #ifdef __ASSEMBLY__ 23 - #define PAGE_SIZE (1 << PAGE_SHIFT) 24 - #else 25 - #define PAGE_SIZE (1UL << PAGE_SHIFT) 26 - #endif 27 - #define PAGE_MASK (~(PAGE_SIZE-1)) 18 + #include <vdso/page.h> 28 19 29 20 #define PAGE_OFFSET 0xc0000000 30 21 #define KERNELBASE PAGE_OFFSET
+1 -3
arch/parisc/include/asm/page.h
··· 4 4 5 5 #include <linux/const.h> 6 6 7 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 8 - #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) 9 - #define PAGE_MASK (~(PAGE_SIZE-1)) 7 + #include <vdso/page.h> 10 8 11 9 #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA 12 10
+1 -9
arch/powerpc/include/asm/page.h
··· 21 21 * page size. When using 64K pages however, whether we are really supporting 22 22 * 64K pages in HW or not is irrelevant to those definitions. 23 23 */ 24 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 25 - #define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT) 24 + #include <vdso/page.h> 26 25 27 26 #ifndef __ASSEMBLY__ 28 27 #ifndef CONFIG_HUGETLB_PAGE ··· 39 40 #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 40 41 #define HUGE_MAX_HSTATE (MMU_PAGE_COUNT-1) 41 42 #endif 42 - 43 - /* 44 - * Subtle: (1 << PAGE_SHIFT) is an int, not an unsigned long. So if we 45 - * assign PAGE_MASK to a larger type it gets extended the way we want 46 - * (i.e. with 1s in the high bits) 47 - */ 48 - #define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) 49 43 50 44 /* 51 45 * KERNELBASE is the virtual address of the start of the kernel, it's often
+1 -3
arch/riscv/include/asm/page.h
··· 12 12 #include <linux/pfn.h> 13 13 #include <linux/const.h> 14 14 15 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 16 - #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) 17 - #define PAGE_MASK (~(PAGE_SIZE - 1)) 15 + #include <vdso/page.h> 18 16 19 17 #define HPAGE_SHIFT PMD_SHIFT 20 18 #define HPAGE_SIZE (_AC(1, UL) << HPAGE_SHIFT)
+4 -7
arch/s390/include/asm/page.h
··· 11 11 #include <linux/const.h> 12 12 #include <asm/types.h> 13 13 14 - #define _PAGE_SHIFT CONFIG_PAGE_SHIFT 15 - #define _PAGE_SIZE (_AC(1, UL) << _PAGE_SHIFT) 16 - #define _PAGE_MASK (~(_PAGE_SIZE - 1)) 14 + #include <vdso/page.h> 17 15 18 - /* PAGE_SHIFT determines the page size */ 19 - #define PAGE_SHIFT _PAGE_SHIFT 20 - #define PAGE_SIZE _PAGE_SIZE 21 - #define PAGE_MASK _PAGE_MASK 16 + #define _PAGE_SHIFT PAGE_SHIFT 17 + #define _PAGE_SIZE PAGE_SIZE 18 + #define _PAGE_MASK PAGE_MASK 22 19 #define PAGE_DEFAULT_ACC _AC(0, UL) 23 20 /* storage-protection override */ 24 21 #define PAGE_SPO_ACC 9
+2 -4
arch/sh/include/asm/page.h
··· 8 8 9 9 #include <linux/const.h> 10 10 11 - /* PAGE_SHIFT determines the page size */ 12 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 13 - #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) 14 - #define PAGE_MASK (~(PAGE_SIZE-1)) 11 + #include <vdso/page.h> 12 + 15 13 #define PTE_MASK PAGE_MASK 16 14 17 15 #if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
+1 -3
arch/sparc/include/asm/page_32.h
··· 11 11 12 12 #include <linux/const.h> 13 13 14 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 15 - #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) 16 - #define PAGE_MASK (~(PAGE_SIZE-1)) 14 + #include <vdso/page.h> 17 15 18 16 #ifndef __ASSEMBLY__ 19 17
+1 -3
arch/sparc/include/asm/page_64.h
··· 4 4 5 5 #include <linux/const.h> 6 6 7 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 8 - #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) 9 - #define PAGE_MASK (~(PAGE_SIZE-1)) 7 + #include <vdso/page.h> 10 8 11 9 /* Flushing for D-cache alias handling is only needed if 12 10 * the page size is smaller than 16K.
+1 -4
arch/um/include/asm/page.h
··· 9 9 10 10 #include <linux/const.h> 11 11 12 - /* PAGE_SHIFT determines the page size */ 13 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 14 - #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) 15 - #define PAGE_MASK (~(PAGE_SIZE-1)) 12 + #include <vdso/page.h> 16 13 17 14 #ifndef __ASSEMBLY__ 18 15
+1 -4
arch/x86/include/asm/page_types.h
··· 6 6 #include <linux/types.h> 7 7 #include <linux/mem_encrypt.h> 8 8 9 - /* PAGE_SHIFT determines the page size */ 10 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 11 - #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) 12 - #define PAGE_MASK (~(PAGE_SIZE-1)) 9 + #include <vdso/page.h> 13 10 14 11 #define __VIRTUAL_MASK ((1UL << __VIRTUAL_MASK_SHIFT) - 1) 15 12
+1 -7
arch/xtensa/include/asm/page.h
··· 18 18 #include <asm/cache.h> 19 19 #include <asm/kmem_layout.h> 20 20 21 - /* 22 - * PAGE_SHIFT determines the page size 23 - */ 24 - 25 - #define PAGE_SHIFT CONFIG_PAGE_SHIFT 26 - #define PAGE_SIZE (__XTENSA_UL_CONST(1) << PAGE_SHIFT) 27 - #define PAGE_MASK (~(PAGE_SIZE-1)) 21 + #include <vdso/page.h> 28 22 29 23 #ifdef CONFIG_MMU 30 24 #define PAGE_OFFSET XCHAL_KSEG_CACHED_VADDR
+30
include/vdso/page.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef __VDSO_PAGE_H 3 + #define __VDSO_PAGE_H 4 + 5 + #include <uapi/linux/const.h> 6 + 7 + /* 8 + * PAGE_SHIFT determines the page size. 9 + * 10 + * Note: This definition is required because PAGE_SHIFT is used 11 + * in several places throuout the codebase. 12 + */ 13 + #define PAGE_SHIFT CONFIG_PAGE_SHIFT 14 + 15 + #define PAGE_SIZE (_AC(1,UL) << CONFIG_PAGE_SHIFT) 16 + 17 + #if defined(CONFIG_PHYS_ADDR_T_64BIT) && !defined(CONFIG_64BIT) 18 + /* 19 + * Applies only to 32-bit architectures with a 64-bit phys_addr_t. 20 + * 21 + * Subtle: (1 << CONFIG_PAGE_SHIFT) is an int, not an unsigned long. 22 + * So if we assign PAGE_MASK to a larger type it gets extended the 23 + * way we want (i.e. with 1s in the high bits) 24 + */ 25 + #define PAGE_MASK (~((1 << CONFIG_PAGE_SHIFT) - 1)) 26 + #else 27 + #define PAGE_MASK (~(PAGE_SIZE - 1)) 28 + #endif 29 + 30 + #endif /* __VDSO_PAGE_H */