History

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

Linus Torvalds committed 13 years ago

Commit 462a2b52 parents 4dd9aa8 7bb66f611 files · +41 −70Browse files

Unified · Split

11 files
  1. arch/arc/boot/dts/abilis_tb100_dvk.dts +1 −1
  2. arch/arc/boot/dts/abilis_tb101_dvk.dts +1 −1
  3. arch/arc/boot/dts/abilis_tb10x.dtsi +2 −4
  4. arch/arc/include/asm/cacheflush.h +4 −2
  5. arch/arc/include/asm/page.h +0 −9
  6. arch/arc/include/asm/pgtable.h +15 −11
  7. arch/arc/include/asm/tlb.h +1 −1
  8. arch/arc/mm/cache_arc700.c +12 −11
  9. arch/arc/mm/tlb.c +2 −1
  10. arch/arc/mm/tlbex.S +3 −3
  11. arch/arc/plat-tb10x/tb10x.c +0 −26
arch/arc/boot/dts/abilis_tb100_dvk.dts+1−1
@@ -37,7 +37,7 @@ · 36 unmodified lines
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 {
arch/arc/boot/dts/abilis_tb101_dvk.dts+1−1
@@ -37,7 +37,7 @@ · 36 unmodified lines
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 {
arch/arc/boot/dts/abilis_tb10x.dtsi+2−4
@@ -88,8 +88,7 @@ · 87 unmodified lines
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 @@ · 88 unmodified lines
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>;
arch/arc/include/asm/cacheflush.h+4−2
@@ -93,14 +93,16 @@ static inline int cache_is_vipt_aliasing(void) · 92 unmodified lines
93#endif93#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 set99 * 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 { \
arch/arc/include/asm/page.h+0−9
@@ -19,13 +19,6 @@ · 18 unmodified lines
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, · 3 unmodified lines
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_TYPECHECKS31#undef STRICT_MM_TYPECHECKS
41 32
42#ifdef STRICT_MM_TYPECHECKS33#ifdef STRICT_MM_TYPECHECKS
arch/arc/include/asm/pgtable.h+15−11
@@ -57,9 +57,9 @@ · 56 unmodified lines
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 @@ · 6 unmodified lines
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 @@ · 12 unmodified lines
93#endif93#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_PAGES99#ifdef CONFIG_ARC_CACHE_PAGES
99#define _PAGE_DEF_CACHEABLE _PAGE_CACHEABLE100#define _PAGE_DEF_CACHEABLE _PAGE_CACHEABLE
@@ -106,7 +107,11 @@ · 6 unmodified lines
106 * -by default cached, unless config otherwise107 * -by default cached, unless config otherwise
107 * -present in memory108 * -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 @@ · 12 unmodified lines
125 * kernel vaddr space - visible in all addr spaces, but kernel mode only130 * kernel vaddr space - visible in all addr spaces, but kernel mode only
126 * Thus Global, all-kernel-access, no-user-access, cached131 * 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)
arch/arc/include/asm/tlb.h+1−1
@@ -16,7 +16,7 @@ · 15 unmodified lines
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__
arch/arc/mm/cache_arc700.c+12−11
@@ -610,7 +610,7 @@ void __sync_icache_dcache(unsigned long paddr, unsigned long vaddr, int len) · 609 unmodified lines
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, · 59 unmodified lines
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) · 43 unmodified lines
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 syscall741 * Explicit Cache flush request from user space via syscall
arch/arc/mm/tlb.c+2−1
@@ -444,7 +444,8 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long vaddr_unaligned, · 443 unmodified lines
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);
arch/arc/mm/tlbex.S+3−3
@@ -277,7 +277,7 @@ ARC_ENTRY EV_TLBMissI · 276 unmodified lines
277 ;----------------------------------------------------------------277 ;----------------------------------------------------------------
278 ; VERIFY_PTE: Check if PTE permissions approp for executing code278 ; VERIFY_PTE: Check if PTE permissions approp for executing code
279 cmp_s r2, VMALLOC_START279 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 PTE283 and r3, r0, r2 ; Mask out NON Flag bits from PTE
@@ -320,9 +320,9 @@ ARC_ENTRY EV_TLBMissD · 36 unmodified lines
320 mov_s r2, 0320 mov_s r2, 0
321 lr r3, [ecr]321 lr r3, [ecr]
322 btst_s r3, ECR_C_BIT_DTLB_LD_MISS ; Read Access322 btst_s r3, ECR_C_BIT_DTLB_LD_MISS ; Read Access
323 or.nz r2, r2, _PAGE_READ ; chk for Read flag in PTE323 or.nz r2, r2, _PAGE_U_READ ; chk for Read flag in PTE
324 btst_s r3, ECR_C_BIT_DTLB_ST_MISS ; Write Access324 btst_s r3, ECR_C_BIT_DTLB_ST_MISS ; Write Access
325 or.nz r2, r2, _PAGE_WRITE ; chk for Write flag in PTE325 or.nz r2, r2, _PAGE_U_WRITE ; chk for Write flag in PTE
326 ; Above laddering takes care of XCHG access326 ; Above laddering takes care of XCHG access
327 ; which is both Read and Write327 ; which is both Read and Write
328 328
arch/arc/plat-tb10x/tb10x.c+0−26
@@ -34,31 +34,6 @@ static void __init tb10x_platform_init(void) · 33 unmodified lines
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 = { · 2 unmodified lines
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_END45MACHINE_END

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t