Commit ac51e005 authored by Zong Li's avatar Zong Li Committed by Paul Walmsley

riscv: mm: use __pa_symbol for kernel symbols

__pa_symbol is the marcro that should be used for kernel symbols. It is
also a pre-requisite for DEBUG_VIRTUAL which will do bounds checking.
Signed-off-by: default avatarZong Li <zong.li@sifive.com>
Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
Signed-off-by: default avatarPaul Walmsley <paul.walmsley@sifive.com>
parent fd698849
...@@ -99,13 +99,13 @@ static void __init setup_initrd(void) ...@@ -99,13 +99,13 @@ static void __init setup_initrd(void)
pr_info("initrd not found or empty"); pr_info("initrd not found or empty");
goto disable; goto disable;
} }
if (__pa(initrd_end) > PFN_PHYS(max_low_pfn)) { if (__pa_symbol(initrd_end) > PFN_PHYS(max_low_pfn)) {
pr_err("initrd extends beyond end of memory"); pr_err("initrd extends beyond end of memory");
goto disable; goto disable;
} }
size = initrd_end - initrd_start; size = initrd_end - initrd_start;
memblock_reserve(__pa(initrd_start), size); memblock_reserve(__pa_symbol(initrd_start), size);
initrd_below_start_ok = 1; initrd_below_start_ok = 1;
pr_info("Initial ramdisk at: 0x%p (%lu bytes)\n", pr_info("Initial ramdisk at: 0x%p (%lu bytes)\n",
...@@ -124,8 +124,8 @@ void __init setup_bootmem(void) ...@@ -124,8 +124,8 @@ void __init setup_bootmem(void)
{ {
struct memblock_region *reg; struct memblock_region *reg;
phys_addr_t mem_size = 0; phys_addr_t mem_size = 0;
phys_addr_t vmlinux_end = __pa(&_end); phys_addr_t vmlinux_end = __pa_symbol(&_end);
phys_addr_t vmlinux_start = __pa(&_start); phys_addr_t vmlinux_start = __pa_symbol(&_start);
/* Find the memory region containing the kernel */ /* Find the memory region containing the kernel */
for_each_memblock(memory, reg) { for_each_memblock(memory, reg) {
...@@ -445,7 +445,7 @@ static void __init setup_vm_final(void) ...@@ -445,7 +445,7 @@ static void __init setup_vm_final(void)
/* Setup swapper PGD for fixmap */ /* Setup swapper PGD for fixmap */
create_pgd_mapping(swapper_pg_dir, FIXADDR_START, create_pgd_mapping(swapper_pg_dir, FIXADDR_START,
__pa(fixmap_pgd_next), __pa_symbol(fixmap_pgd_next),
PGDIR_SIZE, PAGE_TABLE); PGDIR_SIZE, PAGE_TABLE);
/* Map all memory banks */ /* Map all memory banks */
...@@ -474,7 +474,7 @@ static void __init setup_vm_final(void) ...@@ -474,7 +474,7 @@ static void __init setup_vm_final(void)
clear_fixmap(FIX_PMD); clear_fixmap(FIX_PMD);
/* Move to swapper page table */ /* Move to swapper page table */
csr_write(CSR_SATP, PFN_DOWN(__pa(swapper_pg_dir)) | SATP_MODE); csr_write(CSR_SATP, PFN_DOWN(__pa_symbol(swapper_pg_dir)) | SATP_MODE);
local_flush_tlb_all(); local_flush_tlb_all();
} }
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment