[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] vpmu: No need for two initialisation functions
Hi, with the changeset 24529:87854d3bed93 we got 2 initialisation functions for the arch specific stuff. This is no more needed. Dietmar. Signed-off-by: Dietmar Hahn <dietmar.hahn@xxxxxxxxxxxxxx> # HG changeset patch # Parent 8082ad2fc6e3705776a4a4b64982c8b49d162c27 diff -r 8082ad2fc6e3 xen/arch/x86/hvm/svm/vpmu.c --- a/xen/arch/x86/hvm/svm/vpmu.c Wed Feb 29 13:50:57 2012 +0100 +++ b/xen/arch/x86/hvm/svm/vpmu.c Wed Feb 29 14:04:42 2012 +0100 @@ -292,14 +292,14 @@ static int amd_vpmu_do_rdmsr(unsigned in 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 @@ static void amd_vpmu_initialise(struct v 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 @@ struct arch_vpmu_ops amd_vpmu_ops = { .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 @@ int svm_vpmu_initialise(struct vcpu *v) case 0x14: case 0x15: vpmu->arch_vpmu_ops = &amd_vpmu_ops; - return 0; + return amd_vpmu_initialise(v); } printk("VPMU: Initialization failed. " diff -r 8082ad2fc6e3 xen/arch/x86/hvm/vmx/vpmu_core2.c --- a/xen/arch/x86/hvm/vmx/vpmu_core2.c Wed Feb 29 13:50:57 2012 +0100 +++ b/xen/arch/x86/hvm/vmx/vpmu_core2.c Wed Feb 29 14:04:42 2012 +0100 @@ -583,9 +583,10 @@ static int core2_vpmu_do_interrupt(struc 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 @@ 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, - .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 @@ int vmx_vpmu_initialise(struct vcpu *v) case 47: case 58: vpmu->arch_vpmu_ops = &core2_vpmu_ops; - return 0; + return core2_vpmu_initialise(v); } } diff -r 8082ad2fc6e3 xen/arch/x86/hvm/vpmu.c --- a/xen/arch/x86/hvm/vpmu.c Wed Feb 29 13:50:57 2012 +0100 +++ b/xen/arch/x86/hvm/vpmu.c Wed Feb 29 14:04:42 2012 +0100 @@ -88,6 +88,8 @@ void vpmu_initialise(struct vcpu *v) if ( vpmu_is_set(vpmu, VPMU_CONTEXT_ALLOCATED) ) vpmu_destroy(v); + vpmu_clear(vpmu); + vpmu->context = NULL; switch ( vendor ) { @@ -107,13 +109,6 @@ void vpmu_initialise(struct vcpu *v) 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 8082ad2fc6e3 xen/include/asm-x86/hvm/vpmu.h --- a/xen/include/asm-x86/hvm/vpmu.h Wed Feb 29 13:50:57 2012 +0100 +++ b/xen/include/asm-x86/hvm/vpmu.h Wed Feb 29 14:04:42 2012 +0100 @@ -40,7 +40,6 @@ 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 (*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); -- Company details: http://ts.fujitsu.com/imprint.html _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |