OSDN Git Service

KVM: x86: apply guest MTRR virtualization on host reserved pages
[uclinux-h8/linux.git] / arch / x86 / kvm / svm.c
index d36cfaf..bbc678a 100644 (file)
@@ -1166,14 +1166,11 @@ static u64 svm_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio)
        u8 mtrr;
 
        /*
-        * 1. MMIO: always map as UC
+        * 1. MMIO: trust guest MTRR, so same as item 3.
         * 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)
-               return _PAGE_NOCACHE;
-
-       if (!kvm_arch_has_assigned_device(vcpu->kvm))
+       if (!is_mmio && !kvm_arch_has_assigned_device(vcpu->kvm))
                return 0;
 
        mtrr = kvm_mtrr_get_guest_memory_type(vcpu, gfn);