diff options
-rw-r--r-- | arch/powerpc/include/asm/kup.h | 11 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup_64.c | 7 | ||||
-rw-r--r-- | arch/powerpc/mm/init-common.c | 5 | ||||
-rw-r--r-- | arch/powerpc/mm/init_32.c | 3 |
4 files changed, 26 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/kup.h b/arch/powerpc/include/asm/kup.h new file mode 100644 index 000000000000..7a88b8b9b54d --- /dev/null +++ b/arch/powerpc/include/asm/kup.h | |||
@@ -0,0 +1,11 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
2 | #ifndef _ASM_POWERPC_KUP_H_ | ||
3 | #define _ASM_POWERPC_KUP_H_ | ||
4 | |||
5 | #ifndef __ASSEMBLY__ | ||
6 | |||
7 | void setup_kup(void); | ||
8 | |||
9 | #endif /* !__ASSEMBLY__ */ | ||
10 | |||
11 | #endif /* _ASM_POWERPC_KUP_H_ */ | ||
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index ba404dd9ce1d..6179c4200339 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
@@ -68,6 +68,7 @@ | |||
68 | #include <asm/cputhreads.h> | 68 | #include <asm/cputhreads.h> |
69 | #include <asm/hw_irq.h> | 69 | #include <asm/hw_irq.h> |
70 | #include <asm/feature-fixups.h> | 70 | #include <asm/feature-fixups.h> |
71 | #include <asm/kup.h> | ||
71 | 72 | ||
72 | #include "setup.h" | 73 | #include "setup.h" |
73 | 74 | ||
@@ -331,6 +332,12 @@ void __init early_setup(unsigned long dt_ptr) | |||
331 | */ | 332 | */ |
332 | configure_exceptions(); | 333 | configure_exceptions(); |
333 | 334 | ||
335 | /* | ||
336 | * Configure Kernel Userspace Protection. This needs to happen before | ||
337 | * feature fixups for platforms that implement this using features. | ||
338 | */ | ||
339 | setup_kup(); | ||
340 | |||
334 | /* Apply all the dynamic patching */ | 341 | /* Apply all the dynamic patching */ |
335 | apply_feature_fixups(); | 342 | apply_feature_fixups(); |
336 | setup_feature_keys(); | 343 | setup_feature_keys(); |
diff --git a/arch/powerpc/mm/init-common.c b/arch/powerpc/mm/init-common.c index 1e6910eb70ed..36d28e872289 100644 --- a/arch/powerpc/mm/init-common.c +++ b/arch/powerpc/mm/init-common.c | |||
@@ -24,6 +24,11 @@ | |||
24 | #include <linux/string.h> | 24 | #include <linux/string.h> |
25 | #include <asm/pgalloc.h> | 25 | #include <asm/pgalloc.h> |
26 | #include <asm/pgtable.h> | 26 | #include <asm/pgtable.h> |
27 | #include <asm/kup.h> | ||
28 | |||
29 | void __init setup_kup(void) | ||
30 | { | ||
31 | } | ||
27 | 32 | ||
28 | #define CTOR(shift) static void ctor_##shift(void *addr) \ | 33 | #define CTOR(shift) static void ctor_##shift(void *addr) \ |
29 | { \ | 34 | { \ |
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c index 41a3513cadc9..80cc97cd8878 100644 --- a/arch/powerpc/mm/init_32.c +++ b/arch/powerpc/mm/init_32.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <asm/tlb.h> | 45 | #include <asm/tlb.h> |
46 | #include <asm/sections.h> | 46 | #include <asm/sections.h> |
47 | #include <asm/hugetlb.h> | 47 | #include <asm/hugetlb.h> |
48 | #include <asm/kup.h> | ||
48 | 49 | ||
49 | #include "mmu_decl.h" | 50 | #include "mmu_decl.h" |
50 | 51 | ||
@@ -178,6 +179,8 @@ void __init MMU_init(void) | |||
178 | btext_unmap(); | 179 | btext_unmap(); |
179 | #endif | 180 | #endif |
180 | 181 | ||
182 | setup_kup(); | ||
183 | |||
181 | /* Shortly after that, the entire linear mapping will be available */ | 184 | /* Shortly after that, the entire linear mapping will be available */ |
182 | memblock_set_current_limit(lowmem_end_addr); | 185 | memblock_set_current_limit(lowmem_end_addr); |
183 | } | 186 | } |