Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'powerpc-5.16-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:
"Fix a recently introduced oops at boot on 85xx in some configurations.

Fix crashes when loading some livepatch modules with
STRICT_MODULE_RWX.

Thanks to Joe Lawrence, Russell Currey, and Xiaoming Ni"

* tag 'powerpc-5.16-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
powerpc/module_64: Fix livepatching for RO modules
powerpc/85xx: Fix oops when CONFIG_FSL_PMC=n

+36 -10
+34 -8
arch/powerpc/kernel/module_64.c
··· 422 422 const char *name) 423 423 { 424 424 long reladdr; 425 + func_desc_t desc; 426 + int i; 425 427 426 428 if (is_mprofile_ftrace_call(name)) 427 429 return create_ftrace_stub(entry, addr, me); 428 430 429 - memcpy(entry->jump, ppc64_stub_insns, sizeof(ppc64_stub_insns)); 431 + for (i = 0; i < sizeof(ppc64_stub_insns) / sizeof(u32); i++) { 432 + if (patch_instruction(&entry->jump[i], 433 + ppc_inst(ppc64_stub_insns[i]))) 434 + return 0; 435 + } 430 436 431 437 /* Stub uses address relative to r2. */ 432 438 reladdr = (unsigned long)entry - my_r2(sechdrs, me); ··· 443 437 } 444 438 pr_debug("Stub %p get data from reladdr %li\n", entry, reladdr); 445 439 446 - entry->jump[0] |= PPC_HA(reladdr); 447 - entry->jump[1] |= PPC_LO(reladdr); 448 - entry->funcdata = func_desc(addr); 449 - entry->magic = STUB_MAGIC; 440 + if (patch_instruction(&entry->jump[0], 441 + ppc_inst(entry->jump[0] | PPC_HA(reladdr)))) 442 + return 0; 443 + 444 + if (patch_instruction(&entry->jump[1], 445 + ppc_inst(entry->jump[1] | PPC_LO(reladdr)))) 446 + return 0; 447 + 448 + // func_desc_t is 8 bytes if ABIv2, else 16 bytes 449 + desc = func_desc(addr); 450 + for (i = 0; i < sizeof(func_desc_t) / sizeof(u32); i++) { 451 + if (patch_instruction(((u32 *)&entry->funcdata) + i, 452 + ppc_inst(((u32 *)(&desc))[i]))) 453 + return 0; 454 + } 455 + 456 + if (patch_instruction(&entry->magic, ppc_inst(STUB_MAGIC))) 457 + return 0; 450 458 451 459 return 1; 452 460 } ··· 515 495 me->name, *instruction, instruction); 516 496 return 0; 517 497 } 498 + 518 499 /* ld r2,R2_STACK_OFFSET(r1) */ 519 - *instruction = PPC_INST_LD_TOC; 500 + if (patch_instruction(instruction, ppc_inst(PPC_INST_LD_TOC))) 501 + return 0; 502 + 520 503 return 1; 521 504 } 522 505 ··· 659 636 } 660 637 661 638 /* Only replace bits 2 through 26 */ 662 - *(uint32_t *)location 663 - = (*(uint32_t *)location & ~0x03fffffc) 639 + value = (*(uint32_t *)location & ~0x03fffffc) 664 640 | (value & 0x03fffffc); 641 + 642 + if (patch_instruction((u32 *)location, ppc_inst(value))) 643 + return -EFAULT; 644 + 665 645 break; 666 646 667 647 case R_PPC64_REL64:
+2 -2
arch/powerpc/platforms/85xx/smp.c
··· 220 220 local_irq_save(flags); 221 221 hard_irq_disable(); 222 222 223 - if (qoriq_pm_ops) 223 + if (qoriq_pm_ops && qoriq_pm_ops->cpu_up_prepare) 224 224 qoriq_pm_ops->cpu_up_prepare(cpu); 225 225 226 226 /* if cpu is not spinning, reset it */ ··· 292 292 booting_thread_hwid = cpu_thread_in_core(nr); 293 293 primary = cpu_first_thread_sibling(nr); 294 294 295 - if (qoriq_pm_ops) 295 + if (qoriq_pm_ops && qoriq_pm_ops->cpu_up_prepare) 296 296 qoriq_pm_ops->cpu_up_prepare(nr); 297 297 298 298 /*