linux-stable/arch/x86
Maciej S. Szmigiero 01d004afbe KVM: x86: Ignore MSR_AMD64_TW_CFG access
commit 2770d47220 upstream.

Hyper-V enabled Windows Server 2022 KVM VM cannot be started on Zen1 Ryzen
since it crashes at boot with SYSTEM_THREAD_EXCEPTION_NOT_HANDLED +
STATUS_PRIVILEGED_INSTRUCTION (in other words, because of an unexpected #GP
in the guest kernel).

This is because Windows tries to set bit 8 in MSR_AMD64_TW_CFG and can't
handle receiving a #GP when doing so.

Give this MSR the same treatment that commit 2e32b71906
("x86, kvm: Add MSR_AMD64_BU_CFG2 to the list of ignored MSRs") gave
MSR_AMD64_BU_CFG2 under justification that this MSR is baremetal-relevant
only.
Although apparently it was then needed for Linux guests, not Windows as in
this case.

With this change, the aforementioned guest setup is able to finish booting
successfully.

This issue can be reproduced either on a Summit Ridge Ryzen (with
just "-cpu host") or on a Naples EPYC (with "-cpu host,stepping=1" since
EPYC is ordinarily stepping 2).

Alternatively, userspace could solve the problem by using MSR filters, but
forcing every userspace to define a filter isn't very friendly and doesn't
add much, if any, value.  The only potential hiccup is if one of these
"baremetal-only" MSRs ever requires actual emulation and/or has F/M/S
specific behavior.  But if that happens, then KVM can still punt *that*
handling to userspace since userspace MSR filters "win" over KVM's default
handling.

Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/1ce85d9c7c9e9632393816cf19c902e0a3f411f1.1697731406.git.maciej.szmigiero@oracle.com
[sean: call out MSR filtering alternative]
Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-11-28 16:45:44 +00:00
..
boot x86/boot: Wrap literal addresses in absolute_pointer() 2023-06-09 10:22:53 +02:00
configs x86/defconfig: Enable CONFIG_USB_XHCI_HCD=y 2020-09-23 10:46:37 +02:00
crypto crypto: aesni - add compatibility with IAS 2020-08-21 09:48:13 +02:00
entry x86/mm: Fix VDSO and VVAR placement on 5-level paging machines 2023-08-16 18:10:54 +02:00
events perf/x86/intel/pt: Fix address filter config for 32-bit kernel 2022-04-20 09:08:14 +02:00
hyperv x86/hyperv: mark hyperv_init as __init function 2019-12-01 09:14:37 +01:00
ia32 x86/ia32: Fix ia32_restore_sigcontext() AC leak 2019-05-31 06:47:31 -07:00
include KVM: x86: Ignore MSR_AMD64_TW_CFG access 2023-11-28 16:45:44 +00:00
kernel x86: Fix .brk attribute in linker script 2023-11-08 11:21:08 +01:00
kvm KVM: x86: Ignore MSR_AMD64_TW_CFG access 2023-11-28 16:45:44 +00:00
lib x86/asm: Fix an assembler warning with current binutils 2023-02-06 07:46:33 +01:00
math-emu x86: math-emu: Fix up 'cmp' insn for clang ias 2020-07-29 07:42:56 +02:00
mm x86/mm: Drop the 4 MB restriction on minimal NUMA node memory size 2023-11-28 16:45:42 +00:00
net bpf, x86: Validate computation of branch displacements for x86-64 2021-04-10 13:20:11 +02:00
oprofile
pci x86/pci/xen: Disable PCI/MSI[-X] masking for XEN_HVM guests 2022-06-06 08:20:56 +02:00
platform x86/olpc: fix 'logical not is only applied to the left hand side' 2022-08-25 11:11:27 +02:00
power x86/pm: Add enumeration check before spec MSRs save/restore setup 2022-12-08 11:16:33 +01:00
purgatory x86/purgatory: Don't generate debug info for purgatory.ro 2023-04-26 11:18:57 +02:00
ras
realmode x86/64/mm: Map all kernel memory into trampoline_pgd 2021-12-08 08:46:56 +01:00
tools x86/tools: Fix objdump version check again 2021-08-26 08:37:03 -04:00
um x86: um: vdso: Add '%rcx' and '%r11' to the syscall clobber list 2023-03-11 16:26:51 +01:00
video
xen x86/xen: Fix secondary processors' FPU initialization 2023-08-08 19:48:25 +02:00
.gitignore
Kbuild
Kconfig x86/speculation: Add Kconfig option for GDS 2023-08-08 19:48:25 +02:00
Kconfig.cpu
Kconfig.debug x86, perf: Fix the dependency of the x86 insn decoder selftest 2020-01-27 14:46:45 +01:00
Makefile x86/build: Propagate $(CLANG_FLAGS) to $(REALMODE_FLAGS) 2021-05-22 10:57:16 +02:00
Makefile.um
Makefile_32.cpu