RISC-V: Move all address space definition macros to one place
authorAtish Patra <atish.patra@wdc.com>
Thu, 26 Mar 2020 22:55:46 +0000 (15:55 -0700)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Fri, 27 Mar 2020 02:26:11 +0000 (19:26 -0700)
commit2191b4f298fa360f2d1d967c2c7db565bea2c32e
tree098246a41f0c006c2a3becce087bf67e00e8747d
parentbd6f20333c6794e8b06f5ee963bfa5943e65cc86
RISC-V: Move all address space definition macros to one place

We get the following compilation error if CONFIG_SPARSEMEM_VMEMMAP is set.

---------------------------------------------------------------
./arch/riscv/include/asm/pgtable-64.h: In function ‘pud_page’:
./include/asm-generic/memory_model.h:54:29: error: ‘vmemmap’ undeclared
(first use in this function); did you mean ‘mem_map’?
 #define __pfn_to_page(pfn) (vmemmap + (pfn))
                             ^~~~~~~
./include/asm-generic/memory_model.h:82:21: note: in expansion of
macro ‘__pfn_to_page’

 #define pfn_to_page __pfn_to_page
                     ^~~~~~~~~~~~~
./arch/riscv/include/asm/pgtable-64.h:70:9: note: in expansion of macro
‘pfn_to_page’
  return pfn_to_page(pud_val(pud) >> _PAGE_PFN_SHIFT);
---------------------------------------------------------------

Fix the compliation errors by moving all the address space definition
macros before including pgtable-64.h.

Fixes: 8ad8b72721d0 (riscv: Add KASAN support)

Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/include/asm/pgtable.h