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

[Xen-changelog] [xen-unstable] vpmu: No need for two initialisation functions



# HG changeset patch
# User Dietmar Hahn <dietmar.hahn@xxxxxxxxxxxxxx>
# Date 1330523502 0
# Node ID 93d379d11cbb191735cd318b0f4aab96e170013e
# Parent  bea68a25f368b9a16af028ba6f4512306ca80bad
vpmu: No need for two initialisation functions

With the changeset 24529:87854d3bed93 we got 2 initialisation
functions for the arch specific stuff. This is no more needed.

Signed-off-by: Dietmar Hahn <dietmar.hahn@xxxxxxxxxxxxxx>
Committed-by: Keir Fraser <keir@xxxxxxx>
---


diff -r bea68a25f368 -r 93d379d11cbb xen/arch/x86/hvm/svm/vpmu.c
--- a/xen/arch/x86/hvm/svm/vpmu.c       Wed Feb 29 13:51:12 2012 +0000
+++ b/xen/arch/x86/hvm/svm/vpmu.c       Wed Feb 29 13:51:42 2012 +0000
@@ -292,14 +292,14 @@
     return 1;
 }
 
-static void amd_vpmu_initialise(struct vcpu *v)
+static int amd_vpmu_initialise(struct vcpu *v)
 {
     struct amd_vpmu_context *ctxt = NULL;
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
     uint8_t family = current_cpu_data.x86;
 
     if ( vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) )
-        return;
+        return 0;
 
     if ( counters == NULL )
     {
@@ -329,11 +329,12 @@
         gdprintk(XENLOG_WARNING, "Insufficient memory for PMU, "
             " PMU feature is unavailable on domain %d vcpu %d.\n",
             v->vcpu_id, v->domain->domain_id);
-        return;
+        return -ENOMEM;
     }
 
     vpmu->context = (void *)ctxt;
     vpmu_set(vpmu, VPMU_CONTEXT_ALLOCATED);
+    return 0;
 }
 
 static void amd_vpmu_destroy(struct vcpu *v)
@@ -357,7 +358,6 @@
     .do_wrmsr = amd_vpmu_do_wrmsr,
     .do_rdmsr = amd_vpmu_do_rdmsr,
     .do_interrupt = amd_vpmu_do_interrupt,
-    .arch_vpmu_initialise = amd_vpmu_initialise,
     .arch_vpmu_destroy = amd_vpmu_destroy,
     .arch_vpmu_save = amd_vpmu_save,
     .arch_vpmu_load = amd_vpmu_restore
@@ -375,7 +375,7 @@
     case 0x14:
     case 0x15:
         vpmu->arch_vpmu_ops = &amd_vpmu_ops;
-        return 0;
+        return amd_vpmu_initialise(v);
     }
 
     printk("VPMU: Initialization failed. "
diff -r bea68a25f368 -r 93d379d11cbb xen/arch/x86/hvm/vmx/vpmu_core2.c
--- a/xen/arch/x86/hvm/vmx/vpmu_core2.c Wed Feb 29 13:51:12 2012 +0000
+++ b/xen/arch/x86/hvm/vmx/vpmu_core2.c Wed Feb 29 13:51:42 2012 +0000
@@ -583,9 +583,10 @@
     return 1;
 }
 
-static void core2_vpmu_initialise(struct vcpu *v)
+static int core2_vpmu_initialise(struct vcpu *v)
 {
     check_pmc_quirk();
+    return 0;
 }
 
 static void core2_vpmu_destroy(struct vcpu *v)
@@ -607,7 +608,6 @@
     .do_wrmsr = core2_vpmu_do_wrmsr,
     .do_rdmsr = core2_vpmu_do_rdmsr,
     .do_interrupt = core2_vpmu_do_interrupt,
-    .arch_vpmu_initialise = core2_vpmu_initialise,
     .arch_vpmu_destroy = core2_vpmu_destroy,
     .arch_vpmu_save = core2_vpmu_save,
     .arch_vpmu_load = core2_vpmu_load
@@ -633,7 +633,7 @@
         case 47:
         case 58:
             vpmu->arch_vpmu_ops = &core2_vpmu_ops;
-            return 0;
+            return core2_vpmu_initialise(v);
         }
     }
 
diff -r bea68a25f368 -r 93d379d11cbb xen/arch/x86/hvm/vpmu.c
--- a/xen/arch/x86/hvm/vpmu.c   Wed Feb 29 13:51:12 2012 +0000
+++ b/xen/arch/x86/hvm/vpmu.c   Wed Feb 29 13:51:42 2012 +0000
@@ -88,6 +88,8 @@
 
     if ( vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) )
         vpmu_destroy(v);
+    vpmu_clear(vpmu);
+    vpmu->context = NULL;
 
     switch ( vendor )
     {
@@ -107,13 +109,6 @@
         opt_vpmu_enabled = 0;
         break;
     }
-
-    if ( vpmu->arch_vpmu_ops != NULL )
-    {
-        vpmu_clear(vpmu);
-        vpmu->context = NULL;
-        vpmu->arch_vpmu_ops->arch_vpmu_initialise(v);
-    }
 }
 
 void vpmu_destroy(struct vcpu *v)
diff -r bea68a25f368 -r 93d379d11cbb xen/include/asm-x86/hvm/vpmu.h
--- a/xen/include/asm-x86/hvm/vpmu.h    Wed Feb 29 13:51:12 2012 +0000
+++ b/xen/include/asm-x86/hvm/vpmu.h    Wed Feb 29 13:51:42 2012 +0000
@@ -40,7 +40,6 @@
     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 (*arch_vpmu_initialise)(struct vcpu *v);
     void (*arch_vpmu_destroy)(struct vcpu *v);
     void (*arch_vpmu_save)(struct vcpu *v);
     void (*arch_vpmu_load)(struct vcpu *v);

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


 


Rackspace

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