Merge branch 'fixes' of git://git.linaro.org/people/rmk/linux-arm

Pull ARM fixes from Russell King:
"Last merge window, we had some updates from Al cleaning up the signal
restart handling. These have caused some problems on ARM, and while
Al has some fixes, we have some concerns with Al's patches but we've
been unsuccesful with discussing this.

We have got to the point where we need to do something, and we've
decided that the best solution is to revert the appropriate commits
until Al is able to reply to us.

Also included here are four patches to fix warnings that I've noticed
in my build system, and one fix for kprobes test code."

* 'fixes' of git://git.linaro.org/people/rmk/linux-arm:
ARM: fix warning caused by wrongly typed arm_dma_limit
ARM: fix warnings about atomic64_read
ARM: 7440/1: kprobes: only test 'sub pc, pc, #1b-2b+8-2' on ARMv6
ARM: 7441/1: perf: return -EOPNOTSUPP if requested mode exclusion is unavailable
ARM: 7443/1: Revert "new way of handling ERESTART_RESTARTBLOCK"
ARM: 7442/1: Revert "remove unused restart trampoline"
ARM: fix set_domain() macro
ARM: fix mach-versatile/pci.c warning

+59 -28
+1 -1
arch/arm/include/asm/atomic.h
··· 243 244 #define ATOMIC64_INIT(i) { (i) } 245 246 - static inline u64 atomic64_read(atomic64_t *v) 247 { 248 u64 result; 249
··· 243 244 #define ATOMIC64_INIT(i) { (i) } 245 246 + static inline u64 atomic64_read(const atomic64_t *v) 247 { 248 u64 result; 249
+9 -9
arch/arm/include/asm/domain.h
··· 60 #ifndef __ASSEMBLY__ 61 62 #ifdef CONFIG_CPU_USE_DOMAINS 63 - #define set_domain(x) \ 64 - do { \ 65 - __asm__ __volatile__( \ 66 - "mcr p15, 0, %0, c3, c0 @ set domain" \ 67 - : : "r" (x)); \ 68 - isb(); \ 69 - } while (0) 70 71 #define modify_domain(dom,type) \ 72 do { \ ··· 78 } while (0) 79 80 #else 81 - #define set_domain(x) do { } while (0) 82 - #define modify_domain(dom,type) do { } while (0) 83 #endif 84 85 /*
··· 60 #ifndef __ASSEMBLY__ 61 62 #ifdef CONFIG_CPU_USE_DOMAINS 63 + static inline void set_domain(unsigned val) 64 + { 65 + asm volatile( 66 + "mcr p15, 0, %0, c3, c0 @ set domain" 67 + : : "r" (val)); 68 + isb(); 69 + } 70 71 #define modify_domain(dom,type) \ 72 do { \ ··· 78 } while (0) 79 80 #else 81 + static inline void set_domain(unsigned val) { } 82 + static inline void modify_domain(unsigned dom, unsigned type) { } 83 #endif 84 85 /*
+1 -4
arch/arm/include/asm/thread_info.h
··· 148 #define TIF_NOTIFY_RESUME 2 /* callback before returning to user */ 149 #define TIF_SYSCALL_TRACE 8 150 #define TIF_SYSCALL_AUDIT 9 151 - #define TIF_SYSCALL_RESTARTSYS 10 152 #define TIF_POLLING_NRFLAG 16 153 #define TIF_USING_IWMMXT 17 154 #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ ··· 163 #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 164 #define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT) 165 #define _TIF_SECCOMP (1 << TIF_SECCOMP) 166 - #define _TIF_SYSCALL_RESTARTSYS (1 << TIF_SYSCALL_RESTARTSYS) 167 168 /* Checks for any syscall work in entry-common.S */ 169 - #define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ 170 - _TIF_SYSCALL_RESTARTSYS) 171 172 /* 173 * Change these and you break ASM code in entry-common.S
··· 148 #define TIF_NOTIFY_RESUME 2 /* callback before returning to user */ 149 #define TIF_SYSCALL_TRACE 8 150 #define TIF_SYSCALL_AUDIT 9 151 #define TIF_POLLING_NRFLAG 16 152 #define TIF_USING_IWMMXT 17 153 #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ ··· 164 #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 165 #define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT) 166 #define _TIF_SECCOMP (1 << TIF_SECCOMP) 167 168 /* Checks for any syscall work in entry-common.S */ 169 + #define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT) 170 171 /* 172 * Change these and you break ASM code in entry-common.S
+2 -2
arch/arm/kernel/kprobes-test-arm.c
··· 187 TEST_BF_R ("mov pc, r",0,2f,"") 188 TEST_BF_RR("mov pc, r",0,2f,", asl r",1,0,"") 189 TEST_BB( "sub pc, pc, #1b-2b+8") 190 - #if __LINUX_ARM_ARCH__ >= 6 191 - TEST_BB( "sub pc, pc, #1b-2b+8-2") /* UNPREDICTABLE before ARMv6 */ 192 #endif 193 TEST_BB_R( "sub pc, pc, r",14, 1f-2f+8,"") 194 TEST_BB_R( "rsb pc, r",14,1f-2f+8,", pc")
··· 187 TEST_BF_R ("mov pc, r",0,2f,"") 188 TEST_BF_RR("mov pc, r",0,2f,", asl r",1,0,"") 189 TEST_BB( "sub pc, pc, #1b-2b+8") 190 + #if __LINUX_ARM_ARCH__ == 6 && !defined(CONFIG_CPU_V7) 191 + TEST_BB( "sub pc, pc, #1b-2b+8-2") /* UNPREDICTABLE before and after ARMv6 */ 192 #endif 193 TEST_BB_R( "sub pc, pc, r",14, 1f-2f+8,"") 194 TEST_BB_R( "rsb pc, r",14,1f-2f+8,", pc")
+1 -1
arch/arm/kernel/perf_event.c
··· 503 event_requires_mode_exclusion(&event->attr)) { 504 pr_debug("ARM performance counters do not support " 505 "mode exclusion\n"); 506 - return -EPERM; 507 } 508 509 /*
··· 503 event_requires_mode_exclusion(&event->attr)) { 504 pr_debug("ARM performance counters do not support " 505 "mode exclusion\n"); 506 + return -EOPNOTSUPP; 507 } 508 509 /*
-3
arch/arm/kernel/ptrace.c
··· 25 #include <linux/regset.h> 26 #include <linux/audit.h> 27 #include <linux/tracehook.h> 28 - #include <linux/unistd.h> 29 30 #include <asm/pgtable.h> 31 #include <asm/traps.h> ··· 917 audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, 918 regs->ARM_r1, regs->ARM_r2, regs->ARM_r3); 919 920 - if (why == 0 && test_and_clear_thread_flag(TIF_SYSCALL_RESTARTSYS)) 921 - scno = __NR_restart_syscall - __NR_SYSCALL_BASE; 922 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 923 return scno; 924
··· 25 #include <linux/regset.h> 26 #include <linux/audit.h> 27 #include <linux/tracehook.h> 28 29 #include <asm/pgtable.h> 30 #include <asm/traps.h> ··· 918 audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, 919 regs->ARM_r1, regs->ARM_r2, regs->ARM_r3); 920 921 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 922 return scno; 923
+40 -6
arch/arm/kernel/signal.c
··· 27 */ 28 #define SWI_SYS_SIGRETURN (0xef000000|(__NR_sigreturn)|(__NR_OABI_SYSCALL_BASE)) 29 #define SWI_SYS_RT_SIGRETURN (0xef000000|(__NR_rt_sigreturn)|(__NR_OABI_SYSCALL_BASE)) 30 31 /* 32 * With EABI, the syscall number has to be loaded into r7. ··· 45 const unsigned long sigreturn_codes[7] = { 46 MOV_R7_NR_SIGRETURN, SWI_SYS_SIGRETURN, SWI_THUMB_SIGRETURN, 47 MOV_R7_NR_RT_SIGRETURN, SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN, 48 }; 49 50 /* ··· 605 case -ERESTARTNOHAND: 606 case -ERESTARTSYS: 607 case -ERESTARTNOINTR: 608 - case -ERESTART_RESTARTBLOCK: 609 regs->ARM_r0 = regs->ARM_ORIG_r0; 610 regs->ARM_pc = restart_addr; 611 break; 612 } 613 } ··· 626 * debugger has chosen to restart at a different PC. 627 */ 628 if (regs->ARM_pc == restart_addr) { 629 - if (retval == -ERESTARTNOHAND || 630 - retval == -ERESTART_RESTARTBLOCK 631 || (retval == -ERESTARTSYS 632 && !(ka.sa.sa_flags & SA_RESTART))) { 633 regs->ARM_r0 = -EINTR; 634 regs->ARM_pc = continue_addr; 635 } 636 - clear_thread_flag(TIF_SYSCALL_RESTARTSYS); 637 } 638 639 handle_signal(signr, &ka, &info, regs); ··· 645 * ignore the restart. 646 */ 647 if (retval == -ERESTART_RESTARTBLOCK 648 - && regs->ARM_pc == restart_addr) 649 - set_thread_flag(TIF_SYSCALL_RESTARTSYS); 650 } 651 652 restore_saved_sigmask();
··· 27 */ 28 #define SWI_SYS_SIGRETURN (0xef000000|(__NR_sigreturn)|(__NR_OABI_SYSCALL_BASE)) 29 #define SWI_SYS_RT_SIGRETURN (0xef000000|(__NR_rt_sigreturn)|(__NR_OABI_SYSCALL_BASE)) 30 + #define SWI_SYS_RESTART (0xef000000|__NR_restart_syscall|__NR_OABI_SYSCALL_BASE) 31 32 /* 33 * With EABI, the syscall number has to be loaded into r7. ··· 44 const unsigned long sigreturn_codes[7] = { 45 MOV_R7_NR_SIGRETURN, SWI_SYS_SIGRETURN, SWI_THUMB_SIGRETURN, 46 MOV_R7_NR_RT_SIGRETURN, SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN, 47 + }; 48 + 49 + /* 50 + * Either we support OABI only, or we have EABI with the OABI 51 + * compat layer enabled. In the later case we don't know if 52 + * user space is EABI or not, and if not we must not clobber r7. 53 + * Always using the OABI syscall solves that issue and works for 54 + * all those cases. 55 + */ 56 + const unsigned long syscall_restart_code[2] = { 57 + SWI_SYS_RESTART, /* swi __NR_restart_syscall */ 58 + 0xe49df004, /* ldr pc, [sp], #4 */ 59 }; 60 61 /* ··· 592 case -ERESTARTNOHAND: 593 case -ERESTARTSYS: 594 case -ERESTARTNOINTR: 595 regs->ARM_r0 = regs->ARM_ORIG_r0; 596 regs->ARM_pc = restart_addr; 597 + break; 598 + case -ERESTART_RESTARTBLOCK: 599 + regs->ARM_r0 = -EINTR; 600 break; 601 } 602 } ··· 611 * debugger has chosen to restart at a different PC. 612 */ 613 if (regs->ARM_pc == restart_addr) { 614 + if (retval == -ERESTARTNOHAND 615 || (retval == -ERESTARTSYS 616 && !(ka.sa.sa_flags & SA_RESTART))) { 617 regs->ARM_r0 = -EINTR; 618 regs->ARM_pc = continue_addr; 619 } 620 } 621 622 handle_signal(signr, &ka, &info, regs); ··· 632 * ignore the restart. 633 */ 634 if (retval == -ERESTART_RESTARTBLOCK 635 + && regs->ARM_pc == continue_addr) { 636 + if (thumb_mode(regs)) { 637 + regs->ARM_r7 = __NR_restart_syscall - __NR_SYSCALL_BASE; 638 + regs->ARM_pc -= 2; 639 + } else { 640 + #if defined(CONFIG_AEABI) && !defined(CONFIG_OABI_COMPAT) 641 + regs->ARM_r7 = __NR_restart_syscall; 642 + regs->ARM_pc -= 4; 643 + #else 644 + u32 __user *usp; 645 + 646 + regs->ARM_sp -= 4; 647 + usp = (u32 __user *)regs->ARM_sp; 648 + 649 + if (put_user(regs->ARM_pc, usp) == 0) { 650 + regs->ARM_pc = KERN_RESTART_CODE; 651 + } else { 652 + regs->ARM_sp += 4; 653 + force_sigsegv(0, current); 654 + } 655 + #endif 656 + } 657 + } 658 } 659 660 restore_saved_sigmask();
+2
arch/arm/kernel/signal.h
··· 8 * published by the Free Software Foundation. 9 */ 10 #define KERN_SIGRETURN_CODE (CONFIG_VECTORS_BASE + 0x00000500) 11 12 extern const unsigned long sigreturn_codes[7];
··· 8 * published by the Free Software Foundation. 9 */ 10 #define KERN_SIGRETURN_CODE (CONFIG_VECTORS_BASE + 0x00000500) 11 + #define KERN_RESTART_CODE (KERN_SIGRETURN_CODE + sizeof(sigreturn_codes)) 12 13 extern const unsigned long sigreturn_codes[7]; 14 + extern const unsigned long syscall_restart_code[2];
+2
arch/arm/kernel/traps.c
··· 820 */ 821 memcpy((void *)(vectors + KERN_SIGRETURN_CODE - CONFIG_VECTORS_BASE), 822 sigreturn_codes, sizeof(sigreturn_codes)); 823 824 flush_icache_range(vectors, vectors + PAGE_SIZE); 825 modify_domain(DOMAIN_USER, DOMAIN_CLIENT);
··· 820 */ 821 memcpy((void *)(vectors + KERN_SIGRETURN_CODE - CONFIG_VECTORS_BASE), 822 sigreturn_codes, sizeof(sigreturn_codes)); 823 + memcpy((void *)(vectors + KERN_RESTART_CODE - CONFIG_VECTORS_BASE), 824 + syscall_restart_code, sizeof(syscall_restart_code)); 825 826 flush_icache_range(vectors, vectors + PAGE_SIZE); 827 modify_domain(DOMAIN_USER, DOMAIN_CLIENT);
-1
arch/arm/mach-versatile/pci.c
··· 339 static int __init versatile_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 340 { 341 int irq; 342 - int devslot = PCI_SLOT(dev->devfn); 343 344 /* slot, pin, irq 345 * 24 1 27
··· 339 static int __init versatile_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 340 { 341 int irq; 342 343 /* slot, pin, irq 344 * 24 1 27
+1 -1
arch/arm/mm/mm.h
··· 64 #ifdef CONFIG_ZONE_DMA 65 extern phys_addr_t arm_dma_limit; 66 #else 67 - #define arm_dma_limit ((u32)~0) 68 #endif 69 70 extern phys_addr_t arm_lowmem_limit;
··· 64 #ifdef CONFIG_ZONE_DMA 65 extern phys_addr_t arm_dma_limit; 66 #else 67 + #define arm_dma_limit ((phys_addr_t)~0) 68 #endif 69 70 extern phys_addr_t arm_lowmem_limit;