Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: 8607/1: V7M: Wire up caches for V7M processors with cache support.

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.

Signed-off-by: Jonathan Austin <jonathan.austin@arm.com>
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
Tested-by: Andras Szemzo <sza@esh.hu>
Tested-by: Joachim Eastwood <manabian@gmail.com>
Tested-by: Alexandre TORGUE <alexandre.torgue@st.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Jonathan Austin and committed by
Russell King
bc0ee9d2 9a1af5f2

+26 -11
-4
arch/arm/include/asm/glue-cache.h
··· 118 118 #endif 119 119 120 120 #if defined(CONFIG_CPU_V7M) 121 - # ifdef _CACHE 122 121 # define MULTI_CACHE 1 123 - # else 124 - # define _CACHE nop 125 - # endif 126 122 #endif 127 123 128 124 #if !defined(_CACHE) && !defined(MULTI_CACHE)
+15 -1
arch/arm/kernel/head-nommu.S
··· 158 158 bic r0, r0, #CR_V 159 159 #endif 160 160 mcr p15, 0, r0, c1, c0, 0 @ write control reg 161 - #endif /* CONFIG_CPU_CP15 */ 161 + #elif defined (CONFIG_CPU_V7M) 162 + /* For V7M systems we want to modify the CCR similarly to the SCTLR */ 163 + #ifdef CONFIG_CPU_DCACHE_DISABLE 164 + bic r0, r0, #V7M_SCB_CCR_DC 165 + #endif 166 + #ifdef CONFIG_CPU_BPREDICT_DISABLE 167 + bic r0, r0, #V7M_SCB_CCR_BP 168 + #endif 169 + #ifdef CONFIG_CPU_ICACHE_DISABLE 170 + bic r0, r0, #V7M_SCB_CCR_IC 171 + #endif 172 + movw r3, #:lower16:(BASEADDR_V7M_SCB + V7M_SCB_CCR) 173 + movt r3, #:upper16:(BASEADDR_V7M_SCB + V7M_SCB_CCR) 174 + str r0, [r3] 175 + #endif /* CONFIG_CPU_CP15 elif CONFIG_CPU_V7M */ 162 176 ret lr 163 177 ENDPROC(__after_proc_init) 164 178 .ltorg
+7 -3
arch/arm/mm/Kconfig
··· 403 403 bool 404 404 select CPU_32v7M 405 405 select CPU_ABRT_NOMMU 406 + select CPU_CACHE_V7M 406 407 select CPU_CACHE_NOP 407 408 select CPU_PABRT_LEGACY 408 409 select CPU_THUMBONLY ··· 517 516 bool 518 517 519 518 config CPU_CACHE_FA 519 + bool 520 + 521 + config CPU_CACHE_V7M 520 522 bool 521 523 522 524 if MMU ··· 754 750 755 751 config CPU_ICACHE_DISABLE 756 752 bool "Disable I-Cache (I-bit)" 757 - depends on CPU_CP15 && !(CPU_ARM720T || CPU_ARM740T || CPU_XSCALE || CPU_XSC3) 753 + depends on (CPU_CP15 && !(CPU_ARM720T || CPU_ARM740T || CPU_XSCALE || CPU_XSC3)) || CPU_V7M 758 754 help 759 755 Say Y here to disable the processor instruction cache. Unless 760 756 you have a reason not to or are unsure, say N. 761 757 762 758 config CPU_DCACHE_DISABLE 763 759 bool "Disable D-Cache (C-bit)" 764 - depends on CPU_CP15 && !SMP 760 + depends on (CPU_CP15 && !SMP) || CPU_V7M 765 761 help 766 762 Say Y here to disable the processor data cache. Unless 767 763 you have a reason not to or are unsure, say N. ··· 796 792 797 793 config CPU_BPREDICT_DISABLE 798 794 bool "Disable branch prediction" 799 - depends on CPU_ARM1020 || CPU_V6 || CPU_V6K || CPU_MOHAWK || CPU_XSC3 || CPU_V7 || CPU_FA526 795 + depends on CPU_ARM1020 || CPU_V6 || CPU_V6K || CPU_MOHAWK || CPU_XSC3 || CPU_V7 || CPU_FA526 || CPU_V7M 800 796 help 801 797 Say Y here to disable branch prediction. If unsure, say N. 802 798
+2
arch/arm/mm/Makefile
··· 43 43 obj-$(CONFIG_CPU_CACHE_V7) += cache-v7.o 44 44 obj-$(CONFIG_CPU_CACHE_FA) += cache-fa.o 45 45 obj-$(CONFIG_CPU_CACHE_NOP) += cache-nop.o 46 + obj-$(CONFIG_CPU_CACHE_V7M) += cache-v7m.o 46 47 47 48 AFLAGS_cache-v6.o :=-Wa,-march=armv6 48 49 AFLAGS_cache-v7.o :=-Wa,-march=armv7-a 50 + AFLAGS_cache-v7m.o :=-Wa,-march=armv7-m 49 51 50 52 obj-$(CONFIG_CPU_COPY_V4WT) += copypage-v4wt.o 51 53 obj-$(CONFIG_CPU_COPY_V4WB) += copypage-v4wb.o
+2 -3
arch/arm/mm/proc-v7m.S
··· 118 118 119 119 @ Configure the System Control Register to ensure 8-byte stack alignment 120 120 @ Note the STKALIGN bit is either RW or RAO. 121 - ldr r12, [r0, V7M_SCB_CCR] @ system control register 122 - orr r12, #V7M_SCB_CCR_STKALIGN 123 - str r12, [r0, V7M_SCB_CCR] 121 + ldr r0, [r0, V7M_SCB_CCR] @ system control register 122 + orr r0, #V7M_SCB_CCR_STKALIGN 124 123 ret lr 125 124 ENDPROC(__v7m_setup) 126 125