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

Michael writes:
"powerpc fixes for 4.19 #3

A reasonably big batch of fixes due to me being away for a few weeks.

A fix for the TM emulation support on Power9, which could result in
corrupting the guest r11 when running under KVM.

Two fixes to the TM code which could lead to userspace GPR corruption
if we take an SLB miss at exactly the wrong time.

Our dynamic patching code had a bug that meant we could patch freed
__init text, which could lead to corrupting userspace memory.

csum_ipv6_magic() didn't work on little endian platforms since we
optimised it recently.

A fix for an endian bug when reading a device tree property telling
us how many storage keys the machine has available.

Fix a crash seen on some configurations of PowerVM when migrating the
partition from one machine to another.

A fix for a regression in the setup of our CPU to NUMA node mapping
in KVM guests.

A fix to our selftest Makefiles to make them work since a recent
change to the shared Makefile logic."

* tag 'powerpc-4.19-3' of https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
selftests/powerpc: Fix Makefiles for headers_install change
powerpc/numa: Use associativity if VPHN hcall is successful
powerpc/tm: Avoid possible userspace r1 corruption on reclaim
powerpc/tm: Fix userspace r13 corruption
powerpc/pseries: Fix unitialized timer reset on migration
powerpc/pkeys: Fix reading of ibm, processor-storage-keys property
powerpc: fix csum_ipv6_magic() on little endian platforms
powerpc/powernv/ioda2: Reduce upper limit for DMA window size (again)
powerpc: Avoid code patching freed init sections
KVM: PPC: Book3S HV: Fix guest r11 corruption with POWER9 TM workarounds

+55 -9
+1
arch/powerpc/include/asm/setup.h
··· 9 9 10 10 extern unsigned int rtas_data; 11 11 extern unsigned long long memory_limit; 12 + extern bool init_mem_is_free; 12 13 extern unsigned long klimit; 13 14 extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask); 14 15
+2 -2
arch/powerpc/kernel/exceptions-64s.S
··· 1314 1314 1315 1315 #ifdef CONFIG_PPC_DENORMALISATION 1316 1316 mfspr r10,SPRN_HSRR1 1317 - mfspr r11,SPRN_HSRR0 /* save HSRR0 */ 1318 1317 andis. r10,r10,(HSRR1_DENORM)@h /* denorm? */ 1319 - addi r11,r11,-4 /* HSRR0 is next instruction */ 1320 1318 bne+ denorm_assist 1321 1319 #endif 1322 1320 ··· 1380 1382 */ 1381 1383 XVCPSGNDP32(32) 1382 1384 denorm_done: 1385 + mfspr r11,SPRN_HSRR0 1386 + subi r11,r11,4 1383 1387 mtspr SPRN_HSRR0,r11 1384 1388 mtcrf 0x80,r9 1385 1389 ld r9,PACA_EXGEN+EX_R9(r13)
+17 -3
arch/powerpc/kernel/tm.S
··· 176 176 std r1, PACATMSCRATCH(r13) 177 177 ld r1, PACAR1(r13) 178 178 179 - /* Store the PPR in r11 and reset to decent value */ 180 179 std r11, GPR11(r1) /* Temporary stash */ 180 + 181 + /* 182 + * Move the saved user r1 to the kernel stack in case PACATMSCRATCH is 183 + * clobbered by an exception once we turn on MSR_RI below. 184 + */ 185 + ld r11, PACATMSCRATCH(r13) 186 + std r11, GPR1(r1) 187 + 188 + /* 189 + * Store r13 away so we can free up the scratch SPR for the SLB fault 190 + * handler (needed once we start accessing the thread_struct). 191 + */ 192 + GET_SCRATCH0(r11) 193 + std r11, GPR13(r1) 181 194 182 195 /* Reset MSR RI so we can take SLB faults again */ 183 196 li r11, MSR_RI 184 197 mtmsrd r11, 1 185 198 199 + /* Store the PPR in r11 and reset to decent value */ 186 200 mfspr r11, SPRN_PPR 187 201 HMT_MEDIUM 188 202 ··· 221 207 SAVE_GPR(8, r7) /* user r8 */ 222 208 SAVE_GPR(9, r7) /* user r9 */ 223 209 SAVE_GPR(10, r7) /* user r10 */ 224 - ld r3, PACATMSCRATCH(r13) /* user r1 */ 210 + ld r3, GPR1(r1) /* user r1 */ 225 211 ld r4, GPR7(r1) /* user r7 */ 226 212 ld r5, GPR11(r1) /* user r11 */ 227 213 ld r6, GPR12(r1) /* user r12 */ 228 - GET_SCRATCH0(8) /* user r13 */ 214 + ld r8, GPR13(r1) /* user r13 */ 229 215 std r3, GPR1(r7) 230 216 std r4, GPR7(r7) 231 217 std r5, GPR11(r7)
+3
arch/powerpc/lib/checksum_64.S
··· 443 443 addc r0, r8, r9 444 444 ld r10, 0(r4) 445 445 ld r11, 8(r4) 446 + #ifdef CONFIG_CPU_LITTLE_ENDIAN 447 + rotldi r5, r5, 8 448 + #endif 446 449 adde r0, r0, r10 447 450 add r5, r5, r7 448 451 adde r0, r0, r11
+6
arch/powerpc/lib/code-patching.c
··· 28 28 { 29 29 int err; 30 30 31 + /* Make sure we aren't patching a freed init section */ 32 + if (init_mem_is_free && init_section_contains(exec_addr, 4)) { 33 + pr_debug("Skipping init section patching addr: 0x%px\n", exec_addr); 34 + return 0; 35 + } 36 + 31 37 __put_user_size(instr, patch_addr, 4, err); 32 38 if (err) 33 39 return err;
+2
arch/powerpc/mm/mem.c
··· 63 63 #endif 64 64 65 65 unsigned long long memory_limit; 66 + bool init_mem_is_free; 66 67 67 68 #ifdef CONFIG_HIGHMEM 68 69 pte_t *kmap_pte; ··· 397 396 { 398 397 ppc_md.progress = ppc_printk_progress; 399 398 mark_initmem_nx(); 399 + init_mem_is_free = true; 400 400 free_initmem_default(POISON_FREE_INITMEM); 401 401 } 402 402
+5 -2
arch/powerpc/mm/numa.c
··· 1204 1204 int new_nid; 1205 1205 1206 1206 /* Use associativity from first thread for all siblings */ 1207 - vphn_get_associativity(cpu, associativity); 1207 + if (vphn_get_associativity(cpu, associativity)) 1208 + return cpu_to_node(cpu); 1209 + 1208 1210 new_nid = associativity_to_nid(associativity); 1209 1211 if (new_nid < 0 || !node_possible(new_nid)) 1210 1212 new_nid = first_online_node; ··· 1454 1452 1455 1453 static void reset_topology_timer(void) 1456 1454 { 1457 - mod_timer(&topology_timer, jiffies + topology_timer_secs * HZ); 1455 + if (vphn_enabled) 1456 + mod_timer(&topology_timer, jiffies + topology_timer_secs * HZ); 1458 1457 } 1459 1458 1460 1459 #ifdef CONFIG_SMP
+1 -1
arch/powerpc/mm/pkeys.c
··· 45 45 * Since any pkey can be used for data or execute, we will just treat 46 46 * all keys as equal and track them as one entity. 47 47 */ 48 - pkeys_total = be32_to_cpu(vals[0]); 48 + pkeys_total = vals[0]; 49 49 pkeys_devtree_defined = true; 50 50 } 51 51
+1 -1
arch/powerpc/platforms/powernv/pci-ioda-tce.c
··· 276 276 level_shift = entries_shift + 3; 277 277 level_shift = max_t(unsigned int, level_shift, PAGE_SHIFT); 278 278 279 - if ((level_shift - 3) * levels + page_shift >= 60) 279 + if ((level_shift - 3) * levels + page_shift >= 55) 280 280 return -EINVAL; 281 281 282 282 /* Allocate TCE table */
+1
tools/testing/selftests/powerpc/alignment/Makefile
··· 1 1 TEST_GEN_PROGS := copy_first_unaligned alignment_handler 2 2 3 + top_srcdir = ../../../../.. 3 4 include ../../lib.mk 4 5 5 6 $(TEST_GEN_PROGS): ../harness.c ../utils.c
+1
tools/testing/selftests/powerpc/benchmarks/Makefile
··· 4 4 5 5 CFLAGS += -O2 6 6 7 + top_srcdir = ../../../../.. 7 8 include ../../lib.mk 8 9 9 10 $(TEST_GEN_PROGS): ../harness.c
+1
tools/testing/selftests/powerpc/cache_shape/Makefile
··· 5 5 6 6 $(TEST_PROGS): ../harness.c ../utils.c 7 7 8 + top_srcdir = ../../../../.. 8 9 include ../../lib.mk 9 10 10 11 clean:
+1
tools/testing/selftests/powerpc/copyloops/Makefile
··· 17 17 18 18 EXTRA_SOURCES := validate.c ../harness.c stubs.S 19 19 20 + top_srcdir = ../../../../.. 20 21 include ../../lib.mk 21 22 22 23 $(OUTPUT)/copyuser_64_t%: copyuser_64.S $(EXTRA_SOURCES)
+1
tools/testing/selftests/powerpc/dscr/Makefile
··· 3 3 dscr_inherit_test dscr_inherit_exec_test dscr_sysfs_test \ 4 4 dscr_sysfs_thread_test 5 5 6 + top_srcdir = ../../../../.. 6 7 include ../../lib.mk 7 8 8 9 $(OUTPUT)/dscr_default_test: LDLIBS += -lpthread
+1
tools/testing/selftests/powerpc/math/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 TEST_GEN_PROGS := fpu_syscall fpu_preempt fpu_signal vmx_syscall vmx_preempt vmx_signal vsx_preempt 3 3 4 + top_srcdir = ../../../../.. 4 5 include ../../lib.mk 5 6 6 7 $(TEST_GEN_PROGS): ../harness.c
+1
tools/testing/selftests/powerpc/mm/Makefile
··· 5 5 TEST_GEN_PROGS := hugetlb_vs_thp_test subpage_prot prot_sao segv_errors 6 6 TEST_GEN_FILES := tempfile 7 7 8 + top_srcdir = ../../../../.. 8 9 include ../../lib.mk 9 10 10 11 $(TEST_GEN_PROGS): ../harness.c
+1
tools/testing/selftests/powerpc/pmu/Makefile
··· 5 5 TEST_GEN_PROGS := count_instructions l3_bank_test per_event_excludes 6 6 EXTRA_SOURCES := ../harness.c event.c lib.c ../utils.c 7 7 8 + top_srcdir = ../../../../.. 8 9 include ../../lib.mk 9 10 10 11 all: $(TEST_GEN_PROGS) ebb
+1
tools/testing/selftests/powerpc/pmu/ebb/Makefile
··· 17 17 lost_exception_test no_handler_test \ 18 18 cycles_with_mmcr2_test 19 19 20 + top_srcdir = ../../../../../.. 20 21 include ../../../lib.mk 21 22 22 23 $(TEST_GEN_PROGS): ../../harness.c ../../utils.c ../event.c ../lib.c \
+1
tools/testing/selftests/powerpc/primitives/Makefile
··· 2 2 3 3 TEST_GEN_PROGS := load_unaligned_zeropad 4 4 5 + top_srcdir = ../../../../.. 5 6 include ../../lib.mk 6 7 7 8 $(TEST_GEN_PROGS): ../harness.c
+1
tools/testing/selftests/powerpc/ptrace/Makefile
··· 4 4 ptrace-tm-spd-vsx ptrace-tm-spr ptrace-hwbreak ptrace-pkey core-pkey \ 5 5 perf-hwbreak 6 6 7 + top_srcdir = ../../../../.. 7 8 include ../../lib.mk 8 9 9 10 all: $(TEST_PROGS)
+1
tools/testing/selftests/powerpc/signal/Makefile
··· 8 8 CFLAGS += -maltivec 9 9 signal_tm: CFLAGS += -mhtm 10 10 11 + top_srcdir = ../../../../.. 11 12 include ../../lib.mk 12 13 13 14 clean:
+1
tools/testing/selftests/powerpc/stringloops/Makefile
··· 29 29 30 30 ASFLAGS = $(CFLAGS) 31 31 32 + top_srcdir = ../../../../.. 32 33 include ../../lib.mk 33 34 34 35 $(TEST_GEN_PROGS): $(EXTRA_SOURCES)
+1
tools/testing/selftests/powerpc/switch_endian/Makefile
··· 5 5 6 6 EXTRA_CLEAN = $(OUTPUT)/*.o $(OUTPUT)/check-reversed.S 7 7 8 + top_srcdir = ../../../../.. 8 9 include ../../lib.mk 9 10 10 11 $(OUTPUT)/switch_endian_test: $(OUTPUT)/check-reversed.S
+1
tools/testing/selftests/powerpc/syscalls/Makefile
··· 2 2 3 3 CFLAGS += -I../../../../../usr/include 4 4 5 + top_srcdir = ../../../../.. 5 6 include ../../lib.mk 6 7 7 8 $(TEST_GEN_PROGS): ../harness.c
+1
tools/testing/selftests/powerpc/tm/Makefile
··· 6 6 tm-vmxcopy tm-fork tm-tar tm-tmspr tm-vmx-unavail tm-unavailable tm-trap \ 7 7 $(SIGNAL_CONTEXT_CHK_TESTS) tm-sigreturn 8 8 9 + top_srcdir = ../../../../.. 9 10 include ../../lib.mk 10 11 11 12 $(TEST_GEN_PROGS): ../harness.c ../utils.c
+1
tools/testing/selftests/powerpc/vphn/Makefile
··· 2 2 3 3 CFLAGS += -m64 4 4 5 + top_srcdir = ../../../../.. 5 6 include ../../lib.mk 6 7 7 8 $(TEST_GEN_PROGS): ../harness.c