aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-25 13:06:20 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-25 13:06:20 -0400
commit462a2b58b9860bc950b2d06d356de8fbfe1410fa (patch)
tree5ad187e9ca1bdaa62d62b8709992b0b2cf5313c8
parent4dd9aa894812af8fc8a314817374859910371804 (diff)
parent7bb66f6e6eecdd8e10ed3a63bd28c1e9105adc79 (diff)
Merge tag 'arc-v3.10-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc
Pull ARC fixes from Vineet Gupta: - Fallouts/wreckage of Cache Flush optimizations / aliasing dcache support - Fix for an interesting bug where piped input to grep was getting mysteriously clobbered * tag 'arc-v3.10-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc: ARC: lazy dcache flush broke gdb in non-aliasing configs ARC: Use enough bits for determining page's cache color ARC: Brown paper bag bug in macro for checking cache color ARC: copy_(to|from)_user() to honor usermode-access permissions ARC: [mm] Prevent stray dcache lines after__sync_icache_dcach() ARC: [TB10x] Remove redundant abilis,simple-pinctrl mechanism
-rw-r--r--arch/arc/boot/dts/abilis_tb100_dvk.dts2
-rw-r--r--arch/arc/boot/dts/abilis_tb101_dvk.dts2
-rw-r--r--arch/arc/boot/dts/abilis_tb10x.dtsi6
-rw-r--r--arch/arc/include/asm/cacheflush.h6
-rw-r--r--arch/arc/include/asm/page.h9
-rw-r--r--arch/arc/include/asm/pgtable.h26
-rw-r--r--arch/arc/include/asm/tlb.h2
-rw-r--r--arch/arc/mm/cache_arc700.c23
-rw-r--r--arch/arc/mm/tlb.c3
-rw-r--r--arch/arc/mm/tlbex.S6
-rw-r--r--arch/arc/plat-tb10x/tb10x.c26
11 files changed, 41 insertions, 70 deletions
diff --git a/arch/arc/boot/dts/abilis_tb100_dvk.dts b/arch/arc/boot/dts/abilis_tb100_dvk.dts
index c0fd3623c393..0fa0d4abe795 100644
--- a/arch/arc/boot/dts/abilis_tb100_dvk.dts
+++ b/arch/arc/boot/dts/abilis_tb100_dvk.dts
@@ -37,7 +37,7 @@
37 37
38 soc100 { 38 soc100 {
39 uart@FF100000 { 39 uart@FF100000 {
40 pinctrl-names = "abilis,simple-default"; 40 pinctrl-names = "default";
41 pinctrl-0 = <&pctl_uart0>; 41 pinctrl-0 = <&pctl_uart0>;
42 }; 42 };
43 ethernet@FE100000 { 43 ethernet@FE100000 {
diff --git a/arch/arc/boot/dts/abilis_tb101_dvk.dts b/arch/arc/boot/dts/abilis_tb101_dvk.dts
index 6f8c381f6268..a4d80ce283ae 100644
--- a/arch/arc/boot/dts/abilis_tb101_dvk.dts
+++ b/arch/arc/boot/dts/abilis_tb101_dvk.dts
@@ -37,7 +37,7 @@
37 37
38 soc100 { 38 soc100 {
39 uart@FF100000 { 39 uart@FF100000 {
40 pinctrl-names = "abilis,simple-default"; 40 pinctrl-names = "default";
41 pinctrl-0 = <&pctl_uart0>; 41 pinctrl-0 = <&pctl_uart0>;
42 }; 42 };
43 ethernet@FE100000 { 43 ethernet@FE100000 {
diff --git a/arch/arc/boot/dts/abilis_tb10x.dtsi b/arch/arc/boot/dts/abilis_tb10x.dtsi
index a6139fc5aaa3..b97e3051ba4b 100644
--- a/arch/arc/boot/dts/abilis_tb10x.dtsi
+++ b/arch/arc/boot/dts/abilis_tb10x.dtsi
@@ -88,8 +88,7 @@
88 }; 88 };
89 89
90 uart@FF100000 { 90 uart@FF100000 {
91 compatible = "snps,dw-apb-uart", 91 compatible = "snps,dw-apb-uart";
92 "abilis,simple-pinctrl";
93 reg = <0xFF100000 0x100>; 92 reg = <0xFF100000 0x100>;
94 clock-frequency = <166666666>; 93 clock-frequency = <166666666>;
95 interrupts = <25 1>; 94 interrupts = <25 1>;
@@ -184,8 +183,7 @@
184 #address-cells = <1>; 183 #address-cells = <1>;
185 #size-cells = <0>; 184 #size-cells = <0>;
186 cell-index = <1>; 185 cell-index = <1>;
187 compatible = "abilis,tb100-spi", 186 compatible = "abilis,tb100-spi";
188 "abilis,simple-pinctrl";
189 num-cs = <2>; 187 num-cs = <2>;
190 reg = <0xFE011000 0x20>; 188 reg = <0xFE011000 0x20>;
191 interrupt-parent = <&tb10x_ictl>; 189 interrupt-parent = <&tb10x_ictl>;
diff --git a/arch/arc/include/asm/cacheflush.h b/arch/arc/include/asm/cacheflush.h
index 9f841af41092..ef62682e8d95 100644
--- a/arch/arc/include/asm/cacheflush.h
+++ b/arch/arc/include/asm/cacheflush.h
@@ -93,14 +93,16 @@ static inline int cache_is_vipt_aliasing(void)
93#endif 93#endif
94} 94}
95 95
96#define CACHE_COLOR(addr) (((unsigned long)(addr) >> (PAGE_SHIFT)) & 3) 96#define CACHE_COLOR(addr) (((unsigned long)(addr) >> (PAGE_SHIFT)) & 1)
97 97
98/* 98/*
99 * checks if two addresses (after page aligning) index into same cache set 99 * checks if two addresses (after page aligning) index into same cache set
100 */ 100 */
101#define addr_not_cache_congruent(addr1, addr2) \ 101#define addr_not_cache_congruent(addr1, addr2) \
102({ \
102 cache_is_vipt_aliasing() ? \ 103 cache_is_vipt_aliasing() ? \
103 (CACHE_COLOR(addr1) != CACHE_COLOR(addr2)) : 0 \ 104 (CACHE_COLOR(addr1) != CACHE_COLOR(addr2)) : 0; \
105})
104 106
105#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 107#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
106do { \ 108do { \
diff --git a/arch/arc/include/asm/page.h b/arch/arc/include/asm/page.h
index 374a35514116..ab84bf131fe1 100644
--- a/arch/arc/include/asm/page.h
+++ b/arch/arc/include/asm/page.h
@@ -19,13 +19,6 @@
19#define clear_page(paddr) memset((paddr), 0, PAGE_SIZE) 19#define clear_page(paddr) memset((paddr), 0, PAGE_SIZE)
20#define copy_page(to, from) memcpy((to), (from), PAGE_SIZE) 20#define copy_page(to, from) memcpy((to), (from), PAGE_SIZE)
21 21
22#ifndef CONFIG_ARC_CACHE_VIPT_ALIASING
23
24#define clear_user_page(addr, vaddr, pg) clear_page(addr)
25#define copy_user_page(vto, vfrom, vaddr, pg) copy_page(vto, vfrom)
26
27#else /* VIPT aliasing dcache */
28
29struct vm_area_struct; 22struct vm_area_struct;
30struct page; 23struct page;
31 24
@@ -35,8 +28,6 @@ void copy_user_highpage(struct page *to, struct page *from,
35 unsigned long u_vaddr, struct vm_area_struct *vma); 28 unsigned long u_vaddr, struct vm_area_struct *vma);
36void clear_user_page(void *to, unsigned long u_vaddr, struct page *page); 29void clear_user_page(void *to, unsigned long u_vaddr, struct page *page);
37 30
38#endif /* CONFIG_ARC_CACHE_VIPT_ALIASING */
39
40#undef STRICT_MM_TYPECHECKS 31#undef STRICT_MM_TYPECHECKS
41 32
42#ifdef STRICT_MM_TYPECHECKS 33#ifdef STRICT_MM_TYPECHECKS
diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h
index 1cc4720faccb..95b1522212a7 100644
--- a/arch/arc/include/asm/pgtable.h
+++ b/arch/arc/include/asm/pgtable.h
@@ -57,9 +57,9 @@
57 57
58#define _PAGE_ACCESSED (1<<1) /* Page is accessed (S) */ 58#define _PAGE_ACCESSED (1<<1) /* Page is accessed (S) */
59#define _PAGE_CACHEABLE (1<<2) /* Page is cached (H) */ 59#define _PAGE_CACHEABLE (1<<2) /* Page is cached (H) */
60#define _PAGE_EXECUTE (1<<3) /* Page has user execute perm (H) */ 60#define _PAGE_U_EXECUTE (1<<3) /* Page has user execute perm (H) */
61#define _PAGE_WRITE (1<<4) /* Page has user write perm (H) */ 61#define _PAGE_U_WRITE (1<<4) /* Page has user write perm (H) */
62#define _PAGE_READ (1<<5) /* Page has user read perm (H) */ 62#define _PAGE_U_READ (1<<5) /* Page has user read perm (H) */
63#define _PAGE_K_EXECUTE (1<<6) /* Page has kernel execute perm (H) */ 63#define _PAGE_K_EXECUTE (1<<6) /* Page has kernel execute perm (H) */
64#define _PAGE_K_WRITE (1<<7) /* Page has kernel write perm (H) */ 64#define _PAGE_K_WRITE (1<<7) /* Page has kernel write perm (H) */
65#define _PAGE_K_READ (1<<8) /* Page has kernel perm (H) */ 65#define _PAGE_K_READ (1<<8) /* Page has kernel perm (H) */
@@ -72,9 +72,9 @@
72 72
73/* PD1 */ 73/* PD1 */
74#define _PAGE_CACHEABLE (1<<0) /* Page is cached (H) */ 74#define _PAGE_CACHEABLE (1<<0) /* Page is cached (H) */
75#define _PAGE_EXECUTE (1<<1) /* Page has user execute perm (H) */ 75#define _PAGE_U_EXECUTE (1<<1) /* Page has user execute perm (H) */
76#define _PAGE_WRITE (1<<2) /* Page has user write perm (H) */ 76#define _PAGE_U_WRITE (1<<2) /* Page has user write perm (H) */
77#define _PAGE_READ (1<<3) /* Page has user read perm (H) */ 77#define _PAGE_U_READ (1<<3) /* Page has user read perm (H) */
78#define _PAGE_K_EXECUTE (1<<4) /* Page has kernel execute perm (H) */ 78#define _PAGE_K_EXECUTE (1<<4) /* Page has kernel execute perm (H) */
79#define _PAGE_K_WRITE (1<<5) /* Page has kernel write perm (H) */ 79#define _PAGE_K_WRITE (1<<5) /* Page has kernel write perm (H) */
80#define _PAGE_K_READ (1<<6) /* Page has kernel perm (H) */ 80#define _PAGE_K_READ (1<<6) /* Page has kernel perm (H) */
@@ -93,7 +93,8 @@
93#endif 93#endif
94 94
95/* Kernel allowed all permissions for all pages */ 95/* Kernel allowed all permissions for all pages */
96#define _K_PAGE_PERMS (_PAGE_K_EXECUTE | _PAGE_K_WRITE | _PAGE_K_READ) 96#define _K_PAGE_PERMS (_PAGE_K_EXECUTE | _PAGE_K_WRITE | _PAGE_K_READ | \
97 _PAGE_GLOBAL | _PAGE_PRESENT)
97 98
98#ifdef CONFIG_ARC_CACHE_PAGES 99#ifdef CONFIG_ARC_CACHE_PAGES
99#define _PAGE_DEF_CACHEABLE _PAGE_CACHEABLE 100#define _PAGE_DEF_CACHEABLE _PAGE_CACHEABLE
@@ -106,7 +107,11 @@
106 * -by default cached, unless config otherwise 107 * -by default cached, unless config otherwise
107 * -present in memory 108 * -present in memory
108 */ 109 */
109#define ___DEF (_PAGE_PRESENT | _K_PAGE_PERMS | _PAGE_DEF_CACHEABLE) 110#define ___DEF (_PAGE_PRESENT | _PAGE_DEF_CACHEABLE)
111
112#define _PAGE_READ (_PAGE_U_READ | _PAGE_K_READ)
113#define _PAGE_WRITE (_PAGE_U_WRITE | _PAGE_K_WRITE)
114#define _PAGE_EXECUTE (_PAGE_U_EXECUTE | _PAGE_K_EXECUTE)
110 115
111/* Set of bits not changed in pte_modify */ 116/* Set of bits not changed in pte_modify */
112#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED) 117#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED)
@@ -125,11 +130,10 @@
125 * kernel vaddr space - visible in all addr spaces, but kernel mode only 130 * kernel vaddr space - visible in all addr spaces, but kernel mode only
126 * Thus Global, all-kernel-access, no-user-access, cached 131 * Thus Global, all-kernel-access, no-user-access, cached
127 */ 132 */
128#define PAGE_KERNEL __pgprot(___DEF | _PAGE_GLOBAL) 133#define PAGE_KERNEL __pgprot(_K_PAGE_PERMS | _PAGE_DEF_CACHEABLE)
129 134
130/* ioremap */ 135/* ioremap */
131#define PAGE_KERNEL_NO_CACHE __pgprot(_PAGE_PRESENT | _K_PAGE_PERMS | \ 136#define PAGE_KERNEL_NO_CACHE __pgprot(_K_PAGE_PERMS)
132 _PAGE_GLOBAL)
133 137
134/************************************************************************** 138/**************************************************************************
135 * Mapping of vm_flags (Generic VM) to PTE flags (arch specific) 139 * Mapping of vm_flags (Generic VM) to PTE flags (arch specific)
diff --git a/arch/arc/include/asm/tlb.h b/arch/arc/include/asm/tlb.h
index 85b6df839bd7..cb0c708ca665 100644
--- a/arch/arc/include/asm/tlb.h
+++ b/arch/arc/include/asm/tlb.h
@@ -16,7 +16,7 @@
16/* Masks for actual TLB "PD"s */ 16/* Masks for actual TLB "PD"s */
17#define PTE_BITS_IN_PD0 (_PAGE_GLOBAL | _PAGE_PRESENT) 17#define PTE_BITS_IN_PD0 (_PAGE_GLOBAL | _PAGE_PRESENT)
18#define PTE_BITS_IN_PD1 (PAGE_MASK | _PAGE_CACHEABLE | \ 18#define PTE_BITS_IN_PD1 (PAGE_MASK | _PAGE_CACHEABLE | \
19 _PAGE_EXECUTE | _PAGE_WRITE | _PAGE_READ | \ 19 _PAGE_U_EXECUTE | _PAGE_U_WRITE | _PAGE_U_READ | \
20 _PAGE_K_EXECUTE | _PAGE_K_WRITE | _PAGE_K_READ) 20 _PAGE_K_EXECUTE | _PAGE_K_WRITE | _PAGE_K_READ)
21 21
22#ifndef __ASSEMBLY__ 22#ifndef __ASSEMBLY__
diff --git a/arch/arc/mm/cache_arc700.c b/arch/arc/mm/cache_arc700.c
index 2f12bca8aef3..aedce1905441 100644
--- a/arch/arc/mm/cache_arc700.c
+++ b/arch/arc/mm/cache_arc700.c
@@ -610,7 +610,7 @@ void __sync_icache_dcache(unsigned long paddr, unsigned long vaddr, int len)
610 610
611 local_irq_save(flags); 611 local_irq_save(flags);
612 __ic_line_inv_vaddr(paddr, vaddr, len); 612 __ic_line_inv_vaddr(paddr, vaddr, len);
613 __dc_line_op(paddr, vaddr, len, OP_FLUSH); 613 __dc_line_op(paddr, vaddr, len, OP_FLUSH_N_INV);
614 local_irq_restore(flags); 614 local_irq_restore(flags);
615} 615}
616 616
@@ -676,6 +676,17 @@ void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
676 flush_cache_all(); 676 flush_cache_all();
677} 677}
678 678
679void flush_anon_page(struct vm_area_struct *vma, struct page *page,
680 unsigned long u_vaddr)
681{
682 /* TBD: do we really need to clear the kernel mapping */
683 __flush_dcache_page(page_address(page), u_vaddr);
684 __flush_dcache_page(page_address(page), page_address(page));
685
686}
687
688#endif
689
679void copy_user_highpage(struct page *to, struct page *from, 690void copy_user_highpage(struct page *to, struct page *from,
680 unsigned long u_vaddr, struct vm_area_struct *vma) 691 unsigned long u_vaddr, struct vm_area_struct *vma)
681{ 692{
@@ -725,16 +736,6 @@ void clear_user_page(void *to, unsigned long u_vaddr, struct page *page)
725 set_bit(PG_arch_1, &page->flags); 736 set_bit(PG_arch_1, &page->flags);
726} 737}
727 738
728void flush_anon_page(struct vm_area_struct *vma, struct page *page,
729 unsigned long u_vaddr)
730{
731 /* TBD: do we really need to clear the kernel mapping */
732 __flush_dcache_page(page_address(page), u_vaddr);
733 __flush_dcache_page(page_address(page), page_address(page));
734
735}
736
737#endif
738 739
739/********************************************************************** 740/**********************************************************************
740 * Explicit Cache flush request from user space via syscall 741 * Explicit Cache flush request from user space via syscall
diff --git a/arch/arc/mm/tlb.c b/arch/arc/mm/tlb.c
index 066145b5f348..fe1c5a073afe 100644
--- a/arch/arc/mm/tlb.c
+++ b/arch/arc/mm/tlb.c
@@ -444,7 +444,8 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long vaddr_unaligned,
444 * so userspace sees the right data. 444 * so userspace sees the right data.
445 * (Avoids the flush for Non-exec + congruent mapping case) 445 * (Avoids the flush for Non-exec + congruent mapping case)
446 */ 446 */
447 if (vma->vm_flags & VM_EXEC || addr_not_cache_congruent(paddr, vaddr)) { 447 if ((vma->vm_flags & VM_EXEC) ||
448 addr_not_cache_congruent(paddr, vaddr)) {
448 struct page *page = pfn_to_page(pte_pfn(*ptep)); 449 struct page *page = pfn_to_page(pte_pfn(*ptep));
449 450
450 int dirty = test_and_clear_bit(PG_arch_1, &page->flags); 451 int dirty = test_and_clear_bit(PG_arch_1, &page->flags);
diff --git a/arch/arc/mm/tlbex.S b/arch/arc/mm/tlbex.S
index 9df765dc7c3a..3357d26ffe54 100644
--- a/arch/arc/mm/tlbex.S
+++ b/arch/arc/mm/tlbex.S
@@ -277,7 +277,7 @@ ARC_ENTRY EV_TLBMissI
277 ;---------------------------------------------------------------- 277 ;----------------------------------------------------------------
278 ; VERIFY_PTE: Check if PTE permissions approp for executing code 278 ; VERIFY_PTE: Check if PTE permissions approp for executing code
279 cmp_s r2, VMALLOC_START 279 cmp_s r2, VMALLOC_START
280 mov.lo r2, (_PAGE_PRESENT | _PAGE_READ | _PAGE_EXECUTE) 280 mov.lo r2, (_PAGE_PRESENT | _PAGE_U_READ | _PAGE_U_EXECUTE)
281 mov.hs r2, (_PAGE_PRESENT | _PAGE_K_READ | _PAGE_K_EXECUTE) 281 mov.hs r2, (_PAGE_PRESENT | _PAGE_K_READ | _PAGE_K_EXECUTE)
282 282
283 and r3, r0, r2 ; Mask out NON Flag bits from PTE 283 and r3, r0, r2 ; Mask out NON Flag bits from PTE
@@ -320,9 +320,9 @@ ARC_ENTRY EV_TLBMissD
320 mov_s r2, 0 320 mov_s r2, 0
321 lr r3, [ecr] 321 lr r3, [ecr]
322 btst_s r3, ECR_C_BIT_DTLB_LD_MISS ; Read Access 322 btst_s r3, ECR_C_BIT_DTLB_LD_MISS ; Read Access
323 or.nz r2, r2, _PAGE_READ ; chk for Read flag in PTE 323 or.nz r2, r2, _PAGE_U_READ ; chk for Read flag in PTE
324 btst_s r3, ECR_C_BIT_DTLB_ST_MISS ; Write Access 324 btst_s r3, ECR_C_BIT_DTLB_ST_MISS ; Write Access
325 or.nz r2, r2, _PAGE_WRITE ; chk for Write flag in PTE 325 or.nz r2, r2, _PAGE_U_WRITE ; chk for Write flag in PTE
326 ; Above laddering takes care of XCHG access 326 ; Above laddering takes care of XCHG access
327 ; which is both Read and Write 327 ; which is both Read and Write
328 328
diff --git a/arch/arc/plat-tb10x/tb10x.c b/arch/arc/plat-tb10x/tb10x.c
index d3567691c7e1..06cb30929460 100644
--- a/arch/arc/plat-tb10x/tb10x.c
+++ b/arch/arc/plat-tb10x/tb10x.c
@@ -34,31 +34,6 @@ static void __init tb10x_platform_init(void)
34 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 34 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
35} 35}
36 36
37static void __init tb10x_platform_late_init(void)
38{
39 struct device_node *dn;
40
41 /*
42 * Pinctrl documentation recommends setting up the iomux here for
43 * all modules which don't require control over the pins themselves.
44 * Modules which need this kind of assistance are compatible with
45 * "abilis,simple-pinctrl", i.e. we can easily iterate over them.
46 * TODO: Does this recommended method work cleanly with pins required
47 * by modules?
48 */
49 for_each_compatible_node(dn, NULL, "abilis,simple-pinctrl") {
50 struct platform_device *pd = of_find_device_by_node(dn);
51 struct pinctrl *pctl;
52
53 pctl = pinctrl_get_select(&pd->dev, "abilis,simple-default");
54 if (IS_ERR(pctl)) {
55 int ret = PTR_ERR(pctl);
56 dev_err(&pd->dev, "Could not set up pinctrl: %d\n",
57 ret);
58 }
59 }
60}
61
62static const char *tb10x_compat[] __initdata = { 37static const char *tb10x_compat[] __initdata = {
63 "abilis,arc-tb10x", 38 "abilis,arc-tb10x",
64 NULL, 39 NULL,
@@ -67,5 +42,4 @@ static const char *tb10x_compat[] __initdata = {
67MACHINE_START(TB10x, "tb10x") 42MACHINE_START(TB10x, "tb10x")
68 .dt_compat = tb10x_compat, 43 .dt_compat = tb10x_compat,
69 .init_machine = tb10x_platform_init, 44 .init_machine = tb10x_platform_init,
70 .init_late = tb10x_platform_late_init,
71MACHINE_END 45MACHINE_END