diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-08-04 13:30:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-08-04 13:30:47 -0400 |
commit | 4b6f23161b4e888e72671e377c32eabe9a8e62fc (patch) | |
tree | 02bc9ce1e9ab4c304a5db917876182696a8c866e | |
parent | 4c0d228c3bd498b3119d68eb41a17880f7728993 (diff) | |
parent | d7e23b887f67178c4f840781be7a6aa6aeb52ab1 (diff) |
Merge tag 'powerpc-5.3-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman:
"Some more powerpc fixes for 5.3:
- Wire up the new clone3 syscall.
- A fix for the PAPR SCM nvdimm driver, to fix a crash when firmware
gives us a device that's attached to a non-online NUMA node.
- A fix for a boot failure on 32-bit with KASAN enabled.
- Three fixes for implicit fall through warnings, some of which are
errors for us due to -Werror.
Thanks to: Aneesh Kumar K.V, Christophe Leroy, Kees Cook, Santosh
Sivaraj, Stephen Rothwell"
* tag 'powerpc-5.3-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
powerpc/kasan: fix early boot failure on PPC32
drivers/macintosh/smu.c: Mark expected switch fall-through
powerpc/spe: Mark expected switch fall-throughs
powerpc/nvdimm: Pick nearby online node if the device node is not online
powerpc/kvm: Fall through switch case explicitly
powerpc: Wire up clone3 syscall
-rw-r--r-- | arch/powerpc/include/asm/unistd.h | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/align.c | 4 | ||||
-rw-r--r-- | arch/powerpc/kernel/entry_32.S | 8 | ||||
-rw-r--r-- | arch/powerpc/kernel/entry_64.S | 5 | ||||
-rw-r--r-- | arch/powerpc/kernel/syscalls/syscall.tbl | 2 | ||||
-rw-r--r-- | arch/powerpc/kvm/book3s_32_mmu.c | 1 | ||||
-rw-r--r-- | arch/powerpc/mm/kasan/kasan_init_32.c | 7 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/papr_scm.c | 29 | ||||
-rw-r--r-- | drivers/macintosh/smu.c | 1 |
9 files changed, 53 insertions, 5 deletions
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h index 68473c3c471c..b0720c7c3fcf 100644 --- a/arch/powerpc/include/asm/unistd.h +++ b/arch/powerpc/include/asm/unistd.h | |||
@@ -49,6 +49,7 @@ | |||
49 | #define __ARCH_WANT_SYS_FORK | 49 | #define __ARCH_WANT_SYS_FORK |
50 | #define __ARCH_WANT_SYS_VFORK | 50 | #define __ARCH_WANT_SYS_VFORK |
51 | #define __ARCH_WANT_SYS_CLONE | 51 | #define __ARCH_WANT_SYS_CLONE |
52 | #define __ARCH_WANT_SYS_CLONE3 | ||
52 | 53 | ||
53 | #endif /* __ASSEMBLY__ */ | 54 | #endif /* __ASSEMBLY__ */ |
54 | #endif /* _ASM_POWERPC_UNISTD_H_ */ | 55 | #endif /* _ASM_POWERPC_UNISTD_H_ */ |
diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c index 7107ad86de65..92045ed64976 100644 --- a/arch/powerpc/kernel/align.c +++ b/arch/powerpc/kernel/align.c | |||
@@ -176,9 +176,11 @@ static int emulate_spe(struct pt_regs *regs, unsigned int reg, | |||
176 | ret |= __get_user_inatomic(temp.v[1], p++); | 176 | ret |= __get_user_inatomic(temp.v[1], p++); |
177 | ret |= __get_user_inatomic(temp.v[2], p++); | 177 | ret |= __get_user_inatomic(temp.v[2], p++); |
178 | ret |= __get_user_inatomic(temp.v[3], p++); | 178 | ret |= __get_user_inatomic(temp.v[3], p++); |
179 | /* fall through */ | ||
179 | case 4: | 180 | case 4: |
180 | ret |= __get_user_inatomic(temp.v[4], p++); | 181 | ret |= __get_user_inatomic(temp.v[4], p++); |
181 | ret |= __get_user_inatomic(temp.v[5], p++); | 182 | ret |= __get_user_inatomic(temp.v[5], p++); |
183 | /* fall through */ | ||
182 | case 2: | 184 | case 2: |
183 | ret |= __get_user_inatomic(temp.v[6], p++); | 185 | ret |= __get_user_inatomic(temp.v[6], p++); |
184 | ret |= __get_user_inatomic(temp.v[7], p++); | 186 | ret |= __get_user_inatomic(temp.v[7], p++); |
@@ -259,9 +261,11 @@ static int emulate_spe(struct pt_regs *regs, unsigned int reg, | |||
259 | ret |= __put_user_inatomic(data.v[1], p++); | 261 | ret |= __put_user_inatomic(data.v[1], p++); |
260 | ret |= __put_user_inatomic(data.v[2], p++); | 262 | ret |= __put_user_inatomic(data.v[2], p++); |
261 | ret |= __put_user_inatomic(data.v[3], p++); | 263 | ret |= __put_user_inatomic(data.v[3], p++); |
264 | /* fall through */ | ||
262 | case 4: | 265 | case 4: |
263 | ret |= __put_user_inatomic(data.v[4], p++); | 266 | ret |= __put_user_inatomic(data.v[4], p++); |
264 | ret |= __put_user_inatomic(data.v[5], p++); | 267 | ret |= __put_user_inatomic(data.v[5], p++); |
268 | /* fall through */ | ||
265 | case 2: | 269 | case 2: |
266 | ret |= __put_user_inatomic(data.v[6], p++); | 270 | ret |= __put_user_inatomic(data.v[6], p++); |
267 | ret |= __put_user_inatomic(data.v[7], p++); | 271 | ret |= __put_user_inatomic(data.v[7], p++); |
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index 85fdb6d879f1..54fab22c9a43 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S | |||
@@ -597,6 +597,14 @@ ppc_clone: | |||
597 | stw r0,_TRAP(r1) /* register set saved */ | 597 | stw r0,_TRAP(r1) /* register set saved */ |
598 | b sys_clone | 598 | b sys_clone |
599 | 599 | ||
600 | .globl ppc_clone3 | ||
601 | ppc_clone3: | ||
602 | SAVE_NVGPRS(r1) | ||
603 | lwz r0,_TRAP(r1) | ||
604 | rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */ | ||
605 | stw r0,_TRAP(r1) /* register set saved */ | ||
606 | b sys_clone3 | ||
607 | |||
600 | .globl ppc_swapcontext | 608 | .globl ppc_swapcontext |
601 | ppc_swapcontext: | 609 | ppc_swapcontext: |
602 | SAVE_NVGPRS(r1) | 610 | SAVE_NVGPRS(r1) |
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index d9105fcf4021..0a0b5310f54a 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
@@ -487,6 +487,11 @@ _GLOBAL(ppc_clone) | |||
487 | bl sys_clone | 487 | bl sys_clone |
488 | b .Lsyscall_exit | 488 | b .Lsyscall_exit |
489 | 489 | ||
490 | _GLOBAL(ppc_clone3) | ||
491 | bl save_nvgprs | ||
492 | bl sys_clone3 | ||
493 | b .Lsyscall_exit | ||
494 | |||
490 | _GLOBAL(ppc32_swapcontext) | 495 | _GLOBAL(ppc32_swapcontext) |
491 | bl save_nvgprs | 496 | bl save_nvgprs |
492 | bl compat_sys_swapcontext | 497 | bl compat_sys_swapcontext |
diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl index 3331749aab20..43f736ed47f2 100644 --- a/arch/powerpc/kernel/syscalls/syscall.tbl +++ b/arch/powerpc/kernel/syscalls/syscall.tbl | |||
@@ -516,4 +516,4 @@ | |||
516 | 432 common fsmount sys_fsmount | 516 | 432 common fsmount sys_fsmount |
517 | 433 common fspick sys_fspick | 517 | 433 common fspick sys_fspick |
518 | 434 common pidfd_open sys_pidfd_open | 518 | 434 common pidfd_open sys_pidfd_open |
519 | # 435 reserved for clone3 | 519 | 435 nospu clone3 ppc_clone3 |
diff --git a/arch/powerpc/kvm/book3s_32_mmu.c b/arch/powerpc/kvm/book3s_32_mmu.c index 653936177857..18f244aad7aa 100644 --- a/arch/powerpc/kvm/book3s_32_mmu.c +++ b/arch/powerpc/kvm/book3s_32_mmu.c | |||
@@ -239,6 +239,7 @@ static int kvmppc_mmu_book3s_32_xlate_pte(struct kvm_vcpu *vcpu, gva_t eaddr, | |||
239 | case 2: | 239 | case 2: |
240 | case 6: | 240 | case 6: |
241 | pte->may_write = true; | 241 | pte->may_write = true; |
242 | /* fall through */ | ||
242 | case 3: | 243 | case 3: |
243 | case 5: | 244 | case 5: |
244 | case 7: | 245 | case 7: |
diff --git a/arch/powerpc/mm/kasan/kasan_init_32.c b/arch/powerpc/mm/kasan/kasan_init_32.c index 0d62be3cba47..74f4555a62ba 100644 --- a/arch/powerpc/mm/kasan/kasan_init_32.c +++ b/arch/powerpc/mm/kasan/kasan_init_32.c | |||
@@ -21,7 +21,7 @@ static void kasan_populate_pte(pte_t *ptep, pgprot_t prot) | |||
21 | __set_pte_at(&init_mm, va, ptep, pfn_pte(PHYS_PFN(pa), prot), 0); | 21 | __set_pte_at(&init_mm, va, ptep, pfn_pte(PHYS_PFN(pa), prot), 0); |
22 | } | 22 | } |
23 | 23 | ||
24 | static int kasan_init_shadow_page_tables(unsigned long k_start, unsigned long k_end) | 24 | static int __ref kasan_init_shadow_page_tables(unsigned long k_start, unsigned long k_end) |
25 | { | 25 | { |
26 | pmd_t *pmd; | 26 | pmd_t *pmd; |
27 | unsigned long k_cur, k_next; | 27 | unsigned long k_cur, k_next; |
@@ -35,7 +35,10 @@ static int kasan_init_shadow_page_tables(unsigned long k_start, unsigned long k_ | |||
35 | if ((void *)pmd_page_vaddr(*pmd) != kasan_early_shadow_pte) | 35 | if ((void *)pmd_page_vaddr(*pmd) != kasan_early_shadow_pte) |
36 | continue; | 36 | continue; |
37 | 37 | ||
38 | new = pte_alloc_one_kernel(&init_mm); | 38 | if (slab_is_available()) |
39 | new = pte_alloc_one_kernel(&init_mm); | ||
40 | else | ||
41 | new = memblock_alloc(PTE_FRAG_SIZE, PTE_FRAG_SIZE); | ||
39 | 42 | ||
40 | if (!new) | 43 | if (!new) |
41 | return -ENOMEM; | 44 | return -ENOMEM; |
diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c index 2c07908359b2..a5ac371a3f06 100644 --- a/arch/powerpc/platforms/pseries/papr_scm.c +++ b/arch/powerpc/platforms/pseries/papr_scm.c | |||
@@ -275,12 +275,32 @@ static const struct attribute_group *papr_scm_dimm_groups[] = { | |||
275 | NULL, | 275 | NULL, |
276 | }; | 276 | }; |
277 | 277 | ||
278 | static inline int papr_scm_node(int node) | ||
279 | { | ||
280 | int min_dist = INT_MAX, dist; | ||
281 | int nid, min_node; | ||
282 | |||
283 | if ((node == NUMA_NO_NODE) || node_online(node)) | ||
284 | return node; | ||
285 | |||
286 | min_node = first_online_node; | ||
287 | for_each_online_node(nid) { | ||
288 | dist = node_distance(node, nid); | ||
289 | if (dist < min_dist) { | ||
290 | min_dist = dist; | ||
291 | min_node = nid; | ||
292 | } | ||
293 | } | ||
294 | return min_node; | ||
295 | } | ||
296 | |||
278 | static int papr_scm_nvdimm_init(struct papr_scm_priv *p) | 297 | static int papr_scm_nvdimm_init(struct papr_scm_priv *p) |
279 | { | 298 | { |
280 | struct device *dev = &p->pdev->dev; | 299 | struct device *dev = &p->pdev->dev; |
281 | struct nd_mapping_desc mapping; | 300 | struct nd_mapping_desc mapping; |
282 | struct nd_region_desc ndr_desc; | 301 | struct nd_region_desc ndr_desc; |
283 | unsigned long dimm_flags; | 302 | unsigned long dimm_flags; |
303 | int target_nid, online_nid; | ||
284 | 304 | ||
285 | p->bus_desc.ndctl = papr_scm_ndctl; | 305 | p->bus_desc.ndctl = papr_scm_ndctl; |
286 | p->bus_desc.module = THIS_MODULE; | 306 | p->bus_desc.module = THIS_MODULE; |
@@ -319,8 +339,10 @@ static int papr_scm_nvdimm_init(struct papr_scm_priv *p) | |||
319 | 339 | ||
320 | memset(&ndr_desc, 0, sizeof(ndr_desc)); | 340 | memset(&ndr_desc, 0, sizeof(ndr_desc)); |
321 | ndr_desc.attr_groups = region_attr_groups; | 341 | ndr_desc.attr_groups = region_attr_groups; |
322 | ndr_desc.numa_node = dev_to_node(&p->pdev->dev); | 342 | target_nid = dev_to_node(&p->pdev->dev); |
323 | ndr_desc.target_node = ndr_desc.numa_node; | 343 | online_nid = papr_scm_node(target_nid); |
344 | ndr_desc.numa_node = online_nid; | ||
345 | ndr_desc.target_node = target_nid; | ||
324 | ndr_desc.res = &p->res; | 346 | ndr_desc.res = &p->res; |
325 | ndr_desc.of_node = p->dn; | 347 | ndr_desc.of_node = p->dn; |
326 | ndr_desc.provider_data = p; | 348 | ndr_desc.provider_data = p; |
@@ -338,6 +360,9 @@ static int papr_scm_nvdimm_init(struct papr_scm_priv *p) | |||
338 | ndr_desc.res, p->dn); | 360 | ndr_desc.res, p->dn); |
339 | goto err; | 361 | goto err; |
340 | } | 362 | } |
363 | if (target_nid != online_nid) | ||
364 | dev_info(dev, "Region registered with target node %d and online node %d", | ||
365 | target_nid, online_nid); | ||
341 | 366 | ||
342 | return 0; | 367 | return 0; |
343 | 368 | ||
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c index 276065c888bc..23f1f41c8602 100644 --- a/drivers/macintosh/smu.c +++ b/drivers/macintosh/smu.c | |||
@@ -852,6 +852,7 @@ int smu_queue_i2c(struct smu_i2c_cmd *cmd) | |||
852 | break; | 852 | break; |
853 | case SMU_I2C_TRANSFER_COMBINED: | 853 | case SMU_I2C_TRANSFER_COMBINED: |
854 | cmd->info.devaddr &= 0xfe; | 854 | cmd->info.devaddr &= 0xfe; |
855 | /* fall through */ | ||
855 | case SMU_I2C_TRANSFER_STDSUB: | 856 | case SMU_I2C_TRANSFER_STDSUB: |
856 | if (cmd->info.sublen > 3) | 857 | if (cmd->info.sublen > 3) |
857 | return -EINVAL; | 858 | return -EINVAL; |