vdso: Use CONFIG_PAGE_SHIFT in vdso/datapage.h

Both the vdso rework and the CONFIG_PAGE_SHIFT changes were merged during
the v6.9 merge window, so it is now possible to use CONFIG_PAGE_SHIFT
instead of including asm/page.h in the vdso.

This avoids the workaround for arm64 - commit 8b3843ae3634 ("vdso/datapage:
Quick fix - use asm/page-def.h for ARM64") and addresses a build warning
for powerpc64:

In file included from <built-in>:4:
In file included from /home/arnd/arm-soc/arm-soc/lib/vdso/gettimeofday.c:5:
In file included from ../include/vdso/datapage.h:25:
arch/powerpc/include/asm/page.h:230:9: error: result of comparison of constant 13835058055282163712 with expression of type 'unsigned long' is always true [-Werror,-Wtautological-constant-out-of-range-compare]
230 | return __pa(kaddr) >> PAGE_SHIFT;
| ^~~~~~~~~~~
arch/powerpc/include/asm/page.h:217:37: note: expanded from macro '__pa'
217 | VIRTUAL_WARN_ON((unsigned long)(x) < PAGE_OFFSET); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
arch/powerpc/include/asm/page.h:202:73: note: expanded from macro 'VIRTUAL_WARN_ON'
202 | #define VIRTUAL_WARN_ON(x) WARN_ON(IS_ENABLED(CONFIG_DEBUG_VIRTUAL) && (x))
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
arch/powerpc/include/asm/bug.h:88:25: note: expanded from macro 'WARN_ON'
88 | int __ret_warn_on = !!(x); \
| ^

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Link: https://lore.kernel.org/r/20240320180228.136371-1-arnd@kernel.org

authored by Arnd Bergmann and committed by Thomas Gleixner cffaefd1 9e643ab5

Changed files
+2 -9
arch
powerpc
include
asm
include
vdso
+1 -2
arch/powerpc/include/asm/vdso/gettimeofday.h
··· 4 4 5 5 #ifndef __ASSEMBLY__ 6 6 7 - #include <asm/page.h> 8 7 #include <asm/vdso/timebase.h> 9 8 #include <asm/barrier.h> 10 9 #include <asm/unistd.h> ··· 94 95 static __always_inline 95 96 const struct vdso_data *__arch_get_timens_vdso_data(const struct vdso_data *vd) 96 97 { 97 - return (void *)vd + PAGE_SIZE; 98 + return (void *)vd + (1U << CONFIG_PAGE_SHIFT); 98 99 } 99 100 #endif 100 101
+1 -7
include/vdso/datapage.h
··· 19 19 #include <vdso/time32.h> 20 20 #include <vdso/time64.h> 21 21 22 - #ifdef CONFIG_ARM64 23 - #include <asm/page-def.h> 24 - #else 25 - #include <asm/page.h> 26 - #endif 27 - 28 22 #ifdef CONFIG_ARCH_HAS_VDSO_DATA 29 23 #include <asm/vdso/data.h> 30 24 #else ··· 126 132 */ 127 133 union vdso_data_store { 128 134 struct vdso_data data[CS_BASES]; 129 - u8 page[PAGE_SIZE]; 135 + u8 page[1U << CONFIG_PAGE_SHIFT]; 130 136 }; 131 137 132 138 /*