linux-brain/arch/powerpc/kvm
Nicholas Piggin 4bf2c9605d KVM: PPC: Book3S HV: Tolerate treclaim. in fake-suspend mode changing registers
commit 267cdfa21385d78c794768233678756e32b39ead upstream.

POWER9 DD2.2 and 2.3 hardware implements a "fake-suspend" mode where
certain TM instructions executed in HV=0 mode cause softpatch interrupts
so the hypervisor can emulate them and prevent problematic processor
conditions. In this fake-suspend mode, the treclaim. instruction does
not modify registers.

Unfortunately the rfscv instruction executed by the guest do not
generate softpatch interrupts, which can cause the hypervisor to lose
track of the fake-suspend mode, and it can execute this treclaim. while
not in fake-suspend mode. This modifies GPRs and crashes the hypervisor.

It's not trivial to disable scv in the guest with HFSCR now, because
they assume a POWER9 has scv available. So this fix saves and restores
checkpointed registers across the treclaim.

Fixes: 7854f7545b ("KVM: PPC: Book3S: Rework TM save/restore code and make it C-callable")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210908101718.118522-2-npiggin@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-22 12:26:42 +02:00
..
Kconfig powerpc/Kconfig: Clean up formatting 2019-07-04 16:55:10 +10:00
Makefile KVM: PPC: Book3S HV: Add a new KVM device for the XIVE native exploitation mode 2019-04-30 19:35:16 +10:00
book3s.c KVM: Pass MMU notifier range flags to kvm_unmap_hva_range() 2020-08-26 10:41:08 +02:00
book3s.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 98 2019-05-24 17:37:54 +02:00
book3s_32_mmu.c KVM: PPC: Book3S: Mark expected switch fall-through 2019-08-23 15:57:24 +10:00
book3s_32_mmu_host.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_32_sr.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_64_mmu.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_64_mmu_host.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_64_mmu_hv.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_64_mmu_radix.c KVM: PPC: Book3S HV: Close race with page faults around memslot flushes 2020-10-01 13:18:05 +02:00
book3s_64_slb.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_64_vio.c KVM: PPC: Book3S: Fix some RCU-list locks 2020-06-24 17:50:34 +02:00
book3s_64_vio_hv.c KVM: PPC: Fix clearing never mapped TCEs in realmode 2021-09-22 12:26:25 +02:00
book3s_emulate.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_exports.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_hv.c KVM: PPC: Book3S HV Nested: Reflect guest PMU in-use to L0 when guest SPRs are live 2021-09-22 12:26:25 +02:00
book3s_hv_builtin.c KVM: PPC: Book3S HV: Fix TLB management on SMT8 POWER9 and POWER10 processors 2021-07-14 16:53:14 +02:00
book3s_hv_hmi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 114 2019-05-24 17:39:01 +02:00
book3s_hv_interrupts.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_hv_nested.c KVM: PPC: Book3S HV Nested: Sanitise H_ENTER_NESTED TM state 2021-07-28 13:30:59 +02:00
book3s_hv_ras.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
book3s_hv_rm_mmu.c KVM: PPC: Book3S HV: Fix TLB management on SMT8 POWER9 and POWER10 processors 2021-07-14 16:53:14 +02:00
book3s_hv_rm_xics.c KVM: PPC: Book3S HV: use smp_mb() when setting/clearing host_ipi flag 2019-09-24 12:46:26 +10:00
book3s_hv_rm_xive.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
book3s_hv_rmhandlers.S KVM: PPC: Book3S HV: Tolerate treclaim. in fake-suspend mode changing registers 2021-09-22 12:26:42 +02:00
book3s_hv_tm.c KVM: PPC: Book3S HV: Treat TM-related invalid form instructions on P9 like the valid ones 2020-10-01 13:17:44 +02:00
book3s_hv_tm_builtin.c KVM: PPC: Book3S HV: Treat TM-related invalid form instructions on P9 like the valid ones 2020-10-01 13:17:44 +02:00
book3s_interrupts.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_mmu_hpte.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_paired_singles.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_pr.c KVM: PPC: Book3S PR: Free shared page if mmu initialization fails 2020-02-11 04:35:39 -08:00
book3s_pr_papr.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
book3s_rmhandlers.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_rtas.c KVM: PPC: Book3S: Fix H_RTAS rets buffer overflow 2021-07-28 13:30:59 +02:00
book3s_segment.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
book3s_xics.c scripts/spelling.txt: drop "sepc" from the misspelling list 2019-07-12 11:05:41 -07:00
book3s_xics.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
book3s_xive.c KVM: PPC: Book3S HV: XIVE: Set kvm->arch.xive when VPs are allocated 2019-12-13 08:42:59 +01:00
book3s_xive.h KVM: PPC: Book3S HV: XIVE: Ensure VP isn't already in use 2019-10-15 16:09:11 +11:00
book3s_xive_native.c KVM: PPC: Book3S HV: XIVE: Fix possible oops when accessing ESB page 2020-12-02 08:49:46 +01:00
book3s_xive_template.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
booke.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
booke.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
booke_emulate.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
booke_interrupts.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
bookehv_interrupts.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
e500.c KVM: Assert that struct kvm_vcpu is always as offset zero 2019-08-22 10:09:27 +02:00
e500.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
e500_emulate.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
e500_mmu.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
e500_mmu_host.c KVM: Pass MMU notifier range flags to kvm_unmap_hva_range() 2020-08-26 10:41:08 +02:00
e500_mmu_host.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
e500mc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
emulate.c Merge remote-tracking branch 'remotes/powerpc/topic/ppc-kvm' into kvm-ppc-next 2019-08-23 14:08:04 +10:00
emulate_loadstore.c KVM: PPC: Remove set but not used variable 'ra', 'rs', 'rt' 2020-02-24 08:36:51 +01:00
fpu.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
irq.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mpic.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
powerpc.c KVM: PPC: Fix kvm_arch_vcpu_ioctl vcpu_load leak 2021-07-28 13:30:56 +02:00
timing.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
timing.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
tm.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
trace.h KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE 2018-11-07 23:04:38 +11:00
trace_book3s.h KVM: PPC: Book3S: Simplify external interrupt handling 2018-10-09 16:04:27 +11:00
trace_booke.h KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE 2018-11-07 23:04:38 +11:00
trace_hv.h KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE 2018-11-07 23:04:38 +11:00
trace_pr.h KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE 2018-11-07 23:04:38 +11:00