Skip to content

Commit cd6407f

Browse files
committed
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
2 parents 26c439d + 09b2ad1 commit cd6407f

File tree

11 files changed

+59
-28
lines changed

11 files changed

+59
-28
lines changed

arch/arm/include/asm/atomic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ typedef struct {
243243

244244
#define ATOMIC64_INIT(i) { (i) }
245245

246-
static inline u64 atomic64_read(atomic64_t *v)
246+
static inline u64 atomic64_read(const atomic64_t *v)
247247
{
248248
u64 result;
249249

arch/arm/include/asm/domain.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@
6060
#ifndef __ASSEMBLY__
6161

6262
#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)
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+
}
7070

7171
#define modify_domain(dom,type) \
7272
do { \
@@ -78,8 +78,8 @@
7878
} while (0)
7979

8080
#else
81-
#define set_domain(x) do { } while (0)
82-
#define modify_domain(dom,type) do { } while (0)
81+
static inline void set_domain(unsigned val) { }
82+
static inline void modify_domain(unsigned dom, unsigned type) { }
8383
#endif
8484

8585
/*

arch/arm/include/asm/thread_info.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
148148
#define TIF_NOTIFY_RESUME 2 /* callback before returning to user */
149149
#define TIF_SYSCALL_TRACE 8
150150
#define TIF_SYSCALL_AUDIT 9
151-
#define TIF_SYSCALL_RESTARTSYS 10
152151
#define TIF_POLLING_NRFLAG 16
153152
#define TIF_USING_IWMMXT 17
154153
#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
@@ -164,11 +163,9 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
164163
#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
165164
#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT)
166165
#define _TIF_SECCOMP (1 << TIF_SECCOMP)
167-
#define _TIF_SYSCALL_RESTARTSYS (1 << TIF_SYSCALL_RESTARTSYS)
168166

169167
/* Checks for any syscall work in entry-common.S */
170-
#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
171-
_TIF_SYSCALL_RESTARTSYS)
168+
#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT)
172169

173170
/*
174171
* Change these and you break ASM code in entry-common.S

arch/arm/kernel/kprobes-test-arm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ void kprobe_arm_test_cases(void)
187187
TEST_BF_R ("mov pc, r",0,2f,"")
188188
TEST_BF_RR("mov pc, r",0,2f,", asl r",1,0,"")
189189
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 */
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 */
192192
#endif
193193
TEST_BB_R( "sub pc, pc, r",14, 1f-2f+8,"")
194194
TEST_BB_R( "rsb pc, r",14,1f-2f+8,", pc")

arch/arm/kernel/perf_event.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ __hw_perf_event_init(struct perf_event *event)
503503
event_requires_mode_exclusion(&event->attr)) {
504504
pr_debug("ARM performance counters do not support "
505505
"mode exclusion\n");
506-
return -EPERM;
506+
return -EOPNOTSUPP;
507507
}
508508

509509
/*

arch/arm/kernel/ptrace.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include <linux/regset.h>
2626
#include <linux/audit.h>
2727
#include <linux/tracehook.h>
28-
#include <linux/unistd.h>
2928

3029
#include <asm/pgtable.h>
3130
#include <asm/traps.h>
@@ -918,8 +917,6 @@ asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno)
918917
audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0,
919918
regs->ARM_r1, regs->ARM_r2, regs->ARM_r3);
920919

921-
if (why == 0 && test_and_clear_thread_flag(TIF_SYSCALL_RESTARTSYS))
922-
scno = __NR_restart_syscall - __NR_SYSCALL_BASE;
923920
if (!test_thread_flag(TIF_SYSCALL_TRACE))
924921
return scno;
925922

arch/arm/kernel/signal.c

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
*/
2828
#define SWI_SYS_SIGRETURN (0xef000000|(__NR_sigreturn)|(__NR_OABI_SYSCALL_BASE))
2929
#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)
3031

3132
/*
3233
* With EABI, the syscall number has to be loaded into r7.
@@ -46,6 +47,18 @@ const unsigned long sigreturn_codes[7] = {
4647
MOV_R7_NR_RT_SIGRETURN, SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN,
4748
};
4849

50+
/*
51+
* Either we support OABI only, or we have EABI with the OABI
52+
* compat layer enabled. In the later case we don't know if
53+
* user space is EABI or not, and if not we must not clobber r7.
54+
* Always using the OABI syscall solves that issue and works for
55+
* all those cases.
56+
*/
57+
const unsigned long syscall_restart_code[2] = {
58+
SWI_SYS_RESTART, /* swi __NR_restart_syscall */
59+
0xe49df004, /* ldr pc, [sp], #4 */
60+
};
61+
4962
/*
5063
* atomically swap in the new signal mask, and wait for a signal.
5164
*/
@@ -592,10 +605,12 @@ static void do_signal(struct pt_regs *regs, int syscall)
592605
case -ERESTARTNOHAND:
593606
case -ERESTARTSYS:
594607
case -ERESTARTNOINTR:
595-
case -ERESTART_RESTARTBLOCK:
596608
regs->ARM_r0 = regs->ARM_ORIG_r0;
597609
regs->ARM_pc = restart_addr;
598610
break;
611+
case -ERESTART_RESTARTBLOCK:
612+
regs->ARM_r0 = -EINTR;
613+
break;
599614
}
600615
}
601616

@@ -611,14 +626,12 @@ static void do_signal(struct pt_regs *regs, int syscall)
611626
* debugger has chosen to restart at a different PC.
612627
*/
613628
if (regs->ARM_pc == restart_addr) {
614-
if (retval == -ERESTARTNOHAND ||
615-
retval == -ERESTART_RESTARTBLOCK
629+
if (retval == -ERESTARTNOHAND
616630
|| (retval == -ERESTARTSYS
617631
&& !(ka.sa.sa_flags & SA_RESTART))) {
618632
regs->ARM_r0 = -EINTR;
619633
regs->ARM_pc = continue_addr;
620634
}
621-
clear_thread_flag(TIF_SYSCALL_RESTARTSYS);
622635
}
623636

624637
handle_signal(signr, &ka, &info, regs);
@@ -632,8 +645,29 @@ static void do_signal(struct pt_regs *regs, int syscall)
632645
* ignore the restart.
633646
*/
634647
if (retval == -ERESTART_RESTARTBLOCK
635-
&& regs->ARM_pc == restart_addr)
636-
set_thread_flag(TIF_SYSCALL_RESTARTSYS);
648+
&& regs->ARM_pc == continue_addr) {
649+
if (thumb_mode(regs)) {
650+
regs->ARM_r7 = __NR_restart_syscall - __NR_SYSCALL_BASE;
651+
regs->ARM_pc -= 2;
652+
} else {
653+
#if defined(CONFIG_AEABI) && !defined(CONFIG_OABI_COMPAT)
654+
regs->ARM_r7 = __NR_restart_syscall;
655+
regs->ARM_pc -= 4;
656+
#else
657+
u32 __user *usp;
658+
659+
regs->ARM_sp -= 4;
660+
usp = (u32 __user *)regs->ARM_sp;
661+
662+
if (put_user(regs->ARM_pc, usp) == 0) {
663+
regs->ARM_pc = KERN_RESTART_CODE;
664+
} else {
665+
regs->ARM_sp += 4;
666+
force_sigsegv(0, current);
667+
}
668+
#endif
669+
}
670+
}
637671
}
638672

639673
restore_saved_sigmask();

arch/arm/kernel/signal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88
* published by the Free Software Foundation.
99
*/
1010
#define KERN_SIGRETURN_CODE (CONFIG_VECTORS_BASE + 0x00000500)
11+
#define KERN_RESTART_CODE (KERN_SIGRETURN_CODE + sizeof(sigreturn_codes))
1112

1213
extern const unsigned long sigreturn_codes[7];
14+
extern const unsigned long syscall_restart_code[2];

arch/arm/kernel/traps.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,8 @@ void __init early_trap_init(void *vectors_base)
820820
*/
821821
memcpy((void *)(vectors + KERN_SIGRETURN_CODE - CONFIG_VECTORS_BASE),
822822
sigreturn_codes, sizeof(sigreturn_codes));
823+
memcpy((void *)(vectors + KERN_RESTART_CODE - CONFIG_VECTORS_BASE),
824+
syscall_restart_code, sizeof(syscall_restart_code));
823825

824826
flush_icache_range(vectors, vectors + PAGE_SIZE);
825827
modify_domain(DOMAIN_USER, DOMAIN_CLIENT);

arch/arm/mach-versatile/pci.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ void __init pci_versatile_preinit(void)
339339
static int __init versatile_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
340340
{
341341
int irq;
342-
int devslot = PCI_SLOT(dev->devfn);
343342

344343
/* slot, pin, irq
345344
* 24 1 27

arch/arm/mm/mm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ extern void __flush_dcache_page(struct address_space *mapping, struct page *page
6464
#ifdef CONFIG_ZONE_DMA
6565
extern phys_addr_t arm_dma_limit;
6666
#else
67-
#define arm_dma_limit ((u32)~0)
67+
#define arm_dma_limit ((phys_addr_t)~0)
6868
#endif
6969

7070
extern phys_addr_t arm_lowmem_limit;

0 commit comments

Comments
 (0)