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
3737
3838 soc100 {
3939 uart@FF100000 {
40− pinctrl-names = "abilis,simple-default";
40+ pinctrl-names = "default";
4141 pinctrl-0 = <&pctl_uart0>;
4242 };
4343 ethernet@FE100000 {
arch/arc/boot/dts/abilis_tb101_dvk.dts+1−1
@@ -37,7 +37,7 @@ · 36 unmodified lines
3737
3838 soc100 {
3939 uart@FF100000 {
40− pinctrl-names = "abilis,simple-default";
40+ pinctrl-names = "default";
4141 pinctrl-0 = <&pctl_uart0>;
4242 };
4343 ethernet@FE100000 {
arch/arc/boot/dts/abilis_tb10x.dtsi+2−4
@@ -88,8 +88,7 @@ · 87 unmodified lines
8888 };
8989
9090 uart@FF100000 {
91− compatible = "snps,dw-apb-uart",
92− "abilis,simple-pinctrl";
91+ compatible = "snps,dw-apb-uart";
9392 reg = <0xFF100000 0x100>;
9493 clock-frequency = <166666666>;
9594 interrupts = <25 1>;
@@ -184,8 +183,7 @@ · 88 unmodified lines
184183 #address-cells = <1>;
185184 #size-cells = <0>;
186185 cell-index = <1>;
187− compatible = "abilis,tb100-spi",
188− "abilis,simple-pinctrl";
186+ compatible = "abilis,tb100-spi";
189187 num-cs = <2>;
190188 reg = <0xFE011000 0x20>;
191189 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
9393 #endif
9494 }
9595
96−#define CACHE_COLOR(addr) (((unsigned long)(addr) >> (PAGE_SHIFT)) & 3)
96+#define CACHE_COLOR(addr) (((unsigned long)(addr) >> (PAGE_SHIFT)) & 1)
9797
9898 /*
9999 * checks if two addresses (after page aligning) index into same cache set
100100 */
101101 #define addr_not_cache_congruent(addr1, addr2) \
102+({ \
102103 cache_is_vipt_aliasing() ? \
103− (CACHE_COLOR(addr1) != CACHE_COLOR(addr2)) : 0 \
104+ (CACHE_COLOR(addr1) != CACHE_COLOR(addr2)) : 0; \
105+})
104106
105107 #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
106108 do { \
arch/arc/include/asm/page.h+0−9
@@ -19,13 +19,6 @@ · 18 unmodified lines
1919 #define clear_page(paddr) memset((paddr), 0, PAGE_SIZE)
2020 #define copy_page(to, from) memcpy((to), (from), PAGE_SIZE)
2121
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−
2922 struct vm_area_struct;
3023 struct page;
3124
@@ -35,8 +28,6 @@ void copy_user_highpage(struct page *to, struct page *from, · 3 unmodified lines
3528 unsigned long u_vaddr, struct vm_area_struct *vma);
3629 void clear_user_page(void *to, unsigned long u_vaddr, struct page *page);
3730
38−#endif /* CONFIG_ARC_CACHE_VIPT_ALIASING */
39−
4031 #undef STRICT_MM_TYPECHECKS
4132
4233 #ifdef STRICT_MM_TYPECHECKS
arch/arc/include/asm/pgtable.h+15−11
@@ -57,9 +57,9 @@ · 56 unmodified lines
5757
5858 #define _PAGE_ACCESSED (1<<1) /* Page is accessed (S) */
5959 #define _PAGE_CACHEABLE (1<<2) /* Page is cached (H) */
60−#define _PAGE_EXECUTE (1<<3) /* Page has user execute perm (H) */
61−#define _PAGE_WRITE (1<<4) /* Page has user write perm (H) */
62−#define _PAGE_READ (1<<5) /* Page has user read perm (H) */
60+#define _PAGE_U_EXECUTE (1<<3) /* Page has user execute perm (H) */
61+#define _PAGE_U_WRITE (1<<4) /* Page has user write perm (H) */
62+#define _PAGE_U_READ (1<<5) /* Page has user read perm (H) */
6363 #define _PAGE_K_EXECUTE (1<<6) /* Page has kernel execute perm (H) */
6464 #define _PAGE_K_WRITE (1<<7) /* Page has kernel write perm (H) */
6565 #define _PAGE_K_READ (1<<8) /* Page has kernel perm (H) */
@@ -72,9 +72,9 @@ · 6 unmodified lines
7272
7373 /* PD1 */
7474 #define _PAGE_CACHEABLE (1<<0) /* Page is cached (H) */
75−#define _PAGE_EXECUTE (1<<1) /* Page has user execute perm (H) */
76−#define _PAGE_WRITE (1<<2) /* Page has user write perm (H) */
77−#define _PAGE_READ (1<<3) /* Page has user read perm (H) */
75+#define _PAGE_U_EXECUTE (1<<1) /* Page has user execute perm (H) */
76+#define _PAGE_U_WRITE (1<<2) /* Page has user write perm (H) */
77+#define _PAGE_U_READ (1<<3) /* Page has user read perm (H) */
7878 #define _PAGE_K_EXECUTE (1<<4) /* Page has kernel execute perm (H) */
7979 #define _PAGE_K_WRITE (1<<5) /* Page has kernel write perm (H) */
8080 #define _PAGE_K_READ (1<<6) /* Page has kernel perm (H) */
@@ -93,7 +93,8 @@ · 12 unmodified lines
9393 #endif
9494
9595 /* 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)
9798
9899 #ifdef CONFIG_ARC_CACHE_PAGES
99100 #define _PAGE_DEF_CACHEABLE _PAGE_CACHEABLE
@@ -106,7 +107,11 @@ · 6 unmodified lines
106107 * -by default cached, unless config otherwise
107108 * -present in memory
108109 */
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)
110115
111116 /* Set of bits not changed in pte_modify */
112117 #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED)
@@ -125,11 +130,10 @@ · 12 unmodified lines
125130 * kernel vaddr space - visible in all addr spaces, but kernel mode only
126131 * Thus Global, all-kernel-access, no-user-access, cached
127132 */
128−#define PAGE_KERNEL __pgprot(___DEF | _PAGE_GLOBAL)
133+#define PAGE_KERNEL __pgprot(_K_PAGE_PERMS | _PAGE_DEF_CACHEABLE)
129134
130135 /* ioremap */
131−#define PAGE_KERNEL_NO_CACHE __pgprot(_PAGE_PRESENT | _K_PAGE_PERMS | \
132− _PAGE_GLOBAL)
136+#define PAGE_KERNEL_NO_CACHE __pgprot(_K_PAGE_PERMS)
133137
134138 /**************************************************************************
135139 * 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
1616 /* Masks for actual TLB "PD"s */
1717 #define PTE_BITS_IN_PD0 (_PAGE_GLOBAL | _PAGE_PRESENT)
1818 #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 | \
2020 _PAGE_K_EXECUTE | _PAGE_K_WRITE | _PAGE_K_READ)
2121
2222 #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
610610
611611 local_irq_save(flags);
612612 __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);
614614 local_irq_restore(flags);
615615 }
616616
@@ -676,6 +676,17 @@ void flush_cache_range(struct vm_area_struct *vma, unsigned long start, · 59 unmodified lines
676676 flush_cache_all();
677677 }
678678
679+void 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+
679690 void copy_user_highpage(struct page *to, struct page *from,
680691 unsigned long u_vaddr, struct vm_area_struct *vma)
681692 {
@@ -725,16 +736,6 @@ void clear_user_page(void *to, unsigned long u_vaddr, struct page *page) · 43 unmodified lines
725736 set_bit(PG_arch_1, &page->flags);
726737 }
727738
728−void 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
738739
739740 /**********************************************************************
740741 * 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
444444 * so userspace sees the right data.
445445 * (Avoids the flush for Non-exec + congruent mapping case)
446446 */
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)) {
448449 struct page *page = pfn_to_page(pte_pfn(*ptep));
449450
450451 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
277277 ;----------------------------------------------------------------
278278 ; VERIFY_PTE: Check if PTE permissions approp for executing code
279279 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)
281281 mov.hs r2, (_PAGE_PRESENT | _PAGE_K_READ | _PAGE_K_EXECUTE)
282282
283283 and r3, r0, r2 ; Mask out NON Flag bits from PTE
@@ -320,9 +320,9 @@ ARC_ENTRY EV_TLBMissD · 36 unmodified lines
320320 mov_s r2, 0
321321 lr r3, [ecr]
322322 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
324324 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
326326 ; Above laddering takes care of XCHG access
327327 ; which is both Read and Write
328328
arch/arc/plat-tb10x/tb10x.c+0−26
@@ -34,31 +34,6 @@ static void __init tb10x_platform_init(void) · 33 unmodified lines
3434 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
3535 }
3636
37−static 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−
6237 static const char *tb10x_compat[] __initdata = {
6338 "abilis,arc-tb10x",
6439 NULL,
@@ -67,5 +42,4 @@ static const char *tb10x_compat[] __initdata = { · 2 unmodified lines
6742 MACHINE_START(TB10x, "tb10x")
6843 .dt_compat = tb10x_compat,
6944 .init_machine = tb10x_platform_init,
70− .init_late = tb10x_platform_late_init,
7145 MACHINE_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