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-devel

[Xen-devel] [PATCH] pvcpuid: mask TSC invariant bit for various circumst

To: "Xen-Devel (E-mail)" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] pvcpuid: mask TSC invariant bit for various circumstances
From: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>
Date: Mon, 26 Oct 2009 16:12:37 -0700 (PDT)
Delivery-date: Mon, 26 Oct 2009 16:13:30 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
pvcpuid: mask TSC invariant bit for PV domains if migration
is not disabled and TSC is not emulated

(Need similar patch for HVM domain)

Signed-off-by: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>

diff -r d7d7f978d704 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Tue Oct 20 14:36:01 2009 +0100
+++ b/xen/arch/x86/domain.c     Mon Oct 26 16:13:43 2009 -0600
@@ -51,6 +51,7 @@
 #include <asm/nmi.h>
 #include <xen/numa.h>
 #include <xen/iommu.h>
+#include <public/arch-x86/cpuid.h>
 #ifdef CONFIG_COMPAT
 #include <compat/vcpu.h>
 #endif
@@ -2044,6 +2045,13 @@ void domain_cpuid(
             *ebx = cpuid->ebx;
             *ecx = cpuid->ecx;
             *edx = cpuid->edx;
+            if ( input == XEN_CPUID_APM_FUNCTION )
+            {
+                /* mask TSC invariant bit if migration is not disabled
+                   and TSC is not emulated */
+                if ( !d->disable_migrate && !d->arch.vtsc )
+                    *edx &= ~XEN_CPUID_APM_EDX_TSC_INVARIANT;
+            }
             return;
         }
     }
diff -r d7d7f978d704 xen/include/public/arch-x86/cpuid.h
--- a/xen/include/public/arch-x86/cpuid.h       Tue Oct 20 14:36:01 2009 +0100
+++ b/xen/include/public/arch-x86/cpuid.h       Mon Oct 26 16:13:43 2009 -0600
@@ -65,4 +65,8 @@
 #define _XEN_CPUID_FEAT1_MMU_PT_UPDATE_PRESERVE_AD 0
 #define XEN_CPUID_FEAT1_MMU_PT_UPDATE_PRESERVE_AD  (1u<<0)
 
+/* Does the host support TSC Invariance (in Advanced Power Management)? */
+#define XEN_CPUID_APM_FUNCTION          0x80000007
+#define XEN_CPUID_APM_EDX_TSC_INVARIANT (1u<<8)
+
 #endif /* __XEN_PUBLIC_ARCH_X86_CPUID_H__ */

Attachment: cpuid-invariant.patch
Description: Binary data

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