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

[Xen-devel] [PATCH 1 of 2] V2 vpmu: Add a cpuid function


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: Dietmar Hahn <dietmar.hahn@xxxxxxxxxxxxxx>
  • Date: Wed, 07 Mar 2012 14:12:47 +0100
  • Delivery-date: Wed, 07 Mar 2012 13:13:26 +0000
  • Domainkey-signature: s=s1536a; d=ts.fujitsu.com; c=nofws; q=dns; h=X-SBRSScore:X-IronPort-AV:Received:X-IronPort-AV: Received:Received:From:To:Subject:Date:Message-ID: User-Agent:MIME-Version:Content-Transfer-Encoding: Content-Type; b=Z7A6mqmrTuw2L8Ov4wBZmYhWXNtZzHMeK9yfpAAFTif9Ruq98S6TBWGX zQs4/+HPEnv9xJ1I0SazzMwsjDXbI7+rFPeU+QSL6h+NRnJUriQeCRM1S 3bGAsX4ecIJmqHqtiQT+Jlyjyv9YgbVdB13ILknaG+9K7au63hUttDPJF 9bGydfczkknb7HHt+GhVisDbc66mqUQ2C58XdSRf/NmOmIz4cA8RQMFzh J79fIbFAWUfcGqXY+agJ1tONUhp88;
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

This patch hasn't changed from version 1.

Add a new function - do_cpuid - to the vpmu struct arch_vpmu_ops.
This permits the vpmu to set specific bits in the cpuid for the hvm guest.


Signed-off-by: Dietmar Hahn <dietmar.hahn@xxxxxxxxxxxxxx>


 xen/arch/x86/hvm/vmx/vmx.c        |   2 ++
 xen/arch/x86/hvm/vmx/vpmu_core2.c |   7 +++++++
 xen/arch/x86/hvm/vpmu.c           |  10 ++++++++++
 xen/include/asm-x86/hvm/vpmu.h    |   5 +++++
 4 files changed, 24 insertions(+), 0 deletions(-)


# HG changeset patch
# User Dietmar Hahn <dietmar.hahn@xxxxxxxxxxxxxx>
# Date 1331040247 -3600
# Node ID 313da9e9c1cc230a827d9239f7b8deb9f35c2aeb
# Parent  33659563f5897b3dabc93284252f8570ed825e63


diff -r 33659563f589 -r 313da9e9c1cc xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Fri Mar 02 12:33:25 2012 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Tue Mar 06 14:24:07 2012 +0100
@@ -1613,6 +1613,8 @@ static void vmx_cpuid_intercept(
             break;
     }
 
+    vpmu_do_cpuid(input, eax, ebx, ecx, edx);
+
     HVMTRACE_5D (CPUID, input, *eax, *ebx, *ecx, *edx);
 }
 
diff -r 33659563f589 -r 313da9e9c1cc xen/arch/x86/hvm/vmx/vpmu_core2.c
--- a/xen/arch/x86/hvm/vmx/vpmu_core2.c Fri Mar 02 12:33:25 2012 +0000
+++ b/xen/arch/x86/hvm/vmx/vpmu_core2.c Tue Mar 06 14:24:07 2012 +0100
@@ -547,6 +547,12 @@ static int core2_vpmu_do_rdmsr(unsigned 
     return 1;
 }
 
+static void core2_vpmu_do_cpuid(unsigned int input,
+                                unsigned int *eax, unsigned int *ebx,
+                                unsigned int *ecx, unsigned int *edx)
+{
+}
+
 static int core2_vpmu_do_interrupt(struct cpu_user_regs *regs)
 {
     struct vcpu *v = current;
@@ -608,6 +614,7 @@ struct arch_vpmu_ops core2_vpmu_ops = {
     .do_wrmsr = core2_vpmu_do_wrmsr,
     .do_rdmsr = core2_vpmu_do_rdmsr,
     .do_interrupt = core2_vpmu_do_interrupt,
+    .do_cpuid = core2_vpmu_do_cpuid,
     .arch_vpmu_destroy = core2_vpmu_destroy,
     .arch_vpmu_save = core2_vpmu_save,
     .arch_vpmu_load = core2_vpmu_load
diff -r 33659563f589 -r 313da9e9c1cc xen/arch/x86/hvm/vpmu.c
--- a/xen/arch/x86/hvm/vpmu.c   Fri Mar 02 12:33:25 2012 +0000
+++ b/xen/arch/x86/hvm/vpmu.c   Tue Mar 06 14:24:07 2012 +0100
@@ -62,6 +62,16 @@ int vpmu_do_interrupt(struct cpu_user_re
     return 0;
 }
 
+void vpmu_do_cpuid(unsigned int input,
+                   unsigned int *eax, unsigned int *ebx,
+                   unsigned int *ecx, unsigned int *edx)
+{
+    struct vpmu_struct *vpmu = vcpu_vpmu(current);
+
+    if ( vpmu->arch_vpmu_ops && vpmu->arch_vpmu_ops->do_cpuid)
+        vpmu->arch_vpmu_ops->do_cpuid(input, eax, ebx, ecx, edx);
+}
+
 void vpmu_save(struct vcpu *v)
 {
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
diff -r 33659563f589 -r 313da9e9c1cc xen/include/asm-x86/hvm/vpmu.h
--- a/xen/include/asm-x86/hvm/vpmu.h    Fri Mar 02 12:33:25 2012 +0000
+++ b/xen/include/asm-x86/hvm/vpmu.h    Tue Mar 06 14:24:07 2012 +0100
@@ -40,6 +40,9 @@ struct arch_vpmu_ops {
     int (*do_wrmsr)(unsigned int msr, uint64_t msr_content);
     int (*do_rdmsr)(unsigned int msr, uint64_t *msr_content);
     int (*do_interrupt)(struct cpu_user_regs *regs);
+    void (*do_cpuid)(unsigned int input,
+                     unsigned int *eax, unsigned int *ebx,
+                     unsigned int *ecx, unsigned int *edx);
     void (*arch_vpmu_destroy)(struct vcpu *v);
     void (*arch_vpmu_save)(struct vcpu *v);
     void (*arch_vpmu_load)(struct vcpu *v);
@@ -67,6 +70,8 @@ struct vpmu_struct {
 int vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content);
 int vpmu_do_rdmsr(unsigned int msr, uint64_t *msr_content);
 int vpmu_do_interrupt(struct cpu_user_regs *regs);
+void vpmu_do_cpuid(unsigned int input, unsigned int *eax, unsigned int *ebx,
+                                       unsigned int *ecx, unsigned int *edx);
 void vpmu_initialise(struct vcpu *v);
 void vpmu_destroy(struct vcpu *v);
 void vpmu_save(struct vcpu *v);

-- 
Company details: http://ts.fujitsu.com/imprint.html

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.