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 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

Pull arm64 fixes from Catalin Marinas:

- Allow booting of late secondary CPUs affected by erratum 1418040
(currently they are parked if none of the early CPUs are affected by
this erratum).

- Add the 32-bit vdso Makefile to the vdso_install rule so that 'make
vdso_install' installs the 32-bit compat vdso when it is compiled.

- Print a warning that untrusted guests without a CPU erratum
workaround (Cortex-A57 832075) may deadlock the affected system.

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
ARM64: vdso32: Install vdso32 from vdso_install
KVM: arm64: Print warning when cpu erratum can cause guests to deadlock
arm64: Allow booting of late CPUs affected by erratum 1418040
arm64: Move handling of erratum 1418040 into C code

+42 -22
+1
arch/arm64/Makefile
··· 165 165 PHONY += vdso_install 166 166 vdso_install: 167 167 $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@ 168 + $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso32 $@ 168 169 169 170 # We use MRPROPER_FILES and CLEAN_FILES now 170 171 archclean:
+2
arch/arm64/kernel/cpu_errata.c
··· 910 910 .desc = "ARM erratum 1418040", 911 911 .capability = ARM64_WORKAROUND_1418040, 912 912 ERRATA_MIDR_RANGE_LIST(erratum_1418040_list), 913 + .type = (ARM64_CPUCAP_SCOPE_LOCAL_CPU | 914 + ARM64_CPUCAP_PERMITTED_FOR_LATE_CPU), 913 915 }, 914 916 #endif 915 917 #ifdef CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT
-21
arch/arm64/kernel/entry.S
··· 170 170 stp x28, x29, [sp, #16 * 14] 171 171 172 172 .if \el == 0 173 - .if \regsize == 32 174 - /* 175 - * If we're returning from a 32-bit task on a system affected by 176 - * 1418040 then re-enable userspace access to the virtual counter. 177 - */ 178 - #ifdef CONFIG_ARM64_ERRATUM_1418040 179 - alternative_if ARM64_WORKAROUND_1418040 180 - mrs x0, cntkctl_el1 181 - orr x0, x0, #2 // ARCH_TIMER_USR_VCT_ACCESS_EN 182 - msr cntkctl_el1, x0 183 - alternative_else_nop_endif 184 - #endif 185 - .endif 186 173 clear_gp_regs 187 174 mrs x21, sp_el0 188 175 ldr_this_cpu tsk, __entry_task, x20 ··· 280 293 msr sp_el0, x23 281 294 tst x22, #PSR_MODE32_BIT // native task? 282 295 b.eq 3f 283 - 284 - #ifdef CONFIG_ARM64_ERRATUM_1418040 285 - alternative_if ARM64_WORKAROUND_1418040 286 - mrs x0, cntkctl_el1 287 - bic x0, x0, #2 // ARCH_TIMER_USR_VCT_ACCESS_EN 288 - msr cntkctl_el1, x0 289 - alternative_else_nop_endif 290 - #endif 291 296 292 297 #ifdef CONFIG_ARM64_ERRATUM_845719 293 298 alternative_if ARM64_WORKAROUND_845719
+34
arch/arm64/kernel/process.c
··· 516 516 } 517 517 518 518 /* 519 + * ARM erratum 1418040 handling, affecting the 32bit view of CNTVCT. 520 + * Assuming the virtual counter is enabled at the beginning of times: 521 + * 522 + * - disable access when switching from a 64bit task to a 32bit task 523 + * - enable access when switching from a 32bit task to a 64bit task 524 + */ 525 + static void erratum_1418040_thread_switch(struct task_struct *prev, 526 + struct task_struct *next) 527 + { 528 + bool prev32, next32; 529 + u64 val; 530 + 531 + if (!(IS_ENABLED(CONFIG_ARM64_ERRATUM_1418040) && 532 + cpus_have_const_cap(ARM64_WORKAROUND_1418040))) 533 + return; 534 + 535 + prev32 = is_compat_thread(task_thread_info(prev)); 536 + next32 = is_compat_thread(task_thread_info(next)); 537 + 538 + if (prev32 == next32) 539 + return; 540 + 541 + val = read_sysreg(cntkctl_el1); 542 + 543 + if (!next32) 544 + val |= ARCH_TIMER_USR_VCT_ACCESS_EN; 545 + else 546 + val &= ~ARCH_TIMER_USR_VCT_ACCESS_EN; 547 + 548 + write_sysreg(val, cntkctl_el1); 549 + } 550 + 551 + /* 519 552 * Thread switching. 520 553 */ 521 554 __notrace_funcgraph struct task_struct *__switch_to(struct task_struct *prev, ··· 563 530 entry_task_switch(next); 564 531 uao_thread_switch(next); 565 532 ssbs_thread_switch(next); 533 + erratum_1418040_thread_switch(prev, next); 566 534 567 535 /* 568 536 * Complete any pending TLB or cache maintenance on this CPU in case
+1 -1
arch/arm64/kernel/vdso32/Makefile
··· 208 208 cmd_vdsosym = $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ 209 209 210 210 # Install commands for the unstripped file 211 - quiet_cmd_vdso_install = INSTALL $@ 211 + quiet_cmd_vdso_install = INSTALL32 $@ 212 212 cmd_vdso_install = cp $(obj)/$@.dbg $(MODLIB)/vdso/vdso32.so 213 213 214 214 vdso.so: $(obj)/vdso.so.dbg
+4
arch/arm64/kvm/arm.c
··· 1640 1640 return -ENODEV; 1641 1641 } 1642 1642 1643 + if (cpus_have_final_cap(ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE)) 1644 + kvm_info("Guests without required CPU erratum workarounds can deadlock system!\n" \ 1645 + "Only trusted guests should be used on this system.\n"); 1646 + 1643 1647 for_each_online_cpu(cpu) { 1644 1648 smp_call_function_single(cpu, check_kvm_target_cpu, &ret, 1); 1645 1649 if (ret < 0) {