render / rpms / qemu

Forked from rpms/qemu 10 months ago
Clone

Blame qemu-avoid-harmless-msr-warnings.patch

Mark McLoughlin e37615
From d283d5a65a2bdcc570065267be21848bd6fe3d78 Mon Sep 17 00:00:00 2001
Mark McLoughlin e37615
From: Marcelo Tosatti <mtosatti@redhat.com>
Mark McLoughlin e37615
Date: Thu, 7 May 2009 15:48:48 -0300
Mark McLoughlin e37615
Subject: [PATCH 1/1] Avoid harmless unhandled wrmsr 0xc0010117 messages
Mark McLoughlin e37615
Mark McLoughlin e37615
Olders kernel which don't contain kvm.git commit
Mark McLoughlin e37615
61a6bd672bda3b9468bf5895c1be085c4e481138 display the following message:
Mark McLoughlin e37615
Mark McLoughlin e37615
kvm: 32301: cpu0 unhandled wrmsr: 0xc0010117 data 0
Mark McLoughlin e37615
Mark McLoughlin e37615
When kvm_arch_load_regs is called. This is confusing in bug reports.
Mark McLoughlin e37615
Mark McLoughlin e37615
Avoid it by checking whether the host advertises the MSR, similarly to
Mark McLoughlin e37615
how MSR_STAR is handled.
Mark McLoughlin e37615
Mark McLoughlin e37615
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Mark McLoughlin e37615
Signed-off-by: Avi Kivity <avi@redhat.com>
Mark McLoughlin e37615
---
Mark McLoughlin e37615
 qemu-kvm-x86.c |   15 +++++++++++----
Mark McLoughlin e37615
 1 files changed, 11 insertions(+), 4 deletions(-)
Mark McLoughlin e37615
Mark McLoughlin e37615
diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
Mark McLoughlin e37615
index 98aa530..1096e65 100644
Mark McLoughlin e37615
--- a/qemu-kvm-x86.c
Mark McLoughlin e37615
+++ b/qemu-kvm-x86.c
Mark McLoughlin e37615
@@ -25,6 +25,7 @@
Mark McLoughlin e37615
 static struct kvm_msr_list *kvm_msr_list;
Mark McLoughlin e37615
 extern unsigned int kvm_shadow_memory;
Mark McLoughlin e37615
 static int kvm_has_msr_star;
Mark McLoughlin e37615
+static int kvm_has_vm_hsave_pa;
Mark McLoughlin e37615
 
Mark McLoughlin e37615
 static int lm_capable_kernel;
Mark McLoughlin e37615
 
Mark McLoughlin e37615
@@ -54,10 +55,14 @@ int kvm_arch_qemu_create_context(void)
Mark McLoughlin e37615
     kvm_msr_list = kvm_get_msr_list(kvm_context);
Mark McLoughlin e37615
     if (!kvm_msr_list)
Mark McLoughlin e37615
 		return -1;
Mark McLoughlin e37615
-    for (i = 0; i < kvm_msr_list->nmsrs; ++i)
Mark McLoughlin e37615
+    for (i = 0; i < kvm_msr_list->nmsrs; ++i) {
Mark McLoughlin e37615
 	if (kvm_msr_list->indices[i] == MSR_STAR)
Mark McLoughlin e37615
 	    kvm_has_msr_star = 1;
Mark McLoughlin e37615
-	return 0;
Mark McLoughlin e37615
+        if (kvm_msr_list->indices[i] == MSR_VM_HSAVE_PA)
Mark McLoughlin e37615
+            kvm_has_vm_hsave_pa = 1;
Mark McLoughlin e37615
+    }
Mark McLoughlin e37615
+
Mark McLoughlin e37615
+    return 0;
Mark McLoughlin e37615
 }
Mark McLoughlin e37615
 
Mark McLoughlin e37615
 static void set_msr_entry(struct kvm_msr_entry *entry, uint32_t index,
Mark McLoughlin e37615
@@ -260,7 +265,8 @@ void kvm_arch_load_regs(CPUState *env)
Mark McLoughlin e37615
     set_msr_entry(&msrs[n++], MSR_IA32_SYSENTER_EIP, env->sysenter_eip);
Mark McLoughlin e37615
     if (kvm_has_msr_star)
Mark McLoughlin e37615
 	set_msr_entry(&msrs[n++], MSR_STAR,              env->star);
Mark McLoughlin e37615
-    set_msr_entry(&msrs[n++], MSR_VM_HSAVE_PA, env->vm_hsave);
Mark McLoughlin e37615
+    if (kvm_has_vm_hsave_pa)
Mark McLoughlin e37615
+        set_msr_entry(&msrs[n++], MSR_VM_HSAVE_PA, env->vm_hsave);
Mark McLoughlin e37615
 #ifdef TARGET_X86_64
Mark McLoughlin e37615
     if (lm_capable_kernel) {
Mark McLoughlin e37615
         set_msr_entry(&msrs[n++], MSR_CSTAR,             env->cstar);
Mark McLoughlin e37615
@@ -435,7 +441,8 @@ void kvm_arch_save_regs(CPUState *env)
Mark McLoughlin e37615
     if (kvm_has_msr_star)
Mark McLoughlin e37615
 	msrs[n++].index = MSR_STAR;
Mark McLoughlin e37615
     msrs[n++].index = MSR_IA32_TSC;
Mark McLoughlin e37615
-    msrs[n++].index = MSR_VM_HSAVE_PA;
Mark McLoughlin e37615
+    if (kvm_has_vm_hsave_pa)
Mark McLoughlin e37615
+        msrs[n++].index = MSR_VM_HSAVE_PA;
Mark McLoughlin e37615
 #ifdef TARGET_X86_64
Mark McLoughlin e37615
     if (lm_capable_kernel) {
Mark McLoughlin e37615
         msrs[n++].index = MSR_CSTAR;
Mark McLoughlin e37615
-- 
Mark McLoughlin e37615
1.6.0.6
Mark McLoughlin e37615