Skip to content
Commit 1affe455 authored by Yan Zhao's avatar Yan Zhao Committed by Sean Christopherson
Browse files

KVM: x86/mmu: Add helpers to return if KVM honors guest MTRRs



Add helpers to check if KVM honors guest MTRRs instead of open coding the
logic in kvm_tdp_page_fault().  Future fixes and cleanups will also need
to determine if KVM should honor guest MTRRs, e.g. for CR0.CD toggling and
and non-coherent DMA transitions.

Provide an inner helper, __kvm_mmu_honors_guest_mtrrs(), so that KVM can
check if guest MTRRs were honored when stopping non-coherent DMA.

Note, there is no need to explicitly check that TDP is enabled, KVM clears
shadow_memtype_mask when TDP is disabled, i.e. it's non-zero if and only
if EPT is enabled.

Suggested-by: default avatarSean Christopherson <seanjc@google.com>
Signed-off-by: default avatarYan Zhao <yan.y.zhao@intel.com>
Link: https://lore.kernel.org/r/20230714065006.20201-1-yan.y.zhao@intel.com
Link: https://lore.kernel.org/r/20230714065043.20258-1-yan.y.zhao@intel.com


[sean: squash into a one patch, drop explicit TDP check massage changelog]
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
parent 5804c19b
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment