RISC-V: Move all address space definition macros to one place
authorAtish Patra <atish.patra@wdc.com>
Mon, 24 Feb 2020 19:34:36 +0000 (11:34 -0800)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Fri, 6 Mar 2020 00:16:17 +0000 (16:16 -0800)
commit9f40b6e77d2f888a8c0608036eb124cedb6d2434
treed24271b74a58dd39be52f0d2015dd6ffe5a6b6a0
parent3133287b53ee88444e2294e601d2bad54a798f59
RISC-V: Move all address space definition macros to one place

If both CONFIG_KASAN and CONFIG_SPARSEMEM_VMEMMAP are set, we get the
following compilation error.

---------------------------------------------------------------
./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