ARM: V7M: Support caches
v2 cover ARM: V7M: Support caches
Hi,
This patch set allows M-class cpus benefit of optional cache support. It originally was written by Jonny, I've been keeping it locally mainly rebasing over Linux versions.
The original idea behind patches was to reuse existing cache handling code from v7A/R with help of extra macros to factor out cache handling logic (v7M cache operations are provided via memory mapped interface rather than co-processor instructions).
However, that idea was rejected and starting form this (v2) version V7M cache logic lives into file and macros to indirect memory-mapped operations stay there locally since they make it easier to follow the code.
Along with the v7M cache support the first user (Cortex-M7) is introduced.
Patches were tested on MPS2 platform with Cortex-M3/M4/M7. The later one showed significant boot speed-up.
Based on 4.8-rc2.
Thanks!
Vladimir
Changelog:
v1 -> v2
- dropped generalisation of read_cpuid() (per Russell)
- M-class cache operations moved under it's own file and do not interfere with A/R code (per Russell)
RFC -> v1
- use linux/io.h instead of asm/io.h (per Russell)
- droped cast to void pointer in set_csselr; BASEADDR_V7M_SCB is already defined with a help of IOMEM macro (per Russell)
- open-coded implantation of dccmvau and icimvau instead of macros, since the latter would mark the wring instruction as user-accessible (per Russell)
- dccimvac is updated per Russell preference
- M_CLASS() macro is used instead of THUMB() where appropriate
Jonathan Austin (6):
ARM: factor out CSSELR/CCSIDR operations that use cp15 directly
ARM: V7M: Add addresses for mem-mapped V7M cache operations
ARM: V7M: Add support for reading the CTR with read_cpuid_cachetype()
ARM: V7M: Wire up caches for V7M processors with cache support.
ARM: V7M: Indirect proc_info construction for V7M CPUs
ARM: V7M: Add support for the Cortex-M7 processor
Vladimir Murzin (2):
ARM: V7M: fix notrace variant of save_and_disable_irqs
ARM: V7M: introduce cache operations
arch/arm/include/asm/assembler.h | 4 + arch/arm/include/asm/cachetype.h | 39 ++++ arch/arm/include/asm/cputype.h | 15 +- arch/arm/include/asm/glue-cache.h | 4 - arch/arm/include/asm/v7m.h | 22 ++ arch/arm/kernel/head-nommu.S | 16 +- arch/arm/kernel/setup.c | 16 +- arch/arm/mm/Kconfig | 10 +- arch/arm/mm/Makefile | 2 + arch/arm/mm/cache-v7m.S | 453 +++++++++++++++++++++++++++++++++++++ arch/arm/mm/proc-macros.S | 16 ++ arch/arm/mm/proc-v7m.S | 107 +++++++-- 12 files changed, 668 insertions(+), 36 deletions(-) create mode 100644 arch/arm/mm/cache-v7m.S
Signature · 1 line
1.7.9.5
PATCH v2 1/8 ARM: factor out CSSELR/CCSIDR operations that use cp15 directly
From: Jonathan Austin <[email protected]>
Currently we use raw cp15 operations to access the cache setup data.
This patch abstracts the CSSELR and CCSIDR accessors out to a header so that the implementation for them can be switched out as we do with other cpu/cachetype operations.
--- arch/arm/include/asm/cachetype.h | 24 ++++++++++++++++++++++++ arch/arm/kernel/setup.c | 7 ++----- 2 files changed, 26 insertions(+), 5 deletions(-)
arch/arm/include/asm/cachetype.h +24 -0
@@ -56,4 +56,28 @@ static inline unsigned int __attribute__((pure)) cacheid_is(unsigned int mask) (~__CACHEID_NEVER & __CACHEID_ARCH_MIN & mask & cacheid); } +#define CSSELR_ICACHE 1 +#define CSSELR_DCACHE 0 + +#define CSSELR_L1 (0 << 1) +#define CSSELR_L2 (1 << 1) +#define CSSELR_L3 (2 << 1) +#define CSSELR_L4 (3 << 1) +#define CSSELR_L5 (4 << 1) +#define CSSELR_L6 (5 << 1) +#define CSSELR_L7 (6 << 1) + +static inline void set_csselr (unsigned int cache_selector) +{ + asmvolatile ("mcr p15, 2, %0, c0, c0, 0" : :"r" (cache_selector)); +} + +static inline unsigned int read_ccsidr (void ) +{ +unsigned int val; + + asmvolatile ("mrc p15, 1, %0, c0, c0, 0" :"=r" (val)); +return val; +} +#endif
arch/arm/kernel/setup.c +2 -5
@@ -290,12 +290,9 @@ static int cpu_has_aliasing_icache(unsigned int arch)/* arch specifies the register format */ switch (arch) {case CPU_ARCH_ARMv7: - asm("mcr p15, 2, %0, c0, c0, 0 @ set CSSELR" - :/* No output operands */ - :"r" (1 )); +set_csselr (CSSELR_ICACHE |CSSELR_L1 );isb (); - asm("mrc p15, 1, %0, c0, c0, 0 @ read CCSIDR" - :"=r" (id_reg)); + id_reg =read_ccsidr (); line_size =4 << ((id_reg &0x7 ) +2 ); num_sets = ((id_reg >>13 ) &0x7fff ) +1 ; aliasing_icache = (line_size * num_sets) >PAGE_SIZE ;
Signature · 1 line
1.7.9.5
PATCH v2 2/8 ARM: V7M: Add addresses for mem-mapped V7M cache operations
In reply to Vladimir MurzinFrom: Jonathan Austin <[email protected]>
V7M implements cache operations similarly to V7A/R, however all operations are performed via memory-mapped IO instead of co-processor operations.
This patch adds register definitions relevant to the V7M ARM architecture's cache architecture.
--- arch/arm/include/asm/v7m.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
arch/arm/include/asm/v7m.h +22 -0
@@ -24,6 +24,9 @@#define V7M_SCB_CCR 0x14#define V7M_SCB_CCR_STKALIGN (1 << 9) +#define V7M_SCB_CCR_DC (1 << 16) +#define V7M_SCB_CCR_IC (1 << 17) +#define V7M_SCB_CCR_BP (1 << 18)#define V7M_SCB_SHPR2 0x1c#define V7M_SCB_SHPR3 0x20
@@ -47,6 +50,25 @@#define EXC_RET_STACK_MASK 0x00000004#define EXC_RET_THREADMODE_PROCESSSTACK 0xfffffffd +/* Cache related definitions */ + +#define V7M_SCB_CLIDR 0x78/* Cache Level ID register */ +#define V7M_SCB_CTR 0x7c/* Cache Type register */ +#define V7M_SCB_CCSIDR 0x80/* Cache size ID register */ +#define V7M_SCB_CSSELR 0x84/* Cache size selection register */ + +/* Cache opeartions */ +#define V7M_SCB_ICIALLU 0x250/* I-cache invalidate all to PoU */ +#define V7M_SCB_ICIMVAU 0x258/* I-cache invalidate by MVA to PoU */ +#define V7M_SCB_DCIMVAC 0x25c/* D-cache invalidate by MVA to PoC */ +#define V7M_SCB_DCISW 0x260/* D-cache invalidate by set-way */ +#define V7M_SCB_DCCMVAU 0x264/* D-cache clean by MVA to PoU */ +#define V7M_SCB_DCCMVAC 0x268/* D-cache clean by MVA to PoC */ +#define V7M_SCB_DCCSW 0x26c/* D-cache clean by set-way */ +#define V7M_SCB_DCCIMVAC 0x270/* D-cache clean and invalidate by MVA to PoC */ +#define V7M_SCB_DCCISW 0x274/* D-cache clean and invalidate by set-way */ +#define V7M_SCB_BPIALL 0x278/* D-cache clean and invalidate by set-way */ +#ifndef __ASSEMBLY__enum reboot_mode ;
Signature · 1 line
1.7.9.5
PATCH v2 3/8 ARM: V7M: Add support for reading the CTR with read_cpuid_cachetype()
In reply to Vladimir MurzinFrom: Jonathan Austin <[email protected]>
With the addition of caches to the V7M Architecture a new Cache Type Register (CTR) is defined at 0xE000ED7C. This register serves the same purpose as the V7A/R version and accessed via the read_cpuid_cachetype.
--- arch/arm/include/asm/cachetype.h | 15 +++++++++++++++ arch/arm/include/asm/cputype.h | 15 ++++++++++----- arch/arm/kernel/setup.c | 9 +++++---- 3 files changed, 30 insertions(+), 9 deletions(-)
arch/arm/include/asm/cachetype.h +15 -0
@@ -67,6 +67,7 @@ static inline unsigned int __attribute__((pure)) cacheid_is(unsigned int mask)#define CSSELR_L6 (5 << 1)#define CSSELR_L7 (6 << 1) +#ifndef CONFIG_CPU_V7M static inline void set_csselr (unsigned int cache_selector) { asmvolatile ("mcr p15, 2, %0, c0, c0, 0" : :"r" (cache_selector));
@@ -79,5 +80,19 @@ static inline unsigned int read_ccsidr(void) asmvolatile ("mrc p15, 1, %0, c0, c0, 0" :"=r" (val));return val; } +#else /* CONFIG_CPU_V7M */ +#include <linux/io.h> +#include "asm/v7m.h" + +static inline void set_csselr (unsigned int cache_selector) +{ +writel (cache_selector,BASEADDR_V7M_SCB +V7M_SCB_CTR ); +} + +static inline unsigned int read_ccsidr (void ) +{ +return readl (BASEADDR_V7M_SCB +V7M_SCB_CCSIDR ); +} +#endif #endif
arch/arm/include/asm/cputype.h +10 -5
@@ -152,6 +152,11 @@ static inline unsigned int __attribute_const__ read_cpuid_id(void)return read_cpuid (CPUID_ID ); } +static inline unsigned int __attribute_const__ read_cpuid_cachetype(void) +{ +return read_cpuid (CPUID_CACHETYPE ); +} +#elif defined(CONFIG_CPU_V7M ) static inline unsigned int __attribute_const__ read_cpuid_id(void)
@@ -159,6 +164,11 @@ static inline unsigned int __attribute_const__ read_cpuid_id(void)return readl (BASEADDR_V7M_SCB +V7M_SCB_CPUID ); } +static inline unsigned int __attribute_const__ read_cpuid_cachetype(void) +{ +return readl (BASEADDR_V7M_SCB +V7M_SCB_CTR ); +} +#else /* ifdef CONFIG_CPU_CP15 / elif defined(CONFIG_CPU_V7M) */ static inline unsigned int __attribute_const__ read_cpuid_id(void)
@@ -193,11 +203,6 @@ static inline unsigned int __attribute_const__ xscale_cpu_arch_version(void)return read_cpuid_id () &ARM_CPU_XSCALE_ARCH_MASK ; } -static inline unsigned int __attribute_const__ read_cpuid_cachetype(void) -{ -return read_cpuid (CPUID_CACHETYPE ); -} - static inline unsigned int __attribute_const__ read_cpuid_tcmstatus(void) {return read_cpuid (CPUID_TCM );
arch/arm/kernel/setup.c +5 -4
@@ -312,11 +312,12 @@ static void __init cacheid_init(void) {unsigned int arch =cpu_architecture (); -if (arch == CPU_ARCH_ARMv7M) { - cacheid =0 ; - }else if (arch >= CPU_ARCH_ARMv6) { +if (arch >= CPU_ARCH_ARMv6) {unsigned int cachetype =read_cpuid_cachetype (); -if ((cachetype & (7 <<29 )) ==4 <<29 ) { + +if ((arch == CPU_ARCH_ARMv7M) && !cachetype) { + cacheid =0 ; + }else if ((cachetype & (7 <<29 )) ==4 <<29 ) {/* ARMv7 register format */ arch = CPU_ARCH_ARMv7; cacheid =CACHEID_VIPT_NONALIASING ;
Signature · 1 line
1.7.9.5
PATCH v2 4/8 ARM: V7M: fix notrace variant of save_and_disable_irqs
In reply to Vladimir MurzinCommit 8e43a905 "ARM: 7325/1: fix v7 boot with lockdep enabled" introduced notrace variant of save_and_disable_irqs to balance notrace variant of restore_irqs; however V7M case has been missed. It was not noticed because cache-v7.S the only place where notrace variant is used. So fix it, since we are going to extend V7 cache routines to handle V7M case too.
--- arch/arm/include/asm/assembler.h | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/include/asm/assembler.h +4 -0
@@ -159,7 +159,11 @@ .endm .macro save_and_disable_irqs_notrace, oldcpsr +#ifdef CONFIG_CPU_V7M + mrs \oldcpsr, primask +#else mrs \oldcpsr, cpsr +#endif disable_irq_notrace .endm
Signature · 1 line
1.7.9.5
PATCH v2 5/8 ARM: V7M: introduce cache operations
In reply to Vladimir MurzinThis commit implements the cache operation for V7M.
It is based on V7 counterpart and differs as follows:
- cache operations are memory mapped
- only Thumb instruction set is supported
- we don't handle user access faults
--- arch/arm/mm/cache-v7m.S | 453 +++++++++++++++++++++++++++++++++++++++++++++ arch/arm/mm/proc-macros.S | 16 ++ 2 files changed, 469 insertions(+) create mode 100644 arch/arm/mm/cache-v7m.S
arch/arm/mm/cache-v7m.S new file +453 -0
@@ -0,0 +1,453 @@ +/* + * linux/arch/arm/mm/cache-v7m.S + * + * Based on linux/arch/arm/mm/cache-v7.S + * + * Copyright (C) 2001 Deep Blue Solutions Ltd. + * Copyright (C) 2005 ARM Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This is the "shell" of the ARMv7M processor support. + */ +#include <linux/linkage.h> +#include <linux/init.h> +#include <asm/assembler.h> +#include <asm/errno.h> +#include <asm/unwind.h> +#include <asm/v7m.h> + +#include "proc-macros.S" + +/* Generic V7M read/write macros for memory mapped cache operations */ +.macro v7m_cache_read, rt, reg + movw \rt, #:lower16:BASEADDR_V7M_SCB + \reg + movt \rt, #:upper16:BASEADDR_V7M_SCB + \reg + ldr \rt, [\rt] +.endm + +.macro v7m_cacheop, rt, tmp, op, c = al + movw\c \tmp, #:lower16:BASEADDR_V7M_SCB + \op + movt\c \tmp, #:upper16:BASEADDR_V7M_SCB + \op + str\c \rt, [\tmp] +.endm + + +.macro read_ccsidr, rt + v7m_cache_read \rt, V7M_SCB_CCSIDR +.endm + +.macro read_clidr, rt + v7m_cache_read \rt, V7M_SCB_CLIDR +.endm + +.macro write_csselr, rt, tmp + v7m_cacheop \rt, \tmp, V7M_SCB_CSSELR +.endm + +/* + * dcisw: Invalidate data cache by set/way + */ +.macro dcisw, rt, tmp + v7m_cacheop \rt, \tmp, V7M_SCB_DCISW +.endm + +/* + * dccisw: Clean and invalidate data cache by set/way + */ +.macro dccisw, rt, tmp + v7m_cacheop \rt, \tmp, V7M_SCB_DCCISW +.endm + +/* + * dccimvac: Clean and invalidate data cache line by MVA to PoC. + */ +.irp c,,eq,ne,cs,cc,mi,pl,vs,vc,hi,ls,ge,lt,gt,le,hs,lo +.macro dccimvac\c, rt, tmp + v7m_cacheop \rt, \tmp, V7M_SCB_DCCIMVAC, \c +.endm +.endr + +/* + * dcimvac: Invalidate data cache line by MVA to PoC + */ +.macro dcimvac, rt, tmp + v7m_cacheop \rt, \tmp, V7M_SCB_DCIMVAC +.endm + +/* + * dccmvau: Clean data cache line by MVA to PoU + */ +.macro dccmvau, rt, tmp + v7m_cacheop \rt, \tmp, V7M_SCB_DCCMVAU +.endm + +/* + * dccmvac: Clean data cache line by MVA to PoC + */ +.macro dccmvac, rt, tmp + v7m_cacheop \rt, \tmp, V7M_SCB_DCCMVAC +.endm + +/* + * icimvau: Invalidate instruction caches by MVA to PoU + */ +.macro icimvau, rt, tmp + v7m_cacheop \rt, \tmp, V7M_SCB_ICIMVAU +.endm + +/* + * Invalidate the icache, inner shareable if SMP, invalidate BTB for UP. + * rt data ignored by ICIALLU(IS), so can be used for the address + */ +.macro invalidate_icache, rt + v7m_cacheop \rt, \rt, V7M_SCB_ICIALLU + mov \rt, #0 +.endm + +/* + * Invalidate the BTB, inner shareable if SMP. + * rt data ignored by BPIALL, so it can be used for the address + */ +.macro invalidate_bp, rt + v7m_cacheop \rt, \rt, V7M_SCB_BPIALL + mov \rt, #0 +.endm + +ENTRY(v7m_invalidate_l1) + mov r0, #0 + + write_csselr r0, r1 + read_ccsidr r0 + + movw r1, #0x7fff + and r2, r1, r0, lsr #13 + + movw r1, #0x3ff + + and r3, r1, r0, lsr #3 @ NumWays - 1 + add r2, r2, #1 @ NumSets + + and r0, r0, #0x7 + add r0, r0, #4 @ SetShift + + clz r1, r3 @ WayShift + add r4, r3, #1 @ NumWays +1: sub r2, r2, #1 @ NumSets-- + mov r3, r4 @ Temp = NumWays +2: subs r3, r3, #1 @ Temp-- + mov r5, r3, lsl r1 + mov r6, r2, lsl r0 + orr r5, r5, r6 @ Reg = (Temp<<WayShift)|(NumSets<<SetShift) + dcisw r5, r6 + bgt 2b + cmp r2, #0 + bgt 1b + dsb st + isb + ret lr +ENDPROC(v7m_invalidate_l1) + +/* + * v7m_flush_icache_all() + * + * Flush the whole I-cache. + * + * Registers: + * r0 - set to 0 + */ +ENTRY(v7m_flush_icache_all) + invalidate_icache r0 + ret lr +ENDPROC(v7m_flush_icache_all) + +/* + * v7m_flush_dcache_all() + * + * Flush the whole D-cache. + * + * Corrupted registers: r0-r7, r9-r11 + */ +ENTRY(v7m_flush_dcache_all) + dmb @ ensure ordering with previous memory accesses + read_clidr r0 + mov r3, r0, lsr #23 @ move LoC into position + ands r3, r3, #7 << 1 @ extract LoC*2 from clidr + beq finished @ if loc is 0, then no need to clean +start_flush_levels: + mov r10, #0 @ start clean at cache level 0 +flush_levels: + add r2, r10, r10, lsr #1 @ work out 3x current cache level + mov r1, r0, lsr r2 @ extract cache type bits from clidr + and r1, r1, #7 @ mask of the bits for current cache only + cmp r1, #2 @ see what cache we have at this level + blt skip @ skip if no cache, or just i-cache +#ifdef CONFIG_PREEMPT + save_and_disable_irqs_notrace r9 @ make cssr&csidr read atomic +#endif + write_csselr r10, r1 @ set current cache level + isb @ isb to sych the new cssr&csidr + read_ccsidr r1 @ read the new csidr +#ifdef CONFIG_PREEMPT + restore_irqs_notrace r9 +#endif + and r2, r1, #7 @ extract the length of the cache lines + add r2, r2, #4 @ add 4 (line length offset) + movw r4, #0x3ff + ands r4, r4, r1, lsr #3 @ find maximum number on the way size + clz r5, r4 @ find bit position of way size increment + movw r7, #0x7fff + ands r7, r7, r1, lsr #13 @ extract max number of the index size +loop1: + mov r9, r7 @ create working copy of max index +loop2: + lsl r6, r4, r5 + orr r11, r10, r6 @ factor way and cache number into r11 + lsl r6, r9, r2 + orr r11, r11, r6 @ factor index number into r11 + dccisw r11, r6 @ clean/invalidate by set/way + subs r9, r9, #1 @ decrement the index + bge loop2 + subs r4, r4, #1 @ decrement the way + bge loop1 +skip: + add r10, r10, #2 @ increment cache number + cmp r3, r10 + bgt flush_levels +finished: + mov r10, #0 @ swith back to cache level 0 + write_csselr r10, r3 @ select current cache level in cssr + dsb st + isb + ret lr +ENDPROC(v7m_flush_dcache_all) + +/* + * v7m_flush_cache_all() + * + * Flush the entire cache system. + * The data cache flush is now achieved using atomic clean / invalidates + * working outwards from L1 cache. This is done using Set/Way based cache + * maintenance instructions. + * The instruction cache can still be invalidated back to the point of + * unification in a single instruction. + * + */ +ENTRY(v7m_flush_kern_cache_all) + stmfd sp!, {r4-r7, r9-r11, lr} + bl v7m_flush_dcache_all + invalidate_icache r0 + ldmfd sp!, {r4-r7, r9-r11, lr} + ret lr +ENDPROC(v7m_flush_kern_cache_all) + +/* + * v7m_flush_cache_all() + * + * Flush all TLB entries in a particular address space + * + * - mm - mm_struct describing address space + */ +ENTRY(v7m_flush_user_cache_all) + /*FALLTHROUGH*/ + +/* + * v7m_flush_cache_range(start, end, flags) + * + * Flush a range of TLB entries in the specified address space. + * + * - start - start address (may not be aligned) + * - end - end address (exclusive, may not be aligned) + * - flags - vm_area_struct flags describing address space + * + * It is assumed that: + * - we have a VIPT cache. + */ +ENTRY(v7m_flush_user_cache_range) + ret lr +ENDPROC(v7m_flush_user_cache_all) +ENDPROC(v7m_flush_user_cache_range) + +/* + * v7m_coherent_kern_range(start,end) + * + * Ensure that the I and D caches are coherent within specified + * region. This is typically used when code has been written to + * a memory region, and will be executed. + * + * - start - virtual start address of region + * - end - virtual end address of region + * + * It is assumed that: + * - the Icache does not read data from the write buffer + */ +ENTRY(v7m_coherent_kern_range) + /* FALLTHROUGH */ + +/* + * v7m_coherent_user_range(start,end) + * + * Ensure that the I and D caches are coherent within specified + * region. This is typically used when code has been written to + * a memory region, and will be executed. + * + * - start - virtual start address of region + * - end - virtual end address of region + * + * It is assumed that: + * - the Icache does not read data from the write buffer + */ +ENTRY(v7m_coherent_user_range) + UNWIND(.fnstart ) + dcache_line_size r2, r3 + sub r3, r2, #1 + bic r12, r0, r3 +1: +/* + * We use open coded version of dccmvau otherwise USER() would + * point@movw instruction. + */ + dccmvau r12, r3 + add r12, r12, r2 + cmp r12, r1 + blo 1b + dsb ishst + icache_line_size r2, r3 + sub r3, r2, #1 + bic r12, r0, r3 +2: + icimvau r12, r3 + add r12, r12, r2 + cmp r12, r1 + blo 2b + invalidate_bp r0 + dsb ishst + isb + ret lr + UNWIND(.fnend ) +ENDPROC(v7m_coherent_kern_range) +ENDPROC(v7m_coherent_user_range) + +/* + * v7m_flush_kern_dcache_area(void *addr, size_t size) + * + * Ensure that the data held in the page kaddr is written back + * to the page in question. + * + * - addr - kernel address + * - size - region size + */ +ENTRY(v7m_flush_kern_dcache_area) + dcache_line_size r2, r3 + add r1, r0, r1 + sub r3, r2, #1 + bic r0, r0, r3 +1: + dccimvac r0, r3 @ clean & invalidate D line / unified line + add r0, r0, r2 + cmp r0, r1 + blo 1b + dsb st + ret lr +ENDPROC(v7m_flush_kern_dcache_area) + +/* + * v7m_dma_inv_range(start,end) + * + * Invalidate the data cache within the specified region; we will + * be performing a DMA operation in this region and we want to + * purge old data in the cache. + * + * - start - virtual start address of region + * - end - virtual end address of region + */ +v7m_dma_inv_range: + dcache_line_size r2, r3 + sub r3, r2, #1 + tst r0, r3 + bic r0, r0, r3 + dccimvacne r0, r3 + subne r3, r2, #1 @ restore r3, corrupted by v7m's dccimvac + tst r1, r3 + bic r1, r1, r3 + dccimvacne r1, r3 +1: + dcimvac r0, r3 + add r0, r0, r2 + cmp r0, r1 + blo 1b + dsb st + ret lr +ENDPROC(v7m_dma_inv_range) + +/* + * v7m_dma_clean_range(start,end) + * - start - virtual start address of region + * - end - virtual end address of region + */ +v7m_dma_clean_range: + dcache_line_size r2, r3 + sub r3, r2, #1 + bic r0, r0, r3 +1: + dccmvac r0, r3 @ clean D / U line + add r0, r0, r2 + cmp r0, r1 + blo 1b + dsb st + ret lr +ENDPROC(v7m_dma_clean_range) + +/* + * v7m_dma_flush_range(start,end) + * - start - virtual start address of region + * - end - virtual end address of region + */ +ENTRY(v7m_dma_flush_range) + dcache_line_size r2, r3 + sub r3, r2, #1 + bic r0, r0, r3 +1: + dccimvac r0, r3 @ clean & invalidate D / U line + add r0, r0, r2 + cmp r0, r1 + blo 1b + dsb st + ret lr +ENDPROC(v7m_dma_flush_range) + +/* + * dma_map_area(start, size, dir) + * - start - kernel virtual start address + * - size - size of region + * - dir - DMA direction + */ +ENTRY(v7m_dma_map_area) + add r1, r1, r0 + teq r2, #DMA_FROM_DEVICE + beq v7m_dma_inv_range + b v7m_dma_clean_range +ENDPROC(v7m_dma_map_area) + +/* + * dma_unmap_area(start, size, dir) + * - start - kernel virtual start address + * - size - size of region + * - dir - DMA direction + */ +ENTRY(v7m_dma_unmap_area) + add r1, r1, r0 + teq r2, #DMA_TO_DEVICE + bne v7m_dma_inv_range + ret lr +ENDPROC(v7m_dma_unmap_area) + + .globl v7m_flush_kern_cache_louis + .equ v7m_flush_kern_cache_louis, v7m_flush_kern_cache_all + + __INITDATA + + @ define struct cpu_cache_fns (see <asm/cacheflush.h> and proc-macros.S) + define_cache_functions v7m
arch/arm/mm/proc-macros.S +16 -0
@@ -7,6 +7,10 @@ #include <asm/asm-offsets.h> #include <asm/thread_info.h> +#ifdef CONFIG_CPU_V7M +#include <asm/v7m.h> +#endif + /* * vma_vm_mm - get mm pointer from vma pointer (vma->vm_mm) */
@@ -70,7 +74,13 @@ * on ARMv7. */ .macro dcache_line_size, reg, tmp +#ifdef CONFIG_CPU_V7M + movw \tmp, #:lower16:BASEADDR_V7M_SCB + V7M_SCB_CTR + movt \tmp, #:upper16:BASEADDR_V7M_SCB + V7M_SCB_CTR + ldr \tmp, [\tmp] +#else mrc p15, 0, \tmp, c0, c0, 1 @ read ctr +#endif lsr \tmp, \tmp, #16 and \tmp, \tmp, #0xf @ cache line size encoding mov \reg, #4 @ bytes per word
@@ -82,7 +92,13 @@ * on ARMv7. */ .macro icache_line_size, reg, tmp +#ifdef CONFIG_CPU_V7M + movw \tmp, #:lower16:BASEADDR_V7M_SCB + V7M_SCB_CTR + movt \tmp, #:upper16:BASEADDR_V7M_SCB + V7M_SCB_CTR + ldr \tmp, [\tmp] +#else mrc p15, 0, \tmp, c0, c0, 1 @ read ctr +#endif and \tmp, \tmp, #0xf @ cache line size encoding mov \reg, #4 @ bytes per word mov \reg, \reg, lsl \tmp @ actual cache line size
Signature · 1 line
1.7.9.5
PATCH v2 6/8 ARM: V7M: Wire up caches for V7M processors with cache support.
In reply to Vladimir MurzinFrom: Jonathan Austin <[email protected]>
This patch does the plumbing required to invoke the V7M cache code added in earlier patches in this series, although there is no users for that yet.
In order to honour the I/D cache disable config options, this patch changes the mechanism by which the CCR is set on boot, to be more like V7A/R.
--- arch/arm/include/asm/glue-cache.h | 4 ---- arch/arm/kernel/head-nommu.S | 16 +++++++++++++++- arch/arm/mm/Kconfig | 10 +++++++--- arch/arm/mm/Makefile | 2 ++ arch/arm/mm/proc-v7m.S | 5 ++--- 5 files changed, 26 insertions(+), 11 deletions(-)
arch/arm/include/asm/glue-cache.h +0 -4
@@ -118,11 +118,7 @@#endif #if defined(CONFIG_CPU_V7M ) -# ifdef _CACHE# define MULTI_CACHE 1 -# else -# define _CACHE nop -# endif #endif #if !defined(_CACHE) && !defined(MULTI_CACHE )
arch/arm/kernel/head-nommu.S +15 -1
@@ -158,7 +158,21 @@ __after_proc_init: bic r0, r0, #CR_V #endif mcr p15, 0, r0, c1, c0, 0 @ write control reg -#endif /* CONFIG_CPU_CP15 */ +#elif defined (CONFIG_CPU_V7M) + /* For V7M systems we want to modify the CCR similarly to the SCTLR */ +#ifdef CONFIG_CPU_DCACHE_DISABLE + bic r0, r0, #V7M_SCB_CCR_DC +#endif +#ifdef CONFIG_CPU_BPREDICT_DISABLE + bic r0, r0, #V7M_SCB_CCR_BP +#endif +#ifdef CONFIG_CPU_ICACHE_DISABLE + bic r0, r0, #V7M_SCB_CCR_IC +#endif + movw r3, #:lower16:(BASEADDR_V7M_SCB + V7M_SCB_CCR) + movt r3, #:upper16:(BASEADDR_V7M_SCB + V7M_SCB_CCR) + str r0, [r3] +#endif /* CONFIG_CPU_CP15 elif CONFIG_CPU_V7M */ ret lr ENDPROC(__after_proc_init) .ltorg
arch/arm/mm/Kconfig +7 -3
@@ -403,6 +403,7 @@ config CPU_V7M bool select CPU_32v7M select CPU_ABRT_NOMMU + select CPU_CACHE_V7M select CPU_CACHE_NOP select CPU_PABRT_LEGACY select CPU_THUMBONLY
@@ -518,6 +519,9 @@ config CPU_CACHE_VIPT config CPU_CACHE_FA bool +config CPU_CACHE_V7M + bool + if MMU # The copy-page model config CPU_COPY_V4WT
@@ -750,14 +754,14 @@ config CPU_HIGH_VECTOR config CPU_ICACHE_DISABLE bool "Disable I-Cache (I-bit)" - depends on CPU_CP15 && !(CPU_ARM720T || CPU_ARM740T || CPU_XSCALE || CPU_XSC3) + depends on (CPU_CP15 && !(CPU_ARM720T || CPU_ARM740T || CPU_XSCALE || CPU_XSC3)) || CPU_V7M help Say Y here to disable the processor instruction cache. Unless you have a reason not to or are unsure, say N. config CPU_DCACHE_DISABLE bool "Disable D-Cache (C-bit)" - depends on CPU_CP15 && !SMP + depends on (CPU_CP15 && !SMP) || CPU_V7M help Say Y here to disable the processor data cache. Unless you have a reason not to or are unsure, say N.
@@ -792,7 +796,7 @@ config CPU_CACHE_ROUND_ROBIN config CPU_BPREDICT_DISABLE bool "Disable branch prediction" - depends on CPU_ARM1020 || CPU_V6 || CPU_V6K || CPU_MOHAWK || CPU_XSC3 || CPU_V7 || CPU_FA526 + depends on CPU_ARM1020 || CPU_V6 || CPU_V6K || CPU_MOHAWK || CPU_XSC3 || CPU_V7 || CPU_FA526 || CPU_V7M help Say Y here to disable branch prediction. If unsure, say N.
arch/arm/mm/Makefile +2 -0
@@ -43,9 +43,11 @@ obj-$(CONFIG_CPU_CACHE_V6) += cache-v6.o obj-$(CONFIG_CPU_CACHE_V7) += cache-v7.o obj-$(CONFIG_CPU_CACHE_FA) += cache-fa.o obj-$(CONFIG_CPU_CACHE_NOP) += cache-nop.o +obj-$(CONFIG_CPU_CACHE_V7M) += cache-v7m.o AFLAGS_cache-v6.o :=-Wa,-march=armv6 AFLAGS_cache-v7.o :=-Wa,-march=armv7-a +AFLAGS_cache-v7m.o :=-Wa,-march=armv7-m obj-$(CONFIG_CPU_COPY_V4WT) += copypage-v4wt.o obj-$(CONFIG_CPU_COPY_V4WB) += copypage-v4wb.o
arch/arm/mm/proc-v7m.S +2 -3
@@ -118,9 +118,8 @@ __v7m_setup: @ Configure the System Control Register to ensure 8-byte stack alignment @ Note the STKALIGN bit is either RW or RAO. - ldr r12, [r0, V7M_SCB_CCR] @ system control register - orr r12, #V7M_SCB_CCR_STKALIGN - str r12, [r0, V7M_SCB_CCR] + ldr r0, [r0, V7M_SCB_CCR] @ system control register + orr r0, #V7M_SCB_CCR_STKALIGN ret lr ENDPROC(__v7m_setup)
Signature · 1 line
1.7.9.5
PATCH v2 7/8 ARM: V7M: Indirect proc_info construction for V7M CPUs
In reply to Vladimir MurzinFrom: Jonathan Austin <[email protected]>
This patch copies the method used for V7A/R CPUs to specify differing processor info for different cores.
This patch differentiates Cortex-M3 and Cortex-M4 and leaves a fallback case for any other V7M processors.
--- arch/arm/mm/proc-v7m.S | 46 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 11 deletions(-)
arch/arm/mm/proc-v7m.S +35 -11
@@ -132,6 +132,40 @@ ENDPROC(__v7m_setup) .section ".proc.info.init", #alloc +.macro __v7m_proc name, initfunc, cache_fns = nop_cache_fns, hwcaps = 0, proc_fns = v7m_processor_functions + .long 0 /* proc_info_list.__cpu_mm_mmu_flags */ + .long 0 /* proc_info_list.__cpu_io_mmu_flags */ + initfn \initfunc, \name + .long cpu_arch_name + .long cpu_elf_name + .long HWCAP_HALF | HWCAP_THUMB | HWCAP_FAST_MULT | \hwcaps + .long cpu_v7m_name + .long \proc_fns + .long 0 /* proc_info_list.tlb */ + .long 0 /* proc_info_list.user */ + .long \cache_fns +.endm + + /* + * Match ARM Cortex-M4 processor. + */ + .type __v7m_cm4_proc_info, #object +__v7m_cm4_proc_info: + .long 0x410fc240 /* ARM Cortex-M4 0xC24 */ + .long 0xff0ffff0 /* Mask off revision, patch release */ + __v7m_proc __v7m_cm4_proc_info, __v7m_setup, hwcaps = HWCAP_EDSP + .size __v7m_cm4_proc_info, . - __v7m_cm4_proc_info + + /* + * Match ARM Cortex-M3 processor. + */ + .type __v7m_cm3_proc_info, #object +__v7m_cm3_proc_info: + .long 0x410fc230 /* ARM Cortex-M3 0xC23 */ + .long 0xff0ffff0 /* Mask off revision, patch release */ + __v7m_proc __v7m_cm3_proc_info, __v7m_setup + .size __v7m_cm3_proc_info, . - __v7m_cm3_proc_info + /* * Match any ARMv7-M processor core. */
@@ -139,16 +173,6 @@ ENDPROC(__v7m_setup) __v7m_proc_info: .long 0x000f0000 @ Required ID value .long 0x000f0000 @ Mask for ID - .long 0 @ proc_info_list.__cpu_mm_mmu_flags - .long 0 @ proc_info_list.__cpu_io_mmu_flags - initfn __v7m_setup, __v7m_proc_info @ proc_info_list.__cpu_flush - .long cpu_arch_name - .long cpu_elf_name - .long HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT - .long cpu_v7m_name - .long v7m_processor_functions @ proc_info_list.proc - .long 0 @ proc_info_list.tlb - .long 0 @ proc_info_list.user - .long nop_cache_fns @ proc_info_list.cache + __v7m_proc __v7m_proc_info, __v7m_setup .size __v7m_proc_info, . - __v7m_proc_info
Signature · 1 line
1.7.9.5
PATCH v2 8/8 ARM: V7M: Add support for the Cortex-M7 processor
In reply to Vladimir MurzinFrom: Jonathan Austin <[email protected]>
Cortex-M7 is a new member of the V7M processor family that adds, among other things, caches over the features available in Cortex-M4.
This patch adds support for recognising the processor at boot time, and make use of recently introduced cache functions.
--- arch/arm/mm/proc-v7m.S | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)
arch/arm/mm/proc-v7m.S +56 -0
@@ -74,14 +74,42 @@ ENTRY(cpu_v7m_do_resume) ENDPROC(cpu_v7m_do_resume) #endif +ENTRY(cpu_cm7_dcache_clean_area) + dcache_line_size r2, r3 + movw r3, #:lower16:BASEADDR_V7M_SCB + V7M_SCB_DCCMVAC + movt r3, #:upper16:BASEADDR_V7M_SCB + V7M_SCB_DCCMVAC + +1: str r0, [r3] @ clean D entry + add r0, r0, r2 + subs r1, r1, r2 + bhi 1b + dsb + ret lr +ENDPROC(cpu_cm7_dcache_clean_area) + +ENTRY(cpu_cm7_proc_fin) + movw r2, #:lower16:(BASEADDR_V7M_SCB + V7M_SCB_CCR) + movt r2, #:upper16:(BASEADDR_V7M_SCB + V7M_SCB_CCR) + ldr r0, [r2] + bic r0, r0, #(V7M_SCB_CCR_DC | V7M_SCB_CCR_IC) + str r0, [r2] + ret lr +ENDPROC(cpu_cm7_proc_fin) + .section ".text.init", #alloc, #execinstr +__v7m_cm7_setup: + mov r8, #(V7M_SCB_CCR_DC | V7M_SCB_CCR_IC| V7M_SCB_CCR_BP) + b __v7m_setup_cont /* * __v7m_setup * * This should be able to cover all ARMv7-M cores. */ __v7m_setup: + mov r8, 0 + +__v7m_setup_cont: @ Configure the vector table base address ldr r0, =BASEADDR_V7M_SCB ldr r12, =vector_table
@@ -116,14 +144,32 @@ __v7m_setup: mov r1, #1 msr control, r1 @ Thread mode has unpriviledged access + @ Configure caches (if implemented) + teq r8, #0 + stmneia r12, {r0-r6, lr} @ v7m_invalidate_l1 touches r0-r6 + blne v7m_invalidate_l1 + teq r8, #0 @ re-evalutae condition + ldmneia r12, {r0-r6, lr} + @ Configure the System Control Register to ensure 8-byte stack alignment @ Note the STKALIGN bit is either RW or RAO. ldr r0, [r0, V7M_SCB_CCR] @ system control register orr r0, #V7M_SCB_CCR_STKALIGN + orr r0, r0, r8 + ret lr ENDPROC(__v7m_setup) +/* + * Cortex-M7 processor functions + */ + globl_equ cpu_cm7_proc_init, cpu_v7m_proc_init + globl_equ cpu_cm7_reset, cpu_v7m_reset + globl_equ cpu_cm7_do_idle, cpu_v7m_do_idle + globl_equ cpu_cm7_switch_mm, cpu_v7m_switch_mm + define_processor_functions v7m, dabort=nommu_early_abort, pabort=legacy_pabort, nommu=1 + define_processor_functions cm7, dabort=nommu_early_abort, pabort=legacy_pabort, nommu=1 .section ".rodata" string cpu_arch_name, "armv7m"
@@ -147,6 +193,16 @@ ENDPROC(__v7m_setup) .endm /* + * Match ARM Cortex-M7 processor. + */ + .type __v7m_cm7_proc_info, #object +__v7m_cm7_proc_info: + .long 0x410fc270 /* ARM Cortex-M7 0xC27 */ + .long 0xff0ffff0 /* Mask off revision, patch release */ + __v7m_proc __v7m_cm7_proc_info, __v7m_cm7_setup, hwcaps = HWCAP_EDSP, cache_fns = v7m_cache_fns, proc_fns = cm7_processor_functions + .size __v7m_cm7_proc_info, . - __v7m_cm7_proc_info + + /* * Match ARM Cortex-M4 processor. */ .type __v7m_cm4_proc_info, #object
Signature · 1 line
1.7.9.5
Russell King - ARM Linux
maintainerv2 cover ARM: V7M: Support caches
In reply to Vladimir MurzinQuoted 13 lines · Vladimir Murzin
This patch set allows M-class cpus benefit of optional cache support. It originally was written by Jonny, I've been keeping it locally mainly rebasing over Linux versions.
The original idea behind patches was to reuse existing cache handling code from v7A/R with help of extra macros to factor out cache handling logic (v7M cache operations are provided via memory mapped interface rather than co-processor instructions).
However, that idea was rejected and starting form this (v2) version V7M cache logic lives into file and macros to indirect memory-mapped operations stay there locally since they make it easier to follow the code.
Quoted 7 lines
Along with the v7M cache support the first user (Cortex-M7) is introduced.
Patches were tested on MPS2 platform with Cortex-M3/M4/M7. The later one showed significant boot speed-up.
From a quick read through, the approach looks sane, and I think I'm
now happy with these.
Thanks.
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
v2 cover ARM: V7M: Support caches
Quoted 14 lines · Russell King - ARM Linux
Quoted 13 lines · Vladimir Murzin
This patch set allows M-class cpus benefit of optional cache support. It originally was written by Jonny, I've been keeping it locally mainly rebasing over Linux versions.
The original idea behind patches was to reuse existing cache handling code from v7A/R with help of extra macros to factor out cache handling logic (v7M cache operations are provided via memory mapped interface rather than co-processor instructions).
However, that idea was rejected and starting form this (v2) version V7M cache logic lives into file and macros to indirect memory-mapped operations stay there locally since they make it easier to follow the code.
Quoted 9 lines
Quoted 7 lines
Along with the v7M cache support the first user (Cortex-M7) is introduced.
Patches were tested on MPS2 platform with Cortex-M3/M4/M7. The later one showed significant boot speed-up.
From a quick read through, the approach looks sane, and I think I'm
now happy with these.
Thanks!
Is it acceptable if patches hang on a list for awhile, so people (I'm looking at Alex and Szemz?) can test them?
Vladimir
Quoted 2 lines
Thanks.
Russell King - ARM Linux
maintainerv2 cover ARM: V7M: Support caches
Quoted 21 lines · Vladimir Murzin
Quoted 20 lines · Russell King - ARM Linux
Quoted 18 lines · Vladimir Murzin
This patch set allows M-class cpus benefit of optional cache support. It originally was written by Jonny, I've been keeping it locally mainly rebasing over Linux versions.
The original idea behind patches was to reuse existing cache handling code from v7A/R with help of extra macros to factor out cache handling logic (v7M cache operations are provided via memory mapped interface rather than co-processor instructions).
However, that idea was rejected and starting form this (v2) version V7M cache logic lives into file and macros to indirect memory-mapped operations stay there locally since they make it easier to follow the code.Along with the v7M cache support the first user (Cortex-M7) is introduced.
Patches were tested on MPS2 platform with Cortex-M3/M4/M7. The later one showed significant boot speed-up.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
From a quick read through, the approach looks sane, and I think I'm
now happy with these.
Thanks!
Is it acceptable if patches hang on a list for awhile, so people (I'm looking at Alex and Szemz?) can test them?
Of course.
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.
v2 cover ARM: V7M: Support caches
Quoted 26 lines · Russell King - ARM Linux
Quoted 25 lines · Vladimir Murzin
Quoted 23 lines · Russell King - ARM Linux
Quoted 13 lines · Vladimir Murzin
This patch set allows M-class cpus benefit of optional cache support. It originally was written by Jonny, I've been keeping it locally mainly rebasing over Linux versions.
The original idea behind patches was to reuse existing cache handling code from v7A/R with help of extra macros to factor out cache handling logic (v7M cache operations are provided via memory mapped interface rather than co-processor instructions).
However, that idea was rejected and starting form this (v2) version V7M cache logic lives into file and macros to indirect memory-mapped operations stay there locally since they make it easier to follow the code.Quoted 7 lines
Along with the v7M cache support the first user (Cortex-M7) is introduced.
Patches were tested on MPS2 platform with Cortex-M3/M4/M7. The later one showed significant boot speed-up.
From a quick read through, the approach looks sane, and I think I'm
now happy with these.
Quoted 7 lines
Quoted 4 lines
Thanks!
Is it acceptable if patches hang on a list for awhile, so people (I'm looking at Alex and Szemz?) can test them?
Of course.
Russell, given that it was tested on platforms with and without cache support, I've just dropped this set into patch system. Please, let me know if you see issues with that.
Thanks
Vladimir
v2 cover ARM: V7M: Support caches
In reply to Vladimir MurzinHi,
Quoted 5 lines · Vladimir Murzin
Is it acceptable if patches hang on a list for awhile, so people (I'm looking at Alex and Szemz?) can test them?
This is my first email to the list, so sorry If I make mistakes with my report, I still need to learn?
I have tested these patches on my custom board with ATMEL SAME70 armv7m SoC.
With default memory mapping configured MPU booting and rebooting works fine, I don?t see any issues. The system shows significant overall speedup as expected.
[ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 4.8.0-rc2 (root at debian) (gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29) ) #23 PREEMPT Tue Aug 23 22:5 0:19 CEST 2016 [ 0.000000] CPU: ARMv7-M [410fc271] revision 1 (ARMv7M), cr=00000000 [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache [ 0.000000] OF: fdt:Machine model: SAME70-sampione board
So you can add my Tested-by.
Thanks for the patches!
Regards,
Andras Szemzo
v2 cover ARM: V7M: Support caches
Hi
Quoted 23 lines · Szemz? Andr?s
Hi,
Quoted 5 lines · Vladimir Murzin
Is it acceptable if patches hang on a list for awhile, so people (I'm looking at Alex and Szemz?) can test them?
This is my first email to the list, so sorry If I make mistakes with my report, I still need to learn?
I have tested these patches on my custom board with ATMEL SAME70 armv7m SoC.
With default memory mapping configured MPU booting and rebooting works fine, I don?t see any issues. The system shows significant overall speedup as expected.
[ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Linux version 4.8.0-rc2 (root at debian) (gcc version 4.8.3 20140320 (prerelease) (Sourcery CodeBench Lite 2014.05-29) ) #23 PREEMPT Tue Aug 23 22:5 0:19 CEST 2016 [ 0.000000] CPU: ARMv7-M [410fc271] revision 1 (ARMv7M), cr=00000000 [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache [ 0.000000] OF: fdt:Machine model: SAME70-sampione board
Quoted 3 lines
So you can add my Tested-by.
Thanks for the patches!
Thanks a lot for testing!
Cheers
Vladimir
Quoted 5 lines
Regards,
Andras Szemzo
v2 cover ARM: V7M: Support caches
In reply to Vladimir MurzinHi Vladimir,
Quoted 21 lines · Vladimir Murzin
Quoted 20 lines · Russell King - ARM Linux
Quoted 18 lines · Vladimir Murzin
This patch set allows M-class cpus benefit of optional cache support. It originally was written by Jonny, I've been keeping it locally mainly rebasing over Linux versions.
The original idea behind patches was to reuse existing cache handling code from v7A/R with help of extra macros to factor out cache handling logic (v7M cache operations are provided via memory mapped interface rather than co-processor instructions).
However, that idea was rejected and starting form this (v2) version V7M cache logic lives into file and macros to indirect memory-mapped operations stay there locally since they make it easier to follow the code.Along with the v7M cache support the first user (Cortex-M7) is introduced.
Patches were tested on MPS2 platform with Cortex-M3/M4/M7. The later one showed significant boot speed-up.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
From a quick read through, the approach looks sane, and I think I'm
now happy with these.
Thanks!
Is it acceptable if patches hang on a list for awhile, so people (I'm looking at Alex and Szemz?) can test them?
These patches doesn't seem to break anything on the cache-less Cortex-M4 NXP LPC4357.
So FWIW:
regards,
Joachim Eastwood
v2 cover ARM: V7M: Support caches
Hi Joachim,
Quoted 28 lines · Joachim Eastwood
Hi Vladimir,
Quoted 25 lines · Vladimir Murzin
Quoted 23 lines · Russell King - ARM Linux
Quoted 13 lines · Vladimir Murzin
This patch set allows M-class cpus benefit of optional cache support. It originally was written by Jonny, I've been keeping it locally mainly rebasing over Linux versions.
The original idea behind patches was to reuse existing cache handling code from v7A/R with help of extra macros to factor out cache handling logic (v7M cache operations are provided via memory mapped interface rather than co-processor instructions).
However, that idea was rejected and starting form this (v2) version V7M cache logic lives into file and macros to indirect memory-mapped operations stay there locally since they make it easier to follow the code.Quoted 7 lines
Along with the v7M cache support the first user (Cortex-M7) is introduced.
Patches were tested on MPS2 platform with Cortex-M3/M4/M7. The later one showed significant boot speed-up.
From a quick read through, the approach looks sane, and I think I'm
now happy with these.
Quoted 8 lines
Quoted 4 lines
Thanks!
Is it acceptable if patches hang on a list for awhile, so people (I'm looking at Alex and Szemz?) can test them?
These patches doesn't seem to break anything on the cache-less Cortex-M4 NXP LPC4357.
Great!
Quoted 3 lines
So FWIW:
Tested-by Joachim Eastwood <[email protected]>
Thanks a lot for testing!
Cheers
Vladimir
Quoted 5 lines
regards,
Joachim Eastwood
v2 cover ARM: V7M: Support caches
In reply to Vladimir MurzinHi Vladimir,
Quoted 21 lines · Vladimir Murzin
Quoted 20 lines · Russell King - ARM Linux
Quoted 18 lines · Vladimir Murzin
This patch set allows M-class cpus benefit of optional cache support. It originally was written by Jonny, I've been keeping it locally mainly rebasing over Linux versions.
The original idea behind patches was to reuse existing cache handling code from v7A/R with help of extra macros to factor out cache handling logic (v7M cache operations are provided via memory mapped interface rather than co-processor instructions).
However, that idea was rejected and starting form this (v2) version V7M cache logic lives into file and macros to indirect memory-mapped operations stay there locally since they make it easier to follow the code.Along with the v7M cache support the first user (Cortex-M7) is introduced.
Patches were tested on MPS2 platform with Cortex-M3/M4/M7. The later one showed significant boot speed-up.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
From a quick read through, the approach looks sane, and I think I'm
now happy with these.
Thanks!
Is it acceptable if patches hang on a list for awhile, so people (I'm looking at Alex and Szemz?) can test them?
I just tested this v2 patch set. I don't see behavior issues. You can add:
Regards
Alex
Quoted 6 lines
Vladimir
Quoted 2 lines
Thanks.
v2 cover ARM: V7M: Support caches
Hi Alex,
Quoted 28 lines · Alexandre Torgue
Hi Vladimir,
Quoted 25 lines · Vladimir Murzin
Quoted 23 lines · Russell King - ARM Linux
Quoted 13 lines · Vladimir Murzin
This patch set allows M-class cpus benefit of optional cache support. It originally was written by Jonny, I've been keeping it locally mainly rebasing over Linux versions.
The original idea behind patches was to reuse existing cache handling code from v7A/R with help of extra macros to factor out cache handling logic (v7M cache operations are provided via memory mapped interface rather than co-processor instructions).
However, that idea was rejected and starting form this (v2) version V7M cache logic lives into file and macros to indirect memory-mapped operations stay there locally since they make it easier to follow the code.Quoted 7 lines
Along with the v7M cache support the first user (Cortex-M7) is introduced.
Patches were tested on MPS2 platform with Cortex-M3/M4/M7. The later one showed significant boot speed-up.
From a quick read through, the approach looks sane, and I think I'm
now happy with these.
Quoted 9 lines
Quoted 4 lines
Thanks!
Is it acceptable if patches hang on a list for awhile, so people (I'm looking at Alex and Szemz?) can test them?
I just tested this v2 patch set. I don't see behavior issues. You can add:
Tested-by Alexandre TORGUE <[email protected]>
Thanks a lot for testing, Alex!
Cheers
Vladimir
Quoted 12 lines
Regards
Alex
Quoted 6 lines
Vladimir
Quoted 2 lines
Thanks.