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-6.2-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:
"It's a bit of a big batch for rc6, but just because I didn't send any
fixes the last week or two while I was on vacation, next week should
be quieter:

- Fix a few objtool warnings since we recently enabled objtool.

- Fix a deadlock with the hash MMU vs perf record.

- Fix perf profiling of asynchronous interrupt handlers.

- Revert the IMC PMU nest_init_lock to being a mutex.

- Two commits fixing problems with the kexec_file FDT size
estimation.

- Two commits fixing problems with strict RWX vs kernels running at
non-zero.

- Reconnect tlb_flush() to hash__tlb_flush()

Thanks to Kajol Jain, Nicholas Piggin, Sachin Sant Sathvika Vasireddy,
and Sourabh Jain"

* tag 'powerpc-6.2-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
powerpc/64s: Reconnect tlb_flush() to hash__tlb_flush()
powerpc/kexec_file: Count hot-pluggable memory in FDT estimate
powerpc/64s/radix: Fix RWX mapping with relocated kernel
powerpc/64s/radix: Fix crash with unaligned relocated kernel
powerpc/kexec_file: Fix division by zero in extra size estimation
powerpc/imc-pmu: Revert nest_init_lock to being a mutex
powerpc/64: Fix perf profiling asynchronous interrupt handlers
powerpc/64s: Fix local irq disable when PMIs are disabled
powerpc/kvm: Fix unannotated intra-function call warning
powerpc/85xx: Fix unannotated intra-function call warning

+77 -31
+2
arch/powerpc/include/asm/book3s/64/tlbflush.h
··· 97 97 { 98 98 if (radix_enabled()) 99 99 radix__tlb_flush(tlb); 100 + 101 + return hash__tlb_flush(tlb); 100 102 } 101 103 102 104 #ifdef CONFIG_SMP
+30 -13
arch/powerpc/include/asm/hw_irq.h
··· 173 173 return flags; 174 174 } 175 175 176 + static inline notrace unsigned long irq_soft_mask_andc_return(unsigned long mask) 177 + { 178 + unsigned long flags = irq_soft_mask_return(); 179 + 180 + irq_soft_mask_set(flags & ~mask); 181 + 182 + return flags; 183 + } 184 + 176 185 static inline unsigned long arch_local_save_flags(void) 177 186 { 178 187 return irq_soft_mask_return(); ··· 201 192 202 193 static inline unsigned long arch_local_irq_save(void) 203 194 { 204 - return irq_soft_mask_set_return(IRQS_DISABLED); 195 + return irq_soft_mask_or_return(IRQS_DISABLED); 205 196 } 206 197 207 198 static inline bool arch_irqs_disabled_flags(unsigned long flags) ··· 340 331 * is a different soft-masked interrupt pending that requires hard 341 332 * masking. 342 333 */ 343 - static inline bool should_hard_irq_enable(void) 334 + static inline bool should_hard_irq_enable(struct pt_regs *regs) 344 335 { 345 336 if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) { 346 - WARN_ON(irq_soft_mask_return() == IRQS_ENABLED); 337 + WARN_ON(irq_soft_mask_return() != IRQS_ALL_DISABLED); 338 + WARN_ON(!(get_paca()->irq_happened & PACA_IRQ_HARD_DIS)); 347 339 WARN_ON(mfmsr() & MSR_EE); 348 340 } 349 341 ··· 357 347 * 358 348 * TODO: Add test for 64e 359 349 */ 360 - if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && !power_pmu_wants_prompt_pmi()) 361 - return false; 350 + if (IS_ENABLED(CONFIG_PPC_BOOK3S_64)) { 351 + if (!power_pmu_wants_prompt_pmi()) 352 + return false; 353 + /* 354 + * If PMIs are disabled then IRQs should be disabled as well, 355 + * so we shouldn't see this condition, check for it just in 356 + * case because we are about to enable PMIs. 357 + */ 358 + if (WARN_ON_ONCE(regs->softe & IRQS_PMI_DISABLED)) 359 + return false; 360 + } 362 361 363 362 if (get_paca()->irq_happened & PACA_IRQ_MUST_HARD_MASK) 364 363 return false; ··· 377 358 378 359 /* 379 360 * Do the hard enabling, only call this if should_hard_irq_enable is true. 361 + * This allows PMI interrupts to profile irq handlers. 380 362 */ 381 363 static inline void do_hard_irq_enable(void) 382 364 { 383 - if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) { 384 - WARN_ON(irq_soft_mask_return() == IRQS_ENABLED); 385 - WARN_ON(get_paca()->irq_happened & PACA_IRQ_MUST_HARD_MASK); 386 - WARN_ON(mfmsr() & MSR_EE); 387 - } 388 365 /* 389 - * This allows PMI interrupts (and watchdog soft-NMIs) through. 390 - * There is no other reason to enable this way. 366 + * Asynch interrupts come in with IRQS_ALL_DISABLED, 367 + * PACA_IRQ_HARD_DIS, and MSR[EE]=0. 391 368 */ 369 + if (IS_ENABLED(CONFIG_PPC_BOOK3S_64)) 370 + irq_soft_mask_andc_return(IRQS_PMI_DISABLED); 392 371 get_paca()->irq_happened &= ~PACA_IRQ_HARD_DIS; 393 372 __hard_irq_enable(); 394 373 } ··· 469 452 return !(regs->msr & MSR_EE); 470 453 } 471 454 472 - static __always_inline bool should_hard_irq_enable(void) 455 + static __always_inline bool should_hard_irq_enable(struct pt_regs *regs) 473 456 { 474 457 return false; 475 458 }
+1 -1
arch/powerpc/kernel/dbell.c
··· 27 27 28 28 ppc_msgsync(); 29 29 30 - if (should_hard_irq_enable()) 30 + if (should_hard_irq_enable(regs)) 31 31 do_hard_irq_enable(); 32 32 33 33 kvmppc_clear_host_ipi(smp_processor_id());
+2 -1
arch/powerpc/kernel/head_85xx.S
··· 864 864 * SPE unavailable trap from kernel - print a message, but let 865 865 * the task use SPE in the kernel until it returns to user mode. 866 866 */ 867 - KernelSPE: 867 + SYM_FUNC_START_LOCAL(KernelSPE) 868 868 lwz r3,_MSR(r1) 869 869 oris r3,r3,MSR_SPE@h 870 870 stw r3,_MSR(r1) /* enable use of SPE after return */ ··· 881 881 #endif 882 882 .align 4,0 883 883 884 + SYM_FUNC_END(KernelSPE) 884 885 #endif /* CONFIG_SPE */ 885 886 886 887 /*
+1 -1
arch/powerpc/kernel/irq.c
··· 238 238 irq = static_call(ppc_get_irq)(); 239 239 240 240 /* We can hard enable interrupts now to allow perf interrupts */ 241 - if (should_hard_irq_enable()) 241 + if (should_hard_irq_enable(regs)) 242 242 do_hard_irq_enable(); 243 243 244 244 /* And finally process it */
+1 -1
arch/powerpc/kernel/time.c
··· 515 515 } 516 516 517 517 /* Conditionally hard-enable interrupts. */ 518 - if (should_hard_irq_enable()) { 518 + if (should_hard_irq_enable(regs)) { 519 519 /* 520 520 * Ensure a positive value is written to the decrementer, or 521 521 * else some CPUs will continue to take decrementer exceptions.
+7 -4
arch/powerpc/kexec/file_load_64.c
··· 989 989 * linux,drconf-usable-memory properties. Get an approximate on the 990 990 * number of usable memory entries and use for FDT size estimation. 991 991 */ 992 - usm_entries = ((memblock_end_of_DRAM() / drmem_lmb_size()) + 993 - (2 * (resource_size(&crashk_res) / drmem_lmb_size()))); 994 - 995 - extra_size = (unsigned int)(usm_entries * sizeof(u64)); 992 + if (drmem_lmb_size()) { 993 + usm_entries = ((memory_hotplug_max() / drmem_lmb_size()) + 994 + (2 * (resource_size(&crashk_res) / drmem_lmb_size()))); 995 + extra_size = (unsigned int)(usm_entries * sizeof(u64)); 996 + } else { 997 + extra_size = 0; 998 + } 996 999 997 1000 /* 998 1001 * Get the number of CPU nodes in the current DT. This allows to
+2 -3
arch/powerpc/kvm/booke.c
··· 912 912 913 913 static void kvmppc_fill_pt_regs(struct pt_regs *regs) 914 914 { 915 - ulong r1, ip, msr, lr; 915 + ulong r1, msr, lr; 916 916 917 917 asm("mr %0, 1" : "=r"(r1)); 918 918 asm("mflr %0" : "=r"(lr)); 919 919 asm("mfmsr %0" : "=r"(msr)); 920 - asm("bl 1f; 1: mflr %0" : "=r"(ip)); 921 920 922 921 memset(regs, 0, sizeof(*regs)); 923 922 regs->gpr[1] = r1; 924 - regs->nip = ip; 923 + regs->nip = _THIS_IP_; 925 924 regs->msr = msr; 926 925 regs->link = lr; 927 926 }
+24
arch/powerpc/mm/book3s64/radix_pgtable.c
··· 234 234 end = (unsigned long)__end_rodata; 235 235 236 236 radix__change_memory_range(start, end, _PAGE_WRITE); 237 + 238 + for (start = PAGE_OFFSET; start < (unsigned long)_stext; start += PAGE_SIZE) { 239 + end = start + PAGE_SIZE; 240 + if (overlaps_interrupt_vector_text(start, end)) 241 + radix__change_memory_range(start, end, _PAGE_WRITE); 242 + else 243 + break; 244 + } 237 245 } 238 246 239 247 void radix__mark_initmem_nx(void) ··· 270 262 static unsigned long next_boundary(unsigned long addr, unsigned long end) 271 263 { 272 264 #ifdef CONFIG_STRICT_KERNEL_RWX 265 + unsigned long stext_phys; 266 + 267 + stext_phys = __pa_symbol(_stext); 268 + 269 + // Relocatable kernel running at non-zero real address 270 + if (stext_phys != 0) { 271 + // The end of interrupts code at zero is a rodata boundary 272 + unsigned long end_intr = __pa_symbol(__end_interrupts) - stext_phys; 273 + if (addr < end_intr) 274 + return end_intr; 275 + 276 + // Start of relocated kernel text is a rodata boundary 277 + if (addr < stext_phys) 278 + return stext_phys; 279 + } 280 + 273 281 if (addr < __pa_symbol(__srwx_boundary)) 274 282 return __pa_symbol(__srwx_boundary); 275 283 #endif
+7 -7
arch/powerpc/perf/imc-pmu.c
··· 22 22 * Used to avoid races in counting the nest-pmu units during hotplug 23 23 * register and unregister 24 24 */ 25 - static DEFINE_SPINLOCK(nest_init_lock); 25 + static DEFINE_MUTEX(nest_init_lock); 26 26 static DEFINE_PER_CPU(struct imc_pmu_ref *, local_nest_imc_refc); 27 27 static struct imc_pmu **per_nest_pmu_arr; 28 28 static cpumask_t nest_imc_cpumask; ··· 1629 1629 static void imc_common_cpuhp_mem_free(struct imc_pmu *pmu_ptr) 1630 1630 { 1631 1631 if (pmu_ptr->domain == IMC_DOMAIN_NEST) { 1632 - spin_lock(&nest_init_lock); 1632 + mutex_lock(&nest_init_lock); 1633 1633 if (nest_pmus == 1) { 1634 1634 cpuhp_remove_state(CPUHP_AP_PERF_POWERPC_NEST_IMC_ONLINE); 1635 1635 kfree(nest_imc_refc); ··· 1639 1639 1640 1640 if (nest_pmus > 0) 1641 1641 nest_pmus--; 1642 - spin_unlock(&nest_init_lock); 1642 + mutex_unlock(&nest_init_lock); 1643 1643 } 1644 1644 1645 1645 /* Free core_imc memory */ ··· 1796 1796 * rest. To handle the cpuhotplug callback unregister, we track 1797 1797 * the number of nest pmus in "nest_pmus". 1798 1798 */ 1799 - spin_lock(&nest_init_lock); 1799 + mutex_lock(&nest_init_lock); 1800 1800 if (nest_pmus == 0) { 1801 1801 ret = init_nest_pmu_ref(); 1802 1802 if (ret) { 1803 - spin_unlock(&nest_init_lock); 1803 + mutex_unlock(&nest_init_lock); 1804 1804 kfree(per_nest_pmu_arr); 1805 1805 per_nest_pmu_arr = NULL; 1806 1806 goto err_free_mem; ··· 1808 1808 /* Register for cpu hotplug notification. */ 1809 1809 ret = nest_pmu_cpumask_init(); 1810 1810 if (ret) { 1811 - spin_unlock(&nest_init_lock); 1811 + mutex_unlock(&nest_init_lock); 1812 1812 kfree(nest_imc_refc); 1813 1813 kfree(per_nest_pmu_arr); 1814 1814 per_nest_pmu_arr = NULL; ··· 1816 1816 } 1817 1817 } 1818 1818 nest_pmus++; 1819 - spin_unlock(&nest_init_lock); 1819 + mutex_unlock(&nest_init_lock); 1820 1820 break; 1821 1821 case IMC_DOMAIN_CORE: 1822 1822 ret = core_imc_pmu_cpumask_init();