]> Git Repo - linux.git/commitdiff
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
authorLinus Torvalds <[email protected]>
Fri, 7 Jan 2011 00:50:35 +0000 (16:50 -0800)
committerLinus Torvalds <[email protected]>
Fri, 7 Jan 2011 00:50:35 +0000 (16:50 -0800)
* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (416 commits)
  ARM: DMA: add support for DMA debugging
  ARM: PL011: add DMA burst threshold support for ST variants
  ARM: PL011: Add support for transmit DMA
  ARM: PL011: Ensure IRQs are disabled in UART interrupt handler
  ARM: PL011: Separate hardware FIFO size from TTY FIFO size
  ARM: PL011: Allow better handling of vendor data
  ARM: PL011: Ensure error flags are clear at startup
  ARM: PL011: include revision number in boot-time port printk
  ARM: vexpress: add sched_clock() for Versatile Express
  ARM i.MX53: Make MX53 EVK bootable
  ARM i.MX53: Some bug fix about MX53 MSL code
  ARM: 6607/1: sa1100: Update platform device registration
  ARM: 6606/1: sa1100: Fix platform device registration
  ARM i.MX51: rename IPU irqs
  ARM i.MX51: Add ipu clock support
  ARM: imx/mx27_3ds: Add PMIC support
  ARM: DMA: Replace page_to_dma()/dma_to_page() with pfn_to_dma()/dma_to_pfn()
  mx51: fix usb clock support
  MX51: Add support for usb host 2
  arch/arm/plat-mxc/ehci.c: fix errors/typos
  ...

1  2 
arch/arm/kernel/perf_event.c
arch/arm/mach-msm/Kconfig
arch/arm/mach-shmobile/board-ap4evb.c
arch/arm/mach-shmobile/clock-sh7372.c
arch/sh/Kconfig
arch/sh/kernel/Makefile
drivers/video/Kconfig
drivers/video/Makefile

index fdfa4976b0bfeca637178609bb5e8d51e63ac672,624e2a5de2b32ab681547de6455ed5f0517376bf..5efa2647a2fb3bcdf26c58cec440adbc88724e74
@@@ -4,9 -4,7 +4,7 @@@
   * ARM performance counter support.
   *
   * Copyright (C) 2009 picoChip Designs, Ltd., Jamie Iles
-  *
-  * ARMv7 support: Jean Pihet <[email protected]>
-  * 2010 (c) MontaVista Software, LLC.
+  * Copyright (C) 2010 ARM Ltd., Will Deacon <[email protected]>
   *
   * This code is based on the sparc64 perf event code, which is in turn based
   * on the x86 code. Callchain code is based on the ARM OProfile backtrace
@@@ -34,7 -32,7 +32,7 @@@ static struct platform_device *pmu_devi
   * Hardware lock to serialize accesses to PMU registers. Needed for the
   * read/modify/write sequences.
   */
DEFINE_SPINLOCK(pmu_lock);
static DEFINE_RAW_SPINLOCK(pmu_lock);
  
  /*
   * ARMv6 supports a maximum of 3 events, starting from index 1. If we add
@@@ -67,31 -65,25 +65,25 @@@ struct cpu_hw_events 
         */
        unsigned long           active_mask[BITS_TO_LONGS(ARMPMU_MAX_HWEVENTS)];
  };
- DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events);
- /* PMU names. */
- static const char *arm_pmu_names[] = {
-       [ARM_PERF_PMU_ID_XSCALE1] = "xscale1",
-       [ARM_PERF_PMU_ID_XSCALE2] = "xscale2",
-       [ARM_PERF_PMU_ID_V6]      = "v6",
-       [ARM_PERF_PMU_ID_V6MP]    = "v6mpcore",
-       [ARM_PERF_PMU_ID_CA8]     = "ARMv7 Cortex-A8",
-       [ARM_PERF_PMU_ID_CA9]     = "ARMv7 Cortex-A9",
- };
+ static DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events);
  
  struct arm_pmu {
        enum arm_perf_pmu_ids id;
+       const char      *name;
        irqreturn_t     (*handle_irq)(int irq_num, void *dev);
        void            (*enable)(struct hw_perf_event *evt, int idx);
        void            (*disable)(struct hw_perf_event *evt, int idx);
-       int             (*event_map)(int evt);
-       u64             (*raw_event)(u64);
        int             (*get_event_idx)(struct cpu_hw_events *cpuc,
                                         struct hw_perf_event *hwc);
        u32             (*read_counter)(int idx);
        void            (*write_counter)(int idx, u32 val);
        void            (*start)(void);
        void            (*stop)(void);
+       const unsigned  (*cache_map)[PERF_COUNT_HW_CACHE_MAX]
+                                   [PERF_COUNT_HW_CACHE_OP_MAX]
+                                   [PERF_COUNT_HW_CACHE_RESULT_MAX];
+       const unsigned  (*event_map)[PERF_COUNT_HW_MAX];
+       u32             raw_event_mask;
        int             num_events;
        u64             max_period;
  };
@@@ -136,10 -128,6 +128,6 @@@ EXPORT_SYMBOL_GPL(perf_num_counters)
  
  #define CACHE_OP_UNSUPPORTED          0xFFFF
  
- static unsigned armpmu_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
-                                    [PERF_COUNT_HW_CACHE_OP_MAX]
-                                    [PERF_COUNT_HW_CACHE_RESULT_MAX];
  static int
  armpmu_map_cache_event(u64 config)
  {
        if (cache_result >= PERF_COUNT_HW_CACHE_RESULT_MAX)
                return -EINVAL;
  
-       ret = (int)armpmu_perf_cache_map[cache_type][cache_op][cache_result];
+       ret = (int)(*armpmu->cache_map)[cache_type][cache_op][cache_result];
  
        if (ret == CACHE_OP_UNSUPPORTED)
                return -ENOENT;
        return ret;
  }
  
+ static int
+ armpmu_map_event(u64 config)
+ {
+       int mapping = (*armpmu->event_map)[config];
+       return mapping == HW_OP_UNSUPPORTED ? -EOPNOTSUPP : mapping;
+ }
+ static int
+ armpmu_map_raw_event(u64 config)
+ {
+       return (int)(config & armpmu->raw_event_mask);
+ }
  static int
  armpmu_event_set_period(struct perf_event *event,
                        struct hw_perf_event *hwc,
@@@ -458,11 -459,11 +459,11 @@@ __hw_perf_event_init(struct perf_event 
  
        /* Decode the generic type into an ARM event identifier. */
        if (PERF_TYPE_HARDWARE == event->attr.type) {
-               mapping = armpmu->event_map(event->attr.config);
+               mapping = armpmu_map_event(event->attr.config);
        } else if (PERF_TYPE_HW_CACHE == event->attr.type) {
                mapping = armpmu_map_cache_event(event->attr.config);
        } else if (PERF_TYPE_RAW == event->attr.type) {
-               mapping = armpmu->raw_event(event->attr.config);
+               mapping = armpmu_map_raw_event(event->attr.config);
        } else {
                pr_debug("event type %x not supported\n", event->attr.type);
                return -EOPNOTSUPP;
@@@ -603,2366 -604,10 +604,10 @@@ static struct pmu pmu = 
        .read           = armpmu_read,
  };
  
- /*
-  * ARMv6 Performance counter handling code.
-  *
-  * ARMv6 has 2 configurable performance counters and a single cycle counter.
-  * They all share a single reset bit but can be written to zero so we can use
-  * that for a reset.
-  *
-  * The counters can't be individually enabled or disabled so when we remove
-  * one event and replace it with another we could get spurious counts from the
-  * wrong event. However, we can take advantage of the fact that the
-  * performance counters can export events to the event bus, and the event bus
-  * itself can be monitored. This requires that we *don't* export the events to
-  * the event bus. The procedure for disabling a configurable counter is:
-  *    - change the counter to count the ETMEXTOUT[0] signal (0x20). This
-  *      effectively stops the counter from counting.
-  *    - disable the counter's interrupt generation (each counter has it's
-  *      own interrupt enable bit).
-  * Once stopped, the counter value can be written as 0 to reset.
-  *
-  * To enable a counter:
-  *    - enable the counter's interrupt generation.
-  *    - set the new event type.
-  *
-  * Note: the dedicated cycle counter only counts cycles and can't be
-  * enabled/disabled independently of the others. When we want to disable the
-  * cycle counter, we have to just disable the interrupt reporting and start
-  * ignoring that counter. When re-enabling, we have to reset the value and
-  * enable the interrupt.
-  */
- enum armv6_perf_types {
-       ARMV6_PERFCTR_ICACHE_MISS           = 0x0,
-       ARMV6_PERFCTR_IBUF_STALL            = 0x1,
-       ARMV6_PERFCTR_DDEP_STALL            = 0x2,
-       ARMV6_PERFCTR_ITLB_MISS             = 0x3,
-       ARMV6_PERFCTR_DTLB_MISS             = 0x4,
-       ARMV6_PERFCTR_BR_EXEC               = 0x5,
-       ARMV6_PERFCTR_BR_MISPREDICT         = 0x6,
-       ARMV6_PERFCTR_INSTR_EXEC            = 0x7,
-       ARMV6_PERFCTR_DCACHE_HIT            = 0x9,
-       ARMV6_PERFCTR_DCACHE_ACCESS         = 0xA,
-       ARMV6_PERFCTR_DCACHE_MISS           = 0xB,
-       ARMV6_PERFCTR_DCACHE_WBACK          = 0xC,
-       ARMV6_PERFCTR_SW_PC_CHANGE          = 0xD,
-       ARMV6_PERFCTR_MAIN_TLB_MISS         = 0xF,
-       ARMV6_PERFCTR_EXPL_D_ACCESS         = 0x10,
-       ARMV6_PERFCTR_LSU_FULL_STALL        = 0x11,
-       ARMV6_PERFCTR_WBUF_DRAINED          = 0x12,
-       ARMV6_PERFCTR_CPU_CYCLES            = 0xFF,
-       ARMV6_PERFCTR_NOP                   = 0x20,
- };
- enum armv6_counters {
-       ARMV6_CYCLE_COUNTER = 1,
-       ARMV6_COUNTER0,
-       ARMV6_COUNTER1,
- };
- /*
-  * The hardware events that we support. We do support cache operations but
-  * we have harvard caches and no way to combine instruction and data
-  * accesses/misses in hardware.
-  */
- static const unsigned armv6_perf_map[PERF_COUNT_HW_MAX] = {
-       [PERF_COUNT_HW_CPU_CYCLES]          = ARMV6_PERFCTR_CPU_CYCLES,
-       [PERF_COUNT_HW_INSTRUCTIONS]        = ARMV6_PERFCTR_INSTR_EXEC,
-       [PERF_COUNT_HW_CACHE_REFERENCES]    = HW_OP_UNSUPPORTED,
-       [PERF_COUNT_HW_CACHE_MISSES]        = HW_OP_UNSUPPORTED,
-       [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV6_PERFCTR_BR_EXEC,
-       [PERF_COUNT_HW_BRANCH_MISSES]       = ARMV6_PERFCTR_BR_MISPREDICT,
-       [PERF_COUNT_HW_BUS_CYCLES]          = HW_OP_UNSUPPORTED,
- };
- static const unsigned armv6_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
-                                         [PERF_COUNT_HW_CACHE_OP_MAX]
-                                         [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
-       [C(L1D)] = {
-               /*
-                * The performance counters don't differentiate between read
-                * and write accesses/misses so this isn't strictly correct,
-                * but it's the best we can do. Writes and reads get
-                * combined.
-                */
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = ARMV6_PERFCTR_DCACHE_ACCESS,
-                       [C(RESULT_MISS)]        = ARMV6_PERFCTR_DCACHE_MISS,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = ARMV6_PERFCTR_DCACHE_ACCESS,
-                       [C(RESULT_MISS)]        = ARMV6_PERFCTR_DCACHE_MISS,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(L1I)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = ARMV6_PERFCTR_ICACHE_MISS,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = ARMV6_PERFCTR_ICACHE_MISS,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(LL)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(DTLB)] = {
-               /*
-                * The ARM performance counters can count micro DTLB misses,
-                * micro ITLB misses and main TLB misses. There isn't an event
-                * for TLB misses, so use the micro misses here and if users
-                * want the main TLB misses they can use a raw counter.
-                */
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = ARMV6_PERFCTR_DTLB_MISS,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = ARMV6_PERFCTR_DTLB_MISS,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(ITLB)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = ARMV6_PERFCTR_ITLB_MISS,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = ARMV6_PERFCTR_ITLB_MISS,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(BPU)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
- };
- enum armv6mpcore_perf_types {
-       ARMV6MPCORE_PERFCTR_ICACHE_MISS     = 0x0,
-       ARMV6MPCORE_PERFCTR_IBUF_STALL      = 0x1,
-       ARMV6MPCORE_PERFCTR_DDEP_STALL      = 0x2,
-       ARMV6MPCORE_PERFCTR_ITLB_MISS       = 0x3,
-       ARMV6MPCORE_PERFCTR_DTLB_MISS       = 0x4,
-       ARMV6MPCORE_PERFCTR_BR_EXEC         = 0x5,
-       ARMV6MPCORE_PERFCTR_BR_NOTPREDICT   = 0x6,
-       ARMV6MPCORE_PERFCTR_BR_MISPREDICT   = 0x7,
-       ARMV6MPCORE_PERFCTR_INSTR_EXEC      = 0x8,
-       ARMV6MPCORE_PERFCTR_DCACHE_RDACCESS = 0xA,
-       ARMV6MPCORE_PERFCTR_DCACHE_RDMISS   = 0xB,
-       ARMV6MPCORE_PERFCTR_DCACHE_WRACCESS = 0xC,
-       ARMV6MPCORE_PERFCTR_DCACHE_WRMISS   = 0xD,
-       ARMV6MPCORE_PERFCTR_DCACHE_EVICTION = 0xE,
-       ARMV6MPCORE_PERFCTR_SW_PC_CHANGE    = 0xF,
-       ARMV6MPCORE_PERFCTR_MAIN_TLB_MISS   = 0x10,
-       ARMV6MPCORE_PERFCTR_EXPL_MEM_ACCESS = 0x11,
-       ARMV6MPCORE_PERFCTR_LSU_FULL_STALL  = 0x12,
-       ARMV6MPCORE_PERFCTR_WBUF_DRAINED    = 0x13,
-       ARMV6MPCORE_PERFCTR_CPU_CYCLES      = 0xFF,
- };
- /*
-  * The hardware events that we support. We do support cache operations but
-  * we have harvard caches and no way to combine instruction and data
-  * accesses/misses in hardware.
-  */
- static const unsigned armv6mpcore_perf_map[PERF_COUNT_HW_MAX] = {
-       [PERF_COUNT_HW_CPU_CYCLES]          = ARMV6MPCORE_PERFCTR_CPU_CYCLES,
-       [PERF_COUNT_HW_INSTRUCTIONS]        = ARMV6MPCORE_PERFCTR_INSTR_EXEC,
-       [PERF_COUNT_HW_CACHE_REFERENCES]    = HW_OP_UNSUPPORTED,
-       [PERF_COUNT_HW_CACHE_MISSES]        = HW_OP_UNSUPPORTED,
-       [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV6MPCORE_PERFCTR_BR_EXEC,
-       [PERF_COUNT_HW_BRANCH_MISSES]       = ARMV6MPCORE_PERFCTR_BR_MISPREDICT,
-       [PERF_COUNT_HW_BUS_CYCLES]          = HW_OP_UNSUPPORTED,
- };
- static const unsigned armv6mpcore_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
-                                       [PERF_COUNT_HW_CACHE_OP_MAX]
-                                       [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
-       [C(L1D)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]  =
-                               ARMV6MPCORE_PERFCTR_DCACHE_RDACCESS,
-                       [C(RESULT_MISS)]    =
-                               ARMV6MPCORE_PERFCTR_DCACHE_RDMISS,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]  =
-                               ARMV6MPCORE_PERFCTR_DCACHE_WRACCESS,
-                       [C(RESULT_MISS)]    =
-                               ARMV6MPCORE_PERFCTR_DCACHE_WRMISS,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]  = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]    = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(L1I)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]  = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]    = ARMV6MPCORE_PERFCTR_ICACHE_MISS,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]  = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]    = ARMV6MPCORE_PERFCTR_ICACHE_MISS,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]  = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]    = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(LL)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]  = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]    = CACHE_OP_UNSUPPORTED,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]  = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]    = CACHE_OP_UNSUPPORTED,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]  = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]    = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(DTLB)] = {
-               /*
-                * The ARM performance counters can count micro DTLB misses,
-                * micro ITLB misses and main TLB misses. There isn't an event
-                * for TLB misses, so use the micro misses here and if users
-                * want the main TLB misses they can use a raw counter.
-                */
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]  = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]    = ARMV6MPCORE_PERFCTR_DTLB_MISS,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]  = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]    = ARMV6MPCORE_PERFCTR_DTLB_MISS,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]  = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]    = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(ITLB)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]  = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]    = ARMV6MPCORE_PERFCTR_ITLB_MISS,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]  = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]    = ARMV6MPCORE_PERFCTR_ITLB_MISS,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]  = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]    = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(BPU)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]  = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]    = CACHE_OP_UNSUPPORTED,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]  = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]    = CACHE_OP_UNSUPPORTED,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]  = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]    = CACHE_OP_UNSUPPORTED,
-               },
-       },
- };
- static inline unsigned long
- armv6_pmcr_read(void)
- {
-       u32 val;
-       asm volatile("mrc   p15, 0, %0, c15, c12, 0" : "=r"(val));
-       return val;
- }
- static inline void
- armv6_pmcr_write(unsigned long val)
- {
-       asm volatile("mcr   p15, 0, %0, c15, c12, 0" : : "r"(val));
- }
- #define ARMV6_PMCR_ENABLE             (1 << 0)
- #define ARMV6_PMCR_CTR01_RESET                (1 << 1)
- #define ARMV6_PMCR_CCOUNT_RESET               (1 << 2)
- #define ARMV6_PMCR_CCOUNT_DIV         (1 << 3)
- #define ARMV6_PMCR_COUNT0_IEN         (1 << 4)
- #define ARMV6_PMCR_COUNT1_IEN         (1 << 5)
- #define ARMV6_PMCR_CCOUNT_IEN         (1 << 6)
- #define ARMV6_PMCR_COUNT0_OVERFLOW    (1 << 8)
- #define ARMV6_PMCR_COUNT1_OVERFLOW    (1 << 9)
- #define ARMV6_PMCR_CCOUNT_OVERFLOW    (1 << 10)
- #define ARMV6_PMCR_EVT_COUNT0_SHIFT   20
- #define ARMV6_PMCR_EVT_COUNT0_MASK    (0xFF << ARMV6_PMCR_EVT_COUNT0_SHIFT)
- #define ARMV6_PMCR_EVT_COUNT1_SHIFT   12
- #define ARMV6_PMCR_EVT_COUNT1_MASK    (0xFF << ARMV6_PMCR_EVT_COUNT1_SHIFT)
- #define ARMV6_PMCR_OVERFLOWED_MASK \
-       (ARMV6_PMCR_COUNT0_OVERFLOW | ARMV6_PMCR_COUNT1_OVERFLOW | \
-        ARMV6_PMCR_CCOUNT_OVERFLOW)
- static inline int
- armv6_pmcr_has_overflowed(unsigned long pmcr)
- {
-       return (pmcr & ARMV6_PMCR_OVERFLOWED_MASK);
- }
- static inline int
- armv6_pmcr_counter_has_overflowed(unsigned long pmcr,
-                                 enum armv6_counters counter)
- {
-       int ret = 0;
-       if (ARMV6_CYCLE_COUNTER == counter)
-               ret = pmcr & ARMV6_PMCR_CCOUNT_OVERFLOW;
-       else if (ARMV6_COUNTER0 == counter)
-               ret = pmcr & ARMV6_PMCR_COUNT0_OVERFLOW;
-       else if (ARMV6_COUNTER1 == counter)
-               ret = pmcr & ARMV6_PMCR_COUNT1_OVERFLOW;
-       else
-               WARN_ONCE(1, "invalid counter number (%d)\n", counter);
-       return ret;
- }
- static inline u32
- armv6pmu_read_counter(int counter)
- {
-       unsigned long value = 0;
-       if (ARMV6_CYCLE_COUNTER == counter)
-               asm volatile("mrc   p15, 0, %0, c15, c12, 1" : "=r"(value));
-       else if (ARMV6_COUNTER0 == counter)
-               asm volatile("mrc   p15, 0, %0, c15, c12, 2" : "=r"(value));
-       else if (ARMV6_COUNTER1 == counter)
-               asm volatile("mrc   p15, 0, %0, c15, c12, 3" : "=r"(value));
-       else
-               WARN_ONCE(1, "invalid counter number (%d)\n", counter);
-       return value;
- }
- static inline void
- armv6pmu_write_counter(int counter,
-                      u32 value)
- {
-       if (ARMV6_CYCLE_COUNTER == counter)
-               asm volatile("mcr   p15, 0, %0, c15, c12, 1" : : "r"(value));
-       else if (ARMV6_COUNTER0 == counter)
-               asm volatile("mcr   p15, 0, %0, c15, c12, 2" : : "r"(value));
-       else if (ARMV6_COUNTER1 == counter)
-               asm volatile("mcr   p15, 0, %0, c15, c12, 3" : : "r"(value));
-       else
-               WARN_ONCE(1, "invalid counter number (%d)\n", counter);
- }
- void
- armv6pmu_enable_event(struct hw_perf_event *hwc,
-                     int idx)
- {
-       unsigned long val, mask, evt, flags;
-       if (ARMV6_CYCLE_COUNTER == idx) {
-               mask    = 0;
-               evt     = ARMV6_PMCR_CCOUNT_IEN;
-       } else if (ARMV6_COUNTER0 == idx) {
-               mask    = ARMV6_PMCR_EVT_COUNT0_MASK;
-               evt     = (hwc->config_base << ARMV6_PMCR_EVT_COUNT0_SHIFT) |
-                         ARMV6_PMCR_COUNT0_IEN;
-       } else if (ARMV6_COUNTER1 == idx) {
-               mask    = ARMV6_PMCR_EVT_COUNT1_MASK;
-               evt     = (hwc->config_base << ARMV6_PMCR_EVT_COUNT1_SHIFT) |
-                         ARMV6_PMCR_COUNT1_IEN;
-       } else {
-               WARN_ONCE(1, "invalid counter number (%d)\n", idx);
-               return;
-       }
-       /*
-        * Mask out the current event and set the counter to count the event
-        * that we're interested in.
-        */
-       spin_lock_irqsave(&pmu_lock, flags);
-       val = armv6_pmcr_read();
-       val &= ~mask;
-       val |= evt;
-       armv6_pmcr_write(val);
-       spin_unlock_irqrestore(&pmu_lock, flags);
- }
- static irqreturn_t
- armv6pmu_handle_irq(int irq_num,
-                   void *dev)
- {
-       unsigned long pmcr = armv6_pmcr_read();
-       struct perf_sample_data data;
-       struct cpu_hw_events *cpuc;
-       struct pt_regs *regs;
-       int idx;
-       if (!armv6_pmcr_has_overflowed(pmcr))
-               return IRQ_NONE;
-       regs = get_irq_regs();
-       /*
-        * The interrupts are cleared by writing the overflow flags back to
-        * the control register. All of the other bits don't have any effect
-        * if they are rewritten, so write the whole value back.
-        */
-       armv6_pmcr_write(pmcr);
-       perf_sample_data_init(&data, 0);
-       cpuc = &__get_cpu_var(cpu_hw_events);
-       for (idx = 0; idx <= armpmu->num_events; ++idx) {
-               struct perf_event *event = cpuc->events[idx];
-               struct hw_perf_event *hwc;
-               if (!test_bit(idx, cpuc->active_mask))
-                       continue;
-               /*
-                * We have a single interrupt for all counters. Check that
-                * each counter has overflowed before we process it.
-                */
-               if (!armv6_pmcr_counter_has_overflowed(pmcr, idx))
-                       continue;
-               hwc = &event->hw;
-               armpmu_event_update(event, hwc, idx);
-               data.period = event->hw.last_period;
-               if (!armpmu_event_set_period(event, hwc, idx))
-                       continue;
-               if (perf_event_overflow(event, 0, &data, regs))
-                       armpmu->disable(hwc, idx);
-       }
-       /*
-        * Handle the pending perf events.
-        *
-        * Note: this call *must* be run with interrupts disabled. For
-        * platforms that can have the PMU interrupts raised as an NMI, this
-        * will not work.
-        */
-       irq_work_run();
-       return IRQ_HANDLED;
- }
- static void
- armv6pmu_start(void)
- {
-       unsigned long flags, val;
-       spin_lock_irqsave(&pmu_lock, flags);
-       val = armv6_pmcr_read();
-       val |= ARMV6_PMCR_ENABLE;
-       armv6_pmcr_write(val);
-       spin_unlock_irqrestore(&pmu_lock, flags);
- }
- void
- armv6pmu_stop(void)
- {
-       unsigned long flags, val;
-       spin_lock_irqsave(&pmu_lock, flags);
-       val = armv6_pmcr_read();
-       val &= ~ARMV6_PMCR_ENABLE;
-       armv6_pmcr_write(val);
-       spin_unlock_irqrestore(&pmu_lock, flags);
- }
- static inline int
- armv6pmu_event_map(int config)
- {
-       int mapping = armv6_perf_map[config];
-       if (HW_OP_UNSUPPORTED == mapping)
-               mapping = -EOPNOTSUPP;
-       return mapping;
- }
- static inline int
- armv6mpcore_pmu_event_map(int config)
- {
-       int mapping = armv6mpcore_perf_map[config];
-       if (HW_OP_UNSUPPORTED == mapping)
-               mapping = -EOPNOTSUPP;
-       return mapping;
- }
- static u64
- armv6pmu_raw_event(u64 config)
- {
-       return config & 0xff;
- }
- static int
- armv6pmu_get_event_idx(struct cpu_hw_events *cpuc,
-                      struct hw_perf_event *event)
- {
-       /* Always place a cycle counter into the cycle counter. */
-       if (ARMV6_PERFCTR_CPU_CYCLES == event->config_base) {
-               if (test_and_set_bit(ARMV6_CYCLE_COUNTER, cpuc->used_mask))
-                       return -EAGAIN;
-               return ARMV6_CYCLE_COUNTER;
-       } else {
-               /*
-                * For anything other than a cycle counter, try and use
-                * counter0 and counter1.
-                */
-               if (!test_and_set_bit(ARMV6_COUNTER1, cpuc->used_mask)) {
-                       return ARMV6_COUNTER1;
-               }
-               if (!test_and_set_bit(ARMV6_COUNTER0, cpuc->used_mask)) {
-                       return ARMV6_COUNTER0;
-               }
-               /* The counters are all in use. */
-               return -EAGAIN;
-       }
- }
- static void
- armv6pmu_disable_event(struct hw_perf_event *hwc,
-                      int idx)
- {
-       unsigned long val, mask, evt, flags;
-       if (ARMV6_CYCLE_COUNTER == idx) {
-               mask    = ARMV6_PMCR_CCOUNT_IEN;
-               evt     = 0;
-       } else if (ARMV6_COUNTER0 == idx) {
-               mask    = ARMV6_PMCR_COUNT0_IEN | ARMV6_PMCR_EVT_COUNT0_MASK;
-               evt     = ARMV6_PERFCTR_NOP << ARMV6_PMCR_EVT_COUNT0_SHIFT;
-       } else if (ARMV6_COUNTER1 == idx) {
-               mask    = ARMV6_PMCR_COUNT1_IEN | ARMV6_PMCR_EVT_COUNT1_MASK;
-               evt     = ARMV6_PERFCTR_NOP << ARMV6_PMCR_EVT_COUNT1_SHIFT;
-       } else {
-               WARN_ONCE(1, "invalid counter number (%d)\n", idx);
-               return;
-       }
-       /*
-        * Mask out the current event and set the counter to count the number
-        * of ETM bus signal assertion cycles. The external reporting should
-        * be disabled and so this should never increment.
-        */
-       spin_lock_irqsave(&pmu_lock, flags);
-       val = armv6_pmcr_read();
-       val &= ~mask;
-       val |= evt;
-       armv6_pmcr_write(val);
-       spin_unlock_irqrestore(&pmu_lock, flags);
- }
- static void
- armv6mpcore_pmu_disable_event(struct hw_perf_event *hwc,
-                             int idx)
- {
-       unsigned long val, mask, flags, evt = 0;
-       if (ARMV6_CYCLE_COUNTER == idx) {
-               mask    = ARMV6_PMCR_CCOUNT_IEN;
-       } else if (ARMV6_COUNTER0 == idx) {
-               mask    = ARMV6_PMCR_COUNT0_IEN;
-       } else if (ARMV6_COUNTER1 == idx) {
-               mask    = ARMV6_PMCR_COUNT1_IEN;
-       } else {
-               WARN_ONCE(1, "invalid counter number (%d)\n", idx);
-               return;
-       }
-       /*
-        * Unlike UP ARMv6, we don't have a way of stopping the counters. We
-        * simply disable the interrupt reporting.
-        */
-       spin_lock_irqsave(&pmu_lock, flags);
-       val = armv6_pmcr_read();
-       val &= ~mask;
-       val |= evt;
-       armv6_pmcr_write(val);
-       spin_unlock_irqrestore(&pmu_lock, flags);
- }
- static const struct arm_pmu armv6pmu = {
-       .id                     = ARM_PERF_PMU_ID_V6,
-       .handle_irq             = armv6pmu_handle_irq,
-       .enable                 = armv6pmu_enable_event,
-       .disable                = armv6pmu_disable_event,
-       .event_map              = armv6pmu_event_map,
-       .raw_event              = armv6pmu_raw_event,
-       .read_counter           = armv6pmu_read_counter,
-       .write_counter          = armv6pmu_write_counter,
-       .get_event_idx          = armv6pmu_get_event_idx,
-       .start                  = armv6pmu_start,
-       .stop                   = armv6pmu_stop,
-       .num_events             = 3,
-       .max_period             = (1LLU << 32) - 1,
- };
- /*
-  * ARMv6mpcore is almost identical to single core ARMv6 with the exception
-  * that some of the events have different enumerations and that there is no
-  * *hack* to stop the programmable counters. To stop the counters we simply
-  * disable the interrupt reporting and update the event. When unthrottling we
-  * reset the period and enable the interrupt reporting.
-  */
- static const struct arm_pmu armv6mpcore_pmu = {
-       .id                     = ARM_PERF_PMU_ID_V6MP,
-       .handle_irq             = armv6pmu_handle_irq,
-       .enable                 = armv6pmu_enable_event,
-       .disable                = armv6mpcore_pmu_disable_event,
-       .event_map              = armv6mpcore_pmu_event_map,
-       .raw_event              = armv6pmu_raw_event,
-       .read_counter           = armv6pmu_read_counter,
-       .write_counter          = armv6pmu_write_counter,
-       .get_event_idx          = armv6pmu_get_event_idx,
-       .start                  = armv6pmu_start,
-       .stop                   = armv6pmu_stop,
-       .num_events             = 3,
-       .max_period             = (1LLU << 32) - 1,
- };
- /*
-  * ARMv7 Cortex-A8 and Cortex-A9 Performance Events handling code.
-  *
-  * Copied from ARMv6 code, with the low level code inspired
-  *  by the ARMv7 Oprofile code.
-  *
-  * Cortex-A8 has up to 4 configurable performance counters and
-  *  a single cycle counter.
-  * Cortex-A9 has up to 31 configurable performance counters and
-  *  a single cycle counter.
-  *
-  * All counters can be enabled/disabled and IRQ masked separately. The cycle
-  *  counter and all 4 performance counters together can be reset separately.
-  */
- /* Common ARMv7 event types */
- enum armv7_perf_types {
-       ARMV7_PERFCTR_PMNC_SW_INCR              = 0x00,
-       ARMV7_PERFCTR_IFETCH_MISS               = 0x01,
-       ARMV7_PERFCTR_ITLB_MISS                 = 0x02,
-       ARMV7_PERFCTR_DCACHE_REFILL             = 0x03,
-       ARMV7_PERFCTR_DCACHE_ACCESS             = 0x04,
-       ARMV7_PERFCTR_DTLB_REFILL               = 0x05,
-       ARMV7_PERFCTR_DREAD                     = 0x06,
-       ARMV7_PERFCTR_DWRITE                    = 0x07,
-       ARMV7_PERFCTR_EXC_TAKEN                 = 0x09,
-       ARMV7_PERFCTR_EXC_EXECUTED              = 0x0A,
-       ARMV7_PERFCTR_CID_WRITE                 = 0x0B,
-       /* ARMV7_PERFCTR_PC_WRITE is equivalent to HW_BRANCH_INSTRUCTIONS.
-        * It counts:
-        *  - all branch instructions,
-        *  - instructions that explicitly write the PC,
-        *  - exception generating instructions.
-        */
-       ARMV7_PERFCTR_PC_WRITE                  = 0x0C,
-       ARMV7_PERFCTR_PC_IMM_BRANCH             = 0x0D,
-       ARMV7_PERFCTR_UNALIGNED_ACCESS          = 0x0F,
-       ARMV7_PERFCTR_PC_BRANCH_MIS_PRED        = 0x10,
-       ARMV7_PERFCTR_CLOCK_CYCLES              = 0x11,
-       ARMV7_PERFCTR_PC_BRANCH_MIS_USED        = 0x12,
-       ARMV7_PERFCTR_CPU_CYCLES                = 0xFF
- };
- /* ARMv7 Cortex-A8 specific event types */
- enum armv7_a8_perf_types {
-       ARMV7_PERFCTR_INSTR_EXECUTED            = 0x08,
-       ARMV7_PERFCTR_PC_PROC_RETURN            = 0x0E,
-       ARMV7_PERFCTR_WRITE_BUFFER_FULL         = 0x40,
-       ARMV7_PERFCTR_L2_STORE_MERGED           = 0x41,
-       ARMV7_PERFCTR_L2_STORE_BUFF             = 0x42,
-       ARMV7_PERFCTR_L2_ACCESS                 = 0x43,
-       ARMV7_PERFCTR_L2_CACH_MISS              = 0x44,
-       ARMV7_PERFCTR_AXI_READ_CYCLES           = 0x45,
-       ARMV7_PERFCTR_AXI_WRITE_CYCLES          = 0x46,
-       ARMV7_PERFCTR_MEMORY_REPLAY             = 0x47,
-       ARMV7_PERFCTR_UNALIGNED_ACCESS_REPLAY   = 0x48,
-       ARMV7_PERFCTR_L1_DATA_MISS              = 0x49,
-       ARMV7_PERFCTR_L1_INST_MISS              = 0x4A,
-       ARMV7_PERFCTR_L1_DATA_COLORING          = 0x4B,
-       ARMV7_PERFCTR_L1_NEON_DATA              = 0x4C,
-       ARMV7_PERFCTR_L1_NEON_CACH_DATA         = 0x4D,
-       ARMV7_PERFCTR_L2_NEON                   = 0x4E,
-       ARMV7_PERFCTR_L2_NEON_HIT               = 0x4F,
-       ARMV7_PERFCTR_L1_INST                   = 0x50,
-       ARMV7_PERFCTR_PC_RETURN_MIS_PRED        = 0x51,
-       ARMV7_PERFCTR_PC_BRANCH_FAILED          = 0x52,
-       ARMV7_PERFCTR_PC_BRANCH_TAKEN           = 0x53,
-       ARMV7_PERFCTR_PC_BRANCH_EXECUTED        = 0x54,
-       ARMV7_PERFCTR_OP_EXECUTED               = 0x55,
-       ARMV7_PERFCTR_CYCLES_INST_STALL         = 0x56,
-       ARMV7_PERFCTR_CYCLES_INST               = 0x57,
-       ARMV7_PERFCTR_CYCLES_NEON_DATA_STALL    = 0x58,
-       ARMV7_PERFCTR_CYCLES_NEON_INST_STALL    = 0x59,
-       ARMV7_PERFCTR_NEON_CYCLES               = 0x5A,
-       ARMV7_PERFCTR_PMU0_EVENTS               = 0x70,
-       ARMV7_PERFCTR_PMU1_EVENTS               = 0x71,
-       ARMV7_PERFCTR_PMU_EVENTS                = 0x72,
- };
- /* ARMv7 Cortex-A9 specific event types */
- enum armv7_a9_perf_types {
-       ARMV7_PERFCTR_JAVA_HW_BYTECODE_EXEC     = 0x40,
-       ARMV7_PERFCTR_JAVA_SW_BYTECODE_EXEC     = 0x41,
-       ARMV7_PERFCTR_JAZELLE_BRANCH_EXEC       = 0x42,
-       ARMV7_PERFCTR_COHERENT_LINE_MISS        = 0x50,
-       ARMV7_PERFCTR_COHERENT_LINE_HIT         = 0x51,
-       ARMV7_PERFCTR_ICACHE_DEP_STALL_CYCLES   = 0x60,
-       ARMV7_PERFCTR_DCACHE_DEP_STALL_CYCLES   = 0x61,
-       ARMV7_PERFCTR_TLB_MISS_DEP_STALL_CYCLES = 0x62,
-       ARMV7_PERFCTR_STREX_EXECUTED_PASSED     = 0x63,
-       ARMV7_PERFCTR_STREX_EXECUTED_FAILED     = 0x64,
-       ARMV7_PERFCTR_DATA_EVICTION             = 0x65,
-       ARMV7_PERFCTR_ISSUE_STAGE_NO_INST       = 0x66,
-       ARMV7_PERFCTR_ISSUE_STAGE_EMPTY         = 0x67,
-       ARMV7_PERFCTR_INST_OUT_OF_RENAME_STAGE  = 0x68,
-       ARMV7_PERFCTR_PREDICTABLE_FUNCT_RETURNS = 0x6E,
-       ARMV7_PERFCTR_MAIN_UNIT_EXECUTED_INST   = 0x70,
-       ARMV7_PERFCTR_SECOND_UNIT_EXECUTED_INST = 0x71,
-       ARMV7_PERFCTR_LD_ST_UNIT_EXECUTED_INST  = 0x72,
-       ARMV7_PERFCTR_FP_EXECUTED_INST          = 0x73,
-       ARMV7_PERFCTR_NEON_EXECUTED_INST        = 0x74,
-       ARMV7_PERFCTR_PLD_FULL_DEP_STALL_CYCLES = 0x80,
-       ARMV7_PERFCTR_DATA_WR_DEP_STALL_CYCLES  = 0x81,
-       ARMV7_PERFCTR_ITLB_MISS_DEP_STALL_CYCLES        = 0x82,
-       ARMV7_PERFCTR_DTLB_MISS_DEP_STALL_CYCLES        = 0x83,
-       ARMV7_PERFCTR_MICRO_ITLB_MISS_DEP_STALL_CYCLES  = 0x84,
-       ARMV7_PERFCTR_MICRO_DTLB_MISS_DEP_STALL_CYCLES  = 0x85,
-       ARMV7_PERFCTR_DMB_DEP_STALL_CYCLES      = 0x86,
-       ARMV7_PERFCTR_INTGR_CLK_ENABLED_CYCLES  = 0x8A,
-       ARMV7_PERFCTR_DATA_ENGINE_CLK_EN_CYCLES = 0x8B,
-       ARMV7_PERFCTR_ISB_INST                  = 0x90,
-       ARMV7_PERFCTR_DSB_INST                  = 0x91,
-       ARMV7_PERFCTR_DMB_INST                  = 0x92,
-       ARMV7_PERFCTR_EXT_INTERRUPTS            = 0x93,
-       ARMV7_PERFCTR_PLE_CACHE_LINE_RQST_COMPLETED     = 0xA0,
-       ARMV7_PERFCTR_PLE_CACHE_LINE_RQST_SKIPPED       = 0xA1,
-       ARMV7_PERFCTR_PLE_FIFO_FLUSH            = 0xA2,
-       ARMV7_PERFCTR_PLE_RQST_COMPLETED        = 0xA3,
-       ARMV7_PERFCTR_PLE_FIFO_OVERFLOW         = 0xA4,
-       ARMV7_PERFCTR_PLE_RQST_PROG             = 0xA5
- };
- /*
-  * Cortex-A8 HW events mapping
-  *
-  * The hardware events that we support. We do support cache operations but
-  * we have harvard caches and no way to combine instruction and data
-  * accesses/misses in hardware.
-  */
- static const unsigned armv7_a8_perf_map[PERF_COUNT_HW_MAX] = {
-       [PERF_COUNT_HW_CPU_CYCLES]          = ARMV7_PERFCTR_CPU_CYCLES,
-       [PERF_COUNT_HW_INSTRUCTIONS]        = ARMV7_PERFCTR_INSTR_EXECUTED,
-       [PERF_COUNT_HW_CACHE_REFERENCES]    = HW_OP_UNSUPPORTED,
-       [PERF_COUNT_HW_CACHE_MISSES]        = HW_OP_UNSUPPORTED,
-       [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERFCTR_PC_WRITE,
-       [PERF_COUNT_HW_BRANCH_MISSES]       = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
-       [PERF_COUNT_HW_BUS_CYCLES]          = ARMV7_PERFCTR_CLOCK_CYCLES,
- };
- static const unsigned armv7_a8_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
-                                         [PERF_COUNT_HW_CACHE_OP_MAX]
-                                         [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
-       [C(L1D)] = {
-               /*
-                * The performance counters don't differentiate between read
-                * and write accesses/misses so this isn't strictly correct,
-                * but it's the best we can do. Writes and reads get
-                * combined.
-                */
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = ARMV7_PERFCTR_DCACHE_ACCESS,
-                       [C(RESULT_MISS)]        = ARMV7_PERFCTR_DCACHE_REFILL,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = ARMV7_PERFCTR_DCACHE_ACCESS,
-                       [C(RESULT_MISS)]        = ARMV7_PERFCTR_DCACHE_REFILL,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(L1I)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = ARMV7_PERFCTR_L1_INST,
-                       [C(RESULT_MISS)]        = ARMV7_PERFCTR_L1_INST_MISS,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = ARMV7_PERFCTR_L1_INST,
-                       [C(RESULT_MISS)]        = ARMV7_PERFCTR_L1_INST_MISS,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(LL)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = ARMV7_PERFCTR_L2_ACCESS,
-                       [C(RESULT_MISS)]        = ARMV7_PERFCTR_L2_CACH_MISS,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = ARMV7_PERFCTR_L2_ACCESS,
-                       [C(RESULT_MISS)]        = ARMV7_PERFCTR_L2_CACH_MISS,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(DTLB)] = {
-               /*
-                * Only ITLB misses and DTLB refills are supported.
-                * If users want the DTLB refills misses a raw counter
-                * must be used.
-                */
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = ARMV7_PERFCTR_DTLB_REFILL,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = ARMV7_PERFCTR_DTLB_REFILL,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(ITLB)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = ARMV7_PERFCTR_ITLB_MISS,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = ARMV7_PERFCTR_ITLB_MISS,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(BPU)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = ARMV7_PERFCTR_PC_WRITE,
-                       [C(RESULT_MISS)]
-                                       = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = ARMV7_PERFCTR_PC_WRITE,
-                       [C(RESULT_MISS)]
-                                       = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
- };
- /*
-  * Cortex-A9 HW events mapping
-  */
- static const unsigned armv7_a9_perf_map[PERF_COUNT_HW_MAX] = {
-       [PERF_COUNT_HW_CPU_CYCLES]          = ARMV7_PERFCTR_CPU_CYCLES,
-       [PERF_COUNT_HW_INSTRUCTIONS]        =
-                                       ARMV7_PERFCTR_INST_OUT_OF_RENAME_STAGE,
-       [PERF_COUNT_HW_CACHE_REFERENCES]    = ARMV7_PERFCTR_COHERENT_LINE_HIT,
-       [PERF_COUNT_HW_CACHE_MISSES]        = ARMV7_PERFCTR_COHERENT_LINE_MISS,
-       [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERFCTR_PC_WRITE,
-       [PERF_COUNT_HW_BRANCH_MISSES]       = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
-       [PERF_COUNT_HW_BUS_CYCLES]          = ARMV7_PERFCTR_CLOCK_CYCLES,
- };
- static const unsigned armv7_a9_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
-                                         [PERF_COUNT_HW_CACHE_OP_MAX]
-                                         [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
-       [C(L1D)] = {
-               /*
-                * The performance counters don't differentiate between read
-                * and write accesses/misses so this isn't strictly correct,
-                * but it's the best we can do. Writes and reads get
-                * combined.
-                */
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = ARMV7_PERFCTR_DCACHE_ACCESS,
-                       [C(RESULT_MISS)]        = ARMV7_PERFCTR_DCACHE_REFILL,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = ARMV7_PERFCTR_DCACHE_ACCESS,
-                       [C(RESULT_MISS)]        = ARMV7_PERFCTR_DCACHE_REFILL,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(L1I)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = ARMV7_PERFCTR_IFETCH_MISS,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = ARMV7_PERFCTR_IFETCH_MISS,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(LL)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(DTLB)] = {
-               /*
-                * Only ITLB misses and DTLB refills are supported.
-                * If users want the DTLB refills misses a raw counter
-                * must be used.
-                */
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = ARMV7_PERFCTR_DTLB_REFILL,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = ARMV7_PERFCTR_DTLB_REFILL,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(ITLB)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = ARMV7_PERFCTR_ITLB_MISS,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = ARMV7_PERFCTR_ITLB_MISS,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(BPU)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = ARMV7_PERFCTR_PC_WRITE,
-                       [C(RESULT_MISS)]
-                                       = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = ARMV7_PERFCTR_PC_WRITE,
-                       [C(RESULT_MISS)]
-                                       = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
- };
- /*
-  * Perf Events counters
-  */
- enum armv7_counters {
-       ARMV7_CYCLE_COUNTER             = 1,    /* Cycle counter */
-       ARMV7_COUNTER0                  = 2,    /* First event counter */
- };
- /*
-  * The cycle counter is ARMV7_CYCLE_COUNTER.
-  * The first event counter is ARMV7_COUNTER0.
-  * The last event counter is (ARMV7_COUNTER0 + armpmu->num_events - 1).
-  */
- #define       ARMV7_COUNTER_LAST      (ARMV7_COUNTER0 + armpmu->num_events - 1)
- /*
-  * ARMv7 low level PMNC access
-  */
- /*
-  * Per-CPU PMNC: config reg
-  */
- #define ARMV7_PMNC_E          (1 << 0) /* Enable all counters */
- #define ARMV7_PMNC_P          (1 << 1) /* Reset all counters */
- #define ARMV7_PMNC_C          (1 << 2) /* Cycle counter reset */
- #define ARMV7_PMNC_D          (1 << 3) /* CCNT counts every 64th cpu cycle */
- #define ARMV7_PMNC_X          (1 << 4) /* Export to ETM */
- #define ARMV7_PMNC_DP         (1 << 5) /* Disable CCNT if non-invasive debug*/
- #define       ARMV7_PMNC_N_SHIFT      11       /* Number of counters supported */
- #define       ARMV7_PMNC_N_MASK       0x1f
- #define       ARMV7_PMNC_MASK         0x3f     /* Mask for writable bits */
- /*
-  * Available counters
-  */
- #define ARMV7_CNT0            0       /* First event counter */
- #define ARMV7_CCNT            31      /* Cycle counter */
- /* Perf Event to low level counters mapping */
- #define ARMV7_EVENT_CNT_TO_CNTx       (ARMV7_COUNTER0 - ARMV7_CNT0)
- /*
-  * CNTENS: counters enable reg
-  */
- #define ARMV7_CNTENS_P(idx)   (1 << (idx - ARMV7_EVENT_CNT_TO_CNTx))
- #define ARMV7_CNTENS_C                (1 << ARMV7_CCNT)
- /*
-  * CNTENC: counters disable reg
-  */
- #define ARMV7_CNTENC_P(idx)   (1 << (idx - ARMV7_EVENT_CNT_TO_CNTx))
- #define ARMV7_CNTENC_C                (1 << ARMV7_CCNT)
- /*
-  * INTENS: counters overflow interrupt enable reg
-  */
- #define ARMV7_INTENS_P(idx)   (1 << (idx - ARMV7_EVENT_CNT_TO_CNTx))
- #define ARMV7_INTENS_C                (1 << ARMV7_CCNT)
- /*
-  * INTENC: counters overflow interrupt disable reg
-  */
- #define ARMV7_INTENC_P(idx)   (1 << (idx - ARMV7_EVENT_CNT_TO_CNTx))
- #define ARMV7_INTENC_C                (1 << ARMV7_CCNT)
- /*
-  * EVTSEL: Event selection reg
-  */
- #define       ARMV7_EVTSEL_MASK       0xff            /* Mask for writable bits */
- /*
-  * SELECT: Counter selection reg
-  */
- #define       ARMV7_SELECT_MASK       0x1f            /* Mask for writable bits */
- /*
-  * FLAG: counters overflow flag status reg
-  */
- #define ARMV7_FLAG_P(idx)     (1 << (idx - ARMV7_EVENT_CNT_TO_CNTx))
- #define ARMV7_FLAG_C          (1 << ARMV7_CCNT)
- #define       ARMV7_FLAG_MASK         0xffffffff      /* Mask for writable bits */
- #define       ARMV7_OVERFLOWED_MASK   ARMV7_FLAG_MASK
- static inline unsigned long armv7_pmnc_read(void)
- {
-       u32 val;
-       asm volatile("mrc p15, 0, %0, c9, c12, 0" : "=r"(val));
-       return val;
- }
- static inline void armv7_pmnc_write(unsigned long val)
- {
-       val &= ARMV7_PMNC_MASK;
-       asm volatile("mcr p15, 0, %0, c9, c12, 0" : : "r"(val));
- }
- static inline int armv7_pmnc_has_overflowed(unsigned long pmnc)
- {
-       return pmnc & ARMV7_OVERFLOWED_MASK;
- }
- static inline int armv7_pmnc_counter_has_overflowed(unsigned long pmnc,
-                                       enum armv7_counters counter)
- {
-       int ret = 0;
-       if (counter == ARMV7_CYCLE_COUNTER)
-               ret = pmnc & ARMV7_FLAG_C;
-       else if ((counter >= ARMV7_COUNTER0) && (counter <= ARMV7_COUNTER_LAST))
-               ret = pmnc & ARMV7_FLAG_P(counter);
-       else
-               pr_err("CPU%u checking wrong counter %d overflow status\n",
-                       smp_processor_id(), counter);
-       return ret;
- }
- static inline int armv7_pmnc_select_counter(unsigned int idx)
- {
-       u32 val;
-       if ((idx < ARMV7_COUNTER0) || (idx > ARMV7_COUNTER_LAST)) {
-               pr_err("CPU%u selecting wrong PMNC counter"
-                       " %d\n", smp_processor_id(), idx);
-               return -1;
-       }
-       val = (idx - ARMV7_EVENT_CNT_TO_CNTx) & ARMV7_SELECT_MASK;
-       asm volatile("mcr p15, 0, %0, c9, c12, 5" : : "r" (val));
-       return idx;
- }
- static inline u32 armv7pmu_read_counter(int idx)
- {
-       unsigned long value = 0;
-       if (idx == ARMV7_CYCLE_COUNTER)
-               asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r" (value));
-       else if ((idx >= ARMV7_COUNTER0) && (idx <= ARMV7_COUNTER_LAST)) {
-               if (armv7_pmnc_select_counter(idx) == idx)
-                       asm volatile("mrc p15, 0, %0, c9, c13, 2"
-                                    : "=r" (value));
-       } else
-               pr_err("CPU%u reading wrong counter %d\n",
-                       smp_processor_id(), idx);
-       return value;
- }
- static inline void armv7pmu_write_counter(int idx, u32 value)
- {
-       if (idx == ARMV7_CYCLE_COUNTER)
-               asm volatile("mcr p15, 0, %0, c9, c13, 0" : : "r" (value));
-       else if ((idx >= ARMV7_COUNTER0) && (idx <= ARMV7_COUNTER_LAST)) {
-               if (armv7_pmnc_select_counter(idx) == idx)
-                       asm volatile("mcr p15, 0, %0, c9, c13, 2"
-                                    : : "r" (value));
-       } else
-               pr_err("CPU%u writing wrong counter %d\n",
-                       smp_processor_id(), idx);
- }
- static inline void armv7_pmnc_write_evtsel(unsigned int idx, u32 val)
- {
-       if (armv7_pmnc_select_counter(idx) == idx) {
-               val &= ARMV7_EVTSEL_MASK;
-               asm volatile("mcr p15, 0, %0, c9, c13, 1" : : "r" (val));
-       }
- }
- static inline u32 armv7_pmnc_enable_counter(unsigned int idx)
- {
-       u32 val;
-       if ((idx != ARMV7_CYCLE_COUNTER) &&
-           ((idx < ARMV7_COUNTER0) || (idx > ARMV7_COUNTER_LAST))) {
-               pr_err("CPU%u enabling wrong PMNC counter"
-                       " %d\n", smp_processor_id(), idx);
-               return -1;
-       }
-       if (idx == ARMV7_CYCLE_COUNTER)
-               val = ARMV7_CNTENS_C;
-       else
-               val = ARMV7_CNTENS_P(idx);
-       asm volatile("mcr p15, 0, %0, c9, c12, 1" : : "r" (val));
-       return idx;
- }
- static inline u32 armv7_pmnc_disable_counter(unsigned int idx)
- {
-       u32 val;
-       if ((idx != ARMV7_CYCLE_COUNTER) &&
-           ((idx < ARMV7_COUNTER0) || (idx > ARMV7_COUNTER_LAST))) {
-               pr_err("CPU%u disabling wrong PMNC counter"
-                       " %d\n", smp_processor_id(), idx);
-               return -1;
-       }
-       if (idx == ARMV7_CYCLE_COUNTER)
-               val = ARMV7_CNTENC_C;
-       else
-               val = ARMV7_CNTENC_P(idx);
-       asm volatile("mcr p15, 0, %0, c9, c12, 2" : : "r" (val));
-       return idx;
- }
- static inline u32 armv7_pmnc_enable_intens(unsigned int idx)
- {
-       u32 val;
-       if ((idx != ARMV7_CYCLE_COUNTER) &&
-           ((idx < ARMV7_COUNTER0) || (idx > ARMV7_COUNTER_LAST))) {
-               pr_err("CPU%u enabling wrong PMNC counter"
-                       " interrupt enable %d\n", smp_processor_id(), idx);
-               return -1;
-       }
-       if (idx == ARMV7_CYCLE_COUNTER)
-               val = ARMV7_INTENS_C;
-       else
-               val = ARMV7_INTENS_P(idx);
-       asm volatile("mcr p15, 0, %0, c9, c14, 1" : : "r" (val));
-       return idx;
- }
- static inline u32 armv7_pmnc_disable_intens(unsigned int idx)
- {
-       u32 val;
-       if ((idx != ARMV7_CYCLE_COUNTER) &&
-           ((idx < ARMV7_COUNTER0) || (idx > ARMV7_COUNTER_LAST))) {
-               pr_err("CPU%u disabling wrong PMNC counter"
-                       " interrupt enable %d\n", smp_processor_id(), idx);
-               return -1;
-       }
-       if (idx == ARMV7_CYCLE_COUNTER)
-               val = ARMV7_INTENC_C;
-       else
-               val = ARMV7_INTENC_P(idx);
-       asm volatile("mcr p15, 0, %0, c9, c14, 2" : : "r" (val));
-       return idx;
- }
- static inline u32 armv7_pmnc_getreset_flags(void)
- {
-       u32 val;
-       /* Read */
-       asm volatile("mrc p15, 0, %0, c9, c12, 3" : "=r" (val));
-       /* Write to clear flags */
-       val &= ARMV7_FLAG_MASK;
-       asm volatile("mcr p15, 0, %0, c9, c12, 3" : : "r" (val));
-       return val;
- }
- #ifdef DEBUG
- static void armv7_pmnc_dump_regs(void)
- {
-       u32 val;
-       unsigned int cnt;
-       printk(KERN_INFO "PMNC registers dump:\n");
-       asm volatile("mrc p15, 0, %0, c9, c12, 0" : "=r" (val));
-       printk(KERN_INFO "PMNC  =0x%08x\n", val);
-       asm volatile("mrc p15, 0, %0, c9, c12, 1" : "=r" (val));
-       printk(KERN_INFO "CNTENS=0x%08x\n", val);
-       asm volatile("mrc p15, 0, %0, c9, c14, 1" : "=r" (val));
-       printk(KERN_INFO "INTENS=0x%08x\n", val);
-       asm volatile("mrc p15, 0, %0, c9, c12, 3" : "=r" (val));
-       printk(KERN_INFO "FLAGS =0x%08x\n", val);
-       asm volatile("mrc p15, 0, %0, c9, c12, 5" : "=r" (val));
-       printk(KERN_INFO "SELECT=0x%08x\n", val);
-       asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r" (val));
-       printk(KERN_INFO "CCNT  =0x%08x\n", val);
-       for (cnt = ARMV7_COUNTER0; cnt < ARMV7_COUNTER_LAST; cnt++) {
-               armv7_pmnc_select_counter(cnt);
-               asm volatile("mrc p15, 0, %0, c9, c13, 2" : "=r" (val));
-               printk(KERN_INFO "CNT[%d] count =0x%08x\n",
-                       cnt-ARMV7_EVENT_CNT_TO_CNTx, val);
-               asm volatile("mrc p15, 0, %0, c9, c13, 1" : "=r" (val));
-               printk(KERN_INFO "CNT[%d] evtsel=0x%08x\n",
-                       cnt-ARMV7_EVENT_CNT_TO_CNTx, val);
-       }
- }
- #endif
- void armv7pmu_enable_event(struct hw_perf_event *hwc, int idx)
- {
-       unsigned long flags;
-       /*
-        * Enable counter and interrupt, and set the counter to count
-        * the event that we're interested in.
-        */
-       spin_lock_irqsave(&pmu_lock, flags);
-       /*
-        * Disable counter
-        */
-       armv7_pmnc_disable_counter(idx);
-       /*
-        * Set event (if destined for PMNx counters)
-        * We don't need to set the event if it's a cycle count
-        */
-       if (idx != ARMV7_CYCLE_COUNTER)
-               armv7_pmnc_write_evtsel(idx, hwc->config_base);
-       /*
-        * Enable interrupt for this counter
-        */
-       armv7_pmnc_enable_intens(idx);
-       /*
-        * Enable counter
-        */
-       armv7_pmnc_enable_counter(idx);
-       spin_unlock_irqrestore(&pmu_lock, flags);
- }
- static void armv7pmu_disable_event(struct hw_perf_event *hwc, int idx)
- {
-       unsigned long flags;
-       /*
-        * Disable counter and interrupt
-        */
-       spin_lock_irqsave(&pmu_lock, flags);
-       /*
-        * Disable counter
-        */
-       armv7_pmnc_disable_counter(idx);
-       /*
-        * Disable interrupt for this counter
-        */
-       armv7_pmnc_disable_intens(idx);
-       spin_unlock_irqrestore(&pmu_lock, flags);
- }
- static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev)
- {
-       unsigned long pmnc;
-       struct perf_sample_data data;
-       struct cpu_hw_events *cpuc;
-       struct pt_regs *regs;
-       int idx;
-       /*
-        * Get and reset the IRQ flags
-        */
-       pmnc = armv7_pmnc_getreset_flags();
-       /*
-        * Did an overflow occur?
-        */
-       if (!armv7_pmnc_has_overflowed(pmnc))
-               return IRQ_NONE;
-       /*
-        * Handle the counter(s) overflow(s)
-        */
-       regs = get_irq_regs();
-       perf_sample_data_init(&data, 0);
-       cpuc = &__get_cpu_var(cpu_hw_events);
-       for (idx = 0; idx <= armpmu->num_events; ++idx) {
-               struct perf_event *event = cpuc->events[idx];
-               struct hw_perf_event *hwc;
-               if (!test_bit(idx, cpuc->active_mask))
-                       continue;
-               /*
-                * We have a single interrupt for all counters. Check that
-                * each counter has overflowed before we process it.
-                */
-               if (!armv7_pmnc_counter_has_overflowed(pmnc, idx))
-                       continue;
-               hwc = &event->hw;
-               armpmu_event_update(event, hwc, idx);
-               data.period = event->hw.last_period;
-               if (!armpmu_event_set_period(event, hwc, idx))
-                       continue;
-               if (perf_event_overflow(event, 0, &data, regs))
-                       armpmu->disable(hwc, idx);
-       }
-       /*
-        * Handle the pending perf events.
-        *
-        * Note: this call *must* be run with interrupts disabled. For
-        * platforms that can have the PMU interrupts raised as an NMI, this
-        * will not work.
-        */
-       irq_work_run();
-       return IRQ_HANDLED;
- }
- static void armv7pmu_start(void)
- {
-       unsigned long flags;
-       spin_lock_irqsave(&pmu_lock, flags);
-       /* Enable all counters */
-       armv7_pmnc_write(armv7_pmnc_read() | ARMV7_PMNC_E);
-       spin_unlock_irqrestore(&pmu_lock, flags);
- }
- static void armv7pmu_stop(void)
- {
-       unsigned long flags;
-       spin_lock_irqsave(&pmu_lock, flags);
-       /* Disable all counters */
-       armv7_pmnc_write(armv7_pmnc_read() & ~ARMV7_PMNC_E);
-       spin_unlock_irqrestore(&pmu_lock, flags);
- }
- static inline int armv7_a8_pmu_event_map(int config)
- {
-       int mapping = armv7_a8_perf_map[config];
-       if (HW_OP_UNSUPPORTED == mapping)
-               mapping = -EOPNOTSUPP;
-       return mapping;
- }
- static inline int armv7_a9_pmu_event_map(int config)
- {
-       int mapping = armv7_a9_perf_map[config];
-       if (HW_OP_UNSUPPORTED == mapping)
-               mapping = -EOPNOTSUPP;
-       return mapping;
- }
- static u64 armv7pmu_raw_event(u64 config)
- {
-       return config & 0xff;
- }
- static int armv7pmu_get_event_idx(struct cpu_hw_events *cpuc,
-                                 struct hw_perf_event *event)
- {
-       int idx;
-       /* Always place a cycle counter into the cycle counter. */
-       if (event->config_base == ARMV7_PERFCTR_CPU_CYCLES) {
-               if (test_and_set_bit(ARMV7_CYCLE_COUNTER, cpuc->used_mask))
-                       return -EAGAIN;
-               return ARMV7_CYCLE_COUNTER;
-       } else {
-               /*
-                * For anything other than a cycle counter, try and use
-                * the events counters
-                */
-               for (idx = ARMV7_COUNTER0; idx <= armpmu->num_events; ++idx) {
-                       if (!test_and_set_bit(idx, cpuc->used_mask))
-                               return idx;
-               }
-               /* The counters are all in use. */
-               return -EAGAIN;
-       }
- }
- static struct arm_pmu armv7pmu = {
-       .handle_irq             = armv7pmu_handle_irq,
-       .enable                 = armv7pmu_enable_event,
-       .disable                = armv7pmu_disable_event,
-       .raw_event              = armv7pmu_raw_event,
-       .read_counter           = armv7pmu_read_counter,
-       .write_counter          = armv7pmu_write_counter,
-       .get_event_idx          = armv7pmu_get_event_idx,
-       .start                  = armv7pmu_start,
-       .stop                   = armv7pmu_stop,
-       .max_period             = (1LLU << 32) - 1,
- };
- static u32 __init armv7_reset_read_pmnc(void)
- {
-       u32 nb_cnt;
-       /* Initialize & Reset PMNC: C and P bits */
-       armv7_pmnc_write(ARMV7_PMNC_P | ARMV7_PMNC_C);
-       /* Read the nb of CNTx counters supported from PMNC */
-       nb_cnt = (armv7_pmnc_read() >> ARMV7_PMNC_N_SHIFT) & ARMV7_PMNC_N_MASK;
-       /* Add the CPU cycles counter and return */
-       return nb_cnt + 1;
- }
- /*
-  * ARMv5 [xscale] Performance counter handling code.
-  *
-  * Based on xscale OProfile code.
-  *
-  * There are two variants of the xscale PMU that we support:
-  *    - xscale1pmu: 2 event counters and a cycle counter
-  *    - xscale2pmu: 4 event counters and a cycle counter
-  * The two variants share event definitions, but have different
-  * PMU structures.
-  */
- enum xscale_perf_types {
-       XSCALE_PERFCTR_ICACHE_MISS              = 0x00,
-       XSCALE_PERFCTR_ICACHE_NO_DELIVER        = 0x01,
-       XSCALE_PERFCTR_DATA_STALL               = 0x02,
-       XSCALE_PERFCTR_ITLB_MISS                = 0x03,
-       XSCALE_PERFCTR_DTLB_MISS                = 0x04,
-       XSCALE_PERFCTR_BRANCH                   = 0x05,
-       XSCALE_PERFCTR_BRANCH_MISS              = 0x06,
-       XSCALE_PERFCTR_INSTRUCTION              = 0x07,
-       XSCALE_PERFCTR_DCACHE_FULL_STALL        = 0x08,
-       XSCALE_PERFCTR_DCACHE_FULL_STALL_CONTIG = 0x09,
-       XSCALE_PERFCTR_DCACHE_ACCESS            = 0x0A,
-       XSCALE_PERFCTR_DCACHE_MISS              = 0x0B,
-       XSCALE_PERFCTR_DCACHE_WRITE_BACK        = 0x0C,
-       XSCALE_PERFCTR_PC_CHANGED               = 0x0D,
-       XSCALE_PERFCTR_BCU_REQUEST              = 0x10,
-       XSCALE_PERFCTR_BCU_FULL                 = 0x11,
-       XSCALE_PERFCTR_BCU_DRAIN                = 0x12,
-       XSCALE_PERFCTR_BCU_ECC_NO_ELOG          = 0x14,
-       XSCALE_PERFCTR_BCU_1_BIT_ERR            = 0x15,
-       XSCALE_PERFCTR_RMW                      = 0x16,
-       /* XSCALE_PERFCTR_CCNT is not hardware defined */
-       XSCALE_PERFCTR_CCNT                     = 0xFE,
-       XSCALE_PERFCTR_UNUSED                   = 0xFF,
- };
- enum xscale_counters {
-       XSCALE_CYCLE_COUNTER    = 1,
-       XSCALE_COUNTER0,
-       XSCALE_COUNTER1,
-       XSCALE_COUNTER2,
-       XSCALE_COUNTER3,
- };
- static const unsigned xscale_perf_map[PERF_COUNT_HW_MAX] = {
-       [PERF_COUNT_HW_CPU_CYCLES]          = XSCALE_PERFCTR_CCNT,
-       [PERF_COUNT_HW_INSTRUCTIONS]        = XSCALE_PERFCTR_INSTRUCTION,
-       [PERF_COUNT_HW_CACHE_REFERENCES]    = HW_OP_UNSUPPORTED,
-       [PERF_COUNT_HW_CACHE_MISSES]        = HW_OP_UNSUPPORTED,
-       [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = XSCALE_PERFCTR_BRANCH,
-       [PERF_COUNT_HW_BRANCH_MISSES]       = XSCALE_PERFCTR_BRANCH_MISS,
-       [PERF_COUNT_HW_BUS_CYCLES]          = HW_OP_UNSUPPORTED,
- };
- static const unsigned xscale_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
-                                          [PERF_COUNT_HW_CACHE_OP_MAX]
-                                          [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
-       [C(L1D)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = XSCALE_PERFCTR_DCACHE_ACCESS,
-                       [C(RESULT_MISS)]        = XSCALE_PERFCTR_DCACHE_MISS,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = XSCALE_PERFCTR_DCACHE_ACCESS,
-                       [C(RESULT_MISS)]        = XSCALE_PERFCTR_DCACHE_MISS,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(L1I)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = XSCALE_PERFCTR_ICACHE_MISS,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = XSCALE_PERFCTR_ICACHE_MISS,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(LL)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(DTLB)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = XSCALE_PERFCTR_DTLB_MISS,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = XSCALE_PERFCTR_DTLB_MISS,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(ITLB)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = XSCALE_PERFCTR_ITLB_MISS,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = XSCALE_PERFCTR_ITLB_MISS,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
-       [C(BPU)] = {
-               [C(OP_READ)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-               [C(OP_WRITE)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-               [C(OP_PREFETCH)] = {
-                       [C(RESULT_ACCESS)]      = CACHE_OP_UNSUPPORTED,
-                       [C(RESULT_MISS)]        = CACHE_OP_UNSUPPORTED,
-               },
-       },
- };
- #define       XSCALE_PMU_ENABLE       0x001
- #define XSCALE_PMN_RESET      0x002
- #define       XSCALE_CCNT_RESET       0x004
- #define       XSCALE_PMU_RESET        (CCNT_RESET | PMN_RESET)
- #define XSCALE_PMU_CNT64      0x008
- static inline int
- xscalepmu_event_map(int config)
- {
-       int mapping = xscale_perf_map[config];
-       if (HW_OP_UNSUPPORTED == mapping)
-               mapping = -EOPNOTSUPP;
-       return mapping;
- }
- static u64
- xscalepmu_raw_event(u64 config)
- {
-       return config & 0xff;
- }
- #define XSCALE1_OVERFLOWED_MASK       0x700
- #define XSCALE1_CCOUNT_OVERFLOW       0x400
- #define XSCALE1_COUNT0_OVERFLOW       0x100
- #define XSCALE1_COUNT1_OVERFLOW       0x200
- #define XSCALE1_CCOUNT_INT_EN 0x040
- #define XSCALE1_COUNT0_INT_EN 0x010
- #define XSCALE1_COUNT1_INT_EN 0x020
- #define XSCALE1_COUNT0_EVT_SHFT       12
- #define XSCALE1_COUNT0_EVT_MASK       (0xff << XSCALE1_COUNT0_EVT_SHFT)
- #define XSCALE1_COUNT1_EVT_SHFT       20
- #define XSCALE1_COUNT1_EVT_MASK       (0xff << XSCALE1_COUNT1_EVT_SHFT)
- static inline u32
- xscale1pmu_read_pmnc(void)
- {
-       u32 val;
-       asm volatile("mrc p14, 0, %0, c0, c0, 0" : "=r" (val));
-       return val;
- }
- static inline void
- xscale1pmu_write_pmnc(u32 val)
- {
-       /* upper 4bits and 7, 11 are write-as-0 */
-       val &= 0xffff77f;
-       asm volatile("mcr p14, 0, %0, c0, c0, 0" : : "r" (val));
- }
- static inline int
- xscale1_pmnc_counter_has_overflowed(unsigned long pmnc,
-                                       enum xscale_counters counter)
- {
-       int ret = 0;
-       switch (counter) {
-       case XSCALE_CYCLE_COUNTER:
-               ret = pmnc & XSCALE1_CCOUNT_OVERFLOW;
-               break;
-       case XSCALE_COUNTER0:
-               ret = pmnc & XSCALE1_COUNT0_OVERFLOW;
-               break;
-       case XSCALE_COUNTER1:
-               ret = pmnc & XSCALE1_COUNT1_OVERFLOW;
-               break;
-       default:
-               WARN_ONCE(1, "invalid counter number (%d)\n", counter);
-       }
-       return ret;
- }
- static irqreturn_t
- xscale1pmu_handle_irq(int irq_num, void *dev)
- {
-       unsigned long pmnc;
-       struct perf_sample_data data;
-       struct cpu_hw_events *cpuc;
-       struct pt_regs *regs;
-       int idx;
-       /*
-        * NOTE: there's an A stepping erratum that states if an overflow
-        *       bit already exists and another occurs, the previous
-        *       Overflow bit gets cleared. There's no workaround.
-        *       Fixed in B stepping or later.
-        */
-       pmnc = xscale1pmu_read_pmnc();
-       /*
-        * Write the value back to clear the overflow flags. Overflow
-        * flags remain in pmnc for use below. We also disable the PMU
-        * while we process the interrupt.
-        */
-       xscale1pmu_write_pmnc(pmnc & ~XSCALE_PMU_ENABLE);
-       if (!(pmnc & XSCALE1_OVERFLOWED_MASK))
-               return IRQ_NONE;
-       regs = get_irq_regs();
-       perf_sample_data_init(&data, 0);
-       cpuc = &__get_cpu_var(cpu_hw_events);
-       for (idx = 0; idx <= armpmu->num_events; ++idx) {
-               struct perf_event *event = cpuc->events[idx];
-               struct hw_perf_event *hwc;
-               if (!test_bit(idx, cpuc->active_mask))
-                       continue;
-               if (!xscale1_pmnc_counter_has_overflowed(pmnc, idx))
-                       continue;
-               hwc = &event->hw;
-               armpmu_event_update(event, hwc, idx);
-               data.period = event->hw.last_period;
-               if (!armpmu_event_set_period(event, hwc, idx))
-                       continue;
-               if (perf_event_overflow(event, 0, &data, regs))
-                       armpmu->disable(hwc, idx);
-       }
-       irq_work_run();
-       /*
-        * Re-enable the PMU.
-        */
-       pmnc = xscale1pmu_read_pmnc() | XSCALE_PMU_ENABLE;
-       xscale1pmu_write_pmnc(pmnc);
-       return IRQ_HANDLED;
- }
- static void
- xscale1pmu_enable_event(struct hw_perf_event *hwc, int idx)
- {
-       unsigned long val, mask, evt, flags;
-       switch (idx) {
-       case XSCALE_CYCLE_COUNTER:
-               mask = 0;
-               evt = XSCALE1_CCOUNT_INT_EN;
-               break;
-       case XSCALE_COUNTER0:
-               mask = XSCALE1_COUNT0_EVT_MASK;
-               evt = (hwc->config_base << XSCALE1_COUNT0_EVT_SHFT) |
-                       XSCALE1_COUNT0_INT_EN;
-               break;
-       case XSCALE_COUNTER1:
-               mask = XSCALE1_COUNT1_EVT_MASK;
-               evt = (hwc->config_base << XSCALE1_COUNT1_EVT_SHFT) |
-                       XSCALE1_COUNT1_INT_EN;
-               break;
-       default:
-               WARN_ONCE(1, "invalid counter number (%d)\n", idx);
-               return;
-       }
-       spin_lock_irqsave(&pmu_lock, flags);
-       val = xscale1pmu_read_pmnc();
-       val &= ~mask;
-       val |= evt;
-       xscale1pmu_write_pmnc(val);
-       spin_unlock_irqrestore(&pmu_lock, flags);
- }
- static void
- xscale1pmu_disable_event(struct hw_perf_event *hwc, int idx)
- {
-       unsigned long val, mask, evt, flags;
-       switch (idx) {
-       case XSCALE_CYCLE_COUNTER:
-               mask = XSCALE1_CCOUNT_INT_EN;
-               evt = 0;
-               break;
-       case XSCALE_COUNTER0:
-               mask = XSCALE1_COUNT0_INT_EN | XSCALE1_COUNT0_EVT_MASK;
-               evt = XSCALE_PERFCTR_UNUSED << XSCALE1_COUNT0_EVT_SHFT;
-               break;
-       case XSCALE_COUNTER1:
-               mask = XSCALE1_COUNT1_INT_EN | XSCALE1_COUNT1_EVT_MASK;
-               evt = XSCALE_PERFCTR_UNUSED << XSCALE1_COUNT1_EVT_SHFT;
-               break;
-       default:
-               WARN_ONCE(1, "invalid counter number (%d)\n", idx);
-               return;
-       }
-       spin_lock_irqsave(&pmu_lock, flags);
-       val = xscale1pmu_read_pmnc();
-       val &= ~mask;
-       val |= evt;
-       xscale1pmu_write_pmnc(val);
-       spin_unlock_irqrestore(&pmu_lock, flags);
- }
- static int
- xscale1pmu_get_event_idx(struct cpu_hw_events *cpuc,
-                       struct hw_perf_event *event)
- {
-       if (XSCALE_PERFCTR_CCNT == event->config_base) {
-               if (test_and_set_bit(XSCALE_CYCLE_COUNTER, cpuc->used_mask))
-                       return -EAGAIN;
-               return XSCALE_CYCLE_COUNTER;
-       } else {
-               if (!test_and_set_bit(XSCALE_COUNTER1, cpuc->used_mask)) {
-                       return XSCALE_COUNTER1;
-               }
-               if (!test_and_set_bit(XSCALE_COUNTER0, cpuc->used_mask)) {
-                       return XSCALE_COUNTER0;
-               }
-               return -EAGAIN;
-       }
- }
- static void
- xscale1pmu_start(void)
- {
-       unsigned long flags, val;
-       spin_lock_irqsave(&pmu_lock, flags);
-       val = xscale1pmu_read_pmnc();
-       val |= XSCALE_PMU_ENABLE;
-       xscale1pmu_write_pmnc(val);
-       spin_unlock_irqrestore(&pmu_lock, flags);
- }
- static void
- xscale1pmu_stop(void)
- {
-       unsigned long flags, val;
-       spin_lock_irqsave(&pmu_lock, flags);
-       val = xscale1pmu_read_pmnc();
-       val &= ~XSCALE_PMU_ENABLE;
-       xscale1pmu_write_pmnc(val);
-       spin_unlock_irqrestore(&pmu_lock, flags);
- }
- static inline u32
- xscale1pmu_read_counter(int counter)
- {
-       u32 val = 0;
-       switch (counter) {
-       case XSCALE_CYCLE_COUNTER:
-               asm volatile("mrc p14, 0, %0, c1, c0, 0" : "=r" (val));
-               break;
-       case XSCALE_COUNTER0:
-               asm volatile("mrc p14, 0, %0, c2, c0, 0" : "=r" (val));
-               break;
-       case XSCALE_COUNTER1:
-               asm volatile("mrc p14, 0, %0, c3, c0, 0" : "=r" (val));
-               break;
-       }
-       return val;
- }
- static inline void
- xscale1pmu_write_counter(int counter, u32 val)
- {
-       switch (counter) {
-       case XSCALE_CYCLE_COUNTER:
-               asm volatile("mcr p14, 0, %0, c1, c0, 0" : : "r" (val));
-               break;
-       case XSCALE_COUNTER0:
-               asm volatile("mcr p14, 0, %0, c2, c0, 0" : : "r" (val));
-               break;
-       case XSCALE_COUNTER1:
-               asm volatile("mcr p14, 0, %0, c3, c0, 0" : : "r" (val));
-               break;
-       }
- }
- static const struct arm_pmu xscale1pmu = {
-       .id             = ARM_PERF_PMU_ID_XSCALE1,
-       .handle_irq     = xscale1pmu_handle_irq,
-       .enable         = xscale1pmu_enable_event,
-       .disable        = xscale1pmu_disable_event,
-       .event_map      = xscalepmu_event_map,
-       .raw_event      = xscalepmu_raw_event,
-       .read_counter   = xscale1pmu_read_counter,
-       .write_counter  = xscale1pmu_write_counter,
-       .get_event_idx  = xscale1pmu_get_event_idx,
-       .start          = xscale1pmu_start,
-       .stop           = xscale1pmu_stop,
-       .num_events     = 3,
-       .max_period     = (1LLU << 32) - 1,
- };
- #define XSCALE2_OVERFLOWED_MASK       0x01f
- #define XSCALE2_CCOUNT_OVERFLOW       0x001
- #define XSCALE2_COUNT0_OVERFLOW       0x002
- #define XSCALE2_COUNT1_OVERFLOW       0x004
- #define XSCALE2_COUNT2_OVERFLOW       0x008
- #define XSCALE2_COUNT3_OVERFLOW       0x010
- #define XSCALE2_CCOUNT_INT_EN 0x001
- #define XSCALE2_COUNT0_INT_EN 0x002
- #define XSCALE2_COUNT1_INT_EN 0x004
- #define XSCALE2_COUNT2_INT_EN 0x008
- #define XSCALE2_COUNT3_INT_EN 0x010
- #define XSCALE2_COUNT0_EVT_SHFT       0
- #define XSCALE2_COUNT0_EVT_MASK       (0xff << XSCALE2_COUNT0_EVT_SHFT)
- #define XSCALE2_COUNT1_EVT_SHFT       8
- #define XSCALE2_COUNT1_EVT_MASK       (0xff << XSCALE2_COUNT1_EVT_SHFT)
- #define XSCALE2_COUNT2_EVT_SHFT       16
- #define XSCALE2_COUNT2_EVT_MASK       (0xff << XSCALE2_COUNT2_EVT_SHFT)
- #define XSCALE2_COUNT3_EVT_SHFT       24
- #define XSCALE2_COUNT3_EVT_MASK       (0xff << XSCALE2_COUNT3_EVT_SHFT)
- static inline u32
- xscale2pmu_read_pmnc(void)
- {
-       u32 val;
-       asm volatile("mrc p14, 0, %0, c0, c1, 0" : "=r" (val));
-       /* bits 1-2 and 4-23 are read-unpredictable */
-       return val & 0xff000009;
- }
- static inline void
- xscale2pmu_write_pmnc(u32 val)
- {
-       /* bits 4-23 are write-as-0, 24-31 are write ignored */
-       val &= 0xf;
-       asm volatile("mcr p14, 0, %0, c0, c1, 0" : : "r" (val));
- }
- static inline u32
- xscale2pmu_read_overflow_flags(void)
- {
-       u32 val;
-       asm volatile("mrc p14, 0, %0, c5, c1, 0" : "=r" (val));
-       return val;
- }
- static inline void
- xscale2pmu_write_overflow_flags(u32 val)
- {
-       asm volatile("mcr p14, 0, %0, c5, c1, 0" : : "r" (val));
- }
- static inline u32
- xscale2pmu_read_event_select(void)
- {
-       u32 val;
-       asm volatile("mrc p14, 0, %0, c8, c1, 0" : "=r" (val));
-       return val;
- }
- static inline void
- xscale2pmu_write_event_select(u32 val)
- {
-       asm volatile("mcr p14, 0, %0, c8, c1, 0" : : "r"(val));
- }
- static inline u32
- xscale2pmu_read_int_enable(void)
- {
-       u32 val;
-       asm volatile("mrc p14, 0, %0, c4, c1, 0" : "=r" (val));
-       return val;
- }
- static void
- xscale2pmu_write_int_enable(u32 val)
- {
-       asm volatile("mcr p14, 0, %0, c4, c1, 0" : : "r" (val));
- }
- static inline int
- xscale2_pmnc_counter_has_overflowed(unsigned long of_flags,
-                                       enum xscale_counters counter)
- {
-       int ret = 0;
-       switch (counter) {
-       case XSCALE_CYCLE_COUNTER:
-               ret = of_flags & XSCALE2_CCOUNT_OVERFLOW;
-               break;
-       case XSCALE_COUNTER0:
-               ret = of_flags & XSCALE2_COUNT0_OVERFLOW;
-               break;
-       case XSCALE_COUNTER1:
-               ret = of_flags & XSCALE2_COUNT1_OVERFLOW;
-               break;
-       case XSCALE_COUNTER2:
-               ret = of_flags & XSCALE2_COUNT2_OVERFLOW;
-               break;
-       case XSCALE_COUNTER3:
-               ret = of_flags & XSCALE2_COUNT3_OVERFLOW;
-               break;
-       default:
-               WARN_ONCE(1, "invalid counter number (%d)\n", counter);
-       }
-       return ret;
- }
- static irqreturn_t
- xscale2pmu_handle_irq(int irq_num, void *dev)
- {
-       unsigned long pmnc, of_flags;
-       struct perf_sample_data data;
-       struct cpu_hw_events *cpuc;
-       struct pt_regs *regs;
-       int idx;
-       /* Disable the PMU. */
-       pmnc = xscale2pmu_read_pmnc();
-       xscale2pmu_write_pmnc(pmnc & ~XSCALE_PMU_ENABLE);
-       /* Check the overflow flag register. */
-       of_flags = xscale2pmu_read_overflow_flags();
-       if (!(of_flags & XSCALE2_OVERFLOWED_MASK))
-               return IRQ_NONE;
-       /* Clear the overflow bits. */
-       xscale2pmu_write_overflow_flags(of_flags);
-       regs = get_irq_regs();
-       perf_sample_data_init(&data, 0);
-       cpuc = &__get_cpu_var(cpu_hw_events);
-       for (idx = 0; idx <= armpmu->num_events; ++idx) {
-               struct perf_event *event = cpuc->events[idx];
-               struct hw_perf_event *hwc;
-               if (!test_bit(idx, cpuc->active_mask))
-                       continue;
-               if (!xscale2_pmnc_counter_has_overflowed(pmnc, idx))
-                       continue;
-               hwc = &event->hw;
-               armpmu_event_update(event, hwc, idx);
-               data.period = event->hw.last_period;
-               if (!armpmu_event_set_period(event, hwc, idx))
-                       continue;
-               if (perf_event_overflow(event, 0, &data, regs))
-                       armpmu->disable(hwc, idx);
-       }
-       irq_work_run();
-       /*
-        * Re-enable the PMU.
-        */
-       pmnc = xscale2pmu_read_pmnc() | XSCALE_PMU_ENABLE;
-       xscale2pmu_write_pmnc(pmnc);
-       return IRQ_HANDLED;
- }
- static void
- xscale2pmu_enable_event(struct hw_perf_event *hwc, int idx)
- {
-       unsigned long flags, ien, evtsel;
-       ien = xscale2pmu_read_int_enable();
-       evtsel = xscale2pmu_read_event_select();
-       switch (idx) {
-       case XSCALE_CYCLE_COUNTER:
-               ien |= XSCALE2_CCOUNT_INT_EN;
-               break;
-       case XSCALE_COUNTER0:
-               ien |= XSCALE2_COUNT0_INT_EN;
-               evtsel &= ~XSCALE2_COUNT0_EVT_MASK;
-               evtsel |= hwc->config_base << XSCALE2_COUNT0_EVT_SHFT;
-               break;
-       case XSCALE_COUNTER1:
-               ien |= XSCALE2_COUNT1_INT_EN;
-               evtsel &= ~XSCALE2_COUNT1_EVT_MASK;
-               evtsel |= hwc->config_base << XSCALE2_COUNT1_EVT_SHFT;
-               break;
-       case XSCALE_COUNTER2:
-               ien |= XSCALE2_COUNT2_INT_EN;
-               evtsel &= ~XSCALE2_COUNT2_EVT_MASK;
-               evtsel |= hwc->config_base << XSCALE2_COUNT2_EVT_SHFT;
-               break;
-       case XSCALE_COUNTER3:
-               ien |= XSCALE2_COUNT3_INT_EN;
-               evtsel &= ~XSCALE2_COUNT3_EVT_MASK;
-               evtsel |= hwc->config_base << XSCALE2_COUNT3_EVT_SHFT;
-               break;
-       default:
-               WARN_ONCE(1, "invalid counter number (%d)\n", idx);
-               return;
-       }
-       spin_lock_irqsave(&pmu_lock, flags);
-       xscale2pmu_write_event_select(evtsel);
-       xscale2pmu_write_int_enable(ien);
-       spin_unlock_irqrestore(&pmu_lock, flags);
- }
- static void
- xscale2pmu_disable_event(struct hw_perf_event *hwc, int idx)
- {
-       unsigned long flags, ien, evtsel;
-       ien = xscale2pmu_read_int_enable();
-       evtsel = xscale2pmu_read_event_select();
-       switch (idx) {
-       case XSCALE_CYCLE_COUNTER:
-               ien &= ~XSCALE2_CCOUNT_INT_EN;
-               break;
-       case XSCALE_COUNTER0:
-               ien &= ~XSCALE2_COUNT0_INT_EN;
-               evtsel &= ~XSCALE2_COUNT0_EVT_MASK;
-               evtsel |= XSCALE_PERFCTR_UNUSED << XSCALE2_COUNT0_EVT_SHFT;
-               break;
-       case XSCALE_COUNTER1:
-               ien &= ~XSCALE2_COUNT1_INT_EN;
-               evtsel &= ~XSCALE2_COUNT1_EVT_MASK;
-               evtsel |= XSCALE_PERFCTR_UNUSED << XSCALE2_COUNT1_EVT_SHFT;
-               break;
-       case XSCALE_COUNTER2:
-               ien &= ~XSCALE2_COUNT2_INT_EN;
-               evtsel &= ~XSCALE2_COUNT2_EVT_MASK;
-               evtsel |= XSCALE_PERFCTR_UNUSED << XSCALE2_COUNT2_EVT_SHFT;
-               break;
-       case XSCALE_COUNTER3:
-               ien &= ~XSCALE2_COUNT3_INT_EN;
-               evtsel &= ~XSCALE2_COUNT3_EVT_MASK;
-               evtsel |= XSCALE_PERFCTR_UNUSED << XSCALE2_COUNT3_EVT_SHFT;
-               break;
-       default:
-               WARN_ONCE(1, "invalid counter number (%d)\n", idx);
-               return;
-       }
-       spin_lock_irqsave(&pmu_lock, flags);
-       xscale2pmu_write_event_select(evtsel);
-       xscale2pmu_write_int_enable(ien);
-       spin_unlock_irqrestore(&pmu_lock, flags);
- }
- static int
- xscale2pmu_get_event_idx(struct cpu_hw_events *cpuc,
-                       struct hw_perf_event *event)
- {
-       int idx = xscale1pmu_get_event_idx(cpuc, event);
-       if (idx >= 0)
-               goto out;
-       if (!test_and_set_bit(XSCALE_COUNTER3, cpuc->used_mask))
-               idx = XSCALE_COUNTER3;
-       else if (!test_and_set_bit(XSCALE_COUNTER2, cpuc->used_mask))
-               idx = XSCALE_COUNTER2;
- out:
-       return idx;
- }
- static void
- xscale2pmu_start(void)
- {
-       unsigned long flags, val;
-       spin_lock_irqsave(&pmu_lock, flags);
-       val = xscale2pmu_read_pmnc() & ~XSCALE_PMU_CNT64;
-       val |= XSCALE_PMU_ENABLE;
-       xscale2pmu_write_pmnc(val);
-       spin_unlock_irqrestore(&pmu_lock, flags);
- }
- static void
- xscale2pmu_stop(void)
- {
-       unsigned long flags, val;
-       spin_lock_irqsave(&pmu_lock, flags);
-       val = xscale2pmu_read_pmnc();
-       val &= ~XSCALE_PMU_ENABLE;
-       xscale2pmu_write_pmnc(val);
-       spin_unlock_irqrestore(&pmu_lock, flags);
- }
- static inline u32
- xscale2pmu_read_counter(int counter)
- {
-       u32 val = 0;
-       switch (counter) {
-       case XSCALE_CYCLE_COUNTER:
-               asm volatile("mrc p14, 0, %0, c1, c1, 0" : "=r" (val));
-               break;
-       case XSCALE_COUNTER0:
-               asm volatile("mrc p14, 0, %0, c0, c2, 0" : "=r" (val));
-               break;
-       case XSCALE_COUNTER1:
-               asm volatile("mrc p14, 0, %0, c1, c2, 0" : "=r" (val));
-               break;
-       case XSCALE_COUNTER2:
-               asm volatile("mrc p14, 0, %0, c2, c2, 0" : "=r" (val));
-               break;
-       case XSCALE_COUNTER3:
-               asm volatile("mrc p14, 0, %0, c3, c2, 0" : "=r" (val));
-               break;
-       }
-       return val;
- }
- static inline void
- xscale2pmu_write_counter(int counter, u32 val)
- {
-       switch (counter) {
-       case XSCALE_CYCLE_COUNTER:
-               asm volatile("mcr p14, 0, %0, c1, c1, 0" : : "r" (val));
-               break;
-       case XSCALE_COUNTER0:
-               asm volatile("mcr p14, 0, %0, c0, c2, 0" : : "r" (val));
-               break;
-       case XSCALE_COUNTER1:
-               asm volatile("mcr p14, 0, %0, c1, c2, 0" : : "r" (val));
-               break;
-       case XSCALE_COUNTER2:
-               asm volatile("mcr p14, 0, %0, c2, c2, 0" : : "r" (val));
-               break;
-       case XSCALE_COUNTER3:
-               asm volatile("mcr p14, 0, %0, c3, c2, 0" : : "r" (val));
-               break;
-       }
- }
- static const struct arm_pmu xscale2pmu = {
-       .id             = ARM_PERF_PMU_ID_XSCALE2,
-       .handle_irq     = xscale2pmu_handle_irq,
-       .enable         = xscale2pmu_enable_event,
-       .disable        = xscale2pmu_disable_event,
-       .event_map      = xscalepmu_event_map,
-       .raw_event      = xscalepmu_raw_event,
-       .read_counter   = xscale2pmu_read_counter,
-       .write_counter  = xscale2pmu_write_counter,
-       .get_event_idx  = xscale2pmu_get_event_idx,
-       .start          = xscale2pmu_start,
-       .stop           = xscale2pmu_stop,
-       .num_events     = 5,
-       .max_period     = (1LLU << 32) - 1,
- };
+ /* Include the PMU-specific implementations. */
+ #include "perf_event_xscale.c"
+ #include "perf_event_v6.c"
+ #include "perf_event_v7.c"
  
  static int __init
  init_hw_perf_events(void)
                case 0xB360:    /* ARM1136 */
                case 0xB560:    /* ARM1156 */
                case 0xB760:    /* ARM1176 */
-                       armpmu = &armv6pmu;
-                       memcpy(armpmu_perf_cache_map, armv6_perf_cache_map,
-                                       sizeof(armv6_perf_cache_map));
+                       armpmu = armv6pmu_init();
                        break;
                case 0xB020:    /* ARM11mpcore */
-                       armpmu = &armv6mpcore_pmu;
-                       memcpy(armpmu_perf_cache_map,
-                              armv6mpcore_perf_cache_map,
-                              sizeof(armv6mpcore_perf_cache_map));
+                       armpmu = armv6mpcore_pmu_init();
                        break;
                case 0xC080:    /* Cortex-A8 */
-                       armv7pmu.id = ARM_PERF_PMU_ID_CA8;
-                       memcpy(armpmu_perf_cache_map, armv7_a8_perf_cache_map,
-                               sizeof(armv7_a8_perf_cache_map));
-                       armv7pmu.event_map = armv7_a8_pmu_event_map;
-                       armpmu = &armv7pmu;
-                       /* Reset PMNC and read the nb of CNTx counters
-                           supported */
-                       armv7pmu.num_events = armv7_reset_read_pmnc();
+                       armpmu = armv7_a8_pmu_init();
                        break;
                case 0xC090:    /* Cortex-A9 */
-                       armv7pmu.id = ARM_PERF_PMU_ID_CA9;
-                       memcpy(armpmu_perf_cache_map, armv7_a9_perf_cache_map,
-                               sizeof(armv7_a9_perf_cache_map));
-                       armv7pmu.event_map = armv7_a9_pmu_event_map;
-                       armpmu = &armv7pmu;
-                       /* Reset PMNC and read the nb of CNTx counters
-                           supported */
-                       armv7pmu.num_events = armv7_reset_read_pmnc();
+                       armpmu = armv7_a9_pmu_init();
                        break;
                }
        /* Intel CPUs [xscale]. */
                part_number = (cpuid >> 13) & 0x7;
                switch (part_number) {
                case 1:
-                       armpmu = &xscale1pmu;
-                       memcpy(armpmu_perf_cache_map, xscale_perf_cache_map,
-                                       sizeof(xscale_perf_cache_map));
+                       armpmu = xscale1pmu_init();
                        break;
                case 2:
-                       armpmu = &xscale2pmu;
-                       memcpy(armpmu_perf_cache_map, xscale_perf_cache_map,
-                                       sizeof(xscale_perf_cache_map));
+                       armpmu = xscale2pmu_init();
                        break;
                }
        }
  
        if (armpmu) {
                pr_info("enabled with %s PMU driver, %d counters available\n",
-                               arm_pmu_names[armpmu->id], armpmu->num_events);
+                       armpmu->name, armpmu->num_events);
        } else {
                pr_info("no hardware support available\n");
        }
  
 -      perf_pmu_register(&pmu);
 +      perf_pmu_register(&pmu, "cpu", PERF_TYPE_RAW);
  
        return 0;
  }
 -arch_initcall(init_hw_perf_events);
 +early_initcall(init_hw_perf_events);
  
  /*
   * Callchain handling code.
   * This code has been adapted from the ARM OProfile support.
   */
  struct frame_tail {
-       struct frame_tail   *fp;
-       unsigned long       sp;
-       unsigned long       lr;
+       struct frame_tail __user *fp;
+       unsigned long sp;
+       unsigned long lr;
  } __attribute__((packed));
  
  /*
   * Get the return address for a single stackframe and return a pointer to the
   * next frame tail.
   */
- static struct frame_tail *
- user_backtrace(struct frame_tail *tail,
+ static struct frame_tail __user *
+ user_backtrace(struct frame_tail __user *tail,
               struct perf_callchain_entry *entry)
  {
        struct frame_tail buftail;
  void
  perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
  {
-       struct frame_tail *tail;
+       struct frame_tail __user *tail;
  
  
-       tail = (struct frame_tail *)regs->ARM_fp - 1;
+       tail = (struct frame_tail __user *)regs->ARM_fp - 1;
  
        while (tail && !((unsigned long)tail & 0x3))
                tail = user_backtrace(tail, entry);
index 1a11f1ed216db8406698d470a8967c145801c899,31e5fd63ec9a1cad215e329e0bf47c477135808d..fae931ac2e5685b6f2cf11fb39fe99f6fcac311b
@@@ -44,12 -44,13 +44,14 @@@ config ARCH_MSM8X6
        select CPU_V7
        select MSM_V2_TLMM
        select MSM_GPIOMUX
 +      select IOMMU_API
  
  endchoice
  
  config MSM_SOC_REV_A
        bool
+ config  ARCH_MSM_SCORPIONMP
+       bool
  
  config  ARCH_MSM_ARM11
        bool
@@@ -123,10 -124,6 +125,10 @@@ config MACH_MSM8X60_FF
  
  endmenu
  
 +config IOMMU_PGTABLES_L2
 +      def_bool y
 +      depends on ARCH_MSM8X60 && MMU && SMP && CPU_DCACHE_DISABLE=n
 +
  config MSM_DEBUG_UART
        int
        default 1 if MSM_DEBUG_UART1
@@@ -167,7 -164,4 +169,7 @@@ config MSM_GPIOMU
  
  config MSM_V2_TLMM
        bool
 +
 +config IOMMU_API
 +      bool
  endif
index b1222dc43380f9dd6e99081a2080c8dd56d7ef8b,ac429ff2c20d85d35172769b18e55b5609e9203f..f92dbd0c06d553a1a9f8bdae0e1315d05f178081
@@@ -61,6 -61,7 +61,7 @@@
  #include <asm/mach/arch.h>
  #include <asm/mach/map.h>
  #include <asm/mach/time.h>
+ #include <asm/setup.h>
  
  /*
   * Address    Interface               BusWidth        note
@@@ -501,12 -502,7 +502,12 @@@ static struct platform_device keysc_dev
  static struct resource mipidsi0_resources[] = {
        [0] = {
                .start  = 0xffc60000,
 -              .end    = 0xffc68fff,
 +              .end    = 0xffc63073,
 +              .flags  = IORESOURCE_MEM,
 +      },
 +      [1] = {
 +              .start  = 0xffc68000,
 +              .end    = 0xffc680ef,
                .flags  = IORESOURCE_MEM,
        },
  };
  static struct sh_mipi_dsi_info mipidsi0_info = {
        .data_format    = MIPI_RGB888,
        .lcd_chan       = &lcdc_info.ch[0],
 +      .vsynw_offset   = 17,
  };
  
  static struct platform_device mipidsi0_device = {
        },
  };
  
 -/* This function will disappear when we switch to (runtime) PM */
 -static int __init ap4evb_init_display_clk(void)
 -{
 -      struct clk *lcdc_clk;
 -      struct clk *dsitx_clk;
 -      int ret;
 -
 -      lcdc_clk = clk_get(&lcdc_device.dev, "sh_mobile_lcdc_fb.0");
 -      if (IS_ERR(lcdc_clk))
 -              return PTR_ERR(lcdc_clk);
 -
 -      dsitx_clk = clk_get(&mipidsi0_device.dev, "sh-mipi-dsi.0");
 -      if (IS_ERR(dsitx_clk)) {
 -              ret = PTR_ERR(dsitx_clk);
 -              goto eclkdsitxget;
 -      }
 -
 -      ret = clk_enable(lcdc_clk);
 -      if (ret < 0)
 -              goto eclklcdcon;
 -
 -      ret = clk_enable(dsitx_clk);
 -      if (ret < 0)
 -              goto eclkdsitxon;
 -
 -      return 0;
 -
 -eclkdsitxon:
 -      clk_disable(lcdc_clk);
 -eclklcdcon:
 -      clk_put(dsitx_clk);
 -eclkdsitxget:
 -      clk_put(lcdc_clk);
 -
 -      return ret;
 -}
 -device_initcall(ap4evb_init_display_clk);
 -
  static struct platform_device *qhd_devices[] __initdata = {
        &mipidsi0_device,
        &keysc_device,
@@@ -732,15 -765,10 +733,15 @@@ static struct platform_device lcdc1_dev
        },
  };
  
 +static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
 +                              unsigned long *parent_freq);
 +
 +
  static struct sh_mobile_hdmi_info hdmi_info = {
        .lcd_chan = &sh_mobile_lcdc1_info.ch[0],
        .lcd_dev = &lcdc1_device.dev,
        .flags = HDMI_SND_SRC_SPDIF,
 +      .clk_optimize_parent = ap4evb_clk_optimize,
  };
  
  static struct resource hdmi_resources[] = {
@@@ -767,25 -795,6 +768,25 @@@ static struct platform_device hdmi_devi
        },
  };
  
 +static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
 +                              unsigned long *parent_freq)
 +{
 +      struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick");
 +      long error;
 +
 +      if (IS_ERR(hdmi_ick)) {
 +              int ret = PTR_ERR(hdmi_ick);
 +              pr_err("Cannot get HDMI ICK: %d\n", ret);
 +              return ret;
 +      }
 +
 +      error = clk_round_parent(hdmi_ick, target, best_freq, parent_freq, 1, 64);
 +
 +      clk_put(hdmi_ick);
 +
 +      return error;
 +}
 +
  static struct gpio_led ap4evb_leds[] = {
        {
                .name                   = "led4",
index 66663adb21f83ea51bcc9f282d32b8d20c6dae1b,d98deb497c2fac81991411b9ff949c4dfb0afb15..9aa8d68d1a9c027e5b3660235a17b5ad55cf24eb
@@@ -20,8 -20,8 +20,8 @@@
  #include <linux/kernel.h>
  #include <linux/io.h>
  #include <linux/sh_clk.h>
+ #include <linux/clkdev.h>
  #include <mach/common.h>
- #include <asm/clkdev.h>
  
  /* SH7372 registers */
  #define FRQCRA                0xe6150000
@@@ -507,7 -507,7 +507,7 @@@ enum { MSTP001
         MSTP223,
         MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
         MSTP329, MSTP328, MSTP323, MSTP322, MSTP314, MSTP313, MSTP312,
 -       MSTP415, MSTP413, MSTP411, MSTP410, MSTP406, MSTP403,
 +       MSTP423, MSTP415, MSTP413, MSTP411, MSTP410, MSTP406, MSTP403,
         MSTP_NR };
  
  #define MSTP(_parent, _reg, _bit, _flags) \
@@@ -543,7 -543,6 +543,7 @@@ static struct clk mstp_clks[MSTP_NR] = 
        [MSTP314] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 14, 0), /* SDHI0 */
        [MSTP313] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 13, 0), /* SDHI1 */
        [MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMC */
 +      [MSTP423] = MSTP(&div4_clks[DIV4_B], SMSTPCR4, 23, 0), /* DSITX1 */
        [MSTP415] = MSTP(&div4_clks[DIV4_HP], SMSTPCR4, 15, 0), /* SDHI2 */
        [MSTP413] = MSTP(&pllc1_div2_clk, SMSTPCR4, 13, 0), /* HDMI */
        [MSTP411] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR4, 11, 0), /* IIC3 */
@@@ -597,10 -596,9 +597,10 @@@ static struct clk_lookup lookups[] = 
        CLKDEV_CON_ID("spu_clk", &div6_clks[DIV6_SPU]),
        CLKDEV_CON_ID("vou_clk", &div6_clks[DIV6_VOU]),
        CLKDEV_CON_ID("hdmi_clk", &div6_reparent_clks[DIV6_HDMI]),
 -      CLKDEV_CON_ID("dsit_clk", &div6_clks[DIV6_DSIT]),
 -      CLKDEV_CON_ID("dsi0p_clk", &div6_clks[DIV6_DSI0P]),
 -      CLKDEV_CON_ID("dsi1p_clk", &div6_clks[DIV6_DSI1P]),
 +      CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]),
 +      CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]),
 +      CLKDEV_ICK_ID("dsi0p_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
 +      CLKDEV_ICK_ID("dsi1p_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
  
        /* MSTP32 clocks */
        CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* IIC2 */
        CLKDEV_DEV_ID("sh-mobile-csi2.0", &mstp_clks[MSTP126]), /* CSI2 */
        CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP125]), /* TMU00 */
        CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP125]), /* TMU01 */
 -      CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX */
 +      CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX0 */
        CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1", &mstp_clks[MSTP117]), /* LCDC1 */
        CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* IIC0 */
        CLKDEV_DEV_ID("uio_pdrv_genirq.5", &mstp_clks[MSTP106]), /* JPU */
        CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */
        CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */
        CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMC */
 +      CLKDEV_DEV_ID("sh-mipi-dsi.1", &mstp_clks[MSTP423]), /* DSITX1 */
        CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP415]), /* SDHI2 */
        CLKDEV_DEV_ID("sh-mobile-hdmi", &mstp_clks[MSTP413]), /* HDMI */
        CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* IIC3 */
diff --combined arch/sh/Kconfig
index ef514c42eb4af80fc9fb32dffd01e51a36faa384,25cf0b34dffdca99f68fd52cec55f2b0bc870fb8..e9e71120040ca8fa07afeefac3585ed4d8ca0de1
@@@ -1,7 -1,7 +1,7 @@@
  config SUPERH
        def_bool y
        select EMBEDDED
-       select HAVE_CLK
+       select CLKDEV_LOOKUP
        select HAVE_IDE if HAS_IOPORT
        select HAVE_MEMBLOCK
        select HAVE_OPROFILE
@@@ -162,8 -162,7 +162,8 @@@ config ARCH_HAS_CPU_IDLE_WAI
        def_bool y
  
  config NO_IOPORT
 -      bool
 +      def_bool !PCI
 +      depends on !SH_CAYMAN && !SH_SH4202_MICRODEV
  
  config IO_TRAPPED
        bool
@@@ -276,7 -275,6 +276,7 @@@ config CPU_SUBTYPE_SH720
        select CPU_HAS_FPU
        select SYS_SUPPORTS_CMT
        select SYS_SUPPORTS_MTU2
 +      select ARCH_WANT_OPTIONAL_GPIOLIB
  
  config CPU_SUBTYPE_SH7206
        bool "Support SH7206 processor"
@@@ -348,7 -346,6 +348,7 @@@ config CPU_SUBTYPE_SH772
        select CPU_SH3
        select CPU_HAS_DSP
        select SYS_SUPPORTS_CMT
 +      select ARCH_WANT_OPTIONAL_GPIOLIB
        help
          Select SH7720 if you have a SH3-DSP SH7720 CPU.
  
@@@ -411,7 -408,6 +411,7 @@@ config CPU_SUBTYPE_SH772
        select ARCH_SHMOBILE
        select ARCH_SPARSEMEM_ENABLE
        select SYS_SUPPORTS_CMT
 +      select ARCH_WANT_OPTIONAL_GPIOLIB
        help
          Select SH7723 if you have an SH-MobileR2 CPU.
  
@@@ -422,7 -418,6 +422,7 @@@ config CPU_SUBTYPE_SH772
        select ARCH_SHMOBILE
        select ARCH_SPARSEMEM_ENABLE
        select SYS_SUPPORTS_CMT
 +      select ARCH_WANT_OPTIONAL_GPIOLIB
        help
          Select SH7724 if you have an SH-MobileR2R CPU.
  
@@@ -430,7 -425,6 +430,7 @@@ config CPU_SUBTYPE_SH775
        bool "Support SH7757 processor"
        select CPU_SH4A
        select CPU_SHX2
 +      select ARCH_WANT_OPTIONAL_GPIOLIB
        help
          Select SH7757 if you have a SH4A SH7757 CPU.
  
@@@ -454,7 -448,6 +454,7 @@@ config CPU_SUBTYPE_SH778
        select CPU_SHX2
        select ARCH_SPARSEMEM_ENABLE
        select SYS_SUPPORTS_NUMA
 +      select ARCH_WANT_OPTIONAL_GPIOLIB
  
  config CPU_SUBTYPE_SH7786
        bool "Support SH7786 processor"
        select CPU_SHX3
        select CPU_HAS_PTEAEX
        select GENERIC_CLOCKEVENTS_BROADCAST if SMP
 +      select ARCH_WANT_OPTIONAL_GPIOLIB
  
  config CPU_SUBTYPE_SHX3
        bool "Support SH-X3 processor"
@@@ -487,7 -479,6 +487,7 @@@ config CPU_SUBTYPE_SH772
        select ARCH_SPARSEMEM_ENABLE
        select SYS_SUPPORTS_NUMA
        select SYS_SUPPORTS_CMT
 +      select ARCH_WANT_OPTIONAL_GPIOLIB
  
  config CPU_SUBTYPE_SH7366
        bool "Support SH7366 processor"
@@@ -577,6 -568,15 +577,6 @@@ config SH_CLK_CPG_LEGAC
        def_bool y if !CPU_SUBTYPE_SH7785 && !ARCH_SHMOBILE && \
                      !CPU_SHX3 && !CPU_SUBTYPE_SH7757
  
 -config SH_CLK_MD
 -      int "CPU Mode Pin Setting"
 -      depends on CPU_SH2
 -      default 6 if CPU_SUBTYPE_SH7206
 -      default 5 if CPU_SUBTYPE_SH7619
 -      default 0
 -      help
 -        MD2 - MD0 pin setting.
 -
  source "kernel/time/Kconfig"
  
  endmenu
diff --combined arch/sh/kernel/Makefile
index ff80227b02d882679e18f7e6fdcbf4fdbc218651,cf652217952382622273c6c0663b958cb9d42824..77f7ae1d4647d23d0d70a8a1f17e6f77ed5d3506
@@@ -11,7 -11,7 +11,7 @@@ endi
  
  CFLAGS_REMOVE_return_address.o = -pg
  
- obj-y := clkdev.o debugtraps.o dma-nommu.o dumpstack.o                \
+ obj-y := debugtraps.o dma-nommu.o dumpstack.o                 \
           idle.o io.o irq.o irq_$(BITS).o kdebugfs.o                   \
           machvec.o nmi_debug.o process.o                              \
           process_$(BITS).o ptrace.o ptrace_$(BITS).o                  \
           syscalls_$(BITS).o time.o topology.o traps.o                 \
           traps_$(BITS).o unwinder.o
  
 +ifndef CONFIG_GENERIC_IOMAP
 +obj-y                         += iomap.o
 +obj-$(CONFIG_HAS_IOPORT)      += ioport.o
 +endif
 +
  obj-y                         += cpu/
  obj-$(CONFIG_VSYSCALL)                += vsyscall/
  obj-$(CONFIG_SMP)             += smp.o
@@@ -44,6 -39,7 +44,6 @@@ obj-$(CONFIG_DUMP_CODE)               += disassemble
  obj-$(CONFIG_HIBERNATION)     += swsusp.o
  obj-$(CONFIG_DWARF_UNWINDER)  += dwarf.o
  obj-$(CONFIG_PERF_EVENTS)     += perf_event.o perf_callchain.o
 -obj-$(CONFIG_HAS_IOPORT)      += io_generic.o
  
  obj-$(CONFIG_HAVE_HW_BREAKPOINT)              += hw_breakpoint.o
  obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)   += localtimer.o
diff --combined drivers/video/Kconfig
index 9f36a29b10b43513df46d120aac360e987a970c8,ab77297fbed2f46fc7e56a46512a4eaeb428552c..55dc6fb6e909caca039c3177050ea38883c99321
@@@ -186,14 -186,6 +186,14 @@@ config FB_SYS_FOP
         depends on FB
         default n
  
 +config FB_WMT_GE_ROPS
 +      tristate
 +      depends on FB
 +      default n
 +      ---help---
 +        Include functions for accelerated rectangle filling and area
 +        copying using WonderMedia Graphics Engine operations.
 +
  config FB_DEFERRED_IO
        bool
        depends on FB
@@@ -643,72 -635,6 +643,72 @@@ config FB_BFIN_LQ035Q
          To compile this driver as a module, choose M here: the
          module will be called bfin-lq035q1-fb.
  
 +config FB_BF537_LQ035
 +      tristate "SHARP LQ035 TFT LCD (BF537 STAMP)"
 +      depends on FB && (BF534 || BF536 || BF537) && I2C_BLACKFIN_TWI
 +      select FB_CFB_FILLRECT
 +      select FB_CFB_COPYAREA
 +      select FB_CFB_IMAGEBLIT
 +      select BFIN_GPTIMERS
 +      help
 +        This is the framebuffer device for a SHARP LQ035Q7DB03 TFT LCD
 +        attached to a BF537.
 +
 +        To compile this driver as a module, choose M here: the
 +        module will be called bf537-lq035.
 +
 +config FB_BFIN_7393
 +      tristate "Blackfin ADV7393 Video encoder"
 +      depends on FB && BLACKFIN
 +      select I2C
 +      select FB_CFB_FILLRECT
 +      select FB_CFB_COPYAREA
 +      select FB_CFB_IMAGEBLIT
 +      help
 +        This is the framebuffer device for a ADV7393 video encoder
 +        attached to a Blackfin on the PPI port.
 +        If your Blackfin board has a ADV7393 select Y.
 +
 +        To compile this driver as a module, choose M here: the
 +        module will be called bfin_adv7393fb.
 +
 +choice
 +      prompt  "Video mode support"
 +      depends on FB_BFIN_7393
 +      default NTSC
 +
 +config NTSC
 +      bool 'NTSC 720x480'
 +
 +config PAL
 +      bool 'PAL 720x576'
 +
 +config NTSC_640x480
 +      bool 'NTSC 640x480 (Experimental)'
 +
 +config PAL_640x480
 +      bool 'PAL 640x480 (Experimental)'
 +
 +config NTSC_YCBCR
 +      bool 'NTSC 720x480 YCbCR input'
 +
 +config PAL_YCBCR
 +      bool 'PAL 720x576 YCbCR input'
 +
 +endchoice
 +
 +choice
 +      prompt  "Size of ADV7393 frame buffer memory Single/Double Size"
 +      depends on (FB_BFIN_7393)
 +      default ADV7393_1XMEM
 +
 +config ADV7393_1XMEM
 +      bool 'Single'
 +
 +config ADV7393_2XMEM
 +      bool 'Double'
 +endchoice
 +
  config FB_STI
        tristate "HP STI frame buffer device support"
        depends on FB && PARISC
@@@ -824,14 -750,24 +824,14 @@@ config FB_N41
  config FB_HGA
        tristate "Hercules mono graphics support"
        depends on FB && X86
 -      select FB_CFB_FILLRECT
 -      select FB_CFB_COPYAREA
 -      select FB_CFB_IMAGEBLIT
        help
          Say Y here if you have a Hercules mono graphics card.
  
          To compile this driver as a module, choose M here: the
          module will be called hgafb.
  
 -        As this card technology is 15 years old, most people will answer N
 -        here.
 -
 -config FB_HGA_ACCEL
 -      bool "Hercules mono Acceleration functions (EXPERIMENTAL)"
 -      depends on FB_HGA && EXPERIMENTAL
 -      ---help---
 -      This will compile the Hercules mono graphics with
 -      acceleration functions.
 +        As this card technology is at least 25 years old,
 +        most people will answer N here.
  
  config FB_SGIVW
        tristate "SGI Visual Workstation framebuffer support"
@@@ -1786,24 -1722,6 +1786,24 @@@ config FB_AU120
          various panels and CRTs by passing in kernel cmd line option
          au1200fb:panel=<name>.
  
 +config FB_VT8500
 +      bool "VT8500 LCD Driver"
 +      depends on (FB = y) && ARM && ARCH_VT8500 && VTWM_VERSION_VT8500
 +      select FB_WMT_GE_ROPS
 +      select FB_SYS_IMAGEBLIT
 +      help
 +        This is the framebuffer driver for VIA VT8500 integrated LCD
 +        controller.
 +
 +config FB_WM8505
 +      bool "WM8505 frame buffer support"
 +      depends on (FB = y) && ARM && ARCH_VT8500 && VTWM_VERSION_WM8505
 +      select FB_WMT_GE_ROPS
 +      select FB_SYS_IMAGEBLIT
 +      help
 +        This is the framebuffer driver for WonderMedia WM8505
 +        integrated LCD controller.
 +
  source "drivers/video/geode/Kconfig"
  
  config FB_HIT
@@@ -1932,6 -1850,16 +1932,16 @@@ config FB_PXA_PARAMETER
  
          <file:Documentation/fb/pxafb.txt> describes the available parameters.
  
+ config PXA3XX_GCU
+       tristate "PXA3xx 2D graphics accelerator driver"
+       depends on FB_PXA
+       help
+         Kernelspace driver for the 2D graphics controller unit (GCU)
+         found on PXA3xx processors. There is a counterpart driver in the
+         DirectFB suite, see http://www.directfb.org/
+         If you compile this as a module, it will be called pxa3xx_gcu.
  config FB_MBX
        tristate "2700G LCD framebuffer support"
        depends on FB && ARCH_PXA
@@@ -2116,20 -2044,6 +2126,20 @@@ config FB_SM50
  
          If unsure, say N.
  
 +config FB_UDL
 +      tristate "Displaylink USB Framebuffer support"
 +      depends on FB && USB
 +      select FB_MODE_HELPERS
 +      select FB_SYS_FILLRECT
 +      select FB_SYS_COPYAREA
 +      select FB_SYS_IMAGEBLIT
 +      select FB_SYS_FOPS
 +      select FB_DEFERRED_IO
 +      ---help---
 +        This is a kernel framebuffer driver for DisplayLink USB devices.
 +        Supports fbdev clients like xf86-video-fbdev, kdrive, fbi, and
 +        mplayer -vo fbdev. Supports all USB 2.0 era DisplayLink devices.
 +        To compile as a module, choose M here: the module name is udlfb.
  
  config FB_PNX4008_DUM
        tristate "Display Update Module support on Philips PNX4008 board"
diff --combined drivers/video/Makefile
index f9de51c39ad725129817f70cd17512ad4b8d8f8b,9260a898f3439efecbbff4230f4d8d5e88dcf6b4..8c8fabdff9d0b9c70e619df07423bd250db2309b
@@@ -26,7 -26,6 +26,7 @@@ obj-$(CONFIG_FB_SVGALIB)       += svgal
  obj-$(CONFIG_FB_MACMODES)      += macmodes.o
  obj-$(CONFIG_FB_DDC)           += fb_ddc.o
  obj-$(CONFIG_FB_DEFERRED_IO)   += fb_defio.o
 +obj-$(CONFIG_FB_WMT_GE_ROPS)   += wmt_ge_rops.o
  
  # Hardware specific drivers go first
  obj-$(CONFIG_FB_AMIGA)            += amifb.o c2p_planar.o
@@@ -101,12 -100,11 +101,13 @@@ obj-$(CONFIG_FB_CIRRUS)           += cirrusfb.
  obj-$(CONFIG_FB_ASILIANT)       += asiliantfb.o
  obj-$(CONFIG_FB_PXA)            += pxafb.o
  obj-$(CONFIG_FB_PXA168)                 += pxa168fb.o
+ obj-$(CONFIG_PXA3XX_GCU)        += pxa3xx-gcu.o
  obj-$(CONFIG_FB_W100)           += w100fb.o
  obj-$(CONFIG_FB_TMIO)           += tmiofb.o
  obj-$(CONFIG_FB_AU1100)                 += au1100fb.o
  obj-$(CONFIG_FB_AU1200)                 += au1200fb.o
 +obj-$(CONFIG_FB_VT8500)                 += vt8500lcdfb.o
 +obj-$(CONFIG_FB_WM8505)                 += wm8505fb.o
  obj-$(CONFIG_FB_PMAG_AA)        += pmag-aa-fb.o
  obj-$(CONFIG_FB_PMAG_BA)        += pmag-ba-fb.o
  obj-$(CONFIG_FB_PMAGB_B)        += pmagb-b-fb.o
@@@ -125,7 -123,6 +126,7 @@@ obj-$(CONFIG_FB_PNX4008_DUM_RGB)  += pn
  obj-$(CONFIG_FB_IBM_GXT4500)    += gxt4500.o
  obj-$(CONFIG_FB_PS3)            += ps3fb.o
  obj-$(CONFIG_FB_SM501)            += sm501fb.o
 +obj-$(CONFIG_FB_UDL)            += udlfb.o
  obj-$(CONFIG_FB_XILINX)           += xilinxfb.o
  obj-$(CONFIG_SH_MIPI_DSI)       += sh_mipi_dsi.o
  obj-$(CONFIG_FB_SH_MOBILE_HDMI)         += sh_mobile_hdmi.o
@@@ -145,11 -142,9 +146,11 @@@ obj-$(CONFIG_FB_VESA)             += ve
  obj-$(CONFIG_FB_EFI)              += efifb.o
  obj-$(CONFIG_FB_VGA16)            += vga16fb.o
  obj-$(CONFIG_FB_OF)               += offb.o
 +obj-$(CONFIG_FB_BF537_LQ035)      += bf537-lq035.o
  obj-$(CONFIG_FB_BF54X_LQ043)    += bf54x-lq043fb.o
  obj-$(CONFIG_FB_BFIN_LQ035Q1)     += bfin-lq035q1-fb.o
  obj-$(CONFIG_FB_BFIN_T350MCQB)          += bfin-t350mcqb-fb.o
 +obj-$(CONFIG_FB_BFIN_7393)        += bfin_adv7393fb.o
  obj-$(CONFIG_FB_MX3)            += mx3fb.o
  obj-$(CONFIG_FB_DA8XX)                  += da8xx-fb.o
  
This page took 0.264664 seconds and 4 git commands to generate.