[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] vpmu: separate architecture specific PMU initialisation
# HG changeset patch # User Dietmar Hahn <dietmar.hahn@xxxxxxxxxxxxxx> # Date 1327056016 0 # Node ID 87854d3bed930a7f33fee126da943d044a144e12 # Parent 3d58058fc7a2ebda9c2add654c917b9f2c1b12e6 vpmu: separate architecture specific PMU initialisation This patch moves the architecture specific initialisation of the PMU into the archicture specific directory. Signed-off-by: Dietmar Hahn <dietmar.hahn@xxxxxxxxxxxxxx> Signed-off-by: Keir Fraser <keir@xxxxxxx> Committed-by: Keir Fraser <keir@xxxxxxx> --- diff -r 3d58058fc7a2 -r 87854d3bed93 xen/arch/x86/hvm/svm/vpmu.c --- a/xen/arch/x86/hvm/svm/vpmu.c Fri Jan 20 10:26:57 2012 +0000 +++ b/xen/arch/x86/hvm/svm/vpmu.c Fri Jan 20 10:40:16 2012 +0000 @@ -296,7 +296,7 @@ { struct amd_vpmu_context *ctxt = NULL; struct vpmu_struct *vpmu = vcpu_vpmu(v); - __u8 family = current_cpu_data.x86; + uint8_t family = current_cpu_data.x86; if ( vpmu->flags & VPMU_CONTEXT_ALLOCATED ) return; @@ -362,3 +362,25 @@ .arch_vpmu_save = amd_vpmu_save, .arch_vpmu_load = amd_vpmu_restore }; + +int svm_vpmu_initialise(struct vcpu *v) +{ + struct vpmu_struct *vpmu = vcpu_vpmu(v); + uint8_t family = current_cpu_data.x86; + + switch ( family ) + { + case 0x10: + case 0x12: + case 0x14: + case 0x15: + vpmu->arch_vpmu_ops = &amd_vpmu_ops; + return 0; + } + + printk("VPMU: Initialization failed. " + "AMD processor family %d has not " + "been supported\n", family); + return -EINVAL; +} + diff -r 3d58058fc7a2 -r 87854d3bed93 xen/arch/x86/hvm/vmx/vpmu_core2.c --- a/xen/arch/x86/hvm/vmx/vpmu_core2.c Fri Jan 20 10:26:57 2012 +0000 +++ b/xen/arch/x86/hvm/vmx/vpmu_core2.c Fri Jan 20 10:40:16 2012 +0000 @@ -607,3 +607,32 @@ .arch_vpmu_save = core2_vpmu_save, .arch_vpmu_load = core2_vpmu_load }; + +int vmx_vpmu_initialise(struct vcpu *v) +{ + struct vpmu_struct *vpmu = vcpu_vpmu(v); + uint8_t family = current_cpu_data.x86; + uint8_t cpu_model = current_cpu_data.x86_model; + + if ( family == 6 ) + { + switch ( cpu_model ) + { + case 15: + case 23: + case 26: + case 29: + case 42: + case 46: + case 47: + vpmu->arch_vpmu_ops = &core2_vpmu_ops; + return 0; + } + } + + printk("VPMU: Initialization failed. " + "Intel processor family %d model %d has not " + "been supported\n", family, cpu_model); + return -EINVAL; +} + diff -r 3d58058fc7a2 -r 87854d3bed93 xen/arch/x86/hvm/vpmu.c --- a/xen/arch/x86/hvm/vpmu.c Fri Jan 20 10:26:57 2012 +0000 +++ b/xen/arch/x86/hvm/vpmu.c Fri Jan 20 10:40:16 2012 +0000 @@ -81,9 +81,7 @@ void vpmu_initialise(struct vcpu *v) { struct vpmu_struct *vpmu = vcpu_vpmu(v); - __u8 vendor = current_cpu_data.x86_vendor; - __u8 family = current_cpu_data.x86; - __u8 cpu_model = current_cpu_data.x86_model; + uint8_t vendor = current_cpu_data.x86_vendor; if ( !opt_vpmu_enabled ) return; @@ -94,47 +92,19 @@ switch ( vendor ) { case X86_VENDOR_AMD: - switch ( family ) - { - case 0x10: - case 0x12: - case 0x14: - case 0x15: - vpmu->arch_vpmu_ops = &amd_vpmu_ops; - break; - default: - printk("VPMU: Initialization failed. " - "AMD processor family %d has not " - "been supported\n", family); - return; - } + if ( svm_vpmu_initialise(v) != 0 ) + opt_vpmu_enabled = 0; break; case X86_VENDOR_INTEL: - if ( family == 6 ) - { - switch ( cpu_model ) - { - case 15: - case 23: - case 26: - case 29: - case 42: - case 46: - case 47: - vpmu->arch_vpmu_ops = &core2_vpmu_ops; - break; - } - } - if ( vpmu->arch_vpmu_ops == NULL ) - printk("VPMU: Initialization failed. " - "Intel processor family %d model %d has not " - "been supported\n", family, cpu_model); + if ( vmx_vpmu_initialise(v) != 0 ) + opt_vpmu_enabled = 0; break; default: printk("VPMU: Initialization failed. " "Unknown CPU vendor %d\n", vendor); + opt_vpmu_enabled = 0; break; } diff -r 3d58058fc7a2 -r 87854d3bed93 xen/include/asm-x86/hvm/vpmu.h --- a/xen/include/asm-x86/hvm/vpmu.h Fri Jan 20 10:26:57 2012 +0000 +++ b/xen/include/asm-x86/hvm/vpmu.h Fri Jan 20 10:40:16 2012 +0000 @@ -56,8 +56,8 @@ void (*arch_vpmu_load)(struct vcpu *v); }; -extern struct arch_vpmu_ops core2_vpmu_ops; -extern struct arch_vpmu_ops amd_vpmu_ops; +int vmx_vpmu_initialise(struct vcpu *v); +int svm_vpmu_initialise(struct vcpu *v); struct vpmu_struct { u32 flags; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |