From: Stephen Rothwell Date: Wed, 1 Sep 2021 23:24:22 +0000 (+1000) Subject: Merge remote-tracking branch 'risc-v/for-next' X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=56395a7cef345caeddcd8495903ed3db1b2a949d;p=users%2Fjedix%2Flinux-maple.git Merge remote-tracking branch 'risc-v/for-next' --- 56395a7cef345caeddcd8495903ed3db1b2a949d diff --cc arch/riscv/include/asm/page.h index b0ca5058e7ae6,d34327be75746..109c97e991a63 --- a/arch/riscv/include/asm/page.h +++ b/arch/riscv/include/asm/page.h @@@ -103,13 -101,12 +101,13 @@@ struct kernel_mapping }; extern struct kernel_mapping kernel_map; +extern phys_addr_t phys_ram_base; - #ifdef CONFIG_64BIT #define is_kernel_mapping(x) \ ((x) >= kernel_map.virt_addr && (x) < (kernel_map.virt_addr + kernel_map.size)) + #define is_linear_mapping(x) \ - ((x) >= PAGE_OFFSET && (x) < kernel_map.virt_addr) + ((x) >= PAGE_OFFSET && (!IS_ENABLED(CONFIG_64BIT) || (x) < kernel_map.virt_addr)) #define linear_mapping_pa_to_va(x) ((void *)((unsigned long)(x) + kernel_map.va_pa_offset)) #define kernel_mapping_pa_to_va(y) ({ \ diff --cc arch/riscv/mm/init.c index 7cb4f391d106f,248f9ec393c12..96e360cf3de07 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@@ -589,16 -594,8 +615,16 @@@ asmlinkage void __init setup_vm(uintptr /* Sanity check alignment and size */ BUG_ON((PAGE_OFFSET % PGDIR_SIZE) != 0); - BUG_ON((kernel_map.phys_addr % map_size) != 0); + BUG_ON((kernel_map.phys_addr % PMD_SIZE) != 0); +#ifdef CONFIG_64BIT + /* + * The last 4K bytes of the addressable memory can not be mapped because + * of IS_ERR_VALUE macro. + */ + BUG_ON((kernel_map.virt_addr + kernel_map.size) > ADDRESS_SPACE_END - SZ_4K); +#endif + pt_ops.alloc_pte = alloc_pte_early; pt_ops.get_pte_virt = get_pte_virt_early; #ifndef __PAGETABLE_PMD_FOLDED