powerpc: introduce kernstart_virt_addr to store the kernel base
authorJason Yan <yanaijie@huawei.com>
Fri, 20 Sep 2019 09:45:37 +0000 (17:45 +0800)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 13 Nov 2019 08:27:32 +0000 (19:27 +1100)
Now the kernel base is a fixed value - KERNELBASE. To support KASLR, we
need a variable to store the kernel base.

Signed-off-by: Jason Yan <yanaijie@huawei.com>
Reviewed-by: Christophe Leroy <christophe.leroy@c-s.fr>
Reviewed-by: Diana Craciun <diana.craciun@nxp.com>
Tested-by: Diana Craciun <diana.craciun@nxp.com>
Signed-off-by: Scott Wood <oss@buserror.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/page.h
arch/powerpc/mm/init-common.c

index c8bb14ff47135d7913c2392f10ff5b96d2c2a19d..88fa53f89f5a5f290ae2a9353d81c0302762e5c4 100644 (file)
@@ -325,6 +325,8 @@ void arch_free_page(struct page *page, int order);
 
 struct vm_area_struct;
 
+extern unsigned long kernstart_virt_addr;
+
 #include <asm-generic/memory_model.h>
 #endif /* __ASSEMBLY__ */
 #include <asm/slice.h>
index e223da482c0c35b02df1bd6e76420db1fa0c6553..42ef7a6e6098031895cef189b9b5ee91caa91815 100644 (file)
@@ -25,6 +25,8 @@ phys_addr_t memstart_addr __ro_after_init = (phys_addr_t)~0ull;
 EXPORT_SYMBOL_GPL(memstart_addr);
 phys_addr_t kernstart_addr __ro_after_init;
 EXPORT_SYMBOL_GPL(kernstart_addr);
+unsigned long kernstart_virt_addr __ro_after_init = KERNELBASE;
+EXPORT_SYMBOL_GPL(kernstart_virt_addr);
 
 static bool disable_kuep = !IS_ENABLED(CONFIG_PPC_KUEP);
 static bool disable_kuap = !IS_ENABLED(CONFIG_PPC_KUAP);