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

Pull powerpc fixes from Michael Ellerman:

- Fix a bad interaction between the scv handling and the fallback L1D
flush, which could lead to user register corruption. Only affects
people using scv (~no one) on machines with old firmware that are
missing the L1D flush.

- Two small selftest fixes.

Thanks to Eirik Fuller, Libor Pechacek, Nicholas Piggin, Sandipan Das,
and Tulio Magno Quites Machado Filho.

* tag 'powerpc-5.11-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
powerpc/64s: fix scv entry fallback flush vs interrupt
selftests/powerpc: Only test lwm/stmw on big endian
selftests/powerpc: Fix exit status of pkey tests

+77 -7
+13
arch/powerpc/include/asm/exception-64s.h
··· 63 63 nop; \ 64 64 nop; 65 65 66 + #define SCV_ENTRY_FLUSH_SLOT \ 67 + SCV_ENTRY_FLUSH_FIXUP_SECTION; \ 68 + nop; \ 69 + nop; \ 70 + nop; 71 + 66 72 /* 67 73 * r10 must be free to use, r13 must be paca 68 74 */ 69 75 #define INTERRUPT_TO_KERNEL \ 70 76 STF_ENTRY_BARRIER_SLOT; \ 71 77 ENTRY_FLUSH_SLOT 78 + 79 + /* 80 + * r10, ctr must be free to use, r13 must be paca 81 + */ 82 + #define SCV_INTERRUPT_TO_KERNEL \ 83 + STF_ENTRY_BARRIER_SLOT; \ 84 + SCV_ENTRY_FLUSH_SLOT 72 85 73 86 /* 74 87 * Macros for annotating the expected destination of (h)rfid
+10
arch/powerpc/include/asm/feature-fixups.h
··· 240 240 FTR_ENTRY_OFFSET 957b-958b; \ 241 241 .popsection; 242 242 243 + #define SCV_ENTRY_FLUSH_FIXUP_SECTION \ 244 + 957: \ 245 + .pushsection __scv_entry_flush_fixup,"a"; \ 246 + .align 2; \ 247 + 958: \ 248 + FTR_ENTRY_OFFSET 957b-958b; \ 249 + .popsection; 250 + 243 251 #define RFI_FLUSH_FIXUP_SECTION \ 244 252 951: \ 245 253 .pushsection __rfi_flush_fixup,"a"; \ ··· 281 273 282 274 extern long stf_barrier_fallback; 283 275 extern long entry_flush_fallback; 276 + extern long scv_entry_flush_fallback; 284 277 extern long __start___stf_entry_barrier_fixup, __stop___stf_entry_barrier_fixup; 285 278 extern long __start___stf_exit_barrier_fixup, __stop___stf_exit_barrier_fixup; 286 279 extern long __start___uaccess_flush_fixup, __stop___uaccess_flush_fixup; 287 280 extern long __start___entry_flush_fixup, __stop___entry_flush_fixup; 281 + extern long __start___scv_entry_flush_fixup, __stop___scv_entry_flush_fixup; 288 282 extern long __start___rfi_flush_fixup, __stop___rfi_flush_fixup; 289 283 extern long __start___barrier_nospec_fixup, __stop___barrier_nospec_fixup; 290 284 extern long __start__btb_flush_fixup, __stop__btb_flush_fixup;
+1 -1
arch/powerpc/kernel/entry_64.S
··· 75 75 bne .Ltabort_syscall 76 76 END_FTR_SECTION_IFSET(CPU_FTR_TM) 77 77 #endif 78 - INTERRUPT_TO_KERNEL 78 + SCV_INTERRUPT_TO_KERNEL 79 79 mr r10,r1 80 80 ld r1,PACAKSAVE(r13) 81 81 std r10,0(r1)
+19
arch/powerpc/kernel/exceptions-64s.S
··· 2993 2993 ld r11,PACA_EXRFI+EX_R11(r13) 2994 2994 blr 2995 2995 2996 + /* 2997 + * The SCV entry flush happens with interrupts enabled, so it must disable 2998 + * to prevent EXRFI being clobbered by NMIs (e.g., soft_nmi_common). r10 2999 + * (containing LR) does not need to be preserved here because scv entry 3000 + * puts 0 in the pt_regs, CTR can be clobbered for the same reason. 3001 + */ 3002 + TRAMP_REAL_BEGIN(scv_entry_flush_fallback) 3003 + li r10,0 3004 + mtmsrd r10,1 3005 + lbz r10,PACAIRQHAPPENED(r13) 3006 + ori r10,r10,PACA_IRQ_HARD_DIS 3007 + stb r10,PACAIRQHAPPENED(r13) 3008 + std r11,PACA_EXRFI+EX_R11(r13) 3009 + L1D_DISPLACEMENT_FLUSH 3010 + ld r11,PACA_EXRFI+EX_R11(r13) 3011 + li r10,MSR_RI 3012 + mtmsrd r10,1 3013 + blr 3014 + 2996 3015 TRAMP_REAL_BEGIN(rfi_flush_fallback) 2997 3016 SET_SCRATCH0(r13); 2998 3017 GET_PACA(r13);
+7
arch/powerpc/kernel/vmlinux.lds.S
··· 146 146 } 147 147 148 148 . = ALIGN(8); 149 + __scv_entry_flush_fixup : AT(ADDR(__scv_entry_flush_fixup) - LOAD_OFFSET) { 150 + __start___scv_entry_flush_fixup = .; 151 + *(__scv_entry_flush_fixup) 152 + __stop___scv_entry_flush_fixup = .; 153 + } 154 + 155 + . = ALIGN(8); 149 156 __stf_exit_barrier_fixup : AT(ADDR(__stf_exit_barrier_fixup) - LOAD_OFFSET) { 150 157 __start___stf_exit_barrier_fixup = .; 151 158 *(__stf_exit_barrier_fixup)
+21 -3
arch/powerpc/lib/feature-fixups.c
··· 290 290 long *start, *end; 291 291 int i; 292 292 293 - start = PTRRELOC(&__start___entry_flush_fixup); 294 - end = PTRRELOC(&__stop___entry_flush_fixup); 295 - 296 293 instrs[0] = 0x60000000; /* nop */ 297 294 instrs[1] = 0x60000000; /* nop */ 298 295 instrs[2] = 0x60000000; /* nop */ ··· 309 312 if (types & L1D_FLUSH_MTTRIG) 310 313 instrs[i++] = 0x7c12dba6; /* mtspr TRIG2,r0 (SPR #882) */ 311 314 315 + start = PTRRELOC(&__start___entry_flush_fixup); 316 + end = PTRRELOC(&__stop___entry_flush_fixup); 312 317 for (i = 0; start < end; start++, i++) { 313 318 dest = (void *)start + *start; 314 319 ··· 326 327 327 328 patch_instruction((struct ppc_inst *)(dest + 2), ppc_inst(instrs[2])); 328 329 } 330 + 331 + start = PTRRELOC(&__start___scv_entry_flush_fixup); 332 + end = PTRRELOC(&__stop___scv_entry_flush_fixup); 333 + for (; start < end; start++, i++) { 334 + dest = (void *)start + *start; 335 + 336 + pr_devel("patching dest %lx\n", (unsigned long)dest); 337 + 338 + patch_instruction((struct ppc_inst *)dest, ppc_inst(instrs[0])); 339 + 340 + if (types == L1D_FLUSH_FALLBACK) 341 + patch_branch((struct ppc_inst *)(dest + 1), (unsigned long)&scv_entry_flush_fallback, 342 + BRANCH_SET_LINK); 343 + else 344 + patch_instruction((struct ppc_inst *)(dest + 1), ppc_inst(instrs[1])); 345 + 346 + patch_instruction((struct ppc_inst *)(dest + 2), ppc_inst(instrs[2])); 347 + } 348 + 329 349 330 350 printk(KERN_DEBUG "entry-flush: patched %d locations (%s flush)\n", i, 331 351 (types == L1D_FLUSH_NONE) ? "no" :
+4 -1
tools/testing/selftests/powerpc/alignment/alignment_handler.c
··· 443 443 LOAD_DFORM_TEST(ldu); 444 444 LOAD_XFORM_TEST(ldx); 445 445 LOAD_XFORM_TEST(ldux); 446 - LOAD_DFORM_TEST(lmw); 447 446 STORE_DFORM_TEST(stb); 448 447 STORE_XFORM_TEST(stbx); 449 448 STORE_DFORM_TEST(stbu); ··· 461 462 STORE_XFORM_TEST(stdx); 462 463 STORE_DFORM_TEST(stdu); 463 464 STORE_XFORM_TEST(stdux); 465 + 466 + #ifdef __BIG_ENDIAN__ 467 + LOAD_DFORM_TEST(lmw); 464 468 STORE_DFORM_TEST(stmw); 469 + #endif 465 470 466 471 return rc; 467 472 }
+1 -1
tools/testing/selftests/powerpc/mm/pkey_exec_prot.c
··· 290 290 291 291 int main(void) 292 292 { 293 - test_harness(test, "pkey_exec_prot"); 293 + return test_harness(test, "pkey_exec_prot"); 294 294 }
+1 -1
tools/testing/selftests/powerpc/mm/pkey_siginfo.c
··· 329 329 330 330 int main(void) 331 331 { 332 - test_harness(test, "pkey_siginfo"); 332 + return test_harness(test, "pkey_siginfo"); 333 333 }