diff options
author | Ingo Molnar <mingo@kernel.org> | 2012-06-20 08:22:32 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-06-20 08:22:34 -0400 |
commit | 6a991acceedce3ca93caef8ba7af2468c9451614 (patch) | |
tree | 1997d71fc57bdebd12fc70a73070281614b52f15 /arch | |
parent | 70fb74a5420f9caa3e001d65004e4b669124283e (diff) | |
parent | 485802a6c524e62b5924849dd727ddbb1497cc71 (diff) |
Merge commit 'v3.5-rc3' into x86/debug
Merge it in to pick up a fix that we are going to clean up in this
branch.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch')
103 files changed, 557 insertions, 779 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index b649c5904a4..84449dd8f03 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -7,7 +7,6 @@ config ARM | |||
7 | select HAVE_IDE if PCI || ISA || PCMCIA | 7 | select HAVE_IDE if PCI || ISA || PCMCIA |
8 | select HAVE_DMA_ATTRS | 8 | select HAVE_DMA_ATTRS |
9 | select HAVE_DMA_CONTIGUOUS if (CPU_V6 || CPU_V6K || CPU_V7) | 9 | select HAVE_DMA_CONTIGUOUS if (CPU_V6 || CPU_V6K || CPU_V7) |
10 | select CMA if (CPU_V6 || CPU_V6K || CPU_V7) | ||
11 | select HAVE_MEMBLOCK | 10 | select HAVE_MEMBLOCK |
12 | select RTC_LIB | 11 | select RTC_LIB |
13 | select SYS_SUPPORTS_APM_EMULATION | 12 | select SYS_SUPPORTS_APM_EMULATION |
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c index 9d7eb530f95..aa07f5938f0 100644 --- a/arch/arm/common/dmabounce.c +++ b/arch/arm/common/dmabounce.c | |||
@@ -366,8 +366,8 @@ static int __dmabounce_sync_for_cpu(struct device *dev, dma_addr_t addr, | |||
366 | struct safe_buffer *buf; | 366 | struct safe_buffer *buf; |
367 | unsigned long off; | 367 | unsigned long off; |
368 | 368 | ||
369 | dev_dbg(dev, "%s(dma=%#x,off=%#lx,sz=%zx,dir=%x)\n", | 369 | dev_dbg(dev, "%s(dma=%#x,sz=%zx,dir=%x)\n", |
370 | __func__, addr, off, sz, dir); | 370 | __func__, addr, sz, dir); |
371 | 371 | ||
372 | buf = find_safe_buffer_dev(dev, addr, __func__); | 372 | buf = find_safe_buffer_dev(dev, addr, __func__); |
373 | if (!buf) | 373 | if (!buf) |
@@ -377,8 +377,8 @@ static int __dmabounce_sync_for_cpu(struct device *dev, dma_addr_t addr, | |||
377 | 377 | ||
378 | BUG_ON(buf->direction != dir); | 378 | BUG_ON(buf->direction != dir); |
379 | 379 | ||
380 | dev_dbg(dev, "%s: unsafe buffer %p (dma=%#x) mapped to %p (dma=%#x)\n", | 380 | dev_dbg(dev, "%s: unsafe buffer %p (dma=%#x off=%#lx) mapped to %p (dma=%#x)\n", |
381 | __func__, buf->ptr, virt_to_dma(dev, buf->ptr), | 381 | __func__, buf->ptr, virt_to_dma(dev, buf->ptr), off, |
382 | buf->safe, buf->safe_dma_addr); | 382 | buf->safe, buf->safe_dma_addr); |
383 | 383 | ||
384 | DO_STATS(dev->archdata.dmabounce->bounce_count++); | 384 | DO_STATS(dev->archdata.dmabounce->bounce_count++); |
@@ -406,8 +406,8 @@ static int __dmabounce_sync_for_device(struct device *dev, dma_addr_t addr, | |||
406 | struct safe_buffer *buf; | 406 | struct safe_buffer *buf; |
407 | unsigned long off; | 407 | unsigned long off; |
408 | 408 | ||
409 | dev_dbg(dev, "%s(dma=%#x,off=%#lx,sz=%zx,dir=%x)\n", | 409 | dev_dbg(dev, "%s(dma=%#x,sz=%zx,dir=%x)\n", |
410 | __func__, addr, off, sz, dir); | 410 | __func__, addr, sz, dir); |
411 | 411 | ||
412 | buf = find_safe_buffer_dev(dev, addr, __func__); | 412 | buf = find_safe_buffer_dev(dev, addr, __func__); |
413 | if (!buf) | 413 | if (!buf) |
@@ -417,8 +417,8 @@ static int __dmabounce_sync_for_device(struct device *dev, dma_addr_t addr, | |||
417 | 417 | ||
418 | BUG_ON(buf->direction != dir); | 418 | BUG_ON(buf->direction != dir); |
419 | 419 | ||
420 | dev_dbg(dev, "%s: unsafe buffer %p (dma=%#x) mapped to %p (dma=%#x)\n", | 420 | dev_dbg(dev, "%s: unsafe buffer %p (dma=%#x off=%#lx) mapped to %p (dma=%#x)\n", |
421 | __func__, buf->ptr, virt_to_dma(dev, buf->ptr), | 421 | __func__, buf->ptr, virt_to_dma(dev, buf->ptr), off, |
422 | buf->safe, buf->safe_dma_addr); | 422 | buf->safe, buf->safe_dma_addr); |
423 | 423 | ||
424 | DO_STATS(dev->archdata.dmabounce->bounce_count++); | 424 | DO_STATS(dev->archdata.dmabounce->bounce_count++); |
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index 54d49ddb9b8..5fb47a14f4b 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c | |||
@@ -271,9 +271,9 @@ static struct platform_device *create_simple_dss_pdev(const char *pdev_name, | |||
271 | goto err; | 271 | goto err; |
272 | } | 272 | } |
273 | 273 | ||
274 | r = omap_device_register(pdev); | 274 | r = platform_device_add(pdev); |
275 | if (r) { | 275 | if (r) { |
276 | pr_err("Could not register omap_device for %s\n", pdev_name); | 276 | pr_err("Could not register platform_device for %s\n", pdev_name); |
277 | goto err; | 277 | goto err; |
278 | } | 278 | } |
279 | 279 | ||
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index ea6b4315409..d766e4256b7 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -228,7 +228,7 @@ static pte_t **consistent_pte; | |||
228 | 228 | ||
229 | #define DEFAULT_CONSISTENT_DMA_SIZE SZ_2M | 229 | #define DEFAULT_CONSISTENT_DMA_SIZE SZ_2M |
230 | 230 | ||
231 | unsigned long consistent_base = CONSISTENT_END - DEFAULT_CONSISTENT_DMA_SIZE; | 231 | static unsigned long consistent_base = CONSISTENT_END - DEFAULT_CONSISTENT_DMA_SIZE; |
232 | 232 | ||
233 | void __init init_consistent_dma_size(unsigned long size) | 233 | void __init init_consistent_dma_size(unsigned long size) |
234 | { | 234 | { |
@@ -268,10 +268,8 @@ static int __init consistent_init(void) | |||
268 | unsigned long base = consistent_base; | 268 | unsigned long base = consistent_base; |
269 | unsigned long num_ptes = (CONSISTENT_END - base) >> PMD_SHIFT; | 269 | unsigned long num_ptes = (CONSISTENT_END - base) >> PMD_SHIFT; |
270 | 270 | ||
271 | #ifndef CONFIG_ARM_DMA_USE_IOMMU | 271 | if (IS_ENABLED(CONFIG_CMA) && !IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) |
272 | if (cpu_architecture() >= CPU_ARCH_ARMv6) | ||
273 | return 0; | 272 | return 0; |
274 | #endif | ||
275 | 273 | ||
276 | consistent_pte = kmalloc(num_ptes * sizeof(pte_t), GFP_KERNEL); | 274 | consistent_pte = kmalloc(num_ptes * sizeof(pte_t), GFP_KERNEL); |
277 | if (!consistent_pte) { | 275 | if (!consistent_pte) { |
@@ -323,7 +321,7 @@ static struct arm_vmregion_head coherent_head = { | |||
323 | .vm_list = LIST_HEAD_INIT(coherent_head.vm_list), | 321 | .vm_list = LIST_HEAD_INIT(coherent_head.vm_list), |
324 | }; | 322 | }; |
325 | 323 | ||
326 | size_t coherent_pool_size = DEFAULT_CONSISTENT_DMA_SIZE / 8; | 324 | static size_t coherent_pool_size = DEFAULT_CONSISTENT_DMA_SIZE / 8; |
327 | 325 | ||
328 | static int __init early_coherent_pool(char *p) | 326 | static int __init early_coherent_pool(char *p) |
329 | { | 327 | { |
@@ -342,7 +340,7 @@ static int __init coherent_init(void) | |||
342 | struct page *page; | 340 | struct page *page; |
343 | void *ptr; | 341 | void *ptr; |
344 | 342 | ||
345 | if (cpu_architecture() < CPU_ARCH_ARMv6) | 343 | if (!IS_ENABLED(CONFIG_CMA)) |
346 | return 0; | 344 | return 0; |
347 | 345 | ||
348 | ptr = __alloc_from_contiguous(NULL, size, prot, &page); | 346 | ptr = __alloc_from_contiguous(NULL, size, prot, &page); |
@@ -704,7 +702,7 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, | |||
704 | 702 | ||
705 | if (arch_is_coherent() || nommu()) | 703 | if (arch_is_coherent() || nommu()) |
706 | addr = __alloc_simple_buffer(dev, size, gfp, &page); | 704 | addr = __alloc_simple_buffer(dev, size, gfp, &page); |
707 | else if (cpu_architecture() < CPU_ARCH_ARMv6) | 705 | else if (!IS_ENABLED(CONFIG_CMA)) |
708 | addr = __alloc_remap_buffer(dev, size, gfp, prot, &page, caller); | 706 | addr = __alloc_remap_buffer(dev, size, gfp, prot, &page, caller); |
709 | else if (gfp & GFP_ATOMIC) | 707 | else if (gfp & GFP_ATOMIC) |
710 | addr = __alloc_from_pool(dev, size, &page, caller); | 708 | addr = __alloc_from_pool(dev, size, &page, caller); |
@@ -773,7 +771,7 @@ void arm_dma_free(struct device *dev, size_t size, void *cpu_addr, | |||
773 | 771 | ||
774 | if (arch_is_coherent() || nommu()) { | 772 | if (arch_is_coherent() || nommu()) { |
775 | __dma_free_buffer(page, size); | 773 | __dma_free_buffer(page, size); |
776 | } else if (cpu_architecture() < CPU_ARCH_ARMv6) { | 774 | } else if (!IS_ENABLED(CONFIG_CMA)) { |
777 | __dma_free_remap(cpu_addr, size); | 775 | __dma_free_remap(cpu_addr, size); |
778 | __dma_free_buffer(page, size); | 776 | __dma_free_buffer(page, size); |
779 | } else { | 777 | } else { |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index c21d06c7dd7..f54d5921976 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -212,7 +212,7 @@ EXPORT_SYMBOL(arm_dma_zone_size); | |||
212 | * allocations. This must be the smallest DMA mask in the system, | 212 | * allocations. This must be the smallest DMA mask in the system, |
213 | * so a successful GFP_DMA allocation will always satisfy this. | 213 | * so a successful GFP_DMA allocation will always satisfy this. |
214 | */ | 214 | */ |
215 | u32 arm_dma_limit; | 215 | phys_addr_t arm_dma_limit; |
216 | 216 | ||
217 | static void __init arm_adjust_dma_zone(unsigned long *size, unsigned long *hole, | 217 | static void __init arm_adjust_dma_zone(unsigned long *size, unsigned long *hole, |
218 | unsigned long dma_size) | 218 | unsigned long dma_size) |
diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h index 93dc0c17cdc..c471436c795 100644 --- a/arch/arm/mm/mm.h +++ b/arch/arm/mm/mm.h | |||
@@ -62,7 +62,7 @@ extern void __flush_dcache_page(struct address_space *mapping, struct page *page | |||
62 | #endif | 62 | #endif |
63 | 63 | ||
64 | #ifdef CONFIG_ZONE_DMA | 64 | #ifdef CONFIG_ZONE_DMA |
65 | extern u32 arm_dma_limit; | 65 | extern phys_addr_t arm_dma_limit; |
66 | #else | 66 | #else |
67 | #define arm_dma_limit ((u32)~0) | 67 | #define arm_dma_limit ((u32)~0) |
68 | #endif | 68 | #endif |
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index cac5b6be572..14712012826 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig | |||
@@ -7,6 +7,8 @@ config M68K | |||
7 | select GENERIC_IRQ_SHOW | 7 | select GENERIC_IRQ_SHOW |
8 | select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS | 8 | select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS |
9 | select GENERIC_CPU_DEVICES | 9 | select GENERIC_CPU_DEVICES |
10 | select GENERIC_STRNCPY_FROM_USER if MMU | ||
11 | select GENERIC_STRNLEN_USER if MMU | ||
10 | select FPU if MMU | 12 | select FPU if MMU |
11 | select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE | 13 | select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE |
12 | 14 | ||
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild index 1a922fad76f..eafa2539a8e 100644 --- a/arch/m68k/include/asm/Kbuild +++ b/arch/m68k/include/asm/Kbuild | |||
@@ -1,2 +1,4 @@ | |||
1 | include include/asm-generic/Kbuild.asm | 1 | include include/asm-generic/Kbuild.asm |
2 | header-y += cachectl.h | 2 | header-y += cachectl.h |
3 | |||
4 | generic-y += word-at-a-time.h | ||
diff --git a/arch/m68k/include/asm/m528xsim.h b/arch/m68k/include/asm/m528xsim.h index d63b99ff7ff..497c31c803f 100644 --- a/arch/m68k/include/asm/m528xsim.h +++ b/arch/m68k/include/asm/m528xsim.h | |||
@@ -86,7 +86,7 @@ | |||
86 | /* | 86 | /* |
87 | * QSPI module. | 87 | * QSPI module. |
88 | */ | 88 | */ |
89 | #define MCFQSPI_IOBASE (MCF_IPSBAR + 0x340) | 89 | #define MCFQSPI_BASE (MCF_IPSBAR + 0x340) |
90 | #define MCFQSPI_SIZE 0x40 | 90 | #define MCFQSPI_SIZE 0x40 |
91 | 91 | ||
92 | #define MCFQSPI_CS0 147 | 92 | #define MCFQSPI_CS0 147 |
diff --git a/arch/m68k/include/asm/uaccess_mm.h b/arch/m68k/include/asm/uaccess_mm.h index 9c80cd515b2..472c891a4ae 100644 --- a/arch/m68k/include/asm/uaccess_mm.h +++ b/arch/m68k/include/asm/uaccess_mm.h | |||
@@ -379,12 +379,15 @@ __constant_copy_to_user(void __user *to, const void *from, unsigned long n) | |||
379 | #define copy_from_user(to, from, n) __copy_from_user(to, from, n) | 379 | #define copy_from_user(to, from, n) __copy_from_user(to, from, n) |
380 | #define copy_to_user(to, from, n) __copy_to_user(to, from, n) | 380 | #define copy_to_user(to, from, n) __copy_to_user(to, from, n) |
381 | 381 | ||
382 | long strncpy_from_user(char *dst, const char __user *src, long count); | 382 | #define user_addr_max() \ |
383 | long strnlen_user(const char __user *src, long n); | 383 | (segment_eq(get_fs(), USER_DS) ? TASK_SIZE : ~0UL) |
384 | |||
385 | extern long strncpy_from_user(char *dst, const char __user *src, long count); | ||
386 | extern __must_check long strlen_user(const char __user *str); | ||
387 | extern __must_check long strnlen_user(const char __user *str, long n); | ||
388 | |||
384 | unsigned long __clear_user(void __user *to, unsigned long n); | 389 | unsigned long __clear_user(void __user *to, unsigned long n); |
385 | 390 | ||
386 | #define clear_user __clear_user | 391 | #define clear_user __clear_user |
387 | 392 | ||
388 | #define strlen_user(str) strnlen_user(str, 32767) | ||
389 | |||
390 | #endif /* _M68K_UACCESS_H */ | 393 | #endif /* _M68K_UACCESS_H */ |
diff --git a/arch/m68k/kernel/ptrace.c b/arch/m68k/kernel/ptrace.c index 8b4a2222e65..1bc10e62b9a 100644 --- a/arch/m68k/kernel/ptrace.c +++ b/arch/m68k/kernel/ptrace.c | |||
@@ -286,7 +286,7 @@ asmlinkage void syscall_trace(void) | |||
286 | } | 286 | } |
287 | } | 287 | } |
288 | 288 | ||
289 | #ifdef CONFIG_COLDFIRE | 289 | #if defined(CONFIG_COLDFIRE) || !defined(CONFIG_MMU) |
290 | asmlinkage int syscall_trace_enter(void) | 290 | asmlinkage int syscall_trace_enter(void) |
291 | { | 291 | { |
292 | int ret = 0; | 292 | int ret = 0; |
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c index d7deb7fc7eb..707f0573ec6 100644 --- a/arch/m68k/kernel/time.c +++ b/arch/m68k/kernel/time.c | |||
@@ -85,7 +85,7 @@ void __init time_init(void) | |||
85 | mach_sched_init(timer_interrupt); | 85 | mach_sched_init(timer_interrupt); |
86 | } | 86 | } |
87 | 87 | ||
88 | #ifdef CONFIG_M68KCLASSIC | 88 | #ifdef CONFIG_ARCH_USES_GETTIMEOFFSET |
89 | 89 | ||
90 | u32 arch_gettimeoffset(void) | 90 | u32 arch_gettimeoffset(void) |
91 | { | 91 | { |
@@ -108,4 +108,4 @@ static int __init rtc_init(void) | |||
108 | 108 | ||
109 | module_init(rtc_init); | 109 | module_init(rtc_init); |
110 | 110 | ||
111 | #endif /* CONFIG_M68KCLASSIC */ | 111 | #endif /* CONFIG_ARCH_USES_GETTIMEOFFSET */ |
diff --git a/arch/m68k/lib/uaccess.c b/arch/m68k/lib/uaccess.c index 5664386338d..5e97f2ee7c1 100644 --- a/arch/m68k/lib/uaccess.c +++ b/arch/m68k/lib/uaccess.c | |||
@@ -104,80 +104,6 @@ unsigned long __generic_copy_to_user(void __user *to, const void *from, | |||
104 | EXPORT_SYMBOL(__generic_copy_to_user); | 104 | EXPORT_SYMBOL(__generic_copy_to_user); |
105 | 105 | ||
106 | /* | 106 | /* |
107 | * Copy a null terminated string from userspace. | ||
108 | */ | ||
109 | long strncpy_from_user(char *dst, const char __user *src, long count) | ||
110 | { | ||
111 | long res; | ||
112 | char c; | ||
113 | |||
114 | if (count <= 0) | ||
115 | return count; | ||
116 | |||
117 | asm volatile ("\n" | ||
118 | "1: "MOVES".b (%2)+,%4\n" | ||
119 | " move.b %4,(%1)+\n" | ||
120 | " jeq 2f\n" | ||
121 | " subq.l #1,%3\n" | ||
122 | " jne 1b\n" | ||
123 | "2: sub.l %3,%0\n" | ||
124 | "3:\n" | ||
125 | " .section .fixup,\"ax\"\n" | ||
126 | " .even\n" | ||
127 | "10: move.l %5,%0\n" | ||
128 | " jra 3b\n" | ||
129 | " .previous\n" | ||
130 | "\n" | ||
131 | " .section __ex_table,\"a\"\n" | ||
132 | " .align 4\n" | ||
133 | " .long 1b,10b\n" | ||
134 | " .previous" | ||
135 | : "=d" (res), "+a" (dst), "+a" (src), "+r" (count), "=&d" (c) | ||
136 | : "i" (-EFAULT), "0" (count)); | ||
137 | |||
138 | return res; | ||
139 | } | ||
140 | EXPORT_SYMBOL(strncpy_from_user); | ||
141 | |||
142 | /* | ||
143 | * Return the size of a string (including the ending 0) | ||
144 | * | ||
145 | * Return 0 on exception, a value greater than N if too long | ||
146 | */ | ||
147 | long strnlen_user(const char __user *src, long n) | ||
148 | { | ||
149 | char c; | ||
150 | long res; | ||
151 | |||
152 | asm volatile ("\n" | ||
153 | "1: subq.l #1,%1\n" | ||
154 | " jmi 3f\n" | ||
155 | "2: "MOVES".b (%0)+,%2\n" | ||
156 | " tst.b %2\n" | ||
157 | " jne 1b\n" | ||
158 | " jra 4f\n" | ||
159 | "\n" | ||
160 | "3: addq.l #1,%0\n" | ||
161 | "4: sub.l %4,%0\n" | ||
162 | "5:\n" | ||
163 | " .section .fixup,\"ax\"\n" | ||
164 | " .even\n" | ||
165 | "20: sub.l %0,%0\n" | ||
166 | " jra 5b\n" | ||
167 | " .previous\n" | ||
168 | "\n" | ||
169 | " .section __ex_table,\"a\"\n" | ||
170 | " .align 4\n" | ||
171 | " .long 2b,20b\n" | ||
172 | " .previous\n" | ||
173 | : "=&a" (res), "+d" (n), "=&d" (c) | ||
174 | : "0" (src), "r" (src)); | ||
175 | |||
176 | return res; | ||
177 | } | ||
178 | EXPORT_SYMBOL(strnlen_user); | ||
179 | |||
180 | /* | ||
181 | * Zero Userspace | 107 | * Zero Userspace |
182 | */ | 108 | */ |
183 | 109 | ||
diff --git a/arch/m68k/platform/68328/timers.c b/arch/m68k/platform/68328/timers.c index c801c172b82..f4dc9b29560 100644 --- a/arch/m68k/platform/68328/timers.c +++ b/arch/m68k/platform/68328/timers.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | static u32 m68328_tick_cnt; | 55 | static u32 m68328_tick_cnt; |
56 | static irq_handler_t timer_interrupt; | ||
56 | 57 | ||
57 | /***************************************************************************/ | 58 | /***************************************************************************/ |
58 | 59 | ||
@@ -62,7 +63,7 @@ static irqreturn_t hw_tick(int irq, void *dummy) | |||
62 | TSTAT &= 0; | 63 | TSTAT &= 0; |
63 | 64 | ||
64 | m68328_tick_cnt += TICKS_PER_JIFFY; | 65 | m68328_tick_cnt += TICKS_PER_JIFFY; |
65 | return arch_timer_interrupt(irq, dummy); | 66 | return timer_interrupt(irq, dummy); |
66 | } | 67 | } |
67 | 68 | ||
68 | /***************************************************************************/ | 69 | /***************************************************************************/ |
@@ -99,7 +100,7 @@ static struct clocksource m68328_clk = { | |||
99 | 100 | ||
100 | /***************************************************************************/ | 101 | /***************************************************************************/ |
101 | 102 | ||
102 | void hw_timer_init(void) | 103 | void hw_timer_init(irq_handler_t handler) |
103 | { | 104 | { |
104 | /* disable timer 1 */ | 105 | /* disable timer 1 */ |
105 | TCTL = 0; | 106 | TCTL = 0; |
@@ -115,6 +116,7 @@ void hw_timer_init(void) | |||
115 | /* Enable timer 1 */ | 116 | /* Enable timer 1 */ |
116 | TCTL |= TCTL_TEN; | 117 | TCTL |= TCTL_TEN; |
117 | clocksource_register_hz(&m68328_clk, TICKS_PER_JIFFY*HZ); | 118 | clocksource_register_hz(&m68328_clk, TICKS_PER_JIFFY*HZ); |
119 | timer_interrupt = handler; | ||
118 | } | 120 | } |
119 | 121 | ||
120 | /***************************************************************************/ | 122 | /***************************************************************************/ |
diff --git a/arch/m68k/platform/68360/config.c b/arch/m68k/platform/68360/config.c index 255fc03913e..9877cefad1e 100644 --- a/arch/m68k/platform/68360/config.c +++ b/arch/m68k/platform/68360/config.c | |||
@@ -35,6 +35,7 @@ extern void m360_cpm_reset(void); | |||
35 | #define OSCILLATOR (unsigned long int)33000000 | 35 | #define OSCILLATOR (unsigned long int)33000000 |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | static irq_handler_t timer_interrupt; | ||
38 | unsigned long int system_clock; | 39 | unsigned long int system_clock; |
39 | 40 | ||
40 | extern QUICC *pquicc; | 41 | extern QUICC *pquicc; |
@@ -52,7 +53,7 @@ static irqreturn_t hw_tick(int irq, void *dummy) | |||
52 | 53 | ||
53 | pquicc->timer_ter1 = 0x0002; /* clear timer event */ | 54 | pquicc->timer_ter1 = 0x0002; /* clear timer event */ |
54 | 55 | ||
55 | return arch_timer_interrupt(irq, dummy); | 56 | return timer_interrupt(irq, dummy); |
56 | } | 57 | } |
57 | 58 | ||
58 | static struct irqaction m68360_timer_irq = { | 59 | static struct irqaction m68360_timer_irq = { |
@@ -61,7 +62,7 @@ static struct irqaction m68360_timer_irq = { | |||
61 | .handler = hw_tick, | 62 | .handler = hw_tick, |
62 | }; | 63 | }; |
63 | 64 | ||
64 | void hw_timer_init(void) | 65 | void hw_timer_init(irq_handler_t handler) |
65 | { | 66 | { |
66 | unsigned char prescaler; | 67 | unsigned char prescaler; |
67 | unsigned short tgcr_save; | 68 | unsigned short tgcr_save; |
@@ -94,6 +95,8 @@ void hw_timer_init(void) | |||
94 | 95 | ||
95 | pquicc->timer_ter1 = 0x0003; /* clear timer events */ | 96 | pquicc->timer_ter1 = 0x0003; /* clear timer events */ |
96 | 97 | ||
98 | timer_interrupt = handler; | ||
99 | |||
97 | /* enable timer 1 interrupt in CIMR */ | 100 | /* enable timer 1 interrupt in CIMR */ |
98 | setup_irq(CPMVEC_TIMER1, &m68360_timer_irq); | 101 | setup_irq(CPMVEC_TIMER1, &m68360_timer_irq); |
99 | 102 | ||
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile index dbc3850b1d0..5707f1a6234 100644 --- a/arch/parisc/Makefile +++ b/arch/parisc/Makefile | |||
@@ -21,6 +21,7 @@ KBUILD_DEFCONFIG := default_defconfig | |||
21 | 21 | ||
22 | NM = sh $(srctree)/arch/parisc/nm | 22 | NM = sh $(srctree)/arch/parisc/nm |
23 | CHECKFLAGS += -D__hppa__=1 | 23 | CHECKFLAGS += -D__hppa__=1 |
24 | LIBGCC = $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) | ||
24 | 25 | ||
25 | MACHINE := $(shell uname -m) | 26 | MACHINE := $(shell uname -m) |
26 | ifeq ($(MACHINE),parisc*) | 27 | ifeq ($(MACHINE),parisc*) |
@@ -79,7 +80,7 @@ kernel-y := mm/ kernel/ math-emu/ | |||
79 | kernel-$(CONFIG_HPUX) += hpux/ | 80 | kernel-$(CONFIG_HPUX) += hpux/ |
80 | 81 | ||
81 | core-y += $(addprefix arch/parisc/, $(kernel-y)) | 82 | core-y += $(addprefix arch/parisc/, $(kernel-y)) |
82 | libs-y += arch/parisc/lib/ `$(CC) -print-libgcc-file-name` | 83 | libs-y += arch/parisc/lib/ $(LIBGCC) |
83 | 84 | ||
84 | drivers-$(CONFIG_OPROFILE) += arch/parisc/oprofile/ | 85 | drivers-$(CONFIG_OPROFILE) += arch/parisc/oprofile/ |
85 | 86 | ||
diff --git a/arch/parisc/include/asm/Kbuild b/arch/parisc/include/asm/Kbuild index 19a434f5505..4383707d980 100644 --- a/arch/parisc/include/asm/Kbuild +++ b/arch/parisc/include/asm/Kbuild | |||
@@ -1,3 +1,4 @@ | |||
1 | include include/asm-generic/Kbuild.asm | 1 | include include/asm-generic/Kbuild.asm |
2 | 2 | ||
3 | header-y += pdc.h | 3 | header-y += pdc.h |
4 | generic-y += word-at-a-time.h | ||
diff --git a/arch/parisc/include/asm/bug.h b/arch/parisc/include/asm/bug.h index 72cfdb0cfdd..62a33338549 100644 --- a/arch/parisc/include/asm/bug.h +++ b/arch/parisc/include/asm/bug.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _PARISC_BUG_H | 1 | #ifndef _PARISC_BUG_H |
2 | #define _PARISC_BUG_H | 2 | #define _PARISC_BUG_H |
3 | 3 | ||
4 | #include <linux/kernel.h> /* for BUGFLAG_TAINT */ | ||
5 | |||
4 | /* | 6 | /* |
5 | * Tell the user there is some problem. | 7 | * Tell the user there is some problem. |
6 | * The offending file and line are encoded in the __bug_table section. | 8 | * The offending file and line are encoded in the __bug_table section. |
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h index c9aac24b02e..32b394f3b85 100644 --- a/arch/powerpc/include/asm/hw_irq.h +++ b/arch/powerpc/include/asm/hw_irq.h | |||
@@ -100,6 +100,9 @@ static inline void hard_irq_disable(void) | |||
100 | get_paca()->irq_happened |= PACA_IRQ_HARD_DIS; | 100 | get_paca()->irq_happened |= PACA_IRQ_HARD_DIS; |
101 | } | 101 | } |
102 | 102 | ||
103 | /* include/linux/interrupt.h needs hard_irq_disable to be a macro */ | ||
104 | #define hard_irq_disable hard_irq_disable | ||
105 | |||
103 | /* | 106 | /* |
104 | * This is called by asynchronous interrupts to conditionally | 107 | * This is called by asynchronous interrupts to conditionally |
105 | * re-enable hard interrupts when soft-disabled after having | 108 | * re-enable hard interrupts when soft-disabled after having |
diff --git a/arch/powerpc/kernel/module_32.c b/arch/powerpc/kernel/module_32.c index 0b6d79617d7..2e3200ca485 100644 --- a/arch/powerpc/kernel/module_32.c +++ b/arch/powerpc/kernel/module_32.c | |||
@@ -176,8 +176,8 @@ int module_frob_arch_sections(Elf32_Ehdr *hdr, | |||
176 | 176 | ||
177 | static inline int entry_matches(struct ppc_plt_entry *entry, Elf32_Addr val) | 177 | static inline int entry_matches(struct ppc_plt_entry *entry, Elf32_Addr val) |
178 | { | 178 | { |
179 | if (entry->jump[0] == 0x3d600000 + ((val + 0x8000) >> 16) | 179 | if (entry->jump[0] == 0x3d800000 + ((val + 0x8000) >> 16) |
180 | && entry->jump[1] == 0x396b0000 + (val & 0xffff)) | 180 | && entry->jump[1] == 0x398c0000 + (val & 0xffff)) |
181 | return 1; | 181 | return 1; |
182 | return 0; | 182 | return 0; |
183 | } | 183 | } |
@@ -204,10 +204,9 @@ static uint32_t do_plt_call(void *location, | |||
204 | entry++; | 204 | entry++; |
205 | } | 205 | } |
206 | 206 | ||
207 | /* Stolen from Paul Mackerras as well... */ | 207 | entry->jump[0] = 0x3d800000+((val+0x8000)>>16); /* lis r12,sym@ha */ |
208 | entry->jump[0] = 0x3d600000+((val+0x8000)>>16); /* lis r11,sym@ha */ | 208 | entry->jump[1] = 0x398c0000 + (val&0xffff); /* addi r12,r12,sym@l*/ |
209 | entry->jump[1] = 0x396b0000 + (val&0xffff); /* addi r11,r11,sym@l*/ | 209 | entry->jump[2] = 0x7d8903a6; /* mtctr r12 */ |
210 | entry->jump[2] = 0x7d6903a6; /* mtctr r11 */ | ||
211 | entry->jump[3] = 0x4e800420; /* bctr */ | 210 | entry->jump[3] = 0x4e800420; /* bctr */ |
212 | 211 | ||
213 | DEBUGP("Initialized plt for 0x%x at %p\n", val, entry); | 212 | DEBUGP("Initialized plt for 0x%x at %p\n", val, entry); |
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 99a995c2a3f..be171ee73bf 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -475,6 +475,7 @@ void timer_interrupt(struct pt_regs * regs) | |||
475 | struct pt_regs *old_regs; | 475 | struct pt_regs *old_regs; |
476 | u64 *next_tb = &__get_cpu_var(decrementers_next_tb); | 476 | u64 *next_tb = &__get_cpu_var(decrementers_next_tb); |
477 | struct clock_event_device *evt = &__get_cpu_var(decrementers); | 477 | struct clock_event_device *evt = &__get_cpu_var(decrementers); |
478 | u64 now; | ||
478 | 479 | ||
479 | /* Ensure a positive value is written to the decrementer, or else | 480 | /* Ensure a positive value is written to the decrementer, or else |
480 | * some CPUs will continue to take decrementer exceptions. | 481 | * some CPUs will continue to take decrementer exceptions. |
@@ -509,9 +510,16 @@ void timer_interrupt(struct pt_regs * regs) | |||
509 | irq_work_run(); | 510 | irq_work_run(); |
510 | } | 511 | } |
511 | 512 | ||
512 | *next_tb = ~(u64)0; | 513 | now = get_tb_or_rtc(); |
513 | if (evt->event_handler) | 514 | if (now >= *next_tb) { |
514 | evt->event_handler(evt); | 515 | *next_tb = ~(u64)0; |
516 | if (evt->event_handler) | ||
517 | evt->event_handler(evt); | ||
518 | } else { | ||
519 | now = *next_tb - now; | ||
520 | if (now <= DECREMENTER_MAX) | ||
521 | set_dec((int)now); | ||
522 | } | ||
515 | 523 | ||
516 | #ifdef CONFIG_PPC64 | 524 | #ifdef CONFIG_PPC64 |
517 | /* collect purr register values often, for accurate calculations */ | 525 | /* collect purr register values often, for accurate calculations */ |
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 99bcd0ee838..31d9db7913e 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -32,6 +32,8 @@ config SUPERH | |||
32 | select GENERIC_SMP_IDLE_THREAD | 32 | select GENERIC_SMP_IDLE_THREAD |
33 | select GENERIC_CLOCKEVENTS | 33 | select GENERIC_CLOCKEVENTS |
34 | select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST | 34 | select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST |
35 | select GENERIC_STRNCPY_FROM_USER | ||
36 | select GENERIC_STRNLEN_USER | ||
35 | help | 37 | help |
36 | The SuperH is a RISC processor targeted for use in embedded systems | 38 | The SuperH is a RISC processor targeted for use in embedded systems |
37 | and consumer electronics; it was also used in the Sega Dreamcast | 39 | and consumer electronics; it was also used in the Sega Dreamcast |
diff --git a/arch/sh/Makefile b/arch/sh/Makefile index 46edf070da1..aed701c7b11 100644 --- a/arch/sh/Makefile +++ b/arch/sh/Makefile | |||
@@ -9,6 +9,12 @@ | |||
9 | # License. See the file "COPYING" in the main directory of this archive | 9 | # License. See the file "COPYING" in the main directory of this archive |
10 | # for more details. | 10 | # for more details. |
11 | # | 11 | # |
12 | ifneq ($(SUBARCH),$(ARCH)) | ||
13 | ifeq ($(CROSS_COMPILE),) | ||
14 | CROSS_COMPILE := $(call cc-cross-prefix, $(UTS_MACHINE)-linux- $(UTS_MACHINE)-linux-gnu- $(UTS_MACHINE)-unknown-linux-gnu-) | ||
15 | endif | ||
16 | endif | ||
17 | |||
12 | isa-y := any | 18 | isa-y := any |
13 | isa-$(CONFIG_SH_DSP) := sh | 19 | isa-$(CONFIG_SH_DSP) := sh |
14 | isa-$(CONFIG_CPU_SH2) := sh2 | 20 | isa-$(CONFIG_CPU_SH2) := sh2 |
@@ -106,19 +112,13 @@ LDFLAGS_vmlinux += --defsym phys_stext=_stext-$(CONFIG_PAGE_OFFSET) \ | |||
106 | KBUILD_DEFCONFIG := cayman_defconfig | 112 | KBUILD_DEFCONFIG := cayman_defconfig |
107 | endif | 113 | endif |
108 | 114 | ||
109 | ifneq ($(SUBARCH),$(ARCH)) | ||
110 | ifeq ($(CROSS_COMPILE),) | ||
111 | CROSS_COMPILE := $(call cc-cross-prefix, $(UTS_MACHINE)-linux- $(UTS_MACHINE)-linux-gnu- $(UTS_MACHINE)-unknown-linux-gnu-) | ||
112 | endif | ||
113 | endif | ||
114 | |||
115 | ifdef CONFIG_CPU_LITTLE_ENDIAN | 115 | ifdef CONFIG_CPU_LITTLE_ENDIAN |
116 | ld-bfd := elf32-$(UTS_MACHINE)-linux | 116 | ld-bfd := elf32-$(UTS_MACHINE)-linux |
117 | LDFLAGS_vmlinux += --defsym 'jiffies=jiffies_64' --oformat $(ld-bfd) | 117 | LDFLAGS_vmlinux += --defsym jiffies=jiffies_64 --oformat $(ld-bfd) |
118 | LDFLAGS += -EL | 118 | LDFLAGS += -EL |
119 | else | 119 | else |
120 | ld-bfd := elf32-$(UTS_MACHINE)big-linux | 120 | ld-bfd := elf32-$(UTS_MACHINE)big-linux |
121 | LDFLAGS_vmlinux += --defsym 'jiffies=jiffies_64+4' --oformat $(ld-bfd) | 121 | LDFLAGS_vmlinux += --defsym jiffies=jiffies_64+4 --oformat $(ld-bfd) |
122 | LDFLAGS += -EB | 122 | LDFLAGS += -EB |
123 | endif | 123 | endif |
124 | 124 | ||
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild index 7beb42322f6..7b673ddcd55 100644 --- a/arch/sh/include/asm/Kbuild +++ b/arch/sh/include/asm/Kbuild | |||
@@ -1,5 +1,39 @@ | |||
1 | include include/asm-generic/Kbuild.asm | 1 | include include/asm-generic/Kbuild.asm |
2 | 2 | ||
3 | generic-y += bitsperlong.h | ||
4 | generic-y += cputime.h | ||
5 | generic-y += current.h | ||
6 | generic-y += delay.h | ||
7 | generic-y += div64.h | ||
8 | generic-y += emergency-restart.h | ||
9 | generic-y += errno.h | ||
10 | generic-y += fcntl.h | ||
11 | generic-y += ioctl.h | ||
12 | generic-y += ipcbuf.h | ||
13 | generic-y += irq_regs.h | ||
14 | generic-y += kvm_para.h | ||
15 | generic-y += local.h | ||
16 | generic-y += local64.h | ||
17 | generic-y += param.h | ||
18 | generic-y += parport.h | ||
19 | generic-y += percpu.h | ||
20 | generic-y += poll.h | ||
21 | generic-y += mman.h | ||
22 | generic-y += msgbuf.h | ||
23 | generic-y += resource.h | ||
24 | generic-y += scatterlist.h | ||
25 | generic-y += sembuf.h | ||
26 | generic-y += serial.h | ||
27 | generic-y += shmbuf.h | ||
28 | generic-y += siginfo.h | ||
29 | generic-y += sizes.h | ||
30 | generic-y += socket.h | ||
31 | generic-y += statfs.h | ||
32 | generic-y += termbits.h | ||
33 | generic-y += termios.h | ||
34 | generic-y += ucontext.h | ||
35 | generic-y += xor.h | ||
36 | |||
3 | header-y += cachectl.h | 37 | header-y += cachectl.h |
4 | header-y += cpu-features.h | 38 | header-y += cpu-features.h |
5 | header-y += hw_breakpoint.h | 39 | header-y += hw_breakpoint.h |
diff --git a/arch/sh/include/asm/bitsperlong.h b/arch/sh/include/asm/bitsperlong.h deleted file mode 100644 index 6dc0bb0c13b..00000000000 --- a/arch/sh/include/asm/bitsperlong.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/bitsperlong.h> | ||
diff --git a/arch/sh/include/asm/cputime.h b/arch/sh/include/asm/cputime.h deleted file mode 100644 index 6ca395d1393..00000000000 --- a/arch/sh/include/asm/cputime.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __SH_CPUTIME_H | ||
2 | #define __SH_CPUTIME_H | ||
3 | |||
4 | #include <asm-generic/cputime.h> | ||
5 | |||
6 | #endif /* __SH_CPUTIME_H */ | ||
diff --git a/arch/sh/include/asm/current.h b/arch/sh/include/asm/current.h deleted file mode 100644 index 4c51401b553..00000000000 --- a/arch/sh/include/asm/current.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/current.h> | ||
diff --git a/arch/sh/include/asm/delay.h b/arch/sh/include/asm/delay.h deleted file mode 100644 index 9670e127b7b..00000000000 --- a/arch/sh/include/asm/delay.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/delay.h> | ||
diff --git a/arch/sh/include/asm/div64.h b/arch/sh/include/asm/div64.h deleted file mode 100644 index 6cd978cefb2..00000000000 --- a/arch/sh/include/asm/div64.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/div64.h> | ||
diff --git a/arch/sh/include/asm/emergency-restart.h b/arch/sh/include/asm/emergency-restart.h deleted file mode 100644 index 108d8c48e42..00000000000 --- a/arch/sh/include/asm/emergency-restart.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef _ASM_EMERGENCY_RESTART_H | ||
2 | #define _ASM_EMERGENCY_RESTART_H | ||
3 | |||
4 | #include <asm-generic/emergency-restart.h> | ||
5 | |||
6 | #endif /* _ASM_EMERGENCY_RESTART_H */ | ||
diff --git a/arch/sh/include/asm/errno.h b/arch/sh/include/asm/errno.h deleted file mode 100644 index 51cf6f9cebb..00000000000 --- a/arch/sh/include/asm/errno.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __ASM_SH_ERRNO_H | ||
2 | #define __ASM_SH_ERRNO_H | ||
3 | |||
4 | #include <asm-generic/errno.h> | ||
5 | |||
6 | #endif /* __ASM_SH_ERRNO_H */ | ||
diff --git a/arch/sh/include/asm/fcntl.h b/arch/sh/include/asm/fcntl.h deleted file mode 100644 index 46ab12db573..00000000000 --- a/arch/sh/include/asm/fcntl.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/fcntl.h> | ||
diff --git a/arch/sh/include/asm/ioctl.h b/arch/sh/include/asm/ioctl.h deleted file mode 100644 index b279fe06dfe..00000000000 --- a/arch/sh/include/asm/ioctl.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/ioctl.h> | ||
diff --git a/arch/sh/include/asm/ipcbuf.h b/arch/sh/include/asm/ipcbuf.h deleted file mode 100644 index 84c7e51cb6d..00000000000 --- a/arch/sh/include/asm/ipcbuf.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/ipcbuf.h> | ||
diff --git a/arch/sh/include/asm/irq_regs.h b/arch/sh/include/asm/irq_regs.h deleted file mode 100644 index 3dd9c0b7027..00000000000 --- a/arch/sh/include/asm/irq_regs.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/irq_regs.h> | ||
diff --git a/arch/sh/include/asm/kvm_para.h b/arch/sh/include/asm/kvm_para.h deleted file mode 100644 index 14fab8f0b95..00000000000 --- a/arch/sh/include/asm/kvm_para.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/kvm_para.h> | ||
diff --git a/arch/sh/include/asm/local.h b/arch/sh/include/asm/local.h deleted file mode 100644 index 9ed9b9cb459..00000000000 --- a/arch/sh/include/asm/local.h +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | #ifndef __ASM_SH_LOCAL_H | ||
2 | #define __ASM_SH_LOCAL_H | ||
3 | |||
4 | #include <asm-generic/local.h> | ||
5 | |||
6 | #endif /* __ASM_SH_LOCAL_H */ | ||
7 | |||
diff --git a/arch/sh/include/asm/local64.h b/arch/sh/include/asm/local64.h deleted file mode 100644 index 36c93b5cc23..00000000000 --- a/arch/sh/include/asm/local64.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/local64.h> | ||
diff --git a/arch/sh/include/asm/mman.h b/arch/sh/include/asm/mman.h deleted file mode 100644 index 8eebf89f5ab..00000000000 --- a/arch/sh/include/asm/mman.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/mman.h> | ||
diff --git a/arch/sh/include/asm/msgbuf.h b/arch/sh/include/asm/msgbuf.h deleted file mode 100644 index 809134c644a..00000000000 --- a/arch/sh/include/asm/msgbuf.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/msgbuf.h> | ||
diff --git a/arch/sh/include/asm/param.h b/arch/sh/include/asm/param.h deleted file mode 100644 index 965d4542797..00000000000 --- a/arch/sh/include/asm/param.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/param.h> | ||
diff --git a/arch/sh/include/asm/parport.h b/arch/sh/include/asm/parport.h deleted file mode 100644 index cf252af6459..00000000000 --- a/arch/sh/include/asm/parport.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/parport.h> | ||
diff --git a/arch/sh/include/asm/percpu.h b/arch/sh/include/asm/percpu.h deleted file mode 100644 index 4db4b39a439..00000000000 --- a/arch/sh/include/asm/percpu.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __ARCH_SH_PERCPU | ||
2 | #define __ARCH_SH_PERCPU | ||
3 | |||
4 | #include <asm-generic/percpu.h> | ||
5 | |||
6 | #endif /* __ARCH_SH_PERCPU */ | ||
diff --git a/arch/sh/include/asm/poll.h b/arch/sh/include/asm/poll.h deleted file mode 100644 index c98509d3149..00000000000 --- a/arch/sh/include/asm/poll.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/poll.h> | ||
diff --git a/arch/sh/include/asm/resource.h b/arch/sh/include/asm/resource.h deleted file mode 100644 index 9c2499a86ec..00000000000 --- a/arch/sh/include/asm/resource.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __ASM_SH_RESOURCE_H | ||
2 | #define __ASM_SH_RESOURCE_H | ||
3 | |||
4 | #include <asm-generic/resource.h> | ||
5 | |||
6 | #endif /* __ASM_SH_RESOURCE_H */ | ||
diff --git a/arch/sh/include/asm/scatterlist.h b/arch/sh/include/asm/scatterlist.h deleted file mode 100644 index 98dfc3510f1..00000000000 --- a/arch/sh/include/asm/scatterlist.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __ASM_SH_SCATTERLIST_H | ||
2 | #define __ASM_SH_SCATTERLIST_H | ||
3 | |||
4 | #include <asm-generic/scatterlist.h> | ||
5 | |||
6 | #endif /* __ASM_SH_SCATTERLIST_H */ | ||
diff --git a/arch/sh/include/asm/sembuf.h b/arch/sh/include/asm/sembuf.h deleted file mode 100644 index 7673b83cfef..00000000000 --- a/arch/sh/include/asm/sembuf.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/sembuf.h> | ||
diff --git a/arch/sh/include/asm/serial.h b/arch/sh/include/asm/serial.h deleted file mode 100644 index a0cb0caff15..00000000000 --- a/arch/sh/include/asm/serial.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/serial.h> | ||
diff --git a/arch/sh/include/asm/shmbuf.h b/arch/sh/include/asm/shmbuf.h deleted file mode 100644 index 83c05fc2de3..00000000000 --- a/arch/sh/include/asm/shmbuf.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/shmbuf.h> | ||
diff --git a/arch/sh/include/asm/siginfo.h b/arch/sh/include/asm/siginfo.h deleted file mode 100644 index 813040ed68a..00000000000 --- a/arch/sh/include/asm/siginfo.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __ASM_SH_SIGINFO_H | ||
2 | #define __ASM_SH_SIGINFO_H | ||
3 | |||
4 | #include <asm-generic/siginfo.h> | ||
5 | |||
6 | #endif /* __ASM_SH_SIGINFO_H */ | ||
diff --git a/arch/sh/include/asm/sizes.h b/arch/sh/include/asm/sizes.h deleted file mode 100644 index dd248c2e108..00000000000 --- a/arch/sh/include/asm/sizes.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/sizes.h> | ||
diff --git a/arch/sh/include/asm/socket.h b/arch/sh/include/asm/socket.h deleted file mode 100644 index 6b71384b9d8..00000000000 --- a/arch/sh/include/asm/socket.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/socket.h> | ||
diff --git a/arch/sh/include/asm/statfs.h b/arch/sh/include/asm/statfs.h deleted file mode 100644 index 9202a023328..00000000000 --- a/arch/sh/include/asm/statfs.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __ASM_SH_STATFS_H | ||
2 | #define __ASM_SH_STATFS_H | ||
3 | |||
4 | #include <asm-generic/statfs.h> | ||
5 | |||
6 | #endif /* __ASM_SH_STATFS_H */ | ||
diff --git a/arch/sh/include/asm/termbits.h b/arch/sh/include/asm/termbits.h deleted file mode 100644 index 3935b106de7..00000000000 --- a/arch/sh/include/asm/termbits.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/termbits.h> | ||
diff --git a/arch/sh/include/asm/termios.h b/arch/sh/include/asm/termios.h deleted file mode 100644 index 280d78a9d96..00000000000 --- a/arch/sh/include/asm/termios.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/termios.h> | ||
diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h index 050f221fa89..8698a80ed00 100644 --- a/arch/sh/include/asm/uaccess.h +++ b/arch/sh/include/asm/uaccess.h | |||
@@ -25,6 +25,8 @@ | |||
25 | (__chk_user_ptr(addr), \ | 25 | (__chk_user_ptr(addr), \ |
26 | __access_ok((unsigned long __force)(addr), (size))) | 26 | __access_ok((unsigned long __force)(addr), (size))) |
27 | 27 | ||
28 | #define user_addr_max() (current_thread_info()->addr_limit.seg) | ||
29 | |||
28 | /* | 30 | /* |
29 | * Uh, these should become the main single-value transfer routines ... | 31 | * Uh, these should become the main single-value transfer routines ... |
30 | * They automatically use the right size if we just have the right | 32 | * They automatically use the right size if we just have the right |
@@ -100,6 +102,11 @@ struct __large_struct { unsigned long buf[100]; }; | |||
100 | # include "uaccess_64.h" | 102 | # include "uaccess_64.h" |
101 | #endif | 103 | #endif |
102 | 104 | ||
105 | extern long strncpy_from_user(char *dest, const char __user *src, long count); | ||
106 | |||
107 | extern __must_check long strlen_user(const char __user *str); | ||
108 | extern __must_check long strnlen_user(const char __user *str, long n); | ||
109 | |||
103 | /* Generic arbitrary sized copy. */ | 110 | /* Generic arbitrary sized copy. */ |
104 | /* Return the number of bytes NOT copied */ | 111 | /* Return the number of bytes NOT copied */ |
105 | __kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n); | 112 | __kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n); |
@@ -137,37 +144,6 @@ __kernel_size_t __clear_user(void *addr, __kernel_size_t size); | |||
137 | __cl_size; \ | 144 | __cl_size; \ |
138 | }) | 145 | }) |
139 | 146 | ||
140 | /** | ||
141 | * strncpy_from_user: - Copy a NUL terminated string from userspace. | ||
142 | * @dst: Destination address, in kernel space. This buffer must be at | ||
143 | * least @count bytes long. | ||
144 | * @src: Source address, in user space. | ||
145 | * @count: Maximum number of bytes to copy, including the trailing NUL. | ||
146 | * | ||
147 | * Copies a NUL-terminated string from userspace to kernel space. | ||
148 | * | ||
149 | * On success, returns the length of the string (not including the trailing | ||
150 | * NUL). | ||
151 | * | ||
152 | * If access to userspace fails, returns -EFAULT (some data may have been | ||
153 | * copied). | ||
154 | * | ||
155 | * If @count is smaller than the length of the string, copies @count bytes | ||
156 | * and returns @count. | ||
157 | */ | ||
158 | #define strncpy_from_user(dest,src,count) \ | ||
159 | ({ \ | ||
160 | unsigned long __sfu_src = (unsigned long)(src); \ | ||
161 | int __sfu_count = (int)(count); \ | ||
162 | long __sfu_res = -EFAULT; \ | ||
163 | \ | ||
164 | if (__access_ok(__sfu_src, __sfu_count)) \ | ||
165 | __sfu_res = __strncpy_from_user((unsigned long)(dest), \ | ||
166 | __sfu_src, __sfu_count); \ | ||
167 | \ | ||
168 | __sfu_res; \ | ||
169 | }) | ||
170 | |||
171 | static inline unsigned long | 147 | static inline unsigned long |
172 | copy_from_user(void *to, const void __user *from, unsigned long n) | 148 | copy_from_user(void *to, const void __user *from, unsigned long n) |
173 | { | 149 | { |
@@ -192,43 +168,6 @@ copy_to_user(void __user *to, const void *from, unsigned long n) | |||
192 | return __copy_size; | 168 | return __copy_size; |
193 | } | 169 | } |
194 | 170 | ||
195 | /** | ||
196 | * strnlen_user: - Get the size of a string in user space. | ||
197 | * @s: The string to measure. | ||
198 | * @n: The maximum valid length | ||
199 | * | ||
200 | * Context: User context only. This function may sleep. | ||
201 | * | ||
202 | * Get the size of a NUL-terminated string in user space. | ||
203 | * | ||
204 | * Returns the size of the string INCLUDING the terminating NUL. | ||
205 | * On exception, returns 0. | ||
206 | * If the string is too long, returns a value greater than @n. | ||
207 | */ | ||
208 | static inline long strnlen_user(const char __user *s, long n) | ||
209 | { | ||
210 | if (!__addr_ok(s)) | ||
211 | return 0; | ||
212 | else | ||
213 | return __strnlen_user(s, n); | ||
214 | } | ||
215 | |||
216 | /** | ||
217 | * strlen_user: - Get the size of a string in user space. | ||
218 | * @str: The string to measure. | ||
219 | * | ||
220 | * Context: User context only. This function may sleep. | ||
221 | * | ||
222 | * Get the size of a NUL-terminated string in user space. | ||
223 | * | ||
224 | * Returns the size of the string INCLUDING the terminating NUL. | ||
225 | * On exception, returns 0. | ||
226 | * | ||
227 | * If there is a limit on the length of a valid string, you may wish to | ||
228 | * consider using strnlen_user() instead. | ||
229 | */ | ||
230 | #define strlen_user(str) strnlen_user(str, ~0UL >> 1) | ||
231 | |||
232 | /* | 171 | /* |
233 | * The exception table consists of pairs of addresses: the first is the | 172 | * The exception table consists of pairs of addresses: the first is the |
234 | * address of an instruction that is allowed to fault, and the second is | 173 | * address of an instruction that is allowed to fault, and the second is |
diff --git a/arch/sh/include/asm/uaccess_32.h b/arch/sh/include/asm/uaccess_32.h index ae0d24f6653..c0de7ee35ab 100644 --- a/arch/sh/include/asm/uaccess_32.h +++ b/arch/sh/include/asm/uaccess_32.h | |||
@@ -170,79 +170,4 @@ __asm__ __volatile__( \ | |||
170 | 170 | ||
171 | extern void __put_user_unknown(void); | 171 | extern void __put_user_unknown(void); |
172 | 172 | ||
173 | static inline int | ||
174 | __strncpy_from_user(unsigned long __dest, unsigned long __user __src, int __count) | ||
175 | { | ||
176 | __kernel_size_t res; | ||
177 | unsigned long __dummy, _d, _s, _c; | ||
178 | |||
179 | __asm__ __volatile__( | ||
180 | "9:\n" | ||
181 | "mov.b @%2+, %1\n\t" | ||
182 | "cmp/eq #0, %1\n\t" | ||
183 | "bt/s 2f\n" | ||
184 | "1:\n" | ||
185 | "mov.b %1, @%3\n\t" | ||
186 | "dt %4\n\t" | ||
187 | "bf/s 9b\n\t" | ||
188 | " add #1, %3\n\t" | ||
189 | "2:\n\t" | ||
190 | "sub %4, %0\n" | ||
191 | "3:\n" | ||
192 | ".section .fixup,\"ax\"\n" | ||
193 | "4:\n\t" | ||
194 | "mov.l 5f, %1\n\t" | ||
195 | "jmp @%1\n\t" | ||
196 | " mov %9, %0\n\t" | ||
197 | ".balign 4\n" | ||
198 | "5: .long 3b\n" | ||
199 | ".previous\n" | ||
200 | ".section __ex_table,\"a\"\n" | ||
201 | " .balign 4\n" | ||
202 | " .long 9b,4b\n" | ||
203 | ".previous" | ||
204 | : "=r" (res), "=&z" (__dummy), "=r" (_s), "=r" (_d), "=r"(_c) | ||
205 | : "0" (__count), "2" (__src), "3" (__dest), "4" (__count), | ||
206 | "i" (-EFAULT) | ||
207 | : "memory", "t"); | ||
208 | |||
209 | return res; | ||
210 | } | ||
211 | |||
212 | /* | ||
213 | * Return the size of a string (including the ending 0 even when we have | ||
214 | * exceeded the maximum string length). | ||
215 | */ | ||
216 | static inline long __strnlen_user(const char __user *__s, long __n) | ||
217 | { | ||
218 | unsigned long res; | ||
219 | unsigned long __dummy; | ||
220 | |||
221 | __asm__ __volatile__( | ||
222 | "1:\t" | ||
223 | "mov.b @(%0,%3), %1\n\t" | ||
224 | "cmp/eq %4, %0\n\t" | ||
225 | "bt/s 2f\n\t" | ||
226 | " add #1, %0\n\t" | ||
227 | "tst %1, %1\n\t" | ||
228 | "bf 1b\n\t" | ||
229 | "2:\n" | ||
230 | ".section .fixup,\"ax\"\n" | ||
231 | "3:\n\t" | ||
232 | "mov.l 4f, %1\n\t" | ||
233 | "jmp @%1\n\t" | ||
234 | " mov #0, %0\n" | ||
235 | ".balign 4\n" | ||
236 | "4: .long 2b\n" | ||
237 | ".previous\n" | ||
238 | ".section __ex_table,\"a\"\n" | ||
239 | " .balign 4\n" | ||
240 | " .long 1b,3b\n" | ||
241 | ".previous" | ||
242 | : "=z" (res), "=&r" (__dummy) | ||
243 | : "0" (0), "r" (__s), "r" (__n) | ||
244 | : "t"); | ||
245 | return res; | ||
246 | } | ||
247 | |||
248 | #endif /* __ASM_SH_UACCESS_32_H */ | 173 | #endif /* __ASM_SH_UACCESS_32_H */ |
diff --git a/arch/sh/include/asm/uaccess_64.h b/arch/sh/include/asm/uaccess_64.h index 56fd20b8cdc..2e07e0f40c6 100644 --- a/arch/sh/include/asm/uaccess_64.h +++ b/arch/sh/include/asm/uaccess_64.h | |||
@@ -84,8 +84,4 @@ extern long __put_user_asm_l(void *, long); | |||
84 | extern long __put_user_asm_q(void *, long); | 84 | extern long __put_user_asm_q(void *, long); |
85 | extern void __put_user_unknown(void); | 85 | extern void __put_user_unknown(void); |
86 | 86 | ||
87 | extern long __strnlen_user(const char *__s, long __n); | ||
88 | extern int __strncpy_from_user(unsigned long __dest, | ||
89 | unsigned long __user __src, int __count); | ||
90 | |||
91 | #endif /* __ASM_SH_UACCESS_64_H */ | 87 | #endif /* __ASM_SH_UACCESS_64_H */ |
diff --git a/arch/sh/include/asm/ucontext.h b/arch/sh/include/asm/ucontext.h deleted file mode 100644 index 9bc07b9f30f..00000000000 --- a/arch/sh/include/asm/ucontext.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/ucontext.h> | ||
diff --git a/arch/sh/include/asm/word-at-a-time.h b/arch/sh/include/asm/word-at-a-time.h new file mode 100644 index 00000000000..6e38953ff7f --- /dev/null +++ b/arch/sh/include/asm/word-at-a-time.h | |||
@@ -0,0 +1,53 @@ | |||
1 | #ifndef __ASM_SH_WORD_AT_A_TIME_H | ||
2 | #define __ASM_SH_WORD_AT_A_TIME_H | ||
3 | |||
4 | #ifdef CONFIG_CPU_BIG_ENDIAN | ||
5 | # include <asm-generic/word-at-a-time.h> | ||
6 | #else | ||
7 | /* | ||
8 | * Little-endian version cribbed from x86. | ||
9 | */ | ||
10 | struct word_at_a_time { | ||
11 | const unsigned long one_bits, high_bits; | ||
12 | }; | ||
13 | |||
14 | #define WORD_AT_A_TIME_CONSTANTS { REPEAT_BYTE(0x01), REPEAT_BYTE(0x80) } | ||
15 | |||
16 | /* Carl Chatfield / Jan Achrenius G+ version for 32-bit */ | ||
17 | static inline long count_masked_bytes(long mask) | ||
18 | { | ||
19 | /* (000000 0000ff 00ffff ffffff) -> ( 1 1 2 3 ) */ | ||
20 | long a = (0x0ff0001+mask) >> 23; | ||
21 | /* Fix the 1 for 00 case */ | ||
22 | return a & mask; | ||
23 | } | ||
24 | |||
25 | /* Return nonzero if it has a zero */ | ||
26 | static inline unsigned long has_zero(unsigned long a, unsigned long *bits, const struct word_at_a_time *c) | ||
27 | { | ||
28 | unsigned long mask = ((a - c->one_bits) & ~a) & c->high_bits; | ||
29 | *bits = mask; | ||
30 | return mask; | ||
31 | } | ||
32 | |||
33 | static inline unsigned long prep_zero_mask(unsigned long a, unsigned long bits, const struct word_at_a_time *c) | ||
34 | { | ||
35 | return bits; | ||
36 | } | ||
37 | |||
38 | static inline unsigned long create_zero_mask(unsigned long bits) | ||
39 | { | ||
40 | bits = (bits - 1) & ~bits; | ||
41 | return bits >> 7; | ||
42 | } | ||
43 | |||
44 | /* The mask we created is directly usable as a bytemask */ | ||
45 | #define zero_bytemask(mask) (mask) | ||
46 | |||
47 | static inline unsigned long find_zero(unsigned long mask) | ||
48 | { | ||
49 | return count_masked_bytes(mask); | ||
50 | } | ||
51 | #endif | ||
52 | |||
53 | #endif | ||
diff --git a/arch/sh/include/asm/xor.h b/arch/sh/include/asm/xor.h deleted file mode 100644 index c82eb12a5b1..00000000000 --- a/arch/sh/include/asm/xor.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | #include <asm-generic/xor.h> | ||
diff --git a/arch/sh/include/cpu-sh2a/cpu/ubc.h b/arch/sh/include/cpu-sh2a/cpu/ubc.h deleted file mode 100644 index 1192e1c761a..00000000000 --- a/arch/sh/include/cpu-sh2a/cpu/ubc.h +++ /dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | /* | ||
2 | * SH-2A UBC definitions | ||
3 | * | ||
4 | * Copyright (C) 2008 Kieran Bingham | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #ifndef __ASM_CPU_SH2A_UBC_H | ||
12 | #define __ASM_CPU_SH2A_UBC_H | ||
13 | |||
14 | #define UBC_BARA 0xfffc0400 | ||
15 | #define UBC_BAMRA 0xfffc0404 | ||
16 | #define UBC_BBRA 0xfffc04a0 /* 16 bit access */ | ||
17 | #define UBC_BDRA 0xfffc0408 | ||
18 | #define UBC_BDMRA 0xfffc040c | ||
19 | |||
20 | #define UBC_BARB 0xfffc0410 | ||
21 | #define UBC_BAMRB 0xfffc0414 | ||
22 | #define UBC_BBRB 0xfffc04b0 /* 16 bit access */ | ||
23 | #define UBC_BDRB 0xfffc0418 | ||
24 | #define UBC_BDMRB 0xfffc041c | ||
25 | |||
26 | #define UBC_BRCR 0xfffc04c0 | ||
27 | |||
28 | #endif /* __ASM_CPU_SH2A_UBC_H */ | ||
diff --git a/arch/sh/kernel/cpu/sh5/entry.S b/arch/sh/kernel/cpu/sh5/entry.S index ff1f0e6e9be..b7cf6a547f1 100644 --- a/arch/sh/kernel/cpu/sh5/entry.S +++ b/arch/sh/kernel/cpu/sh5/entry.S | |||
@@ -1569,86 +1569,6 @@ ___clear_user_exit: | |||
1569 | #endif /* CONFIG_MMU */ | 1569 | #endif /* CONFIG_MMU */ |
1570 | 1570 | ||
1571 | /* | 1571 | /* |
1572 | * int __strncpy_from_user(unsigned long __dest, unsigned long __src, | ||
1573 | * int __count) | ||
1574 | * | ||
1575 | * Inputs: | ||
1576 | * (r2) target address | ||
1577 | * (r3) source address | ||
1578 | * (r4) maximum size in bytes | ||
1579 | * | ||
1580 | * Ouputs: | ||
1581 | * (*r2) copied data | ||
1582 | * (r2) -EFAULT (in case of faulting) | ||
1583 | * copied data (otherwise) | ||
1584 | */ | ||
1585 | .global __strncpy_from_user | ||
1586 | __strncpy_from_user: | ||
1587 | pta ___strncpy_from_user1, tr0 | ||
1588 | pta ___strncpy_from_user_done, tr1 | ||
1589 | or r4, ZERO, r5 /* r5 = original count */ | ||
1590 | beq/u r4, r63, tr1 /* early exit if r4==0 */ | ||
1591 | movi -(EFAULT), r6 /* r6 = reply, no real fixup */ | ||
1592 | or ZERO, ZERO, r7 /* r7 = data, clear top byte of data */ | ||
1593 | |||
1594 | ___strncpy_from_user1: | ||
1595 | ld.b r3, 0, r7 /* Fault address: only in reading */ | ||
1596 | st.b r2, 0, r7 | ||
1597 | addi r2, 1, r2 | ||
1598 | addi r3, 1, r3 | ||
1599 | beq/u ZERO, r7, tr1 | ||
1600 | addi r4, -1, r4 /* return real number of copied bytes */ | ||
1601 | bne/l ZERO, r4, tr0 | ||
1602 | |||
1603 | ___strncpy_from_user_done: | ||
1604 | sub r5, r4, r6 /* If done, return copied */ | ||
1605 | |||
1606 | ___strncpy_from_user_exit: | ||
1607 | or r6, ZERO, r2 | ||
1608 | ptabs LINK, tr0 | ||
1609 | blink tr0, ZERO | ||
1610 | |||
1611 | /* | ||
1612 | * extern long __strnlen_user(const char *__s, long __n) | ||
1613 | * | ||
1614 | * Inputs: | ||
1615 | * (r2) source address | ||
1616 | * (r3) source size in bytes | ||
1617 | * | ||
1618 | * Ouputs: | ||
1619 | * (r2) -EFAULT (in case of faulting) | ||
1620 | * string length (otherwise) | ||
1621 | */ | ||
1622 | .global __strnlen_user | ||
1623 | __strnlen_user: | ||
1624 | pta ___strnlen_user_set_reply, tr0 | ||
1625 | pta ___strnlen_user1, tr1 | ||
1626 | or ZERO, ZERO, r5 /* r5 = counter */ | ||
1627 | movi -(EFAULT), r6 /* r6 = reply, no real fixup */ | ||
1628 | or ZERO, ZERO, r7 /* r7 = data, clear top byte of data */ | ||
1629 | beq r3, ZERO, tr0 | ||
1630 | |||
1631 | ___strnlen_user1: | ||
1632 | ldx.b r2, r5, r7 /* Fault address: only in reading */ | ||
1633 | addi r3, -1, r3 /* No real fixup */ | ||
1634 | addi r5, 1, r5 | ||
1635 | beq r3, ZERO, tr0 | ||
1636 | bne r7, ZERO, tr1 | ||
1637 | ! The line below used to be active. This meant led to a junk byte lying between each pair | ||
1638 | ! of entries in the argv & envp structures in memory. Whilst the program saw the right data | ||
1639 | ! via the argv and envp arguments to main, it meant the 'flat' representation visible through | ||
1640 | ! /proc/$pid/cmdline was corrupt, causing trouble with ps, for example. | ||
1641 | ! addi r5, 1, r5 /* Include '\0' */ | ||
1642 | |||
1643 | ___strnlen_user_set_reply: | ||
1644 | or r5, ZERO, r6 /* If done, return counter */ | ||
1645 | |||
1646 | ___strnlen_user_exit: | ||
1647 | or r6, ZERO, r2 | ||
1648 | ptabs LINK, tr0 | ||
1649 | blink tr0, ZERO | ||
1650 | |||
1651 | /* | ||
1652 | * extern long __get_user_asm_?(void *val, long addr) | 1572 | * extern long __get_user_asm_?(void *val, long addr) |
1653 | * | 1573 | * |
1654 | * Inputs: | 1574 | * Inputs: |
@@ -1982,8 +1902,6 @@ asm_uaccess_start: | |||
1982 | .long ___copy_user2, ___copy_user_exit | 1902 | .long ___copy_user2, ___copy_user_exit |
1983 | .long ___clear_user1, ___clear_user_exit | 1903 | .long ___clear_user1, ___clear_user_exit |
1984 | #endif | 1904 | #endif |
1985 | .long ___strncpy_from_user1, ___strncpy_from_user_exit | ||
1986 | .long ___strnlen_user1, ___strnlen_user_exit | ||
1987 | .long ___get_user_asm_b1, ___get_user_asm_b_exit | 1905 | .long ___get_user_asm_b1, ___get_user_asm_b_exit |
1988 | .long ___get_user_asm_w1, ___get_user_asm_w_exit | 1906 | .long ___get_user_asm_w1, ___get_user_asm_w_exit |
1989 | .long ___get_user_asm_l1, ___get_user_asm_l_exit | 1907 | .long ___get_user_asm_l1, ___get_user_asm_l_exit |
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c index 9b7a459a461..055d91b7030 100644 --- a/arch/sh/kernel/process.c +++ b/arch/sh/kernel/process.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/sched.h> | 4 | #include <linux/sched.h> |
5 | #include <linux/export.h> | 5 | #include <linux/export.h> |
6 | #include <linux/stackprotector.h> | 6 | #include <linux/stackprotector.h> |
7 | #include <asm/fpu.h> | ||
7 | 8 | ||
8 | struct kmem_cache *task_xstate_cachep = NULL; | 9 | struct kmem_cache *task_xstate_cachep = NULL; |
9 | unsigned int xstate_size; | 10 | unsigned int xstate_size; |
diff --git a/arch/sh/kernel/process_64.c b/arch/sh/kernel/process_64.c index 4264583eaba..602545b12a8 100644 --- a/arch/sh/kernel/process_64.c +++ b/arch/sh/kernel/process_64.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <asm/switch_to.h> | 33 | #include <asm/switch_to.h> |
34 | 34 | ||
35 | struct task_struct *last_task_used_math = NULL; | 35 | struct task_struct *last_task_used_math = NULL; |
36 | struct pt_regs fake_swapper_regs = { 0, }; | ||
36 | 37 | ||
37 | void show_regs(struct pt_regs *regs) | 38 | void show_regs(struct pt_regs *regs) |
38 | { | 39 | { |
diff --git a/arch/sh/kernel/sh_ksyms_64.c b/arch/sh/kernel/sh_ksyms_64.c index 45afa5c51f6..26a0774f527 100644 --- a/arch/sh/kernel/sh_ksyms_64.c +++ b/arch/sh/kernel/sh_ksyms_64.c | |||
@@ -32,8 +32,6 @@ EXPORT_SYMBOL(__get_user_asm_b); | |||
32 | EXPORT_SYMBOL(__get_user_asm_w); | 32 | EXPORT_SYMBOL(__get_user_asm_w); |
33 | EXPORT_SYMBOL(__get_user_asm_l); | 33 | EXPORT_SYMBOL(__get_user_asm_l); |
34 | EXPORT_SYMBOL(__get_user_asm_q); | 34 | EXPORT_SYMBOL(__get_user_asm_q); |
35 | EXPORT_SYMBOL(__strnlen_user); | ||
36 | EXPORT_SYMBOL(__strncpy_from_user); | ||
37 | EXPORT_SYMBOL(__clear_user); | 35 | EXPORT_SYMBOL(__clear_user); |
38 | EXPORT_SYMBOL(copy_page); | 36 | EXPORT_SYMBOL(copy_page); |
39 | EXPORT_SYMBOL(__copy_user); | 37 | EXPORT_SYMBOL(__copy_user); |
diff --git a/arch/sparc/include/asm/cmt.h b/arch/sparc/include/asm/cmt.h deleted file mode 100644 index 870db592857..00000000000 --- a/arch/sparc/include/asm/cmt.h +++ /dev/null | |||
@@ -1,59 +0,0 @@ | |||
1 | #ifndef _SPARC64_CMT_H | ||
2 | #define _SPARC64_CMT_H | ||
3 | |||
4 | /* cmt.h: Chip Multi-Threading register definitions | ||
5 | * | ||
6 | * Copyright (C) 2004 David S. Miller (davem@redhat.com) | ||
7 | */ | ||
8 | |||
9 | /* ASI_CORE_ID - private */ | ||
10 | #define LP_ID 0x0000000000000010UL | ||
11 | #define LP_ID_MAX 0x00000000003f0000UL | ||
12 | #define LP_ID_ID 0x000000000000003fUL | ||
13 | |||
14 | /* ASI_INTR_ID - private */ | ||
15 | #define LP_INTR_ID 0x0000000000000000UL | ||
16 | #define LP_INTR_ID_ID 0x00000000000003ffUL | ||
17 | |||
18 | /* ASI_CESR_ID - private */ | ||
19 | #define CESR_ID 0x0000000000000040UL | ||
20 | #define CESR_ID_ID 0x00000000000000ffUL | ||
21 | |||
22 | /* ASI_CORE_AVAILABLE - shared */ | ||
23 | #define LP_AVAIL 0x0000000000000000UL | ||
24 | #define LP_AVAIL_1 0x0000000000000002UL | ||
25 | #define LP_AVAIL_0 0x0000000000000001UL | ||
26 | |||
27 | /* ASI_CORE_ENABLE_STATUS - shared */ | ||
28 | #define LP_ENAB_STAT 0x0000000000000010UL | ||
29 | #define LP_ENAB_STAT_1 0x0000000000000002UL | ||
30 | #define LP_ENAB_STAT_0 0x0000000000000001UL | ||
31 | |||
32 | /* ASI_CORE_ENABLE - shared */ | ||
33 | #define LP_ENAB 0x0000000000000020UL | ||
34 | #define LP_ENAB_1 0x0000000000000002UL | ||
35 | #define LP_ENAB_0 0x0000000000000001UL | ||
36 | |||
37 | /* ASI_CORE_RUNNING - shared */ | ||
38 | #define LP_RUNNING_RW 0x0000000000000050UL | ||
39 | #define LP_RUNNING_W1S 0x0000000000000060UL | ||
40 | #define LP_RUNNING_W1C 0x0000000000000068UL | ||
41 | #define LP_RUNNING_1 0x0000000000000002UL | ||
42 | #define LP_RUNNING_0 0x0000000000000001UL | ||
43 | |||
44 | /* ASI_CORE_RUNNING_STAT - shared */ | ||
45 | #define LP_RUN_STAT 0x0000000000000058UL | ||
46 | #define LP_RUN_STAT_1 0x0000000000000002UL | ||
47 | #define LP_RUN_STAT_0 0x0000000000000001UL | ||
48 | |||
49 | /* ASI_XIR_STEERING - shared */ | ||
50 | #define LP_XIR_STEER 0x0000000000000030UL | ||
51 | #define LP_XIR_STEER_1 0x0000000000000002UL | ||
52 | #define LP_XIR_STEER_0 0x0000000000000001UL | ||
53 | |||
54 | /* ASI_CMT_ERROR_STEERING - shared */ | ||
55 | #define CMT_ER_STEER 0x0000000000000040UL | ||
56 | #define CMT_ER_STEER_1 0x0000000000000002UL | ||
57 | #define CMT_ER_STEER_0 0x0000000000000001UL | ||
58 | |||
59 | #endif /* _SPARC64_CMT_H */ | ||
diff --git a/arch/sparc/include/asm/mpmbox.h b/arch/sparc/include/asm/mpmbox.h deleted file mode 100644 index f8423039b24..00000000000 --- a/arch/sparc/include/asm/mpmbox.h +++ /dev/null | |||
@@ -1,67 +0,0 @@ | |||
1 | /* | ||
2 | * mpmbox.h: Interface and defines for the OpenProm mailbox | ||
3 | * facilities for MP machines under Linux. | ||
4 | * | ||
5 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
6 | */ | ||
7 | |||
8 | #ifndef _SPARC_MPMBOX_H | ||
9 | #define _SPARC_MPMBOX_H | ||
10 | |||
11 | /* The prom allocates, for each CPU on the machine an unsigned | ||
12 | * byte in physical ram. You probe the device tree prom nodes | ||
13 | * for these values. The purpose of this byte is to be able to | ||
14 | * pass messages from one cpu to another. | ||
15 | */ | ||
16 | |||
17 | /* These are the main message types we have to look for in our | ||
18 | * Cpu mailboxes, based upon these values we decide what course | ||
19 | * of action to take. | ||
20 | */ | ||
21 | |||
22 | /* The CPU is executing code in the kernel. */ | ||
23 | #define MAILBOX_ISRUNNING 0xf0 | ||
24 | |||
25 | /* Another CPU called romvec->pv_exit(), you should call | ||
26 | * prom_stopcpu() when you see this in your mailbox. | ||
27 | */ | ||
28 | #define MAILBOX_EXIT 0xfb | ||
29 | |||
30 | /* Another CPU called romvec->pv_enter(), you should call | ||
31 | * prom_cpuidle() when this is seen. | ||
32 | */ | ||
33 | #define MAILBOX_GOSPIN 0xfc | ||
34 | |||
35 | /* Another CPU has hit a breakpoint either into kadb or the prom | ||
36 | * itself. Just like MAILBOX_GOSPIN, you should call prom_cpuidle() | ||
37 | * at this point. | ||
38 | */ | ||
39 | #define MAILBOX_BPT_SPIN 0xfd | ||
40 | |||
41 | /* Oh geese, some other nitwit got a damn watchdog reset. The party's | ||
42 | * over so go call prom_stopcpu(). | ||
43 | */ | ||
44 | #define MAILBOX_WDOG_STOP 0xfe | ||
45 | |||
46 | #ifndef __ASSEMBLY__ | ||
47 | |||
48 | /* Handy macro's to determine a cpu's state. */ | ||
49 | |||
50 | /* Is the cpu still in Power On Self Test? */ | ||
51 | #define MBOX_POST_P(letter) ((letter) >= 0x00 && (letter) <= 0x7f) | ||
52 | |||
53 | /* Is the cpu at the 'ok' prompt of the PROM? */ | ||
54 | #define MBOX_PROMPROMPT_P(letter) ((letter) >= 0x80 && (letter) <= 0x8f) | ||
55 | |||
56 | /* Is the cpu spinning in the PROM? */ | ||
57 | #define MBOX_PROMSPIN_P(letter) ((letter) >= 0x90 && (letter) <= 0xef) | ||
58 | |||
59 | /* Sanity check... This is junk mail, throw it out. */ | ||
60 | #define MBOX_BOGON_P(letter) ((letter) >= 0xf1 && (letter) <= 0xfa) | ||
61 | |||
62 | /* Is the cpu actively running an application/kernel-code? */ | ||
63 | #define MBOX_RUNNING_P(letter) ((letter) == MAILBOX_ISRUNNING) | ||
64 | |||
65 | #endif /* !(__ASSEMBLY__) */ | ||
66 | |||
67 | #endif /* !(_SPARC_MPMBOX_H) */ | ||
diff --git a/arch/tile/include/asm/thread_info.h b/arch/tile/include/asm/thread_info.h index 7e1fef36bde..e9c670d7a7f 100644 --- a/arch/tile/include/asm/thread_info.h +++ b/arch/tile/include/asm/thread_info.h | |||
@@ -91,11 +91,6 @@ extern void smp_nap(void); | |||
91 | /* Enable interrupts racelessly and nap forever: helper for cpu_idle(). */ | 91 | /* Enable interrupts racelessly and nap forever: helper for cpu_idle(). */ |
92 | extern void _cpu_idle(void); | 92 | extern void _cpu_idle(void); |
93 | 93 | ||
94 | /* Switch boot idle thread to a freshly-allocated stack and free old stack. */ | ||
95 | extern void cpu_idle_on_new_stack(struct thread_info *old_ti, | ||
96 | unsigned long new_sp, | ||
97 | unsigned long new_ss10); | ||
98 | |||
99 | #else /* __ASSEMBLY__ */ | 94 | #else /* __ASSEMBLY__ */ |
100 | 95 | ||
101 | /* | 96 | /* |
diff --git a/arch/tile/include/asm/uaccess.h b/arch/tile/include/asm/uaccess.h index c3dd275f25e..9ab078a4605 100644 --- a/arch/tile/include/asm/uaccess.h +++ b/arch/tile/include/asm/uaccess.h | |||
@@ -146,7 +146,7 @@ extern int fixup_exception(struct pt_regs *regs); | |||
146 | #ifdef __tilegx__ | 146 | #ifdef __tilegx__ |
147 | #define __get_user_1(x, ptr, ret) __get_user_asm(ld1u, x, ptr, ret) | 147 | #define __get_user_1(x, ptr, ret) __get_user_asm(ld1u, x, ptr, ret) |
148 | #define __get_user_2(x, ptr, ret) __get_user_asm(ld2u, x, ptr, ret) | 148 | #define __get_user_2(x, ptr, ret) __get_user_asm(ld2u, x, ptr, ret) |
149 | #define __get_user_4(x, ptr, ret) __get_user_asm(ld4u, x, ptr, ret) | 149 | #define __get_user_4(x, ptr, ret) __get_user_asm(ld4s, x, ptr, ret) |
150 | #define __get_user_8(x, ptr, ret) __get_user_asm(ld, x, ptr, ret) | 150 | #define __get_user_8(x, ptr, ret) __get_user_asm(ld, x, ptr, ret) |
151 | #else | 151 | #else |
152 | #define __get_user_1(x, ptr, ret) __get_user_asm(lb_u, x, ptr, ret) | 152 | #define __get_user_1(x, ptr, ret) __get_user_asm(lb_u, x, ptr, ret) |
diff --git a/arch/tile/kernel/entry.S b/arch/tile/kernel/entry.S index 133c4b56a99..c31637baff2 100644 --- a/arch/tile/kernel/entry.S +++ b/arch/tile/kernel/entry.S | |||
@@ -68,20 +68,6 @@ STD_ENTRY(KBacktraceIterator_init_current) | |||
68 | jrp lr /* keep backtracer happy */ | 68 | jrp lr /* keep backtracer happy */ |
69 | STD_ENDPROC(KBacktraceIterator_init_current) | 69 | STD_ENDPROC(KBacktraceIterator_init_current) |
70 | 70 | ||
71 | /* | ||
72 | * Reset our stack to r1/r2 (sp and ksp0+cpu respectively), then | ||
73 | * free the old stack (passed in r0) and re-invoke cpu_idle(). | ||
74 | * We update sp and ksp0 simultaneously to avoid backtracer warnings. | ||
75 | */ | ||
76 | STD_ENTRY(cpu_idle_on_new_stack) | ||
77 | { | ||
78 | move sp, r1 | ||
79 | mtspr SPR_SYSTEM_SAVE_K_0, r2 | ||
80 | } | ||
81 | jal free_thread_info | ||
82 | j cpu_idle | ||
83 | STD_ENDPROC(cpu_idle_on_new_stack) | ||
84 | |||
85 | /* Loop forever on a nap during SMP boot. */ | 71 | /* Loop forever on a nap during SMP boot. */ |
86 | STD_ENTRY(smp_nap) | 72 | STD_ENTRY(smp_nap) |
87 | nap | 73 | nap |
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c index 6098ccc59be..dd87f342039 100644 --- a/arch/tile/kernel/setup.c +++ b/arch/tile/kernel/setup.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/smp.h> | 29 | #include <linux/smp.h> |
30 | #include <linux/timex.h> | 30 | #include <linux/timex.h> |
31 | #include <linux/hugetlb.h> | 31 | #include <linux/hugetlb.h> |
32 | #include <linux/start_kernel.h> | ||
32 | #include <asm/setup.h> | 33 | #include <asm/setup.h> |
33 | #include <asm/sections.h> | 34 | #include <asm/sections.h> |
34 | #include <asm/cacheflush.h> | 35 | #include <asm/cacheflush.h> |
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S index 8bbea6aa40d..efe5acfc79c 100644 --- a/arch/x86/boot/header.S +++ b/arch/x86/boot/header.S | |||
@@ -94,10 +94,10 @@ bs_die: | |||
94 | 94 | ||
95 | .section ".bsdata", "a" | 95 | .section ".bsdata", "a" |
96 | bugger_off_msg: | 96 | bugger_off_msg: |
97 | .ascii "Direct booting from floppy is no longer supported.\r\n" | 97 | .ascii "Direct floppy boot is not supported. " |
98 | .ascii "Please use a boot loader program instead.\r\n" | 98 | .ascii "Use a boot loader program instead.\r\n" |
99 | .ascii "\n" | 99 | .ascii "\n" |
100 | .ascii "Remove disk and press any key to reboot . . .\r\n" | 100 | .ascii "Remove disk and press any key to reboot ...\r\n" |
101 | .byte 0 | 101 | .byte 0 |
102 | 102 | ||
103 | #ifdef CONFIG_EFI_STUB | 103 | #ifdef CONFIG_EFI_STUB |
@@ -111,7 +111,7 @@ coff_header: | |||
111 | #else | 111 | #else |
112 | .word 0x8664 # x86-64 | 112 | .word 0x8664 # x86-64 |
113 | #endif | 113 | #endif |
114 | .word 2 # nr_sections | 114 | .word 3 # nr_sections |
115 | .long 0 # TimeDateStamp | 115 | .long 0 # TimeDateStamp |
116 | .long 0 # PointerToSymbolTable | 116 | .long 0 # PointerToSymbolTable |
117 | .long 1 # NumberOfSymbols | 117 | .long 1 # NumberOfSymbols |
@@ -158,8 +158,8 @@ extra_header_fields: | |||
158 | #else | 158 | #else |
159 | .quad 0 # ImageBase | 159 | .quad 0 # ImageBase |
160 | #endif | 160 | #endif |
161 | .long 0x1000 # SectionAlignment | 161 | .long 0x20 # SectionAlignment |
162 | .long 0x200 # FileAlignment | 162 | .long 0x20 # FileAlignment |
163 | .word 0 # MajorOperatingSystemVersion | 163 | .word 0 # MajorOperatingSystemVersion |
164 | .word 0 # MinorOperatingSystemVersion | 164 | .word 0 # MinorOperatingSystemVersion |
165 | .word 0 # MajorImageVersion | 165 | .word 0 # MajorImageVersion |
@@ -200,8 +200,10 @@ extra_header_fields: | |||
200 | 200 | ||
201 | # Section table | 201 | # Section table |
202 | section_table: | 202 | section_table: |
203 | .ascii ".text" | 203 | # |
204 | .byte 0 | 204 | # The offset & size fields are filled in by build.c. |
205 | # | ||
206 | .ascii ".setup" | ||
205 | .byte 0 | 207 | .byte 0 |
206 | .byte 0 | 208 | .byte 0 |
207 | .long 0 | 209 | .long 0 |
@@ -217,9 +219,8 @@ section_table: | |||
217 | 219 | ||
218 | # | 220 | # |
219 | # The EFI application loader requires a relocation section | 221 | # The EFI application loader requires a relocation section |
220 | # because EFI applications must be relocatable. But since | 222 | # because EFI applications must be relocatable. The .reloc |
221 | # we don't need the loader to fixup any relocs for us, we | 223 | # offset & size fields are filled in by build.c. |
222 | # just create an empty (zero-length) .reloc section header. | ||
223 | # | 224 | # |
224 | .ascii ".reloc" | 225 | .ascii ".reloc" |
225 | .byte 0 | 226 | .byte 0 |
@@ -233,6 +234,25 @@ section_table: | |||
233 | .word 0 # NumberOfRelocations | 234 | .word 0 # NumberOfRelocations |
234 | .word 0 # NumberOfLineNumbers | 235 | .word 0 # NumberOfLineNumbers |
235 | .long 0x42100040 # Characteristics (section flags) | 236 | .long 0x42100040 # Characteristics (section flags) |
237 | |||
238 | # | ||
239 | # The offset & size fields are filled in by build.c. | ||
240 | # | ||
241 | .ascii ".text" | ||
242 | .byte 0 | ||
243 | .byte 0 | ||
244 | .byte 0 | ||
245 | .long 0 | ||
246 | .long 0x0 # startup_{32,64} | ||
247 | .long 0 # Size of initialized data | ||
248 | # on disk | ||
249 | .long 0x0 # startup_{32,64} | ||
250 | .long 0 # PointerToRelocations | ||
251 | .long 0 # PointerToLineNumbers | ||
252 | .word 0 # NumberOfRelocations | ||
253 | .word 0 # NumberOfLineNumbers | ||
254 | .long 0x60500020 # Characteristics (section flags) | ||
255 | |||
236 | #endif /* CONFIG_EFI_STUB */ | 256 | #endif /* CONFIG_EFI_STUB */ |
237 | 257 | ||
238 | # Kernel attributes; used by setup. This is part 1 of the | 258 | # Kernel attributes; used by setup. This is part 1 of the |
diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c index 3f61f6e2b46..4b8e165ee57 100644 --- a/arch/x86/boot/tools/build.c +++ b/arch/x86/boot/tools/build.c | |||
@@ -50,6 +50,8 @@ typedef unsigned int u32; | |||
50 | u8 buf[SETUP_SECT_MAX*512]; | 50 | u8 buf[SETUP_SECT_MAX*512]; |
51 | int is_big_kernel; | 51 | int is_big_kernel; |
52 | 52 | ||
53 | #define PECOFF_RELOC_RESERVE 0x20 | ||
54 | |||
53 | /*----------------------------------------------------------------------*/ | 55 | /*----------------------------------------------------------------------*/ |
54 | 56 | ||
55 | static const u32 crctab32[] = { | 57 | static const u32 crctab32[] = { |
@@ -133,11 +135,103 @@ static void usage(void) | |||
133 | die("Usage: build setup system [> image]"); | 135 | die("Usage: build setup system [> image]"); |
134 | } | 136 | } |
135 | 137 | ||
136 | int main(int argc, char ** argv) | ||
137 | { | ||
138 | #ifdef CONFIG_EFI_STUB | 138 | #ifdef CONFIG_EFI_STUB |
139 | unsigned int file_sz, pe_header; | 139 | |
140 | static void update_pecoff_section_header(char *section_name, u32 offset, u32 size) | ||
141 | { | ||
142 | unsigned int pe_header; | ||
143 | unsigned short num_sections; | ||
144 | u8 *section; | ||
145 | |||
146 | pe_header = get_unaligned_le32(&buf[0x3c]); | ||
147 | num_sections = get_unaligned_le16(&buf[pe_header + 6]); | ||
148 | |||
149 | #ifdef CONFIG_X86_32 | ||
150 | section = &buf[pe_header + 0xa8]; | ||
151 | #else | ||
152 | section = &buf[pe_header + 0xb8]; | ||
140 | #endif | 153 | #endif |
154 | |||
155 | while (num_sections > 0) { | ||
156 | if (strncmp((char*)section, section_name, 8) == 0) { | ||
157 | /* section header size field */ | ||
158 | put_unaligned_le32(size, section + 0x8); | ||
159 | |||
160 | /* section header vma field */ | ||
161 | put_unaligned_le32(offset, section + 0xc); | ||
162 | |||
163 | /* section header 'size of initialised data' field */ | ||
164 | put_unaligned_le32(size, section + 0x10); | ||
165 | |||
166 | /* section header 'file offset' field */ | ||
167 | put_unaligned_le32(offset, section + 0x14); | ||
168 | |||
169 | break; | ||
170 | } | ||
171 | section += 0x28; | ||
172 | num_sections--; | ||
173 | } | ||
174 | } | ||
175 | |||
176 | static void update_pecoff_setup_and_reloc(unsigned int size) | ||
177 | { | ||
178 | u32 setup_offset = 0x200; | ||
179 | u32 reloc_offset = size - PECOFF_RELOC_RESERVE; | ||
180 | u32 setup_size = reloc_offset - setup_offset; | ||
181 | |||
182 | update_pecoff_section_header(".setup", setup_offset, setup_size); | ||
183 | update_pecoff_section_header(".reloc", reloc_offset, PECOFF_RELOC_RESERVE); | ||
184 | |||
185 | /* | ||
186 | * Modify .reloc section contents with a single entry. The | ||
187 | * relocation is applied to offset 10 of the relocation section. | ||
188 | */ | ||
189 | put_unaligned_le32(reloc_offset + 10, &buf[reloc_offset]); | ||
190 | put_unaligned_le32(10, &buf[reloc_offset + 4]); | ||
191 | } | ||
192 | |||
193 | static void update_pecoff_text(unsigned int text_start, unsigned int file_sz) | ||
194 | { | ||
195 | unsigned int pe_header; | ||
196 | unsigned int text_sz = file_sz - text_start; | ||
197 | |||
198 | pe_header = get_unaligned_le32(&buf[0x3c]); | ||
199 | |||
200 | /* Size of image */ | ||
201 | put_unaligned_le32(file_sz, &buf[pe_header + 0x50]); | ||
202 | |||
203 | /* | ||
204 | * Size of code: Subtract the size of the first sector (512 bytes) | ||
205 | * which includes the header. | ||
206 | */ | ||
207 | put_unaligned_le32(file_sz - 512, &buf[pe_header + 0x1c]); | ||
208 | |||
209 | #ifdef CONFIG_X86_32 | ||
210 | /* | ||
211 | * Address of entry point. | ||
212 | * | ||
213 | * The EFI stub entry point is +16 bytes from the start of | ||
214 | * the .text section. | ||
215 | */ | ||
216 | put_unaligned_le32(text_start + 16, &buf[pe_header + 0x28]); | ||
217 | #else | ||
218 | /* | ||
219 | * Address of entry point. startup_32 is at the beginning and | ||
220 | * the 64-bit entry point (startup_64) is always 512 bytes | ||
221 | * after. The EFI stub entry point is 16 bytes after that, as | ||
222 | * the first instruction allows legacy loaders to jump over | ||
223 | * the EFI stub initialisation | ||
224 | */ | ||
225 | put_unaligned_le32(text_start + 528, &buf[pe_header + 0x28]); | ||
226 | #endif /* CONFIG_X86_32 */ | ||
227 | |||
228 | update_pecoff_section_header(".text", text_start, text_sz); | ||
229 | } | ||
230 | |||
231 | #endif /* CONFIG_EFI_STUB */ | ||
232 | |||
233 | int main(int argc, char ** argv) | ||
234 | { | ||
141 | unsigned int i, sz, setup_sectors; | 235 | unsigned int i, sz, setup_sectors; |
142 | int c; | 236 | int c; |
143 | u32 sys_size; | 237 | u32 sys_size; |
@@ -163,6 +257,12 @@ int main(int argc, char ** argv) | |||
163 | die("Boot block hasn't got boot flag (0xAA55)"); | 257 | die("Boot block hasn't got boot flag (0xAA55)"); |
164 | fclose(file); | 258 | fclose(file); |
165 | 259 | ||
260 | #ifdef CONFIG_EFI_STUB | ||
261 | /* Reserve 0x20 bytes for .reloc section */ | ||
262 | memset(buf+c, 0, PECOFF_RELOC_RESERVE); | ||
263 | c += PECOFF_RELOC_RESERVE; | ||
264 | #endif | ||
265 | |||
166 | /* Pad unused space with zeros */ | 266 | /* Pad unused space with zeros */ |
167 | setup_sectors = (c + 511) / 512; | 267 | setup_sectors = (c + 511) / 512; |
168 | if (setup_sectors < SETUP_SECT_MIN) | 268 | if (setup_sectors < SETUP_SECT_MIN) |
@@ -170,6 +270,10 @@ int main(int argc, char ** argv) | |||
170 | i = setup_sectors*512; | 270 | i = setup_sectors*512; |
171 | memset(buf+c, 0, i-c); | 271 | memset(buf+c, 0, i-c); |
172 | 272 | ||
273 | #ifdef CONFIG_EFI_STUB | ||
274 | update_pecoff_setup_and_reloc(i); | ||
275 | #endif | ||
276 | |||
173 | /* Set the default root device */ | 277 | /* Set the default root device */ |
174 | put_unaligned_le16(DEFAULT_ROOT_DEV, &buf[508]); | 278 | put_unaligned_le16(DEFAULT_ROOT_DEV, &buf[508]); |
175 | 279 | ||
@@ -194,66 +298,8 @@ int main(int argc, char ** argv) | |||
194 | put_unaligned_le32(sys_size, &buf[0x1f4]); | 298 | put_unaligned_le32(sys_size, &buf[0x1f4]); |
195 | 299 | ||
196 | #ifdef CONFIG_EFI_STUB | 300 | #ifdef CONFIG_EFI_STUB |
197 | file_sz = sz + i + ((sys_size * 16) - sz); | 301 | update_pecoff_text(setup_sectors * 512, sz + i + ((sys_size * 16) - sz)); |
198 | 302 | #endif | |
199 | pe_header = get_unaligned_le32(&buf[0x3c]); | ||
200 | |||
201 | /* Size of image */ | ||
202 | put_unaligned_le32(file_sz, &buf[pe_header + 0x50]); | ||
203 | |||
204 | /* | ||
205 | * Subtract the size of the first section (512 bytes) which | ||
206 | * includes the header and .reloc section. The remaining size | ||
207 | * is that of the .text section. | ||
208 | */ | ||
209 | file_sz -= 512; | ||
210 | |||
211 | /* Size of code */ | ||
212 | put_unaligned_le32(file_sz, &buf[pe_header + 0x1c]); | ||
213 | |||
214 | #ifdef CONFIG_X86_32 | ||
215 | /* | ||
216 | * Address of entry point. | ||
217 | * | ||
218 | * The EFI stub entry point is +16 bytes from the start of | ||
219 | * the .text section. | ||
220 | */ | ||
221 | put_unaligned_le32(i + 16, &buf[pe_header + 0x28]); | ||
222 | |||
223 | /* .text size */ | ||
224 | put_unaligned_le32(file_sz, &buf[pe_header + 0xb0]); | ||
225 | |||
226 | /* .text vma */ | ||
227 | put_unaligned_le32(0x200, &buf[pe_header + 0xb4]); | ||
228 | |||
229 | /* .text size of initialised data */ | ||
230 | put_unaligned_le32(file_sz, &buf[pe_header + 0xb8]); | ||
231 | |||
232 | /* .text file offset */ | ||
233 | put_unaligned_le32(0x200, &buf[pe_header + 0xbc]); | ||
234 | #else | ||
235 | /* | ||
236 | * Address of entry point. startup_32 is at the beginning and | ||
237 | * the 64-bit entry point (startup_64) is always 512 bytes | ||
238 | * after. The EFI stub entry point is 16 bytes after that, as | ||
239 | * the first instruction allows legacy loaders to jump over | ||
240 | * the EFI stub initialisation | ||
241 | */ | ||
242 | put_unaligned_le32(i + 528, &buf[pe_header + 0x28]); | ||
243 | |||
244 | /* .text size */ | ||
245 | put_unaligned_le32(file_sz, &buf[pe_header + 0xc0]); | ||
246 | |||
247 | /* .text vma */ | ||
248 | put_unaligned_le32(0x200, &buf[pe_header + 0xc4]); | ||
249 | |||
250 | /* .text size of initialised data */ | ||
251 | put_unaligned_le32(file_sz, &buf[pe_header + 0xc8]); | ||
252 | |||
253 | /* .text file offset */ | ||
254 | put_unaligned_le32(0x200, &buf[pe_header + 0xcc]); | ||
255 | #endif /* CONFIG_X86_32 */ | ||
256 | #endif /* CONFIG_EFI_STUB */ | ||
257 | 303 | ||
258 | crc = partial_crc32(buf, i, crc); | 304 | crc = partial_crc32(buf, i, crc); |
259 | if (fwrite(buf, 1, i, stdout) != i) | 305 | if (fwrite(buf, 1, i, stdout) != i) |
diff --git a/arch/x86/crypto/aesni-intel_asm.S b/arch/x86/crypto/aesni-intel_asm.S index be6d9e365a8..3470624d783 100644 --- a/arch/x86/crypto/aesni-intel_asm.S +++ b/arch/x86/crypto/aesni-intel_asm.S | |||
@@ -2460,10 +2460,12 @@ ENTRY(aesni_cbc_dec) | |||
2460 | pxor IN3, STATE4 | 2460 | pxor IN3, STATE4 |
2461 | movaps IN4, IV | 2461 | movaps IN4, IV |
2462 | #else | 2462 | #else |
2463 | pxor (INP), STATE2 | ||
2464 | pxor 0x10(INP), STATE3 | ||
2465 | pxor IN1, STATE4 | 2463 | pxor IN1, STATE4 |
2466 | movaps IN2, IV | 2464 | movaps IN2, IV |
2465 | movups (INP), IN1 | ||
2466 | pxor IN1, STATE2 | ||
2467 | movups 0x10(INP), IN2 | ||
2468 | pxor IN2, STATE3 | ||
2467 | #endif | 2469 | #endif |
2468 | movups STATE1, (OUTP) | 2470 | movups STATE1, (OUTP) |
2469 | movups STATE2, 0x10(OUTP) | 2471 | movups STATE2, 0x10(OUTP) |
diff --git a/arch/x86/include/asm/nmi.h b/arch/x86/include/asm/nmi.h index 0e3793b821e..dc580c42851 100644 --- a/arch/x86/include/asm/nmi.h +++ b/arch/x86/include/asm/nmi.h | |||
@@ -54,6 +54,20 @@ struct nmiaction { | |||
54 | __register_nmi_handler((t), &fn##_na); \ | 54 | __register_nmi_handler((t), &fn##_na); \ |
55 | }) | 55 | }) |
56 | 56 | ||
57 | /* | ||
58 | * For special handlers that register/unregister in the | ||
59 | * init section only. This should be considered rare. | ||
60 | */ | ||
61 | #define register_nmi_handler_initonly(t, fn, fg, n) \ | ||
62 | ({ \ | ||
63 | static struct nmiaction fn##_na __initdata = { \ | ||
64 | .handler = (fn), \ | ||
65 | .name = (n), \ | ||
66 | .flags = (fg), \ | ||
67 | }; \ | ||
68 | __register_nmi_handler((t), &fn##_na); \ | ||
69 | }) | ||
70 | |||
57 | int __register_nmi_handler(unsigned int, struct nmiaction *); | 71 | int __register_nmi_handler(unsigned int, struct nmiaction *); |
58 | 72 | ||
59 | void unregister_nmi_handler(unsigned int, const char *); | 73 | void unregister_nmi_handler(unsigned int, const char *); |
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index 04cd6882308..e1f3a17034f 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h | |||
@@ -33,9 +33,8 @@ | |||
33 | #define segment_eq(a, b) ((a).seg == (b).seg) | 33 | #define segment_eq(a, b) ((a).seg == (b).seg) |
34 | 34 | ||
35 | #define user_addr_max() (current_thread_info()->addr_limit.seg) | 35 | #define user_addr_max() (current_thread_info()->addr_limit.seg) |
36 | #define __addr_ok(addr) \ | 36 | #define __addr_ok(addr) \ |
37 | ((unsigned long __force)(addr) < \ | 37 | ((unsigned long __force)(addr) < user_addr_max()) |
38 | (current_thread_info()->addr_limit.seg)) | ||
39 | 38 | ||
40 | /* | 39 | /* |
41 | * Test whether a block of memory is a valid user space address. | 40 | * Test whether a block of memory is a valid user space address. |
@@ -47,14 +46,14 @@ | |||
47 | * This needs 33-bit (65-bit for x86_64) arithmetic. We have a carry... | 46 | * This needs 33-bit (65-bit for x86_64) arithmetic. We have a carry... |
48 | */ | 47 | */ |
49 | 48 | ||
50 | #define __range_not_ok(addr, size) \ | 49 | #define __range_not_ok(addr, size, limit) \ |
51 | ({ \ | 50 | ({ \ |
52 | unsigned long flag, roksum; \ | 51 | unsigned long flag, roksum; \ |
53 | __chk_user_ptr(addr); \ | 52 | __chk_user_ptr(addr); \ |
54 | asm("add %3,%1 ; sbb %0,%0 ; cmp %1,%4 ; sbb $0,%0" \ | 53 | asm("add %3,%1 ; sbb %0,%0 ; cmp %1,%4 ; sbb $0,%0" \ |
55 | : "=&r" (flag), "=r" (roksum) \ | 54 | : "=&r" (flag), "=r" (roksum) \ |
56 | : "1" (addr), "g" ((long)(size)), \ | 55 | : "1" (addr), "g" ((long)(size)), \ |
57 | "rm" (current_thread_info()->addr_limit.seg)); \ | 56 | "rm" (limit)); \ |
58 | flag; \ | 57 | flag; \ |
59 | }) | 58 | }) |
60 | 59 | ||
@@ -77,7 +76,8 @@ | |||
77 | * checks that the pointer is in the user space range - after calling | 76 | * checks that the pointer is in the user space range - after calling |
78 | * this function, memory access functions may still return -EFAULT. | 77 | * this function, memory access functions may still return -EFAULT. |
79 | */ | 78 | */ |
80 | #define access_ok(type, addr, size) (likely(__range_not_ok(addr, size) == 0)) | 79 | #define access_ok(type, addr, size) \ |
80 | (likely(__range_not_ok(addr, size, user_addr_max()) == 0)) | ||
81 | 81 | ||
82 | /* | 82 | /* |
83 | * The exception table consists of pairs of addresses relative to the | 83 | * The exception table consists of pairs of addresses relative to the |
diff --git a/arch/x86/include/asm/uv/uv_bau.h b/arch/x86/include/asm/uv/uv_bau.h index becf47b8173..6149b476d9d 100644 --- a/arch/x86/include/asm/uv/uv_bau.h +++ b/arch/x86/include/asm/uv/uv_bau.h | |||
@@ -149,7 +149,6 @@ | |||
149 | /* 4 bits of software ack period */ | 149 | /* 4 bits of software ack period */ |
150 | #define UV2_ACK_MASK 0x7UL | 150 | #define UV2_ACK_MASK 0x7UL |
151 | #define UV2_ACK_UNITS_SHFT 3 | 151 | #define UV2_ACK_UNITS_SHFT 3 |
152 | #define UV2_LEG_SHFT UV2H_LB_BAU_MISC_CONTROL_USE_LEGACY_DESCRIPTOR_FORMATS_SHFT | ||
153 | #define UV2_EXT_SHFT UV2H_LB_BAU_MISC_CONTROL_ENABLE_EXTENDED_SB_STATUS_SHFT | 152 | #define UV2_EXT_SHFT UV2H_LB_BAU_MISC_CONTROL_ENABLE_EXTENDED_SB_STATUS_SHFT |
154 | 153 | ||
155 | /* | 154 | /* |
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c index 6e76c191a83..d5fd66f0d4c 100644 --- a/arch/x86/kernel/aperture_64.c +++ b/arch/x86/kernel/aperture_64.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/bitops.h> | 20 | #include <linux/bitops.h> |
21 | #include <linux/ioport.h> | 21 | #include <linux/ioport.h> |
22 | #include <linux/suspend.h> | 22 | #include <linux/suspend.h> |
23 | #include <linux/kmemleak.h> | ||
24 | #include <asm/e820.h> | 23 | #include <asm/e820.h> |
25 | #include <asm/io.h> | 24 | #include <asm/io.h> |
26 | #include <asm/iommu.h> | 25 | #include <asm/iommu.h> |
@@ -95,11 +94,6 @@ static u32 __init allocate_aperture(void) | |||
95 | return 0; | 94 | return 0; |
96 | } | 95 | } |
97 | memblock_reserve(addr, aper_size); | 96 | memblock_reserve(addr, aper_size); |
98 | /* | ||
99 | * Kmemleak should not scan this block as it may not be mapped via the | ||
100 | * kernel direct mapping. | ||
101 | */ | ||
102 | kmemleak_ignore(phys_to_virt(addr)); | ||
103 | printk(KERN_INFO "Mapping aperture over %d KB of RAM @ %lx\n", | 97 | printk(KERN_INFO "Mapping aperture over %d KB of RAM @ %lx\n", |
104 | aper_size >> 10, addr); | 98 | aper_size >> 10, addr); |
105 | insert_aperture_resource((u32)addr, aper_size); | 99 | insert_aperture_resource((u32)addr, aper_size); |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 5155d6f806f..8704918514d 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -1195,7 +1195,7 @@ static void __clear_irq_vector(int irq, struct irq_cfg *cfg) | |||
1195 | BUG_ON(!cfg->vector); | 1195 | BUG_ON(!cfg->vector); |
1196 | 1196 | ||
1197 | vector = cfg->vector; | 1197 | vector = cfg->vector; |
1198 | for_each_cpu_and(cpu, cfg->domain, cpu_online_mask) | 1198 | for_each_cpu(cpu, cfg->domain) |
1199 | per_cpu(vector_irq, cpu)[vector] = -1; | 1199 | per_cpu(vector_irq, cpu)[vector] = -1; |
1200 | 1200 | ||
1201 | cfg->vector = 0; | 1201 | cfg->vector = 0; |
@@ -1203,7 +1203,7 @@ static void __clear_irq_vector(int irq, struct irq_cfg *cfg) | |||
1203 | 1203 | ||
1204 | if (likely(!cfg->move_in_progress)) | 1204 | if (likely(!cfg->move_in_progress)) |
1205 | return; | 1205 | return; |
1206 | for_each_cpu_and(cpu, cfg->old_domain, cpu_online_mask) { | 1206 | for_each_cpu(cpu, cfg->old_domain) { |
1207 | for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; | 1207 | for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; |
1208 | vector++) { | 1208 | vector++) { |
1209 | if (per_cpu(vector_irq, cpu)[vector] != irq) | 1209 | if (per_cpu(vector_irq, cpu)[vector] != irq) |
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index 5623b4b5d51..5a5a5dc1ff1 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
@@ -1278,7 +1278,7 @@ static void mce_timer_fn(unsigned long data) | |||
1278 | */ | 1278 | */ |
1279 | iv = __this_cpu_read(mce_next_interval); | 1279 | iv = __this_cpu_read(mce_next_interval); |
1280 | if (mce_notify_irq()) | 1280 | if (mce_notify_irq()) |
1281 | iv = max(iv, (unsigned long) HZ/100); | 1281 | iv = max(iv / 2, (unsigned long) HZ/100); |
1282 | else | 1282 | else |
1283 | iv = min(iv * 2, round_jiffies_relative(check_interval * HZ)); | 1283 | iv = min(iv * 2, round_jiffies_relative(check_interval * HZ)); |
1284 | __this_cpu_write(mce_next_interval, iv); | 1284 | __this_cpu_write(mce_next_interval, iv); |
@@ -1560,7 +1560,7 @@ static void __mcheck_cpu_init_vendor(struct cpuinfo_x86 *c) | |||
1560 | static void __mcheck_cpu_init_timer(void) | 1560 | static void __mcheck_cpu_init_timer(void) |
1561 | { | 1561 | { |
1562 | struct timer_list *t = &__get_cpu_var(mce_timer); | 1562 | struct timer_list *t = &__get_cpu_var(mce_timer); |
1563 | unsigned long iv = __this_cpu_read(mce_next_interval); | 1563 | unsigned long iv = check_interval * HZ; |
1564 | 1564 | ||
1565 | setup_timer(t, mce_timer_fn, smp_processor_id()); | 1565 | setup_timer(t, mce_timer_fn, smp_processor_id()); |
1566 | 1566 | ||
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index e049d6da018..c4706cf9c01 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -1496,6 +1496,7 @@ static struct cpu_hw_events *allocate_fake_cpuc(void) | |||
1496 | if (!cpuc->shared_regs) | 1496 | if (!cpuc->shared_regs) |
1497 | goto error; | 1497 | goto error; |
1498 | } | 1498 | } |
1499 | cpuc->is_fake = 1; | ||
1499 | return cpuc; | 1500 | return cpuc; |
1500 | error: | 1501 | error: |
1501 | free_fake_cpuc(cpuc); | 1502 | free_fake_cpuc(cpuc); |
@@ -1756,6 +1757,12 @@ perf_callchain_kernel(struct perf_callchain_entry *entry, struct pt_regs *regs) | |||
1756 | dump_trace(NULL, regs, NULL, 0, &backtrace_ops, entry); | 1757 | dump_trace(NULL, regs, NULL, 0, &backtrace_ops, entry); |
1757 | } | 1758 | } |
1758 | 1759 | ||
1760 | static inline int | ||
1761 | valid_user_frame(const void __user *fp, unsigned long size) | ||
1762 | { | ||
1763 | return (__range_not_ok(fp, size, TASK_SIZE) == 0); | ||
1764 | } | ||
1765 | |||
1759 | #ifdef CONFIG_COMPAT | 1766 | #ifdef CONFIG_COMPAT |
1760 | 1767 | ||
1761 | #include <asm/compat.h> | 1768 | #include <asm/compat.h> |
@@ -1780,7 +1787,7 @@ perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry *entry) | |||
1780 | if (bytes != sizeof(frame)) | 1787 | if (bytes != sizeof(frame)) |
1781 | break; | 1788 | break; |
1782 | 1789 | ||
1783 | if (fp < compat_ptr(regs->sp)) | 1790 | if (!valid_user_frame(fp, sizeof(frame))) |
1784 | break; | 1791 | break; |
1785 | 1792 | ||
1786 | perf_callchain_store(entry, frame.return_address); | 1793 | perf_callchain_store(entry, frame.return_address); |
@@ -1826,7 +1833,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs) | |||
1826 | if (bytes != sizeof(frame)) | 1833 | if (bytes != sizeof(frame)) |
1827 | break; | 1834 | break; |
1828 | 1835 | ||
1829 | if ((unsigned long)fp < regs->sp) | 1836 | if (!valid_user_frame(fp, sizeof(frame))) |
1830 | break; | 1837 | break; |
1831 | 1838 | ||
1832 | perf_callchain_store(entry, frame.return_address); | 1839 | perf_callchain_store(entry, frame.return_address); |
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h index 6638aaf5449..7241e2fc3c1 100644 --- a/arch/x86/kernel/cpu/perf_event.h +++ b/arch/x86/kernel/cpu/perf_event.h | |||
@@ -117,6 +117,7 @@ struct cpu_hw_events { | |||
117 | struct perf_event *event_list[X86_PMC_IDX_MAX]; /* in enabled order */ | 117 | struct perf_event *event_list[X86_PMC_IDX_MAX]; /* in enabled order */ |
118 | 118 | ||
119 | unsigned int group_flag; | 119 | unsigned int group_flag; |
120 | int is_fake; | ||
120 | 121 | ||
121 | /* | 122 | /* |
122 | * Intel DebugStore bits | 123 | * Intel DebugStore bits |
@@ -364,6 +365,7 @@ struct x86_pmu { | |||
364 | int pebs_record_size; | 365 | int pebs_record_size; |
365 | void (*drain_pebs)(struct pt_regs *regs); | 366 | void (*drain_pebs)(struct pt_regs *regs); |
366 | struct event_constraint *pebs_constraints; | 367 | struct event_constraint *pebs_constraints; |
368 | void (*pebs_aliases)(struct perf_event *event); | ||
367 | 369 | ||
368 | /* | 370 | /* |
369 | * Intel LBR | 371 | * Intel LBR |
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 9e3f5d6e3d2..5073bf1c1d8 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
@@ -1121,27 +1121,33 @@ intel_bts_constraints(struct perf_event *event) | |||
1121 | return NULL; | 1121 | return NULL; |
1122 | } | 1122 | } |
1123 | 1123 | ||
1124 | static bool intel_try_alt_er(struct perf_event *event, int orig_idx) | 1124 | static int intel_alt_er(int idx) |
1125 | { | 1125 | { |
1126 | if (!(x86_pmu.er_flags & ERF_HAS_RSP_1)) | 1126 | if (!(x86_pmu.er_flags & ERF_HAS_RSP_1)) |
1127 | return false; | 1127 | return idx; |
1128 | 1128 | ||
1129 | if (event->hw.extra_reg.idx == EXTRA_REG_RSP_0) { | 1129 | if (idx == EXTRA_REG_RSP_0) |
1130 | event->hw.config &= ~INTEL_ARCH_EVENT_MASK; | 1130 | return EXTRA_REG_RSP_1; |
1131 | event->hw.config |= 0x01bb; | 1131 | |
1132 | event->hw.extra_reg.idx = EXTRA_REG_RSP_1; | 1132 | if (idx == EXTRA_REG_RSP_1) |
1133 | event->hw.extra_reg.reg = MSR_OFFCORE_RSP_1; | 1133 | return EXTRA_REG_RSP_0; |
1134 | } else if (event->hw.extra_reg.idx == EXTRA_REG_RSP_1) { | 1134 | |
1135 | return idx; | ||
1136 | } | ||
1137 | |||
1138 | static void intel_fixup_er(struct perf_event *event, int idx) | ||
1139 | { | ||
1140 | event->hw.extra_reg.idx = idx; | ||
1141 | |||
1142 | if (idx == EXTRA_REG_RSP_0) { | ||
1135 | event->hw.config &= ~INTEL_ARCH_EVENT_MASK; | 1143 | event->hw.config &= ~INTEL_ARCH_EVENT_MASK; |
1136 | event->hw.config |= 0x01b7; | 1144 | event->hw.config |= 0x01b7; |
1137 | event->hw.extra_reg.idx = EXTRA_REG_RSP_0; | ||
1138 | event->hw.extra_reg.reg = MSR_OFFCORE_RSP_0; | 1145 | event->hw.extra_reg.reg = MSR_OFFCORE_RSP_0; |
1146 | } else if (idx == EXTRA_REG_RSP_1) { | ||
1147 | event->hw.config &= ~INTEL_ARCH_EVENT_MASK; | ||
1148 | event->hw.config |= 0x01bb; | ||
1149 | event->hw.extra_reg.reg = MSR_OFFCORE_RSP_1; | ||
1139 | } | 1150 | } |
1140 | |||
1141 | if (event->hw.extra_reg.idx == orig_idx) | ||
1142 | return false; | ||
1143 | |||
1144 | return true; | ||
1145 | } | 1151 | } |
1146 | 1152 | ||
1147 | /* | 1153 | /* |
@@ -1159,14 +1165,18 @@ __intel_shared_reg_get_constraints(struct cpu_hw_events *cpuc, | |||
1159 | struct event_constraint *c = &emptyconstraint; | 1165 | struct event_constraint *c = &emptyconstraint; |
1160 | struct er_account *era; | 1166 | struct er_account *era; |
1161 | unsigned long flags; | 1167 | unsigned long flags; |
1162 | int orig_idx = reg->idx; | 1168 | int idx = reg->idx; |
1163 | 1169 | ||
1164 | /* already allocated shared msr */ | 1170 | /* |
1165 | if (reg->alloc) | 1171 | * reg->alloc can be set due to existing state, so for fake cpuc we |
1172 | * need to ignore this, otherwise we might fail to allocate proper fake | ||
1173 | * state for this extra reg constraint. Also see the comment below. | ||
1174 | */ | ||
1175 | if (reg->alloc && !cpuc->is_fake) | ||
1166 | return NULL; /* call x86_get_event_constraint() */ | 1176 | return NULL; /* call x86_get_event_constraint() */ |
1167 | 1177 | ||
1168 | again: | 1178 | again: |
1169 | era = &cpuc->shared_regs->regs[reg->idx]; | 1179 | era = &cpuc->shared_regs->regs[idx]; |
1170 | /* | 1180 | /* |
1171 | * we use spin_lock_irqsave() to avoid lockdep issues when | 1181 | * we use spin_lock_irqsave() to avoid lockdep issues when |
1172 | * passing a fake cpuc | 1182 | * passing a fake cpuc |
@@ -1175,6 +1185,29 @@ again: | |||
1175 | 1185 | ||
1176 | if (!atomic_read(&era->ref) || era->config == reg->config) { | 1186 | if (!atomic_read(&era->ref) || era->config == reg->config) { |
1177 | 1187 | ||
1188 | /* | ||
1189 | * If its a fake cpuc -- as per validate_{group,event}() we | ||
1190 | * shouldn't touch event state and we can avoid doing so | ||
1191 | * since both will only call get_event_constraints() once | ||
1192 | * on each event, this avoids the need for reg->alloc. | ||
1193 | * | ||
1194 | * Not doing the ER fixup will only result in era->reg being | ||
1195 | * wrong, but since we won't actually try and program hardware | ||
1196 | * this isn't a problem either. | ||
1197 | */ | ||
1198 | if (!cpuc->is_fake) { | ||
1199 | if (idx != reg->idx) | ||
1200 | intel_fixup_er(event, idx); | ||
1201 | |||
1202 | /* | ||
1203 | * x86_schedule_events() can call get_event_constraints() | ||
1204 | * multiple times on events in the case of incremental | ||
1205 | * scheduling(). reg->alloc ensures we only do the ER | ||
1206 | * allocation once. | ||
1207 | */ | ||
1208 | reg->alloc = 1; | ||
1209 | } | ||
1210 | |||
1178 | /* lock in msr value */ | 1211 | /* lock in msr value */ |
1179 | era->config = reg->config; | 1212 | era->config = reg->config; |
1180 | era->reg = reg->reg; | 1213 | era->reg = reg->reg; |
@@ -1182,17 +1215,17 @@ again: | |||
1182 | /* one more user */ | 1215 | /* one more user */ |
1183 | atomic_inc(&era->ref); | 1216 | atomic_inc(&era->ref); |
1184 | 1217 | ||
1185 | /* no need to reallocate during incremental event scheduling */ | ||
1186 | reg->alloc = 1; | ||
1187 | |||
1188 | /* | 1218 | /* |
1189 | * need to call x86_get_event_constraint() | 1219 | * need to call x86_get_event_constraint() |
1190 | * to check if associated event has constraints | 1220 | * to check if associated event has constraints |
1191 | */ | 1221 | */ |
1192 | c = NULL; | 1222 | c = NULL; |
1193 | } else if (intel_try_alt_er(event, orig_idx)) { | 1223 | } else { |
1194 | raw_spin_unlock_irqrestore(&era->lock, flags); | 1224 | idx = intel_alt_er(idx); |
1195 | goto again; | 1225 | if (idx != reg->idx) { |
1226 | raw_spin_unlock_irqrestore(&era->lock, flags); | ||
1227 | goto again; | ||
1228 | } | ||
1196 | } | 1229 | } |
1197 | raw_spin_unlock_irqrestore(&era->lock, flags); | 1230 | raw_spin_unlock_irqrestore(&era->lock, flags); |
1198 | 1231 | ||
@@ -1206,11 +1239,14 @@ __intel_shared_reg_put_constraints(struct cpu_hw_events *cpuc, | |||
1206 | struct er_account *era; | 1239 | struct er_account *era; |
1207 | 1240 | ||
1208 | /* | 1241 | /* |
1209 | * only put constraint if extra reg was actually | 1242 | * Only put constraint if extra reg was actually allocated. Also takes |
1210 | * allocated. Also takes care of event which do | 1243 | * care of event which do not use an extra shared reg. |
1211 | * not use an extra shared reg | 1244 | * |
1245 | * Also, if this is a fake cpuc we shouldn't touch any event state | ||
1246 | * (reg->alloc) and we don't care about leaving inconsistent cpuc state | ||
1247 | * either since it'll be thrown out. | ||
1212 | */ | 1248 | */ |
1213 | if (!reg->alloc) | 1249 | if (!reg->alloc || cpuc->is_fake) |
1214 | return; | 1250 | return; |
1215 | 1251 | ||
1216 | era = &cpuc->shared_regs->regs[reg->idx]; | 1252 | era = &cpuc->shared_regs->regs[reg->idx]; |
@@ -1302,15 +1338,9 @@ static void intel_put_event_constraints(struct cpu_hw_events *cpuc, | |||
1302 | intel_put_shared_regs_event_constraints(cpuc, event); | 1338 | intel_put_shared_regs_event_constraints(cpuc, event); |
1303 | } | 1339 | } |
1304 | 1340 | ||
1305 | static int intel_pmu_hw_config(struct perf_event *event) | 1341 | static void intel_pebs_aliases_core2(struct perf_event *event) |
1306 | { | 1342 | { |
1307 | int ret = x86_pmu_hw_config(event); | 1343 | if ((event->hw.config & X86_RAW_EVENT_MASK) == 0x003c) { |
1308 | |||
1309 | if (ret) | ||
1310 | return ret; | ||
1311 | |||
1312 | if (event->attr.precise_ip && | ||
1313 | (event->hw.config & X86_RAW_EVENT_MASK) == 0x003c) { | ||
1314 | /* | 1344 | /* |
1315 | * Use an alternative encoding for CPU_CLK_UNHALTED.THREAD_P | 1345 | * Use an alternative encoding for CPU_CLK_UNHALTED.THREAD_P |
1316 | * (0x003c) so that we can use it with PEBS. | 1346 | * (0x003c) so that we can use it with PEBS. |
@@ -1331,10 +1361,48 @@ static int intel_pmu_hw_config(struct perf_event *event) | |||
1331 | */ | 1361 | */ |
1332 | u64 alt_config = X86_CONFIG(.event=0xc0, .inv=1, .cmask=16); | 1362 | u64 alt_config = X86_CONFIG(.event=0xc0, .inv=1, .cmask=16); |
1333 | 1363 | ||
1364 | alt_config |= (event->hw.config & ~X86_RAW_EVENT_MASK); | ||
1365 | event->hw.config = alt_config; | ||
1366 | } | ||
1367 | } | ||
1368 | |||
1369 | static void intel_pebs_aliases_snb(struct perf_event *event) | ||
1370 | { | ||
1371 | if ((event->hw.config & X86_RAW_EVENT_MASK) == 0x003c) { | ||
1372 | /* | ||
1373 | * Use an alternative encoding for CPU_CLK_UNHALTED.THREAD_P | ||
1374 | * (0x003c) so that we can use it with PEBS. | ||
1375 | * | ||
1376 | * The regular CPU_CLK_UNHALTED.THREAD_P event (0x003c) isn't | ||
1377 | * PEBS capable. However we can use UOPS_RETIRED.ALL | ||
1378 | * (0x01c2), which is a PEBS capable event, to get the same | ||
1379 | * count. | ||
1380 | * | ||
1381 | * UOPS_RETIRED.ALL counts the number of cycles that retires | ||
1382 | * CNTMASK micro-ops. By setting CNTMASK to a value (16) | ||
1383 | * larger than the maximum number of micro-ops that can be | ||
1384 | * retired per cycle (4) and then inverting the condition, we | ||
1385 | * count all cycles that retire 16 or less micro-ops, which | ||
1386 | * is every cycle. | ||
1387 | * | ||
1388 | * Thereby we gain a PEBS capable cycle counter. | ||
1389 | */ | ||
1390 | u64 alt_config = X86_CONFIG(.event=0xc2, .umask=0x01, .inv=1, .cmask=16); | ||
1334 | 1391 | ||
1335 | alt_config |= (event->hw.config & ~X86_RAW_EVENT_MASK); | 1392 | alt_config |= (event->hw.config & ~X86_RAW_EVENT_MASK); |
1336 | event->hw.config = alt_config; | 1393 | event->hw.config = alt_config; |
1337 | } | 1394 | } |
1395 | } | ||
1396 | |||
1397 | static int intel_pmu_hw_config(struct perf_event *event) | ||
1398 | { | ||
1399 | int ret = x86_pmu_hw_config(event); | ||
1400 | |||
1401 | if (ret) | ||
1402 | return ret; | ||
1403 | |||
1404 | if (event->attr.precise_ip && x86_pmu.pebs_aliases) | ||
1405 | x86_pmu.pebs_aliases(event); | ||
1338 | 1406 | ||
1339 | if (intel_pmu_needs_lbr_smpl(event)) { | 1407 | if (intel_pmu_needs_lbr_smpl(event)) { |
1340 | ret = intel_pmu_setup_lbr_filter(event); | 1408 | ret = intel_pmu_setup_lbr_filter(event); |
@@ -1609,6 +1677,7 @@ static __initconst const struct x86_pmu intel_pmu = { | |||
1609 | .max_period = (1ULL << 31) - 1, | 1677 | .max_period = (1ULL << 31) - 1, |
1610 | .get_event_constraints = intel_get_event_constraints, | 1678 | .get_event_constraints = intel_get_event_constraints, |
1611 | .put_event_constraints = intel_put_event_constraints, | 1679 | .put_event_constraints = intel_put_event_constraints, |
1680 | .pebs_aliases = intel_pebs_aliases_core2, | ||
1612 | 1681 | ||
1613 | .format_attrs = intel_arch3_formats_attr, | 1682 | .format_attrs = intel_arch3_formats_attr, |
1614 | 1683 | ||
@@ -1842,8 +1911,9 @@ __init int intel_pmu_init(void) | |||
1842 | break; | 1911 | break; |
1843 | 1912 | ||
1844 | case 42: /* SandyBridge */ | 1913 | case 42: /* SandyBridge */ |
1845 | x86_add_quirk(intel_sandybridge_quirk); | ||
1846 | case 45: /* SandyBridge, "Romely-EP" */ | 1914 | case 45: /* SandyBridge, "Romely-EP" */ |
1915 | x86_add_quirk(intel_sandybridge_quirk); | ||
1916 | case 58: /* IvyBridge */ | ||
1847 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, | 1917 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, |
1848 | sizeof(hw_cache_event_ids)); | 1918 | sizeof(hw_cache_event_ids)); |
1849 | 1919 | ||
@@ -1851,6 +1921,7 @@ __init int intel_pmu_init(void) | |||
1851 | 1921 | ||
1852 | x86_pmu.event_constraints = intel_snb_event_constraints; | 1922 | x86_pmu.event_constraints = intel_snb_event_constraints; |
1853 | x86_pmu.pebs_constraints = intel_snb_pebs_event_constraints; | 1923 | x86_pmu.pebs_constraints = intel_snb_pebs_event_constraints; |
1924 | x86_pmu.pebs_aliases = intel_pebs_aliases_snb; | ||
1854 | x86_pmu.extra_regs = intel_snb_extra_regs; | 1925 | x86_pmu.extra_regs = intel_snb_extra_regs; |
1855 | /* all extra regs are per-cpu when HT is on */ | 1926 | /* all extra regs are per-cpu when HT is on */ |
1856 | x86_pmu.er_flags |= ERF_HAS_RSP_1; | 1927 | x86_pmu.er_flags |= ERF_HAS_RSP_1; |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c index 5a3edc27f6e..35e2192df9f 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c | |||
@@ -400,14 +400,7 @@ struct event_constraint intel_snb_pebs_event_constraints[] = { | |||
400 | INTEL_EVENT_CONSTRAINT(0xc4, 0xf), /* BR_INST_RETIRED.* */ | 400 | INTEL_EVENT_CONSTRAINT(0xc4, 0xf), /* BR_INST_RETIRED.* */ |
401 | INTEL_EVENT_CONSTRAINT(0xc5, 0xf), /* BR_MISP_RETIRED.* */ | 401 | INTEL_EVENT_CONSTRAINT(0xc5, 0xf), /* BR_MISP_RETIRED.* */ |
402 | INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.* */ | 402 | INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.* */ |
403 | INTEL_UEVENT_CONSTRAINT(0x11d0, 0xf), /* MEM_UOP_RETIRED.STLB_MISS_LOADS */ | 403 | INTEL_EVENT_CONSTRAINT(0xd0, 0xf), /* MEM_UOP_RETIRED.* */ |
404 | INTEL_UEVENT_CONSTRAINT(0x12d0, 0xf), /* MEM_UOP_RETIRED.STLB_MISS_STORES */ | ||
405 | INTEL_UEVENT_CONSTRAINT(0x21d0, 0xf), /* MEM_UOP_RETIRED.LOCK_LOADS */ | ||
406 | INTEL_UEVENT_CONSTRAINT(0x22d0, 0xf), /* MEM_UOP_RETIRED.LOCK_STORES */ | ||
407 | INTEL_UEVENT_CONSTRAINT(0x41d0, 0xf), /* MEM_UOP_RETIRED.SPLIT_LOADS */ | ||
408 | INTEL_UEVENT_CONSTRAINT(0x42d0, 0xf), /* MEM_UOP_RETIRED.SPLIT_STORES */ | ||
409 | INTEL_UEVENT_CONSTRAINT(0x81d0, 0xf), /* MEM_UOP_RETIRED.ANY_LOADS */ | ||
410 | INTEL_UEVENT_CONSTRAINT(0x82d0, 0xf), /* MEM_UOP_RETIRED.ANY_STORES */ | ||
411 | INTEL_EVENT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */ | 404 | INTEL_EVENT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */ |
412 | INTEL_EVENT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */ | 405 | INTEL_EVENT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */ |
413 | INTEL_UEVENT_CONSTRAINT(0x02d4, 0xf), /* MEM_LOAD_UOPS_MISC_RETIRED.LLC_MISS */ | 406 | INTEL_UEVENT_CONSTRAINT(0x02d4, 0xf), /* MEM_LOAD_UOPS_MISC_RETIRED.LLC_MISS */ |
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index 086eb58c6e8..f1b42b3a186 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c | |||
@@ -120,11 +120,6 @@ bool kvm_check_and_clear_guest_paused(void) | |||
120 | bool ret = false; | 120 | bool ret = false; |
121 | struct pvclock_vcpu_time_info *src; | 121 | struct pvclock_vcpu_time_info *src; |
122 | 122 | ||
123 | /* | ||
124 | * per_cpu() is safe here because this function is only called from | ||
125 | * timer functions where preemption is already disabled. | ||
126 | */ | ||
127 | WARN_ON(!in_atomic()); | ||
128 | src = &__get_cpu_var(hv_clock); | 123 | src = &__get_cpu_var(hv_clock); |
129 | if ((src->flags & PVCLOCK_GUEST_STOPPED) != 0) { | 124 | if ((src->flags & PVCLOCK_GUEST_STOPPED) != 0) { |
130 | __this_cpu_and(hv_clock.flags, ~PVCLOCK_GUEST_STOPPED); | 125 | __this_cpu_and(hv_clock.flags, ~PVCLOCK_GUEST_STOPPED); |
diff --git a/arch/x86/kernel/nmi_selftest.c b/arch/x86/kernel/nmi_selftest.c index e31bf8d5c4d..149b8d9c6ad 100644 --- a/arch/x86/kernel/nmi_selftest.c +++ b/arch/x86/kernel/nmi_selftest.c | |||
@@ -42,7 +42,7 @@ static int __init nmi_unk_cb(unsigned int val, struct pt_regs *regs) | |||
42 | static void __init init_nmi_testsuite(void) | 42 | static void __init init_nmi_testsuite(void) |
43 | { | 43 | { |
44 | /* trap all the unknown NMIs we may generate */ | 44 | /* trap all the unknown NMIs we may generate */ |
45 | register_nmi_handler(NMI_UNKNOWN, nmi_unk_cb, 0, "nmi_selftest_unk"); | 45 | register_nmi_handler_initonly(NMI_UNKNOWN, nmi_unk_cb, 0, "nmi_selftest_unk"); |
46 | } | 46 | } |
47 | 47 | ||
48 | static void __init cleanup_nmi_testsuite(void) | 48 | static void __init cleanup_nmi_testsuite(void) |
@@ -64,7 +64,7 @@ static void __init test_nmi_ipi(struct cpumask *mask) | |||
64 | { | 64 | { |
65 | unsigned long timeout; | 65 | unsigned long timeout; |
66 | 66 | ||
67 | if (register_nmi_handler(NMI_LOCAL, test_nmi_ipi_callback, | 67 | if (register_nmi_handler_initonly(NMI_LOCAL, test_nmi_ipi_callback, |
68 | NMI_FLAG_FIRST, "nmi_selftest")) { | 68 | NMI_FLAG_FIRST, "nmi_selftest")) { |
69 | nmi_fail = FAILURE; | 69 | nmi_fail = FAILURE; |
70 | return; | 70 | return; |
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index 62c9457ccd2..c0f420f76cd 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c | |||
@@ -100,7 +100,7 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size, | |||
100 | struct dma_attrs *attrs) | 100 | struct dma_attrs *attrs) |
101 | { | 101 | { |
102 | unsigned long dma_mask; | 102 | unsigned long dma_mask; |
103 | struct page *page = NULL; | 103 | struct page *page; |
104 | unsigned int count = PAGE_ALIGN(size) >> PAGE_SHIFT; | 104 | unsigned int count = PAGE_ALIGN(size) >> PAGE_SHIFT; |
105 | dma_addr_t addr; | 105 | dma_addr_t addr; |
106 | 106 | ||
@@ -108,6 +108,7 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size, | |||
108 | 108 | ||
109 | flag |= __GFP_ZERO; | 109 | flag |= __GFP_ZERO; |
110 | again: | 110 | again: |
111 | page = NULL; | ||
111 | if (!(flag & GFP_ATOMIC)) | 112 | if (!(flag & GFP_ATOMIC)) |
112 | page = dma_alloc_from_contiguous(dev, count, get_order(size)); | 113 | page = dma_alloc_from_contiguous(dev, count, get_order(size)); |
113 | if (!page) | 114 | if (!page) |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index ab3f0626071..10ae9be07b4 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -643,9 +643,11 @@ void native_machine_shutdown(void) | |||
643 | set_cpus_allowed_ptr(current, cpumask_of(reboot_cpu_id)); | 643 | set_cpus_allowed_ptr(current, cpumask_of(reboot_cpu_id)); |
644 | 644 | ||
645 | /* | 645 | /* |
646 | * O.K Now that I'm on the appropriate processor, | 646 | * O.K Now that I'm on the appropriate processor, stop all of the |
647 | * stop all of the others. | 647 | * others. Also disable the local irq to not receive the per-cpu |
648 | * timer interrupt which may trigger scheduler's load balance. | ||
648 | */ | 649 | */ |
650 | local_irq_disable(); | ||
649 | stop_other_cpus(); | 651 | stop_other_cpus(); |
650 | #endif | 652 | #endif |
651 | 653 | ||
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 456d64806c8..54e938de713 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -351,9 +351,12 @@ static bool __cpuinit match_llc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) | |||
351 | 351 | ||
352 | static bool __cpuinit match_mc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) | 352 | static bool __cpuinit match_mc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) |
353 | { | 353 | { |
354 | if (c->phys_proc_id == o->phys_proc_id) | 354 | if (c->phys_proc_id == o->phys_proc_id) { |
355 | return topology_sane(c, o, "mc"); | 355 | if (cpu_has(c, X86_FEATURE_AMD_DCM)) |
356 | return true; | ||
356 | 357 | ||
358 | return topology_sane(c, o, "mc"); | ||
359 | } | ||
357 | return false; | 360 | return false; |
358 | } | 361 | } |
359 | 362 | ||
@@ -384,6 +387,15 @@ void __cpuinit set_cpu_sibling_map(int cpu) | |||
384 | if ((i == cpu) || (has_mc && match_llc(c, o))) | 387 | if ((i == cpu) || (has_mc && match_llc(c, o))) |
385 | link_mask(llc_shared, cpu, i); | 388 | link_mask(llc_shared, cpu, i); |
386 | 389 | ||
390 | } | ||
391 | |||
392 | /* | ||
393 | * This needs a separate iteration over the cpus because we rely on all | ||
394 | * cpu_sibling_mask links to be set-up. | ||
395 | */ | ||
396 | for_each_cpu(i, cpu_sibling_setup_mask) { | ||
397 | o = &cpu_data(i); | ||
398 | |||
387 | if ((i == cpu) || (has_mc && match_mc(c, o))) { | 399 | if ((i == cpu) || (has_mc && match_mc(c, o))) { |
388 | link_mask(core, cpu, i); | 400 | link_mask(core, cpu, i); |
389 | 401 | ||
diff --git a/arch/x86/lib/usercopy.c b/arch/x86/lib/usercopy.c index f61ee67ec00..4f74d94c8d9 100644 --- a/arch/x86/lib/usercopy.c +++ b/arch/x86/lib/usercopy.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/module.h> | 8 | #include <linux/module.h> |
9 | 9 | ||
10 | #include <asm/word-at-a-time.h> | 10 | #include <asm/word-at-a-time.h> |
11 | #include <linux/sched.h> | ||
11 | 12 | ||
12 | /* | 13 | /* |
13 | * best effort, GUP based copy_from_user() that is NMI-safe | 14 | * best effort, GUP based copy_from_user() that is NMI-safe |
@@ -21,6 +22,9 @@ copy_from_user_nmi(void *to, const void __user *from, unsigned long n) | |||
21 | void *map; | 22 | void *map; |
22 | int ret; | 23 | int ret; |
23 | 24 | ||
25 | if (__range_not_ok(from, n, TASK_SIZE)) | ||
26 | return len; | ||
27 | |||
24 | do { | 28 | do { |
25 | ret = __get_user_pages_fast(addr, 1, 0, &page); | 29 | ret = __get_user_pages_fast(addr, 1, 0, &page); |
26 | if (!ret) | 30 | if (!ret) |
diff --git a/arch/x86/lib/x86-opcode-map.txt b/arch/x86/lib/x86-opcode-map.txt index 81913790442..5d7e51f3fd2 100644 --- a/arch/x86/lib/x86-opcode-map.txt +++ b/arch/x86/lib/x86-opcode-map.txt | |||
@@ -28,7 +28,7 @@ | |||
28 | # - (66): the last prefix is 0x66 | 28 | # - (66): the last prefix is 0x66 |
29 | # - (F3): the last prefix is 0xF3 | 29 | # - (F3): the last prefix is 0xF3 |
30 | # - (F2): the last prefix is 0xF2 | 30 | # - (F2): the last prefix is 0xF2 |
31 | # | 31 | # - (!F3) : the last prefix is not 0xF3 (including non-last prefix case) |
32 | 32 | ||
33 | Table: one byte opcode | 33 | Table: one byte opcode |
34 | Referrer: | 34 | Referrer: |
@@ -515,12 +515,12 @@ b4: LFS Gv,Mp | |||
515 | b5: LGS Gv,Mp | 515 | b5: LGS Gv,Mp |
516 | b6: MOVZX Gv,Eb | 516 | b6: MOVZX Gv,Eb |
517 | b7: MOVZX Gv,Ew | 517 | b7: MOVZX Gv,Ew |
518 | b8: JMPE | POPCNT Gv,Ev (F3) | 518 | b8: JMPE (!F3) | POPCNT Gv,Ev (F3) |
519 | b9: Grp10 (1A) | 519 | b9: Grp10 (1A) |
520 | ba: Grp8 Ev,Ib (1A) | 520 | ba: Grp8 Ev,Ib (1A) |
521 | bb: BTC Ev,Gv | 521 | bb: BTC Ev,Gv |
522 | bc: BSF Gv,Ev | TZCNT Gv,Ev (F3) | 522 | bc: BSF Gv,Ev (!F3) | TZCNT Gv,Ev (F3) |
523 | bd: BSR Gv,Ev | LZCNT Gv,Ev (F3) | 523 | bd: BSR Gv,Ev (!F3) | LZCNT Gv,Ev (F3) |
524 | be: MOVSX Gv,Eb | 524 | be: MOVSX Gv,Eb |
525 | bf: MOVSX Gv,Ew | 525 | bf: MOVSX Gv,Ew |
526 | # 0x0f 0xc0-0xcf | 526 | # 0x0f 0xc0-0xcf |
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index 97141c26a13..bc4e9d84157 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c | |||
@@ -62,7 +62,8 @@ static void __init find_early_table_space(struct map_range *mr, unsigned long en | |||
62 | extra += PMD_SIZE; | 62 | extra += PMD_SIZE; |
63 | #endif | 63 | #endif |
64 | /* The first 2/4M doesn't use large pages. */ | 64 | /* The first 2/4M doesn't use large pages. */ |
65 | extra += mr->end - mr->start; | 65 | if (mr->start < PMD_SIZE) |
66 | extra += mr->end - mr->start; | ||
66 | 67 | ||
67 | ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT; | 68 | ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT; |
68 | } else | 69 | } else |
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index be1ef574ce9..78fe3f1ac49 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -180,7 +180,7 @@ err_free_memtype: | |||
180 | 180 | ||
181 | /** | 181 | /** |
182 | * ioremap_nocache - map bus memory into CPU space | 182 | * ioremap_nocache - map bus memory into CPU space |
183 | * @offset: bus address of the memory | 183 | * @phys_addr: bus address of the memory |
184 | * @size: size of the resource to map | 184 | * @size: size of the resource to map |
185 | * | 185 | * |
186 | * ioremap_nocache performs a platform specific sequence of operations to | 186 | * ioremap_nocache performs a platform specific sequence of operations to |
@@ -217,7 +217,7 @@ EXPORT_SYMBOL(ioremap_nocache); | |||
217 | 217 | ||
218 | /** | 218 | /** |
219 | * ioremap_wc - map memory into CPU space write combined | 219 | * ioremap_wc - map memory into CPU space write combined |
220 | * @offset: bus address of the memory | 220 | * @phys_addr: bus address of the memory |
221 | * @size: size of the resource to map | 221 | * @size: size of the resource to map |
222 | * | 222 | * |
223 | * This version of ioremap ensures that the memory is marked write combining. | 223 | * This version of ioremap ensures that the memory is marked write combining. |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index e1ebde31521..a718e0d2350 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -122,7 +122,7 @@ within(unsigned long addr, unsigned long start, unsigned long end) | |||
122 | 122 | ||
123 | /** | 123 | /** |
124 | * clflush_cache_range - flush a cache range with clflush | 124 | * clflush_cache_range - flush a cache range with clflush |
125 | * @addr: virtual start address | 125 | * @vaddr: virtual start address |
126 | * @size: number of bytes to flush | 126 | * @size: number of bytes to flush |
127 | * | 127 | * |
128 | * clflush is an unordered instruction which needs fencing with mfence | 128 | * clflush is an unordered instruction which needs fencing with mfence |
diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c index 732af3a9618..4599c3e8bcb 100644 --- a/arch/x86/mm/srat.c +++ b/arch/x86/mm/srat.c | |||
@@ -176,6 +176,8 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) | |||
176 | return; | 176 | return; |
177 | } | 177 | } |
178 | 178 | ||
179 | node_set(node, numa_nodes_parsed); | ||
180 | |||
179 | printk(KERN_INFO "SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]\n", | 181 | printk(KERN_INFO "SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]\n", |
180 | node, pxm, | 182 | node, pxm, |
181 | (unsigned long long) start, (unsigned long long) end - 1); | 183 | (unsigned long long) start, (unsigned long long) end - 1); |
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c index e31bcd8f2ee..fd41a9262d6 100644 --- a/arch/x86/platform/mrst/mrst.c +++ b/arch/x86/platform/mrst/mrst.c | |||
@@ -782,7 +782,7 @@ BLOCKING_NOTIFIER_HEAD(intel_scu_notifier); | |||
782 | EXPORT_SYMBOL_GPL(intel_scu_notifier); | 782 | EXPORT_SYMBOL_GPL(intel_scu_notifier); |
783 | 783 | ||
784 | /* Called by IPC driver */ | 784 | /* Called by IPC driver */ |
785 | void intel_scu_devices_create(void) | 785 | void __devinit intel_scu_devices_create(void) |
786 | { | 786 | { |
787 | int i; | 787 | int i; |
788 | 788 | ||
diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c index 3ae0e61abd2..59880afa851 100644 --- a/arch/x86/platform/uv/tlb_uv.c +++ b/arch/x86/platform/uv/tlb_uv.c | |||
@@ -1295,7 +1295,6 @@ static void __init enable_timeouts(void) | |||
1295 | */ | 1295 | */ |
1296 | mmr_image |= (1L << SOFTACK_MSHIFT); | 1296 | mmr_image |= (1L << SOFTACK_MSHIFT); |
1297 | if (is_uv2_hub()) { | 1297 | if (is_uv2_hub()) { |
1298 | mmr_image &= ~(1L << UV2_LEG_SHFT); | ||
1299 | mmr_image |= (1L << UV2_EXT_SHFT); | 1298 | mmr_image |= (1L << UV2_EXT_SHFT); |
1300 | } | 1299 | } |
1301 | write_mmr_misc_control(pnode, mmr_image); | 1300 | write_mmr_misc_control(pnode, mmr_image); |
diff --git a/arch/x86/tools/gen-insn-attr-x86.awk b/arch/x86/tools/gen-insn-attr-x86.awk index 5f6a5b6c3a1..ddcf39b1a18 100644 --- a/arch/x86/tools/gen-insn-attr-x86.awk +++ b/arch/x86/tools/gen-insn-attr-x86.awk | |||
@@ -66,9 +66,10 @@ BEGIN { | |||
66 | rex_expr = "^REX(\\.[XRWB]+)*" | 66 | rex_expr = "^REX(\\.[XRWB]+)*" |
67 | fpu_expr = "^ESC" # TODO | 67 | fpu_expr = "^ESC" # TODO |
68 | 68 | ||
69 | lprefix1_expr = "\\(66\\)" | 69 | lprefix1_expr = "\\((66|!F3)\\)" |
70 | lprefix2_expr = "\\(F3\\)" | 70 | lprefix2_expr = "\\(F3\\)" |
71 | lprefix3_expr = "\\(F2\\)" | 71 | lprefix3_expr = "\\((F2|!F3)\\)" |
72 | lprefix_expr = "\\((66|F2|F3)\\)" | ||
72 | max_lprefix = 4 | 73 | max_lprefix = 4 |
73 | 74 | ||
74 | # All opcodes starting with lower-case 'v' or with (v1) superscript | 75 | # All opcodes starting with lower-case 'v' or with (v1) superscript |
@@ -333,13 +334,16 @@ function convert_operands(count,opnd, i,j,imm,mod) | |||
333 | if (match(ext, lprefix1_expr)) { | 334 | if (match(ext, lprefix1_expr)) { |
334 | lptable1[idx] = add_flags(lptable1[idx],flags) | 335 | lptable1[idx] = add_flags(lptable1[idx],flags) |
335 | variant = "INAT_VARIANT" | 336 | variant = "INAT_VARIANT" |
336 | } else if (match(ext, lprefix2_expr)) { | 337 | } |
338 | if (match(ext, lprefix2_expr)) { | ||
337 | lptable2[idx] = add_flags(lptable2[idx],flags) | 339 | lptable2[idx] = add_flags(lptable2[idx],flags) |
338 | variant = "INAT_VARIANT" | 340 | variant = "INAT_VARIANT" |
339 | } else if (match(ext, lprefix3_expr)) { | 341 | } |
342 | if (match(ext, lprefix3_expr)) { | ||
340 | lptable3[idx] = add_flags(lptable3[idx],flags) | 343 | lptable3[idx] = add_flags(lptable3[idx],flags) |
341 | variant = "INAT_VARIANT" | 344 | variant = "INAT_VARIANT" |
342 | } else { | 345 | } |
346 | if (!match(ext, lprefix_expr)){ | ||
343 | table[idx] = add_flags(table[idx],flags) | 347 | table[idx] = add_flags(table[idx],flags) |
344 | } | 348 | } |
345 | } | 349 | } |
diff --git a/arch/x86/um/sys_call_table_32.c b/arch/x86/um/sys_call_table_32.c index 416bd40c0eb..68d1dc91b37 100644 --- a/arch/x86/um/sys_call_table_32.c +++ b/arch/x86/um/sys_call_table_32.c | |||
@@ -39,9 +39,9 @@ | |||
39 | #undef __SYSCALL_I386 | 39 | #undef __SYSCALL_I386 |
40 | #define __SYSCALL_I386(nr, sym, compat) [ nr ] = sym, | 40 | #define __SYSCALL_I386(nr, sym, compat) [ nr ] = sym, |
41 | 41 | ||
42 | typedef void (*sys_call_ptr_t)(void); | 42 | typedef asmlinkage void (*sys_call_ptr_t)(void); |
43 | 43 | ||
44 | extern void sys_ni_syscall(void); | 44 | extern asmlinkage void sys_ni_syscall(void); |
45 | 45 | ||
46 | const sys_call_ptr_t sys_call_table[] __cacheline_aligned = { | 46 | const sys_call_ptr_t sys_call_table[] __cacheline_aligned = { |
47 | /* | 47 | /* |
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index e74df9548a0..ff962d4b821 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -209,6 +209,9 @@ static void __init xen_banner(void) | |||
209 | xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : ""); | 209 | xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : ""); |
210 | } | 210 | } |
211 | 211 | ||
212 | #define CPUID_THERM_POWER_LEAF 6 | ||
213 | #define APERFMPERF_PRESENT 0 | ||
214 | |||
212 | static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0; | 215 | static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0; |
213 | static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0; | 216 | static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0; |
214 | 217 | ||
@@ -242,6 +245,11 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, | |||
242 | *dx = cpuid_leaf5_edx_val; | 245 | *dx = cpuid_leaf5_edx_val; |
243 | return; | 246 | return; |
244 | 247 | ||
248 | case CPUID_THERM_POWER_LEAF: | ||
249 | /* Disabling APERFMPERF for kernel usage */ | ||
250 | maskecx = ~(1 << APERFMPERF_PRESENT); | ||
251 | break; | ||
252 | |||
245 | case 0xb: | 253 | case 0xb: |
246 | /* Suppress extended topology stuff */ | 254 | /* Suppress extended topology stuff */ |
247 | maskebx = 0; | 255 | maskebx = 0; |
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index ffd08c414e9..64effdc6da9 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c | |||
@@ -706,6 +706,7 @@ int m2p_add_override(unsigned long mfn, struct page *page, | |||
706 | unsigned long uninitialized_var(address); | 706 | unsigned long uninitialized_var(address); |
707 | unsigned level; | 707 | unsigned level; |
708 | pte_t *ptep = NULL; | 708 | pte_t *ptep = NULL; |
709 | int ret = 0; | ||
709 | 710 | ||
710 | pfn = page_to_pfn(page); | 711 | pfn = page_to_pfn(page); |
711 | if (!PageHighMem(page)) { | 712 | if (!PageHighMem(page)) { |
@@ -741,6 +742,24 @@ int m2p_add_override(unsigned long mfn, struct page *page, | |||
741 | list_add(&page->lru, &m2p_overrides[mfn_hash(mfn)]); | 742 | list_add(&page->lru, &m2p_overrides[mfn_hash(mfn)]); |
742 | spin_unlock_irqrestore(&m2p_override_lock, flags); | 743 | spin_unlock_irqrestore(&m2p_override_lock, flags); |
743 | 744 | ||
745 | /* p2m(m2p(mfn)) == mfn: the mfn is already present somewhere in | ||
746 | * this domain. Set the FOREIGN_FRAME_BIT in the p2m for the other | ||
747 | * pfn so that the following mfn_to_pfn(mfn) calls will return the | ||
748 | * pfn from the m2p_override (the backend pfn) instead. | ||
749 | * We need to do this because the pages shared by the frontend | ||
750 | * (xen-blkfront) can be already locked (lock_page, called by | ||
751 | * do_read_cache_page); when the userspace backend tries to use them | ||
752 | * with direct_IO, mfn_to_pfn returns the pfn of the frontend, so | ||
753 | * do_blockdev_direct_IO is going to try to lock the same pages | ||
754 | * again resulting in a deadlock. | ||
755 | * As a side effect get_user_pages_fast might not be safe on the | ||
756 | * frontend pages while they are being shared with the backend, | ||
757 | * because mfn_to_pfn (that ends up being called by GUPF) will | ||
758 | * return the backend pfn rather than the frontend pfn. */ | ||
759 | ret = __get_user(pfn, &machine_to_phys_mapping[mfn]); | ||
760 | if (ret == 0 && get_phys_to_machine(pfn) == mfn) | ||
761 | set_phys_to_machine(pfn, FOREIGN_FRAME(mfn)); | ||
762 | |||
744 | return 0; | 763 | return 0; |
745 | } | 764 | } |
746 | EXPORT_SYMBOL_GPL(m2p_add_override); | 765 | EXPORT_SYMBOL_GPL(m2p_add_override); |
@@ -752,6 +771,7 @@ int m2p_remove_override(struct page *page, bool clear_pte) | |||
752 | unsigned long uninitialized_var(address); | 771 | unsigned long uninitialized_var(address); |
753 | unsigned level; | 772 | unsigned level; |
754 | pte_t *ptep = NULL; | 773 | pte_t *ptep = NULL; |
774 | int ret = 0; | ||
755 | 775 | ||
756 | pfn = page_to_pfn(page); | 776 | pfn = page_to_pfn(page); |
757 | mfn = get_phys_to_machine(pfn); | 777 | mfn = get_phys_to_machine(pfn); |
@@ -821,6 +841,22 @@ int m2p_remove_override(struct page *page, bool clear_pte) | |||
821 | } else | 841 | } else |
822 | set_phys_to_machine(pfn, page->index); | 842 | set_phys_to_machine(pfn, page->index); |
823 | 843 | ||
844 | /* p2m(m2p(mfn)) == FOREIGN_FRAME(mfn): the mfn is already present | ||
845 | * somewhere in this domain, even before being added to the | ||
846 | * m2p_override (see comment above in m2p_add_override). | ||
847 | * If there are no other entries in the m2p_override corresponding | ||
848 | * to this mfn, then remove the FOREIGN_FRAME_BIT from the p2m for | ||
849 | * the original pfn (the one shared by the frontend): the backend | ||
850 | * cannot do any IO on this page anymore because it has been | ||
851 | * unshared. Removing the FOREIGN_FRAME_BIT from the p2m entry of | ||
852 | * the original pfn causes mfn_to_pfn(mfn) to return the frontend | ||
853 | * pfn again. */ | ||
854 | mfn &= ~FOREIGN_FRAME_BIT; | ||
855 | ret = __get_user(pfn, &machine_to_phys_mapping[mfn]); | ||
856 | if (ret == 0 && get_phys_to_machine(pfn) == FOREIGN_FRAME(mfn) && | ||
857 | m2p_find_override(mfn) == NULL) | ||
858 | set_phys_to_machine(pfn, mfn); | ||
859 | |||
824 | return 0; | 860 | return 0; |
825 | } | 861 | } |
826 | EXPORT_SYMBOL_GPL(m2p_remove_override); | 862 | EXPORT_SYMBOL_GPL(m2p_remove_override); |
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 3ebba0753d3..a4790bf22c5 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
@@ -371,7 +371,8 @@ char * __init xen_memory_setup(void) | |||
371 | populated = xen_populate_chunk(map, memmap.nr_entries, | 371 | populated = xen_populate_chunk(map, memmap.nr_entries, |
372 | max_pfn, &last_pfn, xen_released_pages); | 372 | max_pfn, &last_pfn, xen_released_pages); |
373 | 373 | ||
374 | extra_pages += (xen_released_pages - populated); | 374 | xen_released_pages -= populated; |
375 | extra_pages += xen_released_pages; | ||
375 | 376 | ||
376 | if (last_pfn > max_pfn) { | 377 | if (last_pfn > max_pfn) { |
377 | max_pfn = min(MAX_DOMAIN_PAGES, last_pfn); | 378 | max_pfn = min(MAX_DOMAIN_PAGES, last_pfn); |