Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: vmx: obey KVM_QUIRK_CD_NW_CLEARED

OVMF depends on WB to boot fast, because it only clears caches after
it has set up MTRRs---which is too late.

Let's do writeback if CR0.CD is set to make it happy, similar to what
SVM is already doing.

Signed-off-by: Xiao Guangrong <guangrong.xiao@intel.com>
Tested-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

authored by

Xiao Guangrong and committed by
Paolo Bonzini
fb279950 41dbc6bc

+4 -1
+4 -1
arch/x86/kvm/vmx.c
··· 8650 8650 8651 8651 if (kvm_read_cr0(vcpu) & X86_CR0_CD) { 8652 8652 ipat = VMX_EPT_IPAT_BIT; 8653 - cache = MTRR_TYPE_UNCACHABLE; 8653 + if (kvm_check_has_quirk(vcpu->kvm, KVM_QUIRK_CD_NW_CLEARED)) 8654 + cache = MTRR_TYPE_WRBACK; 8655 + else 8656 + cache = MTRR_TYPE_UNCACHABLE; 8654 8657 goto exit; 8655 8658 } 8656 8659