Another round of ARMv7-M patches
Subsystems (2)
v11 cover Another round of ARMv7-M patches
Hello,
the changes since v10 are small:
- Jonny noticed an inconsitency in arch/arm/mm/proc-v7m.S
- changes to account for review comments to my nvic driver (v3 just sent out)
I put these three patches in my for-next branch so they should make it into the next next. The tree merges fine into current Linus' master and next-20130417.
Russell, what are your thoughts about the series? Would you take it for v3.10? Or v3.11?
Catalin Marinas (1):
ARM: Add base support for ARMv7-M
Uwe Kleine-K?nig (2):
ARM: ARMv7-M: Add support for exception handling
ARM: ARMv7-M: Allow the building of new kernel port
arch/arm/Kconfig | 4 +- arch/arm/Kconfig-nommu | 2 +- arch/arm/Makefile | 1 + arch/arm/include/asm/assembler.h | 17 +++- arch/arm/include/asm/cputype.h | 12 ++- arch/arm/include/asm/glue-cache.h | 27 +++++++ arch/arm/include/asm/glue-df.h | 8 ++ arch/arm/include/asm/glue-proc.h | 9 +++ arch/arm/include/asm/irqflags.h | 22 ++++-- arch/arm/include/asm/ptrace.h | 4 + arch/arm/include/asm/system_info.h | 1 + arch/arm/include/asm/v7m.h | 44 +++++++++++ arch/arm/include/uapi/asm/ptrace.h | 35 +++++++-- arch/arm/kernel/Makefile | 8 +- arch/arm/kernel/entry-common.S | 4 + arch/arm/kernel/entry-header.S | 124 +++++++++++++++++++++++++++++ arch/arm/kernel/entry-v7m.S | 143 +++++++++++++++++++++++++++++++++ arch/arm/kernel/head-nommu.S | 10 ++- arch/arm/kernel/setup.c | 17 +++- arch/arm/kernel/traps.c | 8 ++ arch/arm/mm/Kconfig | 21 ++++- arch/arm/mm/Makefile | 2 + arch/arm/mm/cache-nop.S | 50 ++++++++++++ arch/arm/mm/nommu.c | 7 ++ arch/arm/mm/proc-v7m.S | 157 +++++++++++++++++++++++++++++++++++++ 25 files changed, 711 insertions(+), 26 deletions(-) create mode 100644 arch/arm/include/asm/v7m.h create mode 100644 arch/arm/kernel/entry-v7m.S create mode 100644 arch/arm/mm/cache-nop.S create mode 100644 arch/arm/mm/proc-v7m.S
Signature · 1 line
1.8.2.rc3
PATCH v11 1/3 ARM: Add base support for ARMv7-M
From: Catalin Marinas <[email protected]>
This patch adds the base support for the ARMv7-M architecture. It consists of the corresponding arch/arm/mm/ files and various #ifdef's around the kernel. Exception handling is implemented by a subsequent patch.
[ukleinek: squash in some changes originating from commit
b5717ba (Cortex-M3: Add support for the Microcontroller Prototyping System)
from the v2.6.33-arm1 patch stack, port to post 3.6, drop zImage support, drop reorganisation of pt_regs, assert CONFIG_V7M doesn't leak into installed headers and a few cosmetic changes]
---
Notes:
Changes since v9, sent with Message-id:1363901310-9474-2-git-send-email-u.kleine-koenig at pengutronix.de:
- use relative offsets for V7M_SCB
- drop unused constants for EXC_RET_... and add a comment instead
- several new and expanded comments
- drop HWCAP_SWP and HWCAP_EDSP, add HWCAP_IDIVT
Changes since v10, sent with Message-id:1364381692-7955-2-git-send-email-u.kleine-koenig at pengutronix.de:
- drop unneeded #includes from cache-nop.S
- use define_processor_functions instead of hand coding it. This fixes a mismatch between struct processor and v7m_processor_functions. Noticed by Jonathan Austin.
arch/arm/include/asm/assembler.h | 17 +++- arch/arm/include/asm/cputype.h | 12 ++- arch/arm/include/asm/glue-cache.h | 27 +++++++ arch/arm/include/asm/glue-df.h | 8 ++ arch/arm/include/asm/glue-proc.h | 9 +++ arch/arm/include/asm/irqflags.h | 22 ++++-- arch/arm/include/asm/ptrace.h | 4 + arch/arm/include/asm/system_info.h | 1 + arch/arm/include/asm/v7m.h | 44 +++++++++++ arch/arm/include/uapi/asm/ptrace.h | 35 +++++++-- arch/arm/kernel/head-nommu.S | 10 ++- arch/arm/kernel/setup.c | 17 +++- arch/arm/kernel/traps.c | 8 ++ arch/arm/mm/cache-nop.S | 50 ++++++++++++ arch/arm/mm/nommu.c | 7 ++ arch/arm/mm/proc-v7m.S | 157 +++++++++++++++++++++++++++++++++++++ 16 files changed, 407 insertions(+), 21 deletions(-) create mode 100644 arch/arm/include/asm/v7m.h create mode 100644 arch/arm/mm/cache-nop.S create mode 100644 arch/arm/mm/proc-v7m.S
arch/arm/include/asm/assembler.h +16 -1
@@ -136,7 +136,11 @@* assumes FIQs are enabled, and that the processor is in SVC mode. */ .macro save_and_disable_irqs, oldcpsr +#ifdef CONFIG_CPU_V7M + mrs \oldcpsr, primask +#else mrs \oldcpsr, cpsr +#endif disable_irq .endm
@@ -150,7 +154,11 @@* guarantee that this will preserve the flags. */ .macro restore_irqs_notrace, oldcpsr +#ifdef CONFIG_CPU_V7M + msr primask, \oldcpsr +#else msr cpsr_c, \oldcpsr +#endif .endm .macro restore_irqs, oldcpsr
@@ -229,7 +237,14 @@#endif .endm -#ifdef CONFIG_THUMB2_KERNEL +#if defined(CONFIG_CPU_V7M ) +/* +* setmode is used to assert to be in svc mode during boot. For v7-M +* this is done in __v7m_setup, so setmode can be empty here. +*/ + .macro setmode, mode, reg + .endm +#elif defined(CONFIG_THUMB2_KERNEL ) .macro setmode, mode, reg mov \reg, #\mode msr cpsr_c, \reg
arch/arm/include/asm/cputype.h +11 -1
@@ -106,7 +106,17 @@ static inline unsigned int __attribute_const__ read_cpuid_id(void)return read_cpuid (CPUID_ID ); } -#else /* ifdef CONFIG_CPU_CP15 */ +#elif defined(CONFIG_CPU_V7M ) + +#include <asm/io.h> +#include <asm/v7m.h> + +static inline unsigned int __attribute_const__ read_cpuid_id(void) +{ +return readl (BASEADDR_V7M_SCB +V7M_SCB_CPUID ); +} + +#else /* ifdef CONFIG_CPU_CP15 / elif defined(CONFIG_CPU_V7M) */ static inline unsigned int __attribute_const__ read_cpuid_id(void) {
arch/arm/include/asm/glue-cache.h +27 -0
@@ -125,10 +125,37 @@# endif #endif +#if defined(CONFIG_CPU_V7M ) +# ifdef _CACHE +# define MULTI_CACHE 1 +# else +# define _CACHE nop +# endif +#endif +#if !defined(_CACHE) && !defined(MULTI_CACHE )#error Unknown cache maintenance model#endif +#ifndef __ASSEMBLER__ +extern inline void nop_flush_icache_all (void ) { } +extern inline void nop_flush_kern_cache_all (void ) { } +extern inline void nop_flush_kern_cache_louis (void ) { } +extern inline void nop_flush_user_cache_all (void ) { } +extern inline void nop_flush_user_cache_range (unsigned long a, +unsigned long b,unsigned int c) { } + +extern inline void nop_coherent_kern_range (unsigned long a,unsigned long b) { } +extern inline int nop_coherent_user_range (unsigned long a, +unsigned long b) {return 0 ; } +extern inline void nop_flush_kern_dcache_area (void *a,size_t s) { } + +extern inline void nop_dma_flush_range (const void *a,const void *b) { } + +extern inline void nop_dma_map_area (const void *s,size_t l,int f) { } +extern inline void nop_dma_unmap_area (const void *s,size_t l,int f) { } +#endif +#ifndef MULTI_CACHE #define __cpuc_flush_icache_all __glue(_CACHE,_flush_icache_all)#define __cpuc_flush_kern_all __glue(_CACHE,_flush_kern_cache_all)
arch/arm/include/asm/glue-df.h +8 -0
@@ -95,6 +95,14 @@# endif #endif +#ifdef CONFIG_CPU_ABRT_NOMMU +# ifdef CPU_DABORT_HANDLER +# define MULTI_DABORT 1 +# else +# define CPU_DABORT_HANDLER nommu_early_abort +# endif +#endif +#ifndef CPU_DABORT_HANDLER #error Unknown data abort handler type#endif
arch/arm/include/asm/glue-proc.h +9 -0
@@ -230,6 +230,15 @@# endif #endif +#ifdef CONFIG_CPU_V7M +# ifdef CPU_NAME +# undef MULTI_CPU +# define MULTI_CPU +# else +# define CPU_NAME cpu_v7m +# endif +#endif +#ifndef MULTI_CPU #define cpu_proc_init __glue(CPU_NAME,_proc_init)#define cpu_proc_fin __glue(CPU_NAME,_proc_fin)
arch/arm/include/asm/irqflags.h +16 -6
@@ -8,6 +8,16 @@/* * CPU interrupt mask handling. */ +#ifdef CONFIG_CPU_V7M +#define IRQMASK_REG_NAME_R "primask" +#define IRQMASK_REG_NAME_W "primask" +#define IRQMASK_I_BIT 1 +#else +#define IRQMASK_REG_NAME_R "cpsr" +#define IRQMASK_REG_NAME_W "cpsr_c" +#define IRQMASK_I_BIT PSR_I_BIT +#endif +#if __LINUX_ARM_ARCH__ >=6 static inline unsigned long arch_local_irq_save (void )
@@ -15,7 +25,7 @@ static inline unsigned long arch_local_irq_save(void)unsigned long flags; asmvolatile ( -" mrs %0, cpsr @ arch_local_irq_save\n" +" mrs %0, " IRQMASK_REG_NAME_R " @ arch_local_irq_save\n" " cpsid i" :"=r" (flags) : :"memory" ,"cc" );return flags;
@@ -129,7 +139,7 @@ static inline unsigned long arch_local_save_flags(void) {unsigned long flags; asmvolatile ( -" mrs %0, cpsr @ local_save_flags" +" mrs %0, " IRQMASK_REG_NAME_R " @ local_save_flags" :"=r" (flags) : :"memory" ,"cc" );return flags; }
@@ -140,7 +150,7 @@ static inline unsigned long arch_local_save_flags(void)static inline void arch_local_irq_restore (unsigned long flags) { asmvolatile ( -" msr cpsr_c, %0 @ local_irq_restore" +" msr " IRQMASK_REG_NAME_W ", %0 @ local_irq_restore" : :"r" (flags) :"memory" ,"cc" );
@@ -148,8 +158,8 @@ static inline void arch_local_irq_restore(unsigned long flags)static inline int arch_irqs_disabled_flags (unsigned long flags) { -return flags &PSR_I_BIT ; +return flags &IRQMASK_I_BIT ; } -#endif -#endif +#endif /* ifdef __KERNEL__ */ +#endif /* ifndef __ASM_ARM_IRQFLAGS_H */
arch/arm/include/asm/ptrace.h +4 -0
@@ -45,6 +45,7 @@ struct pt_regs {*/ static inline int valid_user_regs (struct pt_regs *regs) { +#ifndef CONFIG_CPU_V7M unsigned long mode = regs->ARM_cpsr &MODE_MASK ;/*
@@ -67,6 +68,9 @@ static inline int valid_user_regs(struct pt_regs *regs) regs->ARM_cpsr |=USR_MODE ;return 0 ; +#else /* ifndef CONFIG_CPU_V7M */ +return 1 ; +#endif }static inline long regs_return_value (struct pt_regs *regs)
arch/arm/include/asm/system_info.h +1 -0
@@ -11,6 +11,7 @@#define CPU_ARCH_ARMv5TEJ 7#define CPU_ARCH_ARMv6 8#define CPU_ARCH_ARMv7 9 +#define CPU_ARCH_ARMv7M 10#ifndef __ASSEMBLY__
arch/arm/include/asm/v7m.h new file +44 -0
44 lines not on this page · raw message
arch/arm/include/uapi/asm/ptrace.h +27 -8
@@ -34,28 +34,47 @@/* * PSR bits +* Note on V7M there is no mode contained in the PSR */ #define USR26_MODE 0x00000000#define FIQ26_MODE 0x00000001#define IRQ26_MODE 0x00000002#define SVC26_MODE 0x00000003 +#if defined(__KERNEL__) && defined(CONFIG_CPU_V7M ) +/* +* Use 0 here to get code right that creates a userspace +* or kernel space thread. +*/ +#define USR_MODE 0x00000000 +#define SVC_MODE 0x00000000 +#else #define USR_MODE 0x00000010 +#define SVC_MODE 0x00000013 +#endif #define FIQ_MODE 0x00000011#define IRQ_MODE 0x00000012 -#define SVC_MODE 0x00000013#define ABT_MODE 0x00000017#define HYP_MODE 0x0000001a#define UND_MODE 0x0000001b#define SYSTEM_MODE 0x0000001f#define MODE32_BIT 0x00000010#define MODE_MASK 0x0000001f -#define PSR_T_BIT 0x00000020 -#define PSR_F_BIT 0x00000040 -#define PSR_I_BIT 0x00000080 -#define PSR_A_BIT 0x00000100 -#define PSR_E_BIT 0x00000200 -#define PSR_J_BIT 0x01000000 -#define PSR_Q_BIT 0x08000000 + +#define V4_PSR_T_BIT 0x00000020/* >= V4T, but not V7M */ +#define V7M_PSR_T_BIT 0x01000000 +#if defined(__KERNEL__) && defined(CONFIG_CPU_V7M ) +#define PSR_T_BIT V7M_PSR_T_BIT +#else +/* for compatibility */ +#define PSR_T_BIT V4_PSR_T_BIT +#endif + +#define PSR_F_BIT 0x00000040/* >= V4, but not V7M */ +#define PSR_I_BIT 0x00000080/* >= V4, but not V7M */ +#define PSR_A_BIT 0x00000100/* >= V6, but not V7M */ +#define PSR_E_BIT 0x00000200/* >= V6, but not V7M */ +#define PSR_J_BIT 0x01000000/* >= V5J, but not V7M */ +#define PSR_Q_BIT 0x08000000/* >= V5E, including V7M */ #define PSR_V_BIT 0x10000000#define PSR_C_BIT 0x20000000#define PSR_Z_BIT 0x40000000
arch/arm/kernel/head-nommu.S +7 -3
@@ -19,6 +19,7 @@ #include <asm/asm-offsets.h> #include <asm/cp15.h> #include <asm/thread_info.h> +#include <asm/v7m.h> /* * Kernel startup entry point.
@@ -50,10 +51,13 @@ ENTRY(stext) setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9 @ ensure svc mode @ and irqs disabled -#ifndef CONFIG_CPU_CP15 - ldr r9, =CONFIG_PROCESSOR_ID -#else +#if defined(CONFIG_CPU_CP15) mrc p15, 0, r9, c0, c0 @ get processor id +#elif defined(CONFIG_CPU_V7M) + ldr r9, =BASEADDR_V7M_SCB + ldr r9, [r9, V7M_SCB_CPUID] +#else + ldr r9, =CONFIG_PROCESSOR_ID #endif bl __lookup_processor_type @ r5=procinfo r9=cpuid movs r10, r5 @ invalid processor (r5=0)?
arch/arm/kernel/setup.c +15 -2
@@ -128,7 +128,9 @@ struct stack {u32 und[3 ]; }____cacheline_aligned ; +#ifndef CONFIG_CPU_V7M static struct stack stacks[NR_CPUS ]; +#endif char elf_platform[ELF_PLATFORM_SIZE ];EXPORT_SYMBOL (elf_platform);
@@ -207,7 +209,7 @@ static const char *proc_arch[] = {"5TEJ" ,"6TEJ" ,"7" , -"?(11)" , +"7M" ,"?(12)" ,"?(13)" , "?(14)",
@@ -216,6 +218,12 @@ static const char *proc_arch[] = { "?(17)", }; +#ifdef CONFIG_CPU_V7M +static int __get_cpu_architecture (void ) +{ +return CPU_ARCH_ARMv7M; +} +#else static int __get_cpu_architecture (void ) {int cpu_arch;
@@ -248,6 +256,7 @@ static int __get_cpu_architecture(void) return cpu_arch; } +#endif int __pure cpu_architecture (void ) {
@@ -293,7 +302,9 @@ static void __init cacheid_init(void) {unsigned int arch =cpu_architecture (); -if (arch >= CPU_ARCH_ARMv6) { +if (arch == CPU_ARCH_ARMv7M) { + cacheid =0 ; + }else if (arch >= CPU_ARCH_ARMv6) {unsigned int cachetype =read_cpuid_cachetype ();if ((cachetype & (7 <<29 )) ==4 <<29 ) {/* ARMv7 register format */
@@ -375,6 +386,7 @@ static void __init feat_v6_fixup(void)*/ void cpu_init (void ) { +#ifndef CONFIG_CPU_V7M unsigned int cpu =smp_processor_id ();struct stack *stk = &stacks[cpu];
@@ -425,6 +437,7 @@ void cpu_init(void) "I" (offsetof(struct stack, und[0])), PLC (PSR_F_BIT | PSR_I_BIT | SVC_MODE) : "r14"); +#endif }int __cpu_logical_map[NR_CPUS ];
arch/arm/kernel/traps.c +8 -0
@@ -819,6 +819,7 @@ static void __init kuser_get_tls_init(unsigned long vectors)void __init early_trap_init (void *vectors_base) { +#ifndef CONFIG_CPU_V7M unsigned long vectors = (unsigned long )vectors_base;extern char __stubs_start[], __stubs_end[];extern char __vectors_start[], __vectors_end[];
@@ -850,4 +851,11 @@ void __init early_trap_init(void *vectors_base)flush_icache_range (vectors, vectors +PAGE_SIZE );modify_domain (DOMAIN_USER ,DOMAIN_CLIENT ); +#else /* ifndef CONFIG_CPU_V7M */ +/* +* on V7-M there is no need to copy the vector table to a dedicated +* memory area. The address is configurable and so a table in the kernel +* image can be used. +*/ +#endif }
arch/arm/mm/cache-nop.S new file +50 -0
50 lines not on this page · raw message
arch/arm/mm/nommu.c +7 -0
@@ -20,12 +20,19 @@void __init arm_mm_memblock_reserve (void ) { +#ifndef CONFIG_CPU_V7M /* * Register the exception vector page. * some architectures which the DRAM is the exception vector to trap, * alloc_page breaks with error, although it is not NULL, but "0." */ memblock_reserve (CONFIG_VECTORS_BASE ,PAGE_SIZE ); +#else /* ifndef CONFIG_CPU_V7M */ +/* +* There is no dedicated vector page on V7-M. So nothing needs to be +* reserved here. +*/ +#endif }void __init sanity_check_meminfo (void )
arch/arm/mm/proc-v7m.S new file +157 -0
157 lines not on this page · raw message
Signature · 1 line
1.8.2.rc3
PATCH v11 1/3 ARM: Add base support for ARMv7-M
Quoted 7 lines · Uwe Kleine-K?nig
From: Catalin Marinas <[email protected]>
This patch adds the base support for the ARMv7-M architecture. It consists of the corresponding
arch/arm/mm/files and various #ifdef's around the kernel. Exception handling is implemented by a subsequent patch.
Quoted 7 lines
[ukleinek: squash in some changes originating from commit
b5717ba (Cortex-M3: Add support for the Microcontroller Prototyping System)
from the v2.6.33-arm1 patch stack, port to post 3.6, drop zImage support, drop reorganisation of
pt_regs, assertCONFIG_V7Mdoesn't leak into installed headers and a few cosmetic changes]
ITYM CONFIG_CPU_V7M. Apart from that, it looks fine.
PATCH v11 1/3 ARM: Add base support for ARMv7-M
In reply to Uwe Kleine-Königarch/arm/mm/proc-v7m.S line 147
Quoted 9 lines · Uwe Kleine-K?nig
arch/arm/mm/proc-v7m.S new file +9
-0+__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 + b __v7m_setup @ proc_info_list.__cpu_flush + .long cpu_arch_name + .long cpu_elf_name + .long HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_IDIVT
Mainline is detecting HWCAP_IDIVT for v7 processors so you should be able to leave that part out.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v11 1/3 ARM: Add base support for ARMv7-M
Hello Stephen,
Quoted 13 lines · Stephen Boyd
arch/arm/mm/proc-v7m.S line 147
Quoted 9 lines · Uwe Kleine-K?nig
arch/arm/mm/proc-v7m.S new file +9
-0+__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 + b __v7m_setup @ proc_info_list.__cpu_flush + .long cpu_arch_name + .long cpu_elf_name + .long HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_IDIVTMainline is detecting
HWCAP_IDIVTfor v7 processors so you should be able to leave that part out.
I cannot confirm that. If I drop HWCAP_IDIVT here, /proc/cpuinfo changes as follows:
-Features : half thumb fastmult idivt
+Features : half thumb fastmult
Maybe I missed to call the respective function to autodetect that? I don't consider that an issue big enough to justify another round for this series. For me letting v11 hit mainline and fix detection later is ok. I'll take a note to look into this, but if you want to come up with a patch, don't hesitate :-)
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH v11 1/3 ARM: Add base support for ARMv7-M
Quoted 21 lines · Uwe Kleine-K?nig
Hello Stephen,
Quoted 12 lines · Stephen Boyd
arch/arm/mm/proc-v7m.S line 147
Quoted 9 lines · Uwe Kleine-K?nig
arch/arm/mm/proc-v7m.S new file +9
-0+__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 + b __v7m_setup @ proc_info_list.__cpu_flush + .long cpu_arch_name + .long cpu_elf_name + .long HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_IDIVTMainline is detecting
HWCAP_IDIVTfor v7 processors so you should be able to leave that part out.I cannot confirm that. If I drop
HWCAP_IDIVThere,/proc/cpuinfochanges as follows:(quoted diff) +1
-1-Features : half thumb fastmult idivt +Features : half thumb fastmult
Quoted 5 lines
Maybe I missed to call the respective function to autodetect that? I don't consider that an issue big enough to justify another round for this series. For me letting v11 hit mainline and fix detection later is ok. I'll take a note to look into this, but if you want to come up with a patch, don't hesitate :-)
The patch that introduces the detection is 8164f7af88d9ad3a757bd14f634b23997ee77f6b. Sorry I should have read this patch more closely. I seem to recall that M profile doesn't have the CPUID registers in a coprocessor so it won't work. Probably easier to leave it as is for now.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v11 2/3 ARM: ARMv7-M: Add support for exception handling
In reply to Uwe Kleine-KönigThis patch implements the exception handling for the ARMv7-M architecture (pretty different from the A or R profiles).
It bases on work done earlier by Catalin for 2.6.33 but was nearly completely rewritten to use a pt_regs layout compatible to the A profile.
---
Notes:
Changes since v9, sent with Message-id:1363901310-9474-3-git-send-email-u.kleine-koenig at pengutronix.de:
- s/V7M_xPSR_FPALIGN/V7M_xPSR_FRAMEPTRALIGN/
- expand comments
- drop XXX item about clrex
- make 0x1ff a #define
- followup changes for changes in previous
Changes since v10, sent with Message-id:1364381692-7955-3-git-send-email-u.kleine-koenig at pengutronix.de:
- Adaptions for changes in the irq-nvic driver
arch/arm/kernel/entry-common.S | 4 ++ arch/arm/kernel/entry-header.S | 124 +++++++++++++++++++++++++++++++++++ arch/arm/kernel/entry-v7m.S | 143 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 271 insertions(+) create mode 100644 arch/arm/kernel/entry-v7m.S
arch/arm/kernel/entry-common.S +4 -0
@@ -339,6 +339,9 @@ ENDPROC(ftrace_stub) .align 5 ENTRY(vector_swi) +#ifdef CONFIG_CPU_V7M + v7m_exception_entry +#else sub sp, sp, #S_FRAME_SIZE stmia sp, {r0 - r12} @ Calling r0 - r12 ARM( add r8, sp, #S_PC )
@@ -349,6 +352,7 @@ ENTRY(vector_swi) str lr, [sp, #S_PC] @ Save calling PC str r8, [sp, #S_PSR] @ Save CPSR str r0, [sp, #S_OLD_R0] @ Save OLD_R0 +#endif zero_fp /*
arch/arm/kernel/entry-header.S +124 -0
148 lines not on this page · raw message
arch/arm/kernel/entry-v7m.S new file +143 -0
143 lines not on this page · raw message
Signature · 1 line
1.8.2.rc3
PATCH v11 3/3 ARM: ARMv7-M: Allow the building of new kernel port
In reply to Uwe Kleine-KönigThis patch modifies the required Kconfig and Makefile files to allow the building of kernel for Cortex-M3.
---
Notes:
Changes since v9, sent with Message-id:1363901310-9474-4-git-send-email-u.kleine-koenig at pengutronix.de:
- drop selecting CPU_CACHE_VIPT
No changes since v10, sent with Message-id:1364381692-7955-4-git-send-email-u.kleine-koenig at pengutronix.de
arch/arm/Kconfig | 4 ++-- arch/arm/Kconfig-nommu | 2 +- arch/arm/Makefile | 1 + arch/arm/kernel/Makefile | 8 +++++++- arch/arm/mm/Kconfig | 21 ++++++++++++++++++++- arch/arm/mm/Makefile | 2 ++ 6 files changed, 33 insertions(+), 5 deletions(-)
arch/arm/Kconfig +2 -2
@@ -9,7 +9,7 @@ config ARM select BUILDTIME_EXTABLE_SORT if MMU select CPU_PM if (SUSPEND || CPU_IDLE) select DCACHE_WORD_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && !CPU_BIG_ENDIAN && MMU - select GENERIC_ATOMIC64 if (CPU_V6 || !CPU_32v6K || !AEABI) + select GENERIC_ATOMIC64 if (CPU_V7M || CPU_V6 || !CPU_32v6K || !AEABI) select GENERIC_CLOCKEVENTS_BROADCAST if SMP select GENERIC_IRQ_PROBE select GENERIC_IRQ_SHOW
@@ -1685,7 +1685,7 @@ config SCHED_HRTICK config THUMB2_KERNEL bool "Compile the kernel in Thumb-2 mode" if !CPU_THUMBONLY - depends on CPU_V7 && !CPU_V6 && !CPU_V6K + depends on (CPU_V7 || CPU_V7M) && !CPU_V6 && !CPU_V6K default y if CPU_THUMBONLY select AEABI select ARM_ASM_UNIFIED
arch/arm/Kconfig-nommu +1 -1
@@ -28,7 +28,7 @@ config FLASH_SIZE config PROCESSOR_ID hex 'Hard wire the processor ID' default 0x00007700 - depends on !CPU_CP15 + depends on !(CPU_CP15 || CPU_V7M) help If processor has no CP15 register, this processor ID is used instead of the auto-probing which utilizes the register.
arch/arm/Makefile +1 -0
@@ -59,6 +59,7 @@ comma = , # Note that GCC does not numerically define an architecture version # macro, but instead defines a whole series of macros which makes # testing for a specific architecture or later rather impossible. +arch-$(CONFIG_CPU_32v7M) :=-D__LINUX_ARM_ARCH__=7 -march=armv7-m -Wa,-march=armv7-m arch-$(CONFIG_CPU_32v7) :=-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a) arch-$(CONFIG_CPU_32v6) :=-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6) # Only override the compiler option if ARMv6. The ARMv6K extensions are
arch/arm/kernel/Makefile +7 -1
@@ -15,7 +15,7 @@ CFLAGS_REMOVE_return_address.o = -pg # Object file lists. -obj-y := elf.o entry-armv.o entry-common.o irq.o opcodes.o \ +obj-y := elf.o entry-common.o irq.o opcodes.o \ process.o ptrace.o return_address.o sched_clock.o \ setup.o signal.o stacktrace.o sys_arm.o time.o traps.o
@@ -23,6 +23,12 @@ obj-$(CONFIG_ATAGS) += atags_parse.o obj-$(CONFIG_ATAGS_PROC) += atags_proc.o obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += atags_compat.o +ifeq ($(CONFIG_CPU_V7M),y) +obj-y += entry-v7m.o +else +obj-y += entry-armv.o +endif + obj-$(CONFIG_OC_ETM) += etm.o obj-$(CONFIG_CPU_IDLE) += cpuidle.o obj-$(CONFIG_ISA_DMA_API) += dma.o
arch/arm/mm/Kconfig +20 -1
@@ -397,6 +397,15 @@ config CPU_V7 select CPU_PABRT_V7 select CPU_TLB_V7 if MMU +# ARMv7M +config CPU_V7M + bool + select CPU_32v7M + select CPU_ABRT_NOMMU + select CPU_CACHE_NOP + select CPU_PABRT_LEGACY + select CPU_THUMBONLY + config CPU_THUMBONLY bool # There are no CPUs available with MMU that don't implement an ARM ISA:
@@ -441,6 +450,9 @@ config CPU_32v6K config CPU_32v7 bool +config CPU_32v7M + bool + # The abort model config CPU_ABRT_NOMMU bool
@@ -494,6 +506,9 @@ config CPU_CACHE_V6 config CPU_CACHE_V7 bool +config CPU_CACHE_NOP + bool + config CPU_CACHE_VIVT bool
@@ -616,7 +631,11 @@ config ARCH_DMA_ADDR_T_64BIT config ARM_THUMB bool "Support Thumb user binaries" if !CPU_THUMBONLY - depends on CPU_ARM720T || CPU_ARM740T || CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM940T || CPU_ARM946E || CPU_ARM1020 || CPU_ARM1020E || CPU_ARM1022 || CPU_ARM1026 || CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_V6 || CPU_V6K || CPU_V7 || CPU_FEROCEON + depends on CPU_ARM720T || CPU_ARM740T || CPU_ARM920T || CPU_ARM922T || \ + CPU_ARM925T || CPU_ARM926T || CPU_ARM940T || CPU_ARM946E || \ + CPU_ARM1020 || CPU_ARM1020E || CPU_ARM1022 || CPU_ARM1026 || \ + CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_V6 || CPU_V6K || \ + CPU_V7 || CPU_FEROCEON || CPU_V7M default y help Say Y if you want to include kernel support for running user space
arch/arm/mm/Makefile +2 -0
@@ -40,6 +40,7 @@ obj-$(CONFIG_CPU_CACHE_V4WB) += cache-v4wb.o 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 AFLAGS_cache-v6.o :=-Wa,-march=armv6 AFLAGS_cache-v7.o :=-Wa,-march=armv7-a
@@ -88,6 +89,7 @@ obj-$(CONFIG_CPU_FEROCEON) += proc-feroceon.o obj-$(CONFIG_CPU_V6) += proc-v6.o obj-$(CONFIG_CPU_V6K) += proc-v6.o obj-$(CONFIG_CPU_V7) += proc-v7.o +obj-$(CONFIG_CPU_V7M) += proc-v7m.o AFLAGS_proc-v6.o :=-Wa,-march=armv6 AFLAGS_proc-v7.o :=-Wa,-march=armv7-a
Signature · 1 line
1.8.2.rc3
v11 cover Another round of ARMv7-M patches
In reply to Uwe Kleine-KönigHi Uwe,
Nice! I'd love to see these in mainline and they look good now...
Quoted 4 lines · Uwe Kleine-K?nig
Hello,
the changes since v10 are small:
Quoted 8 lines
- Jonny noticed an inconsitency in
arch/arm/mm/proc-v7m.S
- changes to account for review comments to my nvic driver (v3 just sent out)I put these three patches in my for-next branch so they should make it into the next next. The tree merges fine into current Linus' master and next-20130417.
The only comment I have left is that I'd really like the BASEADDRESS_V7M_SCB namespaced like the rest of the V7M defines
With that said, please feel free to add for the series:
Jonny
Quoted 41 lines
Russell, what are your thoughts about the series? Would you take it for v3.10? Or v3.11?
Catalin Marinas (1):
ARM: Add base support for ARMv7-MUwe Kleine-K?nig (2):
ARM: ARMv7-M: Add support for exception handling
ARM: ARMv7-M: Allow the building of new kernel portarch/arm/Kconfig | 4 +- arch/arm/Kconfig-nommu | 2 +- arch/arm/Makefile | 1 + arch/arm/include/asm/assembler.h | 17 +++- arch/arm/include/asm/cputype.h | 12 ++- arch/arm/include/asm/glue-cache.h | 27 +++++++ arch/arm/include/asm/glue-df.h | 8 ++ arch/arm/include/asm/glue-proc.h | 9 +++ arch/arm/include/asm/irqflags.h | 22 ++++-- arch/arm/include/asm/ptrace.h | 4 + arch/arm/include/asm/system_info.h | 1 + arch/arm/include/asm/v7m.h | 44 +++++++++++ arch/arm/include/uapi/asm/ptrace.h | 35 +++++++-- arch/arm/kernel/Makefile | 8 +- arch/arm/kernel/entry-common.S | 4 + arch/arm/kernel/entry-header.S | 124 +++++++++++++++++++++++++++++ arch/arm/kernel/entry-v7m.S | 143 +++++++++++++++++++++++++++++++++ arch/arm/kernel/head-nommu.S | 10 ++- arch/arm/kernel/setup.c | 17 +++- arch/arm/kernel/traps.c | 8 ++ arch/arm/mm/Kconfig | 21 ++++- arch/arm/mm/Makefile | 2 + arch/arm/mm/cache-nop.S | 50 ++++++++++++ arch/arm/mm/nommu.c | 7 ++ arch/arm/mm/proc-v7m.S | 157 +++++++++++++++++++++++++++++++++++++ 25 files changed, 711 insertions(+), 26 deletions(-)create mode 100644
arch/arm/include/asm/v7m.h
create mode 100644arch/arm/kernel/entry-v7m.S
create mode 100644arch/arm/mm/cache-nop.S
create mode 100644arch/arm/mm/proc-v7m.S
v11 cover Another round of ARMv7-M patches
Hello,
Quoted 2 lines · Jonathan Austin
The only comment I have left is that I'd really like the
BASEADDRESS_V7M_SCBnamespaced like the rest of the V7M defines
The idea behind this naming is that V7M_SCB_BASEADDRESS is in the same namespace as V7M_SCB_CPUID so I opened a new namespace for base addresses. Don't you like it only because it's new? Do others have thoughts here?
Quoted 4 lines
With that said, please feel free to add for the series:
Reviewed-by Jonathan Austin <[email protected]>Tested-by Jonathan Austin <[email protected]
Thanks
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
v11 cover Another round of ARMv7-M patches
Hi,
Quoted 6 lines · Uwe Kleine-K?nig
Hello,
Quoted 2 lines · Jonathan Austin
The only comment I have left is that I'd really like the
BASEADDRESS_V7M_SCBnamespaced like the rest of the V7M definesThe idea behind this naming is that
V7M_SCB_BASEADDRESSis in the same
Do you mean is *not* in?
Quoted 2 lines
namespace as
V7M_SCB_CPUIDso I opened a new namespace for base addresses. Don't you like it only because it's new?
I think becausereadl(V7M_SCB_BASEADDRESS + V7M_SCB_CPUID)
reads more cleanly than
readl(BASEADDRESS_V7M_SCB + V7M_SCB_CPUID)
But it isn't a big enough issue to delay merging these - more a preference/style issue. As you ask: does anyone else have any thoughts?
Jonny
Quoted 10 lines
Do others have
thoughts here?Quoted 4 lines
With that said, please feel free to add for the series:
Reviewed-by Jonathan Austin <[email protected]>Tested-by Jonathan Austin <[email protected]Thanks
Uwe
v11 cover Another round of ARMv7-M patches
In reply to Uwe Kleine-KönigQuoted 2 lines · Uwe Kleine-K?nig
Russell, what are your thoughts about the series? Would you take it for v3.10? Or v3.11?
On the whole, I think I'm fairly happy with this. Has it been in -next at all yet?
v11 cover Another round of ARMv7-M patches
Hello Russell,
Quoted 6 lines · Russell King - ARM Linux
Quoted 2 lines · Uwe Kleine-K?nig
Russell, what are your thoughts about the series? Would you take it for v3.10? Or v3.11?
On the whole, I think I'm fairly happy with this. Has it been in -next at all yet?
An earlier version was, but I guess that doesn't count. Still it makes me expect not to break too much :-)
This version (based on a commit in your devel-stable) (+ a fix for the typo you pointed out) should be picked up for the next next.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |