Skip to content

Commit

Permalink
ARM: perf: add type field to struct arm_pmu
Browse files Browse the repository at this point in the history
Currently, the ARM perf code assumes all PMUs it will handle are
CPU PMUs, having ARM_PMU_DEVICE_CPU hardcoded when reserving or
releasing hardware. This means that currently, the ARM perf code can't
support system PMUs.

This patch adds a 'type' field to struct arm_pmu, which allows the code
to reserve & release the hardware regardless of the PMU type.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Will Deacon <will.deacon@arm.com>
Reviewed-by: Jamie Iles <jamie@jamieiles.com>
Reviewed-by: Ashwin Chaugule <ashwinc@codeaurora.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
  • Loading branch information
Mark Rutland authored and Will Deacon committed Aug 31, 2011
1 parent 0f78d2d commit 7ae18a5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions arch/arm/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ static DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events);

struct arm_pmu {
enum arm_perf_pmu_ids id;
enum arm_pmu_type type;
cpumask_t active_irqs;
const char *name;
irqreturn_t (*handle_irq)(int irq_num, void *dev);
Expand Down Expand Up @@ -396,7 +397,7 @@ armpmu_release_hardware(void)
free_irq(irq, NULL);
}

release_pmu(ARM_PMU_DEVICE_CPU);
release_pmu(armpmu->type);
}

static int
Expand All @@ -407,7 +408,7 @@ armpmu_reserve_hardware(void)
int i, err, irq, irqs;
struct platform_device *pmu_device = armpmu->plat_device;

err = reserve_pmu(ARM_PMU_DEVICE_CPU);
err = reserve_pmu(armpmu->type);
if (err) {
pr_warning("unable to reserve pmu\n");
return err;
Expand Down Expand Up @@ -691,6 +692,7 @@ static void __init cpu_pmu_init(struct arm_pmu *armpmu)
raw_spin_lock_init(&events->pmu_lock);
}
armpmu->get_hw_events = armpmu_get_cpu_events;
armpmu->type = ARM_PMU_DEVICE_CPU;
}

/*
Expand Down

0 comments on commit 7ae18a5

Please sign in to comment.