aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-05-25 12:27:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-25 12:27:52 -0400
commit24c82fbb86c675bc265d2bd815d17c4861c50580 (patch)
tree152eb2e427bc79af2075043e70bf087f21aefc78
parent28165ec7a99be98123aa89540bf2cfc24df19498 (diff)
parent784c2213e79c094ffd9c1118722ac9ee5fce5e77 (diff)
Merge branch 'parisc-4.7-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull parisc updates from Helge Deller: - Add native high-resolution timing code for sched_clock() and other timing functions based on the processor internal cr16 cycle counters - Add syscall tracepoint support - Add regset support - Speed up get_user() and put_user() functions - Updated futex.h to match generic implementation (John David Anglin) - A few smaller ftrace build fixes - Fixed thuge-gen kernel self test to utilize architectured MAP_HUGETLB value - Added parisc architecture to seccomp_bpf kernel self test - Various typo fixes (Andrea Gelmini) * 'parisc-4.7-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc: Whitespace cleanups in unistd.h parisc: Use long jump to reach ftrace_return_to_handler() parisc: Fix typo in fpudispatch.c parisc: Fix typos in eisa_eeprom.h parisc: Fix typo in ldcw.h parisc: Fix typo in pdc.h parisc: Update futex.h to match generic implementation parisc: Merge ftrace C-helper and assembler functions into .text.hot section selftests/thuge-gen: Use platform specific MAP_HUGETLB value parisc: Add native high-resolution sched_clock() implementation parisc: Add ARCH_TRACEHOOK and regset support parisc: Add 64bit get_user() and put_user() for 32bit kernel parisc: Simplify and speed up get_user() and put_user() parisc: Add syscall tracepoint support
-rw-r--r--arch/parisc/Kconfig3
-rw-r--r--arch/parisc/include/asm/cmpxchg.h9
-rw-r--r--arch/parisc/include/asm/eisa_eeprom.h4
-rw-r--r--arch/parisc/include/asm/ftrace.h2
-rw-r--r--arch/parisc/include/asm/futex.h70
-rw-r--r--arch/parisc/include/asm/ldcw.h2
-rw-r--r--arch/parisc/include/asm/syscall.h9
-rw-r--r--arch/parisc/include/asm/thread_info.h4
-rw-r--r--arch/parisc/include/asm/uaccess.h91
-rw-r--r--arch/parisc/include/uapi/asm/pdc.h2
-rw-r--r--arch/parisc/include/uapi/asm/ptrace.h48
-rw-r--r--arch/parisc/include/uapi/asm/unistd.h34
-rw-r--r--arch/parisc/kernel/entry.S13
-rw-r--r--arch/parisc/kernel/ftrace.c7
-rw-r--r--arch/parisc/kernel/ptrace.c368
-rw-r--r--arch/parisc/kernel/syscall.S1
-rw-r--r--arch/parisc/kernel/time.c63
-rw-r--r--arch/parisc/lib/bitops.c6
-rw-r--r--arch/parisc/math-emu/fpudispatch.c2
-rw-r--r--tools/testing/selftests/seccomp/seccomp_bpf.c8
-rw-r--r--tools/testing/selftests/vm/thuge-gen.c2
21 files changed, 610 insertions, 138 deletions
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 3d498a676551..dc117385ce2e 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -6,6 +6,7 @@ config PARISC
6 select HAVE_OPROFILE 6 select HAVE_OPROFILE
7 select HAVE_FUNCTION_TRACER 7 select HAVE_FUNCTION_TRACER
8 select HAVE_FUNCTION_GRAPH_TRACER 8 select HAVE_FUNCTION_GRAPH_TRACER
9 select HAVE_SYSCALL_TRACEPOINTS
9 select ARCH_WANT_FRAME_POINTERS 10 select ARCH_WANT_FRAME_POINTERS
10 select RTC_CLASS 11 select RTC_CLASS
11 select RTC_DRV_GENERIC 12 select RTC_DRV_GENERIC
@@ -31,6 +32,8 @@ config PARISC
31 select HAVE_DEBUG_STACKOVERFLOW 32 select HAVE_DEBUG_STACKOVERFLOW
32 select HAVE_ARCH_AUDITSYSCALL 33 select HAVE_ARCH_AUDITSYSCALL
33 select HAVE_ARCH_SECCOMP_FILTER 34 select HAVE_ARCH_SECCOMP_FILTER
35 select HAVE_ARCH_TRACEHOOK
36 select HAVE_UNSTABLE_SCHED_CLOCK if (SMP || !64BIT)
34 select ARCH_NO_COHERENT_DMA_MMAP 37 select ARCH_NO_COHERENT_DMA_MMAP
35 select CPU_NO_EFFICIENT_FFS 38 select CPU_NO_EFFICIENT_FFS
36 39
diff --git a/arch/parisc/include/asm/cmpxchg.h b/arch/parisc/include/asm/cmpxchg.h
index 0a90b965cccb..7ada30900807 100644
--- a/arch/parisc/include/asm/cmpxchg.h
+++ b/arch/parisc/include/asm/cmpxchg.h
@@ -52,8 +52,7 @@ extern void __cmpxchg_called_with_bad_pointer(void);
52/* __cmpxchg_u32/u64 defined in arch/parisc/lib/bitops.c */ 52/* __cmpxchg_u32/u64 defined in arch/parisc/lib/bitops.c */
53extern unsigned long __cmpxchg_u32(volatile unsigned int *m, unsigned int old, 53extern unsigned long __cmpxchg_u32(volatile unsigned int *m, unsigned int old,
54 unsigned int new_); 54 unsigned int new_);
55extern unsigned long __cmpxchg_u64(volatile unsigned long *ptr, 55extern u64 __cmpxchg_u64(volatile u64 *ptr, u64 old, u64 new_);
56 unsigned long old, unsigned long new_);
57 56
58/* don't worry...optimizer will get rid of most of this */ 57/* don't worry...optimizer will get rid of most of this */
59static inline unsigned long 58static inline unsigned long
@@ -61,7 +60,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)
61{ 60{
62 switch (size) { 61 switch (size) {
63#ifdef CONFIG_64BIT 62#ifdef CONFIG_64BIT
64 case 8: return __cmpxchg_u64((unsigned long *)ptr, old, new_); 63 case 8: return __cmpxchg_u64((u64 *)ptr, old, new_);
65#endif 64#endif
66 case 4: return __cmpxchg_u32((unsigned int *)ptr, 65 case 4: return __cmpxchg_u32((unsigned int *)ptr,
67 (unsigned int)old, (unsigned int)new_); 66 (unsigned int)old, (unsigned int)new_);
@@ -86,7 +85,7 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
86{ 85{
87 switch (size) { 86 switch (size) {
88#ifdef CONFIG_64BIT 87#ifdef CONFIG_64BIT
89 case 8: return __cmpxchg_u64((unsigned long *)ptr, old, new_); 88 case 8: return __cmpxchg_u64((u64 *)ptr, old, new_);
90#endif 89#endif
91 case 4: return __cmpxchg_u32(ptr, old, new_); 90 case 4: return __cmpxchg_u32(ptr, old, new_);
92 default: 91 default:
@@ -111,4 +110,6 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
111#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) 110#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
112#endif 111#endif
113 112
113#define cmpxchg64(ptr, o, n) __cmpxchg_u64(ptr, o, n)
114
114#endif /* _ASM_PARISC_CMPXCHG_H_ */ 115#endif /* _ASM_PARISC_CMPXCHG_H_ */
diff --git a/arch/parisc/include/asm/eisa_eeprom.h b/arch/parisc/include/asm/eisa_eeprom.h
index 8ce8b85ca588..5637ac962f8e 100644
--- a/arch/parisc/include/asm/eisa_eeprom.h
+++ b/arch/parisc/include/asm/eisa_eeprom.h
@@ -99,7 +99,7 @@ struct eeprom_eisa_slot_info
99#define HPEE_MEMORY_DECODE_24BITS 0x04 99#define HPEE_MEMORY_DECODE_24BITS 0x04
100#define HPEE_MEMORY_DECODE_32BITS 0x08 100#define HPEE_MEMORY_DECODE_32BITS 0x08
101/* byte 2 and 3 are a 16bit LE value 101/* byte 2 and 3 are a 16bit LE value
102 * containging the memory size in kilobytes */ 102 * containing the memory size in kilobytes */
103/* byte 4,5,6 are a 24bit LE value 103/* byte 4,5,6 are a 24bit LE value
104 * containing the memory base address */ 104 * containing the memory base address */
105 105
@@ -135,7 +135,7 @@ struct eeprom_eisa_slot_info
135#define HPEE_PORT_SHARED 0x40 135#define HPEE_PORT_SHARED 0x40
136#define HPEE_PORT_MORE 0x80 136#define HPEE_PORT_MORE 0x80
137/* byte 1 and 2 is a 16bit LE value 137/* byte 1 and 2 is a 16bit LE value
138 * conating the start port number */ 138 * containing the start port number */
139 139
140#define HPEE_PORT_INIT_MAX_LEN 60 /* in bytes here */ 140#define HPEE_PORT_INIT_MAX_LEN 60 /* in bytes here */
141/* port init entry byte 0 */ 141/* port init entry byte 0 */
diff --git a/arch/parisc/include/asm/ftrace.h b/arch/parisc/include/asm/ftrace.h
index 24cd81d58d70..d635c6b0269d 100644
--- a/arch/parisc/include/asm/ftrace.h
+++ b/arch/parisc/include/asm/ftrace.h
@@ -6,6 +6,8 @@ extern void mcount(void);
6 6
7#define MCOUNT_INSN_SIZE 4 7#define MCOUNT_INSN_SIZE 4
8 8
9extern unsigned long sys_call_table[];
10
9extern unsigned long return_address(unsigned int); 11extern unsigned long return_address(unsigned int);
10 12
11#define ftrace_return_address(n) return_address(n) 13#define ftrace_return_address(n) return_address(n)
diff --git a/arch/parisc/include/asm/futex.h b/arch/parisc/include/asm/futex.h
index 49df14805a9b..ac8bd586ace8 100644
--- a/arch/parisc/include/asm/futex.h
+++ b/arch/parisc/include/asm/futex.h
@@ -35,70 +35,57 @@ static inline int
35futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr) 35futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
36{ 36{
37 unsigned long int flags; 37 unsigned long int flags;
38 u32 val;
39 int op = (encoded_op >> 28) & 7; 38 int op = (encoded_op >> 28) & 7;
40 int cmp = (encoded_op >> 24) & 15; 39 int cmp = (encoded_op >> 24) & 15;
41 int oparg = (encoded_op << 8) >> 20; 40 int oparg = (encoded_op << 8) >> 20;
42 int cmparg = (encoded_op << 20) >> 20; 41 int cmparg = (encoded_op << 20) >> 20;
43 int oldval = 0, ret; 42 int oldval, ret;
43 u32 tmp;
44
44 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) 45 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
45 oparg = 1 << oparg; 46 oparg = 1 << oparg;
46 47
47 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(*uaddr))) 48 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(*uaddr)))
48 return -EFAULT; 49 return -EFAULT;
49 50
51 _futex_spin_lock_irqsave(uaddr, &flags);
50 pagefault_disable(); 52 pagefault_disable();
51 53
52 _futex_spin_lock_irqsave(uaddr, &flags); 54 ret = -EFAULT;
55 if (unlikely(get_user(oldval, uaddr) != 0))
56 goto out_pagefault_enable;
57
58 ret = 0;
59 tmp = oldval;
53 60
54 switch (op) { 61 switch (op) {
55 case FUTEX_OP_SET: 62 case FUTEX_OP_SET:
56 /* *(int *)UADDR2 = OPARG; */ 63 tmp = oparg;
57 ret = get_user(oldval, uaddr);
58 if (!ret)
59 ret = put_user(oparg, uaddr);
60 break; 64 break;
61 case FUTEX_OP_ADD: 65 case FUTEX_OP_ADD:
62 /* *(int *)UADDR2 += OPARG; */ 66 tmp += oparg;
63 ret = get_user(oldval, uaddr);
64 if (!ret) {
65 val = oldval + oparg;
66 ret = put_user(val, uaddr);
67 }
68 break; 67 break;
69 case FUTEX_OP_OR: 68 case FUTEX_OP_OR:
70 /* *(int *)UADDR2 |= OPARG; */ 69 tmp |= oparg;
71 ret = get_user(oldval, uaddr);
72 if (!ret) {
73 val = oldval | oparg;
74 ret = put_user(val, uaddr);
75 }
76 break; 70 break;
77 case FUTEX_OP_ANDN: 71 case FUTEX_OP_ANDN:
78 /* *(int *)UADDR2 &= ~OPARG; */ 72 tmp &= ~oparg;
79 ret = get_user(oldval, uaddr);
80 if (!ret) {
81 val = oldval & ~oparg;
82 ret = put_user(val, uaddr);
83 }
84 break; 73 break;
85 case FUTEX_OP_XOR: 74 case FUTEX_OP_XOR:
86 /* *(int *)UADDR2 ^= OPARG; */ 75 tmp ^= oparg;
87 ret = get_user(oldval, uaddr);
88 if (!ret) {
89 val = oldval ^ oparg;
90 ret = put_user(val, uaddr);
91 }
92 break; 76 break;
93 default: 77 default:
94 ret = -ENOSYS; 78 ret = -ENOSYS;
95 } 79 }
96 80
97 _futex_spin_unlock_irqrestore(uaddr, &flags); 81 if (ret == 0 && unlikely(put_user(tmp, uaddr) != 0))
82 ret = -EFAULT;
98 83
84out_pagefault_enable:
99 pagefault_enable(); 85 pagefault_enable();
86 _futex_spin_unlock_irqrestore(uaddr, &flags);
100 87
101 if (!ret) { 88 if (ret == 0) {
102 switch (cmp) { 89 switch (cmp) {
103 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break; 90 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
104 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break; 91 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
@@ -112,12 +99,10 @@ futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
112 return ret; 99 return ret;
113} 100}
114 101
115/* Non-atomic version */
116static inline int 102static inline int
117futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, 103futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
118 u32 oldval, u32 newval) 104 u32 oldval, u32 newval)
119{ 105{
120 int ret;
121 u32 val; 106 u32 val;
122 unsigned long flags; 107 unsigned long flags;
123 108
@@ -137,17 +122,20 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
137 */ 122 */
138 123
139 _futex_spin_lock_irqsave(uaddr, &flags); 124 _futex_spin_lock_irqsave(uaddr, &flags);
125 if (unlikely(get_user(val, uaddr) != 0)) {
126 _futex_spin_unlock_irqrestore(uaddr, &flags);
127 return -EFAULT;
128 }
140 129
141 ret = get_user(val, uaddr); 130 if (val == oldval && unlikely(put_user(newval, uaddr) != 0)) {
142 131 _futex_spin_unlock_irqrestore(uaddr, &flags);
143 if (!ret && val == oldval) 132 return -EFAULT;
144 ret = put_user(newval, uaddr); 133 }
145 134
146 *uval = val; 135 *uval = val;
147
148 _futex_spin_unlock_irqrestore(uaddr, &flags); 136 _futex_spin_unlock_irqrestore(uaddr, &flags);
149 137
150 return ret; 138 return 0;
151} 139}
152 140
153#endif /*__KERNEL__*/ 141#endif /*__KERNEL__*/
diff --git a/arch/parisc/include/asm/ldcw.h b/arch/parisc/include/asm/ldcw.h
index 8121aa6db2ff..8be707e1b6c7 100644
--- a/arch/parisc/include/asm/ldcw.h
+++ b/arch/parisc/include/asm/ldcw.h
@@ -40,7 +40,7 @@
40 memory to indicate to the compiler that the assembly code reads 40 memory to indicate to the compiler that the assembly code reads
41 or writes to items other than those listed in the input and output 41 or writes to items other than those listed in the input and output
42 operands. This may pessimize the code somewhat but __ldcw is 42 operands. This may pessimize the code somewhat but __ldcw is
43 usually used within code blocks surrounded by memory barriors. */ 43 usually used within code blocks surrounded by memory barriers. */
44#define __ldcw(a) ({ \ 44#define __ldcw(a) ({ \
45 unsigned __ret; \ 45 unsigned __ret; \
46 __asm__ __volatile__(__LDCW " 0(%1),%0" \ 46 __asm__ __volatile__(__LDCW " 0(%1),%0" \
diff --git a/arch/parisc/include/asm/syscall.h b/arch/parisc/include/asm/syscall.h
index 637ce8d6f375..5e0b4e6bd99d 100644
--- a/arch/parisc/include/asm/syscall.h
+++ b/arch/parisc/include/asm/syscall.h
@@ -8,6 +8,8 @@
8#include <linux/err.h> 8#include <linux/err.h>
9#include <asm/ptrace.h> 9#include <asm/ptrace.h>
10 10
11#define NR_syscalls (__NR_Linux_syscalls)
12
11static inline long syscall_get_nr(struct task_struct *tsk, 13static inline long syscall_get_nr(struct task_struct *tsk,
12 struct pt_regs *regs) 14 struct pt_regs *regs)
13{ 15{
@@ -33,12 +35,19 @@ static inline void syscall_get_arguments(struct task_struct *tsk,
33 args[1] = regs->gr[25]; 35 args[1] = regs->gr[25];
34 case 1: 36 case 1:
35 args[0] = regs->gr[26]; 37 args[0] = regs->gr[26];
38 case 0:
36 break; 39 break;
37 default: 40 default:
38 BUG(); 41 BUG();
39 } 42 }
40} 43}
41 44
45static inline long syscall_get_return_value(struct task_struct *task,
46 struct pt_regs *regs)
47{
48 return regs->gr[28];
49}
50
42static inline void syscall_set_return_value(struct task_struct *task, 51static inline void syscall_set_return_value(struct task_struct *task,
43 struct pt_regs *regs, 52 struct pt_regs *regs,
44 int error, long val) 53 int error, long val)
diff --git a/arch/parisc/include/asm/thread_info.h b/arch/parisc/include/asm/thread_info.h
index e96e693fd58c..7581330ea35b 100644
--- a/arch/parisc/include/asm/thread_info.h
+++ b/arch/parisc/include/asm/thread_info.h
@@ -55,6 +55,7 @@ struct thread_info {
55#define TIF_SINGLESTEP 9 /* single stepping? */ 55#define TIF_SINGLESTEP 9 /* single stepping? */
56#define TIF_BLOCKSTEP 10 /* branch stepping? */ 56#define TIF_BLOCKSTEP 10 /* branch stepping? */
57#define TIF_SECCOMP 11 /* secure computing */ 57#define TIF_SECCOMP 11 /* secure computing */
58#define TIF_SYSCALL_TRACEPOINT 12 /* syscall tracepoint instrumentation */
58 59
59#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 60#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
60#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 61#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
@@ -66,12 +67,13 @@ struct thread_info {
66#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) 67#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
67#define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP) 68#define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP)
68#define _TIF_SECCOMP (1 << TIF_SECCOMP) 69#define _TIF_SECCOMP (1 << TIF_SECCOMP)
70#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
69 71
70#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \ 72#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \
71 _TIF_NEED_RESCHED) 73 _TIF_NEED_RESCHED)
72#define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \ 74#define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
73 _TIF_BLOCKSTEP | _TIF_SYSCALL_AUDIT | \ 75 _TIF_BLOCKSTEP | _TIF_SYSCALL_AUDIT | \
74 _TIF_SECCOMP) 76 _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT)
75 77
76#ifdef CONFIG_64BIT 78#ifdef CONFIG_64BIT
77# ifdef CONFIG_COMPAT 79# ifdef CONFIG_COMPAT
diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h
index 7955e43f3f3f..0f59fd9ca205 100644
--- a/arch/parisc/include/asm/uaccess.h
+++ b/arch/parisc/include/asm/uaccess.h
@@ -40,14 +40,10 @@ static inline long access_ok(int type, const void __user * addr,
40#define get_user __get_user 40#define get_user __get_user
41 41
42#if !defined(CONFIG_64BIT) 42#if !defined(CONFIG_64BIT)
43#define LDD_KERNEL(ptr) BUILD_BUG() 43#define LDD_USER(ptr) __get_user_asm64(ptr)
44#define LDD_USER(ptr) BUILD_BUG()
45#define STD_KERNEL(x, ptr) __put_kernel_asm64(x, ptr)
46#define STD_USER(x, ptr) __put_user_asm64(x, ptr) 44#define STD_USER(x, ptr) __put_user_asm64(x, ptr)
47#else 45#else
48#define LDD_KERNEL(ptr) __get_kernel_asm("ldd", ptr)
49#define LDD_USER(ptr) __get_user_asm("ldd", ptr) 46#define LDD_USER(ptr) __get_user_asm("ldd", ptr)
50#define STD_KERNEL(x, ptr) __put_kernel_asm("std", x, ptr)
51#define STD_USER(x, ptr) __put_user_asm("std", x, ptr) 47#define STD_USER(x, ptr) __put_user_asm("std", x, ptr)
52#endif 48#endif
53 49
@@ -80,70 +76,70 @@ struct exception_data {
80 unsigned long fault_addr; 76 unsigned long fault_addr;
81}; 77};
82 78
79/*
80 * load_sr2() preloads the space register %%sr2 - based on the value of
81 * get_fs() - with either a value of 0 to access kernel space (KERNEL_DS which
82 * is 0), or with the current value of %%sr3 to access user space (USER_DS)
83 * memory. The following __get_user_asm() and __put_user_asm() functions have
84 * %%sr2 hard-coded to access the requested memory.
85 */
86#define load_sr2() \
87 __asm__(" or,= %0,%%r0,%%r0\n\t" \
88 " mfsp %%sr3,%0\n\t" \
89 " mtsp %0,%%sr2\n\t" \
90 : : "r"(get_fs()) : )
91
83#define __get_user(x, ptr) \ 92#define __get_user(x, ptr) \
84({ \ 93({ \
85 register long __gu_err __asm__ ("r8") = 0; \ 94 register long __gu_err __asm__ ("r8") = 0; \
86 register long __gu_val __asm__ ("r9") = 0; \ 95 register long __gu_val __asm__ ("r9") = 0; \
87 \ 96 \
88 if (segment_eq(get_fs(), KERNEL_DS)) { \ 97 load_sr2(); \
89 switch (sizeof(*(ptr))) { \ 98 switch (sizeof(*(ptr))) { \
90 case 1: __get_kernel_asm("ldb", ptr); break; \
91 case 2: __get_kernel_asm("ldh", ptr); break; \
92 case 4: __get_kernel_asm("ldw", ptr); break; \
93 case 8: LDD_KERNEL(ptr); break; \
94 default: BUILD_BUG(); break; \
95 } \
96 } \
97 else { \
98 switch (sizeof(*(ptr))) { \
99 case 1: __get_user_asm("ldb", ptr); break; \ 99 case 1: __get_user_asm("ldb", ptr); break; \
100 case 2: __get_user_asm("ldh", ptr); break; \ 100 case 2: __get_user_asm("ldh", ptr); break; \
101 case 4: __get_user_asm("ldw", ptr); break; \ 101 case 4: __get_user_asm("ldw", ptr); break; \
102 case 8: LDD_USER(ptr); break; \ 102 case 8: LDD_USER(ptr); break; \
103 default: BUILD_BUG(); break; \ 103 default: BUILD_BUG(); break; \
104 } \
105 } \ 104 } \
106 \ 105 \
107 (x) = (__force __typeof__(*(ptr))) __gu_val; \ 106 (x) = (__force __typeof__(*(ptr))) __gu_val; \
108 __gu_err; \ 107 __gu_err; \
109}) 108})
110 109
111#define __get_kernel_asm(ldx, ptr) \ 110#define __get_user_asm(ldx, ptr) \
112 __asm__("\n1:\t" ldx "\t0(%2),%0\n\t" \ 111 __asm__("\n1:\t" ldx "\t0(%%sr2,%2),%0\n\t" \
113 ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_get_user_skip_1)\ 112 ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_get_user_skip_1)\
114 : "=r"(__gu_val), "=r"(__gu_err) \ 113 : "=r"(__gu_val), "=r"(__gu_err) \
115 : "r"(ptr), "1"(__gu_err) \ 114 : "r"(ptr), "1"(__gu_err) \
116 : "r1"); 115 : "r1");
117 116
118#define __get_user_asm(ldx, ptr) \ 117#if !defined(CONFIG_64BIT)
119 __asm__("\n1:\t" ldx "\t0(%%sr3,%2),%0\n\t" \ 118
120 ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_get_user_skip_1)\ 119#define __get_user_asm64(ptr) \
121 : "=r"(__gu_val), "=r"(__gu_err) \ 120 __asm__("\n1:\tldw 0(%%sr2,%2),%0" \
121 "\n2:\tldw 4(%%sr2,%2),%R0\n\t" \
122 ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_get_user_skip_2)\
123 ASM_EXCEPTIONTABLE_ENTRY(2b, fixup_get_user_skip_1)\
124 : "=r"(__gu_val), "=r"(__gu_err) \
122 : "r"(ptr), "1"(__gu_err) \ 125 : "r"(ptr), "1"(__gu_err) \
123 : "r1"); 126 : "r1");
124 127
128#endif /* !defined(CONFIG_64BIT) */
129
130
125#define __put_user(x, ptr) \ 131#define __put_user(x, ptr) \
126({ \ 132({ \
127 register long __pu_err __asm__ ("r8") = 0; \ 133 register long __pu_err __asm__ ("r8") = 0; \
128 __typeof__(*(ptr)) __x = (__typeof__(*(ptr)))(x); \ 134 __typeof__(*(ptr)) __x = (__typeof__(*(ptr)))(x); \
129 \ 135 \
130 if (segment_eq(get_fs(), KERNEL_DS)) { \ 136 load_sr2(); \
131 switch (sizeof(*(ptr))) { \ 137 switch (sizeof(*(ptr))) { \
132 case 1: __put_kernel_asm("stb", __x, ptr); break; \
133 case 2: __put_kernel_asm("sth", __x, ptr); break; \
134 case 4: __put_kernel_asm("stw", __x, ptr); break; \
135 case 8: STD_KERNEL(__x, ptr); break; \
136 default: BUILD_BUG(); break; \
137 } \
138 } \
139 else { \
140 switch (sizeof(*(ptr))) { \
141 case 1: __put_user_asm("stb", __x, ptr); break; \ 138 case 1: __put_user_asm("stb", __x, ptr); break; \
142 case 2: __put_user_asm("sth", __x, ptr); break; \ 139 case 2: __put_user_asm("sth", __x, ptr); break; \
143 case 4: __put_user_asm("stw", __x, ptr); break; \ 140 case 4: __put_user_asm("stw", __x, ptr); break; \
144 case 8: STD_USER(__x, ptr); break; \ 141 case 8: STD_USER(__x, ptr); break; \
145 default: BUILD_BUG(); break; \ 142 default: BUILD_BUG(); break; \
146 } \
147 } \ 143 } \
148 \ 144 \
149 __pu_err; \ 145 __pu_err; \
@@ -159,17 +155,9 @@ struct exception_data {
159 * r8/r9 are already listed as err/val. 155 * r8/r9 are already listed as err/val.
160 */ 156 */
161 157
162#define __put_kernel_asm(stx, x, ptr) \
163 __asm__ __volatile__ ( \
164 "\n1:\t" stx "\t%2,0(%1)\n\t" \
165 ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_put_user_skip_1)\
166 : "=r"(__pu_err) \
167 : "r"(ptr), "r"(x), "0"(__pu_err) \
168 : "r1")
169
170#define __put_user_asm(stx, x, ptr) \ 158#define __put_user_asm(stx, x, ptr) \
171 __asm__ __volatile__ ( \ 159 __asm__ __volatile__ ( \
172 "\n1:\t" stx "\t%2,0(%%sr3,%1)\n\t" \ 160 "\n1:\t" stx "\t%2,0(%%sr2,%1)\n\t" \
173 ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_put_user_skip_1)\ 161 ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_put_user_skip_1)\
174 : "=r"(__pu_err) \ 162 : "=r"(__pu_err) \
175 : "r"(ptr), "r"(x), "0"(__pu_err) \ 163 : "r"(ptr), "r"(x), "0"(__pu_err) \
@@ -178,21 +166,10 @@ struct exception_data {
178 166
179#if !defined(CONFIG_64BIT) 167#if !defined(CONFIG_64BIT)
180 168
181#define __put_kernel_asm64(__val, ptr) do { \
182 __asm__ __volatile__ ( \
183 "\n1:\tstw %2,0(%1)" \
184 "\n2:\tstw %R2,4(%1)\n\t" \
185 ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_put_user_skip_2)\
186 ASM_EXCEPTIONTABLE_ENTRY(2b, fixup_put_user_skip_1)\
187 : "=r"(__pu_err) \
188 : "r"(ptr), "r"(__val), "0"(__pu_err) \
189 : "r1"); \
190} while (0)
191
192#define __put_user_asm64(__val, ptr) do { \ 169#define __put_user_asm64(__val, ptr) do { \
193 __asm__ __volatile__ ( \ 170 __asm__ __volatile__ ( \
194 "\n1:\tstw %2,0(%%sr3,%1)" \ 171 "\n1:\tstw %2,0(%%sr2,%1)" \
195 "\n2:\tstw %R2,4(%%sr3,%1)\n\t" \ 172 "\n2:\tstw %R2,4(%%sr2,%1)\n\t" \
196 ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_put_user_skip_2)\ 173 ASM_EXCEPTIONTABLE_ENTRY(1b, fixup_put_user_skip_2)\
197 ASM_EXCEPTIONTABLE_ENTRY(2b, fixup_put_user_skip_1)\ 174 ASM_EXCEPTIONTABLE_ENTRY(2b, fixup_put_user_skip_1)\
198 : "=r"(__pu_err) \ 175 : "=r"(__pu_err) \
diff --git a/arch/parisc/include/uapi/asm/pdc.h b/arch/parisc/include/uapi/asm/pdc.h
index 702498f7705b..0609ff117f67 100644
--- a/arch/parisc/include/uapi/asm/pdc.h
+++ b/arch/parisc/include/uapi/asm/pdc.h
@@ -59,7 +59,7 @@
59#define PDC_MODEL_GET_BOOT__OP 8 /* returns boot test options */ 59#define PDC_MODEL_GET_BOOT__OP 8 /* returns boot test options */
60#define PDC_MODEL_SET_BOOT__OP 9 /* set boot test options */ 60#define PDC_MODEL_SET_BOOT__OP 9 /* set boot test options */
61 61
62#define PA89_INSTRUCTION_SET 0x4 /* capatibilies returned */ 62#define PA89_INSTRUCTION_SET 0x4 /* capabilities returned */
63#define PA90_INSTRUCTION_SET 0x8 63#define PA90_INSTRUCTION_SET 0x8
64 64
65#define PDC_CACHE 5 /* return/set cache (& TLB) info*/ 65#define PDC_CACHE 5 /* return/set cache (& TLB) info*/
diff --git a/arch/parisc/include/uapi/asm/ptrace.h b/arch/parisc/include/uapi/asm/ptrace.h
index c4fa6c8b9ad9..02ce2eb99a7f 100644
--- a/arch/parisc/include/uapi/asm/ptrace.h
+++ b/arch/parisc/include/uapi/asm/ptrace.h
@@ -13,6 +13,11 @@
13 * N.B. gdb/strace care about the size and offsets within this 13 * N.B. gdb/strace care about the size and offsets within this
14 * structure. If you change things, you may break object compatibility 14 * structure. If you change things, you may break object compatibility
15 * for those applications. 15 * for those applications.
16 *
17 * Please do NOT use this structure for future programs, but use
18 * user_regs_struct (see below) instead.
19 *
20 * It can be accessed through PTRACE_PEEKUSR/PTRACE_POKEUSR only.
16 */ 21 */
17 22
18struct pt_regs { 23struct pt_regs {
@@ -33,6 +38,45 @@ struct pt_regs {
33 unsigned long ipsw; /* CR22 */ 38 unsigned long ipsw; /* CR22 */
34}; 39};
35 40
41/**
42 * struct user_regs_struct - User general purpose registers
43 *
44 * This is the user-visible general purpose register state structure
45 * which is used to define the elf_gregset_t.
46 *
47 * It can be accessed through PTRACE_GETREGSET with NT_PRSTATUS
48 * and through PTRACE_GETREGS.
49 */
50struct user_regs_struct {
51 unsigned long gr[32]; /* PSW is in gr[0] */
52 unsigned long sr[8];
53 unsigned long iaoq[2];
54 unsigned long iasq[2];
55 unsigned long sar; /* CR11 */
56 unsigned long iir; /* CR19 */
57 unsigned long isr; /* CR20 */
58 unsigned long ior; /* CR21 */
59 unsigned long ipsw; /* CR22 */
60 unsigned long cr0;
61 unsigned long cr24, cr25, cr26, cr27, cr28, cr29, cr30, cr31;
62 unsigned long cr8, cr9, cr12, cr13, cr10, cr15;
63 unsigned long _pad[80-64]; /* pad to ELF_NGREG (80) */
64};
65
66/**
67 * struct user_fp_struct - User floating point registers
68 *
69 * This is the user-visible floating point register state structure.
70 * It uses the same layout and size as elf_fpregset_t.
71 *
72 * It can be accessed through PTRACE_GETREGSET with NT_PRFPREG
73 * and through PTRACE_GETFPREGS.
74 */
75struct user_fp_struct {
76 __u64 fr[32];
77};
78
79
36/* 80/*
37 * The numbers chosen here are somewhat arbitrary but absolutely MUST 81 * The numbers chosen here are somewhat arbitrary but absolutely MUST
38 * not overlap with any of the number assigned in <linux/ptrace.h>. 82 * not overlap with any of the number assigned in <linux/ptrace.h>.
@@ -43,5 +87,9 @@ struct pt_regs {
43 */ 87 */
44#define PTRACE_SINGLEBLOCK 12 /* resume execution until next branch */ 88#define PTRACE_SINGLEBLOCK 12 /* resume execution until next branch */
45 89
90#define PTRACE_GETREGS 18
91#define PTRACE_SETREGS 19
92#define PTRACE_GETFPREGS 14
93#define PTRACE_SETFPREGS 15
46 94
47#endif /* _UAPI_PARISC_PTRACE_H */ 95#endif /* _UAPI_PARISC_PTRACE_H */
diff --git a/arch/parisc/include/uapi/asm/unistd.h b/arch/parisc/include/uapi/asm/unistd.h
index cc0ce92c93c7..a9b9407f38f7 100644
--- a/arch/parisc/include/uapi/asm/unistd.h
+++ b/arch/parisc/include/uapi/asm/unistd.h
@@ -102,7 +102,7 @@
102#define __NR_uselib (__NR_Linux + 86) 102#define __NR_uselib (__NR_Linux + 86)
103#define __NR_swapon (__NR_Linux + 87) 103#define __NR_swapon (__NR_Linux + 87)
104#define __NR_reboot (__NR_Linux + 88) 104#define __NR_reboot (__NR_Linux + 88)
105#define __NR_mmap2 (__NR_Linux + 89) 105#define __NR_mmap2 (__NR_Linux + 89)
106#define __NR_mmap (__NR_Linux + 90) 106#define __NR_mmap (__NR_Linux + 90)
107#define __NR_munmap (__NR_Linux + 91) 107#define __NR_munmap (__NR_Linux + 91)
108#define __NR_truncate (__NR_Linux + 92) 108#define __NR_truncate (__NR_Linux + 92)
@@ -114,7 +114,7 @@
114#define __NR_recv (__NR_Linux + 98) 114#define __NR_recv (__NR_Linux + 98)
115#define __NR_statfs (__NR_Linux + 99) 115#define __NR_statfs (__NR_Linux + 99)
116#define __NR_fstatfs (__NR_Linux + 100) 116#define __NR_fstatfs (__NR_Linux + 100)
117#define __NR_stat64 (__NR_Linux + 101) 117#define __NR_stat64 (__NR_Linux + 101)
118/* #define __NR_socketcall (__NR_Linux + 102) */ 118/* #define __NR_socketcall (__NR_Linux + 102) */
119#define __NR_syslog (__NR_Linux + 103) 119#define __NR_syslog (__NR_Linux + 103)
120#define __NR_setitimer (__NR_Linux + 104) 120#define __NR_setitimer (__NR_Linux + 104)
@@ -140,17 +140,17 @@
140#define __NR_adjtimex (__NR_Linux + 124) 140#define __NR_adjtimex (__NR_Linux + 124)
141#define __NR_mprotect (__NR_Linux + 125) 141#define __NR_mprotect (__NR_Linux + 125)
142#define __NR_sigprocmask (__NR_Linux + 126) 142#define __NR_sigprocmask (__NR_Linux + 126)
143#define __NR_create_module (__NR_Linux + 127) 143#define __NR_create_module (__NR_Linux + 127) /* not used */
144#define __NR_init_module (__NR_Linux + 128) 144#define __NR_init_module (__NR_Linux + 128)
145#define __NR_delete_module (__NR_Linux + 129) 145#define __NR_delete_module (__NR_Linux + 129)
146#define __NR_get_kernel_syms (__NR_Linux + 130) 146#define __NR_get_kernel_syms (__NR_Linux + 130) /* not used */
147#define __NR_quotactl (__NR_Linux + 131) 147#define __NR_quotactl (__NR_Linux + 131)
148#define __NR_getpgid (__NR_Linux + 132) 148#define __NR_getpgid (__NR_Linux + 132)
149#define __NR_fchdir (__NR_Linux + 133) 149#define __NR_fchdir (__NR_Linux + 133)
150#define __NR_bdflush (__NR_Linux + 134) 150#define __NR_bdflush (__NR_Linux + 134)
151#define __NR_sysfs (__NR_Linux + 135) 151#define __NR_sysfs (__NR_Linux + 135)
152#define __NR_personality (__NR_Linux + 136) 152#define __NR_personality (__NR_Linux + 136)
153#define __NR_afs_syscall (__NR_Linux + 137) /* Syscall for Andrew File System */ 153#define __NR_afs_syscall (__NR_Linux + 137) /* not used */
154#define __NR_setfsuid (__NR_Linux + 138) 154#define __NR_setfsuid (__NR_Linux + 138)
155#define __NR_setfsgid (__NR_Linux + 139) 155#define __NR_setfsgid (__NR_Linux + 139)
156#define __NR__llseek (__NR_Linux + 140) 156#define __NR__llseek (__NR_Linux + 140)
@@ -180,9 +180,9 @@
180#define __NR_setresuid (__NR_Linux + 164) 180#define __NR_setresuid (__NR_Linux + 164)
181#define __NR_getresuid (__NR_Linux + 165) 181#define __NR_getresuid (__NR_Linux + 165)
182#define __NR_sigaltstack (__NR_Linux + 166) 182#define __NR_sigaltstack (__NR_Linux + 166)
183#define __NR_query_module (__NR_Linux + 167) 183#define __NR_query_module (__NR_Linux + 167) /* not used */
184#define __NR_poll (__NR_Linux + 168) 184#define __NR_poll (__NR_Linux + 168)
185#define __NR_nfsservctl (__NR_Linux + 169) 185#define __NR_nfsservctl (__NR_Linux + 169) /* not used */
186#define __NR_setresgid (__NR_Linux + 170) 186#define __NR_setresgid (__NR_Linux + 170)
187#define __NR_getresgid (__NR_Linux + 171) 187#define __NR_getresgid (__NR_Linux + 171)
188#define __NR_prctl (__NR_Linux + 172) 188#define __NR_prctl (__NR_Linux + 172)
@@ -209,18 +209,16 @@
209#define __NR_shmdt (__NR_Linux + 193) 209#define __NR_shmdt (__NR_Linux + 193)
210#define __NR_shmget (__NR_Linux + 194) 210#define __NR_shmget (__NR_Linux + 194)
211#define __NR_shmctl (__NR_Linux + 195) 211#define __NR_shmctl (__NR_Linux + 195)
212 212#define __NR_getpmsg (__NR_Linux + 196) /* not used */
213#define __NR_getpmsg (__NR_Linux + 196) /* Somebody *wants* streams? */ 213#define __NR_putpmsg (__NR_Linux + 197) /* not used */
214#define __NR_putpmsg (__NR_Linux + 197)
215
216#define __NR_lstat64 (__NR_Linux + 198) 214#define __NR_lstat64 (__NR_Linux + 198)
217#define __NR_truncate64 (__NR_Linux + 199) 215#define __NR_truncate64 (__NR_Linux + 199)
218#define __NR_ftruncate64 (__NR_Linux + 200) 216#define __NR_ftruncate64 (__NR_Linux + 200)
219#define __NR_getdents64 (__NR_Linux + 201) 217#define __NR_getdents64 (__NR_Linux + 201)
220#define __NR_fcntl64 (__NR_Linux + 202) 218#define __NR_fcntl64 (__NR_Linux + 202)
221#define __NR_attrctl (__NR_Linux + 203) 219#define __NR_attrctl (__NR_Linux + 203) /* not used */
222#define __NR_acl_get (__NR_Linux + 204) 220#define __NR_acl_get (__NR_Linux + 204) /* not used */
223#define __NR_acl_set (__NR_Linux + 205) 221#define __NR_acl_set (__NR_Linux + 205) /* not used */
224#define __NR_gettid (__NR_Linux + 206) 222#define __NR_gettid (__NR_Linux + 206)
225#define __NR_readahead (__NR_Linux + 207) 223#define __NR_readahead (__NR_Linux + 207)
226#define __NR_tkill (__NR_Linux + 208) 224#define __NR_tkill (__NR_Linux + 208)
@@ -228,8 +226,8 @@
228#define __NR_futex (__NR_Linux + 210) 226#define __NR_futex (__NR_Linux + 210)
229#define __NR_sched_setaffinity (__NR_Linux + 211) 227#define __NR_sched_setaffinity (__NR_Linux + 211)
230#define __NR_sched_getaffinity (__NR_Linux + 212) 228#define __NR_sched_getaffinity (__NR_Linux + 212)
231#define __NR_set_thread_area (__NR_Linux + 213) 229#define __NR_set_thread_area (__NR_Linux + 213) /* not used */
232#define __NR_get_thread_area (__NR_Linux + 214) 230#define __NR_get_thread_area (__NR_Linux + 214) /* not used */
233#define __NR_io_setup (__NR_Linux + 215) 231#define __NR_io_setup (__NR_Linux + 215)
234#define __NR_io_destroy (__NR_Linux + 216) 232#define __NR_io_destroy (__NR_Linux + 216)
235#define __NR_io_getevents (__NR_Linux + 217) 233#define __NR_io_getevents (__NR_Linux + 217)
@@ -278,7 +276,7 @@
278#define __NR_mbind (__NR_Linux + 260) 276#define __NR_mbind (__NR_Linux + 260)
279#define __NR_get_mempolicy (__NR_Linux + 261) 277#define __NR_get_mempolicy (__NR_Linux + 261)
280#define __NR_set_mempolicy (__NR_Linux + 262) 278#define __NR_set_mempolicy (__NR_Linux + 262)
281#define __NR_vserver (__NR_Linux + 263) 279#define __NR_vserver (__NR_Linux + 263) /* not used */
282#define __NR_add_key (__NR_Linux + 264) 280#define __NR_add_key (__NR_Linux + 264)
283#define __NR_request_key (__NR_Linux + 265) 281#define __NR_request_key (__NR_Linux + 265)
284#define __NR_keyctl (__NR_Linux + 266) 282#define __NR_keyctl (__NR_Linux + 266)
@@ -318,7 +316,7 @@
318#define __NR_kexec_load (__NR_Linux + 300) 316#define __NR_kexec_load (__NR_Linux + 300)
319#define __NR_utimensat (__NR_Linux + 301) 317#define __NR_utimensat (__NR_Linux + 301)
320#define __NR_signalfd (__NR_Linux + 302) 318#define __NR_signalfd (__NR_Linux + 302)
321#define __NR_timerfd (__NR_Linux + 303) 319#define __NR_timerfd (__NR_Linux + 303) /* not used */
322#define __NR_eventfd (__NR_Linux + 304) 320#define __NR_eventfd (__NR_Linux + 304)
323#define __NR_fallocate (__NR_Linux + 305) 321#define __NR_fallocate (__NR_Linux + 305)
324#define __NR_timerfd_create (__NR_Linux + 306) 322#define __NR_timerfd_create (__NR_Linux + 306)
diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
index 39127d3e70e5..baa3d9d6e971 100644
--- a/arch/parisc/kernel/entry.S
+++ b/arch/parisc/kernel/entry.S
@@ -667,7 +667,7 @@
667 * boundary 667 * boundary
668 */ 668 */
669 669
670 .text 670 .section .text.hot
671 .align 2048 671 .align 2048
672 672
673ENTRY(fault_vector_20) 673ENTRY(fault_vector_20)
@@ -2019,6 +2019,7 @@ ftrace_stub:
2019 .procend 2019 .procend
2020ENDPROC(mcount) 2020ENDPROC(mcount)
2021 2021
2022#ifdef CONFIG_FUNCTION_GRAPH_TRACER
2022 .align 8 2023 .align 8
2023 .globl return_to_handler 2024 .globl return_to_handler
2024 .type return_to_handler, @function 2025 .type return_to_handler, @function
@@ -2040,11 +2041,17 @@ parisc_return_to_handler:
2040#endif 2041#endif
2041 2042
2042 /* call ftrace_return_to_handler(0) */ 2043 /* call ftrace_return_to_handler(0) */
2044 .import ftrace_return_to_handler,code
2045 load32 ftrace_return_to_handler,%ret0
2046 load32 .Lftrace_ret,%r2
2043#ifdef CONFIG_64BIT 2047#ifdef CONFIG_64BIT
2044 ldo -16(%sp),%ret1 /* Reference param save area */ 2048 ldo -16(%sp),%ret1 /* Reference param save area */
2049 bve (%ret0)
2050#else
2051 bv %r0(%ret0)
2045#endif 2052#endif
2046 BL ftrace_return_to_handler,%r2
2047 ldi 0,%r26 2053 ldi 0,%r26
2054.Lftrace_ret:
2048 copy %ret0,%rp 2055 copy %ret0,%rp
2049 2056
2050 /* restore original return values */ 2057 /* restore original return values */
@@ -2062,6 +2069,8 @@ parisc_return_to_handler:
2062 .procend 2069 .procend
2063ENDPROC(return_to_handler) 2070ENDPROC(return_to_handler)
2064 2071
2072#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
2073
2065#endif /* CONFIG_FUNCTION_TRACER */ 2074#endif /* CONFIG_FUNCTION_TRACER */
2066 2075
2067#ifdef CONFIG_IRQSTACKS 2076#ifdef CONFIG_IRQSTACKS
diff --git a/arch/parisc/kernel/ftrace.c b/arch/parisc/kernel/ftrace.c
index b13f9ec6f294..a828a0adf52c 100644
--- a/arch/parisc/kernel/ftrace.c
+++ b/arch/parisc/kernel/ftrace.c
@@ -18,12 +18,15 @@
18#include <asm/ftrace.h> 18#include <asm/ftrace.h>
19 19
20 20
21#define __hot __attribute__ ((__section__ (".text.hot")))
22
21#ifdef CONFIG_FUNCTION_GRAPH_TRACER 23#ifdef CONFIG_FUNCTION_GRAPH_TRACER
22/* 24/*
23 * Hook the return address and push it in the stack of return addrs 25 * Hook the return address and push it in the stack of return addrs
24 * in current thread info. 26 * in current thread info.
25 */ 27 */
26static void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr) 28static void __hot prepare_ftrace_return(unsigned long *parent,
29 unsigned long self_addr)
27{ 30{
28 unsigned long old; 31 unsigned long old;
29 struct ftrace_graph_ent trace; 32 struct ftrace_graph_ent trace;
@@ -53,7 +56,7 @@ static void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr
53} 56}
54#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ 57#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
55 58
56void notrace ftrace_function_trampoline(unsigned long parent, 59void notrace __hot ftrace_function_trampoline(unsigned long parent,
57 unsigned long self_addr, 60 unsigned long self_addr,
58 unsigned long org_sp_gr3) 61 unsigned long org_sp_gr3)
59{ 62{
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c
index 8fb81a391599..b5458b37fc5b 100644
--- a/arch/parisc/kernel/ptrace.c
+++ b/arch/parisc/kernel/ptrace.c
@@ -4,18 +4,20 @@
4 * Copyright (C) 2000 Hewlett-Packard Co, Linuxcare Inc. 4 * Copyright (C) 2000 Hewlett-Packard Co, Linuxcare Inc.
5 * Copyright (C) 2000 Matthew Wilcox <matthew@wil.cx> 5 * Copyright (C) 2000 Matthew Wilcox <matthew@wil.cx>
6 * Copyright (C) 2000 David Huggins-Daines <dhd@debian.org> 6 * Copyright (C) 2000 David Huggins-Daines <dhd@debian.org>
7 * Copyright (C) 2008 Helge Deller <deller@gmx.de> 7 * Copyright (C) 2008-2016 Helge Deller <deller@gmx.de>
8 */ 8 */
9 9
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14#include <linux/elf.h>
14#include <linux/errno.h> 15#include <linux/errno.h>
15#include <linux/ptrace.h> 16#include <linux/ptrace.h>
16#include <linux/tracehook.h> 17#include <linux/tracehook.h>
17#include <linux/user.h> 18#include <linux/user.h>
18#include <linux/personality.h> 19#include <linux/personality.h>
20#include <linux/regset.h>
19#include <linux/security.h> 21#include <linux/security.h>
20#include <linux/seccomp.h> 22#include <linux/seccomp.h>
21#include <linux/compat.h> 23#include <linux/compat.h>
@@ -30,6 +32,17 @@
30/* PSW bits we allow the debugger to modify */ 32/* PSW bits we allow the debugger to modify */
31#define USER_PSW_BITS (PSW_N | PSW_B | PSW_V | PSW_CB) 33#define USER_PSW_BITS (PSW_N | PSW_B | PSW_V | PSW_CB)
32 34
35#define CREATE_TRACE_POINTS
36#include <trace/events/syscalls.h>
37
38/*
39 * These are our native regset flavors.
40 */
41enum parisc_regset {
42 REGSET_GENERAL,
43 REGSET_FP
44};
45
33/* 46/*
34 * Called by kernel/ptrace.c when detaching.. 47 * Called by kernel/ptrace.c when detaching..
35 * 48 *
@@ -114,6 +127,7 @@ void user_enable_block_step(struct task_struct *task)
114long arch_ptrace(struct task_struct *child, long request, 127long arch_ptrace(struct task_struct *child, long request,
115 unsigned long addr, unsigned long data) 128 unsigned long addr, unsigned long data)
116{ 129{
130 unsigned long __user *datap = (unsigned long __user *)data;
117 unsigned long tmp; 131 unsigned long tmp;
118 long ret = -EIO; 132 long ret = -EIO;
119 133
@@ -126,7 +140,7 @@ long arch_ptrace(struct task_struct *child, long request,
126 addr >= sizeof(struct pt_regs)) 140 addr >= sizeof(struct pt_regs))
127 break; 141 break;
128 tmp = *(unsigned long *) ((char *) task_regs(child) + addr); 142 tmp = *(unsigned long *) ((char *) task_regs(child) + addr);
129 ret = put_user(tmp, (unsigned long __user *) data); 143 ret = put_user(tmp, datap);
130 break; 144 break;
131 145
132 /* Write the word at location addr in the USER area. This will need 146 /* Write the word at location addr in the USER area. This will need
@@ -165,6 +179,34 @@ long arch_ptrace(struct task_struct *child, long request,
165 } 179 }
166 break; 180 break;
167 181
182 case PTRACE_GETREGS: /* Get all gp regs from the child. */
183 return copy_regset_to_user(child,
184 task_user_regset_view(current),
185 REGSET_GENERAL,
186 0, sizeof(struct user_regs_struct),
187 datap);
188
189 case PTRACE_SETREGS: /* Set all gp regs in the child. */
190 return copy_regset_from_user(child,
191 task_user_regset_view(current),
192 REGSET_GENERAL,
193 0, sizeof(struct user_regs_struct),
194 datap);
195
196 case PTRACE_GETFPREGS: /* Get the child FPU state. */
197 return copy_regset_to_user(child,
198 task_user_regset_view(current),
199 REGSET_FP,
200 0, sizeof(struct user_fp_struct),
201 datap);
202
203 case PTRACE_SETFPREGS: /* Set the child FPU state. */
204 return copy_regset_from_user(child,
205 task_user_regset_view(current),
206 REGSET_FP,
207 0, sizeof(struct user_fp_struct),
208 datap);
209
168 default: 210 default:
169 ret = ptrace_request(child, request, addr, data); 211 ret = ptrace_request(child, request, addr, data);
170 break; 212 break;
@@ -283,6 +325,10 @@ long do_syscall_trace_enter(struct pt_regs *regs)
283 regs->gr[20] = -1UL; 325 regs->gr[20] = -1UL;
284 goto out; 326 goto out;
285 } 327 }
328#ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
329 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
330 trace_sys_enter(regs, regs->gr[20]);
331#endif
286 332
287#ifdef CONFIG_64BIT 333#ifdef CONFIG_64BIT
288 if (!is_compat_task()) 334 if (!is_compat_task())
@@ -311,6 +357,324 @@ void do_syscall_trace_exit(struct pt_regs *regs)
311 357
312 audit_syscall_exit(regs); 358 audit_syscall_exit(regs);
313 359
360#ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
361 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
362 trace_sys_exit(regs, regs->gr[20]);
363#endif
364
314 if (stepping || test_thread_flag(TIF_SYSCALL_TRACE)) 365 if (stepping || test_thread_flag(TIF_SYSCALL_TRACE))
315 tracehook_report_syscall_exit(regs, stepping); 366 tracehook_report_syscall_exit(regs, stepping);
316} 367}
368
369
370/*
371 * regset functions.
372 */
373
374static int fpr_get(struct task_struct *target,
375 const struct user_regset *regset,
376 unsigned int pos, unsigned int count,
377 void *kbuf, void __user *ubuf)
378{
379 struct pt_regs *regs = task_regs(target);
380 __u64 *k = kbuf;
381 __u64 __user *u = ubuf;
382 __u64 reg;
383
384 pos /= sizeof(reg);
385 count /= sizeof(reg);
386
387 if (kbuf)
388 for (; count > 0 && pos < ELF_NFPREG; --count)
389 *k++ = regs->fr[pos++];
390 else
391 for (; count > 0 && pos < ELF_NFPREG; --count)
392 if (__put_user(regs->fr[pos++], u++))
393 return -EFAULT;
394
395 kbuf = k;
396 ubuf = u;
397 pos *= sizeof(reg);
398 count *= sizeof(reg);
399 return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
400 ELF_NFPREG * sizeof(reg), -1);
401}
402
403static int fpr_set(struct task_struct *target,
404 const struct user_regset *regset,
405 unsigned int pos, unsigned int count,
406 const void *kbuf, const void __user *ubuf)
407{
408 struct pt_regs *regs = task_regs(target);
409 const __u64 *k = kbuf;
410 const __u64 __user *u = ubuf;
411 __u64 reg;
412
413 pos /= sizeof(reg);
414 count /= sizeof(reg);
415
416 if (kbuf)
417 for (; count > 0 && pos < ELF_NFPREG; --count)
418 regs->fr[pos++] = *k++;
419 else
420 for (; count > 0 && pos < ELF_NFPREG; --count) {
421 if (__get_user(reg, u++))
422 return -EFAULT;
423 regs->fr[pos++] = reg;
424 }
425
426 kbuf = k;
427 ubuf = u;
428 pos *= sizeof(reg);
429 count *= sizeof(reg);
430 return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
431 ELF_NFPREG * sizeof(reg), -1);
432}
433
434#define RI(reg) (offsetof(struct user_regs_struct,reg) / sizeof(long))
435
436static unsigned long get_reg(struct pt_regs *regs, int num)
437{
438 switch (num) {
439 case RI(gr[0]) ... RI(gr[31]): return regs->gr[num - RI(gr[0])];
440 case RI(sr[0]) ... RI(sr[7]): return regs->sr[num - RI(sr[0])];
441 case RI(iasq[0]): return regs->iasq[0];
442 case RI(iasq[1]): return regs->iasq[1];
443 case RI(iaoq[0]): return regs->iaoq[0];
444 case RI(iaoq[1]): return regs->iaoq[1];
445 case RI(sar): return regs->sar;
446 case RI(iir): return regs->iir;
447 case RI(isr): return regs->isr;
448 case RI(ior): return regs->ior;
449 case RI(ipsw): return regs->ipsw;
450 case RI(cr27): return regs->cr27;
451 case RI(cr0): return mfctl(0);
452 case RI(cr24): return mfctl(24);
453 case RI(cr25): return mfctl(25);
454 case RI(cr26): return mfctl(26);
455 case RI(cr28): return mfctl(28);
456 case RI(cr29): return mfctl(29);
457 case RI(cr30): return mfctl(30);
458 case RI(cr31): return mfctl(31);
459 case RI(cr8): return mfctl(8);
460 case RI(cr9): return mfctl(9);
461 case RI(cr12): return mfctl(12);
462 case RI(cr13): return mfctl(13);
463 case RI(cr10): return mfctl(10);
464 case RI(cr15): return mfctl(15);
465 default: return 0;
466 }
467}
468
469static void set_reg(struct pt_regs *regs, int num, unsigned long val)
470{
471 switch (num) {
472 case RI(gr[0]): /*
473 * PSW is in gr[0].
474 * Allow writing to Nullify, Divide-step-correction,
475 * and carry/borrow bits.
476 * BEWARE, if you set N, and then single step, it won't
477 * stop on the nullified instruction.
478 */
479 val &= USER_PSW_BITS;
480 regs->gr[0] &= ~USER_PSW_BITS;
481 regs->gr[0] |= val;
482 return;
483 case RI(gr[1]) ... RI(gr[31]):
484 regs->gr[num - RI(gr[0])] = val;
485 return;
486 case RI(iaoq[0]):
487 case RI(iaoq[1]):
488 regs->iaoq[num - RI(iaoq[0])] = val;
489 return;
490 case RI(sar): regs->sar = val;
491 return;
492 default: return;
493#if 0
494 /* do not allow to change any of the following registers (yet) */
495 case RI(sr[0]) ... RI(sr[7]): return regs->sr[num - RI(sr[0])];
496 case RI(iasq[0]): return regs->iasq[0];
497 case RI(iasq[1]): return regs->iasq[1];
498 case RI(iir): return regs->iir;
499 case RI(isr): return regs->isr;
500 case RI(ior): return regs->ior;
501 case RI(ipsw): return regs->ipsw;
502 case RI(cr27): return regs->cr27;
503 case cr0, cr24, cr25, cr26, cr27, cr28, cr29, cr30, cr31;
504 case cr8, cr9, cr12, cr13, cr10, cr15;
505#endif
506 }
507}
508
509static int gpr_get(struct task_struct *target,
510 const struct user_regset *regset,
511 unsigned int pos, unsigned int count,
512 void *kbuf, void __user *ubuf)
513{
514 struct pt_regs *regs = task_regs(target);
515 unsigned long *k = kbuf;
516 unsigned long __user *u = ubuf;
517 unsigned long reg;
518
519 pos /= sizeof(reg);
520 count /= sizeof(reg);
521
522 if (kbuf)
523 for (; count > 0 && pos < ELF_NGREG; --count)
524 *k++ = get_reg(regs, pos++);
525 else
526 for (; count > 0 && pos < ELF_NGREG; --count)
527 if (__put_user(get_reg(regs, pos++), u++))
528 return -EFAULT;
529 kbuf = k;
530 ubuf = u;
531 pos *= sizeof(reg);
532 count *= sizeof(reg);
533 return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
534 ELF_NGREG * sizeof(reg), -1);
535}
536
537static int gpr_set(struct task_struct *target,
538 const struct user_regset *regset,
539 unsigned int pos, unsigned int count,
540 const void *kbuf, const void __user *ubuf)
541{
542 struct pt_regs *regs = task_regs(target);
543 const unsigned long *k = kbuf;
544 const unsigned long __user *u = ubuf;
545 unsigned long reg;
546
547 pos /= sizeof(reg);
548 count /= sizeof(reg);
549
550 if (kbuf)
551 for (; count > 0 && pos < ELF_NGREG; --count)
552 set_reg(regs, pos++, *k++);
553 else
554 for (; count > 0 && pos < ELF_NGREG; --count) {
555 if (__get_user(reg, u++))
556 return -EFAULT;
557 set_reg(regs, pos++, reg);
558 }
559
560 kbuf = k;
561 ubuf = u;
562 pos *= sizeof(reg);
563 count *= sizeof(reg);
564 return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
565 ELF_NGREG * sizeof(reg), -1);
566}
567
568static const struct user_regset native_regsets[] = {
569 [REGSET_GENERAL] = {
570 .core_note_type = NT_PRSTATUS, .n = ELF_NGREG,
571 .size = sizeof(long), .align = sizeof(long),
572 .get = gpr_get, .set = gpr_set
573 },
574 [REGSET_FP] = {
575 .core_note_type = NT_PRFPREG, .n = ELF_NFPREG,
576 .size = sizeof(__u64), .align = sizeof(__u64),
577 .get = fpr_get, .set = fpr_set
578 }
579};
580
581static const struct user_regset_view user_parisc_native_view = {
582 .name = "parisc", .e_machine = ELF_ARCH, .ei_osabi = ELFOSABI_LINUX,
583 .regsets = native_regsets, .n = ARRAY_SIZE(native_regsets)
584};
585
586#ifdef CONFIG_64BIT
587#include <linux/compat.h>
588
589static int gpr32_get(struct task_struct *target,
590 const struct user_regset *regset,
591 unsigned int pos, unsigned int count,
592 void *kbuf, void __user *ubuf)
593{
594 struct pt_regs *regs = task_regs(target);
595 compat_ulong_t *k = kbuf;
596 compat_ulong_t __user *u = ubuf;
597 compat_ulong_t reg;
598
599 pos /= sizeof(reg);
600 count /= sizeof(reg);
601
602 if (kbuf)
603 for (; count > 0 && pos < ELF_NGREG; --count)
604 *k++ = get_reg(regs, pos++);
605 else
606 for (; count > 0 && pos < ELF_NGREG; --count)
607 if (__put_user((compat_ulong_t) get_reg(regs, pos++), u++))
608 return -EFAULT;
609
610 kbuf = k;
611 ubuf = u;
612 pos *= sizeof(reg);
613 count *= sizeof(reg);
614 return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
615 ELF_NGREG * sizeof(reg), -1);
616}
617
618static int gpr32_set(struct task_struct *target,
619 const struct user_regset *regset,
620 unsigned int pos, unsigned int count,
621 const void *kbuf, const void __user *ubuf)
622{
623 struct pt_regs *regs = task_regs(target);
624 const compat_ulong_t *k = kbuf;
625 const compat_ulong_t __user *u = ubuf;
626 compat_ulong_t reg;
627
628 pos /= sizeof(reg);
629 count /= sizeof(reg);
630
631 if (kbuf)
632 for (; count > 0 && pos < ELF_NGREG; --count)
633 set_reg(regs, pos++, *k++);
634 else
635 for (; count > 0 && pos < ELF_NGREG; --count) {
636 if (__get_user(reg, u++))
637 return -EFAULT;
638 set_reg(regs, pos++, reg);
639 }
640
641 kbuf = k;
642 ubuf = u;
643 pos *= sizeof(reg);
644 count *= sizeof(reg);
645 return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
646 ELF_NGREG * sizeof(reg), -1);
647}
648
649/*
650 * These are the regset flavors matching the 32bit native set.
651 */
652static const struct user_regset compat_regsets[] = {
653 [REGSET_GENERAL] = {
654 .core_note_type = NT_PRSTATUS, .n = ELF_NGREG,
655 .size = sizeof(compat_long_t), .align = sizeof(compat_long_t),
656 .get = gpr32_get, .set = gpr32_set
657 },
658 [REGSET_FP] = {
659 .core_note_type = NT_PRFPREG, .n = ELF_NFPREG,
660 .size = sizeof(__u64), .align = sizeof(__u64),
661 .get = fpr_get, .set = fpr_set
662 }
663};
664
665static const struct user_regset_view user_parisc_compat_view = {
666 .name = "parisc", .e_machine = EM_PARISC, .ei_osabi = ELFOSABI_LINUX,
667 .regsets = compat_regsets, .n = ARRAY_SIZE(compat_regsets)
668};
669#endif /* CONFIG_64BIT */
670
671const struct user_regset_view *task_user_regset_view(struct task_struct *task)
672{
673 BUILD_BUG_ON(sizeof(struct user_regs_struct)/sizeof(long) != ELF_NGREG);
674 BUILD_BUG_ON(sizeof(struct user_fp_struct)/sizeof(__u64) != ELF_NFPREG);
675#ifdef CONFIG_64BIT
676 if (is_compat_task())
677 return &user_parisc_compat_view;
678#endif
679 return &user_parisc_native_view;
680}
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
index 57b4836b7ecd..d03422e5f188 100644
--- a/arch/parisc/kernel/syscall.S
+++ b/arch/parisc/kernel/syscall.S
@@ -912,6 +912,7 @@ END(lws_table)
912 912
913 .align 8 913 .align 8
914ENTRY(sys_call_table) 914ENTRY(sys_call_table)
915 .export sys_call_table,data
915#include "syscall_table.S" 916#include "syscall_table.S"
916END(sys_call_table) 917END(sys_call_table)
917 918
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index 400acac0a304..58dd6801f5be 100644
--- a/arch/parisc/kernel/time.c
+++ b/arch/parisc/kernel/time.c
@@ -38,6 +38,18 @@
38 38
39static unsigned long clocktick __read_mostly; /* timer cycles per tick */ 39static unsigned long clocktick __read_mostly; /* timer cycles per tick */
40 40
41#ifndef CONFIG_64BIT
42/*
43 * The processor-internal cycle counter (Control Register 16) is used as time
44 * source for the sched_clock() function. This register is 64bit wide on a
45 * 64-bit kernel and 32bit on a 32-bit kernel. Since sched_clock() always
46 * requires a 64bit counter we emulate on the 32-bit kernel the higher 32bits
47 * with a per-cpu variable which we increase every time the counter
48 * wraps-around (which happens every ~4 secounds).
49 */
50static DEFINE_PER_CPU(unsigned long, cr16_high_32_bits);
51#endif
52
41/* 53/*
42 * We keep time on PA-RISC Linux by using the Interval Timer which is 54 * We keep time on PA-RISC Linux by using the Interval Timer which is
43 * a pair of registers; one is read-only and one is write-only; both 55 * a pair of registers; one is read-only and one is write-only; both
@@ -108,6 +120,12 @@ irqreturn_t __irq_entry timer_interrupt(int irq, void *dev_id)
108 */ 120 */
109 mtctl(next_tick, 16); 121 mtctl(next_tick, 16);
110 122
123#if !defined(CONFIG_64BIT)
124 /* check for overflow on a 32bit kernel (every ~4 seconds). */
125 if (unlikely(next_tick < now))
126 this_cpu_inc(cr16_high_32_bits);
127#endif
128
111 /* Skip one clocktick on purpose if we missed next_tick. 129 /* Skip one clocktick on purpose if we missed next_tick.
112 * The new CR16 must be "later" than current CR16 otherwise 130 * The new CR16 must be "later" than current CR16 otherwise
113 * itimer would not fire until CR16 wrapped - e.g 4 seconds 131 * itimer would not fire until CR16 wrapped - e.g 4 seconds
@@ -219,6 +237,12 @@ void __init start_cpu_itimer(void)
219 unsigned int cpu = smp_processor_id(); 237 unsigned int cpu = smp_processor_id();
220 unsigned long next_tick = mfctl(16) + clocktick; 238 unsigned long next_tick = mfctl(16) + clocktick;
221 239
240#if defined(CONFIG_HAVE_UNSTABLE_SCHED_CLOCK) && defined(CONFIG_64BIT)
241 /* With multiple 64bit CPUs online, the cr16's are not syncronized. */
242 if (cpu != 0)
243 clear_sched_clock_stable();
244#endif
245
222 mtctl(next_tick, 16); /* kick off Interval Timer (CR16) */ 246 mtctl(next_tick, 16); /* kick off Interval Timer (CR16) */
223 247
224 per_cpu(cpu_data, cpu).it_value = next_tick; 248 per_cpu(cpu_data, cpu).it_value = next_tick;
@@ -246,15 +270,52 @@ void read_persistent_clock(struct timespec *ts)
246 } 270 }
247} 271}
248 272
273
274/*
275 * sched_clock() framework
276 */
277
278static u32 cyc2ns_mul __read_mostly;
279static u32 cyc2ns_shift __read_mostly;
280
281u64 sched_clock(void)
282{
283 u64 now;
284
285 /* Get current cycle counter (Control Register 16). */
286#ifdef CONFIG_64BIT
287 now = mfctl(16);
288#else
289 now = mfctl(16) + (((u64) this_cpu_read(cr16_high_32_bits)) << 32);
290#endif
291
292 /* return the value in ns (cycles_2_ns) */
293 return mul_u64_u32_shr(now, cyc2ns_mul, cyc2ns_shift);
294}
295
296
297/*
298 * timer interrupt and sched_clock() initialization
299 */
300
249void __init time_init(void) 301void __init time_init(void)
250{ 302{
251 unsigned long current_cr16_khz; 303 unsigned long current_cr16_khz;
252 304
305 current_cr16_khz = PAGE0->mem_10msec/10; /* kHz */
253 clocktick = (100 * PAGE0->mem_10msec) / HZ; 306 clocktick = (100 * PAGE0->mem_10msec) / HZ;
254 307
308 /* calculate mult/shift values for cr16 */
309 clocks_calc_mult_shift(&cyc2ns_mul, &cyc2ns_shift, current_cr16_khz,
310 NSEC_PER_MSEC, 0);
311
312#if defined(CONFIG_HAVE_UNSTABLE_SCHED_CLOCK) && defined(CONFIG_64BIT)
313 /* At bootup only one 64bit CPU is online and cr16 is "stable" */
314 set_sched_clock_stable();
315#endif
316
255 start_cpu_itimer(); /* get CPU 0 started */ 317 start_cpu_itimer(); /* get CPU 0 started */
256 318
257 /* register at clocksource framework */ 319 /* register at clocksource framework */
258 current_cr16_khz = PAGE0->mem_10msec/10; /* kHz */
259 clocksource_register_khz(&clocksource_cr16, current_cr16_khz); 320 clocksource_register_khz(&clocksource_cr16, current_cr16_khz);
260} 321}
diff --git a/arch/parisc/lib/bitops.c b/arch/parisc/lib/bitops.c
index 187118841af1..8e45b0a97abf 100644
--- a/arch/parisc/lib/bitops.c
+++ b/arch/parisc/lib/bitops.c
@@ -55,11 +55,10 @@ unsigned long __xchg8(char x, char *ptr)
55} 55}
56 56
57 57
58#ifdef CONFIG_64BIT 58u64 __cmpxchg_u64(volatile u64 *ptr, u64 old, u64 new)
59unsigned long __cmpxchg_u64(volatile unsigned long *ptr, unsigned long old, unsigned long new)
60{ 59{
61 unsigned long flags; 60 unsigned long flags;
62 unsigned long prev; 61 u64 prev;
63 62
64 _atomic_spin_lock_irqsave(ptr, flags); 63 _atomic_spin_lock_irqsave(ptr, flags);
65 if ((prev = *ptr) == old) 64 if ((prev = *ptr) == old)
@@ -67,7 +66,6 @@ unsigned long __cmpxchg_u64(volatile unsigned long *ptr, unsigned long old, unsi
67 _atomic_spin_unlock_irqrestore(ptr, flags); 66 _atomic_spin_unlock_irqrestore(ptr, flags);
68 return prev; 67 return prev;
69} 68}
70#endif
71 69
72unsigned long __cmpxchg_u32(volatile unsigned int *ptr, unsigned int old, unsigned int new) 70unsigned long __cmpxchg_u32(volatile unsigned int *ptr, unsigned int old, unsigned int new)
73{ 71{
diff --git a/arch/parisc/math-emu/fpudispatch.c b/arch/parisc/math-emu/fpudispatch.c
index 673b73e8420d..18df1237c93c 100644
--- a/arch/parisc/math-emu/fpudispatch.c
+++ b/arch/parisc/math-emu/fpudispatch.c
@@ -184,7 +184,7 @@ static void parisc_linux_get_fpu_type(u_int fpregs[])
184 184
185/* 185/*
186 * this routine will decode the excepting floating point instruction and 186 * this routine will decode the excepting floating point instruction and
187 * call the approiate emulation routine. 187 * call the appropriate emulation routine.
188 * It is called by decode_fpu with the following parameters: 188 * It is called by decode_fpu with the following parameters:
189 * fpudispatch(current_ir, unimplemented_code, 0, &Fpu_register) 189 * fpudispatch(current_ir, unimplemented_code, 0, &Fpu_register)
190 * where current_ir is the instruction to be emulated, 190 * where current_ir is the instruction to be emulated,
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 7947e568e057..2e58549b2f02 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -1234,6 +1234,10 @@ TEST_F(TRACE_poke, getpid_runs_normally)
1234# define ARCH_REGS struct user_pt_regs 1234# define ARCH_REGS struct user_pt_regs
1235# define SYSCALL_NUM regs[8] 1235# define SYSCALL_NUM regs[8]
1236# define SYSCALL_RET regs[0] 1236# define SYSCALL_RET regs[0]
1237#elif defined(__hppa__)
1238# define ARCH_REGS struct user_regs_struct
1239# define SYSCALL_NUM gr[20]
1240# define SYSCALL_RET gr[28]
1237#elif defined(__powerpc__) 1241#elif defined(__powerpc__)
1238# define ARCH_REGS struct pt_regs 1242# define ARCH_REGS struct pt_regs
1239# define SYSCALL_NUM gpr[0] 1243# define SYSCALL_NUM gpr[0]
@@ -1303,7 +1307,7 @@ void change_syscall(struct __test_metadata *_metadata,
1303 EXPECT_EQ(0, ret); 1307 EXPECT_EQ(0, ret);
1304 1308
1305#if defined(__x86_64__) || defined(__i386__) || defined(__powerpc__) || \ 1309#if defined(__x86_64__) || defined(__i386__) || defined(__powerpc__) || \
1306 defined(__s390__) 1310 defined(__s390__) || defined(__hppa__)
1307 { 1311 {
1308 regs.SYSCALL_NUM = syscall; 1312 regs.SYSCALL_NUM = syscall;
1309 } 1313 }
@@ -1505,6 +1509,8 @@ TEST_F(TRACE_syscall, syscall_dropped)
1505# define __NR_seccomp 383 1509# define __NR_seccomp 383
1506# elif defined(__aarch64__) 1510# elif defined(__aarch64__)
1507# define __NR_seccomp 277 1511# define __NR_seccomp 277
1512# elif defined(__hppa__)
1513# define __NR_seccomp 338
1508# elif defined(__powerpc__) 1514# elif defined(__powerpc__)
1509# define __NR_seccomp 358 1515# define __NR_seccomp 358
1510# elif defined(__s390__) 1516# elif defined(__s390__)
diff --git a/tools/testing/selftests/vm/thuge-gen.c b/tools/testing/selftests/vm/thuge-gen.c
index c87957295f74..0bc737a75150 100644
--- a/tools/testing/selftests/vm/thuge-gen.c
+++ b/tools/testing/selftests/vm/thuge-gen.c
@@ -30,7 +30,9 @@
30#define MAP_HUGE_1GB (30 << MAP_HUGE_SHIFT) 30#define MAP_HUGE_1GB (30 << MAP_HUGE_SHIFT)
31#define MAP_HUGE_SHIFT 26 31#define MAP_HUGE_SHIFT 26
32#define MAP_HUGE_MASK 0x3f 32#define MAP_HUGE_MASK 0x3f
33#if !defined(MAP_HUGETLB)
33#define MAP_HUGETLB 0x40000 34#define MAP_HUGETLB 0x40000
35#endif
34 36
35#define SHM_HUGETLB 04000 /* segment will use huge TLB pages */ 37#define SHM_HUGETLB 04000 /* segment will use huge TLB pages */
36#define SHM_HUGE_SHIFT 26 38#define SHM_HUGE_SHIFT 26