Commit bcc8fa83 authored by Russell King's avatar Russell King

Merge branch 'for-rmk/perf' of...

Merge branch 'for-rmk/perf' of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux into devel-stable

There's quite a lot here, most of it from Mark Rutland, who has been
working on big.LITTLE PMU support for a while now. His work also brings
us significantly closer to moving the bulk of the CPU PMU driver out
into drivers/, where it can be shared with arm64.

As part of this work, there is a small patch to perf/core, which has
been Acked-by PeterZ and doesn't conflict with tip/perf/core at present.
I've kept that patch on a separate branch, merged in here, so that the
tip guys can pull it too if any unexpected issues crop up.

Please note that there is a conflict with mainline, since we remove
perf_event_cpu.c. The correct resolution is also to remove the file,
since the changes there are already reflected in the rework (and this
resolution is already included in linux-next).
parents 4c9e0f76 74cf0bc7
...@@ -19,4 +19,11 @@ extern unsigned long perf_misc_flags(struct pt_regs *regs); ...@@ -19,4 +19,11 @@ extern unsigned long perf_misc_flags(struct pt_regs *regs);
#define perf_misc_flags(regs) perf_misc_flags(regs) #define perf_misc_flags(regs) perf_misc_flags(regs)
#endif #endif
#define perf_arch_fetch_caller_regs(regs, __ip) { \
(regs)->ARM_pc = (__ip); \
(regs)->ARM_fp = (unsigned long) __builtin_frame_address(0); \
(regs)->ARM_sp = current_stack_pointer; \
(regs)->ARM_cpsr = SVC_MODE; \
}
#endif /* __ARM_PERF_EVENT_H__ */ #endif /* __ARM_PERF_EVENT_H__ */
...@@ -24,22 +24,10 @@ ...@@ -24,22 +24,10 @@
* interrupt and passed the address of the low level handler, * interrupt and passed the address of the low level handler,
* and can be used to implement any platform specific handling * and can be used to implement any platform specific handling
* before or after calling it. * before or after calling it.
* @runtime_resume: an optional handler which will be called by the
* runtime PM framework following a call to pm_runtime_get().
* Note that if pm_runtime_get() is called more than once in
* succession this handler will only be called once.
* @runtime_suspend: an optional handler which will be called by the
* runtime PM framework following a call to pm_runtime_put().
* Note that if pm_runtime_get() is called more than once in
* succession this handler will only be called following the
* final call to pm_runtime_put() that actually disables the
* hardware.
*/ */
struct arm_pmu_platdata { struct arm_pmu_platdata {
irqreturn_t (*handle_irq)(int irq, void *dev, irqreturn_t (*handle_irq)(int irq, void *dev,
irq_handler_t pmu_handler); irq_handler_t pmu_handler);
int (*runtime_resume)(struct device *dev);
int (*runtime_suspend)(struct device *dev);
}; };
#ifdef CONFIG_HW_PERF_EVENTS #ifdef CONFIG_HW_PERF_EVENTS
...@@ -92,6 +80,7 @@ struct pmu_hw_events { ...@@ -92,6 +80,7 @@ struct pmu_hw_events {
struct arm_pmu { struct arm_pmu {
struct pmu pmu; struct pmu pmu;
cpumask_t active_irqs; cpumask_t active_irqs;
cpumask_t supported_cpus;
int *irq_affinity; int *irq_affinity;
char *name; char *name;
irqreturn_t (*handle_irq)(int irq_num, void *dev); irqreturn_t (*handle_irq)(int irq_num, void *dev);
...@@ -122,8 +111,6 @@ struct arm_pmu { ...@@ -122,8 +111,6 @@ struct arm_pmu {
#define to_arm_pmu(p) (container_of(p, struct arm_pmu, pmu)) #define to_arm_pmu(p) (container_of(p, struct arm_pmu, pmu))
extern const struct dev_pm_ops armpmu_dev_pm_ops;
int armpmu_register(struct arm_pmu *armpmu, int type); int armpmu_register(struct arm_pmu *armpmu, int type);
u64 armpmu_event_update(struct perf_event *event); u64 armpmu_event_update(struct perf_event *event);
...@@ -158,6 +145,10 @@ struct pmu_probe_info { ...@@ -158,6 +145,10 @@ struct pmu_probe_info {
#define XSCALE_PMU_PROBE(_version, _fn) \ #define XSCALE_PMU_PROBE(_version, _fn) \
PMU_PROBE(ARM_CPU_IMP_INTEL << 24 | _version, ARM_PMU_XSCALE_MASK, _fn) PMU_PROBE(ARM_CPU_IMP_INTEL << 24 | _version, ARM_PMU_XSCALE_MASK, _fn)
int arm_pmu_device_probe(struct platform_device *pdev,
const struct of_device_id *of_table,
const struct pmu_probe_info *probe_table);
#endif /* CONFIG_HW_PERF_EVENTS */ #endif /* CONFIG_HW_PERF_EVENTS */
#endif /* __ARM_PMU_H__ */ #endif /* __ARM_PMU_H__ */
...@@ -70,7 +70,9 @@ obj-$(CONFIG_CPU_PJ4) += pj4-cp0.o ...@@ -70,7 +70,9 @@ obj-$(CONFIG_CPU_PJ4) += pj4-cp0.o
obj-$(CONFIG_CPU_PJ4B) += pj4-cp0.o obj-$(CONFIG_CPU_PJ4B) += pj4-cp0.o
obj-$(CONFIG_IWMMXT) += iwmmxt.o obj-$(CONFIG_IWMMXT) += iwmmxt.o
obj-$(CONFIG_PERF_EVENTS) += perf_regs.o perf_callchain.o obj-$(CONFIG_PERF_EVENTS) += perf_regs.o perf_callchain.o
obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o perf_event_cpu.o obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o \
perf_event_xscale.o perf_event_v6.o \
perf_event_v7.o
CFLAGS_pj4-cp0.o := -marm CFLAGS_pj4-cp0.o := -marm
AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt
obj-$(CONFIG_ARM_CPU_TOPOLOGY) += topology.o obj-$(CONFIG_ARM_CPU_TOPOLOGY) += topology.o
......
This diff is collapsed.
This diff is collapsed.
...@@ -31,6 +31,14 @@ ...@@ -31,6 +31,14 @@
*/ */
#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K) #if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K)
#include <asm/cputype.h>
#include <asm/irq_regs.h>
#include <asm/pmu.h>
#include <linux/of.h>
#include <linux/platform_device.h>
enum armv6_perf_types { enum armv6_perf_types {
ARMV6_PERFCTR_ICACHE_MISS = 0x0, ARMV6_PERFCTR_ICACHE_MISS = 0x0,
ARMV6_PERFCTR_IBUF_STALL = 0x1, ARMV6_PERFCTR_IBUF_STALL = 0x1,
...@@ -543,24 +551,39 @@ static int armv6mpcore_pmu_init(struct arm_pmu *cpu_pmu) ...@@ -543,24 +551,39 @@ static int armv6mpcore_pmu_init(struct arm_pmu *cpu_pmu)
return 0; return 0;
} }
#else
static int armv6_1136_pmu_init(struct arm_pmu *cpu_pmu)
{
return -ENODEV;
}
static int armv6_1156_pmu_init(struct arm_pmu *cpu_pmu) static struct of_device_id armv6_pmu_of_device_ids[] = {
{ {.compatible = "arm,arm11mpcore-pmu", .data = armv6mpcore_pmu_init},
return -ENODEV; {.compatible = "arm,arm1176-pmu", .data = armv6_1176_pmu_init},
} {.compatible = "arm,arm1136-pmu", .data = armv6_1136_pmu_init},
{ /* sentinel value */ }
};
static int armv6_1176_pmu_init(struct arm_pmu *cpu_pmu) static const struct pmu_probe_info armv6_pmu_probe_table[] = {
ARM_PMU_PROBE(ARM_CPU_PART_ARM1136, armv6_1136_pmu_init),
ARM_PMU_PROBE(ARM_CPU_PART_ARM1156, armv6_1156_pmu_init),
ARM_PMU_PROBE(ARM_CPU_PART_ARM1176, armv6_1176_pmu_init),
ARM_PMU_PROBE(ARM_CPU_PART_ARM11MPCORE, armv6mpcore_pmu_init),
{ /* sentinel value */ }
};
static int armv6_pmu_device_probe(struct platform_device *pdev)
{ {
return -ENODEV; return arm_pmu_device_probe(pdev, armv6_pmu_of_device_ids,
armv6_pmu_probe_table);
} }
static int armv6mpcore_pmu_init(struct arm_pmu *cpu_pmu) static struct platform_driver armv6_pmu_driver = {
.driver = {
.name = "armv6-pmu",
.of_match_table = armv6_pmu_of_device_ids,
},
.probe = armv6_pmu_device_probe,
};
static int __init register_armv6_pmu_driver(void)
{ {
return -ENODEV; return platform_driver_register(&armv6_pmu_driver);
} }
device_initcall(register_armv6_pmu_driver);
#endif /* CONFIG_CPU_V6 || CONFIG_CPU_V6K */ #endif /* CONFIG_CPU_V6 || CONFIG_CPU_V6K */
...@@ -19,9 +19,15 @@ ...@@ -19,9 +19,15 @@
#ifdef CONFIG_CPU_V7 #ifdef CONFIG_CPU_V7
#include <asm/cp15.h> #include <asm/cp15.h>
#include <asm/cputype.h>
#include <asm/irq_regs.h>
#include <asm/pmu.h>
#include <asm/vfp.h> #include <asm/vfp.h>
#include "../vfp/vfpinstr.h" #include "../vfp/vfpinstr.h"
#include <linux/of.h>
#include <linux/platform_device.h>
/* /*
* Common ARMv7 event types * Common ARMv7 event types
* *
...@@ -1056,15 +1062,22 @@ static void armv7pmu_init(struct arm_pmu *cpu_pmu) ...@@ -1056,15 +1062,22 @@ static void armv7pmu_init(struct arm_pmu *cpu_pmu)
cpu_pmu->max_period = (1LLU << 32) - 1; cpu_pmu->max_period = (1LLU << 32) - 1;
}; };
static u32 armv7_read_num_pmnc_events(void) static void armv7_read_num_pmnc_events(void *info)
{ {
u32 nb_cnt; int *nb_cnt = info;
/* Read the nb of CNTx counters supported from PMNC */ /* Read the nb of CNTx counters supported from PMNC */
nb_cnt = (armv7_pmnc_read() >> ARMV7_PMNC_N_SHIFT) & ARMV7_PMNC_N_MASK; *nb_cnt = (armv7_pmnc_read() >> ARMV7_PMNC_N_SHIFT) & ARMV7_PMNC_N_MASK;
/* Add the CPU cycles counter and return */ /* Add the CPU cycles counter */
return nb_cnt + 1; *nb_cnt += 1;
}
static int armv7_probe_num_events(struct arm_pmu *arm_pmu)
{
return smp_call_function_any(&arm_pmu->supported_cpus,
armv7_read_num_pmnc_events,
&arm_pmu->num_events, 1);
} }
static int armv7_a8_pmu_init(struct arm_pmu *cpu_pmu) static int armv7_a8_pmu_init(struct arm_pmu *cpu_pmu)
...@@ -1072,8 +1085,7 @@ static int armv7_a8_pmu_init(struct arm_pmu *cpu_pmu) ...@@ -1072,8 +1085,7 @@ static int armv7_a8_pmu_init(struct arm_pmu *cpu_pmu)
armv7pmu_init(cpu_pmu); armv7pmu_init(cpu_pmu);
cpu_pmu->name = "armv7_cortex_a8"; cpu_pmu->name = "armv7_cortex_a8";
cpu_pmu->map_event = armv7_a8_map_event; cpu_pmu->map_event = armv7_a8_map_event;
cpu_pmu->num_events = armv7_read_num_pmnc_events(); return armv7_probe_num_events(cpu_pmu);
return 0;
} }
static int armv7_a9_pmu_init(struct arm_pmu *cpu_pmu) static int armv7_a9_pmu_init(struct arm_pmu *cpu_pmu)
...@@ -1081,8 +1093,7 @@ static int armv7_a9_pmu_init(struct arm_pmu *cpu_pmu) ...@@ -1081,8 +1093,7 @@ static int armv7_a9_pmu_init(struct arm_pmu *cpu_pmu)
armv7pmu_init(cpu_pmu); armv7pmu_init(cpu_pmu);
cpu_pmu->name = "armv7_cortex_a9"; cpu_pmu->name = "armv7_cortex_a9";
cpu_pmu->map_event = armv7_a9_map_event; cpu_pmu->map_event = armv7_a9_map_event;
cpu_pmu->num_events = armv7_read_num_pmnc_events(); return armv7_probe_num_events(cpu_pmu);
return 0;
} }
static int armv7_a5_pmu_init(struct arm_pmu *cpu_pmu) static int armv7_a5_pmu_init(struct arm_pmu *cpu_pmu)
...@@ -1090,8 +1101,7 @@ static int armv7_a5_pmu_init(struct arm_pmu *cpu_pmu) ...@@ -1090,8 +1101,7 @@ static int armv7_a5_pmu_init(struct arm_pmu *cpu_pmu)
armv7pmu_init(cpu_pmu); armv7pmu_init(cpu_pmu);
cpu_pmu->name = "armv7_cortex_a5"; cpu_pmu->name = "armv7_cortex_a5";
cpu_pmu->map_event = armv7_a5_map_event; cpu_pmu->map_event = armv7_a5_map_event;
cpu_pmu->num_events = armv7_read_num_pmnc_events(); return armv7_probe_num_events(cpu_pmu);
return 0;
} }
static int armv7_a15_pmu_init(struct arm_pmu *cpu_pmu) static int armv7_a15_pmu_init(struct arm_pmu *cpu_pmu)
...@@ -1099,9 +1109,8 @@ static int armv7_a15_pmu_init(struct arm_pmu *cpu_pmu) ...@@ -1099,9 +1109,8 @@ static int armv7_a15_pmu_init(struct arm_pmu *cpu_pmu)
armv7pmu_init(cpu_pmu); armv7pmu_init(cpu_pmu);
cpu_pmu->name = "armv7_cortex_a15"; cpu_pmu->name = "armv7_cortex_a15";
cpu_pmu->map_event = armv7_a15_map_event; cpu_pmu->map_event = armv7_a15_map_event;
cpu_pmu->num_events = armv7_read_num_pmnc_events();
cpu_pmu->set_event_filter = armv7pmu_set_event_filter; cpu_pmu->set_event_filter = armv7pmu_set_event_filter;
return 0; return armv7_probe_num_events(cpu_pmu);
} }
static int armv7_a7_pmu_init(struct arm_pmu *cpu_pmu) static int armv7_a7_pmu_init(struct arm_pmu *cpu_pmu)
...@@ -1109,9 +1118,8 @@ static int armv7_a7_pmu_init(struct arm_pmu *cpu_pmu) ...@@ -1109,9 +1118,8 @@ static int armv7_a7_pmu_init(struct arm_pmu *cpu_pmu)
armv7pmu_init(cpu_pmu); armv7pmu_init(cpu_pmu);
cpu_pmu->name = "armv7_cortex_a7"; cpu_pmu->name = "armv7_cortex_a7";
cpu_pmu->map_event = armv7_a7_map_event; cpu_pmu->map_event = armv7_a7_map_event;
cpu_pmu->num_events = armv7_read_num_pmnc_events();
cpu_pmu->set_event_filter = armv7pmu_set_event_filter; cpu_pmu->set_event_filter = armv7pmu_set_event_filter;
return 0; return armv7_probe_num_events(cpu_pmu);
} }
static int armv7_a12_pmu_init(struct arm_pmu *cpu_pmu) static int armv7_a12_pmu_init(struct arm_pmu *cpu_pmu)
...@@ -1119,16 +1127,15 @@ static int armv7_a12_pmu_init(struct arm_pmu *cpu_pmu) ...@@ -1119,16 +1127,15 @@ static int armv7_a12_pmu_init(struct arm_pmu *cpu_pmu)
armv7pmu_init(cpu_pmu); armv7pmu_init(cpu_pmu);
cpu_pmu->name = "armv7_cortex_a12"; cpu_pmu->name = "armv7_cortex_a12";
cpu_pmu->map_event = armv7_a12_map_event; cpu_pmu->map_event = armv7_a12_map_event;
cpu_pmu->num_events = armv7_read_num_pmnc_events();
cpu_pmu->set_event_filter = armv7pmu_set_event_filter; cpu_pmu->set_event_filter = armv7pmu_set_event_filter;
return 0; return armv7_probe_num_events(cpu_pmu);
} }
static int armv7_a17_pmu_init(struct arm_pmu *cpu_pmu) static int armv7_a17_pmu_init(struct arm_pmu *cpu_pmu)
{ {
armv7_a12_pmu_init(cpu_pmu); int ret = armv7_a12_pmu_init(cpu_pmu);
cpu_pmu->name = "armv7_cortex_a17"; cpu_pmu->name = "armv7_cortex_a17";
return 0; return ret;
} }
/* /*
...@@ -1508,14 +1515,13 @@ static int krait_pmu_init(struct arm_pmu *cpu_pmu) ...@@ -1508,14 +1515,13 @@ static int krait_pmu_init(struct arm_pmu *cpu_pmu)
cpu_pmu->map_event = krait_map_event_no_branch; cpu_pmu->map_event = krait_map_event_no_branch;
else else
cpu_pmu->map_event = krait_map_event; cpu_pmu->map_event = krait_map_event;
cpu_pmu->num_events = armv7_read_num_pmnc_events();
cpu_pmu->set_event_filter = armv7pmu_set_event_filter; cpu_pmu->set_event_filter = armv7pmu_set_event_filter;
cpu_pmu->reset = krait_pmu_reset; cpu_pmu->reset = krait_pmu_reset;
cpu_pmu->enable = krait_pmu_enable_event; cpu_pmu->enable = krait_pmu_enable_event;
cpu_pmu->disable = krait_pmu_disable_event; cpu_pmu->disable = krait_pmu_disable_event;
cpu_pmu->get_event_idx = krait_pmu_get_event_idx; cpu_pmu->get_event_idx = krait_pmu_get_event_idx;
cpu_pmu->clear_event_idx = krait_pmu_clear_event_idx; cpu_pmu->clear_event_idx = krait_pmu_clear_event_idx;
return 0; return armv7_probe_num_events(cpu_pmu);
} }
/* /*
...@@ -1833,13 +1839,12 @@ static int scorpion_pmu_init(struct arm_pmu *cpu_pmu) ...@@ -1833,13 +1839,12 @@ static int scorpion_pmu_init(struct arm_pmu *cpu_pmu)
armv7pmu_init(cpu_pmu); armv7pmu_init(cpu_pmu);
cpu_pmu->name = "armv7_scorpion"; cpu_pmu->name = "armv7_scorpion";
cpu_pmu->map_event = scorpion_map_event; cpu_pmu->map_event = scorpion_map_event;
cpu_pmu->num_events = armv7_read_num_pmnc_events();
cpu_pmu->reset = scorpion_pmu_reset; cpu_pmu->reset = scorpion_pmu_reset;
cpu_pmu->enable = scorpion_pmu_enable_event; cpu_pmu->enable = scorpion_pmu_enable_event;
cpu_pmu->disable = scorpion_pmu_disable_event; cpu_pmu->disable = scorpion_pmu_disable_event;
cpu_pmu->get_event_idx = scorpion_pmu_get_event_idx; cpu_pmu->get_event_idx = scorpion_pmu_get_event_idx;
cpu_pmu->clear_event_idx = scorpion_pmu_clear_event_idx; cpu_pmu->clear_event_idx = scorpion_pmu_clear_event_idx;
return 0; return armv7_probe_num_events(cpu_pmu);
} }
static int scorpion_mp_pmu_init(struct arm_pmu *cpu_pmu) static int scorpion_mp_pmu_init(struct arm_pmu *cpu_pmu)
...@@ -1847,62 +1852,52 @@ static int scorpion_mp_pmu_init(struct arm_pmu *cpu_pmu) ...@@ -1847,62 +1852,52 @@ static int scorpion_mp_pmu_init(struct arm_pmu *cpu_pmu)
armv7pmu_init(cpu_pmu); armv7pmu_init(cpu_pmu);
cpu_pmu->name = "armv7_scorpion_mp"; cpu_pmu->name = "armv7_scorpion_mp";
cpu_pmu->map_event = scorpion_map_event; cpu_pmu->map_event = scorpion_map_event;
cpu_pmu->num_events = armv7_read_num_pmnc_events();
cpu_pmu->reset = scorpion_pmu_reset; cpu_pmu->reset = scorpion_pmu_reset;
cpu_pmu->enable = scorpion_pmu_enable_event; cpu_pmu->enable = scorpion_pmu_enable_event;
cpu_pmu->disable = scorpion_pmu_disable_event; cpu_pmu->disable = scorpion_pmu_disable_event;
cpu_pmu->get_event_idx = scorpion_pmu_get_event_idx; cpu_pmu->get_event_idx = scorpion_pmu_get_event_idx;
cpu_pmu->clear_event_idx = scorpion_pmu_clear_event_idx; cpu_pmu->clear_event_idx = scorpion_pmu_clear_event_idx;
return 0; return armv7_probe_num_events(cpu_pmu);
} }
#else
static inline int armv7_a8_pmu_init(struct arm_pmu *cpu_pmu) static const struct of_device_id armv7_pmu_of_device_ids[] = {
{ {.compatible = "arm,cortex-a17-pmu", .data = armv7_a17_pmu_init},
return -ENODEV; {.compatible = "arm,cortex-a15-pmu", .data = armv7_a15_pmu_init},
} {.compatible = "arm,cortex-a12-pmu", .data = armv7_a12_pmu_init},
{.compatible = "arm,cortex-a9-pmu", .data = armv7_a9_pmu_init},
static inline int armv7_a9_pmu_init(struct arm_pmu *cpu_pmu) {.compatible = "arm,cortex-a8-pmu", .data = armv7_a8_pmu_init},
{ {.compatible = "arm,cortex-a7-pmu", .data = armv7_a7_pmu_init},
return -ENODEV; {.compatible = "arm,cortex-a5-pmu", .data = armv7_a5_pmu_init},
} {.compatible = "qcom,krait-pmu", .data = krait_pmu_init},
{.compatible = "qcom,scorpion-pmu", .data = scorpion_pmu_init},
static inline int armv7_a5_pmu_init(struct arm_pmu *cpu_pmu) {.compatible = "qcom,scorpion-mp-pmu", .data = scorpion_mp_pmu_init},
{ {},
return -ENODEV; };
}
static inline int armv7_a15_pmu_init(struct arm_pmu *cpu_pmu)
{
return -ENODEV;
}
static inline int armv7_a7_pmu_init(struct arm_pmu *cpu_pmu)
{
return -ENODEV;
}
static inline int armv7_a12_pmu_init(struct arm_pmu *cpu_pmu) static const struct pmu_probe_info armv7_pmu_probe_table[] = {
{ ARM_PMU_PROBE(ARM_CPU_PART_CORTEX_A8, armv7_a8_pmu_init),
return -ENODEV; ARM_PMU_PROBE(ARM_CPU_PART_CORTEX_A9, armv7_a9_pmu_init),
} { /* sentinel value */ }
};
static inline int armv7_a17_pmu_init(struct arm_pmu *cpu_pmu)
{
return -ENODEV;
}
static inline int krait_pmu_init(struct arm_pmu *cpu_pmu) static int armv7_pmu_device_probe(struct platform_device *pdev)
{ {
return -ENODEV; return arm_pmu_device_probe(pdev, armv7_pmu_of_device_ids,
armv7_pmu_probe_table);
} }
static inline int scorpion_pmu_init(struct arm_pmu *cpu_pmu) static struct platform_driver armv7_pmu_driver = {
{ .driver = {
return -ENODEV; .name = "armv7-pmu",
} .of_match_table = armv7_pmu_of_device_ids,
},
.probe = armv7_pmu_device_probe,
};
static inline int scorpion_mp_pmu_init(struct arm_pmu *cpu_pmu) static int __init register_armv7_pmu_driver(void)
{ {
return -ENODEV; return platform_driver_register(&armv7_pmu_driver);
} }
device_initcall(register_armv7_pmu_driver);
#endif /* CONFIG_CPU_V7 */ #endif /* CONFIG_CPU_V7 */
...@@ -13,6 +13,14 @@ ...@@ -13,6 +13,14 @@
*/ */
#ifdef CONFIG_CPU_XSCALE #ifdef CONFIG_CPU_XSCALE
#include <asm/cputype.h>
#include <asm/irq_regs.h>
#include <asm/pmu.h>
#include <linux/of.h>
#include <linux/platform_device.h>
enum xscale_perf_types { enum xscale_perf_types {
XSCALE_PERFCTR_ICACHE_MISS = 0x00, XSCALE_PERFCTR_ICACHE_MISS = 0x00,
XSCALE_PERFCTR_ICACHE_NO_DELIVER = 0x01, XSCALE_PERFCTR_ICACHE_NO_DELIVER = 0x01,
...@@ -740,14 +748,28 @@ static int xscale2pmu_init(struct arm_pmu *cpu_pmu) ...@@ -740,14 +748,28 @@ static int xscale2pmu_init(struct arm_pmu *cpu_pmu)
return 0; return 0;
} }
#else
static inline int xscale1pmu_init(struct arm_pmu *cpu_pmu) static const struct pmu_probe_info xscale_pmu_probe_table[] = {
XSCALE_PMU_PROBE(ARM_CPU_XSCALE_ARCH_V1, xscale1pmu_init),
XSCALE_PMU_PROBE(ARM_CPU_XSCALE_ARCH_V2, xscale2pmu_init),
{ /* sentinel value */ }
};
static int xscale_pmu_device_probe(struct platform_device *pdev)
{ {
return -ENODEV; return arm_pmu_device_probe(pdev, NULL, xscale_pmu_probe_table);
} }
static inline int xscale2pmu_init(struct arm_pmu *cpu_pmu) static struct platform_driver xscale_pmu_driver = {
.driver = {
.name = "xscale-pmu",
},
.probe = xscale_pmu_device_probe,
};
static int __init register_xscale_pmu_driver(void)
{ {
return -ENODEV; return platform_driver_register(&xscale_pmu_driver);
} }
device_initcall(register_xscale_pmu_driver);
#endif /* CONFIG_CPU_XSCALE */ #endif /* CONFIG_CPU_XSCALE */
...@@ -304,6 +304,11 @@ struct pmu { ...@@ -304,6 +304,11 @@ struct pmu {
* Free pmu-private AUX data structures * Free pmu-private AUX data structures
*/ */
void (*free_aux) (void *aux); /* optional */ void (*free_aux) (void *aux); /* optional */
/*
* Filter events for PMU-specific reasons.
*/
int (*filter_match) (struct perf_event *event); /* optional */
}; };
/** /**
......
...@@ -1506,11 +1506,17 @@ static int __init perf_workqueue_init(void) ...@@ -1506,11 +1506,17 @@ static int __init perf_workqueue_init(void)
core_initcall(perf_workqueue_init); core_initcall(perf_workqueue_init);
static inline int pmu_filter_match(struct perf_event *event)
{
struct pmu *pmu = event->pmu;
return pmu->filter_match ? pmu->filter_match(event) : 1;
}
static inline int static inline int
event_filter_match(struct perf_event *event) event_filter_match(struct perf_event *event)
{ {
return (event->cpu == -1 || event->cpu == smp_processor_id()) return (event->cpu == -1 || event->cpu == smp_processor_id())
&& perf_cgroup_match(event); && perf_cgroup_match(event) && pmu_filter_match(event);
} }
static void static void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment