diff mbox series

[v4,2/2] vdso: Introduce vdso/page.h

Message ID 20241010135146.181175-3-vincenzo.frascino@arm.com (mailing list archive)
State New
Headers show
Series vdso: Use only headers from the vdso/ namespace | expand

Commit Message

Vincenzo Frascino Oct. 10, 2024, 1:51 p.m. UTC
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.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason A. Donenfeld <Jason@zx2c4.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # m68k
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 arch/alpha/include/asm/page.h      |  6 +-----
 arch/arc/include/uapi/asm/page.h   |  7 +++----
 arch/arm/include/asm/page.h        |  5 +----
 arch/arm64/include/asm/page-def.h  |  5 +----
 arch/csky/include/asm/page.h       |  8 ++------
 arch/hexagon/include/asm/page.h    |  4 +---
 arch/loongarch/include/asm/page.h  |  7 +------
 arch/m68k/include/asm/page.h       |  6 ++----
 arch/microblaze/include/asm/page.h |  5 +----
 arch/mips/include/asm/page.h       |  7 +------
 arch/nios2/include/asm/page.h      |  7 +------
 arch/openrisc/include/asm/page.h   | 11 +----------
 arch/parisc/include/asm/page.h     |  4 +---
 arch/powerpc/include/asm/page.h    | 10 +---------
 arch/riscv/include/asm/page.h      |  4 +---
 arch/s390/include/asm/page.h       |  4 +---
 arch/sh/include/asm/page.h         |  6 ++----
 arch/sparc/include/asm/page_32.h   |  4 +---
 arch/sparc/include/asm/page_64.h   |  4 +---
 arch/um/include/asm/page.h         |  5 +----
 arch/x86/include/asm/page_types.h  |  5 +----
 arch/xtensa/include/asm/page.h     |  8 +-------
 include/vdso/page.h                | 30 ++++++++++++++++++++++++++++++
 23 files changed, 57 insertions(+), 105 deletions(-)
 create mode 100644 include/vdso/page.h

Comments

kernel test robot Oct. 11, 2024, 11:03 a.m. UTC | #1
Hi Vincenzo,

kernel test robot noticed the following build errors:

[auto build test ERROR on vgupta-arc/for-curr]
[also build test ERROR on arm64/for-next/core geert-m68k/for-next geert-m68k/for-linus deller-parisc/for-next powerpc/next powerpc/fixes s390/features uml/next tip/x86/core linus/master v6.12-rc2 next-20241011]
[cannot apply to vgupta-arc/for-next uml/fixes]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Vincenzo-Frascino/drm-i915-Change-fault-type-to-unsigned-long/20241010-215325
base:   https://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git for-curr
patch link:    https://lore.kernel.org/r/20241010135146.181175-3-vincenzo.frascino%40arm.com
patch subject: [PATCH v4 2/2] vdso: Introduce vdso/page.h
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20241011/202410112106.mvc2U2p0-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 70e0a7e7e6a8541bcc46908c592eed561850e416)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241011/202410112106.mvc2U2p0-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410112106.mvc2U2p0-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:7:
   In file included from include/linux/hardirq.h:5:
   In file included from include/linux/context_tracking_state.h:5:
   In file included from include/linux/percpu.h:5:
   In file included from include/linux/alloc_tag.h:11:
   In file included from include/linux/preempt.h:79:
   In file included from arch/s390/include/asm/preempt.h:6:
   In file included from include/linux/thread_info.h:60:
   In file included from arch/s390/include/asm/thread_info.h:31:
>> arch/s390/include/asm/page.h:17:9: warning: 'PAGE_SHIFT' macro redefined [-Wmacro-redefined]
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |         ^
   include/vdso/page.h:13:9: note: previous definition is here
      13 | #define PAGE_SHIFT      CONFIG_PAGE_SHIFT
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:7:
   In file included from include/linux/hardirq.h:5:
   In file included from include/linux/context_tracking_state.h:5:
   In file included from include/linux/percpu.h:5:
   In file included from include/linux/alloc_tag.h:11:
   In file included from include/linux/preempt.h:79:
   In file included from arch/s390/include/asm/preempt.h:6:
   In file included from include/linux/thread_info.h:60:
   In file included from arch/s390/include/asm/thread_info.h:31:
>> arch/s390/include/asm/page.h:18:9: warning: 'PAGE_SIZE' macro redefined [-Wmacro-redefined]
      18 | #define PAGE_SIZE       _PAGE_SIZE
         |         ^
   include/vdso/page.h:15:9: note: previous definition is here
      15 | #define PAGE_SIZE       (_AC(1,UL) << CONFIG_PAGE_SHIFT)
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:7:
   In file included from include/linux/hardirq.h:5:
   In file included from include/linux/context_tracking_state.h:5:
   In file included from include/linux/percpu.h:5:
   In file included from include/linux/alloc_tag.h:11:
   In file included from include/linux/preempt.h:79:
   In file included from arch/s390/include/asm/preempt.h:6:
   In file included from include/linux/thread_info.h:60:
   In file included from arch/s390/include/asm/thread_info.h:31:
>> arch/s390/include/asm/page.h:19:9: warning: 'PAGE_MASK' macro redefined [-Wmacro-redefined]
      19 | #define PAGE_MASK       _PAGE_MASK
         |         ^
   include/vdso/page.h:27:9: note: previous definition is here
      27 | #define PAGE_MASK       (~(PAGE_SIZE - 1))
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:7:
   In file included from include/linux/hardirq.h:5:
   In file included from include/linux/context_tracking_state.h:5:
   In file included from include/linux/percpu.h:5:
   In file included from include/linux/alloc_tag.h:11:
   In file included from include/linux/preempt.h:79:
   In file included from arch/s390/include/asm/preempt.h:6:
   In file included from include/linux/thread_info.h:60:
   In file included from arch/s390/include/asm/thread_info.h:31:
>> arch/s390/include/asm/page.h:253:14: error: use of undeclared identifier '_PAGE_SHIFT'
     253 |         return __va(pfn_to_phys(pfn));
         |                     ^
   arch/s390/include/asm/page.h:244:36: note: expanded from macro 'pfn_to_phys'
     244 | #define pfn_to_phys(pfn)        ((pfn) << PAGE_SHIFT)
         |                                           ^
   arch/s390/include/asm/page.h:17:20: note: expanded from macro 'PAGE_SHIFT'
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^
   arch/s390/include/asm/page.h:258:9: error: use of undeclared identifier '_PAGE_SHIFT'
     258 |         return phys_to_pfn(__pa(kaddr));
         |                ^
   arch/s390/include/asm/page.h:243:38: note: expanded from macro 'phys_to_pfn'
     243 | #define phys_to_pfn(phys)       ((phys) >> PAGE_SHIFT)
         |                                            ^
   arch/s390/include/asm/page.h:17:20: note: expanded from macro 'PAGE_SHIFT'
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:7:
   In file included from include/linux/hardirq.h:5:
   In file included from include/linux/context_tracking_state.h:5:
   In file included from include/linux/percpu.h:5:
   In file included from include/linux/alloc_tag.h:11:
   In file included from include/linux/preempt.h:79:
   In file included from arch/s390/include/asm/preempt.h:6:
   In file included from include/linux/thread_info.h:60:
   In file included from arch/s390/include/asm/thread_info.h:31:
   In file included from arch/s390/include/asm/page.h:273:
>> include/asm-generic/getorder.h:33:27: error: use of undeclared identifier '_PAGE_SHIFT'
      33 |                         return BITS_PER_LONG - PAGE_SHIFT;
         |                                                ^
   arch/s390/include/asm/page.h:17:20: note: expanded from macro 'PAGE_SHIFT'
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:7:
   In file included from include/linux/hardirq.h:5:
   In file included from include/linux/context_tracking_state.h:5:
   In file included from include/linux/percpu.h:5:
   In file included from include/linux/alloc_tag.h:11:
   In file included from include/linux/preempt.h:79:
   In file included from arch/s390/include/asm/preempt.h:6:
   In file included from include/linux/thread_info.h:60:
   In file included from arch/s390/include/asm/thread_info.h:31:
   In file included from arch/s390/include/asm/page.h:273:
   include/asm-generic/getorder.h:35:22: error: use of undeclared identifier '_PAGE_SHIFT'
      35 |                 if (size < (1UL << PAGE_SHIFT))
         |                                    ^
   arch/s390/include/asm/page.h:17:20: note: expanded from macro 'PAGE_SHIFT'
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:7:
   In file included from include/linux/hardirq.h:5:
   In file included from include/linux/context_tracking_state.h:5:
   In file included from include/linux/percpu.h:5:
   In file included from include/linux/alloc_tag.h:11:
   In file included from include/linux/preempt.h:79:
   In file included from arch/s390/include/asm/preempt.h:6:
   In file included from include/linux/thread_info.h:60:
   In file included from arch/s390/include/asm/thread_info.h:31:
   In file included from arch/s390/include/asm/page.h:273:
   include/asm-generic/getorder.h:38:30: error: use of undeclared identifier '_PAGE_SHIFT'
      38 |                 return ilog2((size) - 1) - PAGE_SHIFT + 1;
         |                                            ^
   arch/s390/include/asm/page.h:17:20: note: expanded from macro 'PAGE_SHIFT'
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:7:
   In file included from include/linux/hardirq.h:5:
   In file included from include/linux/context_tracking_state.h:5:
   In file included from include/linux/percpu.h:5:
   In file included from include/linux/alloc_tag.h:11:
   In file included from include/linux/preempt.h:79:
   In file included from arch/s390/include/asm/preempt.h:6:
   In file included from include/linux/thread_info.h:60:
   In file included from arch/s390/include/asm/thread_info.h:31:
   In file included from arch/s390/include/asm/page.h:273:
   include/asm-generic/getorder.h:42:11: error: use of undeclared identifier '_PAGE_SHIFT'
      42 |         size >>= PAGE_SHIFT;
         |                  ^
   arch/s390/include/asm/page.h:17:20: note: expanded from macro 'PAGE_SHIFT'
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:7:
   In file included from include/linux/hardirq.h:5:
   In file included from include/linux/context_tracking_state.h:5:
   In file included from include/linux/percpu.h:5:
   In file included from include/linux/alloc_tag.h:14:
   In file included from include/linux/smp.h:119:
   In file included from arch/s390/include/asm/smp.h:12:
>> arch/s390/include/asm/processor.h:287:45: error: use of undeclared identifier '_PAGE_SIZE'
     287 |         return !((ksp ^ current_stack_pointer) & ~(THREAD_SIZE - 1));
         |                                                    ^
   arch/s390/include/asm/thread_info.h:25:22: note: expanded from macro 'THREAD_SIZE'
      25 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
         |                      ^
   arch/s390/include/asm/page.h:18:19: note: expanded from macro 'PAGE_SIZE'
      18 | #define PAGE_SIZE       _PAGE_SIZE
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:7:
   In file included from include/linux/hardirq.h:5:
   In file included from include/linux/context_tracking_state.h:5:
   In file included from include/linux/percpu.h:12:
>> include/linux/sched.h:1890:22: error: use of undeclared identifier '_PAGE_SIZE'
    1890 |         unsigned long stack[THREAD_SIZE/sizeof(long)];
         |                             ^
   arch/s390/include/asm/thread_info.h:25:22: note: expanded from macro 'THREAD_SIZE'
      25 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
         |                      ^
   arch/s390/include/asm/page.h:18:19: note: expanded from macro 'PAGE_SIZE'
      18 | #define PAGE_SIZE       _PAGE_SIZE
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:7:
   In file included from include/linux/hardirq.h:5:
   In file included from include/linux/context_tracking_state.h:5:
   In file included from include/linux/percpu.h:12:
   include/linux/sched.h:1897:33: error: use of undeclared identifier '_PAGE_SIZE'
    1897 | extern unsigned long init_stack[THREAD_SIZE / sizeof(unsigned long)];
         |                                 ^
   arch/s390/include/asm/thread_info.h:25:22: note: expanded from macro 'THREAD_SIZE'
      25 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
         |                      ^
   arch/s390/include/asm/page.h:18:19: note: expanded from macro 'PAGE_SIZE'
      18 | #define PAGE_SIZE       _PAGE_SIZE
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:11:
   include/linux/signal.h:98:11: warning: array index 3 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
      98 |                 return (set->sig[3] | set->sig[2] |
         |                         ^        ~
   arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
      22 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:11:
   include/linux/signal.h:98:25: warning: array index 2 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
      98 |                 return (set->sig[3] | set->sig[2] |
         |                                       ^        ~
   arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
      22 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:11:
   include/linux/signal.h:99:4: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
      99 |                         set->sig[1] | set->sig[0]) == 0;
         |                         ^        ~
   arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
      22 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:11:
   include/linux/signal.h:101:11: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
     101 |                 return (set->sig[1] | set->sig[0]) == 0;
         |                         ^        ~
   arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
      22 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:11:
   include/linux/signal.h:114:11: warning: array index 3 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds]
     114 |                 return  (set1->sig[3] == set2->sig[3]) &&
         |                          ^         ~
   arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
      22 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:11:
   include/linux/signal.h:114:27: warning: array index 3 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds]
     114 |                 return  (set1->sig[3] == set2->sig[3]) &&
         |                                          ^         ~
   arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
      22 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:11:
   include/linux/signal.h:115:5: warning: array index 2 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds]
     115 |                         (set1->sig[2] == set2->sig[2]) &&
         |                          ^         ~
   arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
      22 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:11:
   include/linux/signal.h:115:21: warning: array index 2 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds]
     115 |                         (set1->sig[2] == set2->sig[2]) &&
         |                                          ^         ~
   arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
      22 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:11:
   include/linux/signal.h:116:5: warning: array index 1 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds]
     116 |                         (set1->sig[1] == set2->sig[1]) &&
         |                          ^         ~
   arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
      22 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:11:
   include/linux/signal.h:116:21: warning: array index 1 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds]
     116 |                         (set1->sig[1] == set2->sig[1]) &&
         |                                          ^         ~
   arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
--
      22 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:11:
   include/linux/signal.h:187:1: warning: array index 3 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
     187 | _SIG_SET_OP(signotset, _sig_not)
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/signal.h:174:10: note: expanded from macro '_SIG_SET_OP'
     174 |         case 4: set->sig[3] = op(set->sig[3]);                          \
         |                 ^        ~
   arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
      22 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:11:
   include/linux/signal.h:187:1: warning: array index 2 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
     187 | _SIG_SET_OP(signotset, _sig_not)
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/signal.h:175:20: note: expanded from macro '_SIG_SET_OP'
     175 |                 set->sig[2] = op(set->sig[2]);                          \
         |                                  ^        ~
   include/linux/signal.h:186:24: note: expanded from macro '_sig_not'
     186 | #define _sig_not(x)     (~(x))
         |                            ^
   arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
      22 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:11:
   include/linux/signal.h:187:1: warning: array index 2 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
     187 | _SIG_SET_OP(signotset, _sig_not)
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/signal.h:175:3: note: expanded from macro '_SIG_SET_OP'
     175 |                 set->sig[2] = op(set->sig[2]);                          \
         |                 ^        ~
   arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
      22 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:11:
   include/linux/signal.h:187:1: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
     187 | _SIG_SET_OP(signotset, _sig_not)
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/signal.h:177:27: note: expanded from macro '_SIG_SET_OP'
     177 |         case 2: set->sig[1] = op(set->sig[1]);                          \
         |                                  ^        ~
   include/linux/signal.h:186:24: note: expanded from macro '_sig_not'
     186 | #define _sig_not(x)     (~(x))
         |                            ^
   arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
      22 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:11:
   include/linux/signal.h:187:1: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
     187 | _SIG_SET_OP(signotset, _sig_not)
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/signal.h:177:10: note: expanded from macro '_SIG_SET_OP'
     177 |         case 2: set->sig[1] = op(set->sig[1]);                          \
         |                 ^        ~
   arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
      22 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:11:
   include/linux/signal.h:198:10: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
     198 |         case 2: set->sig[1] = 0;
         |                 ^        ~
   arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
      22 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:11:
   include/linux/signal.h:211:10: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
     211 |         case 2: set->sig[1] = -1;
         |                 ^        ~
   arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
      22 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:11:
   include/linux/signal.h:242:10: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
     242 |         case 2: set->sig[1] = 0;
         |                 ^        ~
   arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
      22 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:11:
   include/linux/signal.h:255:10: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds]
     255 |         case 2: set->sig[1] = -1;
         |                 ^        ~
   arch/s390/include/asm/signal.h:22:9: note: array 'sig' declared here
      22 |         unsigned long sig[_NSIG_WORDS];
         |         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:16:
   In file included from include/linux/mm.h:7:
   In file included from include/linux/gfp.h:7:
   In file included from include/linux/mmzone.h:22:
>> include/linux/mm_types.h:547:6: warning: '_PAGE_SIZE' is not defined, evaluates to 0 [-Wundef]
     547 | #if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE)
         |      ^
   arch/s390/include/asm/page.h:18:19: note: expanded from macro 'PAGE_SIZE'
      18 | #define PAGE_SIZE       _PAGE_SIZE
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:16:
   In file included from include/linux/mm.h:7:
   In file included from include/linux/gfp.h:7:
   In file included from include/linux/mmzone.h:22:
>> include/linux/mm_types.h:547:18: warning: '_PAGE_MASK' is not defined, evaluates to 0 [-Wundef]
     547 | #if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE)
         |                  ^
   include/linux/mm_types.h:524:55: note: expanded from macro 'PAGE_FRAG_CACHE_MAX_SIZE'
     524 | #define PAGE_FRAG_CACHE_MAX_SIZE        __ALIGN_MASK(32768, ~PAGE_MASK)
         |                                                              ^
   arch/s390/include/asm/page.h:19:19: note: expanded from macro 'PAGE_MASK'
      19 | #define PAGE_MASK       _PAGE_MASK
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:16:
   In file included from include/linux/mm.h:7:
   In file included from include/linux/gfp.h:7:
   In file included from include/linux/mmzone.h:22:
>> include/linux/mm_types.h:547:18: warning: '_PAGE_MASK' is not defined, evaluates to 0 [-Wundef]
   include/linux/mm_types.h:524:55: note: expanded from macro 'PAGE_FRAG_CACHE_MAX_SIZE'
     524 | #define PAGE_FRAG_CACHE_MAX_SIZE        __ALIGN_MASK(32768, ~PAGE_MASK)
         |                                                              ^
   arch/s390/include/asm/page.h:19:19: note: expanded from macro 'PAGE_MASK'
      19 | #define PAGE_MASK       _PAGE_MASK
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:16:
   In file included from include/linux/mm.h:7:
   In file included from include/linux/gfp.h:7:
   In file included from include/linux/mmzone.h:23:
>> include/linux/page-flags.h:214:38: error: use of undeclared identifier '_PAGE_SIZE'
     214 |         if (IS_ALIGNED((unsigned long)page, PAGE_SIZE) &&
         |                                             ^
   arch/s390/include/asm/page.h:18:19: note: expanded from macro 'PAGE_SIZE'
      18 | #define PAGE_SIZE       _PAGE_SIZE
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:16:
   In file included from include/linux/mm.h:7:
   In file included from include/linux/gfp.h:7:
>> include/linux/mmzone.h:1777:23: warning: '_PAGE_SHIFT' is not defined, evaluates to 0 [-Wundef]
    1777 | #if (MAX_PAGE_ORDER + PAGE_SHIFT) > SECTION_SIZE_BITS
         |                       ^
   arch/s390/include/asm/page.h:17:20: note: expanded from macro 'PAGE_SHIFT'
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:16:
   In file included from include/linux/mm.h:7:
   In file included from include/linux/gfp.h:7:
>> include/linux/mmzone.h:1783:16: error: use of undeclared identifier '_PAGE_SHIFT'
    1783 |         return pfn >> PFN_SECTION_SHIFT;
         |                       ^
   include/linux/mmzone.h:1767:48: note: expanded from macro 'PFN_SECTION_SHIFT'
    1767 | #define PFN_SECTION_SHIFT       (SECTION_SIZE_BITS - PAGE_SHIFT)
         |                                                      ^
   arch/s390/include/asm/page.h:17:20: note: expanded from macro 'PAGE_SHIFT'
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:16:
   In file included from include/linux/mm.h:7:
   In file included from include/linux/gfp.h:7:
   include/linux/mmzone.h:1787:16: error: use of undeclared identifier '_PAGE_SHIFT'
    1787 |         return sec << PFN_SECTION_SHIFT;
         |                       ^
   include/linux/mmzone.h:1767:48: note: expanded from macro 'PFN_SECTION_SHIFT'
    1767 | #define PFN_SECTION_SHIFT       (SECTION_SIZE_BITS - PAGE_SHIFT)
         |                                                      ^
   arch/s390/include/asm/page.h:17:20: note: expanded from macro 'PAGE_SHIFT'
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:16:
   In file included from include/linux/mm.h:7:
   In file included from include/linux/gfp.h:7:
>> include/linux/mmzone.h:1875:23: error: use of undeclared identifier '_PAGE_SIZE'
    1875 |         unsigned long root = SECTION_NR_TO_ROOT(nr);
         |                              ^
   include/linux/mmzone.h:1858:42: note: expanded from macro 'SECTION_NR_TO_ROOT'
    1858 | #define SECTION_NR_TO_ROOT(sec) ((sec) / SECTIONS_PER_ROOT)
         |                                          ^
   include/linux/mmzone.h:1853:34: note: expanded from macro 'SECTIONS_PER_ROOT'
    1853 | #define SECTIONS_PER_ROOT       (PAGE_SIZE / sizeof (struct mem_section))
         |                                  ^
   arch/s390/include/asm/page.h:18:19: note: expanded from macro 'PAGE_SIZE'
      18 | #define PAGE_SIZE       _PAGE_SIZE
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:16:
   In file included from include/linux/mm.h:7:
   In file included from include/linux/gfp.h:7:
   include/linux/mmzone.h:1877:23: error: use of undeclared identifier '_PAGE_SIZE'
    1877 |         if (unlikely(root >= NR_SECTION_ROOTS))
         |                              ^
   include/linux/mmzone.h:1859:56: note: expanded from macro 'NR_SECTION_ROOTS'
    1859 | #define NR_SECTION_ROOTS        DIV_ROUND_UP(NR_MEM_SECTIONS, SECTIONS_PER_ROOT)
         |                                                               ^
   include/linux/mmzone.h:1853:34: note: expanded from macro 'SECTIONS_PER_ROOT'
    1853 | #define SECTIONS_PER_ROOT       (PAGE_SIZE / sizeof (struct mem_section))
         |                                  ^
   arch/s390/include/asm/page.h:18:19: note: expanded from macro 'PAGE_SIZE'
      18 | #define PAGE_SIZE       _PAGE_SIZE
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:16:
   In file included from include/linux/mm.h:7:
   In file included from include/linux/gfp.h:7:
   include/linux/mmzone.h:1877:23: error: use of undeclared identifier '_PAGE_SIZE'
   include/linux/mmzone.h:1859:56: note: expanded from macro 'NR_SECTION_ROOTS'
    1859 | #define NR_SECTION_ROOTS        DIV_ROUND_UP(NR_MEM_SECTIONS, SECTIONS_PER_ROOT)
         |                                                               ^
   include/linux/mmzone.h:1853:34: note: expanded from macro 'SECTIONS_PER_ROOT'
    1853 | #define SECTIONS_PER_ROOT       (PAGE_SIZE / sizeof (struct mem_section))
         |                                  ^
   arch/s390/include/asm/page.h:18:19: note: expanded from macro 'PAGE_SIZE'
      18 | #define PAGE_SIZE       _PAGE_SIZE
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:16:
   In file included from include/linux/mm.h:7:
   In file included from include/linux/gfp.h:7:
   include/linux/mmzone.h:1884:33: error: use of undeclared identifier '_PAGE_SIZE'
    1884 |         return &mem_section[root][nr & SECTION_ROOT_MASK];
         |                                        ^
   include/linux/mmzone.h:1860:28: note: expanded from macro 'SECTION_ROOT_MASK'
    1860 | #define SECTION_ROOT_MASK       (SECTIONS_PER_ROOT - 1)
         |                                  ^
   include/linux/mmzone.h:1853:34: note: expanded from macro 'SECTIONS_PER_ROOT'
    1853 | #define SECTIONS_PER_ROOT       (PAGE_SIZE / sizeof (struct mem_section))
         |                                  ^
   arch/s390/include/asm/page.h:18:19: note: expanded from macro 'PAGE_SIZE'
      18 | #define PAGE_SIZE       _PAGE_SIZE
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:16:
   In file included from include/linux/mm.h:7:
   In file included from include/linux/gfp.h:7:
   include/linux/mmzone.h:1996:18: error: use of undeclared identifier '_PAGE_SHIFT'
    1996 |         return (pfn & ~(PAGE_SECTION_MASK)) / PAGES_PER_SUBSECTION;
         |                         ^
   include/linux/mmzone.h:1772:30: note: expanded from macro 'PAGE_SECTION_MASK'
    1772 | #define PAGE_SECTION_MASK       (~(PAGES_PER_SECTION-1))
         |                                    ^
   include/linux/mmzone.h:1771:41: note: expanded from macro 'PAGES_PER_SECTION'
    1771 | #define PAGES_PER_SECTION       (1UL << PFN_SECTION_SHIFT)
         |                                         ^
   include/linux/mmzone.h:1767:48: note: expanded from macro 'PFN_SECTION_SHIFT'
    1767 | #define PFN_SECTION_SHIFT       (SECTION_SIZE_BITS - PAGE_SHIFT)
         |                                                      ^
   arch/s390/include/asm/page.h:17:20: note: expanded from macro 'PAGE_SHIFT'
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:16:
   In file included from include/linux/mm.h:7:
   In file included from include/linux/gfp.h:7:
   include/linux/mmzone.h:1996:40: error: use of undeclared identifier '_PAGE_SHIFT'
    1996 |         return (pfn & ~(PAGE_SECTION_MASK)) / PAGES_PER_SUBSECTION;
         |                                               ^
   include/linux/mmzone.h:1797:38: note: expanded from macro 'PAGES_PER_SUBSECTION'
    1797 | #define PAGES_PER_SUBSECTION (1UL << PFN_SUBSECTION_SHIFT)
         |                                      ^
   include/linux/mmzone.h:1796:50: note: expanded from macro 'PFN_SUBSECTION_SHIFT'
    1796 | #define PFN_SUBSECTION_SHIFT (SUBSECTION_SHIFT - PAGE_SHIFT)
         |                                                  ^
   arch/s390/include/asm/page.h:17:20: note: expanded from macro 'PAGE_SHIFT'
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^
   In file included from arch/s390/kernel/asm-offsets.c:11:
   In file included from include/linux/kvm_host.h:16:
   In file included from include/linux/mm.h:7:
   In file included from include/linux/gfp.h:7:
   include/linux/mmzone.h:2037:15: error: use of undeclared identifier '_PAGE_SHIFT'
    2037 |         if (PHYS_PFN(PFN_PHYS(pfn)) != pfn)
         |                      ^
   include/linux/pfn.h:21:42: note: expanded from macro 'PFN_PHYS'


vim +/_PAGE_SHIFT +253 arch/s390/include/asm/page.h

014b020475d4b9 Alexander Gordeev 2020-02-25  250  
2d1494fb31405d Linus Walleij     2023-08-12  251  static inline void *pfn_to_virt(unsigned long pfn)
2d1494fb31405d Linus Walleij     2023-08-12  252  {
2d1494fb31405d Linus Walleij     2023-08-12 @253  	return __va(pfn_to_phys(pfn));
2d1494fb31405d Linus Walleij     2023-08-12  254  }
2d1494fb31405d Linus Walleij     2023-08-12  255
kernel test robot Oct. 11, 2024, 12:26 p.m. UTC | #2
Hi Vincenzo,

kernel test robot noticed the following build errors:

[auto build test ERROR on vgupta-arc/for-curr]
[also build test ERROR on arm64/for-next/core geert-m68k/for-next geert-m68k/for-linus deller-parisc/for-next powerpc/next powerpc/fixes s390/features uml/next tip/x86/core linus/master openrisc/for-next v6.12-rc2 next-20241011]
[cannot apply to vgupta-arc/for-next uml/fixes]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Vincenzo-Frascino/drm-i915-Change-fault-type-to-unsigned-long/20241010-215325
base:   https://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git for-curr
patch link:    https://lore.kernel.org/r/20241010135146.181175-3-vincenzo.frascino%40arm.com
patch subject: [PATCH v4 2/2] vdso: Introduce vdso/page.h
config: s390-allyesconfig (https://download.01.org/0day-ci/archive/20241011/202410112014.ugeJ1luU-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241011/202410112014.ugeJ1luU-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410112014.ugeJ1luU-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   In file included from arch/s390/include/asm/thread_info.h:31,
                    from include/linux/thread_info.h:60,
                    from arch/s390/include/asm/preempt.h:6,
                    from include/linux/preempt.h:79,
                    from include/linux/alloc_tag.h:11,
                    from include/linux/percpu.h:5,
                    from include/linux/context_tracking_state.h:5,
                    from include/linux/hardirq.h:5,
                    from include/linux/kvm_host.h:7,
                    from arch/s390/kernel/asm-offsets.c:11:
>> arch/s390/include/asm/page.h:17:9: warning: "PAGE_SHIFT" redefined
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |         ^~~~~~~~~~
   In file included from arch/s390/include/asm/page.h:14:
   include/vdso/page.h:13:9: note: this is the location of the previous definition
      13 | #define PAGE_SHIFT      CONFIG_PAGE_SHIFT
         |         ^~~~~~~~~~
>> arch/s390/include/asm/page.h:18:9: warning: "PAGE_SIZE" redefined
      18 | #define PAGE_SIZE       _PAGE_SIZE
         |         ^~~~~~~~~
   include/vdso/page.h:15:9: note: this is the location of the previous definition
      15 | #define PAGE_SIZE       (_AC(1,UL) << CONFIG_PAGE_SHIFT)
         |         ^~~~~~~~~
>> arch/s390/include/asm/page.h:19:9: warning: "PAGE_MASK" redefined
      19 | #define PAGE_MASK       _PAGE_MASK
         |         ^~~~~~~~~
   include/vdso/page.h:27:9: note: this is the location of the previous definition
      27 | #define PAGE_MASK       (~(PAGE_SIZE - 1))
         |         ^~~~~~~~~
   arch/s390/include/asm/page.h: In function 'pfn_to_virt':
>> arch/s390/include/asm/page.h:17:25: error: '_PAGE_SHIFT' undeclared (first use in this function); did you mean 'HPAGE_SHIFT'?
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^~~~~~~~~~~
   arch/s390/include/asm/page.h:239:59: note: in definition of macro '__va'
     239 | #define __va(x)                 ((void *)((unsigned long)(x) + __identity_base))
         |                                                           ^
   arch/s390/include/asm/page.h:244:43: note: in expansion of macro 'PAGE_SHIFT'
     244 | #define pfn_to_phys(pfn)        ((pfn) << PAGE_SHIFT)
         |                                           ^~~~~~~~~~
   arch/s390/include/asm/page.h:253:21: note: in expansion of macro 'pfn_to_phys'
     253 |         return __va(pfn_to_phys(pfn));
         |                     ^~~~~~~~~~~
   arch/s390/include/asm/page.h:17:25: note: each undeclared identifier is reported only once for each function it appears in
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^~~~~~~~~~~
   arch/s390/include/asm/page.h:239:59: note: in definition of macro '__va'
     239 | #define __va(x)                 ((void *)((unsigned long)(x) + __identity_base))
         |                                                           ^
   arch/s390/include/asm/page.h:244:43: note: in expansion of macro 'PAGE_SHIFT'
     244 | #define pfn_to_phys(pfn)        ((pfn) << PAGE_SHIFT)
         |                                           ^~~~~~~~~~
   arch/s390/include/asm/page.h:253:21: note: in expansion of macro 'pfn_to_phys'
     253 |         return __va(pfn_to_phys(pfn));
         |                     ^~~~~~~~~~~
   arch/s390/include/asm/page.h: In function 'virt_to_pfn':
>> arch/s390/include/asm/page.h:17:25: error: '_PAGE_SHIFT' undeclared (first use in this function); did you mean 'HPAGE_SHIFT'?
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^~~~~~~~~~~
   arch/s390/include/asm/page.h:243:44: note: in expansion of macro 'PAGE_SHIFT'
     243 | #define phys_to_pfn(phys)       ((phys) >> PAGE_SHIFT)
         |                                            ^~~~~~~~~~
   arch/s390/include/asm/page.h:258:16: note: in expansion of macro 'phys_to_pfn'
     258 |         return phys_to_pfn(__pa(kaddr));
         |                ^~~~~~~~~~~
   include/asm-generic/getorder.h: In function 'get_order':
>> arch/s390/include/asm/page.h:17:25: error: '_PAGE_SHIFT' undeclared (first use in this function); did you mean 'HPAGE_SHIFT'?
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^~~~~~~~~~~
   include/asm-generic/getorder.h:33:48: note: in expansion of macro 'PAGE_SHIFT'
      33 |                         return BITS_PER_LONG - PAGE_SHIFT;
         |                                                ^~~~~~~~~~
   arch/s390/include/asm/processor.h: In function 'on_thread_stack':
>> arch/s390/include/asm/page.h:18:25: error: '_PAGE_SIZE' undeclared (first use in this function); did you mean 'HPAGE_SIZE'?
      18 | #define PAGE_SIZE       _PAGE_SIZE
         |                         ^~~~~~~~~~
   arch/s390/include/asm/thread_info.h:25:22: note: in expansion of macro 'PAGE_SIZE'
      25 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
         |                      ^~~~~~~~~
   arch/s390/include/asm/processor.h:287:52: note: in expansion of macro 'THREAD_SIZE'
     287 |         return !((ksp ^ current_stack_pointer) & ~(THREAD_SIZE - 1));
         |                                                    ^~~~~~~~~~~
   include/linux/sched.h: At top level:
>> arch/s390/include/asm/page.h:18:25: error: '_PAGE_SIZE' undeclared here (not in a function); did you mean 'HPAGE_SIZE'?
      18 | #define PAGE_SIZE       _PAGE_SIZE
         |                         ^~~~~~~~~~
   arch/s390/include/asm/thread_info.h:25:22: note: in expansion of macro 'PAGE_SIZE'
      25 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
         |                      ^~~~~~~~~
   include/linux/sched.h:1890:29: note: in expansion of macro 'THREAD_SIZE'
    1890 |         unsigned long stack[THREAD_SIZE/sizeof(long)];
         |                             ^~~~~~~~~~~
>> arch/s390/include/asm/page.h:18:25: warning: "_PAGE_SIZE" is not defined, evaluates to 0 [-Wundef]
      18 | #define PAGE_SIZE       _PAGE_SIZE
         |                         ^~~~~~~~~~
   include/linux/mm_types.h:547:6: note: in expansion of macro 'PAGE_SIZE'
     547 | #if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE)
         |      ^~~~~~~~~
   In file included from include/vdso/const.h:5,
                    from include/linux/const.h:4,
                    from include/linux/bits.h:5,
                    from include/linux/ratelimit_types.h:5,
                    from include/linux/printk.h:9,
                    from include/asm-generic/bug.h:22,
                    from arch/s390/include/asm/bug.h:69,
                    from include/linux/bug.h:5,
                    from include/linux/alloc_tag.h:8:
>> arch/s390/include/asm/page.h:19:25: warning: "_PAGE_MASK" is not defined, evaluates to 0 [-Wundef]
      19 | #define PAGE_MASK       _PAGE_MASK
         |                         ^~~~~~~~~~
   include/uapi/linux/const.h:49:50: note: in definition of macro '__ALIGN_KERNEL_MASK'
      49 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                                  ^~~~
   include/linux/mm_types.h:524:41: note: in expansion of macro '__ALIGN_MASK'
     524 | #define PAGE_FRAG_CACHE_MAX_SIZE        __ALIGN_MASK(32768, ~PAGE_MASK)
         |                                         ^~~~~~~~~~~~
   include/linux/mm_types.h:524:62: note: in expansion of macro 'PAGE_MASK'
     524 | #define PAGE_FRAG_CACHE_MAX_SIZE        __ALIGN_MASK(32768, ~PAGE_MASK)
         |                                                              ^~~~~~~~~
   include/linux/mm_types.h:547:18: note: in expansion of macro 'PAGE_FRAG_CACHE_MAX_SIZE'
     547 | #if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE)
         |                  ^~~~~~~~~~~~~~~~~~~~~~~~
>> arch/s390/include/asm/page.h:19:25: warning: "_PAGE_MASK" is not defined, evaluates to 0 [-Wundef]
      19 | #define PAGE_MASK       _PAGE_MASK
         |                         ^~~~~~~~~~
   include/uapi/linux/const.h:49:61: note: in definition of macro '__ALIGN_KERNEL_MASK'
      49 | #define __ALIGN_KERNEL_MASK(x, mask)    (((x) + (mask)) & ~(mask))
         |                                                             ^~~~
   include/linux/mm_types.h:524:41: note: in expansion of macro '__ALIGN_MASK'
     524 | #define PAGE_FRAG_CACHE_MAX_SIZE        __ALIGN_MASK(32768, ~PAGE_MASK)
         |                                         ^~~~~~~~~~~~
   include/linux/mm_types.h:524:62: note: in expansion of macro 'PAGE_MASK'
     524 | #define PAGE_FRAG_CACHE_MAX_SIZE        __ALIGN_MASK(32768, ~PAGE_MASK)
         |                                                              ^~~~~~~~~
   include/linux/mm_types.h:547:18: note: in expansion of macro 'PAGE_FRAG_CACHE_MAX_SIZE'
     547 | #if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE)
         |                  ^~~~~~~~~~~~~~~~~~~~~~~~
>> arch/s390/include/asm/page.h:17:25: warning: "_PAGE_SHIFT" is not defined, evaluates to 0 [-Wundef]
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^~~~~~~~~~~
   include/linux/mmzone.h:1777:23: note: in expansion of macro 'PAGE_SHIFT'
    1777 | #if (MAX_PAGE_ORDER + PAGE_SHIFT) > SECTION_SIZE_BITS
         |                       ^~~~~~~~~~
   include/linux/mmzone.h: In function 'pfn_to_section_nr':
>> arch/s390/include/asm/page.h:17:25: error: '_PAGE_SHIFT' undeclared (first use in this function); did you mean 'HPAGE_SHIFT'?
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^~~~~~~~~~~
   include/linux/mmzone.h:1767:54: note: in expansion of macro 'PAGE_SHIFT'
    1767 | #define PFN_SECTION_SHIFT       (SECTION_SIZE_BITS - PAGE_SHIFT)
         |                                                      ^~~~~~~~~~
   include/linux/mmzone.h:1783:23: note: in expansion of macro 'PFN_SECTION_SHIFT'
    1783 |         return pfn >> PFN_SECTION_SHIFT;
         |                       ^~~~~~~~~~~~~~~~~
   include/linux/mmzone.h: In function 'section_nr_to_pfn':
>> arch/s390/include/asm/page.h:17:25: error: '_PAGE_SHIFT' undeclared (first use in this function); did you mean 'HPAGE_SHIFT'?
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^~~~~~~~~~~
   include/linux/mmzone.h:1767:54: note: in expansion of macro 'PAGE_SHIFT'
    1767 | #define PFN_SECTION_SHIFT       (SECTION_SIZE_BITS - PAGE_SHIFT)
         |                                                      ^~~~~~~~~~
   include/linux/mmzone.h:1787:23: note: in expansion of macro 'PFN_SECTION_SHIFT'
    1787 |         return sec << PFN_SECTION_SHIFT;
         |                       ^~~~~~~~~~~~~~~~~
   include/linux/mmzone.h: In function 'subsection_map_index':
>> arch/s390/include/asm/page.h:17:25: error: '_PAGE_SHIFT' undeclared (first use in this function); did you mean 'HPAGE_SHIFT'?
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^~~~~~~~~~~
   include/linux/mmzone.h:1767:54: note: in expansion of macro 'PAGE_SHIFT'
    1767 | #define PFN_SECTION_SHIFT       (SECTION_SIZE_BITS - PAGE_SHIFT)
         |                                                      ^~~~~~~~~~
   include/linux/mmzone.h:1771:41: note: in expansion of macro 'PFN_SECTION_SHIFT'
    1771 | #define PAGES_PER_SECTION       (1UL << PFN_SECTION_SHIFT)
         |                                         ^~~~~~~~~~~~~~~~~
   include/linux/mmzone.h:1772:36: note: in expansion of macro 'PAGES_PER_SECTION'
    1772 | #define PAGE_SECTION_MASK       (~(PAGES_PER_SECTION-1))
         |                                    ^~~~~~~~~~~~~~~~~
   include/linux/mmzone.h:1996:25: note: in expansion of macro 'PAGE_SECTION_MASK'
    1996 |         return (pfn & ~(PAGE_SECTION_MASK)) / PAGES_PER_SUBSECTION;
         |                         ^~~~~~~~~~~~~~~~~
   In file included from include/asm-generic/memory_model.h:5,
                    from arch/s390/include/asm/page.h:272:
   include/linux/mmzone.h: In function 'pfn_valid':
>> arch/s390/include/asm/page.h:17:25: error: '_PAGE_SHIFT' undeclared (first use in this function); did you mean 'HPAGE_SHIFT'?
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^~~~~~~~~~~
   include/linux/pfn.h:22:43: note: in definition of macro 'PHYS_PFN'
      22 | #define PHYS_PFN(x)     ((unsigned long)((x) >> PAGE_SHIFT))
         |                                           ^
   include/linux/pfn.h:21:46: note: in expansion of macro 'PAGE_SHIFT'
      21 | #define PFN_PHYS(x)     ((phys_addr_t)(x) << PAGE_SHIFT)
         |                                              ^~~~~~~~~~
   include/linux/mmzone.h:2037:22: note: in expansion of macro 'PFN_PHYS'
    2037 |         if (PHYS_PFN(PFN_PHYS(pfn)) != pfn)
         |                      ^~~~~~~~
   In file included from arch/s390/include/asm/bug.h:5:
   arch/s390/include/asm/uv.h: In function 'share':
>> arch/s390/include/asm/page.h:19:25: error: '_PAGE_MASK' undeclared (first use in this function); did you mean 'HPAGE_MASK'?
      19 | #define PAGE_MASK       _PAGE_MASK
         |                         ^~~~~~~~~~
   include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
      77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
         |                                             ^
   arch/s390/include/asm/uv.h:440:9: note: in expansion of macro 'BUG_ON'
     440 |         BUG_ON(addr & ~PAGE_MASK);
         |         ^~~~~~
   arch/s390/include/asm/uv.h:440:24: note: in expansion of macro 'PAGE_MASK'
     440 |         BUG_ON(addr & ~PAGE_MASK);
         |                        ^~~~~~~~~
   arch/s390/include/asm/pgtable.h: In function 'pgd_pfn':
>> arch/s390/include/asm/page.h:17:25: error: '_PAGE_SHIFT' undeclared (first use in this function); did you mean 'HPAGE_SHIFT'?
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^~~~~~~~~~~
   arch/s390/include/asm/pgtable.h:710:48: note: in expansion of macro 'PAGE_SHIFT'
     710 |         return (pgd_val(pgd) & origin_mask) >> PAGE_SHIFT;
         |                                                ^~~~~~~~~~
   arch/s390/include/asm/pgtable.h: In function 'p4d_pfn':
>> arch/s390/include/asm/page.h:17:25: error: '_PAGE_SHIFT' undeclared (first use in this function); did you mean 'HPAGE_SHIFT'?
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^~~~~~~~~~~
   arch/s390/include/asm/pgtable.h:737:48: note: in expansion of macro 'PAGE_SHIFT'
     737 |         return (p4d_val(p4d) & origin_mask) >> PAGE_SHIFT;
         |                                                ^~~~~~~~~~
   arch/s390/include/asm/pgtable.h: In function 'pte_pgprot':
>> arch/s390/include/asm/page.h:19:25: error: '_PAGE_MASK' undeclared (first use in this function); did you mean 'HPAGE_MASK'?
      19 | #define PAGE_MASK       _PAGE_MASK
         |                         ^~~~~~~~~~
   arch/s390/include/asm/pgtable.h:205:34: note: in expansion of macro 'PAGE_MASK'
     205 | #define _PAGE_CHG_MASK          (PAGE_MASK | _PAGE_SPECIAL | _PAGE_DIRTY | \
         |                                  ^~~~~~~~~
   arch/s390/include/asm/pgtable.h:961:50: note: in expansion of macro '_PAGE_CHG_MASK'
     961 |         unsigned long pte_flags = pte_val(pte) & _PAGE_CHG_MASK;
         |                                                  ^~~~~~~~~~~~~~
   arch/s390/include/asm/pgtable.h: In function 'pte_modify':
   arch/s390/include/asm/page.h:19:25: error: '_PAGE_MASK' undeclared (first use in this function); did you mean 'HPAGE_MASK'?
      19 | #define PAGE_MASK       _PAGE_MASK
         |                         ^~~~~~~~~~
   arch/s390/include/asm/page.h:124:40: note: in definition of macro '__pgprot'
     124 | #define __pgprot(x)     ((pgprot_t) { (x) } )
         |                                        ^
   arch/s390/include/asm/pgtable.h:205:34: note: in expansion of macro 'PAGE_MASK'
     205 | #define _PAGE_CHG_MASK          (PAGE_MASK | _PAGE_SPECIAL | _PAGE_DIRTY | \
         |                                  ^~~~~~~~~
   arch/s390/include/asm/pgtable.h:1035:44: note: in expansion of macro '_PAGE_CHG_MASK'
    1035 |         pte = clear_pte_bit(pte, __pgprot(~_PAGE_CHG_MASK));
         |                                            ^~~~~~~~~~~~~~
   arch/s390/include/asm/pgtable.h: In function '__ptep_rdp':
   arch/s390/include/asm/page.h:19:25: error: '_PAGE_MASK' undeclared (first use in this function); did you mean 'HPAGE_MASK'?
      19 | #define PAGE_MASK       _PAGE_MASK
         |                         ^~~~~~~~~~
   arch/s390/include/asm/pgtable.h:1121:58: note: in expansion of macro 'PAGE_MASK'
    1121 |                      : [r1] "a" (pto), [r2] "a" ((addr & PAGE_MASK) | opt),
         |                                                          ^~~~~~~~~
   arch/s390/include/asm/pgtable.h: In function 'mk_pte':
   arch/s390/include/asm/page.h:17:25: error: '_PAGE_SHIFT' undeclared (first use in this function); did you mean 'HPAGE_SHIFT'?
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^~~~~~~~~~~
   arch/s390/include/asm/page.h:244:43: note: in expansion of macro 'PAGE_SHIFT'
     244 | #define pfn_to_phys(pfn)        ((pfn) << PAGE_SHIFT)
         |                                           ^~~~~~~~~~
   arch/s390/include/asm/page.h:248:33: note: in expansion of macro 'pfn_to_phys'
     248 | #define page_to_phys(page)      pfn_to_phys(page_to_pfn(page))
         |                                 ^~~~~~~~~~~
   arch/s390/include/asm/pgtable.h:1419:34: note: in expansion of macro 'page_to_phys'
    1419 |         unsigned long physpage = page_to_phys(page);
         |                                  ^~~~~~~~~~~~
   arch/s390/include/asm/pgtable.h: In function 'pmd_pfn':
   arch/s390/include/asm/page.h:17:25: error: '_PAGE_SHIFT' undeclared (first use in this function); did you mean 'HPAGE_SHIFT'?
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^~~~~~~~~~~
   arch/s390/include/asm/pgtable.h:1447:40: note: in expansion of macro 'PAGE_SHIFT'
    1447 |         return __pa(pmd_deref(pmd)) >> PAGE_SHIFT;
         |                                        ^~~~~~~~~~
   arch/s390/include/asm/pgtable.h: In function 'pud_pfn':
   arch/s390/include/asm/page.h:17:25: error: '_PAGE_SHIFT' undeclared (first use in this function); did you mean 'HPAGE_SHIFT'?
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^~~~~~~~~~~
   arch/s390/include/asm/pgtable.h:1463:40: note: in expansion of macro 'PAGE_SHIFT'
    1463 |         return __pa(pud_deref(pud)) >> PAGE_SHIFT;
         |                                        ^~~~~~~~~~
   include/linux/pgtable.h: In function 'pte_index':
   arch/s390/include/asm/page.h:17:25: error: '_PAGE_SHIFT' undeclared (first use in this function); did you mean 'HPAGE_SHIFT'?
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^~~~~~~~~~~
   include/linux/pgtable.h:69:28: note: in expansion of macro 'PAGE_SHIFT'
      69 |         return (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1);
         |                            ^~~~~~~~~~
   include/linux/pgtable.h: In function 'pte_advance_pfn':
   arch/s390/include/asm/page.h:17:25: error: '_PAGE_SHIFT' undeclared (first use in this function); did you mean 'HPAGE_SHIFT'?
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^~~~~~~~~~~
   arch/s390/include/asm/page.h:119:37: note: in definition of macro '__pte'
     119 | #define __pte(x)        ((pte_t) { (x) } )
         |                                     ^
   arch/s390/include/asm/pgtable.h:1371:33: note: in expansion of macro 'PAGE_SHIFT'
    1371 | #define PFN_PTE_SHIFT           PAGE_SHIFT
         |                                 ^~~~~~~~~~
   include/linux/pgtable.h:239:44: note: in expansion of macro 'PFN_PTE_SHIFT'
     239 |         return __pte(pte_val(pte) + (nr << PFN_PTE_SHIFT));
         |                                            ^~~~~~~~~~~~~
   include/linux/pgtable.h: In function 'is_zero_pfn':
   arch/s390/include/asm/page.h:17:25: error: '_PAGE_SHIFT' undeclared (first use in this function); did you mean 'HPAGE_SHIFT'?
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^~~~~~~~~~~
   include/linux/pgtable.h:1565:59: note: in expansion of macro 'PAGE_SHIFT'
    1565 |         return offset_from_zero_pfn <= (zero_page_mask >> PAGE_SHIFT);
         |                                                           ^~~~~~~~~~
   include/linux/slab.h: At top level:
   arch/s390/include/asm/page.h:17:25: error: '_PAGE_SHIFT' undeclared here (not in a function); did you mean 'HPAGE_SHIFT'?
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^~~~~~~~~~~
   include/linux/slab.h:528:34: note: in expansion of macro 'PAGE_SHIFT'
     528 | #define KMALLOC_SHIFT_HIGH      (PAGE_SHIFT + 1)
         |                                  ^~~~~~~~~~
   include/linux/slab.h:597:42: note: in expansion of macro 'KMALLOC_SHIFT_HIGH'
     597 | typedef struct kmem_cache * kmem_buckets[KMALLOC_SHIFT_HIGH + 1];
         |                                          ^~~~~~~~~~~~~~~~~~
   In file included from include/linux/init.h:5,
                    from include/linux/printk.h:6:
   arch/s390/include/asm/page.h:17:25: error: expression in static assertion is not an integer
      17 | #define PAGE_SHIFT      _PAGE_SHIFT
         |                         ^~~~~~~~~~~
   include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
      78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                                        ^~~~


vim +17 arch/s390/include/asm/page.h

c67da7c7c5d4c0 arch/s390/include/asm/page.h Heiko Carstens           2017-06-16  15  
^1da177e4c3f41 include/asm-s390/page.h      Linus Torvalds           2005-04-16  16  /* PAGE_SHIFT determines the page size */
c67da7c7c5d4c0 arch/s390/include/asm/page.h Heiko Carstens           2017-06-16 @17  #define PAGE_SHIFT	_PAGE_SHIFT
c67da7c7c5d4c0 arch/s390/include/asm/page.h Heiko Carstens           2017-06-16 @18  #define PAGE_SIZE	_PAGE_SIZE
c67da7c7c5d4c0 arch/s390/include/asm/page.h Heiko Carstens           2017-06-16 @19  #define PAGE_MASK	_PAGE_MASK
6376402841e1fa arch/s390/include/asm/page.h Heiko Carstens           2023-06-21  20  #define PAGE_DEFAULT_ACC	_AC(0, UL)
e613d83454d7da arch/s390/include/asm/page.h Janis Schoetterl-Glausch 2022-02-11  21  /* storage-protection override */
e613d83454d7da arch/s390/include/asm/page.h Janis Schoetterl-Glausch 2022-02-11  22  #define PAGE_SPO_ACC		9
0b642ede47969d include/asm-s390/page.h      Peter Oberparleiter      2005-05-01  23  #define PAGE_DEFAULT_KEY	(PAGE_DEFAULT_ACC << 4)
^1da177e4c3f41 include/asm-s390/page.h      Linus Torvalds           2005-04-16  24
diff mbox series

Patch

diff --git a/arch/alpha/include/asm/page.h b/arch/alpha/include/asm/page.h
index 70419e6be1a3..261af54fd601 100644
--- a/arch/alpha/include/asm/page.h
+++ b/arch/alpha/include/asm/page.h
@@ -4,11 +4,7 @@ 
 
 #include <linux/const.h>
 #include <asm/pal.h>
-
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT	CONFIG_PAGE_SHIFT
-#define PAGE_SIZE	(_AC(1,UL) << PAGE_SHIFT)
-#define PAGE_MASK	(~(PAGE_SIZE-1))
+#include <vdso/page.h>
 
 #ifndef __ASSEMBLY__
 
diff --git a/arch/arc/include/uapi/asm/page.h b/arch/arc/include/uapi/asm/page.h
index 7fd9e741b527..4606a326af5c 100644
--- a/arch/arc/include/uapi/asm/page.h
+++ b/arch/arc/include/uapi/asm/page.h
@@ -14,7 +14,7 @@ 
 
 /* PAGE_SHIFT determines the page size */
 #ifdef __KERNEL__
-#define PAGE_SHIFT CONFIG_PAGE_SHIFT
+#include <vdso/page.h>
 #else
 /*
  * Default 8k
@@ -24,11 +24,10 @@ 
  * not available
  */
 #define PAGE_SHIFT 13
+#define PAGE_SIZE	_BITUL(PAGE_SHIFT)	/* Default 8K */
+#define PAGE_MASK	(~(PAGE_SIZE-1))
 #endif
 
-#define PAGE_SIZE	_BITUL(PAGE_SHIFT)	/* Default 8K */
 #define PAGE_OFFSET	_AC(0x80000000, UL)	/* Kernel starts at 2G onwrds */
 
-#define PAGE_MASK	(~(PAGE_SIZE-1))
-
 #endif /* _UAPI__ASM_ARC_PAGE_H */
diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h
index 62af9f7f9e96..ef11b721230e 100644
--- a/arch/arm/include/asm/page.h
+++ b/arch/arm/include/asm/page.h
@@ -7,10 +7,7 @@ 
 #ifndef _ASMARM_PAGE_H
 #define _ASMARM_PAGE_H
 
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT		CONFIG_PAGE_SHIFT
-#define PAGE_SIZE		(_AC(1,UL) << PAGE_SHIFT)
-#define PAGE_MASK		(~((1 << PAGE_SHIFT) - 1))
+#include <vdso/page.h>
 
 #ifndef __ASSEMBLY__
 
diff --git a/arch/arm64/include/asm/page-def.h b/arch/arm64/include/asm/page-def.h
index 792e9fe881dc..d402e08442ee 100644
--- a/arch/arm64/include/asm/page-def.h
+++ b/arch/arm64/include/asm/page-def.h
@@ -10,9 +10,6 @@ 
 
 #include <linux/const.h>
 
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT		CONFIG_PAGE_SHIFT
-#define PAGE_SIZE		(_AC(1, UL) << PAGE_SHIFT)
-#define PAGE_MASK		(~(PAGE_SIZE-1))
+#include <vdso/page.h>
 
 #endif /* __ASM_PAGE_DEF_H */
diff --git a/arch/csky/include/asm/page.h b/arch/csky/include/asm/page.h
index 0ca6c408c07f..f8beae295afb 100644
--- a/arch/csky/include/asm/page.h
+++ b/arch/csky/include/asm/page.h
@@ -7,12 +7,8 @@ 
 #include <asm/cache.h>
 #include <linux/const.h>
 
-/*
- * PAGE_SHIFT determines the page size: 4KB
- */
-#define PAGE_SHIFT	CONFIG_PAGE_SHIFT
-#define PAGE_SIZE	(_AC(1, UL) << PAGE_SHIFT)
-#define PAGE_MASK	(~(PAGE_SIZE - 1))
+#include <vdso/page.h>
+
 #define THREAD_SIZE	(PAGE_SIZE * 2)
 #define THREAD_MASK	(~(THREAD_SIZE - 1))
 #define THREAD_SHIFT	(PAGE_SHIFT + 1)
diff --git a/arch/hexagon/include/asm/page.h b/arch/hexagon/include/asm/page.h
index 8a6af57274c2..b01f8df69dd4 100644
--- a/arch/hexagon/include/asm/page.h
+++ b/arch/hexagon/include/asm/page.h
@@ -45,9 +45,7 @@ 
 #define HVM_HUGEPAGE_SIZE 0x5
 #endif
 
-#define PAGE_SHIFT CONFIG_PAGE_SHIFT
-#define PAGE_SIZE  (1UL << PAGE_SHIFT)
-#define PAGE_MASK  (~((1 << PAGE_SHIFT) - 1))
+#include <vdso/page.h>
 
 #ifdef __KERNEL__
 #ifndef __ASSEMBLY__
diff --git a/arch/loongarch/include/asm/page.h b/arch/loongarch/include/asm/page.h
index e85df33f11c7..83f3533e31a4 100644
--- a/arch/loongarch/include/asm/page.h
+++ b/arch/loongarch/include/asm/page.h
@@ -8,12 +8,7 @@ 
 #include <linux/const.h>
 #include <asm/addrspace.h>
 
-/*
- * PAGE_SHIFT determines the page size
- */
-#define PAGE_SHIFT	CONFIG_PAGE_SHIFT
-#define PAGE_SIZE	(_AC(1, UL) << PAGE_SHIFT)
-#define PAGE_MASK	(~(PAGE_SIZE - 1))
+#include <vdso/page.h>
 
 #define HPAGE_SHIFT	(PAGE_SHIFT + PAGE_SHIFT - 3)
 #define HPAGE_SIZE	(_AC(1, UL) << HPAGE_SHIFT)
diff --git a/arch/m68k/include/asm/page.h b/arch/m68k/include/asm/page.h
index 8cfb84b49975..b173ba27d36f 100644
--- a/arch/m68k/include/asm/page.h
+++ b/arch/m68k/include/asm/page.h
@@ -6,10 +6,8 @@ 
 #include <asm/setup.h>
 #include <asm/page_offset.h>
 
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT	CONFIG_PAGE_SHIFT
-#define PAGE_SIZE	(_AC(1, UL) << PAGE_SHIFT)
-#define PAGE_MASK	(~(PAGE_SIZE-1))
+#include <vdso/page.h>
+
 #define PAGE_OFFSET	(PAGE_OFFSET_RAW)
 
 #ifndef __ASSEMBLY__
diff --git a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h
index 8810f4f1c3b0..d1ec3806edab 100644
--- a/arch/microblaze/include/asm/page.h
+++ b/arch/microblaze/include/asm/page.h
@@ -19,10 +19,7 @@ 
 
 #ifdef __KERNEL__
 
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT	CONFIG_PAGE_SHIFT
-#define PAGE_SIZE	(ASM_CONST(1) << PAGE_SHIFT)
-#define PAGE_MASK	(~(PAGE_SIZE-1))
+#include <vdso/page.h>
 
 #define LOAD_OFFSET	ASM_CONST((CONFIG_KERNEL_START-CONFIG_KERNEL_BASE_ADDR))
 
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
index 4609cb0326cf..bc3e3484c1bf 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
@@ -14,12 +14,7 @@ 
 #include <linux/kernel.h>
 #include <asm/mipsregs.h>
 
-/*
- * PAGE_SHIFT determines the page size
- */
-#define PAGE_SHIFT	CONFIG_PAGE_SHIFT
-#define PAGE_SIZE	(_AC(1,UL) << PAGE_SHIFT)
-#define PAGE_MASK	(~((1 << PAGE_SHIFT) - 1))
+#include <vdso/page.h>
 
 /*
  * This is used for calculating the real page sizes
diff --git a/arch/nios2/include/asm/page.h b/arch/nios2/include/asm/page.h
index 0722f88e63cc..2897ec1b74f6 100644
--- a/arch/nios2/include/asm/page.h
+++ b/arch/nios2/include/asm/page.h
@@ -18,12 +18,7 @@ 
 #include <linux/pfn.h>
 #include <linux/const.h>
 
-/*
- * PAGE_SHIFT determines the page size
- */
-#define PAGE_SHIFT	CONFIG_PAGE_SHIFT
-#define PAGE_SIZE	(_AC(1, UL) << PAGE_SHIFT)
-#define PAGE_MASK	(~(PAGE_SIZE - 1))
+#include <vdso/page.h>
 
 /*
  * PAGE_OFFSET -- the first address of the first page of memory.
diff --git a/arch/openrisc/include/asm/page.h b/arch/openrisc/include/asm/page.h
index 1d5913f67c31..124a2db4b160 100644
--- a/arch/openrisc/include/asm/page.h
+++ b/arch/openrisc/include/asm/page.h
@@ -15,16 +15,7 @@ 
 #ifndef __ASM_OPENRISC_PAGE_H
 #define __ASM_OPENRISC_PAGE_H
 
-
-/* PAGE_SHIFT determines the page size */
-
-#define PAGE_SHIFT      CONFIG_PAGE_SHIFT
-#ifdef __ASSEMBLY__
-#define PAGE_SIZE       (1 << PAGE_SHIFT)
-#else
-#define PAGE_SIZE       (1UL << PAGE_SHIFT)
-#endif
-#define PAGE_MASK       (~(PAGE_SIZE-1))
+#include <vdso/page.h>
 
 #define PAGE_OFFSET	0xc0000000
 #define KERNELBASE	PAGE_OFFSET
diff --git a/arch/parisc/include/asm/page.h b/arch/parisc/include/asm/page.h
index 4bea2e95798f..6c4836fb5407 100644
--- a/arch/parisc/include/asm/page.h
+++ b/arch/parisc/include/asm/page.h
@@ -4,9 +4,7 @@ 
 
 #include <linux/const.h>
 
-#define PAGE_SHIFT	CONFIG_PAGE_SHIFT
-#define PAGE_SIZE	(_AC(1,UL) << PAGE_SHIFT)
-#define PAGE_MASK	(~(PAGE_SIZE-1))
+#include <vdso/page.h>
 
 #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
 
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index 83d0a4fc5f75..af9a2628d1df 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -21,8 +21,7 @@ 
  * page size. When using 64K pages however, whether we are really supporting
  * 64K pages in HW or not is irrelevant to those definitions.
  */
-#define PAGE_SHIFT		CONFIG_PAGE_SHIFT
-#define PAGE_SIZE		(ASM_CONST(1) << PAGE_SHIFT)
+#include <vdso/page.h>
 
 #ifndef __ASSEMBLY__
 #ifndef CONFIG_HUGETLB_PAGE
@@ -41,13 +40,6 @@  extern unsigned int hpage_shift;
 #define HUGE_MAX_HSTATE		(MMU_PAGE_COUNT-1)
 #endif
 
-/*
- * Subtle: (1 << PAGE_SHIFT) is an int, not an unsigned long. So if we
- * assign PAGE_MASK to a larger type it gets extended the way we want
- * (i.e. with 1s in the high bits)
- */
-#define PAGE_MASK      (~((1 << PAGE_SHIFT) - 1))
-
 /*
  * KERNELBASE is the virtual address of the start of the kernel, it's often
  * the same as PAGE_OFFSET, but _might not be_.
diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h
index 32d308a3355f..9875399827c7 100644
--- a/arch/riscv/include/asm/page.h
+++ b/arch/riscv/include/asm/page.h
@@ -12,9 +12,7 @@ 
 #include <linux/pfn.h>
 #include <linux/const.h>
 
-#define PAGE_SHIFT	CONFIG_PAGE_SHIFT
-#define PAGE_SIZE	(_AC(1, UL) << PAGE_SHIFT)
-#define PAGE_MASK	(~(PAGE_SIZE - 1))
+#include <vdso/page.h>
 
 #define HPAGE_SHIFT		PMD_SHIFT
 #define HPAGE_SIZE		(_AC(1, UL) << HPAGE_SHIFT)
diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h
index 73e1e03317b4..c949fe7736b9 100644
--- a/arch/s390/include/asm/page.h
+++ b/arch/s390/include/asm/page.h
@@ -11,9 +11,7 @@ 
 #include <linux/const.h>
 #include <asm/types.h>
 
-#define _PAGE_SHIFT	CONFIG_PAGE_SHIFT
-#define _PAGE_SIZE	(_AC(1, UL) << _PAGE_SHIFT)
-#define _PAGE_MASK	(~(_PAGE_SIZE - 1))
+#include <vdso/page.h>
 
 /* PAGE_SHIFT determines the page size */
 #define PAGE_SHIFT	_PAGE_SHIFT
diff --git a/arch/sh/include/asm/page.h b/arch/sh/include/asm/page.h
index f780b467e75d..fc39b8171bfb 100644
--- a/arch/sh/include/asm/page.h
+++ b/arch/sh/include/asm/page.h
@@ -8,10 +8,8 @@ 
 
 #include <linux/const.h>
 
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT	CONFIG_PAGE_SHIFT
-#define PAGE_SIZE	(_AC(1, UL) << PAGE_SHIFT)
-#define PAGE_MASK	(~(PAGE_SIZE-1))
+#include <vdso/page.h>
+
 #define PTE_MASK	PAGE_MASK
 
 #if defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
diff --git a/arch/sparc/include/asm/page_32.h b/arch/sparc/include/asm/page_32.h
index 9977c77374cd..9954254ea569 100644
--- a/arch/sparc/include/asm/page_32.h
+++ b/arch/sparc/include/asm/page_32.h
@@ -11,9 +11,7 @@ 
 
 #include <linux/const.h>
 
-#define PAGE_SHIFT   CONFIG_PAGE_SHIFT
-#define PAGE_SIZE    (_AC(1, UL) << PAGE_SHIFT)
-#define PAGE_MASK    (~(PAGE_SIZE-1))
+#include <vdso/page.h>
 
 #ifndef __ASSEMBLY__
 
diff --git a/arch/sparc/include/asm/page_64.h b/arch/sparc/include/asm/page_64.h
index e9bd24821c93..2a68ff5b6eab 100644
--- a/arch/sparc/include/asm/page_64.h
+++ b/arch/sparc/include/asm/page_64.h
@@ -4,9 +4,7 @@ 
 
 #include <linux/const.h>
 
-#define PAGE_SHIFT   CONFIG_PAGE_SHIFT
-#define PAGE_SIZE    (_AC(1,UL) << PAGE_SHIFT)
-#define PAGE_MASK    (~(PAGE_SIZE-1))
+#include <vdso/page.h>
 
 /* Flushing for D-cache alias handling is only needed if
  * the page size is smaller than 16K.
diff --git a/arch/um/include/asm/page.h b/arch/um/include/asm/page.h
index 9ef9a8aedfa6..834313ecd3d6 100644
--- a/arch/um/include/asm/page.h
+++ b/arch/um/include/asm/page.h
@@ -9,10 +9,7 @@ 
 
 #include <linux/const.h>
 
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT	CONFIG_PAGE_SHIFT
-#define PAGE_SIZE	(_AC(1, UL) << PAGE_SHIFT)
-#define PAGE_MASK	(~(PAGE_SIZE-1))
+#include <vdso/page.h>
 
 #ifndef __ASSEMBLY__
 
diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h
index 52f1b4ff0cc1..974688973cf6 100644
--- a/arch/x86/include/asm/page_types.h
+++ b/arch/x86/include/asm/page_types.h
@@ -6,10 +6,7 @@ 
 #include <linux/types.h>
 #include <linux/mem_encrypt.h>
 
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT		CONFIG_PAGE_SHIFT
-#define PAGE_SIZE		(_AC(1,UL) << PAGE_SHIFT)
-#define PAGE_MASK		(~(PAGE_SIZE-1))
+#include <vdso/page.h>
 
 #define __VIRTUAL_MASK		((1UL << __VIRTUAL_MASK_SHIFT) - 1)
 
diff --git a/arch/xtensa/include/asm/page.h b/arch/xtensa/include/asm/page.h
index 4db56ef052d2..595c1037b738 100644
--- a/arch/xtensa/include/asm/page.h
+++ b/arch/xtensa/include/asm/page.h
@@ -18,13 +18,7 @@ 
 #include <asm/cache.h>
 #include <asm/kmem_layout.h>
 
-/*
- * PAGE_SHIFT determines the page size
- */
-
-#define PAGE_SHIFT	CONFIG_PAGE_SHIFT
-#define PAGE_SIZE	(__XTENSA_UL_CONST(1) << PAGE_SHIFT)
-#define PAGE_MASK	(~(PAGE_SIZE-1))
+#include <vdso/page.h>
 
 #ifdef CONFIG_MMU
 #define PAGE_OFFSET	XCHAL_KSEG_CACHED_VADDR
diff --git a/include/vdso/page.h b/include/vdso/page.h
new file mode 100644
index 000000000000..4ada1ba6bd1f
--- /dev/null
+++ b/include/vdso/page.h
@@ -0,0 +1,30 @@ 
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __VDSO_PAGE_H
+#define __VDSO_PAGE_H
+
+#include <uapi/linux/const.h>
+
+/*
+ * PAGE_SHIFT determines the page size.
+ *
+ * Note: This definition is required because PAGE_SHIFT is used
+ * in several places throuout the codebase.
+ */
+#define PAGE_SHIFT      CONFIG_PAGE_SHIFT
+
+#define PAGE_SIZE	(_AC(1,UL) << CONFIG_PAGE_SHIFT)
+
+#if defined(CONFIG_PHYS_ADDR_T_64BIT) && !defined(CONFIG_64BIT)
+/*
+ * Applies only to 32-bit architectures with a 64-bit phys_addr_t.
+ *
+ * Subtle: (1 << CONFIG_PAGE_SHIFT) is an int, not an unsigned long.
+ * So if we assign PAGE_MASK to a larger type it gets extended the
+ * way we want (i.e. with 1s in the high bits)
+ */
+#define PAGE_MASK	(~((1 << CONFIG_PAGE_SHIFT) - 1))
+#else
+#define PAGE_MASK	(~(PAGE_SIZE - 1))
+#endif
+
+#endif	/* __VDSO_PAGE_H */