WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] HVM RDTSCP fixes

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] HVM RDTSCP fixes
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 16 Dec 2009 06:00:27 -0800
Delivery-date: Wed, 16 Dec 2009 06:00:52 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1260966201 0
# Node ID 976d679b04fbcf8c64aff958fc0dd9f1ade09250
# Parent  91ec068176323568191f27e6c001085bd2bb242d
HVM RDTSCP fixes
 - Put the guest rdtscp cpuid logic in xc_cpuid_x86.c.
 - MSR_TSC_AUX's high 32bit is reserved, so only write the low 32bit.

Signed-off-by: Dongxiao Xu <dongxiao.xu@xxxxxxxxx>
---
 tools/libxc/xc_cpuid_x86.c |    3 ++-
 xen/arch/x86/hvm/vmx/vmx.c |   19 +++++++++----------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff -r 91ec06817632 -r 976d679b04fb tools/libxc/xc_cpuid_x86.c
--- a/tools/libxc/xc_cpuid_x86.c        Wed Dec 16 12:21:43 2009 +0000
+++ b/tools/libxc/xc_cpuid_x86.c        Wed Dec 16 12:23:21 2009 +0000
@@ -136,7 +136,8 @@ static void intel_xc_cpuid_policy(
         regs[2] &= (is_64bit ? bitmaskof(X86_FEATURE_LAHF_LM) : 0);
         regs[3] &= ((is_pae ? bitmaskof(X86_FEATURE_NX) : 0) |
                     (is_64bit ? bitmaskof(X86_FEATURE_LM) : 0) |
-                    (is_64bit ? bitmaskof(X86_FEATURE_SYSCALL) : 0));
+                    (is_64bit ? bitmaskof(X86_FEATURE_SYSCALL) : 0) |
+                    (is_64bit ? bitmaskof(X86_FEATURE_RDTSCP) : 0));
         break;
     }
 
diff -r 91ec06817632 -r 976d679b04fb xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Wed Dec 16 12:21:43 2009 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Wed Dec 16 12:23:21 2009 +0000
@@ -292,7 +292,7 @@ static enum handler_return long_mode_do_
         {
             struct vmx_msr_state *guest_state = &v->arch.hvm_vmx.msr_state;
             guest_state->msrs[VMX_INDEX_MSR_TSC_AUX] = msr_content;
-            wrmsrl(MSR_TSC_AUX, msr_content);
+            wrmsrl(MSR_TSC_AUX, (uint32_t)msr_content);
         }
         else
         {
@@ -333,7 +333,8 @@ static void vmx_restore_host_msrs(void)
     }
 
     if ( cpu_has_rdtscp )
-        wrmsrl(MSR_TSC_AUX, host_msr_state->msrs[VMX_INDEX_MSR_TSC_AUX]);
+        wrmsrl(MSR_TSC_AUX,
+               (uint32_t)host_msr_state->msrs[VMX_INDEX_MSR_TSC_AUX]);
 }
 
 static void vmx_save_guest_msrs(struct vcpu *v)
@@ -383,7 +384,8 @@ static void vmx_restore_guest_msrs(struc
     }
 
     if ( cpu_has_rdtscp )
-        wrmsrl(MSR_TSC_AUX, guest_msr_state->msrs[VMX_INDEX_MSR_TSC_AUX]);
+        wrmsrl(MSR_TSC_AUX,
+               (uint32_t)guest_msr_state->msrs[VMX_INDEX_MSR_TSC_AUX]);
 }
 
 #else  /* __i386__ */
@@ -627,6 +629,8 @@ static void vmx_save_cpu_state(struct vc
     data->msr_syscall_mask = guest_state->msrs[VMX_INDEX_MSR_SYSCALL_MASK];
     if ( cpu_has_rdtscp )
         data->msr_tsc_aux = guest_state->msrs[VMX_INDEX_MSR_TSC_AUX];
+    else
+        data->msr_tsc_aux = 0;
 #endif
 
     data->tsc = hvm_get_guest_tsc(v);
@@ -647,6 +651,8 @@ static void vmx_load_cpu_state(struct vc
     v->arch.hvm_vmx.shadow_gs = data->shadow_gs;
     if ( cpu_has_rdtscp )
         guest_state->msrs[VMX_INDEX_MSR_TSC_AUX] = data->msr_tsc_aux;
+    else
+        guest_state->msrs[VMX_INDEX_MSR_TSC_AUX] = 0;
 #endif
 
     hvm_set_guest_tsc(v, data->tsc);
@@ -1563,13 +1569,6 @@ static void vmx_cpuid_intercept(
             else
                 *edx &= ~(bitmaskof(X86_FEATURE_SYSCALL));
 
-#ifdef __x86_64__
-            if ( cpu_has_rdtscp )
-                *edx |= bitmaskof(X86_FEATURE_RDTSCP);
-            else
-                *edx &= ~(bitmaskof(X86_FEATURE_RDTSCP));
-#endif
-
             break;
     }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] HVM RDTSCP fixes, Xen patchbot-unstable <=