Re: [PATCH master/stable-0.12/stable-0.13] kvm: reset MSR_IA32_CR_PAT correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 On 09/07/2010 04:21 PM, Avi Kivity wrote:
The power-on value of MSR_IA32_CR_PAT is not 0 - that disables cacheing and
makes everything dog slow.

Fix to reset MSR_IA32_CR_PAT to the correct value.

Signed-off-by: Avi Kivity<avi@xxxxxxxxxx>
---
  qemu-kvm-x86.c |   11 ++++++++++-
  1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
index 4c32771..e02e896 100644
--- a/qemu-kvm-x86.c
+++ b/qemu-kvm-x86.c
@@ -1289,12 +1289,21 @@ static int kvm_reset_msrs(CPUState *env)
      } msr_data;
      int n;
      struct kvm_msr_entry *msrs = msr_data.entries;
+    uint32_t index;
+    uint64_t data;

      if (!kvm_msr_list)
          return -1;

      for (n = 0; n<  kvm_msr_list->nmsrs; n++) {
-        kvm_msr_entry_set(&msrs[n], kvm_msr_list->indices[n], 0);
+        index = kvm_msr_list->indices[n];
+        switch (index) {
+        case MSR_PAT:
+            data = 0x0007040600070406ULL;
+        default:
+            data = 0;
+        }
+        kvm_msr_entry_set(&msrs[n], index, data);
      }

Note: a better fix is to read all msr values during vm creation, so we get the kernel reset values instead of making up our own. This is more future proof wrt newer msrs. But let's start with the simple fix first.

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux