]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - arch/x86/kvm/svm.c
Revert "KVM: x86: apply guest MTRR virtualization on host reserved pages"
[karo-tx-linux.git] / arch / x86 / kvm / svm.c
index 89173af53c84ee433a4e3f9be257afd47699a2f3..9e88078f41463aeaf51c167ecf131afe94f1a74c 100644 (file)
@@ -202,6 +202,7 @@ module_param(npt, int, S_IRUGO);
 static int nested = true;
 module_param(nested, int, S_IRUGO);
 
+static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0);
 static void svm_flush_tlb(struct kvm_vcpu *vcpu);
 static void svm_complete_interrupts(struct vcpu_svm *svm);
 
@@ -1166,11 +1167,14 @@ static u64 svm_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio)
        u8 mtrr;
 
        /*
-        * 1. MMIO: trust guest MTRR, so same as item 3.
+        * 1. MMIO: always map as UC
         * 2. No passthrough: always map as WB, and force guest PAT to WB as well
         * 3. Passthrough: can't guarantee the result, try to trust guest.
         */
-       if (!is_mmio && !kvm_arch_has_assigned_device(vcpu->kvm))
+       if (is_mmio)
+               return _PAGE_NOCACHE;
+
+       if (!kvm_arch_has_assigned_device(vcpu->kvm))
                return 0;
 
        if (!kvm_check_has_quirk(vcpu->kvm, KVM_X86_QUIRK_CD_NW_CLEARED) &&
@@ -1263,7 +1267,7 @@ static void init_vmcb(struct vcpu_svm *svm, bool init_event)
         * svm_set_cr0() sets PG and WP and clears NW and CD on save->cr0.
         * It also updates the guest-visible cr0 value.
         */
-       (void)kvm_set_cr0(&svm->vcpu, X86_CR0_NW | X86_CR0_CD | X86_CR0_ET);
+       svm_set_cr0(&svm->vcpu, X86_CR0_NW | X86_CR0_CD | X86_CR0_ET);
        kvm_mmu_reset_context(&svm->vcpu);
 
        save->cr4 = X86_CR4_PAE;