diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-11-26 14:24:03 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-11-26 14:24:03 -0500 |
commit | 39c1573748166b348117d6bf161ceffce90e734f (patch) | |
tree | f766298511a9978e79f69d84e94e6b1ce8259429 | |
parent | 3ad0e83cf86bcaeb6ca3c37060a3ce866b25fb42 (diff) | |
parent | 984d7a1ec67ce3a46324fa4bcb4c745bbc266cf2 (diff) |
Merge tag 'powerpc-4.9-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman:
"Fixes marked for stable:
- Set missing wakeup bit in LPCR on POWER9
- Fix the early OPAL console wrappers
- Fixup kernel read only mapping
Fixes for code merged this cycle:
- Fix missing CRCs, add more asm-prototypes.h declarations"
* tag 'powerpc-4.9-6' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
powerpc/mm: Fixup kernel read only mapping
powerpc/boot: Fix the early OPAL console wrappers
powerpc: Fix missing CRCs, add more asm-prototypes.h declarations
powerpc: Set missing wakeup bit in LPCR on POWER9
-rw-r--r-- | arch/powerpc/boot/main.c | 8 | ||||
-rw-r--r-- | arch/powerpc/boot/opal-calls.S | 13 | ||||
-rw-r--r-- | arch/powerpc/boot/opal.c | 11 | ||||
-rw-r--r-- | arch/powerpc/boot/ops.h | 1 | ||||
-rw-r--r-- | arch/powerpc/include/asm/asm-prototypes.h | 12 | ||||
-rw-r--r-- | arch/powerpc/include/asm/mmu.h | 14 | ||||
-rw-r--r-- | arch/powerpc/include/asm/reg.h | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/cpu_setup_power.S | 8 | ||||
-rw-r--r-- | arch/powerpc/mm/hash_utils_64.c | 8 |
9 files changed, 64 insertions, 12 deletions
diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c index 57d42d129033..78aaf4ffd7ab 100644 --- a/arch/powerpc/boot/main.c +++ b/arch/powerpc/boot/main.c | |||
@@ -232,8 +232,12 @@ void start(void) | |||
232 | console_ops.close(); | 232 | console_ops.close(); |
233 | 233 | ||
234 | kentry = (kernel_entry_t) vmlinux.addr; | 234 | kentry = (kernel_entry_t) vmlinux.addr; |
235 | if (ft_addr) | 235 | if (ft_addr) { |
236 | kentry(ft_addr, 0, NULL); | 236 | if(platform_ops.kentry) |
237 | platform_ops.kentry(ft_addr, vmlinux.addr); | ||
238 | else | ||
239 | kentry(ft_addr, 0, NULL); | ||
240 | } | ||
237 | else | 241 | else |
238 | kentry((unsigned long)initrd.addr, initrd.size, | 242 | kentry((unsigned long)initrd.addr, initrd.size, |
239 | loader_info.promptr); | 243 | loader_info.promptr); |
diff --git a/arch/powerpc/boot/opal-calls.S b/arch/powerpc/boot/opal-calls.S index ff2f1b97bc53..2a99fc9a3ccf 100644 --- a/arch/powerpc/boot/opal-calls.S +++ b/arch/powerpc/boot/opal-calls.S | |||
@@ -12,6 +12,19 @@ | |||
12 | 12 | ||
13 | .text | 13 | .text |
14 | 14 | ||
15 | .globl opal_kentry | ||
16 | opal_kentry: | ||
17 | /* r3 is the fdt ptr */ | ||
18 | mtctr r4 | ||
19 | li r4, 0 | ||
20 | li r5, 0 | ||
21 | li r6, 0 | ||
22 | li r7, 0 | ||
23 | ld r11,opal@got(r2) | ||
24 | ld r8,0(r11) | ||
25 | ld r9,8(r11) | ||
26 | bctr | ||
27 | |||
15 | #define OPAL_CALL(name, token) \ | 28 | #define OPAL_CALL(name, token) \ |
16 | .globl name; \ | 29 | .globl name; \ |
17 | name: \ | 30 | name: \ |
diff --git a/arch/powerpc/boot/opal.c b/arch/powerpc/boot/opal.c index 1f37e1c1d6d8..d7b4fd47eb44 100644 --- a/arch/powerpc/boot/opal.c +++ b/arch/powerpc/boot/opal.c | |||
@@ -23,14 +23,25 @@ struct opal { | |||
23 | 23 | ||
24 | static u32 opal_con_id; | 24 | static u32 opal_con_id; |
25 | 25 | ||
26 | /* see opal-wrappers.S */ | ||
26 | int64_t opal_console_write(int64_t term_number, u64 *length, const u8 *buffer); | 27 | int64_t opal_console_write(int64_t term_number, u64 *length, const u8 *buffer); |
27 | int64_t opal_console_read(int64_t term_number, uint64_t *length, u8 *buffer); | 28 | int64_t opal_console_read(int64_t term_number, uint64_t *length, u8 *buffer); |
28 | int64_t opal_console_write_buffer_space(uint64_t term_number, uint64_t *length); | 29 | int64_t opal_console_write_buffer_space(uint64_t term_number, uint64_t *length); |
29 | int64_t opal_console_flush(uint64_t term_number); | 30 | int64_t opal_console_flush(uint64_t term_number); |
30 | int64_t opal_poll_events(uint64_t *outstanding_event_mask); | 31 | int64_t opal_poll_events(uint64_t *outstanding_event_mask); |
31 | 32 | ||
33 | void opal_kentry(unsigned long fdt_addr, void *vmlinux_addr); | ||
34 | |||
32 | static int opal_con_open(void) | 35 | static int opal_con_open(void) |
33 | { | 36 | { |
37 | /* | ||
38 | * When OPAL loads the boot kernel it stashes the OPAL base and entry | ||
39 | * address in r8 and r9 so the kernel can use the OPAL console | ||
40 | * before unflattening the devicetree. While executing the wrapper will | ||
41 | * probably trash r8 and r9 so this kentry hook restores them before | ||
42 | * entering the decompressed kernel. | ||
43 | */ | ||
44 | platform_ops.kentry = opal_kentry; | ||
34 | return 0; | 45 | return 0; |
35 | } | 46 | } |
36 | 47 | ||
diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h index 309d1b127e96..fad1862f4b2d 100644 --- a/arch/powerpc/boot/ops.h +++ b/arch/powerpc/boot/ops.h | |||
@@ -30,6 +30,7 @@ struct platform_ops { | |||
30 | void * (*realloc)(void *ptr, unsigned long size); | 30 | void * (*realloc)(void *ptr, unsigned long size); |
31 | void (*exit)(void); | 31 | void (*exit)(void); |
32 | void * (*vmlinux_alloc)(unsigned long size); | 32 | void * (*vmlinux_alloc)(unsigned long size); |
33 | void (*kentry)(unsigned long fdt_addr, void *vmlinux_addr); | ||
33 | }; | 34 | }; |
34 | extern struct platform_ops platform_ops; | 35 | extern struct platform_ops platform_ops; |
35 | 36 | ||
diff --git a/arch/powerpc/include/asm/asm-prototypes.h b/arch/powerpc/include/asm/asm-prototypes.h index d1492736d852..e0baba1535e6 100644 --- a/arch/powerpc/include/asm/asm-prototypes.h +++ b/arch/powerpc/include/asm/asm-prototypes.h | |||
@@ -14,6 +14,10 @@ | |||
14 | 14 | ||
15 | #include <linux/threads.h> | 15 | #include <linux/threads.h> |
16 | #include <linux/kprobes.h> | 16 | #include <linux/kprobes.h> |
17 | #include <asm/cacheflush.h> | ||
18 | #include <asm/checksum.h> | ||
19 | #include <asm/uaccess.h> | ||
20 | #include <asm/epapr_hcalls.h> | ||
17 | 21 | ||
18 | #include <uapi/asm/ucontext.h> | 22 | #include <uapi/asm/ucontext.h> |
19 | 23 | ||
@@ -109,4 +113,12 @@ void early_setup_secondary(void); | |||
109 | /* time */ | 113 | /* time */ |
110 | void accumulate_stolen_time(void); | 114 | void accumulate_stolen_time(void); |
111 | 115 | ||
116 | /* misc runtime */ | ||
117 | extern u64 __bswapdi2(u64); | ||
118 | extern s64 __lshrdi3(s64, int); | ||
119 | extern s64 __ashldi3(s64, int); | ||
120 | extern s64 __ashrdi3(s64, int); | ||
121 | extern int __cmpdi2(s64, s64); | ||
122 | extern int __ucmpdi2(u64, u64); | ||
123 | |||
112 | #endif /* _ASM_POWERPC_ASM_PROTOTYPES_H */ | 124 | #endif /* _ASM_POWERPC_ASM_PROTOTYPES_H */ |
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h index e88368354e49..e311c25751a4 100644 --- a/arch/powerpc/include/asm/mmu.h +++ b/arch/powerpc/include/asm/mmu.h | |||
@@ -29,6 +29,12 @@ | |||
29 | */ | 29 | */ |
30 | 30 | ||
31 | /* | 31 | /* |
32 | * Kernel read only support. | ||
33 | * We added the ppp value 0b110 in ISA 2.04. | ||
34 | */ | ||
35 | #define MMU_FTR_KERNEL_RO ASM_CONST(0x00004000) | ||
36 | |||
37 | /* | ||
32 | * We need to clear top 16bits of va (from the remaining 64 bits )in | 38 | * We need to clear top 16bits of va (from the remaining 64 bits )in |
33 | * tlbie* instructions | 39 | * tlbie* instructions |
34 | */ | 40 | */ |
@@ -103,10 +109,10 @@ | |||
103 | #define MMU_FTRS_POWER4 MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | 109 | #define MMU_FTRS_POWER4 MMU_FTRS_DEFAULT_HPTE_ARCH_V2 |
104 | #define MMU_FTRS_PPC970 MMU_FTRS_POWER4 | MMU_FTR_TLBIE_CROP_VA | 110 | #define MMU_FTRS_PPC970 MMU_FTRS_POWER4 | MMU_FTR_TLBIE_CROP_VA |
105 | #define MMU_FTRS_POWER5 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE | 111 | #define MMU_FTRS_POWER5 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE |
106 | #define MMU_FTRS_POWER6 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE | 112 | #define MMU_FTRS_POWER6 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE | MMU_FTR_KERNEL_RO |
107 | #define MMU_FTRS_POWER7 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE | 113 | #define MMU_FTRS_POWER7 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE | MMU_FTR_KERNEL_RO |
108 | #define MMU_FTRS_POWER8 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE | 114 | #define MMU_FTRS_POWER8 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE | MMU_FTR_KERNEL_RO |
109 | #define MMU_FTRS_POWER9 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE | 115 | #define MMU_FTRS_POWER9 MMU_FTRS_POWER4 | MMU_FTR_LOCKLESS_TLBIE | MMU_FTR_KERNEL_RO |
110 | #define MMU_FTRS_CELL MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \ | 116 | #define MMU_FTRS_CELL MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \ |
111 | MMU_FTR_CI_LARGE_PAGE | 117 | MMU_FTR_CI_LARGE_PAGE |
112 | #define MMU_FTRS_PA6T MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \ | 118 | #define MMU_FTRS_PA6T MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \ |
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index 9cd4e8cbc78c..9e1499f98def 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h | |||
@@ -355,6 +355,7 @@ | |||
355 | #define LPCR_PECE0 ASM_CONST(0x0000000000004000) /* ext. exceptions can cause exit */ | 355 | #define LPCR_PECE0 ASM_CONST(0x0000000000004000) /* ext. exceptions can cause exit */ |
356 | #define LPCR_PECE1 ASM_CONST(0x0000000000002000) /* decrementer can cause exit */ | 356 | #define LPCR_PECE1 ASM_CONST(0x0000000000002000) /* decrementer can cause exit */ |
357 | #define LPCR_PECE2 ASM_CONST(0x0000000000001000) /* machine check etc can cause exit */ | 357 | #define LPCR_PECE2 ASM_CONST(0x0000000000001000) /* machine check etc can cause exit */ |
358 | #define LPCR_PECE_HVEE ASM_CONST(0x0000400000000000) /* P9 Wakeup on HV interrupts */ | ||
358 | #define LPCR_MER ASM_CONST(0x0000000000000800) /* Mediated External Exception */ | 359 | #define LPCR_MER ASM_CONST(0x0000000000000800) /* Mediated External Exception */ |
359 | #define LPCR_MER_SH 11 | 360 | #define LPCR_MER_SH 11 |
360 | #define LPCR_TC ASM_CONST(0x0000000000000200) /* Translation control */ | 361 | #define LPCR_TC ASM_CONST(0x0000000000000200) /* Translation control */ |
diff --git a/arch/powerpc/kernel/cpu_setup_power.S b/arch/powerpc/kernel/cpu_setup_power.S index 52ff3f025437..37c027ca83b2 100644 --- a/arch/powerpc/kernel/cpu_setup_power.S +++ b/arch/powerpc/kernel/cpu_setup_power.S | |||
@@ -98,8 +98,8 @@ _GLOBAL(__setup_cpu_power9) | |||
98 | li r0,0 | 98 | li r0,0 |
99 | mtspr SPRN_LPID,r0 | 99 | mtspr SPRN_LPID,r0 |
100 | mfspr r3,SPRN_LPCR | 100 | mfspr r3,SPRN_LPCR |
101 | ori r3, r3, LPCR_PECEDH | 101 | LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE) |
102 | ori r3, r3, LPCR_HVICE | 102 | or r3, r3, r4 |
103 | bl __init_LPCR | 103 | bl __init_LPCR |
104 | bl __init_HFSCR | 104 | bl __init_HFSCR |
105 | bl __init_tlb_power9 | 105 | bl __init_tlb_power9 |
@@ -118,8 +118,8 @@ _GLOBAL(__restore_cpu_power9) | |||
118 | li r0,0 | 118 | li r0,0 |
119 | mtspr SPRN_LPID,r0 | 119 | mtspr SPRN_LPID,r0 |
120 | mfspr r3,SPRN_LPCR | 120 | mfspr r3,SPRN_LPCR |
121 | ori r3, r3, LPCR_PECEDH | 121 | LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE) |
122 | ori r3, r3, LPCR_HVICE | 122 | or r3, r3, r4 |
123 | bl __init_LPCR | 123 | bl __init_LPCR |
124 | bl __init_HFSCR | 124 | bl __init_HFSCR |
125 | bl __init_tlb_power9 | 125 | bl __init_tlb_power9 |
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index 5503078090cd..78dabf065ba9 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c | |||
@@ -193,8 +193,12 @@ unsigned long htab_convert_pte_flags(unsigned long pteflags) | |||
193 | /* | 193 | /* |
194 | * Kernel read only mapped with ppp bits 0b110 | 194 | * Kernel read only mapped with ppp bits 0b110 |
195 | */ | 195 | */ |
196 | if (!(pteflags & _PAGE_WRITE)) | 196 | if (!(pteflags & _PAGE_WRITE)) { |
197 | rflags |= (HPTE_R_PP0 | 0x2); | 197 | if (mmu_has_feature(MMU_FTR_KERNEL_RO)) |
198 | rflags |= (HPTE_R_PP0 | 0x2); | ||
199 | else | ||
200 | rflags |= 0x3; | ||
201 | } | ||
198 | } else { | 202 | } else { |
199 | if (pteflags & _PAGE_RWX) | 203 | if (pteflags & _PAGE_RWX) |
200 | rflags |= 0x2; | 204 | rflags |= 0x2; |