]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Revert "KVM: x86: apply guest MTRR virtualization on host reserved pages"
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 1 Oct 2015 11:12:47 +0000 (13:12 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 1 Oct 2015 11:30:42 +0000 (13:30 +0200)
This reverts commit fd717f11015f673487ffc826e59b2bad69d20fe5.
It was reported to cause Machine Check Exceptions (bug 104091).

Reported-by: harn-solo@gmx.de
Cc: stable@vger.kernel.org # 4.2+
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm.c
arch/x86/kvm/vmx.c

index 94b7d15db3fc91f3a70d665892f6f41832145c22..9e88078f41463aeaf51c167ecf131afe94f1a74c 100644 (file)
@@ -1167,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) &&
index 64076740251e7f3b8197fe87eeff262891ac995a..06ef4908ba61d2e25ead615953a2f42c923a9219 100644 (file)
@@ -8617,17 +8617,22 @@ static u64 vmx_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio)
        u64 ipat = 0;
 
        /* For VT-d and EPT combination
-        * 1. MMIO: guest may want to apply WC, trust it.
+        * 1. MMIO: always map as UC
         * 2. EPT with VT-d:
         *   a. VT-d without snooping control feature: can't guarantee the
-        *      result, try to trust guest.  So the same as item 1.
+        *      result, try to trust guest.
         *   b. VT-d with snooping control feature: snooping control feature of
         *      VT-d engine can guarantee the cache correctness. Just set it
         *      to WB to keep consistent with host. So the same as item 3.
         * 3. EPT without VT-d: always map as WB and set IPAT=1 to keep
         *    consistent with host MTRR
         */
-       if (!is_mmio && !kvm_arch_has_noncoherent_dma(vcpu->kvm)) {
+       if (is_mmio) {
+               cache = MTRR_TYPE_UNCACHABLE;
+               goto exit;
+       }
+
+       if (!kvm_arch_has_noncoherent_dma(vcpu->kvm)) {
                ipat = VMX_EPT_IPAT_BIT;
                cache = MTRR_TYPE_WRBACK;
                goto exit;