KVM: MTRR: fix fixed MTRR segment look up
authorAlexis Dambricourt <alexis.dambricourt@gmail.com>
Mon, 14 Dec 2015 14:39:34 +0000 (15:39 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 22 Dec 2015 14:28:37 +0000 (15:28 +0100)
This fixes the slow-down of VM running with pci-passthrough, since some MTRR
range changed from MTRR_TYPE_WRBACK to MTRR_TYPE_UNCACHABLE.  Memory in the
0K-640K range was incorrectly treated as uncacheable.

Fixes: f7bfb57b3e89ff89c0da9f93dedab89f68d6ca27
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=107561
Cc: qemu-stable@nongnu.org
Signed-off-by: Alexis Dambricourt <alexis.dambricourt@gmail.com>
[Use correct BZ for "Fixes" annotation.  - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mtrr.c

index 9e8bf13572e6dc3f95d33d24f079d63e256a3a7a..adc54e1d40a9e161c52a41b1c8860ccf4c15b00f 100644 (file)
@@ -267,7 +267,7 @@ static int fixed_mtrr_addr_to_seg(u64 addr)
 
        for (seg = 0; seg < seg_num; seg++) {
                mtrr_seg = &fixed_seg_table[seg];
-               if (mtrr_seg->start >= addr && addr < mtrr_seg->end)
+               if (mtrr_seg->start <= addr && addr < mtrr_seg->end)
                        return seg;
        }