Core support for Cortex-A5 and Cortex-A15
v3 cover Core support for Cortex-A5 and Cortex-A15
Hello,
This is version 3 of the patches originally posted here:
v1: http://lists.infradead.org/pipermail/linux-arm-kernel/2011-June/052141.html
v2: http://lists.infradead.org/pipermail/linux-arm-kernel/2011-June/052426.html
Changes from v2 include:
* Use named parameter for supplying hwcaps to proc macro
* Based on -rc3
Tested on Realview-PBX (Cortex-A9) without regressions. Also tested on Cortex-A5 (w/ NEON) and Cortex-A15 (w/ NEON).
I've also applied and tested these successfully on top of Dave Martin's generic macro patches (with the string declaration bits backed out) so I believe they should be fit for inclusion in 3.1 in their current state. That said, all feedback is more than welcome.
Thanks,
Will
Pawel Moll (2):
arm: Convert v7 proc infos into a common macro
arm: Add Cortex A5 proc info
Will Deacon (8):
ARM: hwcaps: use shifts instead of hardcoded constants
ARM: hwcaps: add new HWCAP defines for ARMv7-A
ARM: proc: add proc info for Cortex-A15MP using classic page tables
ARM: vfp: add VFPv4 capability detection and populate elf_hwcap
ARM: perf: remove confusing comment from v7 perf events backend
ARM: perf: add PMUv2 common event definitions
ARM: perf: add support for the Cortex-A5 PMU
ARM: perf: add support for the Cortex-A15 PMU
arch/arm/include/asm/hwcap.h | 36 ++-- arch/arm/include/asm/perf_event.h | 2 + arch/arm/kernel/perf_event.c | 6 + arch/arm/kernel/perf_event_v7.c | 344 ++++++++++++++++++++++++++++++++++-- arch/arm/kernel/setup.c | 4 + arch/arm/mm/proc-v7.S | 98 ++++++----- arch/arm/vfp/vfpmodule.c | 6 +- 7 files changed, 413 insertions(+), 83 deletions(-)
PATCH v3 1/10 arm: Convert v7 proc infos into a common macro
From: Pawel Moll <[email protected]>
As most of the proc info content is common across all v7 processors, this patch converts existing A9 and generic v7 descriptions into a macro (allowing extra flags in future).
--- arch/arm/mm/proc-v7.S | 67 +++++++++++++++++------------------------------- 1 files changed, 24 insertions(+), 43 deletions(-)
arch/arm/mm/proc-v7.S +24 -43
@@ -436,33 +436,36 @@ cpu_elf_name: .section ".proc.info.init", #alloc, #execinstr - .type __v7_ca9mp_proc_info, #object -__v7_ca9mp_proc_info: - .long 0x410fc090 @ Required ID value - .long 0xff0ffff0 @ Mask for ID - ALT_SMP(.long \ - PMD_TYPE_SECT | \ - PMD_SECT_AP_WRITE | \ - PMD_SECT_AP_READ | \ - PMD_FLAGS_SMP) - ALT_UP(.long \ - PMD_TYPE_SECT | \ - PMD_SECT_AP_WRITE | \ - PMD_SECT_AP_READ | \ - PMD_FLAGS_UP) - .long PMD_TYPE_SECT | \ - PMD_SECT_XN | \ - PMD_SECT_AP_WRITE | \ - PMD_SECT_AP_READ - W(b) __v7_ca9mp_setup + /* + * Standard v7 proc info content + */ +.macro __v7_proc initfunc, mm_mmuflags = 0, io_mmuflags = 0, hwcaps = 0 + ALT_SMP(.long PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_SECT_AP_READ | \ + PMD_FLAGS_SMP | \mm_mmuflags) + ALT_UP(.long PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_SECT_AP_READ | \ + PMD_FLAGS_UP | \mm_mmuflags) + .long PMD_TYPE_SECT | PMD_SECT_XN | PMD_SECT_AP_WRITE | \ + PMD_SECT_AP_READ | \io_mmuflags + W(b) \initfunc .long cpu_arch_name .long cpu_elf_name - .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP|HWCAP_TLS + .long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB | HWCAP_FAST_MULT | \ + HWCAP_EDSP | HWCAP_TLS | \hwcaps .long cpu_v7_name .long v7_processor_functions .long v7wbi_tlb_fns .long v6_user_fns .long v7_cache_fns +.endm + + /* + * ARM Ltd. Cortex A9 processor. + */ + .type __v7_ca9mp_proc_info, #object +__v7_ca9mp_proc_info: + .long 0x410fc090 + .long 0xff0ffff0 + __v7_proc __v7_ca9mp_setup .size __v7_ca9mp_proc_info, . - __v7_ca9mp_proc_info /*
@@ -472,27 +475,5 @@ __v7_ca9mp_proc_info: __v7_proc_info: .long 0x000f0000 @ Required ID value .long 0x000f0000 @ Mask for ID - ALT_SMP(.long \ - PMD_TYPE_SECT | \ - PMD_SECT_AP_WRITE | \ - PMD_SECT_AP_READ | \ - PMD_FLAGS_SMP) - ALT_UP(.long \ - PMD_TYPE_SECT | \ - PMD_SECT_AP_WRITE | \ - PMD_SECT_AP_READ | \ - PMD_FLAGS_UP) - .long PMD_TYPE_SECT | \ - PMD_SECT_XN | \ - PMD_SECT_AP_WRITE | \ - PMD_SECT_AP_READ - W(b) __v7_setup - .long cpu_arch_name - .long cpu_elf_name - .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP|HWCAP_TLS - .long cpu_v7_name - .long v7_processor_functions - .long v7wbi_tlb_fns - .long v6_user_fns - .long v7_cache_fns + __v7_proc __v7_setup .size __v7_proc_info, . - __v7_proc_info
Signature · 1 line
1.7.0.4
PATCH v3 2/10 arm: Add Cortex A5 proc info
In reply to Will DeaconFrom: Pawel Moll <[email protected]>
This patch adds processor info for ARM Ltd. Cortex A5, which has SCU initialisation procedure identical to A9.
--- arch/arm/mm/proc-v7.S | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
arch/arm/mm/proc-v7.S +11 -0
@@ -273,6 +273,7 @@ cpu_resume_l1_flags: * It is assumed that: * - cache type register is implemented */ +__v7_ca5mp_setup: __v7_ca9mp_setup: #ifdef CONFIG_SMP ALT_SMP(mrc p15, 0, r0, c1, c0, 1)
@@ -459,6 +460,16 @@ cpu_elf_name: .endm /* + * ARM Ltd. Cortex A5 processor. + */ + .type __v7_ca5mp_proc_info, #object +__v7_ca5mp_proc_info: + .long 0x410fc050 + .long 0xff0ffff0 + __v7_proc __v7_ca5mp_setup + .size __v7_ca5mp_proc_info, . - __v7_ca5mp_proc_info + + /* * ARM Ltd. Cortex A9 processor. */ .type __v7_ca9mp_proc_info, #object
Signature · 1 line
1.7.0.4
PATCH v3 3/10 ARM: hwcaps: use shifts instead of hardcoded constants
In reply to Will DeaconThe HWCAP numbers are defined as constants, each one being a power of 2. This has become slightly unwieldy now that we have reached 32k.
This patch changes the HWCAP defines to use (1 << n) instead of coding the constant directly. The values remain unchanged.
--- arch/arm/include/asm/hwcap.h | 32 ++++++++++++++++---------------- 1 files changed, 16 insertions(+), 16 deletions(-)
arch/arm/include/asm/hwcap.h +16 -16
@@ -4,22 +4,22 @@/* * HWCAP flags - for elf_hwcap (in kernel) and AT_HWCAP */ -#define HWCAP_SWP 1 -#define HWCAP_HALF 2 -#define HWCAP_THUMB 4 -#define HWCAP_26BIT 8/* Play it safe */ -#define HWCAP_FAST_MULT 16 -#define HWCAP_FPA 32 -#define HWCAP_VFP 64 -#define HWCAP_EDSP 128 -#define HWCAP_JAVA 256 -#define HWCAP_IWMMXT 512 -#define HWCAP_CRUNCH 1024 -#define HWCAP_THUMBEE 2048 -#define HWCAP_NEON 4096 -#define HWCAP_VFPv3 8192 -#define HWCAP_VFPv3D16 16384 -#define HWCAP_TLS 32768 +#define HWCAP_SWP (1 << 0) +#define HWCAP_HALF (1 << 1) +#define HWCAP_THUMB (1 << 2) +#define HWCAP_26BIT (1 << 3)/* Play it safe */ +#define HWCAP_FAST_MULT (1 << 4) +#define HWCAP_FPA (1 << 5) +#define HWCAP_VFP (1 << 6) +#define HWCAP_EDSP (1 << 7) +#define HWCAP_JAVA (1 << 8) +#define HWCAP_IWMMXT (1 << 9) +#define HWCAP_CRUNCH (1 << 10) +#define HWCAP_THUMBEE (1 << 11) +#define HWCAP_NEON (1 << 12) +#define HWCAP_VFPv3 (1 << 13) +#define HWCAP_VFPv3D16 (1 << 14) +#define HWCAP_TLS (1 << 15)#if defined(__KERNEL__) && !defined(__ASSEMBLY__)/*
Signature · 1 line
1.7.0.4
PATCH v3 4/10 ARM: hwcaps: add new HWCAP defines for ARMv7-A
In reply to Will DeaconModern ARMv7-A cores can optionally implement these new hardware features:
- VFPv4:
The latest version of the ARMv7 vector floating-point extensions, including hardware support for fused multiple accumulate. D16 or D32 variants may be implemented.
- Integer divide:
The SDIV and UDIV instructions provide signed and unsigned integer division in hardware. When implemented, these instructions may be available in either both Thumb and ARM, or Thumb only.
This patch adds new HWCAP defines to describe these new features. The integer divide capabilities are split into two bits for ARM and Thumb respectively. Whilst HWCAP_IDIVA should never be set if HWCAP_IDIVT is clear, separating the bits makes it easier to interpret from userspace.
--- arch/arm/include/asm/hwcap.h | 4 ++++ arch/arm/kernel/setup.c | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-)
arch/arm/include/asm/hwcap.h +4 -0
@@ -20,6 +20,10 @@#define HWCAP_VFPv3 (1 << 13)#define HWCAP_VFPv3D16 (1 << 14)#define HWCAP_TLS (1 << 15) +#define HWCAP_VFPv4 (1 << 16) +#define HWCAP_IDIVA (1 << 17) +#define HWCAP_IDIVT (1 << 18) +#define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT)#if defined(__KERNEL__) && !defined(__ASSEMBLY__)/*
arch/arm/kernel/setup.c +4 -0
@@ -977,6 +977,10 @@ static const char *hwcap_str[] = {"neon" ,"vfpv3" ,"vfpv3d16" , +"tls" , +"vfpv4" , +"idiva" , +"idivt" , NULL };
Signature · 1 line
1.7.0.4
PATCH v3 5/10 ARM: proc: add proc info for Cortex-A15MP using classic page tables
In reply to Will DeaconMulticore implementations of the Cortex-A15 require bit 6 of the auxiliary control register to be set in order for cache and TLB maintenance operations to be broadcast between CPUs.
This patch adds a new proc_info structure for Cortex-A15, which enables the SMP bit during setup and includes the new HWCAP for integer division.
--- arch/arm/mm/proc-v7.S | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-)
arch/arm/mm/proc-v7.S +18 -2
@@ -275,12 +275,18 @@ cpu_resume_l1_flags: */ __v7_ca5mp_setup: __v7_ca9mp_setup: + mov r10, #(1 << 0) @ TLB ops broadcasting + b 1f +__v7_ca15mp_setup: + mov r10, #0 +1: #ifdef CONFIG_SMP ALT_SMP(mrc p15, 0, r0, c1, c0, 1) ALT_UP(mov r0, #(1 << 6)) @ fake it for UP tst r0, #(1 << 6) @ SMP/nAMP mode enabled? - orreq r0, r0, #(1 << 6) | (1 << 0) @ Enable SMP/nAMP mode and - mcreq p15, 0, r0, c1, c0, 1 @ TLB ops broadcasting + orreq r0, r0, #(1 << 6) @ Enable SMP/nAMP mode + orreq r0, r0, r10 @ Enable CPU-specific SMP bits + mcreq p15, 0, r0, c1, c0, 1 #endif __v7_setup: adr r12, __v7_setup_stack @ the local stack
@@ -480,6 +486,16 @@ __v7_ca9mp_proc_info: .size __v7_ca9mp_proc_info, . - __v7_ca9mp_proc_info /* + * ARM Ltd. Cortex A15 processor. + */ + .type __v7_ca15mp_proc_info, #object +__v7_ca15mp_proc_info: + .long 0x410fc0f0 + .long 0xff0ffff0 + __v7_proc __v7_ca15mp_setup, hwcaps = HWCAP_IDIV + .size __v7_ca15mp_proc_info, . - __v7_ca15mp_proc_info + + /* * Match any ARMv7 processor core. */ .type __v7_proc_info, #object
Signature · 1 line
1.7.0.4
PATCH v3 6/10 ARM: vfp: add VFPv4 capability detection and populate elf_hwcap
In reply to Will DeaconThe presence of VFPv4 cannot be detected simply by looking at the FPSID subarchitecture field, as a value >= 2 signifies the architecture as VFPv3 or later.
This patch reads from MVFR1 to check whether or not the fused multiply accumulate instructions are supported. Since these are introduced with VFPv4, this tells us what we need to know.
--- arch/arm/vfp/vfpmodule.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
arch/arm/vfp/vfpmodule.c +4 -2
@@ -582,7 +582,6 @@ static int __init vfp_init(void) elf_hwcap |= HWCAP_VFPv3D16; }#endif -#ifdef CONFIG_NEON /* * Check for the presence of the Advanced SIMD * load/store instructions, integer and single
@@ -590,10 +589,13 @@ static int __init vfp_init(void)* for NEON if the hardware has the MVFR registers. */ if ((read_cpuid_id () &0x000f0000 ) ==0x000f0000 ) { +#ifdef CONFIG_NEON if ((fmrx (MVFR1 ) &0x000fff00 ) ==0x00011100 ) elf_hwcap |=HWCAP_NEON ; - }#endif +if ((fmrx (MVFR1 ) &0xf0000000 ) ==0x10000000 ) + elf_hwcap |= HWCAP_VFPv4; + } }return 0 ; }
Signature · 1 line
1.7.0.4
PATCH v3 7/10 ARM: perf: remove confusing comment from v7 perf events backend
In reply to Will DeaconThe comment about measuring TLB misses and refills in the ARMv7 perf backend makes little sense and refers loosely to raw counters that should be used instead.
This patch removes the comments to avoid any confusion.
--- arch/arm/kernel/perf_event_v7.c | 10 ---------- 1 files changed, 0 insertions(+), 10 deletions(-)
arch/arm/kernel/perf_event_v7.c +0 -10
@@ -207,11 +207,6 @@ static const unsigned armv7_a8_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] }, }, [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,
@@ -323,11 +318,6 @@ static const unsigned armv7_a9_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] }, }, [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,
Signature · 1 line
1.7.0.4
PATCH v3 8/10 ARM: perf: add PMUv2 common event definitions
In reply to Will DeaconThe PMUv2 specification reserves a number of event encodings for common events.
This patch adds these events to the common event enumeration in preparation for PMUv2 cores, such as Cortex-A15.
--- arch/arm/kernel/perf_event_v7.c | 35 +++++++++++++++++++++++++---------- 1 files changed, 25 insertions(+), 10 deletions(-)
arch/arm/kernel/perf_event_v7.c +25 -10
@@ -17,17 +17,23 @@*/ #ifdef CONFIG_CPU_V7 -/* Common ARMv7 event types */ +/* +* Common ARMv7 event types +* +* Note: An implementation may not be able to count all of these events +* but the encodings are considered to be `reserved' in the case that +* they are not available. +*/ 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_DCACHE_REFILL =0x03 ,/* L1 */ +ARMV7_PERFCTR_DCACHE_ACCESS =0x04 ,/* L1 */ ARMV7_PERFCTR_DTLB_REFILL =0x05 ,ARMV7_PERFCTR_DREAD =0x06 ,ARMV7_PERFCTR_DWRITE =0x07 , - +ARMV7_PERFCTR_INSTR_EXECUTED =0x08 ,ARMV7_PERFCTR_EXC_TAKEN =0x09 ,ARMV7_PERFCTR_EXC_EXECUTED =0x0A , ARMV7_PERFCTR_CID_WRITE = 0x0B,
@@ -39,21 +45,30 @@ enum armv7_perf_types {*/ ARMV7_PERFCTR_PC_WRITE =0x0C ,ARMV7_PERFCTR_PC_IMM_BRANCH =0x0D , +ARMV7_PERFCTR_PC_PROC_RETURN =0x0E ,ARMV7_PERFCTR_UNALIGNED_ACCESS =0x0F , + +/* These events are defined by the PMUv2 supplement (ARM DDI 0457A). */ ARMV7_PERFCTR_PC_BRANCH_MIS_PRED =0x10 ,ARMV7_PERFCTR_CLOCK_CYCLES =0x11 , - -ARMV7_PERFCTR_PC_BRANCH_MIS_USED =0x12 , +ARMV7_PERFCTR_PC_BRANCH_PRED =0x12 , +ARMV7_PERFCTR_MEM_ACCESS =0x13 , +ARMV7_PERFCTR_L1_ICACHE_ACCESS =0x14 , +ARMV7_PERFCTR_L1_DCACHE_WB =0x15 , +ARMV7_PERFCTR_L2_DCACHE_ACCESS =0x16 , +ARMV7_PERFCTR_L2_DCACHE_REFILL =0x17 , +ARMV7_PERFCTR_L2_DCACHE_WB =0x18 , +ARMV7_PERFCTR_BUS_ACCESS =0x19 , +ARMV7_PERFCTR_MEMORY_ERROR =0x1A , +ARMV7_PERFCTR_INSTR_SPEC =0x1B , +ARMV7_PERFCTR_TTBR_WRITE =0x1C , +ARMV7_PERFCTR_BUS_CYCLES =0x1D ,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,
Signature · 1 line
1.7.0.4
PATCH v3 9/10 ARM: perf: add support for the Cortex-A5 PMU
In reply to Will DeaconThis patch adds support for the Cortex-A5 PMU to the ARMv7 perf-event backend.
--- arch/arm/include/asm/perf_event.h | 1 + arch/arm/kernel/perf_event.c | 3 + arch/arm/kernel/perf_event_v7.c | 146 +++++++++++++++++++++++++++++++++++++ 3 files changed, 150 insertions(+), 0 deletions(-)
arch/arm/include/asm/perf_event.h +1 -0
@@ -24,6 +24,7 @@ enum arm_perf_pmu_ids {ARM_PERF_PMU_ID_V6MP ,ARM_PERF_PMU_ID_CA8 ,ARM_PERF_PMU_ID_CA9 , +ARM_PERF_PMU_ID_CA5 , ARM_NUM_PMU_IDS, };
arch/arm/kernel/perf_event.c +3 -0
@@ -660,6 +660,9 @@ init_hw_perf_events(void)case 0xC090 :/* Cortex-A9 */ armpmu =armv7_a9_pmu_init ();break ; +case 0xC050 :/* Cortex-A5 */ + armpmu =armv7_a5_pmu_init (); +break ; }/* Intel CPUs [xscale]. */ }else if (0x69 == implementor) {
arch/arm/kernel/perf_event_v7.c +146 -0
168 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH v3 10/10 ARM: perf: add support for the Cortex-A15 PMU
In reply to Will DeaconThis patch adds support for the Cortex-A15 PMU to the ARMv7 perf-event backend.
--- arch/arm/include/asm/perf_event.h | 1 + arch/arm/kernel/perf_event.c | 3 + arch/arm/kernel/perf_event_v7.c | 153 +++++++++++++++++++++++++++++++++++++ 3 files changed, 157 insertions(+), 0 deletions(-)
arch/arm/include/asm/perf_event.h +1 -0
@@ -25,6 +25,7 @@ enum arm_perf_pmu_ids {ARM_PERF_PMU_ID_CA8 ,ARM_PERF_PMU_ID_CA9 ,ARM_PERF_PMU_ID_CA5 , +ARM_PERF_PMU_ID_CA15 , ARM_NUM_PMU_IDS, };
arch/arm/kernel/perf_event.c +3 -0
@@ -663,6 +663,9 @@ init_hw_perf_events(void)case 0xC050 :/* Cortex-A5 */ armpmu =armv7_a5_pmu_init ();break ; +case 0xC0F0 :/* Cortex-A15 */ + armpmu =armv7_a15_pmu_init (); +break ; }/* Intel CPUs [xscale]. */ }else if (0x69 == implementor) {
arch/arm/kernel/perf_event_v7.c +153 -0
175 lines not on this page · raw message
Signature · 1 line
1.7.0.4