aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-27 21:42:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-27 21:42:52 -0400
commit17bb51d56cdc8cbf252031db3107de034cfeb44c (patch)
treef9fb2c16b29a152d3413fa0028e660e3b6146584 /arch
parent0671b7674f42ab3a200401ea0e48d6f47d34acae (diff)
parent95aac7b1cd224f568fb83937044cd303ff11b029 (diff)
Merge branch 'akpm-incoming-2'
* akpm-incoming-2: (139 commits) epoll: make epoll_wait() use the hrtimer range feature select: rename estimate_accuracy() to select_estimate_accuracy() Remove duplicate includes from many files ramoops: use the platform data structure instead of module params kernel/resource.c: handle reinsertion of an already-inserted resource kfifo: fix kfifo_alloc() to return a signed int value w1: don't allow arbitrary users to remove w1 devices alpha: remove dma64_addr_t usage mips: remove dma64_addr_t usage sparc: remove dma64_addr_t usage fuse: use release_pages() taskstats: use real microsecond granularity for CPU times taskstats: split fill_pid function taskstats: separate taskstats commands delayacct: align to 8 byte boundary on 64-bit systems delay-accounting: reimplement -c for getdelays.c to report information on a target command namespaces Kconfig: move namespace menu location after the cgroup namespaces Kconfig: remove the cgroup device whitelist experimental tag namespaces Kconfig: remove pointless cgroup dependency namespaces Kconfig: make namespace a submenu ...
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/pci_iommu.c4
-rw-r--r--arch/alpha/kernel/ptrace.c7
-rw-r--r--arch/arm/kernel/ptrace.c28
-rw-r--r--arch/arm/mach-tegra/timer.c1
-rw-r--r--arch/arm/mm/highmem.c3
-rw-r--r--arch/arm/plat-nomadik/include/plat/ste_dma40.h1
-rw-r--r--arch/avr32/kernel/ptrace.c11
-rw-r--r--arch/blackfin/kernel/ptrace.c16
-rw-r--r--arch/cris/arch-v10/kernel/ptrace.c20
-rw-r--r--arch/cris/arch-v32/kernel/ptrace.c16
-rw-r--r--arch/frv/kernel/ptrace.c32
-rw-r--r--arch/frv/mm/highmem.c3
-rw-r--r--arch/h8300/kernel/ptrace.c33
-rw-r--r--arch/ia64/include/asm/cputime.h6
-rw-r--r--arch/ia64/kernel/ptrace.c3
-rw-r--r--arch/m32r/kernel/ptrace.c11
-rw-r--r--arch/m68k/kernel/ptrace.c51
-rw-r--r--arch/m68knommu/kernel/ptrace.c57
-rw-r--r--arch/microblaze/kernel/ptrace.c5
-rw-r--r--arch/mips/include/asm/pci/bridge.h2
-rw-r--r--arch/mips/kernel/ptrace.c25
-rw-r--r--arch/mips/mm/highmem.c3
-rw-r--r--arch/mn10300/include/asm/highmem.h4
-rw-r--r--arch/mn10300/kernel/ptrace.c20
-rw-r--r--arch/parisc/kernel/ptrace.c13
-rw-r--r--arch/powerpc/include/asm/cputime.h12
-rw-r--r--arch/powerpc/kernel/ptrace.c66
-rw-r--r--arch/powerpc/mm/highmem.c4
-rw-r--r--arch/powerpc/sysdev/fsl_rio.c76
-rw-r--r--arch/s390/include/asm/cputime.h10
-rw-r--r--arch/s390/kernel/ptrace.c3
-rw-r--r--arch/score/kernel/ptrace.c7
-rw-r--r--arch/sh/kernel/ptrace_32.c45
-rw-r--r--arch/sh/kernel/ptrace_64.c25
-rw-r--r--arch/sparc/include/asm/io_32.h31
-rw-r--r--arch/sparc/include/asm/io_64.h31
-rw-r--r--arch/sparc/include/asm/pci_64.h2
-rw-r--r--arch/sparc/kernel/ptrace_32.c57
-rw-r--r--arch/sparc/kernel/ptrace_64.c15
-rw-r--r--arch/sparc/mm/highmem.c4
-rw-r--r--arch/tile/Kconfig3
-rw-r--r--arch/tile/kernel/ptrace.c13
-rw-r--r--arch/tile/kernel/setup.c2
-rw-r--r--arch/tile/mm/highmem.c3
-rw-r--r--arch/um/kernel/ptrace.c23
-rw-r--r--arch/um/sys-i386/ptrace.c4
-rw-r--r--arch/um/sys-x86_64/ptrace.c11
-rw-r--r--arch/x86/kernel/ptrace.c17
-rw-r--r--arch/x86/mm/highmem_32.c3
-rw-r--r--arch/x86/mm/init_64.c1
-rw-r--r--arch/x86/mm/iomap_32.c3
-rw-r--r--arch/x86/xen/enlighten.c1
-rw-r--r--arch/xtensa/kernel/ptrace.c14
53 files changed, 482 insertions, 379 deletions
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index d1dbd9acd1df..022c2748fa41 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -223,7 +223,7 @@ iommu_arena_free(struct pci_iommu_arena *arena, long ofs, long n)
223 */ 223 */
224static int pci_dac_dma_supported(struct pci_dev *dev, u64 mask) 224static int pci_dac_dma_supported(struct pci_dev *dev, u64 mask)
225{ 225{
226 dma64_addr_t dac_offset = alpha_mv.pci_dac_offset; 226 dma_addr_t dac_offset = alpha_mv.pci_dac_offset;
227 int ok = 1; 227 int ok = 1;
228 228
229 /* If this is not set, the machine doesn't support DAC at all. */ 229 /* If this is not set, the machine doesn't support DAC at all. */
@@ -756,7 +756,7 @@ static void alpha_pci_unmap_sg(struct device *dev, struct scatterlist *sg,
756 spin_lock_irqsave(&arena->lock, flags); 756 spin_lock_irqsave(&arena->lock, flags);
757 757
758 for (end = sg + nents; sg < end; ++sg) { 758 for (end = sg + nents; sg < end; ++sg) {
759 dma64_addr_t addr; 759 dma_addr_t addr;
760 size_t size; 760 size_t size;
761 long npages, ofs; 761 long npages, ofs;
762 dma_addr_t tend; 762 dma_addr_t tend;
diff --git a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c
index baa903602f6a..e2af5eb59bb4 100644
--- a/arch/alpha/kernel/ptrace.c
+++ b/arch/alpha/kernel/ptrace.c
@@ -269,7 +269,8 @@ void ptrace_disable(struct task_struct *child)
269 user_disable_single_step(child); 269 user_disable_single_step(child);
270} 270}
271 271
272long arch_ptrace(struct task_struct *child, long request, long addr, long data) 272long arch_ptrace(struct task_struct *child, long request,
273 unsigned long addr, unsigned long data)
273{ 274{
274 unsigned long tmp; 275 unsigned long tmp;
275 size_t copied; 276 size_t copied;
@@ -292,7 +293,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
292 case PTRACE_PEEKUSR: 293 case PTRACE_PEEKUSR:
293 force_successful_syscall_return(); 294 force_successful_syscall_return();
294 ret = get_reg(child, addr); 295 ret = get_reg(child, addr);
295 DBG(DBG_MEM, ("peek $%ld->%#lx\n", addr, ret)); 296 DBG(DBG_MEM, ("peek $%lu->%#lx\n", addr, ret));
296 break; 297 break;
297 298
298 /* When I and D space are separate, this will have to be fixed. */ 299 /* When I and D space are separate, this will have to be fixed. */
@@ -302,7 +303,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
302 break; 303 break;
303 304
304 case PTRACE_POKEUSR: /* write the specified register */ 305 case PTRACE_POKEUSR: /* write the specified register */
305 DBG(DBG_MEM, ("poke $%ld<-%#lx\n", addr, data)); 306 DBG(DBG_MEM, ("poke $%lu<-%#lx\n", addr, data));
306 ret = put_reg(child, addr, data); 307 ret = put_reg(child, addr, data);
307 break; 308 break;
308 default: 309 default:
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index e0cb6370ed14..3e97483abcf0 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -1075,13 +1075,15 @@ out:
1075} 1075}
1076#endif 1076#endif
1077 1077
1078long arch_ptrace(struct task_struct *child, long request, long addr, long data) 1078long arch_ptrace(struct task_struct *child, long request,
1079 unsigned long addr, unsigned long data)
1079{ 1080{
1080 int ret; 1081 int ret;
1082 unsigned long __user *datap = (unsigned long __user *) data;
1081 1083
1082 switch (request) { 1084 switch (request) {
1083 case PTRACE_PEEKUSR: 1085 case PTRACE_PEEKUSR:
1084 ret = ptrace_read_user(child, addr, (unsigned long __user *)data); 1086 ret = ptrace_read_user(child, addr, datap);
1085 break; 1087 break;
1086 1088
1087 case PTRACE_POKEUSR: 1089 case PTRACE_POKEUSR:
@@ -1089,34 +1091,34 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
1089 break; 1091 break;
1090 1092
1091 case PTRACE_GETREGS: 1093 case PTRACE_GETREGS:
1092 ret = ptrace_getregs(child, (void __user *)data); 1094 ret = ptrace_getregs(child, datap);
1093 break; 1095 break;
1094 1096
1095 case PTRACE_SETREGS: 1097 case PTRACE_SETREGS:
1096 ret = ptrace_setregs(child, (void __user *)data); 1098 ret = ptrace_setregs(child, datap);
1097 break; 1099 break;
1098 1100
1099 case PTRACE_GETFPREGS: 1101 case PTRACE_GETFPREGS:
1100 ret = ptrace_getfpregs(child, (void __user *)data); 1102 ret = ptrace_getfpregs(child, datap);
1101 break; 1103 break;
1102 1104
1103 case PTRACE_SETFPREGS: 1105 case PTRACE_SETFPREGS:
1104 ret = ptrace_setfpregs(child, (void __user *)data); 1106 ret = ptrace_setfpregs(child, datap);
1105 break; 1107 break;
1106 1108
1107#ifdef CONFIG_IWMMXT 1109#ifdef CONFIG_IWMMXT
1108 case PTRACE_GETWMMXREGS: 1110 case PTRACE_GETWMMXREGS:
1109 ret = ptrace_getwmmxregs(child, (void __user *)data); 1111 ret = ptrace_getwmmxregs(child, datap);
1110 break; 1112 break;
1111 1113
1112 case PTRACE_SETWMMXREGS: 1114 case PTRACE_SETWMMXREGS:
1113 ret = ptrace_setwmmxregs(child, (void __user *)data); 1115 ret = ptrace_setwmmxregs(child, datap);
1114 break; 1116 break;
1115#endif 1117#endif
1116 1118
1117 case PTRACE_GET_THREAD_AREA: 1119 case PTRACE_GET_THREAD_AREA:
1118 ret = put_user(task_thread_info(child)->tp_value, 1120 ret = put_user(task_thread_info(child)->tp_value,
1119 (unsigned long __user *) data); 1121 datap);
1120 break; 1122 break;
1121 1123
1122 case PTRACE_SET_SYSCALL: 1124 case PTRACE_SET_SYSCALL:
@@ -1126,21 +1128,21 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
1126 1128
1127#ifdef CONFIG_CRUNCH 1129#ifdef CONFIG_CRUNCH
1128 case PTRACE_GETCRUNCHREGS: 1130 case PTRACE_GETCRUNCHREGS:
1129 ret = ptrace_getcrunchregs(child, (void __user *)data); 1131 ret = ptrace_getcrunchregs(child, datap);
1130 break; 1132 break;
1131 1133
1132 case PTRACE_SETCRUNCHREGS: 1134 case PTRACE_SETCRUNCHREGS:
1133 ret = ptrace_setcrunchregs(child, (void __user *)data); 1135 ret = ptrace_setcrunchregs(child, datap);
1134 break; 1136 break;
1135#endif 1137#endif
1136 1138
1137#ifdef CONFIG_VFP 1139#ifdef CONFIG_VFP
1138 case PTRACE_GETVFPREGS: 1140 case PTRACE_GETVFPREGS:
1139 ret = ptrace_getvfpregs(child, (void __user *)data); 1141 ret = ptrace_getvfpregs(child, datap);
1140 break; 1142 break;
1141 1143
1142 case PTRACE_SETVFPREGS: 1144 case PTRACE_SETVFPREGS:
1143 ret = ptrace_setvfpregs(child, (void __user *)data); 1145 ret = ptrace_setvfpregs(child, datap);
1144 break; 1146 break;
1145#endif 1147#endif
1146 1148
diff --git a/arch/arm/mach-tegra/timer.c b/arch/arm/mach-tegra/timer.c
index 2f420210d406..9057d6fd1d31 100644
--- a/arch/arm/mach-tegra/timer.c
+++ b/arch/arm/mach-tegra/timer.c
@@ -28,7 +28,6 @@
28#include <linux/cnt32_to_63.h> 28#include <linux/cnt32_to_63.h>
29 29
30#include <asm/mach/time.h> 30#include <asm/mach/time.h>
31#include <asm/mach/time.h>
32#include <asm/localtimer.h> 31#include <asm/localtimer.h>
33 32
34#include <mach/iomap.h> 33#include <mach/iomap.h>
diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c
index c00f119babbf..c435fd9e1da9 100644
--- a/arch/arm/mm/highmem.c
+++ b/arch/arm/mm/highmem.c
@@ -89,7 +89,7 @@ void __kunmap_atomic(void *kvaddr)
89 int idx, type; 89 int idx, type;
90 90
91 if (kvaddr >= (void *)FIXADDR_START) { 91 if (kvaddr >= (void *)FIXADDR_START) {
92 type = kmap_atomic_idx_pop(); 92 type = kmap_atomic_idx();
93 idx = type + KM_TYPE_NR * smp_processor_id(); 93 idx = type + KM_TYPE_NR * smp_processor_id();
94 94
95 if (cache_is_vivt()) 95 if (cache_is_vivt())
@@ -101,6 +101,7 @@ void __kunmap_atomic(void *kvaddr)
101#else 101#else
102 (void) idx; /* to kill a warning */ 102 (void) idx; /* to kill a warning */
103#endif 103#endif
104 kmap_atomic_idx_pop();
104 } else if (vaddr >= PKMAP_ADDR(0) && vaddr < PKMAP_ADDR(LAST_PKMAP)) { 105 } else if (vaddr >= PKMAP_ADDR(0) && vaddr < PKMAP_ADDR(LAST_PKMAP)) {
105 /* this address was obtained through kmap_high_get() */ 106 /* this address was obtained through kmap_high_get() */
106 kunmap_high(pte_page(pkmap_page_table[PKMAP_NR(vaddr)])); 107 kunmap_high(pte_page(pkmap_page_table[PKMAP_NR(vaddr)]));
diff --git a/arch/arm/plat-nomadik/include/plat/ste_dma40.h b/arch/arm/plat-nomadik/include/plat/ste_dma40.h
index 5fbde4b8dc12..93a812672d9a 100644
--- a/arch/arm/plat-nomadik/include/plat/ste_dma40.h
+++ b/arch/arm/plat-nomadik/include/plat/ste_dma40.h
@@ -14,7 +14,6 @@
14#include <linux/dmaengine.h> 14#include <linux/dmaengine.h>
15#include <linux/workqueue.h> 15#include <linux/workqueue.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/dmaengine.h>
18 17
19/* dev types for memcpy */ 18/* dev types for memcpy */
20#define STEDMA40_DEV_DST_MEMORY (-1) 19#define STEDMA40_DEV_DST_MEMORY (-1)
diff --git a/arch/avr32/kernel/ptrace.c b/arch/avr32/kernel/ptrace.c
index 5e73c25f8f85..4aedcab7cd4b 100644
--- a/arch/avr32/kernel/ptrace.c
+++ b/arch/avr32/kernel/ptrace.c
@@ -146,9 +146,11 @@ static int ptrace_setregs(struct task_struct *tsk, const void __user *uregs)
146 return ret; 146 return ret;
147} 147}
148 148
149long arch_ptrace(struct task_struct *child, long request, long addr, long data) 149long arch_ptrace(struct task_struct *child, long request,
150 unsigned long addr, unsigned long data)
150{ 151{
151 int ret; 152 int ret;
153 void __user *datap = (void __user *) data;
152 154
153 switch (request) { 155 switch (request) {
154 /* Read the word at location addr in the child process */ 156 /* Read the word at location addr in the child process */
@@ -158,8 +160,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
158 break; 160 break;
159 161
160 case PTRACE_PEEKUSR: 162 case PTRACE_PEEKUSR:
161 ret = ptrace_read_user(child, addr, 163 ret = ptrace_read_user(child, addr, datap);
162 (unsigned long __user *)data);
163 break; 164 break;
164 165
165 /* Write the word in data at location addr */ 166 /* Write the word in data at location addr */
@@ -173,11 +174,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
173 break; 174 break;
174 175
175 case PTRACE_GETREGS: 176 case PTRACE_GETREGS:
176 ret = ptrace_getregs(child, (void __user *)data); 177 ret = ptrace_getregs(child, datap);
177 break; 178 break;
178 179
179 case PTRACE_SETREGS: 180 case PTRACE_SETREGS:
180 ret = ptrace_setregs(child, (const void __user *)data); 181 ret = ptrace_setregs(child, datap);
181 break; 182 break;
182 183
183 default: 184 default:
diff --git a/arch/blackfin/kernel/ptrace.c b/arch/blackfin/kernel/ptrace.c
index b35839354130..75089f80855d 100644
--- a/arch/blackfin/kernel/ptrace.c
+++ b/arch/blackfin/kernel/ptrace.c
@@ -38,12 +38,13 @@
38 * Get contents of register REGNO in task TASK. 38 * Get contents of register REGNO in task TASK.
39 */ 39 */
40static inline long 40static inline long
41get_reg(struct task_struct *task, long regno, unsigned long __user *datap) 41get_reg(struct task_struct *task, unsigned long regno,
42 unsigned long __user *datap)
42{ 43{
43 long tmp; 44 long tmp;
44 struct pt_regs *regs = task_pt_regs(task); 45 struct pt_regs *regs = task_pt_regs(task);
45 46
46 if (regno & 3 || regno > PT_LAST_PSEUDO || regno < 0) 47 if (regno & 3 || regno > PT_LAST_PSEUDO)
47 return -EIO; 48 return -EIO;
48 49
49 switch (regno) { 50 switch (regno) {
@@ -74,11 +75,11 @@ get_reg(struct task_struct *task, long regno, unsigned long __user *datap)
74 * Write contents of register REGNO in task TASK. 75 * Write contents of register REGNO in task TASK.
75 */ 76 */
76static inline int 77static inline int
77put_reg(struct task_struct *task, long regno, unsigned long data) 78put_reg(struct task_struct *task, unsigned long regno, unsigned long data)
78{ 79{
79 struct pt_regs *regs = task_pt_regs(task); 80 struct pt_regs *regs = task_pt_regs(task);
80 81
81 if (regno & 3 || regno > PT_LAST_PSEUDO || regno < 0) 82 if (regno & 3 || regno > PT_LAST_PSEUDO)
82 return -EIO; 83 return -EIO;
83 84
84 switch (regno) { 85 switch (regno) {
@@ -240,7 +241,8 @@ void user_disable_single_step(struct task_struct *child)
240 clear_tsk_thread_flag(child, TIF_SINGLESTEP); 241 clear_tsk_thread_flag(child, TIF_SINGLESTEP);
241} 242}
242 243
243long arch_ptrace(struct task_struct *child, long request, long addr, long data) 244long arch_ptrace(struct task_struct *child, long request,
245 unsigned long addr, unsigned long data)
244{ 246{
245 int ret; 247 int ret;
246 unsigned long __user *datap = (unsigned long __user *)data; 248 unsigned long __user *datap = (unsigned long __user *)data;
@@ -368,14 +370,14 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
368 return copy_regset_to_user(child, &user_bfin_native_view, 370 return copy_regset_to_user(child, &user_bfin_native_view,
369 REGSET_GENERAL, 371 REGSET_GENERAL,
370 0, sizeof(struct pt_regs), 372 0, sizeof(struct pt_regs),
371 (void __user *)data); 373 datap);
372 374
373 case PTRACE_SETREGS: 375 case PTRACE_SETREGS:
374 pr_debug("ptrace: PTRACE_SETREGS\n"); 376 pr_debug("ptrace: PTRACE_SETREGS\n");
375 return copy_regset_from_user(child, &user_bfin_native_view, 377 return copy_regset_from_user(child, &user_bfin_native_view,
376 REGSET_GENERAL, 378 REGSET_GENERAL,
377 0, sizeof(struct pt_regs), 379 0, sizeof(struct pt_regs),
378 (const void __user *)data); 380 datap);
379 381
380 case_default: 382 case_default:
381 default: 383 default:
diff --git a/arch/cris/arch-v10/kernel/ptrace.c b/arch/cris/arch-v10/kernel/ptrace.c
index e70c804e9377..320065f3cbe5 100644
--- a/arch/cris/arch-v10/kernel/ptrace.c
+++ b/arch/cris/arch-v10/kernel/ptrace.c
@@ -76,9 +76,11 @@ ptrace_disable(struct task_struct *child)
76 * (in user space) where the result of the ptrace call is written (instead of 76 * (in user space) where the result of the ptrace call is written (instead of
77 * being returned). 77 * being returned).
78 */ 78 */
79long arch_ptrace(struct task_struct *child, long request, long addr, long data) 79long arch_ptrace(struct task_struct *child, long request,
80 unsigned long addr, unsigned long data)
80{ 81{
81 int ret; 82 int ret;
83 unsigned int regno = addr >> 2;
82 unsigned long __user *datap = (unsigned long __user *)data; 84 unsigned long __user *datap = (unsigned long __user *)data;
83 85
84 switch (request) { 86 switch (request) {
@@ -93,10 +95,10 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
93 unsigned long tmp; 95 unsigned long tmp;
94 96
95 ret = -EIO; 97 ret = -EIO;
96 if ((addr & 3) || addr < 0 || addr > PT_MAX << 2) 98 if ((addr & 3) || regno > PT_MAX)
97 break; 99 break;
98 100
99 tmp = get_reg(child, addr >> 2); 101 tmp = get_reg(child, regno);
100 ret = put_user(tmp, datap); 102 ret = put_user(tmp, datap);
101 break; 103 break;
102 } 104 }
@@ -110,19 +112,17 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
110 /* Write the word at location address in the USER area. */ 112 /* Write the word at location address in the USER area. */
111 case PTRACE_POKEUSR: 113 case PTRACE_POKEUSR:
112 ret = -EIO; 114 ret = -EIO;
113 if ((addr & 3) || addr < 0 || addr > PT_MAX << 2) 115 if ((addr & 3) || regno > PT_MAX)
114 break; 116 break;
115 117
116 addr >>= 2; 118 if (regno == PT_DCCR) {
117
118 if (addr == PT_DCCR) {
119 /* don't allow the tracing process to change stuff like 119 /* don't allow the tracing process to change stuff like
120 * interrupt enable, kernel/user bit, dma enables etc. 120 * interrupt enable, kernel/user bit, dma enables etc.
121 */ 121 */
122 data &= DCCR_MASK; 122 data &= DCCR_MASK;
123 data |= get_reg(child, PT_DCCR) & ~DCCR_MASK; 123 data |= get_reg(child, PT_DCCR) & ~DCCR_MASK;
124 } 124 }
125 if (put_reg(child, addr, data)) 125 if (put_reg(child, regno, data))
126 break; 126 break;
127 ret = 0; 127 ret = 0;
128 break; 128 break;
@@ -141,7 +141,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
141 break; 141 break;
142 } 142 }
143 143
144 data += sizeof(long); 144 datap++;
145 } 145 }
146 146
147 break; 147 break;
@@ -165,7 +165,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
165 } 165 }
166 166
167 put_reg(child, i, tmp); 167 put_reg(child, i, tmp);
168 data += sizeof(long); 168 datap++;
169 } 169 }
170 170
171 break; 171 break;
diff --git a/arch/cris/arch-v32/kernel/ptrace.c b/arch/cris/arch-v32/kernel/ptrace.c
index f4ebd1e7d0f5..511ece94a574 100644
--- a/arch/cris/arch-v32/kernel/ptrace.c
+++ b/arch/cris/arch-v32/kernel/ptrace.c
@@ -126,9 +126,11 @@ ptrace_disable(struct task_struct *child)
126} 126}
127 127
128 128
129long arch_ptrace(struct task_struct *child, long request, long addr, long data) 129long arch_ptrace(struct task_struct *child, long request,
130 unsigned long addr, unsigned long data)
130{ 131{
131 int ret; 132 int ret;
133 unsigned int regno = addr >> 2;
132 unsigned long __user *datap = (unsigned long __user *)data; 134 unsigned long __user *datap = (unsigned long __user *)data;
133 135
134 switch (request) { 136 switch (request) {
@@ -163,10 +165,10 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
163 unsigned long tmp; 165 unsigned long tmp;
164 166
165 ret = -EIO; 167 ret = -EIO;
166 if ((addr & 3) || addr < 0 || addr > PT_MAX << 2) 168 if ((addr & 3) || regno > PT_MAX)
167 break; 169 break;
168 170
169 tmp = get_reg(child, addr >> 2); 171 tmp = get_reg(child, regno);
170 ret = put_user(tmp, datap); 172 ret = put_user(tmp, datap);
171 break; 173 break;
172 } 174 }
@@ -180,19 +182,17 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
180 /* Write the word at location address in the USER area. */ 182 /* Write the word at location address in the USER area. */
181 case PTRACE_POKEUSR: 183 case PTRACE_POKEUSR:
182 ret = -EIO; 184 ret = -EIO;
183 if ((addr & 3) || addr < 0 || addr > PT_MAX << 2) 185 if ((addr & 3) || regno > PT_MAX)
184 break; 186 break;
185 187
186 addr >>= 2; 188 if (regno == PT_CCS) {
187
188 if (addr == PT_CCS) {
189 /* don't allow the tracing process to change stuff like 189 /* don't allow the tracing process to change stuff like
190 * interrupt enable, kernel/user bit, dma enables etc. 190 * interrupt enable, kernel/user bit, dma enables etc.
191 */ 191 */
192 data &= CCS_MASK; 192 data &= CCS_MASK;
193 data |= get_reg(child, PT_CCS) & ~CCS_MASK; 193 data |= get_reg(child, PT_CCS) & ~CCS_MASK;
194 } 194 }
195 if (put_reg(child, addr, data)) 195 if (put_reg(child, regno, data))
196 break; 196 break;
197 ret = 0; 197 ret = 0;
198 break; 198 break;
diff --git a/arch/frv/kernel/ptrace.c b/arch/frv/kernel/ptrace.c
index fac028936a04..9d68f7fac730 100644
--- a/arch/frv/kernel/ptrace.c
+++ b/arch/frv/kernel/ptrace.c
@@ -254,23 +254,26 @@ void ptrace_disable(struct task_struct *child)
254 user_disable_single_step(child); 254 user_disable_single_step(child);
255} 255}
256 256
257long arch_ptrace(struct task_struct *child, long request, long addr, long data) 257long arch_ptrace(struct task_struct *child, long request,
258 unsigned long addr, unsigned long data)
258{ 259{
259 unsigned long tmp; 260 unsigned long tmp;
260 int ret; 261 int ret;
262 int regno = addr >> 2;
263 unsigned long __user *datap = (unsigned long __user *) data;
261 264
262 switch (request) { 265 switch (request) {
263 /* read the word at location addr in the USER area. */ 266 /* read the word at location addr in the USER area. */
264 case PTRACE_PEEKUSR: { 267 case PTRACE_PEEKUSR: {
265 tmp = 0; 268 tmp = 0;
266 ret = -EIO; 269 ret = -EIO;
267 if ((addr & 3) || addr < 0) 270 if (addr & 3)
268 break; 271 break;
269 272
270 ret = 0; 273 ret = 0;
271 switch (addr >> 2) { 274 switch (regno) {
272 case 0 ... PT__END - 1: 275 case 0 ... PT__END - 1:
273 tmp = get_reg(child, addr >> 2); 276 tmp = get_reg(child, regno);
274 break; 277 break;
275 278
276 case PT__END + 0: 279 case PT__END + 0:
@@ -299,23 +302,18 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
299 } 302 }
300 303
301 if (ret == 0) 304 if (ret == 0)
302 ret = put_user(tmp, (unsigned long *) data); 305 ret = put_user(tmp, datap);
303 break; 306 break;
304 } 307 }
305 308
306 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ 309 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
307 ret = -EIO; 310 ret = -EIO;
308 if ((addr & 3) || addr < 0) 311 if (addr & 3)
309 break; 312 break;
310 313
311 ret = 0; 314 switch (regno) {
312 switch (addr >> 2) {
313 case 0 ... PT__END - 1: 315 case 0 ... PT__END - 1:
314 ret = put_reg(child, addr >> 2, data); 316 ret = put_reg(child, regno, data);
315 break;
316
317 default:
318 ret = -EIO;
319 break; 317 break;
320 } 318 }
321 break; 319 break;
@@ -324,25 +322,25 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
324 return copy_regset_to_user(child, &user_frv_native_view, 322 return copy_regset_to_user(child, &user_frv_native_view,
325 REGSET_GENERAL, 323 REGSET_GENERAL,
326 0, sizeof(child->thread.user->i), 324 0, sizeof(child->thread.user->i),
327 (void __user *)data); 325 datap);
328 326
329 case PTRACE_SETREGS: /* Set all integer regs in the child. */ 327 case PTRACE_SETREGS: /* Set all integer regs in the child. */
330 return copy_regset_from_user(child, &user_frv_native_view, 328 return copy_regset_from_user(child, &user_frv_native_view,
331 REGSET_GENERAL, 329 REGSET_GENERAL,
332 0, sizeof(child->thread.user->i), 330 0, sizeof(child->thread.user->i),
333 (const void __user *)data); 331 datap);
334 332
335 case PTRACE_GETFPREGS: /* Get the child FP/Media state. */ 333 case PTRACE_GETFPREGS: /* Get the child FP/Media state. */
336 return copy_regset_to_user(child, &user_frv_native_view, 334 return copy_regset_to_user(child, &user_frv_native_view,
337 REGSET_FPMEDIA, 335 REGSET_FPMEDIA,
338 0, sizeof(child->thread.user->f), 336 0, sizeof(child->thread.user->f),
339 (void __user *)data); 337 datap);
340 338
341 case PTRACE_SETFPREGS: /* Set the child FP/Media state. */ 339 case PTRACE_SETFPREGS: /* Set the child FP/Media state. */
342 return copy_regset_from_user(child, &user_frv_native_view, 340 return copy_regset_from_user(child, &user_frv_native_view,
343 REGSET_FPMEDIA, 341 REGSET_FPMEDIA,
344 0, sizeof(child->thread.user->f), 342 0, sizeof(child->thread.user->f),
345 (const void __user *)data); 343 datap);
346 344
347 default: 345 default:
348 ret = ptrace_request(child, request, addr, data); 346 ret = ptrace_request(child, request, addr, data);
diff --git a/arch/frv/mm/highmem.c b/arch/frv/mm/highmem.c
index 61088dcc1594..fd7fcd4c2e33 100644
--- a/arch/frv/mm/highmem.c
+++ b/arch/frv/mm/highmem.c
@@ -68,7 +68,7 @@ EXPORT_SYMBOL(__kmap_atomic);
68 68
69void __kunmap_atomic(void *kvaddr) 69void __kunmap_atomic(void *kvaddr)
70{ 70{
71 int type = kmap_atomic_idx_pop(); 71 int type = kmap_atomic_idx();
72 switch (type) { 72 switch (type) {
73 case 0: __kunmap_atomic_primary(4, 6); break; 73 case 0: __kunmap_atomic_primary(4, 6); break;
74 case 1: __kunmap_atomic_primary(5, 7); break; 74 case 1: __kunmap_atomic_primary(5, 7); break;
@@ -83,6 +83,7 @@ void __kunmap_atomic(void *kvaddr)
83 default: 83 default:
84 BUG(); 84 BUG();
85 } 85 }
86 kmap_atomic_idx_pop();
86 pagefault_enable(); 87 pagefault_enable();
87} 88}
88EXPORT_SYMBOL(__kunmap_atomic); 89EXPORT_SYMBOL(__kunmap_atomic);
diff --git a/arch/h8300/kernel/ptrace.c b/arch/h8300/kernel/ptrace.c
index df114122ebdf..497fa89b5df4 100644
--- a/arch/h8300/kernel/ptrace.c
+++ b/arch/h8300/kernel/ptrace.c
@@ -50,27 +50,29 @@ void ptrace_disable(struct task_struct *child)
50 user_disable_single_step(child); 50 user_disable_single_step(child);
51} 51}
52 52
53long arch_ptrace(struct task_struct *child, long request, long addr, long data) 53long arch_ptrace(struct task_struct *child, long request,
54 unsigned long addr, unsigned long data)
54{ 55{
55 int ret; 56 int ret;
57 int regno = addr >> 2;
58 unsigned long __user *datap = (unsigned long __user *) data;
56 59
57 switch (request) { 60 switch (request) {
58 /* read the word at location addr in the USER area. */ 61 /* read the word at location addr in the USER area. */
59 case PTRACE_PEEKUSR: { 62 case PTRACE_PEEKUSR: {
60 unsigned long tmp = 0; 63 unsigned long tmp = 0;
61 64
62 if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) { 65 if ((addr & 3) || addr >= sizeof(struct user)) {
63 ret = -EIO; 66 ret = -EIO;
64 break ; 67 break ;
65 } 68 }
66 69
67 ret = 0; /* Default return condition */ 70 ret = 0; /* Default return condition */
68 addr = addr >> 2; /* temporary hack. */
69 71
70 if (addr < H8300_REGS_NO) 72 if (regno < H8300_REGS_NO)
71 tmp = h8300_get_reg(child, addr); 73 tmp = h8300_get_reg(child, regno);
72 else { 74 else {
73 switch(addr) { 75 switch (regno) {
74 case 49: 76 case 49:
75 tmp = child->mm->start_code; 77 tmp = child->mm->start_code;
76 break ; 78 break ;
@@ -88,24 +90,23 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
88 } 90 }
89 } 91 }
90 if (!ret) 92 if (!ret)
91 ret = put_user(tmp,(unsigned long *) data); 93 ret = put_user(tmp, datap);
92 break ; 94 break ;
93 } 95 }
94 96
95 /* when I and D space are separate, this will have to be fixed. */ 97 /* when I and D space are separate, this will have to be fixed. */
96 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ 98 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
97 if ((addr & 3) || addr < 0 || addr >= sizeof(struct user)) { 99 if ((addr & 3) || addr >= sizeof(struct user)) {
98 ret = -EIO; 100 ret = -EIO;
99 break ; 101 break ;
100 } 102 }
101 addr = addr >> 2; /* temporary hack. */
102 103
103 if (addr == PT_ORIG_ER0) { 104 if (regno == PT_ORIG_ER0) {
104 ret = -EIO; 105 ret = -EIO;
105 break ; 106 break ;
106 } 107 }
107 if (addr < H8300_REGS_NO) { 108 if (regno < H8300_REGS_NO) {
108 ret = h8300_put_reg(child, addr, data); 109 ret = h8300_put_reg(child, regno, data);
109 break ; 110 break ;
110 } 111 }
111 ret = -EIO; 112 ret = -EIO;
@@ -116,11 +117,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
116 unsigned long tmp; 117 unsigned long tmp;
117 for (i = 0; i < H8300_REGS_NO; i++) { 118 for (i = 0; i < H8300_REGS_NO; i++) {
118 tmp = h8300_get_reg(child, i); 119 tmp = h8300_get_reg(child, i);
119 if (put_user(tmp, (unsigned long *) data)) { 120 if (put_user(tmp, datap)) {
120 ret = -EFAULT; 121 ret = -EFAULT;
121 break; 122 break;
122 } 123 }
123 data += sizeof(long); 124 datap++;
124 } 125 }
125 ret = 0; 126 ret = 0;
126 break; 127 break;
@@ -130,12 +131,12 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
130 int i; 131 int i;
131 unsigned long tmp; 132 unsigned long tmp;
132 for (i = 0; i < H8300_REGS_NO; i++) { 133 for (i = 0; i < H8300_REGS_NO; i++) {
133 if (get_user(tmp, (unsigned long *) data)) { 134 if (get_user(tmp, datap)) {
134 ret = -EFAULT; 135 ret = -EFAULT;
135 break; 136 break;
136 } 137 }
137 h8300_put_reg(child, i, tmp); 138 h8300_put_reg(child, i, tmp);
138 data += sizeof(long); 139 datap++;
139 } 140 }
140 ret = 0; 141 ret = 0;
141 break; 142 break;
diff --git a/arch/ia64/include/asm/cputime.h b/arch/ia64/include/asm/cputime.h
index 7fa8a8594660..6073b187528a 100644
--- a/arch/ia64/include/asm/cputime.h
+++ b/arch/ia64/include/asm/cputime.h
@@ -56,10 +56,10 @@ typedef u64 cputime64_t;
56#define jiffies64_to_cputime64(__jif) ((__jif) * (NSEC_PER_SEC / HZ)) 56#define jiffies64_to_cputime64(__jif) ((__jif) * (NSEC_PER_SEC / HZ))
57 57
58/* 58/*
59 * Convert cputime <-> milliseconds 59 * Convert cputime <-> microseconds
60 */ 60 */
61#define cputime_to_msecs(__ct) ((__ct) / NSEC_PER_MSEC) 61#define cputime_to_usecs(__ct) ((__ct) / NSEC_PER_USEC)
62#define msecs_to_cputime(__msecs) ((__msecs) * NSEC_PER_MSEC) 62#define usecs_to_cputime(__usecs) ((__usecs) * NSEC_PER_USEC)
63 63
64/* 64/*
65 * Convert cputime <-> seconds 65 * Convert cputime <-> seconds
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
index 7c7909f9bc93..8848f43d819e 100644
--- a/arch/ia64/kernel/ptrace.c
+++ b/arch/ia64/kernel/ptrace.c
@@ -1177,7 +1177,8 @@ ptrace_disable (struct task_struct *child)
1177} 1177}
1178 1178
1179long 1179long
1180arch_ptrace (struct task_struct *child, long request, long addr, long data) 1180arch_ptrace (struct task_struct *child, long request,
1181 unsigned long addr, unsigned long data)
1181{ 1182{
1182 switch (request) { 1183 switch (request) {
1183 case PTRACE_PEEKTEXT: 1184 case PTRACE_PEEKTEXT:
diff --git a/arch/m32r/kernel/ptrace.c b/arch/m32r/kernel/ptrace.c
index 0021ade4cba8..20743754f2b2 100644
--- a/arch/m32r/kernel/ptrace.c
+++ b/arch/m32r/kernel/ptrace.c
@@ -622,9 +622,11 @@ void ptrace_disable(struct task_struct *child)
622} 622}
623 623
624long 624long
625arch_ptrace(struct task_struct *child, long request, long addr, long data) 625arch_ptrace(struct task_struct *child, long request,
626 unsigned long addr, unsigned long data)
626{ 627{
627 int ret; 628 int ret;
629 unsigned long __user *datap = (unsigned long __user *) data;
628 630
629 switch (request) { 631 switch (request) {
630 /* 632 /*
@@ -639,8 +641,7 @@ arch_ptrace(struct task_struct *child, long request, long addr, long data)
639 * read the word at location addr in the USER area. 641 * read the word at location addr in the USER area.
640 */ 642 */
641 case PTRACE_PEEKUSR: 643 case PTRACE_PEEKUSR:
642 ret = ptrace_read_user(child, addr, 644 ret = ptrace_read_user(child, addr, datap);
643 (unsigned long __user *)data);
644 break; 645 break;
645 646
646 /* 647 /*
@@ -661,11 +662,11 @@ arch_ptrace(struct task_struct *child, long request, long addr, long data)
661 break; 662 break;
662 663
663 case PTRACE_GETREGS: 664 case PTRACE_GETREGS:
664 ret = ptrace_getregs(child, (void __user *)data); 665 ret = ptrace_getregs(child, datap);
665 break; 666 break;
666 667
667 case PTRACE_SETREGS: 668 case PTRACE_SETREGS:
668 ret = ptrace_setregs(child, (void __user *)data); 669 ret = ptrace_setregs(child, datap);
669 break; 670 break;
670 671
671 default: 672 default:
diff --git a/arch/m68k/kernel/ptrace.c b/arch/m68k/kernel/ptrace.c
index 616e59752c29..0b252683cefb 100644
--- a/arch/m68k/kernel/ptrace.c
+++ b/arch/m68k/kernel/ptrace.c
@@ -156,55 +156,57 @@ void user_disable_single_step(struct task_struct *child)
156 singlestep_disable(child); 156 singlestep_disable(child);
157} 157}
158 158
159long arch_ptrace(struct task_struct *child, long request, long addr, long data) 159long arch_ptrace(struct task_struct *child, long request,
160 unsigned long addr, unsigned long data)
160{ 161{
161 unsigned long tmp; 162 unsigned long tmp;
162 int i, ret = 0; 163 int i, ret = 0;
164 int regno = addr >> 2; /* temporary hack. */
165 unsigned long __user *datap = (unsigned long __user *) data;
163 166
164 switch (request) { 167 switch (request) {
165 /* read the word at location addr in the USER area. */ 168 /* read the word at location addr in the USER area. */
166 case PTRACE_PEEKUSR: 169 case PTRACE_PEEKUSR:
167 if (addr & 3) 170 if (addr & 3)
168 goto out_eio; 171 goto out_eio;
169 addr >>= 2; /* temporary hack. */
170 172
171 if (addr >= 0 && addr < 19) { 173 if (regno >= 0 && regno < 19) {
172 tmp = get_reg(child, addr); 174 tmp = get_reg(child, regno);
173 } else if (addr >= 21 && addr < 49) { 175 } else if (regno >= 21 && regno < 49) {
174 tmp = child->thread.fp[addr - 21]; 176 tmp = child->thread.fp[regno - 21];
175 /* Convert internal fpu reg representation 177 /* Convert internal fpu reg representation
176 * into long double format 178 * into long double format
177 */ 179 */
178 if (FPU_IS_EMU && (addr < 45) && !(addr % 3)) 180 if (FPU_IS_EMU && (regno < 45) && !(regno % 3))
179 tmp = ((tmp & 0xffff0000) << 15) | 181 tmp = ((tmp & 0xffff0000) << 15) |
180 ((tmp & 0x0000ffff) << 16); 182 ((tmp & 0x0000ffff) << 16);
181 } else 183 } else
182 goto out_eio; 184 goto out_eio;
183 ret = put_user(tmp, (unsigned long *)data); 185 ret = put_user(tmp, datap);
184 break; 186 break;
185 187
186 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ 188 case PTRACE_POKEUSR:
189 /* write the word at location addr in the USER area */
187 if (addr & 3) 190 if (addr & 3)
188 goto out_eio; 191 goto out_eio;
189 addr >>= 2; /* temporary hack. */
190 192
191 if (addr == PT_SR) { 193 if (regno == PT_SR) {
192 data &= SR_MASK; 194 data &= SR_MASK;
193 data |= get_reg(child, PT_SR) & ~SR_MASK; 195 data |= get_reg(child, PT_SR) & ~SR_MASK;
194 } 196 }
195 if (addr >= 0 && addr < 19) { 197 if (regno >= 0 && regno < 19) {
196 if (put_reg(child, addr, data)) 198 if (put_reg(child, regno, data))
197 goto out_eio; 199 goto out_eio;
198 } else if (addr >= 21 && addr < 48) { 200 } else if (regno >= 21 && regno < 48) {
199 /* Convert long double format 201 /* Convert long double format
200 * into internal fpu reg representation 202 * into internal fpu reg representation
201 */ 203 */
202 if (FPU_IS_EMU && (addr < 45) && !(addr % 3)) { 204 if (FPU_IS_EMU && (regno < 45) && !(regno % 3)) {
203 data = (unsigned long)data << 15; 205 data <<= 15;
204 data = (data & 0xffff0000) | 206 data = (data & 0xffff0000) |
205 ((data & 0x0000ffff) >> 1); 207 ((data & 0x0000ffff) >> 1);
206 } 208 }
207 child->thread.fp[addr - 21] = data; 209 child->thread.fp[regno - 21] = data;
208 } else 210 } else
209 goto out_eio; 211 goto out_eio;
210 break; 212 break;
@@ -212,16 +214,16 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
212 case PTRACE_GETREGS: /* Get all gp regs from the child. */ 214 case PTRACE_GETREGS: /* Get all gp regs from the child. */
213 for (i = 0; i < 19; i++) { 215 for (i = 0; i < 19; i++) {
214 tmp = get_reg(child, i); 216 tmp = get_reg(child, i);
215 ret = put_user(tmp, (unsigned long *)data); 217 ret = put_user(tmp, datap);
216 if (ret) 218 if (ret)
217 break; 219 break;
218 data += sizeof(long); 220 datap++;
219 } 221 }
220 break; 222 break;
221 223
222 case PTRACE_SETREGS: /* Set all gp regs in the child. */ 224 case PTRACE_SETREGS: /* Set all gp regs in the child. */
223 for (i = 0; i < 19; i++) { 225 for (i = 0; i < 19; i++) {
224 ret = get_user(tmp, (unsigned long *)data); 226 ret = get_user(tmp, datap);
225 if (ret) 227 if (ret)
226 break; 228 break;
227 if (i == PT_SR) { 229 if (i == PT_SR) {
@@ -229,25 +231,24 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
229 tmp |= get_reg(child, PT_SR) & ~SR_MASK; 231 tmp |= get_reg(child, PT_SR) & ~SR_MASK;
230 } 232 }
231 put_reg(child, i, tmp); 233 put_reg(child, i, tmp);
232 data += sizeof(long); 234 datap++;
233 } 235 }
234 break; 236 break;
235 237
236 case PTRACE_GETFPREGS: /* Get the child FPU state. */ 238 case PTRACE_GETFPREGS: /* Get the child FPU state. */
237 if (copy_to_user((void *)data, &child->thread.fp, 239 if (copy_to_user(datap, &child->thread.fp,
238 sizeof(struct user_m68kfp_struct))) 240 sizeof(struct user_m68kfp_struct)))
239 ret = -EFAULT; 241 ret = -EFAULT;
240 break; 242 break;
241 243
242 case PTRACE_SETFPREGS: /* Set the child FPU state. */ 244 case PTRACE_SETFPREGS: /* Set the child FPU state. */
243 if (copy_from_user(&child->thread.fp, (void *)data, 245 if (copy_from_user(&child->thread.fp, datap,
244 sizeof(struct user_m68kfp_struct))) 246 sizeof(struct user_m68kfp_struct)))
245 ret = -EFAULT; 247 ret = -EFAULT;
246 break; 248 break;
247 249
248 case PTRACE_GET_THREAD_AREA: 250 case PTRACE_GET_THREAD_AREA:
249 ret = put_user(task_thread_info(child)->tp_value, 251 ret = put_user(task_thread_info(child)->tp_value, datap);
250 (unsigned long __user *)data);
251 break; 252 break;
252 253
253 default: 254 default:
diff --git a/arch/m68knommu/kernel/ptrace.c b/arch/m68knommu/kernel/ptrace.c
index 6fe7c38cd556..6709fb707335 100644
--- a/arch/m68knommu/kernel/ptrace.c
+++ b/arch/m68knommu/kernel/ptrace.c
@@ -112,9 +112,12 @@ void ptrace_disable(struct task_struct *child)
112 user_disable_single_step(child); 112 user_disable_single_step(child);
113} 113}
114 114
115long arch_ptrace(struct task_struct *child, long request, long addr, long data) 115long arch_ptrace(struct task_struct *child, long request,
116 unsigned long addr, unsigned long data)
116{ 117{
117 int ret; 118 int ret;
119 int regno = addr >> 2;
120 unsigned long __user *datap = (unsigned long __user *) data;
118 121
119 switch (request) { 122 switch (request) {
120 /* read the word at location addr in the USER area. */ 123 /* read the word at location addr in the USER area. */
@@ -122,53 +125,48 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
122 unsigned long tmp; 125 unsigned long tmp;
123 126
124 ret = -EIO; 127 ret = -EIO;
125 if ((addr & 3) || addr < 0 || 128 if ((addr & 3) || addr > sizeof(struct user) - 3)
126 addr > sizeof(struct user) - 3)
127 break; 129 break;
128 130
129 tmp = 0; /* Default return condition */ 131 tmp = 0; /* Default return condition */
130 addr = addr >> 2; /* temporary hack. */
131 ret = -EIO; 132 ret = -EIO;
132 if (addr < 19) { 133 if (regno < 19) {
133 tmp = get_reg(child, addr); 134 tmp = get_reg(child, regno);
134 if (addr == PT_SR) 135 if (regno == PT_SR)
135 tmp >>= 16; 136 tmp >>= 16;
136 } else if (addr >= 21 && addr < 49) { 137 } else if (regno >= 21 && regno < 49) {
137 tmp = child->thread.fp[addr - 21]; 138 tmp = child->thread.fp[regno - 21];
138 } else if (addr == 49) { 139 } else if (regno == 49) {
139 tmp = child->mm->start_code; 140 tmp = child->mm->start_code;
140 } else if (addr == 50) { 141 } else if (regno == 50) {
141 tmp = child->mm->start_data; 142 tmp = child->mm->start_data;
142 } else if (addr == 51) { 143 } else if (regno == 51) {
143 tmp = child->mm->end_code; 144 tmp = child->mm->end_code;
144 } else 145 } else
145 break; 146 break;
146 ret = put_user(tmp,(unsigned long *) data); 147 ret = put_user(tmp, datap);
147 break; 148 break;
148 } 149 }
149 150
150 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ 151 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
151 ret = -EIO; 152 ret = -EIO;
152 if ((addr & 3) || addr < 0 || 153 if ((addr & 3) || addr > sizeof(struct user) - 3)
153 addr > sizeof(struct user) - 3)
154 break; 154 break;
155 155
156 addr = addr >> 2; /* temporary hack. */ 156 if (regno == PT_SR) {
157
158 if (addr == PT_SR) {
159 data &= SR_MASK; 157 data &= SR_MASK;
160 data <<= 16; 158 data <<= 16;
161 data |= get_reg(child, PT_SR) & ~(SR_MASK << 16); 159 data |= get_reg(child, PT_SR) & ~(SR_MASK << 16);
162 } 160 }
163 if (addr < 19) { 161 if (regno < 19) {
164 if (put_reg(child, addr, data)) 162 if (put_reg(child, regno, data))
165 break; 163 break;
166 ret = 0; 164 ret = 0;
167 break; 165 break;
168 } 166 }
169 if (addr >= 21 && addr < 48) 167 if (regno >= 21 && regno < 48)
170 { 168 {
171 child->thread.fp[addr - 21] = data; 169 child->thread.fp[regno - 21] = data;
172 ret = 0; 170 ret = 0;
173 } 171 }
174 break; 172 break;
@@ -180,11 +178,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
180 tmp = get_reg(child, i); 178 tmp = get_reg(child, i);
181 if (i == PT_SR) 179 if (i == PT_SR)
182 tmp >>= 16; 180 tmp >>= 16;
183 if (put_user(tmp, (unsigned long *) data)) { 181 if (put_user(tmp, datap)) {
184 ret = -EFAULT; 182 ret = -EFAULT;
185 break; 183 break;
186 } 184 }
187 data += sizeof(long); 185 datap++;
188 } 186 }
189 ret = 0; 187 ret = 0;
190 break; 188 break;
@@ -194,7 +192,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
194 int i; 192 int i;
195 unsigned long tmp; 193 unsigned long tmp;
196 for (i = 0; i < 19; i++) { 194 for (i = 0; i < 19; i++) {
197 if (get_user(tmp, (unsigned long *) data)) { 195 if (get_user(tmp, datap)) {
198 ret = -EFAULT; 196 ret = -EFAULT;
199 break; 197 break;
200 } 198 }
@@ -204,7 +202,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
204 tmp |= get_reg(child, PT_SR) & ~(SR_MASK << 16); 202 tmp |= get_reg(child, PT_SR) & ~(SR_MASK << 16);
205 } 203 }
206 put_reg(child, i, tmp); 204 put_reg(child, i, tmp);
207 data += sizeof(long); 205 datap++;
208 } 206 }
209 ret = 0; 207 ret = 0;
210 break; 208 break;
@@ -213,7 +211,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
213#ifdef PTRACE_GETFPREGS 211#ifdef PTRACE_GETFPREGS
214 case PTRACE_GETFPREGS: { /* Get the child FPU state. */ 212 case PTRACE_GETFPREGS: { /* Get the child FPU state. */
215 ret = 0; 213 ret = 0;
216 if (copy_to_user((void *)data, &child->thread.fp, 214 if (copy_to_user(datap, &child->thread.fp,
217 sizeof(struct user_m68kfp_struct))) 215 sizeof(struct user_m68kfp_struct)))
218 ret = -EFAULT; 216 ret = -EFAULT;
219 break; 217 break;
@@ -223,7 +221,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
223#ifdef PTRACE_SETFPREGS 221#ifdef PTRACE_SETFPREGS
224 case PTRACE_SETFPREGS: { /* Set the child FPU state. */ 222 case PTRACE_SETFPREGS: { /* Set the child FPU state. */
225 ret = 0; 223 ret = 0;
226 if (copy_from_user(&child->thread.fp, (void *)data, 224 if (copy_from_user(&child->thread.fp, datap,
227 sizeof(struct user_m68kfp_struct))) 225 sizeof(struct user_m68kfp_struct)))
228 ret = -EFAULT; 226 ret = -EFAULT;
229 break; 227 break;
@@ -231,8 +229,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
231#endif 229#endif
232 230
233 case PTRACE_GET_THREAD_AREA: 231 case PTRACE_GET_THREAD_AREA:
234 ret = put_user(task_thread_info(child)->tp_value, 232 ret = put_user(task_thread_info(child)->tp_value, datap);
235 (unsigned long __user *)data);
236 break; 233 break;
237 234
238 default: 235 default:
diff --git a/arch/microblaze/kernel/ptrace.c b/arch/microblaze/kernel/ptrace.c
index dc03ffc8174a..05ac8cc975d5 100644
--- a/arch/microblaze/kernel/ptrace.c
+++ b/arch/microblaze/kernel/ptrace.c
@@ -73,7 +73,8 @@ static microblaze_reg_t *reg_save_addr(unsigned reg_offs,
73 return (microblaze_reg_t *)((char *)regs + reg_offs); 73 return (microblaze_reg_t *)((char *)regs + reg_offs);
74} 74}
75 75
76long arch_ptrace(struct task_struct *child, long request, long addr, long data) 76long arch_ptrace(struct task_struct *child, long request,
77 unsigned long addr, unsigned long data)
77{ 78{
78 int rval; 79 int rval;
79 unsigned long val = 0; 80 unsigned long val = 0;
@@ -99,7 +100,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
99 } else { 100 } else {
100 rval = -EIO; 101 rval = -EIO;
101 } 102 }
102 } else if (addr >= 0 && addr < PT_SIZE && (addr & 0x3) == 0) { 103 } else if (addr < PT_SIZE && (addr & 0x3) == 0) {
103 microblaze_reg_t *reg_addr = reg_save_addr(addr, child); 104 microblaze_reg_t *reg_addr = reg_save_addr(addr, child);
104 if (request == PTRACE_PEEKUSR) 105 if (request == PTRACE_PEEKUSR)
105 val = *reg_addr; 106 val = *reg_addr;
diff --git a/arch/mips/include/asm/pci/bridge.h b/arch/mips/include/asm/pci/bridge.h
index 5f4b9d4e4114..f1f508e4f971 100644
--- a/arch/mips/include/asm/pci/bridge.h
+++ b/arch/mips/include/asm/pci/bridge.h
@@ -839,7 +839,7 @@ struct bridge_controller {
839 nasid_t nasid; 839 nasid_t nasid;
840 unsigned int widget_id; 840 unsigned int widget_id;
841 unsigned int irq_cpu; 841 unsigned int irq_cpu;
842 dma64_addr_t baddr; 842 u64 baddr;
843 unsigned int pci_int[8]; 843 unsigned int pci_int[8];
844}; 844};
845 845
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index c8777333e198..d21c388c0116 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -255,9 +255,13 @@ int ptrace_set_watch_regs(struct task_struct *child,
255 return 0; 255 return 0;
256} 256}
257 257
258long arch_ptrace(struct task_struct *child, long request, long addr, long data) 258long arch_ptrace(struct task_struct *child, long request,
259 unsigned long addr, unsigned long data)
259{ 260{
260 int ret; 261 int ret;
262 void __user *addrp = (void __user *) addr;
263 void __user *datavp = (void __user *) data;
264 unsigned long __user *datalp = (void __user *) data;
261 265
262 switch (request) { 266 switch (request) {
263 /* when I and D space are separate, these will need to be fixed. */ 267 /* when I and D space are separate, these will need to be fixed. */
@@ -386,7 +390,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
386 ret = -EIO; 390 ret = -EIO;
387 goto out; 391 goto out;
388 } 392 }
389 ret = put_user(tmp, (unsigned long __user *) data); 393 ret = put_user(tmp, datalp);
390 break; 394 break;
391 } 395 }
392 396
@@ -478,34 +482,31 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
478 } 482 }
479 483
480 case PTRACE_GETREGS: 484 case PTRACE_GETREGS:
481 ret = ptrace_getregs(child, (__s64 __user *) data); 485 ret = ptrace_getregs(child, datavp);
482 break; 486 break;
483 487
484 case PTRACE_SETREGS: 488 case PTRACE_SETREGS:
485 ret = ptrace_setregs(child, (__s64 __user *) data); 489 ret = ptrace_setregs(child, datavp);
486 break; 490 break;
487 491
488 case PTRACE_GETFPREGS: 492 case PTRACE_GETFPREGS:
489 ret = ptrace_getfpregs(child, (__u32 __user *) data); 493 ret = ptrace_getfpregs(child, datavp);
490 break; 494 break;
491 495
492 case PTRACE_SETFPREGS: 496 case PTRACE_SETFPREGS:
493 ret = ptrace_setfpregs(child, (__u32 __user *) data); 497 ret = ptrace_setfpregs(child, datavp);
494 break; 498 break;
495 499
496 case PTRACE_GET_THREAD_AREA: 500 case PTRACE_GET_THREAD_AREA:
497 ret = put_user(task_thread_info(child)->tp_value, 501 ret = put_user(task_thread_info(child)->tp_value, datalp);
498 (unsigned long __user *) data);
499 break; 502 break;
500 503
501 case PTRACE_GET_WATCH_REGS: 504 case PTRACE_GET_WATCH_REGS:
502 ret = ptrace_get_watch_regs(child, 505 ret = ptrace_get_watch_regs(child, addrp);
503 (struct pt_watch_regs __user *) addr);
504 break; 506 break;
505 507
506 case PTRACE_SET_WATCH_REGS: 508 case PTRACE_SET_WATCH_REGS:
507 ret = ptrace_set_watch_regs(child, 509 ret = ptrace_set_watch_regs(child, addrp);
508 (struct pt_watch_regs __user *) addr);
509 break; 510 break;
510 511
511 default: 512 default:
diff --git a/arch/mips/mm/highmem.c b/arch/mips/mm/highmem.c
index 1e69b1fb4b85..3634c7ea06ac 100644
--- a/arch/mips/mm/highmem.c
+++ b/arch/mips/mm/highmem.c
@@ -74,7 +74,7 @@ void __kunmap_atomic(void *kvaddr)
74 return; 74 return;
75 } 75 }
76 76
77 type = kmap_atomic_idx_pop(); 77 type = kmap_atomic_idx();
78#ifdef CONFIG_DEBUG_HIGHMEM 78#ifdef CONFIG_DEBUG_HIGHMEM
79 { 79 {
80 int idx = type + KM_TYPE_NR * smp_processor_id(); 80 int idx = type + KM_TYPE_NR * smp_processor_id();
@@ -89,6 +89,7 @@ void __kunmap_atomic(void *kvaddr)
89 local_flush_tlb_one(vaddr); 89 local_flush_tlb_one(vaddr);
90 } 90 }
91#endif 91#endif
92 kmap_atomic_idx_pop();
92 pagefault_enable(); 93 pagefault_enable();
93} 94}
94EXPORT_SYMBOL(__kunmap_atomic); 95EXPORT_SYMBOL(__kunmap_atomic);
diff --git a/arch/mn10300/include/asm/highmem.h b/arch/mn10300/include/asm/highmem.h
index f577ba2268ca..e2155e686451 100644
--- a/arch/mn10300/include/asm/highmem.h
+++ b/arch/mn10300/include/asm/highmem.h
@@ -101,7 +101,7 @@ static inline void __kunmap_atomic(unsigned long vaddr)
101 return; 101 return;
102 } 102 }
103 103
104 type = kmap_atomic_idx_pop(); 104 type = kmap_atomic_idx();
105 105
106#if HIGHMEM_DEBUG 106#if HIGHMEM_DEBUG
107 { 107 {
@@ -119,6 +119,8 @@ static inline void __kunmap_atomic(unsigned long vaddr)
119 __flush_tlb_one(vaddr); 119 __flush_tlb_one(vaddr);
120 } 120 }
121#endif 121#endif
122
123 kmap_atomic_idx_pop();
122 pagefault_enable(); 124 pagefault_enable();
123} 125}
124#endif /* __KERNEL__ */ 126#endif /* __KERNEL__ */
diff --git a/arch/mn10300/kernel/ptrace.c b/arch/mn10300/kernel/ptrace.c
index cf847dabc1bd..5c0b07e61006 100644
--- a/arch/mn10300/kernel/ptrace.c
+++ b/arch/mn10300/kernel/ptrace.c
@@ -295,31 +295,31 @@ void ptrace_disable(struct task_struct *child)
295/* 295/*
296 * handle the arch-specific side of process tracing 296 * handle the arch-specific side of process tracing
297 */ 297 */
298long arch_ptrace(struct task_struct *child, long request, long addr, long data) 298long arch_ptrace(struct task_struct *child, long request,
299 unsigned long addr, unsigned long data)
299{ 300{
300 unsigned long tmp; 301 unsigned long tmp;
301 int ret; 302 int ret;
303 unsigned long __user *datap = (unsigned long __user *) data;
302 304
303 switch (request) { 305 switch (request) {
304 /* read the word at location addr in the USER area. */ 306 /* read the word at location addr in the USER area. */
305 case PTRACE_PEEKUSR: 307 case PTRACE_PEEKUSR:
306 ret = -EIO; 308 ret = -EIO;
307 if ((addr & 3) || addr < 0 || 309 if ((addr & 3) || addr > sizeof(struct user) - 3)
308 addr > sizeof(struct user) - 3)
309 break; 310 break;
310 311
311 tmp = 0; /* Default return condition */ 312 tmp = 0; /* Default return condition */
312 if (addr < NR_PTREGS << 2) 313 if (addr < NR_PTREGS << 2)
313 tmp = get_stack_long(child, 314 tmp = get_stack_long(child,
314 ptrace_regid_to_frame[addr]); 315 ptrace_regid_to_frame[addr]);
315 ret = put_user(tmp, (unsigned long *) data); 316 ret = put_user(tmp, datap);
316 break; 317 break;
317 318
318 /* write the word at location addr in the USER area */ 319 /* write the word at location addr in the USER area */
319 case PTRACE_POKEUSR: 320 case PTRACE_POKEUSR:
320 ret = -EIO; 321 ret = -EIO;
321 if ((addr & 3) || addr < 0 || 322 if ((addr & 3) || addr > sizeof(struct user) - 3)
322 addr > sizeof(struct user) - 3)
323 break; 323 break;
324 324
325 ret = 0; 325 ret = 0;
@@ -332,25 +332,25 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
332 return copy_regset_to_user(child, &user_mn10300_native_view, 332 return copy_regset_to_user(child, &user_mn10300_native_view,
333 REGSET_GENERAL, 333 REGSET_GENERAL,
334 0, NR_PTREGS * sizeof(long), 334 0, NR_PTREGS * sizeof(long),
335 (void __user *)data); 335 datap);
336 336
337 case PTRACE_SETREGS: /* Set all integer regs in the child. */ 337 case PTRACE_SETREGS: /* Set all integer regs in the child. */
338 return copy_regset_from_user(child, &user_mn10300_native_view, 338 return copy_regset_from_user(child, &user_mn10300_native_view,
339 REGSET_GENERAL, 339 REGSET_GENERAL,
340 0, NR_PTREGS * sizeof(long), 340 0, NR_PTREGS * sizeof(long),
341 (const void __user *)data); 341 datap);
342 342
343 case PTRACE_GETFPREGS: /* Get the child FPU state. */ 343 case PTRACE_GETFPREGS: /* Get the child FPU state. */
344 return copy_regset_to_user(child, &user_mn10300_native_view, 344 return copy_regset_to_user(child, &user_mn10300_native_view,
345 REGSET_FPU, 345 REGSET_FPU,
346 0, sizeof(struct fpu_state_struct), 346 0, sizeof(struct fpu_state_struct),
347 (void __user *)data); 347 datap);
348 348
349 case PTRACE_SETFPREGS: /* Set the child FPU state. */ 349 case PTRACE_SETFPREGS: /* Set the child FPU state. */
350 return copy_regset_from_user(child, &user_mn10300_native_view, 350 return copy_regset_from_user(child, &user_mn10300_native_view,
351 REGSET_FPU, 351 REGSET_FPU,
352 0, sizeof(struct fpu_state_struct), 352 0, sizeof(struct fpu_state_struct),
353 (const void __user *)data); 353 datap);
354 354
355 default: 355 default:
356 ret = ptrace_request(child, request, addr, data); 356 ret = ptrace_request(child, request, addr, data);
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c
index c4f49e45129d..2905b1f52d30 100644
--- a/arch/parisc/kernel/ptrace.c
+++ b/arch/parisc/kernel/ptrace.c
@@ -110,7 +110,8 @@ void user_enable_block_step(struct task_struct *task)
110 pa_psw(task)->l = 0; 110 pa_psw(task)->l = 0;
111} 111}
112 112
113long arch_ptrace(struct task_struct *child, long request, long addr, long data) 113long arch_ptrace(struct task_struct *child, long request,
114 unsigned long addr, unsigned long data)
114{ 115{
115 unsigned long tmp; 116 unsigned long tmp;
116 long ret = -EIO; 117 long ret = -EIO;
@@ -120,11 +121,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
120 /* Read the word at location addr in the USER area. For ptraced 121 /* Read the word at location addr in the USER area. For ptraced
121 processes, the kernel saves all regs on a syscall. */ 122 processes, the kernel saves all regs on a syscall. */
122 case PTRACE_PEEKUSR: 123 case PTRACE_PEEKUSR:
123 if ((addr & (sizeof(long)-1)) || 124 if ((addr & (sizeof(unsigned long)-1)) ||
124 (unsigned long) addr >= sizeof(struct pt_regs)) 125 addr >= sizeof(struct pt_regs))
125 break; 126 break;
126 tmp = *(unsigned long *) ((char *) task_regs(child) + addr); 127 tmp = *(unsigned long *) ((char *) task_regs(child) + addr);
127 ret = put_user(tmp, (unsigned long *) data); 128 ret = put_user(tmp, (unsigned long __user *) data);
128 break; 129 break;
129 130
130 /* Write the word at location addr in the USER area. This will need 131 /* Write the word at location addr in the USER area. This will need
@@ -151,8 +152,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
151 break; 152 break;
152 } 153 }
153 154
154 if ((addr & (sizeof(long)-1)) || 155 if ((addr & (sizeof(unsigned long)-1)) ||
155 (unsigned long) addr >= sizeof(struct pt_regs)) 156 addr >= sizeof(struct pt_regs))
156 break; 157 break;
157 if ((addr >= PT_GR1 && addr <= PT_GR31) || 158 if ((addr >= PT_GR1 && addr <= PT_GR31) ||
158 addr == PT_IAOQ0 || addr == PT_IAOQ1 || 159 addr == PT_IAOQ0 || addr == PT_IAOQ1 ||
diff --git a/arch/powerpc/include/asm/cputime.h b/arch/powerpc/include/asm/cputime.h
index 8bdc6a9e5773..1cf20bdfbeca 100644
--- a/arch/powerpc/include/asm/cputime.h
+++ b/arch/powerpc/include/asm/cputime.h
@@ -124,23 +124,23 @@ static inline u64 cputime64_to_jiffies64(const cputime_t ct)
124} 124}
125 125
126/* 126/*
127 * Convert cputime <-> milliseconds 127 * Convert cputime <-> microseconds
128 */ 128 */
129extern u64 __cputime_msec_factor; 129extern u64 __cputime_msec_factor;
130 130
131static inline unsigned long cputime_to_msecs(const cputime_t ct) 131static inline unsigned long cputime_to_usecs(const cputime_t ct)
132{ 132{
133 return mulhdu(ct, __cputime_msec_factor); 133 return mulhdu(ct, __cputime_msec_factor) * USEC_PER_MSEC;
134} 134}
135 135
136static inline cputime_t msecs_to_cputime(const unsigned long ms) 136static inline cputime_t usecs_to_cputime(const unsigned long us)
137{ 137{
138 cputime_t ct; 138 cputime_t ct;
139 unsigned long sec; 139 unsigned long sec;
140 140
141 /* have to be a little careful about overflow */ 141 /* have to be a little careful about overflow */
142 ct = ms % 1000; 142 ct = us % 1000000;
143 sec = ms / 1000; 143 sec = us / 1000000;
144 if (ct) { 144 if (ct) {
145 ct *= tb_ticks_per_sec; 145 ct *= tb_ticks_per_sec;
146 do_div(ct, 1000); 146 do_div(ct, 1000);
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 286d9783d93f..a9b32967cff6 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -1406,37 +1406,42 @@ static long ppc_del_hwdebug(struct task_struct *child, long addr, long data)
1406 * Here are the old "legacy" powerpc specific getregs/setregs ptrace calls, 1406 * Here are the old "legacy" powerpc specific getregs/setregs ptrace calls,
1407 * we mark them as obsolete now, they will be removed in a future version 1407 * we mark them as obsolete now, they will be removed in a future version
1408 */ 1408 */
1409static long arch_ptrace_old(struct task_struct *child, long request, long addr, 1409static long arch_ptrace_old(struct task_struct *child, long request,
1410 long data) 1410 unsigned long addr, unsigned long data)
1411{ 1411{
1412 void __user *datavp = (void __user *) data;
1413
1412 switch (request) { 1414 switch (request) {
1413 case PPC_PTRACE_GETREGS: /* Get GPRs 0 - 31. */ 1415 case PPC_PTRACE_GETREGS: /* Get GPRs 0 - 31. */
1414 return copy_regset_to_user(child, &user_ppc_native_view, 1416 return copy_regset_to_user(child, &user_ppc_native_view,
1415 REGSET_GPR, 0, 32 * sizeof(long), 1417 REGSET_GPR, 0, 32 * sizeof(long),
1416 (void __user *) data); 1418 datavp);
1417 1419
1418 case PPC_PTRACE_SETREGS: /* Set GPRs 0 - 31. */ 1420 case PPC_PTRACE_SETREGS: /* Set GPRs 0 - 31. */
1419 return copy_regset_from_user(child, &user_ppc_native_view, 1421 return copy_regset_from_user(child, &user_ppc_native_view,
1420 REGSET_GPR, 0, 32 * sizeof(long), 1422 REGSET_GPR, 0, 32 * sizeof(long),
1421 (const void __user *) data); 1423 datavp);
1422 1424
1423 case PPC_PTRACE_GETFPREGS: /* Get FPRs 0 - 31. */ 1425 case PPC_PTRACE_GETFPREGS: /* Get FPRs 0 - 31. */
1424 return copy_regset_to_user(child, &user_ppc_native_view, 1426 return copy_regset_to_user(child, &user_ppc_native_view,
1425 REGSET_FPR, 0, 32 * sizeof(double), 1427 REGSET_FPR, 0, 32 * sizeof(double),
1426 (void __user *) data); 1428 datavp);
1427 1429
1428 case PPC_PTRACE_SETFPREGS: /* Set FPRs 0 - 31. */ 1430 case PPC_PTRACE_SETFPREGS: /* Set FPRs 0 - 31. */
1429 return copy_regset_from_user(child, &user_ppc_native_view, 1431 return copy_regset_from_user(child, &user_ppc_native_view,
1430 REGSET_FPR, 0, 32 * sizeof(double), 1432 REGSET_FPR, 0, 32 * sizeof(double),
1431 (const void __user *) data); 1433 datavp);
1432 } 1434 }
1433 1435
1434 return -EPERM; 1436 return -EPERM;
1435} 1437}
1436 1438
1437long arch_ptrace(struct task_struct *child, long request, long addr, long data) 1439long arch_ptrace(struct task_struct *child, long request,
1440 unsigned long addr, unsigned long data)
1438{ 1441{
1439 int ret = -EPERM; 1442 int ret = -EPERM;
1443 void __user *datavp = (void __user *) data;
1444 unsigned long __user *datalp = datavp;
1440 1445
1441 switch (request) { 1446 switch (request) {
1442 /* read the word at location addr in the USER area. */ 1447 /* read the word at location addr in the USER area. */
@@ -1446,11 +1451,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
1446 ret = -EIO; 1451 ret = -EIO;
1447 /* convert to index and check */ 1452 /* convert to index and check */
1448#ifdef CONFIG_PPC32 1453#ifdef CONFIG_PPC32
1449 index = (unsigned long) addr >> 2; 1454 index = addr >> 2;
1450 if ((addr & 3) || (index > PT_FPSCR) 1455 if ((addr & 3) || (index > PT_FPSCR)
1451 || (child->thread.regs == NULL)) 1456 || (child->thread.regs == NULL))
1452#else 1457#else
1453 index = (unsigned long) addr >> 3; 1458 index = addr >> 3;
1454 if ((addr & 7) || (index > PT_FPSCR)) 1459 if ((addr & 7) || (index > PT_FPSCR))
1455#endif 1460#endif
1456 break; 1461 break;
@@ -1463,7 +1468,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
1463 tmp = ((unsigned long *)child->thread.fpr) 1468 tmp = ((unsigned long *)child->thread.fpr)
1464 [TS_FPRWIDTH * (index - PT_FPR0)]; 1469 [TS_FPRWIDTH * (index - PT_FPR0)];
1465 } 1470 }
1466 ret = put_user(tmp,(unsigned long __user *) data); 1471 ret = put_user(tmp, datalp);
1467 break; 1472 break;
1468 } 1473 }
1469 1474
@@ -1474,11 +1479,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
1474 ret = -EIO; 1479 ret = -EIO;
1475 /* convert to index and check */ 1480 /* convert to index and check */
1476#ifdef CONFIG_PPC32 1481#ifdef CONFIG_PPC32
1477 index = (unsigned long) addr >> 2; 1482 index = addr >> 2;
1478 if ((addr & 3) || (index > PT_FPSCR) 1483 if ((addr & 3) || (index > PT_FPSCR)
1479 || (child->thread.regs == NULL)) 1484 || (child->thread.regs == NULL))
1480#else 1485#else
1481 index = (unsigned long) addr >> 3; 1486 index = addr >> 3;
1482 if ((addr & 7) || (index > PT_FPSCR)) 1487 if ((addr & 7) || (index > PT_FPSCR))
1483#endif 1488#endif
1484 break; 1489 break;
@@ -1525,11 +1530,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
1525 dbginfo.features = 0; 1530 dbginfo.features = 0;
1526#endif /* CONFIG_PPC_ADV_DEBUG_REGS */ 1531#endif /* CONFIG_PPC_ADV_DEBUG_REGS */
1527 1532
1528 if (!access_ok(VERIFY_WRITE, data, 1533 if (!access_ok(VERIFY_WRITE, datavp,
1529 sizeof(struct ppc_debug_info))) 1534 sizeof(struct ppc_debug_info)))
1530 return -EFAULT; 1535 return -EFAULT;
1531 ret = __copy_to_user((struct ppc_debug_info __user *)data, 1536 ret = __copy_to_user(datavp, &dbginfo,
1532 &dbginfo, sizeof(struct ppc_debug_info)) ? 1537 sizeof(struct ppc_debug_info)) ?
1533 -EFAULT : 0; 1538 -EFAULT : 0;
1534 break; 1539 break;
1535 } 1540 }
@@ -1537,11 +1542,10 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
1537 case PPC_PTRACE_SETHWDEBUG: { 1542 case PPC_PTRACE_SETHWDEBUG: {
1538 struct ppc_hw_breakpoint bp_info; 1543 struct ppc_hw_breakpoint bp_info;
1539 1544
1540 if (!access_ok(VERIFY_READ, data, 1545 if (!access_ok(VERIFY_READ, datavp,
1541 sizeof(struct ppc_hw_breakpoint))) 1546 sizeof(struct ppc_hw_breakpoint)))
1542 return -EFAULT; 1547 return -EFAULT;
1543 ret = __copy_from_user(&bp_info, 1548 ret = __copy_from_user(&bp_info, datavp,
1544 (struct ppc_hw_breakpoint __user *)data,
1545 sizeof(struct ppc_hw_breakpoint)) ? 1549 sizeof(struct ppc_hw_breakpoint)) ?
1546 -EFAULT : 0; 1550 -EFAULT : 0;
1547 if (!ret) 1551 if (!ret)
@@ -1560,11 +1564,9 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
1560 if (addr > 0) 1564 if (addr > 0)
1561 break; 1565 break;
1562#ifdef CONFIG_PPC_ADV_DEBUG_REGS 1566#ifdef CONFIG_PPC_ADV_DEBUG_REGS
1563 ret = put_user(child->thread.dac1, 1567 ret = put_user(child->thread.dac1, datalp);
1564 (unsigned long __user *)data);
1565#else 1568#else
1566 ret = put_user(child->thread.dabr, 1569 ret = put_user(child->thread.dabr, datalp);
1567 (unsigned long __user *)data);
1568#endif 1570#endif
1569 break; 1571 break;
1570 } 1572 }
@@ -1580,7 +1582,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
1580 return copy_regset_to_user(child, &user_ppc_native_view, 1582 return copy_regset_to_user(child, &user_ppc_native_view,
1581 REGSET_GPR, 1583 REGSET_GPR,
1582 0, sizeof(struct pt_regs), 1584 0, sizeof(struct pt_regs),
1583 (void __user *) data); 1585 datavp);
1584 1586
1585#ifdef CONFIG_PPC64 1587#ifdef CONFIG_PPC64
1586 case PTRACE_SETREGS64: 1588 case PTRACE_SETREGS64:
@@ -1589,19 +1591,19 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
1589 return copy_regset_from_user(child, &user_ppc_native_view, 1591 return copy_regset_from_user(child, &user_ppc_native_view,
1590 REGSET_GPR, 1592 REGSET_GPR,
1591 0, sizeof(struct pt_regs), 1593 0, sizeof(struct pt_regs),
1592 (const void __user *) data); 1594 datavp);
1593 1595
1594 case PTRACE_GETFPREGS: /* Get the child FPU state (FPR0...31 + FPSCR) */ 1596 case PTRACE_GETFPREGS: /* Get the child FPU state (FPR0...31 + FPSCR) */
1595 return copy_regset_to_user(child, &user_ppc_native_view, 1597 return copy_regset_to_user(child, &user_ppc_native_view,
1596 REGSET_FPR, 1598 REGSET_FPR,
1597 0, sizeof(elf_fpregset_t), 1599 0, sizeof(elf_fpregset_t),
1598 (void __user *) data); 1600 datavp);
1599 1601
1600 case PTRACE_SETFPREGS: /* Set the child FPU state (FPR0...31 + FPSCR) */ 1602 case PTRACE_SETFPREGS: /* Set the child FPU state (FPR0...31 + FPSCR) */
1601 return copy_regset_from_user(child, &user_ppc_native_view, 1603 return copy_regset_from_user(child, &user_ppc_native_view,
1602 REGSET_FPR, 1604 REGSET_FPR,
1603 0, sizeof(elf_fpregset_t), 1605 0, sizeof(elf_fpregset_t),
1604 (const void __user *) data); 1606 datavp);
1605 1607
1606#ifdef CONFIG_ALTIVEC 1608#ifdef CONFIG_ALTIVEC
1607 case PTRACE_GETVRREGS: 1609 case PTRACE_GETVRREGS:
@@ -1609,40 +1611,40 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
1609 REGSET_VMX, 1611 REGSET_VMX,
1610 0, (33 * sizeof(vector128) + 1612 0, (33 * sizeof(vector128) +
1611 sizeof(u32)), 1613 sizeof(u32)),
1612 (void __user *) data); 1614 datavp);
1613 1615
1614 case PTRACE_SETVRREGS: 1616 case PTRACE_SETVRREGS:
1615 return copy_regset_from_user(child, &user_ppc_native_view, 1617 return copy_regset_from_user(child, &user_ppc_native_view,
1616 REGSET_VMX, 1618 REGSET_VMX,
1617 0, (33 * sizeof(vector128) + 1619 0, (33 * sizeof(vector128) +
1618 sizeof(u32)), 1620 sizeof(u32)),
1619 (const void __user *) data); 1621 datavp);
1620#endif 1622#endif
1621#ifdef CONFIG_VSX 1623#ifdef CONFIG_VSX
1622 case PTRACE_GETVSRREGS: 1624 case PTRACE_GETVSRREGS:
1623 return copy_regset_to_user(child, &user_ppc_native_view, 1625 return copy_regset_to_user(child, &user_ppc_native_view,
1624 REGSET_VSX, 1626 REGSET_VSX,
1625 0, 32 * sizeof(double), 1627 0, 32 * sizeof(double),
1626 (void __user *) data); 1628 datavp);
1627 1629
1628 case PTRACE_SETVSRREGS: 1630 case PTRACE_SETVSRREGS:
1629 return copy_regset_from_user(child, &user_ppc_native_view, 1631 return copy_regset_from_user(child, &user_ppc_native_view,
1630 REGSET_VSX, 1632 REGSET_VSX,
1631 0, 32 * sizeof(double), 1633 0, 32 * sizeof(double),
1632 (const void __user *) data); 1634 datavp);
1633#endif 1635#endif
1634#ifdef CONFIG_SPE 1636#ifdef CONFIG_SPE
1635 case PTRACE_GETEVRREGS: 1637 case PTRACE_GETEVRREGS:
1636 /* Get the child spe register state. */ 1638 /* Get the child spe register state. */
1637 return copy_regset_to_user(child, &user_ppc_native_view, 1639 return copy_regset_to_user(child, &user_ppc_native_view,
1638 REGSET_SPE, 0, 35 * sizeof(u32), 1640 REGSET_SPE, 0, 35 * sizeof(u32),
1639 (void __user *) data); 1641 datavp);
1640 1642
1641 case PTRACE_SETEVRREGS: 1643 case PTRACE_SETEVRREGS:
1642 /* Set the child spe register state. */ 1644 /* Set the child spe register state. */
1643 return copy_regset_from_user(child, &user_ppc_native_view, 1645 return copy_regset_from_user(child, &user_ppc_native_view,
1644 REGSET_SPE, 0, 35 * sizeof(u32), 1646 REGSET_SPE, 0, 35 * sizeof(u32),
1645 (const void __user *) data); 1647 datavp);
1646#endif 1648#endif
1647 1649
1648 /* Old reverse args ptrace callss */ 1650 /* Old reverse args ptrace callss */
diff --git a/arch/powerpc/mm/highmem.c b/arch/powerpc/mm/highmem.c
index b0848b462bbc..e7450bdbe83a 100644
--- a/arch/powerpc/mm/highmem.c
+++ b/arch/powerpc/mm/highmem.c
@@ -62,7 +62,7 @@ void __kunmap_atomic(void *kvaddr)
62 return; 62 return;
63 } 63 }
64 64
65 type = kmap_atomic_idx_pop(); 65 type = kmap_atomic_idx();
66 66
67#ifdef CONFIG_DEBUG_HIGHMEM 67#ifdef CONFIG_DEBUG_HIGHMEM
68 { 68 {
@@ -79,6 +79,8 @@ void __kunmap_atomic(void *kvaddr)
79 local_flush_tlb_page(NULL, vaddr); 79 local_flush_tlb_page(NULL, vaddr);
80 } 80 }
81#endif 81#endif
82
83 kmap_atomic_idx_pop();
82 pagefault_enable(); 84 pagefault_enable();
83} 85}
84EXPORT_SYMBOL(__kunmap_atomic); 86EXPORT_SYMBOL(__kunmap_atomic);
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 412763672d23..9725369d432a 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -50,6 +50,7 @@
50#define RIO_ATMU_REGS_OFFSET 0x10c00 50#define RIO_ATMU_REGS_OFFSET 0x10c00
51#define RIO_P_MSG_REGS_OFFSET 0x11000 51#define RIO_P_MSG_REGS_OFFSET 0x11000
52#define RIO_S_MSG_REGS_OFFSET 0x13000 52#define RIO_S_MSG_REGS_OFFSET 0x13000
53#define RIO_GCCSR 0x13c
53#define RIO_ESCSR 0x158 54#define RIO_ESCSR 0x158
54#define RIO_CCSR 0x15c 55#define RIO_CCSR 0x15c
55#define RIO_LTLEDCSR 0x0608 56#define RIO_LTLEDCSR 0x0608
@@ -87,6 +88,9 @@
87#define RIO_IPWSR_PWD 0x00000008 88#define RIO_IPWSR_PWD 0x00000008
88#define RIO_IPWSR_PWB 0x00000004 89#define RIO_IPWSR_PWB 0x00000004
89 90
91#define RIO_EPWISR_PINT 0x80000000
92#define RIO_EPWISR_PW 0x00000001
93
90#define RIO_MSG_DESC_SIZE 32 94#define RIO_MSG_DESC_SIZE 32
91#define RIO_MSG_BUFFER_SIZE 4096 95#define RIO_MSG_BUFFER_SIZE 4096
92#define RIO_MIN_TX_RING_SIZE 2 96#define RIO_MIN_TX_RING_SIZE 2
@@ -1082,18 +1086,12 @@ fsl_rio_port_write_handler(int irq, void *dev_instance)
1082 struct rio_priv *priv = port->priv; 1086 struct rio_priv *priv = port->priv;
1083 u32 epwisr, tmp; 1087 u32 epwisr, tmp;
1084 1088
1085 ipwmr = in_be32(&priv->msg_regs->pwmr);
1086 ipwsr = in_be32(&priv->msg_regs->pwsr);
1087
1088 epwisr = in_be32(priv->regs_win + RIO_EPWISR); 1089 epwisr = in_be32(priv->regs_win + RIO_EPWISR);
1089 if (epwisr & 0x80000000) { 1090 if (!(epwisr & RIO_EPWISR_PW))
1090 tmp = in_be32(priv->regs_win + RIO_LTLEDCSR); 1091 goto pw_done;
1091 pr_info("RIO_LTLEDCSR = 0x%x\n", tmp);
1092 out_be32(priv->regs_win + RIO_LTLEDCSR, 0);
1093 }
1094 1092
1095 if (!(epwisr & 0x00000001)) 1093 ipwmr = in_be32(&priv->msg_regs->pwmr);
1096 return IRQ_HANDLED; 1094 ipwsr = in_be32(&priv->msg_regs->pwsr);
1097 1095
1098#ifdef DEBUG_PW 1096#ifdef DEBUG_PW
1099 pr_debug("PW Int->IPWMR: 0x%08x IPWSR: 0x%08x (", ipwmr, ipwsr); 1097 pr_debug("PW Int->IPWMR: 0x%08x IPWSR: 0x%08x (", ipwmr, ipwsr);
@@ -1109,20 +1107,6 @@ fsl_rio_port_write_handler(int irq, void *dev_instance)
1109 pr_debug(" PWB"); 1107 pr_debug(" PWB");
1110 pr_debug(" )\n"); 1108 pr_debug(" )\n");
1111#endif 1109#endif
1112 out_be32(&priv->msg_regs->pwsr,
1113 ipwsr & (RIO_IPWSR_TE | RIO_IPWSR_QFI | RIO_IPWSR_PWD));
1114
1115 if ((ipwmr & RIO_IPWMR_EIE) && (ipwsr & RIO_IPWSR_TE)) {
1116 priv->port_write_msg.err_count++;
1117 pr_info("RIO: Port-Write Transaction Err (%d)\n",
1118 priv->port_write_msg.err_count);
1119 }
1120 if (ipwsr & RIO_IPWSR_PWD) {
1121 priv->port_write_msg.discard_count++;
1122 pr_info("RIO: Port Discarded Port-Write Msg(s) (%d)\n",
1123 priv->port_write_msg.discard_count);
1124 }
1125
1126 /* Schedule deferred processing if PW was received */ 1110 /* Schedule deferred processing if PW was received */
1127 if (ipwsr & RIO_IPWSR_QFI) { 1111 if (ipwsr & RIO_IPWSR_QFI) {
1128 /* Save PW message (if there is room in FIFO), 1112 /* Save PW message (if there is room in FIFO),
@@ -1134,16 +1118,43 @@ fsl_rio_port_write_handler(int irq, void *dev_instance)
1134 RIO_PW_MSG_SIZE); 1118 RIO_PW_MSG_SIZE);
1135 } else { 1119 } else {
1136 priv->port_write_msg.discard_count++; 1120 priv->port_write_msg.discard_count++;
1137 pr_info("RIO: ISR Discarded Port-Write Msg(s) (%d)\n", 1121 pr_debug("RIO: ISR Discarded Port-Write Msg(s) (%d)\n",
1138 priv->port_write_msg.discard_count); 1122 priv->port_write_msg.discard_count);
1139 } 1123 }
1124 /* Clear interrupt and issue Clear Queue command. This allows
1125 * another port-write to be received.
1126 */
1127 out_be32(&priv->msg_regs->pwsr, RIO_IPWSR_QFI);
1128 out_be32(&priv->msg_regs->pwmr, ipwmr | RIO_IPWMR_CQ);
1129
1140 schedule_work(&priv->pw_work); 1130 schedule_work(&priv->pw_work);
1141 } 1131 }
1142 1132
1143 /* Issue Clear Queue command. This allows another 1133 if ((ipwmr & RIO_IPWMR_EIE) && (ipwsr & RIO_IPWSR_TE)) {
1144 * port-write to be received. 1134 priv->port_write_msg.err_count++;
1145 */ 1135 pr_debug("RIO: Port-Write Transaction Err (%d)\n",
1146 out_be32(&priv->msg_regs->pwmr, ipwmr | RIO_IPWMR_CQ); 1136 priv->port_write_msg.err_count);
1137 /* Clear Transaction Error: port-write controller should be
1138 * disabled when clearing this error
1139 */
1140 out_be32(&priv->msg_regs->pwmr, ipwmr & ~RIO_IPWMR_PWE);
1141 out_be32(&priv->msg_regs->pwsr, RIO_IPWSR_TE);
1142 out_be32(&priv->msg_regs->pwmr, ipwmr);
1143 }
1144
1145 if (ipwsr & RIO_IPWSR_PWD) {
1146 priv->port_write_msg.discard_count++;
1147 pr_debug("RIO: Port Discarded Port-Write Msg(s) (%d)\n",
1148 priv->port_write_msg.discard_count);
1149 out_be32(&priv->msg_regs->pwsr, RIO_IPWSR_PWD);
1150 }
1151
1152pw_done:
1153 if (epwisr & RIO_EPWISR_PINT) {
1154 tmp = in_be32(priv->regs_win + RIO_LTLEDCSR);
1155 pr_debug("RIO_LTLEDCSR = 0x%x\n", tmp);
1156 out_be32(priv->regs_win + RIO_LTLEDCSR, 0);
1157 }
1147 1158
1148 return IRQ_HANDLED; 1159 return IRQ_HANDLED;
1149} 1160}
@@ -1461,6 +1472,7 @@ int fsl_rio_setup(struct platform_device *dev)
1461 port->host_deviceid = fsl_rio_get_hdid(port->id); 1472 port->host_deviceid = fsl_rio_get_hdid(port->id);
1462 1473
1463 port->priv = priv; 1474 port->priv = priv;
1475 port->phys_efptr = 0x100;
1464 rio_register_mport(port); 1476 rio_register_mport(port);
1465 1477
1466 priv->regs_win = ioremap(regs.start, regs.end - regs.start + 1); 1478 priv->regs_win = ioremap(regs.start, regs.end - regs.start + 1);
@@ -1508,6 +1520,12 @@ int fsl_rio_setup(struct platform_device *dev)
1508 dev_info(&dev->dev, "RapidIO Common Transport System size: %d\n", 1520 dev_info(&dev->dev, "RapidIO Common Transport System size: %d\n",
1509 port->sys_size ? 65536 : 256); 1521 port->sys_size ? 65536 : 256);
1510 1522
1523 if (port->host_deviceid >= 0)
1524 out_be32(priv->regs_win + RIO_GCCSR, RIO_PORT_GEN_HOST |
1525 RIO_PORT_GEN_MASTER | RIO_PORT_GEN_DISCOVERED);
1526 else
1527 out_be32(priv->regs_win + RIO_GCCSR, 0x00000000);
1528
1511 priv->atmu_regs = (struct rio_atmu_regs *)(priv->regs_win 1529 priv->atmu_regs = (struct rio_atmu_regs *)(priv->regs_win
1512 + RIO_ATMU_REGS_OFFSET); 1530 + RIO_ATMU_REGS_OFFSET);
1513 priv->maint_atmu_regs = priv->atmu_regs + 1; 1531 priv->maint_atmu_regs = priv->atmu_regs + 1;
diff --git a/arch/s390/include/asm/cputime.h b/arch/s390/include/asm/cputime.h
index 8b1a52a137c5..40e2ab0fa3f0 100644
--- a/arch/s390/include/asm/cputime.h
+++ b/arch/s390/include/asm/cputime.h
@@ -73,18 +73,18 @@ cputime64_to_jiffies64(cputime64_t cputime)
73} 73}
74 74
75/* 75/*
76 * Convert cputime to milliseconds and back. 76 * Convert cputime to microseconds and back.
77 */ 77 */
78static inline unsigned int 78static inline unsigned int
79cputime_to_msecs(const cputime_t cputime) 79cputime_to_usecs(const cputime_t cputime)
80{ 80{
81 return cputime_div(cputime, 4096000); 81 return cputime_div(cputime, 4096);
82} 82}
83 83
84static inline cputime_t 84static inline cputime_t
85msecs_to_cputime(const unsigned int m) 85usecs_to_cputime(const unsigned int m)
86{ 86{
87 return (cputime_t) m * 4096000; 87 return (cputime_t) m * 4096;
88} 88}
89 89
90/* 90/*
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 83339d33c4b1..019bb714db49 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -343,7 +343,8 @@ poke_user(struct task_struct *child, addr_t addr, addr_t data)
343 return __poke_user(child, addr, data); 343 return __poke_user(child, addr, data);
344} 344}
345 345
346long arch_ptrace(struct task_struct *child, long request, long addr, long data) 346long arch_ptrace(struct task_struct *child, long request,
347 unsigned long addr, unsigned long data)
347{ 348{
348 ptrace_area parea; 349 ptrace_area parea;
349 int copied, ret; 350 int copied, ret;
diff --git a/arch/score/kernel/ptrace.c b/arch/score/kernel/ptrace.c
index 174c6422b096..55836188b217 100644
--- a/arch/score/kernel/ptrace.c
+++ b/arch/score/kernel/ptrace.c
@@ -325,7 +325,8 @@ void ptrace_disable(struct task_struct *child)
325} 325}
326 326
327long 327long
328arch_ptrace(struct task_struct *child, long request, long addr, long data) 328arch_ptrace(struct task_struct *child, long request,
329 unsigned long addr, unsigned long data)
329{ 330{
330 int ret; 331 int ret;
331 unsigned long __user *datap = (void __user *)data; 332 unsigned long __user *datap = (void __user *)data;
@@ -335,14 +336,14 @@ arch_ptrace(struct task_struct *child, long request, long addr, long data)
335 ret = copy_regset_to_user(child, &user_score_native_view, 336 ret = copy_regset_to_user(child, &user_score_native_view,
336 REGSET_GENERAL, 337 REGSET_GENERAL,
337 0, sizeof(struct pt_regs), 338 0, sizeof(struct pt_regs),
338 (void __user *)datap); 339 datap);
339 break; 340 break;
340 341
341 case PTRACE_SETREGS: 342 case PTRACE_SETREGS:
342 ret = copy_regset_from_user(child, &user_score_native_view, 343 ret = copy_regset_from_user(child, &user_score_native_view,
343 REGSET_GENERAL, 344 REGSET_GENERAL,
344 0, sizeof(struct pt_regs), 345 0, sizeof(struct pt_regs),
345 (const void __user *)datap); 346 datap);
346 break; 347 break;
347 348
348 default: 349 default:
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index 2cd42b58cb20..90a15d29feeb 100644
--- a/arch/sh/kernel/ptrace_32.c
+++ b/arch/sh/kernel/ptrace_32.c
@@ -365,9 +365,9 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task)
365 return &user_sh_native_view; 365 return &user_sh_native_view;
366} 366}
367 367
368long arch_ptrace(struct task_struct *child, long request, long addr, long data) 368long arch_ptrace(struct task_struct *child, long request,
369 unsigned long addr, unsigned long data)
369{ 370{
370 struct user * dummy = NULL;
371 unsigned long __user *datap = (unsigned long __user *)data; 371 unsigned long __user *datap = (unsigned long __user *)data;
372 int ret; 372 int ret;
373 373
@@ -383,17 +383,20 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
383 383
384 if (addr < sizeof(struct pt_regs)) 384 if (addr < sizeof(struct pt_regs))
385 tmp = get_stack_long(child, addr); 385 tmp = get_stack_long(child, addr);
386 else if (addr >= (long) &dummy->fpu && 386 else if (addr >= offsetof(struct user, fpu) &&
387 addr < (long) &dummy->u_fpvalid) { 387 addr < offsetof(struct user, u_fpvalid)) {
388 if (!tsk_used_math(child)) { 388 if (!tsk_used_math(child)) {
389 if (addr == (long)&dummy->fpu.fpscr) 389 if (addr == offsetof(struct user, fpu.fpscr))
390 tmp = FPSCR_INIT; 390 tmp = FPSCR_INIT;
391 else 391 else
392 tmp = 0; 392 tmp = 0;
393 } else 393 } else {
394 tmp = ((long *)child->thread.xstate) 394 unsigned long index;
395 [(addr - (long)&dummy->fpu) >> 2]; 395 index = addr - offsetof(struct user, fpu);
396 } else if (addr == (long) &dummy->u_fpvalid) 396 tmp = ((unsigned long *)child->thread.xstate)
397 [index >> 2];
398 }
399 } else if (addr == offsetof(struct user, u_fpvalid))
397 tmp = !!tsk_used_math(child); 400 tmp = !!tsk_used_math(child);
398 else if (addr == PT_TEXT_ADDR) 401 else if (addr == PT_TEXT_ADDR)
399 tmp = child->mm->start_code; 402 tmp = child->mm->start_code;
@@ -417,13 +420,15 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
417 420
418 if (addr < sizeof(struct pt_regs)) 421 if (addr < sizeof(struct pt_regs))
419 ret = put_stack_long(child, addr, data); 422 ret = put_stack_long(child, addr, data);
420 else if (addr >= (long) &dummy->fpu && 423 else if (addr >= offsetof(struct user, fpu) &&
421 addr < (long) &dummy->u_fpvalid) { 424 addr < offsetof(struct user, u_fpvalid)) {
425 unsigned long index;
426 index = addr - offsetof(struct user, fpu);
422 set_stopped_child_used_math(child); 427 set_stopped_child_used_math(child);
423 ((long *)child->thread.xstate) 428 ((unsigned long *)child->thread.xstate)
424 [(addr - (long)&dummy->fpu) >> 2] = data; 429 [index >> 2] = data;
425 ret = 0; 430 ret = 0;
426 } else if (addr == (long) &dummy->u_fpvalid) { 431 } else if (addr == offsetof(struct user, u_fpvalid)) {
427 conditional_stopped_child_used_math(data, child); 432 conditional_stopped_child_used_math(data, child);
428 ret = 0; 433 ret = 0;
429 } 434 }
@@ -433,35 +438,35 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
433 return copy_regset_to_user(child, &user_sh_native_view, 438 return copy_regset_to_user(child, &user_sh_native_view,
434 REGSET_GENERAL, 439 REGSET_GENERAL,
435 0, sizeof(struct pt_regs), 440 0, sizeof(struct pt_regs),
436 (void __user *)data); 441 datap);
437 case PTRACE_SETREGS: 442 case PTRACE_SETREGS:
438 return copy_regset_from_user(child, &user_sh_native_view, 443 return copy_regset_from_user(child, &user_sh_native_view,
439 REGSET_GENERAL, 444 REGSET_GENERAL,
440 0, sizeof(struct pt_regs), 445 0, sizeof(struct pt_regs),
441 (const void __user *)data); 446 datap);
442#ifdef CONFIG_SH_FPU 447#ifdef CONFIG_SH_FPU
443 case PTRACE_GETFPREGS: 448 case PTRACE_GETFPREGS:
444 return copy_regset_to_user(child, &user_sh_native_view, 449 return copy_regset_to_user(child, &user_sh_native_view,
445 REGSET_FPU, 450 REGSET_FPU,
446 0, sizeof(struct user_fpu_struct), 451 0, sizeof(struct user_fpu_struct),
447 (void __user *)data); 452 datap);
448 case PTRACE_SETFPREGS: 453 case PTRACE_SETFPREGS:
449 return copy_regset_from_user(child, &user_sh_native_view, 454 return copy_regset_from_user(child, &user_sh_native_view,
450 REGSET_FPU, 455 REGSET_FPU,
451 0, sizeof(struct user_fpu_struct), 456 0, sizeof(struct user_fpu_struct),
452 (const void __user *)data); 457 datap);
453#endif 458#endif
454#ifdef CONFIG_SH_DSP 459#ifdef CONFIG_SH_DSP
455 case PTRACE_GETDSPREGS: 460 case PTRACE_GETDSPREGS:
456 return copy_regset_to_user(child, &user_sh_native_view, 461 return copy_regset_to_user(child, &user_sh_native_view,
457 REGSET_DSP, 462 REGSET_DSP,
458 0, sizeof(struct pt_dspregs), 463 0, sizeof(struct pt_dspregs),
459 (void __user *)data); 464 datap);
460 case PTRACE_SETDSPREGS: 465 case PTRACE_SETDSPREGS:
461 return copy_regset_from_user(child, &user_sh_native_view, 466 return copy_regset_from_user(child, &user_sh_native_view,
462 REGSET_DSP, 467 REGSET_DSP,
463 0, sizeof(struct pt_dspregs), 468 0, sizeof(struct pt_dspregs),
464 (const void __user *)data); 469 datap);
465#endif 470#endif
466 default: 471 default:
467 ret = ptrace_request(child, request, addr, data); 472 ret = ptrace_request(child, request, addr, data);
diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c
index e0fb065914aa..4436eacddb15 100644
--- a/arch/sh/kernel/ptrace_64.c
+++ b/arch/sh/kernel/ptrace_64.c
@@ -383,9 +383,11 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task)
383 return &user_sh64_native_view; 383 return &user_sh64_native_view;
384} 384}
385 385
386long arch_ptrace(struct task_struct *child, long request, long addr, long data) 386long arch_ptrace(struct task_struct *child, long request,
387 unsigned long addr, unsigned long data)
387{ 388{
388 int ret; 389 int ret;
390 unsigned long __user *datap = (unsigned long __user *) data;
389 391
390 switch (request) { 392 switch (request) {
391 /* read the word at location addr in the USER area. */ 393 /* read the word at location addr in the USER area. */
@@ -400,13 +402,15 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
400 tmp = get_stack_long(child, addr); 402 tmp = get_stack_long(child, addr);
401 else if ((addr >= offsetof(struct user, fpu)) && 403 else if ((addr >= offsetof(struct user, fpu)) &&
402 (addr < offsetof(struct user, u_fpvalid))) { 404 (addr < offsetof(struct user, u_fpvalid))) {
403 tmp = get_fpu_long(child, addr - offsetof(struct user, fpu)); 405 unsigned long index;
406 index = addr - offsetof(struct user, fpu);
407 tmp = get_fpu_long(child, index);
404 } else if (addr == offsetof(struct user, u_fpvalid)) { 408 } else if (addr == offsetof(struct user, u_fpvalid)) {
405 tmp = !!tsk_used_math(child); 409 tmp = !!tsk_used_math(child);
406 } else { 410 } else {
407 break; 411 break;
408 } 412 }
409 ret = put_user(tmp, (unsigned long *)data); 413 ret = put_user(tmp, datap);
410 break; 414 break;
411 } 415 }
412 416
@@ -437,7 +441,9 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
437 } 441 }
438 else if ((addr >= offsetof(struct user, fpu)) && 442 else if ((addr >= offsetof(struct user, fpu)) &&
439 (addr < offsetof(struct user, u_fpvalid))) { 443 (addr < offsetof(struct user, u_fpvalid))) {
440 ret = put_fpu_long(child, addr - offsetof(struct user, fpu), data); 444 unsigned long index;
445 index = addr - offsetof(struct user, fpu);
446 ret = put_fpu_long(child, index, data);
441 } 447 }
442 break; 448 break;
443 449
@@ -445,23 +451,23 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
445 return copy_regset_to_user(child, &user_sh64_native_view, 451 return copy_regset_to_user(child, &user_sh64_native_view,
446 REGSET_GENERAL, 452 REGSET_GENERAL,
447 0, sizeof(struct pt_regs), 453 0, sizeof(struct pt_regs),
448 (void __user *)data); 454 datap);
449 case PTRACE_SETREGS: 455 case PTRACE_SETREGS:
450 return copy_regset_from_user(child, &user_sh64_native_view, 456 return copy_regset_from_user(child, &user_sh64_native_view,
451 REGSET_GENERAL, 457 REGSET_GENERAL,
452 0, sizeof(struct pt_regs), 458 0, sizeof(struct pt_regs),
453 (const void __user *)data); 459 datap);
454#ifdef CONFIG_SH_FPU 460#ifdef CONFIG_SH_FPU
455 case PTRACE_GETFPREGS: 461 case PTRACE_GETFPREGS:
456 return copy_regset_to_user(child, &user_sh64_native_view, 462 return copy_regset_to_user(child, &user_sh64_native_view,
457 REGSET_FPU, 463 REGSET_FPU,
458 0, sizeof(struct user_fpu_struct), 464 0, sizeof(struct user_fpu_struct),
459 (void __user *)data); 465 datap);
460 case PTRACE_SETFPREGS: 466 case PTRACE_SETFPREGS:
461 return copy_regset_from_user(child, &user_sh64_native_view, 467 return copy_regset_from_user(child, &user_sh64_native_view,
462 REGSET_FPU, 468 REGSET_FPU,
463 0, sizeof(struct user_fpu_struct), 469 0, sizeof(struct user_fpu_struct),
464 (const void __user *)data); 470 datap);
465#endif 471#endif
466 default: 472 default:
467 ret = ptrace_request(child, request, addr, data); 473 ret = ptrace_request(child, request, addr, data);
@@ -471,7 +477,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
471 return ret; 477 return ret;
472} 478}
473 479
474asmlinkage int sh64_ptrace(long request, long pid, long addr, long data) 480asmlinkage int sh64_ptrace(long request, long pid,
481 unsigned long addr, unsigned long data)
475{ 482{
476#define WPC_DBRMODE 0x0d104008 483#define WPC_DBRMODE 0x0d104008
477 static unsigned long first_call; 484 static unsigned long first_call;
diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h
index 2889574608db..c2ced21c9dc1 100644
--- a/arch/sparc/include/asm/io_32.h
+++ b/arch/sparc/include/asm/io_32.h
@@ -208,6 +208,21 @@ _memset_io(volatile void __iomem *dst, int c, __kernel_size_t n)
208#define memset_io(d,c,sz) _memset_io(d,c,sz) 208#define memset_io(d,c,sz) _memset_io(d,c,sz)
209 209
210static inline void 210static inline void
211_sbus_memcpy_fromio(void *dst, const volatile void __iomem *src,
212 __kernel_size_t n)
213{
214 char *d = dst;
215
216 while (n--) {
217 char tmp = sbus_readb(src);
218 *d++ = tmp;
219 src++;
220 }
221}
222
223#define sbus_memcpy_fromio(d, s, sz) _sbus_memcpy_fromio(d, s, sz)
224
225static inline void
211_memcpy_fromio(void *dst, const volatile void __iomem *src, __kernel_size_t n) 226_memcpy_fromio(void *dst, const volatile void __iomem *src, __kernel_size_t n)
212{ 227{
213 char *d = dst; 228 char *d = dst;
@@ -222,6 +237,22 @@ _memcpy_fromio(void *dst, const volatile void __iomem *src, __kernel_size_t n)
222#define memcpy_fromio(d,s,sz) _memcpy_fromio(d,s,sz) 237#define memcpy_fromio(d,s,sz) _memcpy_fromio(d,s,sz)
223 238
224static inline void 239static inline void
240_sbus_memcpy_toio(volatile void __iomem *dst, const void *src,
241 __kernel_size_t n)
242{
243 const char *s = src;
244 volatile void __iomem *d = dst;
245
246 while (n--) {
247 char tmp = *s++;
248 sbus_writeb(tmp, d);
249 d++;
250 }
251}
252
253#define sbus_memcpy_toio(d, s, sz) _sbus_memcpy_toio(d, s, sz)
254
255static inline void
225_memcpy_toio(volatile void __iomem *dst, const void *src, __kernel_size_t n) 256_memcpy_toio(volatile void __iomem *dst, const void *src, __kernel_size_t n)
226{ 257{
227 const char *s = src; 258 const char *s = src;
diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h
index 9517d063c79c..9c8965415f0a 100644
--- a/arch/sparc/include/asm/io_64.h
+++ b/arch/sparc/include/asm/io_64.h
@@ -419,6 +419,21 @@ _memset_io(volatile void __iomem *dst, int c, __kernel_size_t n)
419#define memset_io(d,c,sz) _memset_io(d,c,sz) 419#define memset_io(d,c,sz) _memset_io(d,c,sz)
420 420
421static inline void 421static inline void
422_sbus_memcpy_fromio(void *dst, const volatile void __iomem *src,
423 __kernel_size_t n)
424{
425 char *d = dst;
426
427 while (n--) {
428 char tmp = sbus_readb(src);
429 *d++ = tmp;
430 src++;
431 }
432}
433
434#define sbus_memcpy_fromio(d, s, sz) _sbus_memcpy_fromio(d, s, sz)
435
436static inline void
422_memcpy_fromio(void *dst, const volatile void __iomem *src, __kernel_size_t n) 437_memcpy_fromio(void *dst, const volatile void __iomem *src, __kernel_size_t n)
423{ 438{
424 char *d = dst; 439 char *d = dst;
@@ -433,6 +448,22 @@ _memcpy_fromio(void *dst, const volatile void __iomem *src, __kernel_size_t n)
433#define memcpy_fromio(d,s,sz) _memcpy_fromio(d,s,sz) 448#define memcpy_fromio(d,s,sz) _memcpy_fromio(d,s,sz)
434 449
435static inline void 450static inline void
451_sbus_memcpy_toio(volatile void __iomem *dst, const void *src,
452 __kernel_size_t n)
453{
454 const char *s = src;
455 volatile void __iomem *d = dst;
456
457 while (n--) {
458 char tmp = *s++;
459 sbus_writeb(tmp, d);
460 d++;
461 }
462}
463
464#define sbus_memcpy_toio(d, s, sz) _sbus_memcpy_toio(d, s, sz)
465
466static inline void
436_memcpy_toio(volatile void __iomem *dst, const void *src, __kernel_size_t n) 467_memcpy_toio(volatile void __iomem *dst, const void *src, __kernel_size_t n)
437{ 468{
438 const char *s = src; 469 const char *s = src;
diff --git a/arch/sparc/include/asm/pci_64.h b/arch/sparc/include/asm/pci_64.h
index 5312782f0b5e..948b686ec089 100644
--- a/arch/sparc/include/asm/pci_64.h
+++ b/arch/sparc/include/asm/pci_64.h
@@ -38,7 +38,7 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
38 * types on sparc64. However, it requires that the device 38 * types on sparc64. However, it requires that the device
39 * can drive enough of the 64 bits. 39 * can drive enough of the 64 bits.
40 */ 40 */
41#define PCI64_REQUIRED_MASK (~(dma64_addr_t)0) 41#define PCI64_REQUIRED_MASK (~(u64)0)
42#define PCI64_ADDR_BASE 0xfffc000000000000UL 42#define PCI64_ADDR_BASE 0xfffc000000000000UL
43 43
44#ifdef CONFIG_PCI 44#ifdef CONFIG_PCI
diff --git a/arch/sparc/kernel/ptrace_32.c b/arch/sparc/kernel/ptrace_32.c
index e608f397e11f..27b9e93d0121 100644
--- a/arch/sparc/kernel/ptrace_32.c
+++ b/arch/sparc/kernel/ptrace_32.c
@@ -323,18 +323,35 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task)
323 return &user_sparc32_view; 323 return &user_sparc32_view;
324} 324}
325 325
326long arch_ptrace(struct task_struct *child, long request, long addr, long data) 326struct fps {
327 unsigned long regs[32];
328 unsigned long fsr;
329 unsigned long flags;
330 unsigned long extra;
331 unsigned long fpqd;
332 struct fq {
333 unsigned long *insnaddr;
334 unsigned long insn;
335 } fpq[16];
336};
337
338long arch_ptrace(struct task_struct *child, long request,
339 unsigned long addr, unsigned long data)
327{ 340{
328 unsigned long addr2 = current->thread.kregs->u_regs[UREG_I4]; 341 unsigned long addr2 = current->thread.kregs->u_regs[UREG_I4];
342 void __user *addr2p;
329 const struct user_regset_view *view; 343 const struct user_regset_view *view;
344 struct pt_regs __user *pregs;
345 struct fps __user *fps;
330 int ret; 346 int ret;
331 347
332 view = task_user_regset_view(current); 348 view = task_user_regset_view(current);
349 addr2p = (void __user *) addr2;
350 pregs = (struct pt_regs __user *) addr;
351 fps = (struct fps __user *) addr;
333 352
334 switch(request) { 353 switch(request) {
335 case PTRACE_GETREGS: { 354 case PTRACE_GETREGS: {
336 struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
337
338 ret = copy_regset_to_user(child, view, REGSET_GENERAL, 355 ret = copy_regset_to_user(child, view, REGSET_GENERAL,
339 32 * sizeof(u32), 356 32 * sizeof(u32),
340 4 * sizeof(u32), 357 4 * sizeof(u32),
@@ -348,8 +365,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
348 } 365 }
349 366
350 case PTRACE_SETREGS: { 367 case PTRACE_SETREGS: {
351 struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
352
353 ret = copy_regset_from_user(child, view, REGSET_GENERAL, 368 ret = copy_regset_from_user(child, view, REGSET_GENERAL,
354 32 * sizeof(u32), 369 32 * sizeof(u32),
355 4 * sizeof(u32), 370 4 * sizeof(u32),
@@ -363,19 +378,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
363 } 378 }
364 379
365 case PTRACE_GETFPREGS: { 380 case PTRACE_GETFPREGS: {
366 struct fps {
367 unsigned long regs[32];
368 unsigned long fsr;
369 unsigned long flags;
370 unsigned long extra;
371 unsigned long fpqd;
372 struct fq {
373 unsigned long *insnaddr;
374 unsigned long insn;
375 } fpq[16];
376 };
377 struct fps __user *fps = (struct fps __user *) addr;
378
379 ret = copy_regset_to_user(child, view, REGSET_FP, 381 ret = copy_regset_to_user(child, view, REGSET_FP,
380 0 * sizeof(u32), 382 0 * sizeof(u32),
381 32 * sizeof(u32), 383 32 * sizeof(u32),
@@ -397,19 +399,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
397 } 399 }
398 400
399 case PTRACE_SETFPREGS: { 401 case PTRACE_SETFPREGS: {
400 struct fps {
401 unsigned long regs[32];
402 unsigned long fsr;
403 unsigned long flags;
404 unsigned long extra;
405 unsigned long fpqd;
406 struct fq {
407 unsigned long *insnaddr;
408 unsigned long insn;
409 } fpq[16];
410 };
411 struct fps __user *fps = (struct fps __user *) addr;
412
413 ret = copy_regset_from_user(child, view, REGSET_FP, 402 ret = copy_regset_from_user(child, view, REGSET_FP,
414 0 * sizeof(u32), 403 0 * sizeof(u32),
415 32 * sizeof(u32), 404 32 * sizeof(u32),
@@ -424,8 +413,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
424 413
425 case PTRACE_READTEXT: 414 case PTRACE_READTEXT:
426 case PTRACE_READDATA: 415 case PTRACE_READDATA:
427 ret = ptrace_readdata(child, addr, 416 ret = ptrace_readdata(child, addr, addr2p, data);
428 (void __user *) addr2, data);
429 417
430 if (ret == data) 418 if (ret == data)
431 ret = 0; 419 ret = 0;
@@ -435,8 +423,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
435 423
436 case PTRACE_WRITETEXT: 424 case PTRACE_WRITETEXT:
437 case PTRACE_WRITEDATA: 425 case PTRACE_WRITEDATA:
438 ret = ptrace_writedata(child, (void __user *) addr2, 426 ret = ptrace_writedata(child, addr2p, addr, data);
439 addr, data);
440 427
441 if (ret == data) 428 if (ret == data)
442 ret = 0; 429 ret = 0;
diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c
index aa90da08bf61..9ccc812bc09e 100644
--- a/arch/sparc/kernel/ptrace_64.c
+++ b/arch/sparc/kernel/ptrace_64.c
@@ -969,16 +969,19 @@ struct fps {
969 unsigned long fsr; 969 unsigned long fsr;
970}; 970};
971 971
972long arch_ptrace(struct task_struct *child, long request, long addr, long data) 972long arch_ptrace(struct task_struct *child, long request,
973 unsigned long addr, unsigned long data)
973{ 974{
974 const struct user_regset_view *view = task_user_regset_view(current); 975 const struct user_regset_view *view = task_user_regset_view(current);
975 unsigned long addr2 = task_pt_regs(current)->u_regs[UREG_I4]; 976 unsigned long addr2 = task_pt_regs(current)->u_regs[UREG_I4];
976 struct pt_regs __user *pregs; 977 struct pt_regs __user *pregs;
977 struct fps __user *fps; 978 struct fps __user *fps;
979 void __user *addr2p;
978 int ret; 980 int ret;
979 981
980 pregs = (struct pt_regs __user *) (unsigned long) addr; 982 pregs = (struct pt_regs __user *) addr;
981 fps = (struct fps __user *) (unsigned long) addr; 983 fps = (struct fps __user *) addr;
984 addr2p = (void __user *) addr2;
982 985
983 switch (request) { 986 switch (request) {
984 case PTRACE_PEEKUSR: 987 case PTRACE_PEEKUSR:
@@ -1029,8 +1032,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
1029 1032
1030 case PTRACE_READTEXT: 1033 case PTRACE_READTEXT:
1031 case PTRACE_READDATA: 1034 case PTRACE_READDATA:
1032 ret = ptrace_readdata(child, addr, 1035 ret = ptrace_readdata(child, addr, addr2p, data);
1033 (char __user *)addr2, data);
1034 if (ret == data) 1036 if (ret == data)
1035 ret = 0; 1037 ret = 0;
1036 else if (ret >= 0) 1038 else if (ret >= 0)
@@ -1039,8 +1041,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
1039 1041
1040 case PTRACE_WRITETEXT: 1042 case PTRACE_WRITETEXT:
1041 case PTRACE_WRITEDATA: 1043 case PTRACE_WRITEDATA:
1042 ret = ptrace_writedata(child, (char __user *) addr2, 1044 ret = ptrace_writedata(child, addr2p, addr, data);
1043 addr, data);
1044 if (ret == data) 1045 if (ret == data)
1045 ret = 0; 1046 ret = 0;
1046 else if (ret >= 0) 1047 else if (ret >= 0)
diff --git a/arch/sparc/mm/highmem.c b/arch/sparc/mm/highmem.c
index 5e50c09b7dce..4730eac0747b 100644
--- a/arch/sparc/mm/highmem.c
+++ b/arch/sparc/mm/highmem.c
@@ -75,7 +75,7 @@ void __kunmap_atomic(void *kvaddr)
75 return; 75 return;
76 } 76 }
77 77
78 type = kmap_atomic_idx_pop(); 78 type = kmap_atomic_idx();
79 79
80#ifdef CONFIG_DEBUG_HIGHMEM 80#ifdef CONFIG_DEBUG_HIGHMEM
81 { 81 {
@@ -104,6 +104,8 @@ void __kunmap_atomic(void *kvaddr)
104#endif 104#endif
105 } 105 }
106#endif 106#endif
107
108 kmap_atomic_idx_pop();
107 pagefault_enable(); 109 pagefault_enable();
108} 110}
109EXPORT_SYMBOL(__kunmap_atomic); 111EXPORT_SYMBOL(__kunmap_atomic);
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 89cfee07efa9..7e8c2844e093 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -58,6 +58,9 @@ config ARCH_SUPPORTS_OPTIMIZED_INLINING
58config ARCH_PHYS_ADDR_T_64BIT 58config ARCH_PHYS_ADDR_T_64BIT
59 def_bool y 59 def_bool y
60 60
61config ARCH_DMA_ADDR_T_64BIT
62 def_bool y
63
61config LOCKDEP_SUPPORT 64config LOCKDEP_SUPPORT
62 def_bool y 65 def_bool y
63 66
diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index 5b20c2874d51..9cd29884c09f 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -45,7 +45,8 @@ void ptrace_disable(struct task_struct *child)
45 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 45 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
46} 46}
47 47
48long arch_ptrace(struct task_struct *child, long request, long addr, long data) 48long arch_ptrace(struct task_struct *child, long request,
49 unsigned long addr, unsigned long data)
49{ 50{
50 unsigned long __user *datap = (long __user __force *)data; 51 unsigned long __user *datap = (long __user __force *)data;
51 unsigned long tmp; 52 unsigned long tmp;
@@ -57,7 +58,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
57 switch (request) { 58 switch (request) {
58 59
59 case PTRACE_PEEKUSR: /* Read register from pt_regs. */ 60 case PTRACE_PEEKUSR: /* Read register from pt_regs. */
60 if (addr < 0 || addr >= PTREGS_SIZE) 61 if (addr >= PTREGS_SIZE)
61 break; 62 break;
62 childreg = (char *)task_pt_regs(child) + addr; 63 childreg = (char *)task_pt_regs(child) + addr;
63#ifdef CONFIG_COMPAT 64#ifdef CONFIG_COMPAT
@@ -76,7 +77,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
76 break; 77 break;
77 78
78 case PTRACE_POKEUSR: /* Write register in pt_regs. */ 79 case PTRACE_POKEUSR: /* Write register in pt_regs. */
79 if (addr < 0 || addr >= PTREGS_SIZE) 80 if (addr >= PTREGS_SIZE)
80 break; 81 break;
81 childreg = (char *)task_pt_regs(child) + addr; 82 childreg = (char *)task_pt_regs(child) + addr;
82#ifdef CONFIG_COMPAT 83#ifdef CONFIG_COMPAT
@@ -98,7 +99,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
98 if (!access_ok(VERIFY_WRITE, datap, PTREGS_SIZE)) 99 if (!access_ok(VERIFY_WRITE, datap, PTREGS_SIZE))
99 break; 100 break;
100 childregs = (long *)task_pt_regs(child); 101 childregs = (long *)task_pt_regs(child);
101 for (i = 0; i < sizeof(struct pt_regs)/sizeof(long); ++i) { 102 for (i = 0; i < sizeof(struct pt_regs)/sizeof(unsigned long);
103 ++i) {
102 ret = __put_user(childregs[i], &datap[i]); 104 ret = __put_user(childregs[i], &datap[i]);
103 if (ret != 0) 105 if (ret != 0)
104 break; 106 break;
@@ -109,7 +111,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
109 if (!access_ok(VERIFY_READ, datap, PTREGS_SIZE)) 111 if (!access_ok(VERIFY_READ, datap, PTREGS_SIZE))
110 break; 112 break;
111 childregs = (long *)task_pt_regs(child); 113 childregs = (long *)task_pt_regs(child);
112 for (i = 0; i < sizeof(struct pt_regs)/sizeof(long); ++i) { 114 for (i = 0; i < sizeof(struct pt_regs)/sizeof(unsigned long);
115 ++i) {
113 ret = __get_user(childregs[i], &datap[i]); 116 ret = __get_user(childregs[i], &datap[i]);
114 if (ret != 0) 117 if (ret != 0)
115 break; 118 break;
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c
index f3a50e74f9a4..ae51cad12da0 100644
--- a/arch/tile/kernel/setup.c
+++ b/arch/tile/kernel/setup.c
@@ -30,8 +30,6 @@
30#include <linux/timex.h> 30#include <linux/timex.h>
31#include <asm/setup.h> 31#include <asm/setup.h>
32#include <asm/sections.h> 32#include <asm/sections.h>
33#include <asm/sections.h>
34#include <asm/cacheflush.h>
35#include <asm/cacheflush.h> 33#include <asm/cacheflush.h>
36#include <asm/pgalloc.h> 34#include <asm/pgalloc.h>
37#include <asm/mmu_context.h> 35#include <asm/mmu_context.h>
diff --git a/arch/tile/mm/highmem.c b/arch/tile/mm/highmem.c
index 8ef6595e162c..abb57331cf6e 100644
--- a/arch/tile/mm/highmem.c
+++ b/arch/tile/mm/highmem.c
@@ -241,7 +241,7 @@ void __kunmap_atomic(void *kvaddr)
241 pte_t pteval = *pte; 241 pte_t pteval = *pte;
242 int idx, type; 242 int idx, type;
243 243
244 type = kmap_atomic_idx_pop(); 244 type = kmap_atomic_idx();
245 idx = type + KM_TYPE_NR*smp_processor_id(); 245 idx = type + KM_TYPE_NR*smp_processor_id();
246 246
247 /* 247 /*
@@ -252,6 +252,7 @@ void __kunmap_atomic(void *kvaddr)
252 BUG_ON(!pte_present(pteval) && !pte_migrating(pteval)); 252 BUG_ON(!pte_present(pteval) && !pte_migrating(pteval));
253 kmap_atomic_unregister(pte_page(pteval), vaddr); 253 kmap_atomic_unregister(pte_page(pteval), vaddr);
254 kpte_clear_flush(pte, vaddr); 254 kpte_clear_flush(pte, vaddr);
255 kmap_atomic_idx_pop();
255 } else { 256 } else {
256 /* Must be a lowmem page */ 257 /* Must be a lowmem page */
257 BUG_ON(vaddr < PAGE_OFFSET); 258 BUG_ON(vaddr < PAGE_OFFSET);
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c
index e0510496596c..a5e33f29bbeb 100644
--- a/arch/um/kernel/ptrace.c
+++ b/arch/um/kernel/ptrace.c
@@ -42,10 +42,12 @@ void ptrace_disable(struct task_struct *child)
42extern int peek_user(struct task_struct * child, long addr, long data); 42extern int peek_user(struct task_struct * child, long addr, long data);
43extern int poke_user(struct task_struct * child, long addr, long data); 43extern int poke_user(struct task_struct * child, long addr, long data);
44 44
45long arch_ptrace(struct task_struct *child, long request, long addr, long data) 45long arch_ptrace(struct task_struct *child, long request,
46 unsigned long addr, unsigned long data)
46{ 47{
47 int i, ret; 48 int i, ret;
48 unsigned long __user *p = (void __user *)(unsigned long)data; 49 unsigned long __user *p = (void __user *)data;
50 void __user *vp = p;
49 51
50 switch (request) { 52 switch (request) {
51 /* read word at location addr. */ 53 /* read word at location addr. */
@@ -107,24 +109,20 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
107#endif 109#endif
108#ifdef PTRACE_GETFPREGS 110#ifdef PTRACE_GETFPREGS
109 case PTRACE_GETFPREGS: /* Get the child FPU state. */ 111 case PTRACE_GETFPREGS: /* Get the child FPU state. */
110 ret = get_fpregs((struct user_i387_struct __user *) data, 112 ret = get_fpregs(vp, child);
111 child);
112 break; 113 break;
113#endif 114#endif
114#ifdef PTRACE_SETFPREGS 115#ifdef PTRACE_SETFPREGS
115 case PTRACE_SETFPREGS: /* Set the child FPU state. */ 116 case PTRACE_SETFPREGS: /* Set the child FPU state. */
116 ret = set_fpregs((struct user_i387_struct __user *) data, 117 ret = set_fpregs(vp, child);
117 child);
118 break; 118 break;
119#endif 119#endif
120 case PTRACE_GET_THREAD_AREA: 120 case PTRACE_GET_THREAD_AREA:
121 ret = ptrace_get_thread_area(child, addr, 121 ret = ptrace_get_thread_area(child, addr, vp);
122 (struct user_desc __user *) data);
123 break; 122 break;
124 123
125 case PTRACE_SET_THREAD_AREA: 124 case PTRACE_SET_THREAD_AREA:
126 ret = ptrace_set_thread_area(child, addr, 125 ret = ptrace_set_thread_area(child, addr, datavp);
127 (struct user_desc __user *) data);
128 break; 126 break;
129 127
130 case PTRACE_FAULTINFO: { 128 case PTRACE_FAULTINFO: {
@@ -134,7 +132,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
134 * On i386, ptrace_faultinfo is smaller! 132 * On i386, ptrace_faultinfo is smaller!
135 */ 133 */
136 ret = copy_to_user(p, &child->thread.arch.faultinfo, 134 ret = copy_to_user(p, &child->thread.arch.faultinfo,
137 sizeof(struct ptrace_faultinfo)); 135 sizeof(struct ptrace_faultinfo)) ?
136 -EIO : 0;
138 break; 137 break;
139 } 138 }
140 139
@@ -158,7 +157,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
158#ifdef PTRACE_ARCH_PRCTL 157#ifdef PTRACE_ARCH_PRCTL
159 case PTRACE_ARCH_PRCTL: 158 case PTRACE_ARCH_PRCTL:
160 /* XXX Calls ptrace on the host - needs some SMP thinking */ 159 /* XXX Calls ptrace on the host - needs some SMP thinking */
161 ret = arch_prctl(child, data, (void *) addr); 160 ret = arch_prctl(child, data, (void __user *) addr);
162 break; 161 break;
163#endif 162#endif
164 default: 163 default:
diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c
index c9b176534d65..d23b2d3ea384 100644
--- a/arch/um/sys-i386/ptrace.c
+++ b/arch/um/sys-i386/ptrace.c
@@ -203,8 +203,8 @@ int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
203 (unsigned long *) &fpregs); 203 (unsigned long *) &fpregs);
204} 204}
205 205
206long subarch_ptrace(struct task_struct *child, long request, long addr, 206long subarch_ptrace(struct task_struct *child, long request,
207 long data) 207 unsigned long addr, unsigned long data)
208{ 208{
209 return -EIO; 209 return -EIO;
210} 210}
diff --git a/arch/um/sys-x86_64/ptrace.c b/arch/um/sys-x86_64/ptrace.c
index f3458d7d1c5a..f43613643cdb 100644
--- a/arch/um/sys-x86_64/ptrace.c
+++ b/arch/um/sys-x86_64/ptrace.c
@@ -175,19 +175,18 @@ int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
175 return restore_fp_registers(userspace_pid[cpu], fpregs); 175 return restore_fp_registers(userspace_pid[cpu], fpregs);
176} 176}
177 177
178long subarch_ptrace(struct task_struct *child, long request, long addr, 178long subarch_ptrace(struct task_struct *child, long request,
179 long data) 179 unsigned long addr, unsigned long data)
180{ 180{
181 int ret = -EIO; 181 int ret = -EIO;
182 void __user *datap = (void __user *) data;
182 183
183 switch (request) { 184 switch (request) {
184 case PTRACE_GETFPXREGS: /* Get the child FPU state. */ 185 case PTRACE_GETFPXREGS: /* Get the child FPU state. */
185 ret = get_fpregs((struct user_i387_struct __user *) data, 186 ret = get_fpregs(datap, child);
186 child);
187 break; 187 break;
188 case PTRACE_SETFPXREGS: /* Set the child FPU state. */ 188 case PTRACE_SETFPXREGS: /* Set the child FPU state. */
189 ret = set_fpregs((struct user_i387_struct __user *) data, 189 ret = set_fpregs(datap, child);
190 child);
191 break; 190 break;
192 } 191 }
193 192
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 70c4872cd8aa..45892dc4b72a 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -801,7 +801,8 @@ void ptrace_disable(struct task_struct *child)
801static const struct user_regset_view user_x86_32_view; /* Initialized below. */ 801static const struct user_regset_view user_x86_32_view; /* Initialized below. */
802#endif 802#endif
803 803
804long arch_ptrace(struct task_struct *child, long request, long addr, long data) 804long arch_ptrace(struct task_struct *child, long request,
805 unsigned long addr, unsigned long data)
805{ 806{
806 int ret; 807 int ret;
807 unsigned long __user *datap = (unsigned long __user *)data; 808 unsigned long __user *datap = (unsigned long __user *)data;
@@ -812,8 +813,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
812 unsigned long tmp; 813 unsigned long tmp;
813 814
814 ret = -EIO; 815 ret = -EIO;
815 if ((addr & (sizeof(data) - 1)) || addr < 0 || 816 if ((addr & (sizeof(data) - 1)) || addr >= sizeof(struct user))
816 addr >= sizeof(struct user))
817 break; 817 break;
818 818
819 tmp = 0; /* Default return condition */ 819 tmp = 0; /* Default return condition */
@@ -830,8 +830,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
830 830
831 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ 831 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
832 ret = -EIO; 832 ret = -EIO;
833 if ((addr & (sizeof(data) - 1)) || addr < 0 || 833 if ((addr & (sizeof(data) - 1)) || addr >= sizeof(struct user))
834 addr >= sizeof(struct user))
835 break; 834 break;
836 835
837 if (addr < sizeof(struct user_regs_struct)) 836 if (addr < sizeof(struct user_regs_struct))
@@ -888,17 +887,17 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
888 887
889#if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION 888#if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
890 case PTRACE_GET_THREAD_AREA: 889 case PTRACE_GET_THREAD_AREA:
891 if (addr < 0) 890 if ((int) addr < 0)
892 return -EIO; 891 return -EIO;
893 ret = do_get_thread_area(child, addr, 892 ret = do_get_thread_area(child, addr,
894 (struct user_desc __user *) data); 893 (struct user_desc __user *)data);
895 break; 894 break;
896 895
897 case PTRACE_SET_THREAD_AREA: 896 case PTRACE_SET_THREAD_AREA:
898 if (addr < 0) 897 if ((int) addr < 0)
899 return -EIO; 898 return -EIO;
900 ret = do_set_thread_area(child, addr, 899 ret = do_set_thread_area(child, addr,
901 (struct user_desc __user *) data, 0); 900 (struct user_desc __user *)data, 0);
902 break; 901 break;
903#endif 902#endif
904 903
diff --git a/arch/x86/mm/highmem_32.c b/arch/x86/mm/highmem_32.c
index d723e369003c..b49962662101 100644
--- a/arch/x86/mm/highmem_32.c
+++ b/arch/x86/mm/highmem_32.c
@@ -74,7 +74,7 @@ void __kunmap_atomic(void *kvaddr)
74 vaddr <= __fix_to_virt(FIX_KMAP_BEGIN)) { 74 vaddr <= __fix_to_virt(FIX_KMAP_BEGIN)) {
75 int idx, type; 75 int idx, type;
76 76
77 type = kmap_atomic_idx_pop(); 77 type = kmap_atomic_idx();
78 idx = type + KM_TYPE_NR * smp_processor_id(); 78 idx = type + KM_TYPE_NR * smp_processor_id();
79 79
80#ifdef CONFIG_DEBUG_HIGHMEM 80#ifdef CONFIG_DEBUG_HIGHMEM
@@ -87,6 +87,7 @@ void __kunmap_atomic(void *kvaddr)
87 * attributes or becomes a protected page in a hypervisor. 87 * attributes or becomes a protected page in a hypervisor.
88 */ 88 */
89 kpte_clear_flush(kmap_pte-idx, vaddr); 89 kpte_clear_flush(kmap_pte-idx, vaddr);
90 kmap_atomic_idx_pop();
90 } 91 }
91#ifdef CONFIG_DEBUG_HIGHMEM 92#ifdef CONFIG_DEBUG_HIGHMEM
92 else { 93 else {
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 84346200e783..71a59296af80 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -51,7 +51,6 @@
51#include <asm/numa.h> 51#include <asm/numa.h>
52#include <asm/cacheflush.h> 52#include <asm/cacheflush.h>
53#include <asm/init.h> 53#include <asm/init.h>
54#include <linux/bootmem.h>
55 54
56static int __init parse_direct_gbpages_off(char *arg) 55static int __init parse_direct_gbpages_off(char *arg)
57{ 56{
diff --git a/arch/x86/mm/iomap_32.c b/arch/x86/mm/iomap_32.c
index 75a3d7f24a2c..7b179b499fa3 100644
--- a/arch/x86/mm/iomap_32.c
+++ b/arch/x86/mm/iomap_32.c
@@ -98,7 +98,7 @@ iounmap_atomic(void __iomem *kvaddr)
98 vaddr <= __fix_to_virt(FIX_KMAP_BEGIN)) { 98 vaddr <= __fix_to_virt(FIX_KMAP_BEGIN)) {
99 int idx, type; 99 int idx, type;
100 100
101 type = kmap_atomic_idx_pop(); 101 type = kmap_atomic_idx();
102 idx = type + KM_TYPE_NR * smp_processor_id(); 102 idx = type + KM_TYPE_NR * smp_processor_id();
103 103
104#ifdef CONFIG_DEBUG_HIGHMEM 104#ifdef CONFIG_DEBUG_HIGHMEM
@@ -111,6 +111,7 @@ iounmap_atomic(void __iomem *kvaddr)
111 * attributes or becomes a protected page in a hypervisor. 111 * attributes or becomes a protected page in a hypervisor.
112 */ 112 */
113 kpte_clear_flush(kmap_pte-idx, vaddr); 113 kpte_clear_flush(kmap_pte-idx, vaddr);
114 kmap_atomic_idx_pop();
114 } 115 }
115 116
116 pagefault_enable(); 117 pagefault_enable();
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 580da1aa4a4c..70ddeaeb1ef3 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -59,7 +59,6 @@
59#include <asm/pgtable.h> 59#include <asm/pgtable.h>
60#include <asm/tlbflush.h> 60#include <asm/tlbflush.h>
61#include <asm/reboot.h> 61#include <asm/reboot.h>
62#include <asm/setup.h>
63#include <asm/stackprotector.h> 62#include <asm/stackprotector.h>
64#include <asm/hypervisor.h> 63#include <asm/hypervisor.h>
65 64
diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c
index 9d4e1ceb3f09..c72c9473ef99 100644
--- a/arch/xtensa/kernel/ptrace.c
+++ b/arch/xtensa/kernel/ptrace.c
@@ -256,9 +256,11 @@ int ptrace_pokeusr(struct task_struct *child, long regno, long val)
256 return 0; 256 return 0;
257} 257}
258 258
259long arch_ptrace(struct task_struct *child, long request, long addr, long data) 259long arch_ptrace(struct task_struct *child, long request,
260 unsigned long addr, unsigned long data)
260{ 261{
261 int ret = -EPERM; 262 int ret = -EPERM;
263 void __user *datap = (void __user *) data;
262 264
263 switch (request) { 265 switch (request) {
264 case PTRACE_PEEKTEXT: /* read word at location addr. */ 266 case PTRACE_PEEKTEXT: /* read word at location addr. */
@@ -267,7 +269,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
267 break; 269 break;
268 270
269 case PTRACE_PEEKUSR: /* read register specified by addr. */ 271 case PTRACE_PEEKUSR: /* read register specified by addr. */
270 ret = ptrace_peekusr(child, addr, (void __user *) data); 272 ret = ptrace_peekusr(child, addr, datap);
271 break; 273 break;
272 274
273 case PTRACE_POKETEXT: /* write the word at location addr. */ 275 case PTRACE_POKETEXT: /* write the word at location addr. */
@@ -280,19 +282,19 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
280 break; 282 break;
281 283
282 case PTRACE_GETREGS: 284 case PTRACE_GETREGS:
283 ret = ptrace_getregs(child, (void __user *) data); 285 ret = ptrace_getregs(child, datap);
284 break; 286 break;
285 287
286 case PTRACE_SETREGS: 288 case PTRACE_SETREGS:
287 ret = ptrace_setregs(child, (void __user *) data); 289 ret = ptrace_setregs(child, datap);
288 break; 290 break;
289 291
290 case PTRACE_GETXTREGS: 292 case PTRACE_GETXTREGS:
291 ret = ptrace_getxregs(child, (void __user *) data); 293 ret = ptrace_getxregs(child, datap);
292 break; 294 break;
293 295
294 case PTRACE_SETXTREGS: 296 case PTRACE_SETXTREGS:
295 ret = ptrace_setxregs(child, (void __user *) data); 297 ret = ptrace_setxregs(child, datap);
296 break; 298 break;
297 299
298 default: 300 default: