KVM: x86: Move PAT MSR handling out of mtrr.c
authorSean Christopherson <seanjc@google.com>
Thu, 11 May 2023 23:33:49 +0000 (16:33 -0700)
committerSean Christopherson <seanjc@google.com>
Thu, 1 Jun 2023 20:41:06 +0000 (13:41 -0700)
commitbc7fe2f0b7511ef6bb2765b6e1f923da449e00ef
tree3a1259acc89b6c020fa5148b97cf958ec0db2f82
parent34a83deac31cd9fdecef331578422095af2db4b0
KVM: x86: Move PAT MSR handling out of mtrr.c

Drop handling of MSR_IA32_CR_PAT from mtrr.c now that SVM and VMX handle
writes without bouncing through kvm_set_msr_common().  PAT isn't truly an
MTRR even though it affects memory types, and more importantly KVM enables
hardware virtualization of guest PAT (by NOT setting "ignore guest PAT")
when a guest has non-coherent DMA, i.e. KVM doesn't need to zap SPTEs when
the guest PAT changes.

The read path is and always has been trivial, i.e. burying it in the MTRR
code does more harm than good.

WARN and continue for the PAT case in kvm_set_msr_common(), as that code
is _currently_ reached if and only if KVM is buggy.  Defer cleaning up the
lack of symmetry between the read and write paths to a future patch.

Reviewed-by: Kai Huang <kai.huang@intel.com>
Link: https://lore.kernel.org/r/20230511233351.635053-7-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/mtrr.c
arch/x86/kvm/x86.c