OSDN Git Service

arm: perf: fold hotplug notifier into arm_pmu
[uclinux-h8/linux.git] / arch / arm / include / asm / pmu.h
index 0b648c5..b1596bd 100644 (file)
@@ -15,6 +15,8 @@
 #include <linux/interrupt.h>
 #include <linux/perf_event.h>
 
+#include <asm/cputype.h>
+
 /*
  * struct arm_pmu_platdata - ARM PMU platform data
  *
@@ -66,19 +68,25 @@ struct pmu_hw_events {
        /*
         * The events that are active on the PMU for the given index.
         */
-       struct perf_event       **events;
+       struct perf_event       *events[ARMPMU_MAX_HWEVENTS];
 
        /*
         * A 1 bit for an index indicates that the counter is being used for
         * an event. A 0 means that the counter can be used.
         */
-       unsigned long           *used_mask;
+       DECLARE_BITMAP(used_mask, ARMPMU_MAX_HWEVENTS);
 
        /*
         * Hardware lock to serialize accesses to PMU registers. Needed for the
         * read/modify/write sequences.
         */
        raw_spinlock_t          pmu_lock;
+
+       /*
+        * When using percpu IRQs, we need a percpu dev_id. Place it here as we
+        * already have to allocate this struct per cpu.
+        */
+       struct arm_pmu          *percpu_pmu;
 };
 
 struct arm_pmu {
@@ -107,7 +115,8 @@ struct arm_pmu {
        struct mutex    reserve_mutex;
        u64             max_period;
        struct platform_device  *plat_device;
-       struct pmu_hw_events    *(*get_hw_events)(void);
+       struct pmu_hw_events    __percpu *hw_events;
+       struct notifier_block   hotplug_nb;
 };
 
 #define to_arm_pmu(p) (container_of(p, struct arm_pmu, pmu))
@@ -127,6 +136,27 @@ int armpmu_map_event(struct perf_event *event,
                                                [PERF_COUNT_HW_CACHE_RESULT_MAX],
                     u32 raw_event_mask);
 
+struct pmu_probe_info {
+       unsigned int cpuid;
+       unsigned int mask;
+       int (*init)(struct arm_pmu *);
+};
+
+#define PMU_PROBE(_cpuid, _mask, _fn)  \
+{                                      \
+       .cpuid = (_cpuid),              \
+       .mask = (_mask),                \
+       .init = (_fn),                  \
+}
+
+#define ARM_PMU_PROBE(_cpuid, _fn) \
+       PMU_PROBE(_cpuid, ARM_CPU_PART_MASK, _fn)
+
+#define ARM_PMU_XSCALE_MASK    ((0xff << 24) | ARM_CPU_XSCALE_ARCH_MASK)
+
+#define XSCALE_PMU_PROBE(_version, _fn) \
+       PMU_PROBE(ARM_CPU_IMP_INTEL << 24 | _version, ARM_PMU_XSCALE_MASK, _fn)
+
 #endif /* CONFIG_HW_PERF_EVENTS */
 
 #endif /* __ARM_PMU_H__ */