linux-snapdragon/arch/powerpc/kvm
Nicholas Piggin 9151f0bdc3 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:39:22 +02:00
..
book3s_32_mmu_host.c powerpc/32s: move CTX_TO_VSID() into mmu-hash.h 2021-06-17 00:09:08 +10:00
book3s_32_mmu.c
book3s_32_sr.S
book3s_64_entry.S KVM: PPC: Book3S HV P9: implement hash host / hash guest support 2021-06-10 22:12:15 +10:00
book3s_64_mmu_host.c powerpc/kvm: Fix build error when PPC_MEM_KEYS/PPC_PSERIES=n 2021-04-27 10:48:37 +10:00
book3s_64_mmu_hv.c KVM: PPC: Book3S HV: Fix kvm_unmap_gfn_range_hv() for Hash MMU 2021-05-12 11:07:39 +10:00
book3s_64_mmu_radix.c KVM: PPC: Book3S HV: Fix copy_tofrom_guest routines 2021-09-18 13:43:32 +02:00
book3s_64_mmu.c
book3s_64_slb.S
book3s_64_vio_hv.c KVM: PPC: Fix clearing never mapped TCEs in realmode 2021-09-18 13:43:33 +02:00
book3s_64_vio.c KVM: PPC: Book3S: Fix symbol undeclared warnings 2020-09-22 11:53:55 +10:00
book3s_emulate.c powerpc/32s: Change mfsrin() into a static inline function 2021-02-09 01:10:15 +11:00
book3s_exports.c
book3s_hv_builtin.c KVM: PPC: Book3S HV: Fix TLB management on SMT8 POWER9 and POWER10 processors 2021-06-21 09:22:34 +10:00
book3s_hv_hmi.c
book3s_hv_interrupts.S KVM: PPC: Book3S HV: remove ISA v3.0 and v3.1 support from P7/8 path 2021-06-10 22:12:15 +10:00
book3s_hv_nested.c KVM: PPC: Book3S HV Nested: Sanitise H_ENTER_NESTED TM state 2021-07-23 16:19:38 +10:00
book3s_hv_p9_entry.c KVM: PPC: Book3S HV P9: Fix guest TM support 2021-07-15 21:53:37 +10:00
book3s_hv_ras.c KVM: PPC: Book3S HV: Don't attempt to recover machine checks for FWNMI enabled guests 2020-12-04 01:01:23 +11:00
book3s_hv_rm_mmu.c ARM: 2021-06-28 15:40:51 -07:00
book3s_hv_rm_xics.c KVM: PPC: Book3S HV: Remove unused nested HV tests in XICS emulation 2021-06-10 22:12:14 +10:00
book3s_hv_rm_xive.c
book3s_hv_rmhandlers.S KVM: PPC: Book3S HV: Tolerate treclaim. in fake-suspend mode changing registers 2021-09-22 12:39:22 +02:00
book3s_hv_tm_builtin.c
book3s_hv_tm.c
book3s_hv_uvmem.c Merge branch 'akpm' (patches from Andrew) 2021-06-29 17:29:11 -07:00
book3s_hv.c KVM: PPC: Book3S HV Nested: Reflect guest PMU in-use to L0 when guest SPRs are live 2021-09-18 13:43:32 +02:00
book3s_interrupts.S PPC KVM update for 5.9 2020-08-09 13:24:02 -04:00
book3s_mmu_hpte.c
book3s_paired_singles.c
book3s_pr_papr.c KVM: stats: Separate generic stats from architecture specific ones 2021-06-24 11:47:56 -04:00
book3s_pr.c powerpc updates for 5.14 2021-07-02 12:54:34 -07:00
book3s_rmhandlers.S powerpc: Replace RFI by rfi on book3s/32 and booke 2020-11-19 16:56:54 +11:00
book3s_rtas.c KVM: PPC: Book3S: Fix H_RTAS rets buffer overflow 2021-07-23 16:14:31 +10:00
book3s_segment.S KVM: PPC: Book3S 64: move bad_host_intr check to HV handler 2021-06-10 22:12:12 +10:00
book3s_xics.c KVM: PPC: Book3S: Assign boolean values to a bool variable 2020-12-15 22:22:06 +11:00
book3s_xics.h
book3s_xive_native.c Updates for the interrupt subsystem: 2021-06-29 12:25:04 -07:00
book3s_xive_template.c powerpc/xive: Remove P9 DD1 flag XIVE_IRQ_FLAG_EOI_FW 2020-12-11 09:53:10 +11:00
book3s_xive.c Updates for the interrupt subsystem: 2021-06-29 12:25:04 -07:00
book3s_xive.h KVM: PPC: Book3S HV: Remove virt mode checks from real mode handlers 2021-06-10 22:12:14 +10:00
book3s.c KVM: debugfs: Reuse binary stats descriptors 2021-06-24 18:00:29 -04:00
book3s.h KVM: PPC: Convert to the gfn-based MMU notifier callbacks 2021-04-17 08:31:07 -04:00
booke_emulate.c
booke_interrupts.S KVM: PPC: Clean up redundant kvm_run parameters in assembly 2020-07-23 15:50:01 +10:00
booke.c KVM: debugfs: Reuse binary stats descriptors 2021-06-24 18:00:29 -04:00
booke.h
bookehv_interrupts.S KVM: PPC: Clean up redundant kvm_run parameters in assembly 2020-07-23 15:50:01 +10:00
e500_emulate.c
e500_mmu_host.c KVM: PPC: Convert to the gfn-based MMU notifier callbacks 2021-04-17 08:31:07 -04:00
e500_mmu_host.h
e500_mmu.c
e500.c
e500.h
e500mc.c
emulate_loadstore.c
emulate.c
fpu.S
irq.h
Kconfig powerpc/kvm: Force selection of CONFIG_PPC_FPU 2021-01-30 11:39:32 +11:00
Makefile KVM: stats: Add fd-based API to read binary stats data 2021-06-24 11:47:57 -04:00
mpic.c
powerpc.c KVM: PPC: Fix kvm_arch_vcpu_ioctl vcpu_load leak 2021-07-17 14:33:18 +10:00
timing.c
timing.h
tm.S
trace_book3s.h
trace_booke.h KVM: Move arm64's MMU notifier trace events to generic code 2021-04-17 08:30:56 -04:00
trace_hv.h KVM: PPC: Fix typo on H_DISABLE_AND_GET hcall 2020-07-23 17:43:35 +10:00
trace_pr.h
trace.h