Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+41 -70
+1 -1
arch/arc/boot/dts/abilis_tb100_dvk.dts
··· 37 37 38 38 soc100 { 39 39 uart@FF100000 { 40 - pinctrl-names = "abilis,simple-default"; 40 + pinctrl-names = "default"; 41 41 pinctrl-0 = <&pctl_uart0>; 42 42 }; 43 43 ethernet@FE100000 {
+1 -1
arch/arc/boot/dts/abilis_tb101_dvk.dts
··· 37 37 38 38 soc100 { 39 39 uart@FF100000 { 40 - pinctrl-names = "abilis,simple-default"; 40 + pinctrl-names = "default"; 41 41 pinctrl-0 = <&pctl_uart0>; 42 42 }; 43 43 ethernet@FE100000 {
+2 -4
arch/arc/boot/dts/abilis_tb10x.dtsi
··· 88 88 }; 89 89 90 90 uart@FF100000 { 91 - compatible = "snps,dw-apb-uart", 92 - "abilis,simple-pinctrl"; 91 + compatible = "snps,dw-apb-uart"; 93 92 reg = <0xFF100000 0x100>; 94 93 clock-frequency = <166666666>; 95 94 interrupts = <25 1>; ··· 183 184 #address-cells = <1>; 184 185 #size-cells = <0>; 185 186 cell-index = <1>; 186 - compatible = "abilis,tb100-spi", 187 - "abilis,simple-pinctrl"; 187 + compatible = "abilis,tb100-spi"; 188 188 num-cs = <2>; 189 189 reg = <0xFE011000 0x20>; 190 190 interrupt-parent = <&tb10x_ictl>;
+4 -2
arch/arc/include/asm/cacheflush.h
··· 93 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 99 * checks if two addresses (after page aligning) index into same cache set 100 100 */ 101 101 #define addr_not_cache_congruent(addr1, addr2) \ 102 + ({ \ 102 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 107 #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 106 108 do { \
-9
arch/arc/include/asm/page.h
··· 19 19 #define clear_page(paddr) memset((paddr), 0, PAGE_SIZE) 20 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 - 29 22 struct vm_area_struct; 30 23 struct page; 31 24 ··· 27 34 void copy_user_highpage(struct page *to, struct page *from, 28 35 unsigned long u_vaddr, struct vm_area_struct *vma); 29 36 void clear_user_page(void *to, unsigned long u_vaddr, struct page *page); 30 - 31 - #endif /* CONFIG_ARC_CACHE_VIPT_ALIASING */ 32 37 33 38 #undef STRICT_MM_TYPECHECKS 34 39
+15 -11
arch/arc/include/asm/pgtable.h
··· 57 57 58 58 #define _PAGE_ACCESSED (1<<1) /* Page is accessed (S) */ 59 59 #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) */ 63 63 #define _PAGE_K_EXECUTE (1<<6) /* Page has kernel execute perm (H) */ 64 64 #define _PAGE_K_WRITE (1<<7) /* Page has kernel write perm (H) */ 65 65 #define _PAGE_K_READ (1<<8) /* Page has kernel perm (H) */ ··· 72 72 73 73 /* PD1 */ 74 74 #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) */ 78 78 #define _PAGE_K_EXECUTE (1<<4) /* Page has kernel execute perm (H) */ 79 79 #define _PAGE_K_WRITE (1<<5) /* Page has kernel write perm (H) */ 80 80 #define _PAGE_K_READ (1<<6) /* Page has kernel perm (H) */ ··· 93 93 #endif 94 94 95 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 99 #ifdef CONFIG_ARC_CACHE_PAGES 99 100 #define _PAGE_DEF_CACHEABLE _PAGE_CACHEABLE ··· 107 106 * -by default cached, unless config otherwise 108 107 * -present in memory 109 108 */ 110 - #define ___DEF (_PAGE_PRESENT | _K_PAGE_PERMS | _PAGE_DEF_CACHEABLE) 109 + #define ___DEF (_PAGE_PRESENT | _PAGE_DEF_CACHEABLE) 110 + 111 + #define _PAGE_READ (_PAGE_U_READ | _PAGE_K_READ) 112 + #define _PAGE_WRITE (_PAGE_U_WRITE | _PAGE_K_WRITE) 113 + #define _PAGE_EXECUTE (_PAGE_U_EXECUTE | _PAGE_K_EXECUTE) 111 114 112 115 /* Set of bits not changed in pte_modify */ 113 116 #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED) ··· 130 125 * kernel vaddr space - visible in all addr spaces, but kernel mode only 131 126 * Thus Global, all-kernel-access, no-user-access, cached 132 127 */ 133 - #define PAGE_KERNEL __pgprot(___DEF | _PAGE_GLOBAL) 128 + #define PAGE_KERNEL __pgprot(_K_PAGE_PERMS | _PAGE_DEF_CACHEABLE) 134 129 135 130 /* ioremap */ 136 - #define PAGE_KERNEL_NO_CACHE __pgprot(_PAGE_PRESENT | _K_PAGE_PERMS | \ 137 - _PAGE_GLOBAL) 131 + #define PAGE_KERNEL_NO_CACHE __pgprot(_K_PAGE_PERMS) 138 132 139 133 /************************************************************************** 140 134 * Mapping of vm_flags (Generic VM) to PTE flags (arch specific)
+1 -1
arch/arc/include/asm/tlb.h
··· 16 16 /* Masks for actual TLB "PD"s */ 17 17 #define PTE_BITS_IN_PD0 (_PAGE_GLOBAL | _PAGE_PRESENT) 18 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 20 _PAGE_K_EXECUTE | _PAGE_K_WRITE | _PAGE_K_READ) 21 21 22 22 #ifndef __ASSEMBLY__
+12 -11
arch/arc/mm/cache_arc700.c
··· 610 610 611 611 local_irq_save(flags); 612 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 614 local_irq_restore(flags); 615 615 } 616 616 ··· 676 676 flush_cache_all(); 677 677 } 678 678 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 + 679 690 void copy_user_highpage(struct page *to, struct page *from, 680 691 unsigned long u_vaddr, struct vm_area_struct *vma) 681 692 { ··· 736 725 set_bit(PG_arch_1, &page->flags); 737 726 } 738 727 739 - void flush_anon_page(struct vm_area_struct *vma, struct page *page, 740 - unsigned long u_vaddr) 741 - { 742 - /* TBD: do we really need to clear the kernel mapping */ 743 - __flush_dcache_page(page_address(page), u_vaddr); 744 - __flush_dcache_page(page_address(page), page_address(page)); 745 - 746 - } 747 - 748 - #endif 749 728 750 729 /********************************************************************** 751 730 * Explicit Cache flush request from user space via syscall
+2 -1
arch/arc/mm/tlb.c
··· 444 444 * so userspace sees the right data. 445 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 449 struct page *page = pfn_to_page(pte_pfn(*ptep)); 449 450 450 451 int dirty = test_and_clear_bit(PG_arch_1, &page->flags);
+3 -3
arch/arc/mm/tlbex.S
··· 277 277 ;---------------------------------------------------------------- 278 278 ; VERIFY_PTE: Check if PTE permissions approp for executing code 279 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 281 mov.hs r2, (_PAGE_PRESENT | _PAGE_K_READ | _PAGE_K_EXECUTE) 282 282 283 283 and r3, r0, r2 ; Mask out NON Flag bits from PTE ··· 320 320 mov_s r2, 0 321 321 lr r3, [ecr] 322 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 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 326 ; Above laddering takes care of XCHG access 327 327 ; which is both Read and Write 328 328
-26
arch/arc/plat-tb10x/tb10x.c
··· 34 34 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 35 35 } 36 36 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 - 62 37 static const char *tb10x_compat[] __initdata = { 63 38 "abilis,arc-tb10x", 64 39 NULL, ··· 42 67 MACHINE_START(TB10x, "tb10x") 43 68 .dt_compat = tb10x_compat, 44 69 .init_machine = tb10x_platform_init, 45 - .init_late = tb10x_platform_late_init, 46 70 MACHINE_END