linux-stable/arch/powerpc/kvm
Nicholas Piggin cf0b0e3712 KVM: PPC: Book3S HV: Prevent POWER7/8 TLB flush flushing SLB
The POWER9 ERAT flush instruction is a SLBIA with IH=7, which is a
reserved value on POWER7/8. On POWER8 this invalidates the SLB entries
above index 0, similarly to SLBIA IH=0.

If the SLB entries are invalidated, and then the guest is bypassed, the
host SLB does not get re-loaded, so the bolted entries above 0 will be
lost. This can result in kernel stack access causing a SLB fault.

Kernel stack access causing a SLB fault was responsible for the infamous
mega bug (search "Fix SLB reload bug"). Although since commit
48e7b76957 ("powerpc/64s/hash: Convert SLB miss handlers to C") that
starts using the kernel stack in the SLB miss handler, it might only
result in an infinite loop of SLB faults. In any case it's a bug.

Fix this by only executing the instruction on >= POWER9 where IH=7 is
defined not to invalidate the SLB. POWER7/8 don't require this ERAT
flush.

Fixes: 5008711259 ("KVM: PPC: Book3S HV: Invalidate ERAT when flushing guest TLB entries")
Cc: stable@vger.kernel.org # v5.2+
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Fabiano Rosas <farosas@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211119031627.577853-1-npiggin@gmail.com
2021-11-24 21:00:36 +11:00
..
Kconfig powerpc/kvm: Remove obsolete and unneeded select 2021-08-20 12:37:18 +10:00
Makefile KVM: stats: Add fd-based API to read binary stats data 2021-06-24 11:47:57 -04:00
book3s.c KVM: stats: Add halt_wait_ns stats for all architectures 2021-08-20 16:06:33 -04:00
book3s.h KVM: PPC: Book3S PR: Declare kvmppc_handle_exit_pr() 2021-08-20 22:17:38 +10:00
book3s_32_mmu.c
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_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.c KVM: PPC: Book3S PR: Remove unused variable 2021-08-20 22:17:41 +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: Stop exporting symbols from book3s_64_mmu_radix 2021-08-24 23:14:06 +10:00
book3s_64_slb.S
book3s_64_vio.c KVM: PPC: Replace zero-length array with flexible array member 2021-10-20 18:30:42 -05:00
book3s_64_vio_hv.c ARM: 2021-09-07 13:40:51 -07: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.c KVM: PPC: Tick accounting should defer vtime accounting 'til after IRQ handling 2021-10-28 22:27:48 +11:00
book3s_hv_builtin.c KVM: PPC: Book3S HV: Prevent POWER7/8 TLB flush flushing SLB 2021-11-24 21:00:36 +11: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: save_hv_return_state does not require trap argument 2021-08-25 16:37:18 +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 KVM: PPC: Book3S HV: H_ENTER filter out reserved HPTE[B] value 2021-10-13 13:08:16 +11:00
book3s_hv_rm_xics.c powerpc/powernv/pci: Rework pnv_opal_pci_msi_eoi() 2021-08-10 23:15:01 +10:00
book3s_hv_rm_xive.c
book3s_hv_rmhandlers.S KVM: PPC: Book3S HV: Use GLOBAL_TOC for kvmppc_h_set_dabr/xdabr() 2021-11-15 15:46:45 +11:00
book3s_hv_tm.c KVM: PPC: Book3S HV Nested: Fix TM softpatch HFAC interrupt emulation 2021-08-25 16:37:17 +10:00
book3s_hv_tm_builtin.c
book3s_hv_uvmem.c mm/migrate.c: remove MIGRATE_PFN_LOCKED 2021-11-11 09:34:35 -08:00
book3s_interrupts.S
book3s_mmu_hpte.c
book3s_paired_singles.c
book3s_pr.c powerpc updates for 5.14 2021-07-02 12:54:34 -07:00
book3s_pr_papr.c KVM: stats: Separate generic stats from architecture specific ones 2021-06-24 11:47:56 -04: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 powerpc: rename powerpc_debugfs_root to arch_debugfs_dir 2021-08-13 22:04:26 +10:00
book3s_xics.h
book3s_xive.c kvm: rename KVM_MAX_VCPU_ID to KVM_MAX_VCPU_IDS 2021-09-30 04:27:05 -04:00
book3s_xive.h KVM: PPC: Book3S HV: XIVE: Add support for automatic save-restore 2021-08-10 23:15:02 +10:00
book3s_xive_native.c powerpc: rename powerpc_debugfs_root to arch_debugfs_dir 2021-08-13 22:04:26 +10:00
book3s_xive_template.c powerpc/xive: Remove P9 DD1 flag XIVE_IRQ_FLAG_EOI_FW 2020-12-11 09:53:10 +11:00
booke.c KVM: PPC: Tick accounting should defer vtime accounting 'til after IRQ handling 2021-10-28 22:27:48 +11:00
booke.h
booke_emulate.c
booke_interrupts.S
bookehv_interrupts.S
e500.c
e500.h
e500_emulate.c
e500_mmu.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
e500mc.c
emulate.c
emulate_loadstore.c
fpu.S
irq.h
mpic.c
powerpc.c KVM: PPC: Cap KVM_CAP_NR_VCPUS by KVM_CAP_MAX_VCPUS 2021-11-18 02:12:14 -05:00
timing.c
timing.h
tm.S
trace.h
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
trace_pr.h