Patches for 2.6.35
Subsystems (2)
v2 cover Patches for 2.6.35
These are a set of patches I'd like to get merged in 2.6.35 (during the -rc) period.
The first one was posted some time ago but deferred because of other conflicting patch (the 16-way PL310).
Some of the other patches are necessary fixes plus a few trivial ones.
Thanks.
Catalin Marinas (8):
ARM: Improve the L2 cache performance when PL310 is used
ARM: Align machine_desc.phys_io to a 1MB section
ARM: Avoid the CONSISTENT_DMA_SIZE warning on noMMU builds
ARM: The v6_dma_inv_range() function must preserve data on SMP
ARM: Add a config option for the ARM11MPCore DMA cache maintenance workaround
ARM: Add support for the MOVW/MOVT relocations in Thumb-2
ARM: Remove dummy loads from the original relocation address
ARM: Do not compile the Thumb-2 module relocations on an ARM kernel
arch/arm/include/asm/elf.h | 2 + arch/arm/kernel/head.S | 2 + arch/arm/kernel/module.c | 34 +++++++++++++++++++++++ arch/arm/mm/Kconfig | 26 ++++++++++++++++++ arch/arm/mm/cache-l2x0.c | 65 ++++++++++++++++++++++++++++++-------------- arch/arm/mm/cache-v6.S | 18 +++++++++--- arch/arm/mm/dma-mapping.c | 2 + 7 files changed, 124 insertions(+), 25 deletions(-)
Signature · 1 line
Catalin
PATCH v2 1/8 ARM: Improve the L2 cache performance when PL310 is used
With this L2 cache controller, the cache maintenance by PA and sync operations are atomic and do not require a "wait" loop or spinlocks. This patch conditionally defines the cache_wait() function and locking primitives (rather than duplicating the functions or file).
Since L2x0 cache controllers do not work with ARMv7 CPUs, the patch automatically enables CACHE_PL310 when CPU_V7 is defined.
--- arch/arm/mm/Kconfig | 7 +++++ arch/arm/mm/cache-l2x0.c | 65 +++++++++++++++++++++++++++++++--------------- 2 files changed, 51 insertions(+), 21 deletions(-)
arch/arm/mm/Kconfig +7 -0
@@ -770,6 +770,13 @@ config CACHE_L2X0 help This option enables the L2x0 PrimeCell. +config CACHE_PL310 + bool + depends on CACHE_L2X0 + default y if CPU_V7 + help + This option enables support for the PL310 cache controller. + config CACHE_TAUROS2 bool "Enable the Tauros2 L2 cache controller" depends on (ARCH_DOVE || ARCH_MMP)
arch/arm/mm/cache-l2x0.c +44 -21
153 lines not on this page · raw message
PATCH v2 2/8 ARM: Align machine_desc.phys_io to a 1MB section
In reply to Catalin MarinasPlatforms like RealView don't pass a section-aligned pointer via the machine_desc structure. This patch aligns the pointer in the __create_page_tables function. Reported by Tony Thompson.
--- arch/arm/kernel/head.S | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/kernel/head.S +2 -0
@@ -302,6 +302,8 @@ __create_page_tables: movhi r3, #0x0800 add r6, r0, r3 ldr r3, [r8, #MACHINFO_PHYSIO] + mov r3, r3, lsr #20 @ 1MB-aligned address + mov r3, r3, lsl #20 orr r3, r3, r7 1: str r3, [r0], #4 add r3, r3, #1 << 20
PATCH v2 3/8 ARM: Avoid the CONSISTENT_DMA_SIZE warning on noMMU builds
In reply to Catalin MarinasThis macro is not defined when !CONFIG_MMU.
--- arch/arm/mm/dma-mapping.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/mm/dma-mapping.c +2 -0
@@ -25,6 +25,7 @@#include <asm/sizes.h> /* Sanity check size */ +#ifdef CONFIG_MMU #if (CONSISTENT_DMA_SIZE %SZ_2M )#error "CONSISTENT_DMA_SIZE must be multiple of 2MiB"#endif
@@ -32,6 +33,7 @@#define CONSISTENT_OFFSET (x) (((unsigned long)(x) - CONSISTENT_BASE) >> PAGE_SHIFT)#define CONSISTENT_PTE_INDEX (x) (((unsigned long)(x) - CONSISTENT_BASE) >> PGDIR_SHIFT)#define NUM_CONSISTENT_PTES (CONSISTENT_DMA_SIZE >> PGDIR_SHIFT) +#endif static u64 get_coherent_dma_mask (struct device *dev) {
PATCH v2 4/8 ARM: The v6_dma_inv_range() function must preserve data on SMP
In reply to Catalin MarinasA recent patch for DMA cache maintenance on ARM11MPCore added a write for ownership trick to the v6_dma_inv_range() function. Such operation destroys data already present in the buffer. However, this function is used with with dma_sync_single_for_device() which is supposed to preserve the existing data transfered into the buffer. This patch adds a combination of read/write for ownership to preserve the original data.
--- arch/arm/mm/cache-v6.S | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
arch/arm/mm/cache-v6.S +2 -1
@@ -212,7 +212,8 @@ v6_dma_inv_range: #endif 1: #ifdef CONFIG_SMP - str r0, [r0] @ write for ownership + ldr r2, [r0] @ read for ownership + str r2, [r0] @ write for ownership #endif #ifdef HARVARD_CACHE mcr p15, 0, r0, c7, c6, 1 @ invalidate D line
PATCH v2 5/8 ARM: Add a config option for the ARM11MPCore DMA cache maintenance workaround
In reply to Catalin MarinasCommit f4d6477f introduced a workaround for the lack of hardware broadcasting of the cache maintenance operations on ARM11MPCore. However, the workaround is only valid on CPUs that do not do speculative loads into the D-cache.
This patch adds a Kconfig option with the corresponding help to make the above clear. When the DMA_CACHE_RWFO option is disabled, the kernel behaviour is that prior to the f4d6477f commit. This also allows ARMv6 UP processors with speculative loads to work correctly.
For other processors, a different workaround may be needed.
--- arch/arm/mm/Kconfig | 19 +++++++++++++++++++ arch/arm/mm/cache-v6.S | 15 ++++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-)
arch/arm/mm/Kconfig +19 -0
@@ -735,6 +735,25 @@ config NEEDS_SYSCALL_FOR_CMPXCHG Forget about fast user space cmpxchg support. It is just not possible. +config DMA_CACHE_RWFO + bool "Enable read/write for ownership DMA cache maintenance" + depends on CPU_V6 && SMP + default y + help + The Snoop Control Unit on ARM11MPCore does not detect the + cache maintenance operations and the dma_{map,unmap}_area() + functions may leave stale cache entries on other CPUs. By + enabling this option, Read or Write For Ownership in the ARMv6 + DMA cache maintenance functions is performed. These LDR/STR + instructions change the cache line state to shared or modified + so that the cache operation has the desired effect. + + Note that the workaround is only valid on processors that do + not perform speculative loads into the D-cache. For such + processors, if cache maintenance operations are not broadcast + in hardware, other workarounds are needed (e.g. cache + maintenance broadcasting in software via FIQ). + config OUTER_CACHE bool
arch/arm/mm/cache-v6.S +12 -3
@@ -211,7 +211,7 @@ v6_dma_inv_range: mcrne p15, 0, r1, c7, c15, 1 @ clean & invalidate unified line #endif 1: -#ifdef CONFIG_SMP +#ifdef CONFIG_DMA_CACHE_RWFO ldr r2, [r0] @ read for ownership str r2, [r0] @ write for ownership #endif
@@ -235,7 +235,7 @@ v6_dma_inv_range: v6_dma_clean_range: bic r0, r0, #D_CACHE_LINE_SIZE - 1 1: -#ifdef CONFIG_SMP +#ifdef CONFIG_DMA_CACHE_RWFO ldr r2, [r0] @ read for ownership #endif #ifdef HARVARD_CACHE
@@ -258,7 +258,7 @@ v6_dma_clean_range: ENTRY(v6_dma_flush_range) bic r0, r0, #D_CACHE_LINE_SIZE - 1 1: -#ifdef CONFIG_SMP +#ifdef CONFIG_DMA_CACHE_RWFO ldr r2, [r0] @ read for ownership str r2, [r0] @ write for ownership #endif
@@ -284,9 +284,13 @@ ENTRY(v6_dma_map_area) add r1, r1, r0 teq r2, #DMA_FROM_DEVICE beq v6_dma_inv_range +#ifndef CONFIG_DMA_CACHE_RWFO + b v6_dma_clean_range +#else teq r2, #DMA_TO_DEVICE beq v6_dma_clean_range b v6_dma_flush_range +#endif ENDPROC(v6_dma_map_area) /*
@@ -296,6 +300,11 @@ ENDPROC(v6_dma_map_area) * - dir - DMA direction */ ENTRY(v6_dma_unmap_area) +#ifndef CONFIG_DMA_CACHE_RWFO + add r1, r1, r0 + teq r2, #DMA_TO_DEVICE + bne v6_dma_inv_range +#endif mov pc, lr ENDPROC(v6_dma_unmap_area)
PATCH v2 6/8 ARM: Add support for the MOVW/MOVT relocations in Thumb-2
In reply to Catalin MarinasThe patch adds handling case for the R_ARM_THM_MOVW_ABS_NC and R_ARM_THM_MOVT_ABS relocations in arch/arm/kernel/module.c. Such relocations may appear in Thumb-2 compiled kernel modules.
--- arch/arm/include/asm/elf.h | 2 ++ arch/arm/kernel/module.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 0 deletions(-)
arch/arm/include/asm/elf.h +2 -0
@@ -59,6 +59,8 @@ typedef struct user_fp elf_fpregset_t;#define R_ARM_THM_CALL 10#define R_ARM_THM_JUMP24 30 +#define R_ARM_THM_MOVW_ABS_NC 47 +#define R_ARM_THM_MOVT_ABS 48/* * These are used to set parameters in the core dumps.
arch/arm/kernel/module.c +32 -0
@@ -237,6 +237,38 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, lower = *(u16 *)(loc +2 );break ; +case R_ARM_THM_MOVW_ABS_NC : +case R_ARM_THM_MOVT_ABS : + upper = *(u16 *)loc; + lower = *(u16 *)(loc +2 ); + +/* +* MOVT/MOVW instructions encoding in Thumb-2: +* +* i = upper[10] +* imm4 = upper[3:0] +* imm3 = lower[14:12] +* imm8 = lower[7:0] +* +* imm16 = imm4:i:imm3:imm8 +*/ + offset = ((upper &0x000f ) <<12 ) | + ((upper &0x0400 ) <<1 ) | + ((lower &0x7000 ) >>4 ) | (lower &0x00ff ); + offset = (offset ^0x8000 ) -0x8000 ; + offset += sym->st_value; + +if (ELF32_R_TYPE (rel->r_info) ==R_ARM_THM_MOVT_ABS ) + offset >>=16 ; + + *(u16 *)loc = (u16)((upper &0xfbf0 ) | + ((offset &0xf000 ) >>12 ) | + ((offset &0x0800 ) >>1 )); + *(u16 *)(loc +2 ) = (u16)((lower &0x8f00 ) | + ((offset &0x0700 ) <<4 ) | + (offset &0x00ff )); +break ; +default :printk (KERN_ERR "%s: unknown relocation: %u\n" , module->name,ELF32_R_TYPE (rel->r_info));
PATCH v2 7/8 ARM: Remove dummy loads from the original relocation address
In reply to Catalin MarinasReading back the upper and lower values in the R_ARM_THM_CALL and R_ARM_THM_JUMP24 case was introduced by a previous commit but they are not needed.
--- arch/arm/kernel/module.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
arch/arm/kernel/module.c +0 -2
@@ -233,8 +233,6 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, *(u16 *)(loc +2 ) = (u16)((lower &0xd000 ) | (j1 <<13 ) | (j2 <<11 ) | ((offset >>1 ) &0x07ff )); - upper = *(u16 *)loc; - lower = *(u16 *)(loc +2 );break ;case R_ARM_THM_MOVW_ABS_NC :
PATCH v2 8/8 ARM: Do not compile the Thumb-2 module relocations on an ARM kernel
In reply to Catalin Marinas--- arch/arm/kernel/module.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
arch/arm/kernel/module.c +4 -0
@@ -102,7 +102,9 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,unsigned long loc;Elf32_Sym *sym;s32 offset; +#ifdef CONFIG_THUMB2_KERNEL u32 upper, lower, sign, j1, j2; +#endif offset =ELF32_R_SYM (rel->r_info);if (offset <0 || offset > (symsec->sh_size /sizeof (Elf32_Sym))) {
@@ -185,6 +187,7 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, (offset &0x0fff );break ; +#ifdef CONFIG_THUMB2_KERNEL case R_ARM_THM_CALL :case R_ARM_THM_JUMP24 : upper = *(u16 *)loc;
@@ -266,6 +269,7 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, ((offset &0x0700 ) <<4 ) | (offset & 0x00ff));break ; +#endif default : printk(KERN_ERR "%s: unknown relocation: %u\n",