riscv: Move kernel mapping outside of linear mapping
[linux-2.6-microblaze.git] / arch / riscv / kernel / setup.c
index e85bacf..d208abc 100644 (file)
@@ -263,8 +263,13 @@ void __init setup_arch(char **cmdline_p)
 
        sbi_init();
 
-       if (IS_ENABLED(CONFIG_STRICT_KERNEL_RWX))
+       if (IS_ENABLED(CONFIG_STRICT_KERNEL_RWX)) {
                protect_kernel_text_data();
+#if defined(CONFIG_64BIT) && defined(CONFIG_MMU)
+               protect_kernel_linear_mapping_text_rodata();
+#endif
+       }
+
 #ifdef CONFIG_SWIOTLB
        swiotlb_init(1);
 #endif