aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2011-08-29 03:08:51 -0400
committerPaul Mundt <lethal@linux-sh.org>2011-08-29 03:08:51 -0400
commitb9a3acf46afdafc601947136f63e9dd228cd86e8 (patch)
tree2b206b6d3c51f673c94fbcdf03df2a699e7110d2 /arch
parent9f0fa7991af382bfa8c9575d2457a0b6ad03ac4c (diff)
parent21d41f2b312231536cf981c960c83cc4493c0293 (diff)
Merge branch 'sh/stable-updates' into sh-latest
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/include/asm/sysinfo.h9
-rw-r--r--arch/alpha/include/asm/thread_info.h8
-rw-r--r--arch/alpha/kernel/osf_sys.c12
-rw-r--r--arch/arm/Kconfig3
-rw-r--r--arch/arm/kernel/iwmmxt.S6
-rw-r--r--arch/arm/kernel/module.c4
-rw-r--r--arch/arm/mach-imx/clock-imx25.c3
-rw-r--r--arch/arm/mach-imx/mach-imx27_visstrim_m10.c13
-rw-r--r--arch/arm/mach-imx/mach-mx31ads.c4
-rw-r--r--arch/arm/mach-imx/mach-mx31lilly.c2
-rw-r--r--arch/arm/mach-mmp/gplugd.c22
-rw-r--r--arch/arm/mach-mmp/include/mach/mfp-gplugd.h52
-rw-r--r--arch/arm/mach-mmp/include/mach/mfp-pxa168.h37
-rw-r--r--arch/arm/mach-mmp/time.c62
-rw-r--r--arch/arm/mach-mx5/board-cpuimx51.c2
-rw-r--r--arch/arm/mach-mx5/board-mx51_babbage.c2
-rw-r--r--arch/arm/mach-mx5/board-mx51_efikamx.c6
-rw-r--r--arch/arm/mach-mx5/board-mx51_efikasb.c15
-rw-r--r--arch/arm/mach-mx5/clock-mx51-mx53.c6
-rw-r--r--arch/arm/mach-mx5/mx51_efika.c2
-rw-r--r--arch/arm/mach-omap2/Kconfig1
-rw-r--r--arch/arm/mach-omap2/board-am3517crane.c2
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c23
-rw-r--r--arch/arm/mach-omap2/cminst44xx.h25
-rw-r--r--arch/arm/mach-omap2/mux.c14
-rw-r--r--arch/arm/mach-omap2/smartreflex.c3
-rw-r--r--arch/arm/mach-omap2/timer.c3
-rw-r--r--arch/arm/mach-omap2/twl-common.c78
-rw-r--r--arch/arm/mach-s3c64xx/mach-crag6410.c18
-rw-r--r--arch/arm/mach-sa1100/pci-nanoengine.c1
-rw-r--r--arch/arm/mm/alignment.c56
-rw-r--r--arch/arm/mm/init.c2
-rw-r--r--arch/arm/mm/proc-arm946.S3
-rw-r--r--arch/arm/plat-mxc/include/mach/debug-macro.S8
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mx53.h31
-rw-r--r--arch/arm/plat-omap/Kconfig1
-rw-r--r--arch/arm/plat-omap/include/plat/dma.h5
-rw-r--r--arch/arm/plat-omap/include/plat/irqs.h1
-rw-r--r--arch/arm/plat-omap/include/plat/serial.h3
-rw-r--r--arch/arm/plat-omap/iovmm.c3
-rw-r--r--arch/arm/tools/mach-types2
-rw-r--r--arch/cris/include/asm/serial.h9
-rw-r--r--arch/ia64/Kconfig1
-rw-r--r--arch/ia64/configs/generic_defconfig1
-rw-r--r--arch/m68k/include/asm/page_mm.h2
-rw-r--r--arch/powerpc/include/asm/jump_label.h2
-rw-r--r--arch/powerpc/include/asm/kdump.h10
-rw-r--r--arch/powerpc/include/asm/reg.h8
-rw-r--r--arch/powerpc/kernel/cputable.c11
-rw-r--r--arch/powerpc/kernel/iomap.c2
-rw-r--r--arch/powerpc/kernel/machine_kexec.c10
-rw-r--r--arch/powerpc/kernel/perf_callchain.c20
-rw-r--r--arch/powerpc/kernel/prom_init.c14
-rw-r--r--arch/powerpc/kvm/book3s_hv_rmhandlers.S4
-rw-r--r--arch/powerpc/platforms/Kconfig2
-rw-r--r--arch/powerpc/platforms/pseries/dtl.c2
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-cpu.c4
-rw-r--r--arch/powerpc/platforms/pseries/io_event_irq.c8
-rw-r--r--arch/powerpc/platforms/pseries/kexec.c34
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c19
-rw-r--r--arch/powerpc/platforms/pseries/plpar_wrappers.h12
-rw-r--r--arch/powerpc/platforms/pseries/setup.c5
-rw-r--r--arch/powerpc/sysdev/fsl_rio.c5
-rw-r--r--arch/powerpc/sysdev/ppc4xx_pci.c5
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7757.c1
-rw-r--r--arch/sh/kernel/traps_32.c37
-rw-r--r--arch/sparc/Kconfig1
-rw-r--r--arch/sparc/include/asm/sigcontext.h14
-rw-r--r--arch/sparc/include/asm/spinlock_32.h11
-rw-r--r--arch/sparc/include/asm/spinlock_64.h6
-rw-r--r--arch/sparc/kernel/Makefile1
-rw-r--r--arch/sparc/kernel/ds.c13
-rw-r--r--arch/sparc/kernel/pcic.c4
-rw-r--r--arch/sparc/kernel/signal32.c184
-rw-r--r--arch/sparc/kernel/signal_32.c172
-rw-r--r--arch/sparc/kernel/signal_64.c108
-rw-r--r--arch/sparc/kernel/sigutil.h9
-rw-r--r--arch/sparc/kernel/sigutil_32.c120
-rw-r--r--arch/sparc/kernel/sigutil_64.c93
-rw-r--r--arch/x86/include/asm/desc.h4
-rw-r--r--arch/x86/include/asm/irq_vectors.h4
-rw-r--r--arch/x86/include/asm/paravirt_types.h6
-rw-r--r--arch/x86/include/asm/ptrace.h19
-rw-r--r--arch/x86/include/asm/traps.h2
-rw-r--r--arch/x86/include/asm/unistd_64.h2
-rw-r--r--arch/x86/include/asm/vsyscall.h6
-rw-r--r--arch/x86/include/asm/xen/page.h4
-rw-r--r--arch/x86/kernel/Makefile13
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c1
-rw-r--r--arch/x86/kernel/cpu/mtrr/main.c2
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel.c1
-rw-r--r--arch/x86/kernel/entry_32.S8
-rw-r--r--arch/x86/kernel/entry_64.S1
-rw-r--r--arch/x86/kernel/paravirt.c4
-rw-r--r--arch/x86/kernel/step.c2
-rw-r--r--arch/x86/kernel/traps.c6
-rw-r--r--arch/x86/kernel/vmlinux.lds.S41
-rw-r--r--arch/x86/kernel/vsyscall_64.c90
-rw-r--r--arch/x86/kernel/vsyscall_emu_64.S36
-rw-r--r--arch/x86/kernel/vsyscall_trace.h29
-rw-r--r--arch/x86/kvm/Kconfig3
-rw-r--r--arch/x86/mm/fault.c15
-rw-r--r--arch/x86/pci/acpi.c9
-rw-r--r--arch/x86/platform/olpc/olpc.c4
-rw-r--r--arch/x86/vdso/vdso.S1
-rw-r--r--arch/x86/vdso/vdso32/sysenter.S2
-rw-r--r--arch/x86/xen/Makefile2
-rw-r--r--arch/x86/xen/enlighten.c8
-rw-r--r--arch/x86/xen/mmu.c16
-rw-r--r--arch/x86/xen/smp.c4
110 files changed, 1164 insertions, 698 deletions
diff --git a/arch/alpha/include/asm/sysinfo.h b/arch/alpha/include/asm/sysinfo.h
index 086aba284df2..e77d77cd07b8 100644
--- a/arch/alpha/include/asm/sysinfo.h
+++ b/arch/alpha/include/asm/sysinfo.h
@@ -27,13 +27,4 @@
27#define UAC_NOFIX 2 27#define UAC_NOFIX 2
28#define UAC_SIGBUS 4 28#define UAC_SIGBUS 4
29 29
30
31#ifdef __KERNEL__
32
33/* This is the shift that is applied to the UAC bits as stored in the
34 per-thread flags. See thread_info.h. */
35#define UAC_SHIFT 6
36
37#endif
38
39#endif /* __ASM_ALPHA_SYSINFO_H */ 30#endif /* __ASM_ALPHA_SYSINFO_H */
diff --git a/arch/alpha/include/asm/thread_info.h b/arch/alpha/include/asm/thread_info.h
index 6f32f9c84a2d..ff73db022342 100644
--- a/arch/alpha/include/asm/thread_info.h
+++ b/arch/alpha/include/asm/thread_info.h
@@ -74,9 +74,9 @@ register struct thread_info *__current_thread_info __asm__("$8");
74#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 74#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
75#define TIF_POLLING_NRFLAG 8 /* poll_idle is polling NEED_RESCHED */ 75#define TIF_POLLING_NRFLAG 8 /* poll_idle is polling NEED_RESCHED */
76#define TIF_DIE_IF_KERNEL 9 /* dik recursion lock */ 76#define TIF_DIE_IF_KERNEL 9 /* dik recursion lock */
77#define TIF_UAC_NOPRINT 10 /* see sysinfo.h */ 77#define TIF_UAC_NOPRINT 10 /* ! Preserve sequence of following */
78#define TIF_UAC_NOFIX 11 78#define TIF_UAC_NOFIX 11 /* ! flags as they match */
79#define TIF_UAC_SIGBUS 12 79#define TIF_UAC_SIGBUS 12 /* ! userspace part of 'osf_sysinfo' */
80#define TIF_MEMDIE 13 /* is terminating due to OOM killer */ 80#define TIF_MEMDIE 13 /* is terminating due to OOM killer */
81#define TIF_RESTORE_SIGMASK 14 /* restore signal mask in do_signal */ 81#define TIF_RESTORE_SIGMASK 14 /* restore signal mask in do_signal */
82#define TIF_FREEZE 16 /* is freezing for suspend */ 82#define TIF_FREEZE 16 /* is freezing for suspend */
@@ -97,7 +97,7 @@ register struct thread_info *__current_thread_info __asm__("$8");
97#define _TIF_ALLWORK_MASK (_TIF_WORK_MASK \ 97#define _TIF_ALLWORK_MASK (_TIF_WORK_MASK \
98 | _TIF_SYSCALL_TRACE) 98 | _TIF_SYSCALL_TRACE)
99 99
100#define ALPHA_UAC_SHIFT 10 100#define ALPHA_UAC_SHIFT TIF_UAC_NOPRINT
101#define ALPHA_UAC_MASK (1 << TIF_UAC_NOPRINT | 1 << TIF_UAC_NOFIX | \ 101#define ALPHA_UAC_MASK (1 << TIF_UAC_NOPRINT | 1 << TIF_UAC_NOFIX | \
102 1 << TIF_UAC_SIGBUS) 102 1 << TIF_UAC_SIGBUS)
103 103
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 326f0a2d56e5..01e8715e26d9 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -42,6 +42,7 @@
42#include <asm/uaccess.h> 42#include <asm/uaccess.h>
43#include <asm/system.h> 43#include <asm/system.h>
44#include <asm/sysinfo.h> 44#include <asm/sysinfo.h>
45#include <asm/thread_info.h>
45#include <asm/hwrpb.h> 46#include <asm/hwrpb.h>
46#include <asm/processor.h> 47#include <asm/processor.h>
47 48
@@ -633,9 +634,10 @@ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer,
633 case GSI_UACPROC: 634 case GSI_UACPROC:
634 if (nbytes < sizeof(unsigned int)) 635 if (nbytes < sizeof(unsigned int))
635 return -EINVAL; 636 return -EINVAL;
636 w = (current_thread_info()->flags >> UAC_SHIFT) & UAC_BITMASK; 637 w = (current_thread_info()->flags >> ALPHA_UAC_SHIFT) &
637 if (put_user(w, (unsigned int __user *)buffer)) 638 UAC_BITMASK;
638 return -EFAULT; 639 if (put_user(w, (unsigned int __user *)buffer))
640 return -EFAULT;
639 return 1; 641 return 1;
640 642
641 case GSI_PROC_TYPE: 643 case GSI_PROC_TYPE:
@@ -756,8 +758,8 @@ SYSCALL_DEFINE5(osf_setsysinfo, unsigned long, op, void __user *, buffer,
756 case SSIN_UACPROC: 758 case SSIN_UACPROC:
757 again: 759 again:
758 old = current_thread_info()->flags; 760 old = current_thread_info()->flags;
759 new = old & ~(UAC_BITMASK << UAC_SHIFT); 761 new = old & ~(UAC_BITMASK << ALPHA_UAC_SHIFT);
760 new = new | (w & UAC_BITMASK) << UAC_SHIFT; 762 new = new | (w & UAC_BITMASK) << ALPHA_UAC_SHIFT;
761 if (cmpxchg(&current_thread_info()->flags, 763 if (cmpxchg(&current_thread_info()->flags,
762 old, new) != old) 764 old, new) != old)
763 goto again; 765 goto again;
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 2c71a8f3535a..5ebc5d922ea1 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -195,8 +195,7 @@ config VECTORS_BASE
195 The base address of exception vectors. 195 The base address of exception vectors.
196 196
197config ARM_PATCH_PHYS_VIRT 197config ARM_PATCH_PHYS_VIRT
198 bool "Patch physical to virtual translations at runtime (EXPERIMENTAL)" 198 bool "Patch physical to virtual translations at runtime"
199 depends on EXPERIMENTAL
200 depends on !XIP_KERNEL && MMU 199 depends on !XIP_KERNEL && MMU
201 depends on !ARCH_REALVIEW || !SPARSEMEM 200 depends on !ARCH_REALVIEW || !SPARSEMEM
202 help 201 help
diff --git a/arch/arm/kernel/iwmmxt.S b/arch/arm/kernel/iwmmxt.S
index 7fa3bb0d2397..a08783823b32 100644
--- a/arch/arm/kernel/iwmmxt.S
+++ b/arch/arm/kernel/iwmmxt.S
@@ -195,10 +195,10 @@ ENTRY(iwmmxt_task_disable)
195 195
196 @ enable access to CP0 and CP1 196 @ enable access to CP0 and CP1
197 XSC(mrc p15, 0, r4, c15, c1, 0) 197 XSC(mrc p15, 0, r4, c15, c1, 0)
198 XSC(orr r4, r4, #0xf) 198 XSC(orr r4, r4, #0x3)
199 XSC(mcr p15, 0, r4, c15, c1, 0) 199 XSC(mcr p15, 0, r4, c15, c1, 0)
200 PJ4(mrc p15, 0, r4, c1, c0, 2) 200 PJ4(mrc p15, 0, r4, c1, c0, 2)
201 PJ4(orr r4, r4, #0x3) 201 PJ4(orr r4, r4, #0xf)
202 PJ4(mcr p15, 0, r4, c1, c0, 2) 202 PJ4(mcr p15, 0, r4, c1, c0, 2)
203 203
204 mov r0, #0 @ nothing to load 204 mov r0, #0 @ nothing to load
@@ -313,7 +313,7 @@ ENTRY(iwmmxt_task_switch)
313 teq r2, r3 @ next task owns it? 313 teq r2, r3 @ next task owns it?
314 movne pc, lr @ no: leave Concan disabled 314 movne pc, lr @ no: leave Concan disabled
315 315
3161: @ flip Conan access 3161: @ flip Concan access
317 XSC(eor r1, r1, #0x3) 317 XSC(eor r1, r1, #0x3)
318 XSC(mcr p15, 0, r1, c15, c1, 0) 318 XSC(mcr p15, 0, r1, c15, c1, 0)
319 PJ4(eor r1, r1, #0xf) 319 PJ4(eor r1, r1, #0xf)
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index 05b377616fd5..cc2020c2c709 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -323,7 +323,11 @@ int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs,
323#endif 323#endif
324 s = find_mod_section(hdr, sechdrs, ".alt.smp.init"); 324 s = find_mod_section(hdr, sechdrs, ".alt.smp.init");
325 if (s && !is_smp()) 325 if (s && !is_smp())
326#ifdef CONFIG_SMP_ON_UP
326 fixup_smp((void *)s->sh_addr, s->sh_size); 327 fixup_smp((void *)s->sh_addr, s->sh_size);
328#else
329 return -EINVAL;
330#endif
327 return 0; 331 return 0;
328} 332}
329 333
diff --git a/arch/arm/mach-imx/clock-imx25.c b/arch/arm/mach-imx/clock-imx25.c
index 0fc7ba56d616..e63e23504fe5 100644
--- a/arch/arm/mach-imx/clock-imx25.c
+++ b/arch/arm/mach-imx/clock-imx25.c
@@ -331,6 +331,9 @@ int __init mx25_clocks_init(void)
331 __raw_writel(__raw_readl(CRM_BASE+0x64) | (1 << 7) | (1 << 0), 331 __raw_writel(__raw_readl(CRM_BASE+0x64) | (1 << 7) | (1 << 0),
332 CRM_BASE + 0x64); 332 CRM_BASE + 0x64);
333 333
334 /* Clock source for gpt is ahb_div */
335 __raw_writel(__raw_readl(CRM_BASE+0x64) & ~(1 << 5), CRM_BASE + 0x64);
336
334 mxc_timer_init(&gpt_clk, MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54); 337 mxc_timer_init(&gpt_clk, MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54);
335 338
336 return 0; 339 return 0;
diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
index 6707de0ab716..6778f8193bc6 100644
--- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
+++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
@@ -30,6 +30,7 @@
30#include <linux/input.h> 30#include <linux/input.h>
31#include <linux/gpio.h> 31#include <linux/gpio.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <sound/tlv320aic32x4.h>
33#include <asm/mach-types.h> 34#include <asm/mach-types.h>
34#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
35#include <asm/mach/time.h> 36#include <asm/mach/time.h>
@@ -196,6 +197,17 @@ static struct pca953x_platform_data visstrim_m10_pca9555_pdata = {
196 .invert = 0, 197 .invert = 0,
197}; 198};
198 199
200static struct aic32x4_pdata visstrim_m10_aic32x4_pdata = {
201 .power_cfg = AIC32X4_PWR_MICBIAS_2075_LDOIN |
202 AIC32X4_PWR_AVDD_DVDD_WEAK_DISABLE |
203 AIC32X4_PWR_AIC32X4_LDO_ENABLE |
204 AIC32X4_PWR_CMMODE_LDOIN_RANGE_18_36 |
205 AIC32X4_PWR_CMMODE_HP_LDOIN_POWERED,
206 .micpga_routing = AIC32X4_MICPGA_ROUTE_LMIC_IN2R_10K |
207 AIC32X4_MICPGA_ROUTE_RMIC_IN1L_10K,
208 .swapdacs = false,
209};
210
199static struct i2c_board_info visstrim_m10_i2c_devices[] = { 211static struct i2c_board_info visstrim_m10_i2c_devices[] = {
200 { 212 {
201 I2C_BOARD_INFO("pca9555", 0x20), 213 I2C_BOARD_INFO("pca9555", 0x20),
@@ -203,6 +215,7 @@ static struct i2c_board_info visstrim_m10_i2c_devices[] = {
203 }, 215 },
204 { 216 {
205 I2C_BOARD_INFO("tlv320aic32x4", 0x18), 217 I2C_BOARD_INFO("tlv320aic32x4", 0x18),
218 .platform_data = &visstrim_m10_aic32x4_pdata,
206 } 219 }
207}; 220};
208 221
diff --git a/arch/arm/mach-imx/mach-mx31ads.c b/arch/arm/mach-imx/mach-mx31ads.c
index 0ce49478a479..29ca8907a780 100644
--- a/arch/arm/mach-imx/mach-mx31ads.c
+++ b/arch/arm/mach-imx/mach-mx31ads.c
@@ -468,7 +468,7 @@ static struct i2c_board_info __initdata mx31ads_i2c1_devices[] = {
468#endif 468#endif
469}; 469};
470 470
471static void mxc_init_i2c(void) 471static void __init mxc_init_i2c(void)
472{ 472{
473 i2c_register_board_info(1, mx31ads_i2c1_devices, 473 i2c_register_board_info(1, mx31ads_i2c1_devices,
474 ARRAY_SIZE(mx31ads_i2c1_devices)); 474 ARRAY_SIZE(mx31ads_i2c1_devices));
@@ -486,7 +486,7 @@ static unsigned int ssi_pins[] = {
486 MX31_PIN_STXD5__STXD5, 486 MX31_PIN_STXD5__STXD5,
487}; 487};
488 488
489static void mxc_init_audio(void) 489static void __init mxc_init_audio(void)
490{ 490{
491 imx31_add_imx_ssi(0, NULL); 491 imx31_add_imx_ssi(0, NULL);
492 mxc_iomux_setup_multiple_pins(ssi_pins, ARRAY_SIZE(ssi_pins), "ssi"); 492 mxc_iomux_setup_multiple_pins(ssi_pins, ARRAY_SIZE(ssi_pins), "ssi");
diff --git a/arch/arm/mach-imx/mach-mx31lilly.c b/arch/arm/mach-imx/mach-mx31lilly.c
index 750368ddf0f9..126913ad106a 100644
--- a/arch/arm/mach-imx/mach-mx31lilly.c
+++ b/arch/arm/mach-imx/mach-mx31lilly.c
@@ -192,7 +192,7 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
192 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT, 192 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
193}; 193};
194 194
195static void lilly1131_usb_init(void) 195static void __init lilly1131_usb_init(void)
196{ 196{
197 imx31_add_mxc_ehci_hs(1, &usbh1_pdata); 197 imx31_add_mxc_ehci_hs(1, &usbh1_pdata);
198 198
diff --git a/arch/arm/mach-mmp/gplugd.c b/arch/arm/mach-mmp/gplugd.c
index c070c24255f4..98e25d9aaab6 100644
--- a/arch/arm/mach-mmp/gplugd.c
+++ b/arch/arm/mach-mmp/gplugd.c
@@ -16,16 +16,18 @@
16#include <mach/gpio.h> 16#include <mach/gpio.h>
17#include <mach/pxa168.h> 17#include <mach/pxa168.h>
18#include <mach/mfp-pxa168.h> 18#include <mach/mfp-pxa168.h>
19#include <mach/mfp-gplugd.h>
20 19
21#include "common.h" 20#include "common.h"
22 21
23static unsigned long gplugd_pin_config[] __initdata = { 22static unsigned long gplugd_pin_config[] __initdata = {
24 /* UART3 */ 23 /* UART3 */
25 GPIO8_UART3_SOUT, 24 GPIO8_UART3_TXD,
26 GPIO9_UART3_SIN, 25 GPIO9_UART3_RXD,
27 GPI1O_UART3_CTS, 26 GPIO1O_UART3_CTS,
28 GPI11_UART3_RTS, 27 GPIO11_UART3_RTS,
28
29 /* USB OTG PEN */
30 GPIO18_GPIO,
29 31
30 /* MMC2 */ 32 /* MMC2 */
31 GPIO28_MMC2_CMD, 33 GPIO28_MMC2_CMD,
@@ -109,6 +111,12 @@ static unsigned long gplugd_pin_config[] __initdata = {
109 GPIO105_CI2C_SDA, 111 GPIO105_CI2C_SDA,
110 GPIO106_CI2C_SCL, 112 GPIO106_CI2C_SCL,
111 113
114 /* SPI NOR Flash on SSP2 */
115 GPIO107_SSP2_RXD,
116 GPIO108_SSP2_TXD,
117 GPIO110_GPIO, /* SPI_CSn */
118 GPIO111_SSP2_CLK,
119
112 /* Select JTAG */ 120 /* Select JTAG */
113 GPIO109_GPIO, 121 GPIO109_GPIO,
114 122
@@ -154,7 +162,7 @@ static void __init select_disp_freq(void)
154 "frequency\n"); 162 "frequency\n");
155 } else { 163 } else {
156 gpio_direction_output(35, 1); 164 gpio_direction_output(35, 1);
157 gpio_free(104); 165 gpio_free(35);
158 } 166 }
159 167
160 if (unlikely(gpio_request(85, "DISP_FREQ_SEL_2"))) { 168 if (unlikely(gpio_request(85, "DISP_FREQ_SEL_2"))) {
@@ -162,7 +170,7 @@ static void __init select_disp_freq(void)
162 "frequency\n"); 170 "frequency\n");
163 } else { 171 } else {
164 gpio_direction_output(85, 0); 172 gpio_direction_output(85, 0);
165 gpio_free(104); 173 gpio_free(85);
166 } 174 }
167} 175}
168 176
diff --git a/arch/arm/mach-mmp/include/mach/mfp-gplugd.h b/arch/arm/mach-mmp/include/mach/mfp-gplugd.h
deleted file mode 100644
index b8cf38d85600..000000000000
--- a/arch/arm/mach-mmp/include/mach/mfp-gplugd.h
+++ /dev/null
@@ -1,52 +0,0 @@
1/*
2 * linux/arch/arm/mach-mmp/include/mach/mfp-gplugd.h
3 *
4 * MFP definitions used in gplugD
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __MACH_MFP_GPLUGD_H
12#define __MACH_MFP_GPLUGD_H
13
14#include <plat/mfp.h>
15#include <mach/mfp.h>
16
17/* UART3 */
18#define GPIO8_UART3_SOUT MFP_CFG(GPIO8, AF2)
19#define GPIO9_UART3_SIN MFP_CFG(GPIO9, AF2)
20#define GPI1O_UART3_CTS MFP_CFG(GPIO10, AF2)
21#define GPI11_UART3_RTS MFP_CFG(GPIO11, AF2)
22
23/* MMC2 */
24#define GPIO28_MMC2_CMD MFP_CFG_DRV(GPIO28, AF6, FAST)
25#define GPIO29_MMC2_CLK MFP_CFG_DRV(GPIO29, AF6, FAST)
26#define GPIO30_MMC2_DAT0 MFP_CFG_DRV(GPIO30, AF6, FAST)
27#define GPIO31_MMC2_DAT1 MFP_CFG_DRV(GPIO31, AF6, FAST)
28#define GPIO32_MMC2_DAT2 MFP_CFG_DRV(GPIO32, AF6, FAST)
29#define GPIO33_MMC2_DAT3 MFP_CFG_DRV(GPIO33, AF6, FAST)
30
31/* I2S */
32#undef GPIO114_I2S_FRM
33#undef GPIO115_I2S_BCLK
34
35#define GPIO114_I2S_FRM MFP_CFG_DRV(GPIO114, AF1, FAST)
36#define GPIO115_I2S_BCLK MFP_CFG_DRV(GPIO115, AF1, FAST)
37#define GPIO116_I2S_TXD MFP_CFG_DRV(GPIO116, AF1, FAST)
38
39/* MMC4 */
40#define GPIO125_MMC4_DAT3 MFP_CFG_DRV(GPIO125, AF7, FAST)
41#define GPIO126_MMC4_DAT2 MFP_CFG_DRV(GPIO126, AF7, FAST)
42#define GPIO127_MMC4_DAT1 MFP_CFG_DRV(GPIO127, AF7, FAST)
43#define GPIO0_2_MMC4_DAT0 MFP_CFG_DRV(GPIO0_2, AF7, FAST)
44#define GPIO1_2_MMC4_CMD MFP_CFG_DRV(GPIO1_2, AF7, FAST)
45#define GPIO2_2_MMC4_CLK MFP_CFG_DRV(GPIO2_2, AF7, FAST)
46
47/* OTG GPIO */
48#define GPIO_USB_OTG_PEN 18
49#define GPIO_USB_OIDIR 20
50
51/* Other GPIOs are 35, 84, 85 */
52#endif /* __MACH_MFP_GPLUGD_H */
diff --git a/arch/arm/mach-mmp/include/mach/mfp-pxa168.h b/arch/arm/mach-mmp/include/mach/mfp-pxa168.h
index 8c782328b21c..92aaa3c19d61 100644
--- a/arch/arm/mach-mmp/include/mach/mfp-pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/mfp-pxa168.h
@@ -203,6 +203,10 @@
203#define GPIO33_CF_nCD2 MFP_CFG(GPIO33, AF3) 203#define GPIO33_CF_nCD2 MFP_CFG(GPIO33, AF3)
204 204
205/* UART */ 205/* UART */
206#define GPIO8_UART3_TXD MFP_CFG(GPIO8, AF2)
207#define GPIO9_UART3_RXD MFP_CFG(GPIO9, AF2)
208#define GPIO1O_UART3_CTS MFP_CFG(GPIO10, AF2)
209#define GPIO11_UART3_RTS MFP_CFG(GPIO11, AF2)
206#define GPIO88_UART2_TXD MFP_CFG(GPIO88, AF2) 210#define GPIO88_UART2_TXD MFP_CFG(GPIO88, AF2)
207#define GPIO89_UART2_RXD MFP_CFG(GPIO89, AF2) 211#define GPIO89_UART2_RXD MFP_CFG(GPIO89, AF2)
208#define GPIO107_UART1_TXD MFP_CFG_DRV(GPIO107, AF1, FAST) 212#define GPIO107_UART1_TXD MFP_CFG_DRV(GPIO107, AF1, FAST)
@@ -232,6 +236,22 @@
232#define GPIO53_MMC1_CD MFP_CFG(GPIO53, AF1) 236#define GPIO53_MMC1_CD MFP_CFG(GPIO53, AF1)
233#define GPIO46_MMC1_WP MFP_CFG(GPIO46, AF1) 237#define GPIO46_MMC1_WP MFP_CFG(GPIO46, AF1)
234 238
239/* MMC2 */
240#define GPIO28_MMC2_CMD MFP_CFG_DRV(GPIO28, AF6, FAST)
241#define GPIO29_MMC2_CLK MFP_CFG_DRV(GPIO29, AF6, FAST)
242#define GPIO30_MMC2_DAT0 MFP_CFG_DRV(GPIO30, AF6, FAST)
243#define GPIO31_MMC2_DAT1 MFP_CFG_DRV(GPIO31, AF6, FAST)
244#define GPIO32_MMC2_DAT2 MFP_CFG_DRV(GPIO32, AF6, FAST)
245#define GPIO33_MMC2_DAT3 MFP_CFG_DRV(GPIO33, AF6, FAST)
246
247/* MMC4 */
248#define GPIO125_MMC4_DAT3 MFP_CFG_DRV(GPIO125, AF7, FAST)
249#define GPIO126_MMC4_DAT2 MFP_CFG_DRV(GPIO126, AF7, FAST)
250#define GPIO127_MMC4_DAT1 MFP_CFG_DRV(GPIO127, AF7, FAST)
251#define GPIO0_2_MMC4_DAT0 MFP_CFG_DRV(GPIO0_2, AF7, FAST)
252#define GPIO1_2_MMC4_CMD MFP_CFG_DRV(GPIO1_2, AF7, FAST)
253#define GPIO2_2_MMC4_CLK MFP_CFG_DRV(GPIO2_2, AF7, FAST)
254
235/* LCD */ 255/* LCD */
236#define GPIO84_LCD_CS MFP_CFG(GPIO84, AF1) 256#define GPIO84_LCD_CS MFP_CFG(GPIO84, AF1)
237#define GPIO60_LCD_DD0 MFP_CFG(GPIO60, AF1) 257#define GPIO60_LCD_DD0 MFP_CFG(GPIO60, AF1)
@@ -269,11 +289,12 @@
269#define GPIO106_CI2C_SCL MFP_CFG(GPIO106, AF1) 289#define GPIO106_CI2C_SCL MFP_CFG(GPIO106, AF1)
270 290
271/* I2S */ 291/* I2S */
272#define GPIO113_I2S_MCLK MFP_CFG(GPIO113,AF6) 292#define GPIO113_I2S_MCLK MFP_CFG(GPIO113, AF6)
273#define GPIO114_I2S_FRM MFP_CFG(GPIO114,AF1) 293#define GPIO114_I2S_FRM MFP_CFG(GPIO114, AF1)
274#define GPIO115_I2S_BCLK MFP_CFG(GPIO115,AF1) 294#define GPIO115_I2S_BCLK MFP_CFG(GPIO115, AF1)
275#define GPIO116_I2S_RXD MFP_CFG(GPIO116,AF2) 295#define GPIO116_I2S_RXD MFP_CFG(GPIO116, AF2)
276#define GPIO117_I2S_TXD MFP_CFG(GPIO117,AF2) 296#define GPIO116_I2S_TXD MFP_CFG(GPIO116, AF1)
297#define GPIO117_I2S_TXD MFP_CFG(GPIO117, AF2)
277 298
278/* PWM */ 299/* PWM */
279#define GPIO96_PWM3_OUT MFP_CFG(GPIO96, AF1) 300#define GPIO96_PWM3_OUT MFP_CFG(GPIO96, AF1)
@@ -324,4 +345,10 @@
324#define GPIO101_MII_MDIO MFP_CFG(GPIO101, AF5) 345#define GPIO101_MII_MDIO MFP_CFG(GPIO101, AF5)
325#define GPIO103_RX_DV MFP_CFG(GPIO103, AF5) 346#define GPIO103_RX_DV MFP_CFG(GPIO103, AF5)
326 347
348/* SSP2 */
349#define GPIO107_SSP2_RXD MFP_CFG(GPIO107, AF4)
350#define GPIO108_SSP2_TXD MFP_CFG(GPIO108, AF4)
351#define GPIO111_SSP2_CLK MFP_CFG(GPIO111, AF4)
352#define GPIO112_SSP2_FRM MFP_CFG(GPIO112, AF4)
353
327#endif /* __ASM_MACH_MFP_PXA168_H */ 354#endif /* __ASM_MACH_MFP_PXA168_H */
diff --git a/arch/arm/mach-mmp/time.c b/arch/arm/mach-mmp/time.c
index 99833b9485cf..4e91ee6e27c8 100644
--- a/arch/arm/mach-mmp/time.c
+++ b/arch/arm/mach-mmp/time.c
@@ -51,12 +51,12 @@ static inline uint32_t timer_read(void)
51{ 51{
52 int delay = 100; 52 int delay = 100;
53 53
54 __raw_writel(1, TIMERS_VIRT_BASE + TMR_CVWR(0)); 54 __raw_writel(1, TIMERS_VIRT_BASE + TMR_CVWR(1));
55 55
56 while (delay--) 56 while (delay--)
57 cpu_relax(); 57 cpu_relax();
58 58
59 return __raw_readl(TIMERS_VIRT_BASE + TMR_CVWR(0)); 59 return __raw_readl(TIMERS_VIRT_BASE + TMR_CVWR(1));
60} 60}
61 61
62unsigned long long notrace sched_clock(void) 62unsigned long long notrace sched_clock(void)
@@ -75,28 +75,51 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
75{ 75{
76 struct clock_event_device *c = dev_id; 76 struct clock_event_device *c = dev_id;
77 77
78 /* disable and clear pending interrupt status */ 78 /*
79 __raw_writel(0x0, TIMERS_VIRT_BASE + TMR_IER(0)); 79 * Clear pending interrupt status.
80 __raw_writel(0x1, TIMERS_VIRT_BASE + TMR_ICR(0)); 80 */
81 __raw_writel(0x01, TIMERS_VIRT_BASE + TMR_ICR(0));
82
83 /*
84 * Disable timer 0.
85 */
86 __raw_writel(0x02, TIMERS_VIRT_BASE + TMR_CER);
87
81 c->event_handler(c); 88 c->event_handler(c);
89
82 return IRQ_HANDLED; 90 return IRQ_HANDLED;
83} 91}
84 92
85static int timer_set_next_event(unsigned long delta, 93static int timer_set_next_event(unsigned long delta,
86 struct clock_event_device *dev) 94 struct clock_event_device *dev)
87{ 95{
88 unsigned long flags, next; 96 unsigned long flags;
89 97
90 local_irq_save(flags); 98 local_irq_save(flags);
91 99
92 /* clear pending interrupt status and enable */ 100 /*
101 * Disable timer 0.
102 */
103 __raw_writel(0x02, TIMERS_VIRT_BASE + TMR_CER);
104
105 /*
106 * Clear and enable timer match 0 interrupt.
107 */
93 __raw_writel(0x01, TIMERS_VIRT_BASE + TMR_ICR(0)); 108 __raw_writel(0x01, TIMERS_VIRT_BASE + TMR_ICR(0));
94 __raw_writel(0x01, TIMERS_VIRT_BASE + TMR_IER(0)); 109 __raw_writel(0x01, TIMERS_VIRT_BASE + TMR_IER(0));
95 110
96 next = timer_read() + delta; 111 /*
97 __raw_writel(next, TIMERS_VIRT_BASE + TMR_TN_MM(0, 0)); 112 * Setup new clockevent timer value.
113 */
114 __raw_writel(delta - 1, TIMERS_VIRT_BASE + TMR_TN_MM(0, 0));
115
116 /*
117 * Enable timer 0.
118 */
119 __raw_writel(0x03, TIMERS_VIRT_BASE + TMR_CER);
98 120
99 local_irq_restore(flags); 121 local_irq_restore(flags);
122
100 return 0; 123 return 0;
101} 124}
102 125
@@ -145,23 +168,26 @@ static struct clocksource cksrc = {
145static void __init timer_config(void) 168static void __init timer_config(void)
146{ 169{
147 uint32_t ccr = __raw_readl(TIMERS_VIRT_BASE + TMR_CCR); 170 uint32_t ccr = __raw_readl(TIMERS_VIRT_BASE + TMR_CCR);
148 uint32_t cer = __raw_readl(TIMERS_VIRT_BASE + TMR_CER);
149 uint32_t cmr = __raw_readl(TIMERS_VIRT_BASE + TMR_CMR);
150 171
151 __raw_writel(cer & ~0x1, TIMERS_VIRT_BASE + TMR_CER); /* disable */ 172 __raw_writel(0x0, TIMERS_VIRT_BASE + TMR_CER); /* disable */
152 173
153 ccr &= (cpu_is_mmp2()) ? TMR_CCR_CS_0(0) : TMR_CCR_CS_0(3); 174 ccr &= (cpu_is_mmp2()) ? (TMR_CCR_CS_0(0) | TMR_CCR_CS_1(0)) :
175 (TMR_CCR_CS_0(3) | TMR_CCR_CS_1(3));
154 __raw_writel(ccr, TIMERS_VIRT_BASE + TMR_CCR); 176 __raw_writel(ccr, TIMERS_VIRT_BASE + TMR_CCR);
155 177
156 /* free-running mode */ 178 /* set timer 0 to periodic mode, and timer 1 to free-running mode */
157 __raw_writel(cmr | 0x01, TIMERS_VIRT_BASE + TMR_CMR); 179 __raw_writel(0x2, TIMERS_VIRT_BASE + TMR_CMR);
158 180
159 __raw_writel(0x0, TIMERS_VIRT_BASE + TMR_PLCR(0)); /* free-running */ 181 __raw_writel(0x1, TIMERS_VIRT_BASE + TMR_PLCR(0)); /* periodic */
160 __raw_writel(0x7, TIMERS_VIRT_BASE + TMR_ICR(0)); /* clear status */ 182 __raw_writel(0x7, TIMERS_VIRT_BASE + TMR_ICR(0)); /* clear status */
161 __raw_writel(0x0, TIMERS_VIRT_BASE + TMR_IER(0)); 183 __raw_writel(0x0, TIMERS_VIRT_BASE + TMR_IER(0));
162 184
163 /* enable timer counter */ 185 __raw_writel(0x0, TIMERS_VIRT_BASE + TMR_PLCR(1)); /* free-running */
164 __raw_writel(cer | 0x01, TIMERS_VIRT_BASE + TMR_CER); 186 __raw_writel(0x7, TIMERS_VIRT_BASE + TMR_ICR(1)); /* clear status */
187 __raw_writel(0x0, TIMERS_VIRT_BASE + TMR_IER(1));
188
189 /* enable timer 1 counter */
190 __raw_writel(0x2, TIMERS_VIRT_BASE + TMR_CER);
165} 191}
166 192
167static struct irqaction timer_irq = { 193static struct irqaction timer_irq = {
diff --git a/arch/arm/mach-mx5/board-cpuimx51.c b/arch/arm/mach-mx5/board-cpuimx51.c
index 7c893fa70266..68934ea8725a 100644
--- a/arch/arm/mach-mx5/board-cpuimx51.c
+++ b/arch/arm/mach-mx5/board-cpuimx51.c
@@ -81,7 +81,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
81 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP, 81 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
82 }, { 82 }, {
83 .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x2000000), 83 .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x2000000),
84 .irq = irq_to_gpio(CPUIMX51_QUARTD_GPIO), 84 .irq = gpio_to_irq(CPUIMX51_QUARTD_GPIO),
85 .irqflags = IRQF_TRIGGER_HIGH, 85 .irqflags = IRQF_TRIGGER_HIGH,
86 .uartclk = CPUIMX51_QUART_XTAL, 86 .uartclk = CPUIMX51_QUART_XTAL,
87 .regshift = CPUIMX51_QUART_REGSHIFT, 87 .regshift = CPUIMX51_QUART_REGSHIFT,
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index e400b09109ce..11b0ff67f89d 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -369,7 +369,7 @@ static void __init mx51_babbage_init(void)
369 ARRAY_SIZE(mx51babbage_pads)); 369 ARRAY_SIZE(mx51babbage_pads));
370 370
371 imx51_add_imx_uart(0, &uart_pdata); 371 imx51_add_imx_uart(0, &uart_pdata);
372 imx51_add_imx_uart(1, &uart_pdata); 372 imx51_add_imx_uart(1, NULL);
373 imx51_add_imx_uart(2, &uart_pdata); 373 imx51_add_imx_uart(2, &uart_pdata);
374 374
375 babbage_fec_reset(); 375 babbage_fec_reset();
diff --git a/arch/arm/mach-mx5/board-mx51_efikamx.c b/arch/arm/mach-mx5/board-mx51_efikamx.c
index f70700dc0ec1..551daf85ff8c 100644
--- a/arch/arm/mach-mx5/board-mx51_efikamx.c
+++ b/arch/arm/mach-mx5/board-mx51_efikamx.c
@@ -108,9 +108,9 @@ static void __init mx51_efikamx_board_id(void)
108 gpio_request(EFIKAMX_PCBID2, "pcbid2"); 108 gpio_request(EFIKAMX_PCBID2, "pcbid2");
109 gpio_direction_input(EFIKAMX_PCBID2); 109 gpio_direction_input(EFIKAMX_PCBID2);
110 110
111 id = gpio_get_value(EFIKAMX_PCBID0); 111 id = gpio_get_value(EFIKAMX_PCBID0) ? 1 : 0;
112 id |= gpio_get_value(EFIKAMX_PCBID1) << 1; 112 id |= (gpio_get_value(EFIKAMX_PCBID1) ? 1 : 0) << 1;
113 id |= gpio_get_value(EFIKAMX_PCBID2) << 2; 113 id |= (gpio_get_value(EFIKAMX_PCBID2) ? 1 : 0) << 2;
114 114
115 switch (id) { 115 switch (id) {
116 case 7: 116 case 7:
diff --git a/arch/arm/mach-mx5/board-mx51_efikasb.c b/arch/arm/mach-mx5/board-mx51_efikasb.c
index 2e4d9d32a87c..8a9bca22beb5 100644
--- a/arch/arm/mach-mx5/board-mx51_efikasb.c
+++ b/arch/arm/mach-mx5/board-mx51_efikasb.c
@@ -156,23 +156,24 @@ static struct gpio_keys_button mx51_efikasb_keys[] = {
156 { 156 {
157 .code = KEY_POWER, 157 .code = KEY_POWER,
158 .gpio = EFIKASB_PWRKEY, 158 .gpio = EFIKASB_PWRKEY,
159 .type = EV_PWR, 159 .type = EV_KEY,
160 .desc = "Power Button", 160 .desc = "Power Button",
161 .wakeup = 1, 161 .wakeup = 1,
162 .debounce_interval = 10, /* ms */ 162 .active_low = 1,
163 }, 163 },
164 { 164 {
165 .code = SW_LID, 165 .code = SW_LID,
166 .gpio = EFIKASB_LID, 166 .gpio = EFIKASB_LID,
167 .type = EV_SW, 167 .type = EV_SW,
168 .desc = "Lid Switch", 168 .desc = "Lid Switch",
169 .active_low = 1,
169 }, 170 },
170 { 171 {
171 /* SW_RFKILLALL vs KEY_RFKILL ? */ 172 .code = KEY_RFKILL,
172 .code = SW_RFKILL_ALL,
173 .gpio = EFIKASB_RFKILL, 173 .gpio = EFIKASB_RFKILL,
174 .type = EV_SW, 174 .type = EV_KEY,
175 .desc = "rfkill", 175 .desc = "rfkill",
176 .active_low = 1,
176 }, 177 },
177}; 178};
178 179
@@ -224,8 +225,8 @@ static void __init mx51_efikasb_board_id(void)
224 gpio_request(EFIKASB_PCBID1, "pcb id1"); 225 gpio_request(EFIKASB_PCBID1, "pcb id1");
225 gpio_direction_input(EFIKASB_PCBID1); 226 gpio_direction_input(EFIKASB_PCBID1);
226 227
227 id = gpio_get_value(EFIKASB_PCBID0); 228 id = gpio_get_value(EFIKASB_PCBID0) ? 1 : 0;
228 id |= gpio_get_value(EFIKASB_PCBID1) << 1; 229 id |= (gpio_get_value(EFIKASB_PCBID1) ? 1 : 0) << 1;
229 230
230 switch (id) { 231 switch (id) {
231 default: 232 default:
diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
index 7f20308c4dbd..f7bf996f463b 100644
--- a/arch/arm/mach-mx5/clock-mx51-mx53.c
+++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
@@ -271,7 +271,11 @@ static int _clk_pll_enable(struct clk *clk)
271 int i = 0; 271 int i = 0;
272 272
273 pllbase = _get_pll_base(clk); 273 pllbase = _get_pll_base(clk);
274 reg = __raw_readl(pllbase + MXC_PLL_DP_CTL) | MXC_PLL_DP_CTL_UPEN; 274 reg = __raw_readl(pllbase + MXC_PLL_DP_CTL);
275 if (reg & MXC_PLL_DP_CTL_UPEN)
276 return 0;
277
278 reg |= MXC_PLL_DP_CTL_UPEN;
275 __raw_writel(reg, pllbase + MXC_PLL_DP_CTL); 279 __raw_writel(reg, pllbase + MXC_PLL_DP_CTL);
276 280
277 /* Wait for lock */ 281 /* Wait for lock */
diff --git a/arch/arm/mach-mx5/mx51_efika.c b/arch/arm/mach-mx5/mx51_efika.c
index 4435e03cea5d..c9209454807a 100644
--- a/arch/arm/mach-mx5/mx51_efika.c
+++ b/arch/arm/mach-mx5/mx51_efika.c
@@ -186,7 +186,7 @@ static int initialize_usbh1_port(struct platform_device *pdev)
186 186
187 mdelay(10); 187 mdelay(10);
188 188
189 return mx51_initialize_usb_hw(0, MXC_EHCI_ITC_NO_THRESHOLD); 189 return mx51_initialize_usb_hw(pdev->id, MXC_EHCI_ITC_NO_THRESHOLD);
190} 190}
191 191
192static struct mxc_usbh_platform_data usbh1_config = { 192static struct mxc_usbh_platform_data usbh1_config = {
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 4ae6257b39a4..57b66d590c52 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -7,7 +7,6 @@ config ARCH_OMAP2PLUS_TYPICAL
7 default y 7 default y
8 select AEABI 8 select AEABI
9 select REGULATOR 9 select REGULATOR
10 select PM
11 select PM_RUNTIME 10 select PM_RUNTIME
12 select VFP 11 select VFP
13 select NEON if ARCH_OMAP3 || ARCH_OMAP4 12 select NEON if ARCH_OMAP3 || ARCH_OMAP4
diff --git a/arch/arm/mach-omap2/board-am3517crane.c b/arch/arm/mach-omap2/board-am3517crane.c
index 5f2b55ff04ff..933e9353cb37 100644
--- a/arch/arm/mach-omap2/board-am3517crane.c
+++ b/arch/arm/mach-omap2/board-am3517crane.c
@@ -45,8 +45,6 @@ static struct omap_board_config_kernel am3517_crane_config[] __initdata = {
45static struct omap_board_mux board_mux[] __initdata = { 45static struct omap_board_mux board_mux[] __initdata = {
46 { .reg_offset = OMAP_MUX_TERMINATOR }, 46 { .reg_offset = OMAP_MUX_TERMINATOR },
47}; 47};
48#else
49#define board_mux NULL
50#endif 48#endif
51 49
52static void __init am3517_crane_init_early(void) 50static void __init am3517_crane_init_early(void)
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 32f5f895568a..3ae16b4e3f52 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -491,23 +491,22 @@ static void __init beagle_opp_init(void)
491 491
492 /* Custom OPP enabled for all xM versions */ 492 /* Custom OPP enabled for all xM versions */
493 if (cpu_is_omap3630()) { 493 if (cpu_is_omap3630()) {
494 struct omap_hwmod *mh = omap_hwmod_lookup("mpu"); 494 struct device *mpu_dev, *iva_dev;
495 struct omap_hwmod *dh = omap_hwmod_lookup("iva");
496 struct device *dev;
497 495
498 if (!mh || !dh) { 496 mpu_dev = omap2_get_mpuss_device();
497 iva_dev = omap2_get_iva_device();
498
499 if (!mpu_dev || !iva_dev) {
499 pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n", 500 pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n",
500 __func__, mh, dh); 501 __func__, mpu_dev, iva_dev);
501 return; 502 return;
502 } 503 }
503 /* Enable MPU 1GHz and lower opps */ 504 /* Enable MPU 1GHz and lower opps */
504 dev = &mh->od->pdev.dev; 505 r = opp_enable(mpu_dev, 800000000);
505 r = opp_enable(dev, 800000000);
506 /* TODO: MPU 1GHz needs SR and ABB */ 506 /* TODO: MPU 1GHz needs SR and ABB */
507 507
508 /* Enable IVA 800MHz and lower opps */ 508 /* Enable IVA 800MHz and lower opps */
509 dev = &dh->od->pdev.dev; 509 r |= opp_enable(iva_dev, 660000000);
510 r |= opp_enable(dev, 660000000);
511 /* TODO: DSP 800MHz needs SR and ABB */ 510 /* TODO: DSP 800MHz needs SR and ABB */
512 if (r) { 511 if (r) {
513 pr_err("%s: failed to enable higher opp %d\n", 512 pr_err("%s: failed to enable higher opp %d\n",
@@ -516,10 +515,8 @@ static void __init beagle_opp_init(void)
516 * Cleanup - disable the higher freqs - we dont care 515 * Cleanup - disable the higher freqs - we dont care
517 * about the results 516 * about the results
518 */ 517 */
519 dev = &mh->od->pdev.dev; 518 opp_disable(mpu_dev, 800000000);
520 opp_disable(dev, 800000000); 519 opp_disable(iva_dev, 660000000);
521 dev = &dh->od->pdev.dev;
522 opp_disable(dev, 660000000);
523 } 520 }
524 } 521 }
525 return; 522 return;
diff --git a/arch/arm/mach-omap2/cminst44xx.h b/arch/arm/mach-omap2/cminst44xx.h
index f2ea6453ade0..a018a7327879 100644
--- a/arch/arm/mach-omap2/cminst44xx.h
+++ b/arch/arm/mach-omap2/cminst44xx.h
@@ -18,13 +18,36 @@ extern void omap4_cminst_clkdm_force_sleep(u8 part, s16 inst, u16 cdoffs);
18extern void omap4_cminst_clkdm_force_wakeup(u8 part, s16 inst, u16 cdoffs); 18extern void omap4_cminst_clkdm_force_wakeup(u8 part, s16 inst, u16 cdoffs);
19 19
20extern int omap4_cminst_wait_module_ready(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs); 20extern int omap4_cminst_wait_module_ready(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs);
21extern int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs, u16 clkctrl_offs); 21
22# ifdef CONFIG_ARCH_OMAP4
23extern int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs,
24 u16 clkctrl_offs);
22 25
23extern void omap4_cminst_module_enable(u8 mode, u8 part, u16 inst, s16 cdoffs, 26extern void omap4_cminst_module_enable(u8 mode, u8 part, u16 inst, s16 cdoffs,
24 u16 clkctrl_offs); 27 u16 clkctrl_offs);
25extern void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs, 28extern void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
26 u16 clkctrl_offs); 29 u16 clkctrl_offs);
27 30
31# else
32
33static inline int omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs,
34 u16 clkctrl_offs)
35{
36 return 0;
37}
38
39static inline void omap4_cminst_module_enable(u8 mode, u8 part, u16 inst,
40 s16 cdoffs, u16 clkctrl_offs)
41{
42}
43
44static inline void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
45 u16 clkctrl_offs)
46{
47}
48
49# endif
50
28/* 51/*
29 * In an ideal world, we would not export these low-level functions, 52 * In an ideal world, we would not export these low-level functions,
30 * but this will probably take some time to fix properly 53 * but this will probably take some time to fix properly
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index c7fb22abc219..655e9480eb98 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -821,11 +821,10 @@ static void __init omap_mux_set_cmdline_signals(void)
821 if (!omap_mux_options) 821 if (!omap_mux_options)
822 return; 822 return;
823 823
824 options = kmalloc(strlen(omap_mux_options) + 1, GFP_KERNEL); 824 options = kstrdup(omap_mux_options, GFP_KERNEL);
825 if (!options) 825 if (!options)
826 return; 826 return;
827 827
828 strcpy(options, omap_mux_options);
829 next_opt = options; 828 next_opt = options;
830 829
831 while ((token = strsep(&next_opt, ",")) != NULL) { 830 while ((token = strsep(&next_opt, ",")) != NULL) {
@@ -855,24 +854,19 @@ static int __init omap_mux_copy_names(struct omap_mux *src,
855 854
856 for (i = 0; i < OMAP_MUX_NR_MODES; i++) { 855 for (i = 0; i < OMAP_MUX_NR_MODES; i++) {
857 if (src->muxnames[i]) { 856 if (src->muxnames[i]) {
858 dst->muxnames[i] = 857 dst->muxnames[i] = kstrdup(src->muxnames[i],
859 kmalloc(strlen(src->muxnames[i]) + 1, 858 GFP_KERNEL);
860 GFP_KERNEL);
861 if (!dst->muxnames[i]) 859 if (!dst->muxnames[i])
862 goto free; 860 goto free;
863 strcpy(dst->muxnames[i], src->muxnames[i]);
864 } 861 }
865 } 862 }
866 863
867#ifdef CONFIG_DEBUG_FS 864#ifdef CONFIG_DEBUG_FS
868 for (i = 0; i < OMAP_MUX_NR_SIDES; i++) { 865 for (i = 0; i < OMAP_MUX_NR_SIDES; i++) {
869 if (src->balls[i]) { 866 if (src->balls[i]) {
870 dst->balls[i] = 867 dst->balls[i] = kstrdup(src->balls[i], GFP_KERNEL);
871 kmalloc(strlen(src->balls[i]) + 1,
872 GFP_KERNEL);
873 if (!dst->balls[i]) 868 if (!dst->balls[i])
874 goto free; 869 goto free;
875 strcpy(dst->balls[i], src->balls[i]);
876 } 870 }
877 } 871 }
878#endif 872#endif
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index 2ce2fb7664bc..34c01a7de810 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -621,7 +621,7 @@ void sr_disable(struct voltagedomain *voltdm)
621 sr_v2_disable(sr); 621 sr_v2_disable(sr);
622 } 622 }
623 623
624 pm_runtime_put_sync(&sr->pdev->dev); 624 pm_runtime_put_sync_suspend(&sr->pdev->dev);
625} 625}
626 626
627/** 627/**
@@ -860,6 +860,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
860 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 860 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
861 861
862 pm_runtime_enable(&pdev->dev); 862 pm_runtime_enable(&pdev->dev);
863 pm_runtime_irq_safe(&pdev->dev);
863 864
864 sr_info->pdev = pdev; 865 sr_info->pdev = pdev;
865 sr_info->srid = pdev->id; 866 sr_info->srid = pdev->id;
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index e9640728239b..cf1de7d2630d 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -293,7 +293,8 @@ static void __init omap2_gp_clocksource_init(int gptimer_id,
293 pr_info("OMAP clocksource: GPTIMER%d at %lu Hz\n", 293 pr_info("OMAP clocksource: GPTIMER%d at %lu Hz\n",
294 gptimer_id, clksrc.rate); 294 gptimer_id, clksrc.rate);
295 295
296 __omap_dm_timer_load_start(clksrc.io_base, OMAP_TIMER_CTRL_ST, 0, 1); 296 __omap_dm_timer_load_start(clksrc.io_base,
297 OMAP_TIMER_CTRL_ST | OMAP_TIMER_CTRL_AR, 0, 1);
297 init_sched_clock(&cd, dmtimer_update_sched_clock, 32, clksrc.rate); 298 init_sched_clock(&cd, dmtimer_update_sched_clock, 32, clksrc.rate);
298 299
299 if (clocksource_register_hz(&clocksource_gpt, clksrc.rate)) 300 if (clocksource_register_hz(&clocksource_gpt, clksrc.rate))
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 2543342dbccb..daa056ed8738 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -48,14 +48,7 @@ void __init omap_pmic_init(int bus, u32 clkrate,
48 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); 48 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
49} 49}
50 50
51static struct twl4030_usb_data omap4_usb_pdata = { 51#if defined(CONFIG_ARCH_OMAP3)
52 .phy_init = omap4430_phy_init,
53 .phy_exit = omap4430_phy_exit,
54 .phy_power = omap4430_phy_power,
55 .phy_set_clock = omap4430_phy_set_clk,
56 .phy_suspend = omap4430_phy_suspend,
57};
58
59static struct twl4030_usb_data omap3_usb_pdata = { 52static struct twl4030_usb_data omap3_usb_pdata = {
60 .usb_mode = T2_USB_MODE_ULPI, 53 .usb_mode = T2_USB_MODE_ULPI,
61}; 54};
@@ -122,6 +115,45 @@ static struct regulator_init_data omap3_vpll2_idata = {
122 .consumer_supplies = omap3_vpll2_supplies, 115 .consumer_supplies = omap3_vpll2_supplies,
123}; 116};
124 117
118void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
119 u32 pdata_flags, u32 regulators_flags)
120{
121 if (!pmic_data->irq_base)
122 pmic_data->irq_base = TWL4030_IRQ_BASE;
123 if (!pmic_data->irq_end)
124 pmic_data->irq_end = TWL4030_IRQ_END;
125
126 /* Common platform data configurations */
127 if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb)
128 pmic_data->usb = &omap3_usb_pdata;
129
130 if (pdata_flags & TWL_COMMON_PDATA_BCI && !pmic_data->bci)
131 pmic_data->bci = &omap3_bci_pdata;
132
133 if (pdata_flags & TWL_COMMON_PDATA_MADC && !pmic_data->madc)
134 pmic_data->madc = &omap3_madc_pdata;
135
136 if (pdata_flags & TWL_COMMON_PDATA_AUDIO && !pmic_data->audio)
137 pmic_data->audio = &omap3_audio_pdata;
138
139 /* Common regulator configurations */
140 if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac)
141 pmic_data->vdac = &omap3_vdac_idata;
142
143 if (regulators_flags & TWL_COMMON_REGULATOR_VPLL2 && !pmic_data->vpll2)
144 pmic_data->vpll2 = &omap3_vpll2_idata;
145}
146#endif /* CONFIG_ARCH_OMAP3 */
147
148#if defined(CONFIG_ARCH_OMAP4)
149static struct twl4030_usb_data omap4_usb_pdata = {
150 .phy_init = omap4430_phy_init,
151 .phy_exit = omap4430_phy_exit,
152 .phy_power = omap4430_phy_power,
153 .phy_set_clock = omap4430_phy_set_clk,
154 .phy_suspend = omap4430_phy_suspend,
155};
156
125static struct regulator_init_data omap4_vdac_idata = { 157static struct regulator_init_data omap4_vdac_idata = {
126 .constraints = { 158 .constraints = {
127 .min_uV = 1800000, 159 .min_uV = 1800000,
@@ -273,32 +305,4 @@ void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
273 !pmic_data->clk32kg) 305 !pmic_data->clk32kg)
274 pmic_data->clk32kg = &omap4_clk32kg_idata; 306 pmic_data->clk32kg = &omap4_clk32kg_idata;
275} 307}
276 308#endif /* CONFIG_ARCH_OMAP4 */
277void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
278 u32 pdata_flags, u32 regulators_flags)
279{
280 if (!pmic_data->irq_base)
281 pmic_data->irq_base = TWL4030_IRQ_BASE;
282 if (!pmic_data->irq_end)
283 pmic_data->irq_end = TWL4030_IRQ_END;
284
285 /* Common platform data configurations */
286 if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb)
287 pmic_data->usb = &omap3_usb_pdata;
288
289 if (pdata_flags & TWL_COMMON_PDATA_BCI && !pmic_data->bci)
290 pmic_data->bci = &omap3_bci_pdata;
291
292 if (pdata_flags & TWL_COMMON_PDATA_MADC && !pmic_data->madc)
293 pmic_data->madc = &omap3_madc_pdata;
294
295 if (pdata_flags & TWL_COMMON_PDATA_AUDIO && !pmic_data->audio)
296 pmic_data->audio = &omap3_audio_pdata;
297
298 /* Common regulator configurations */
299 if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac)
300 pmic_data->vdac = &omap3_vdac_idata;
301
302 if (regulators_flags & TWL_COMMON_REGULATOR_VPLL2 && !pmic_data->vpll2)
303 pmic_data->vpll2 = &omap3_vpll2_idata;
304}
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 9026249233ad..af0c2fe1ea37 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -65,7 +65,7 @@
65#include <plat/iic.h> 65#include <plat/iic.h>
66#include <plat/pm.h> 66#include <plat/pm.h>
67 67
68#include <sound/wm8915.h> 68#include <sound/wm8996.h>
69#include <sound/wm8962.h> 69#include <sound/wm8962.h>
70#include <sound/wm9081.h> 70#include <sound/wm9081.h>
71 71
@@ -614,7 +614,7 @@ static struct wm831x_pdata glenfarclas_pmic_pdata __initdata = {
614 .disable_touch = true, 614 .disable_touch = true,
615}; 615};
616 616
617static struct wm8915_retune_mobile_config wm8915_retune[] = { 617static struct wm8996_retune_mobile_config wm8996_retune[] = {
618 { 618 {
619 .name = "Sub LPF", 619 .name = "Sub LPF",
620 .rate = 48000, 620 .rate = 48000,
@@ -635,12 +635,12 @@ static struct wm8915_retune_mobile_config wm8915_retune[] = {
635 }, 635 },
636}; 636};
637 637
638static struct wm8915_pdata wm8915_pdata __initdata = { 638static struct wm8996_pdata wm8996_pdata __initdata = {
639 .ldo_ena = S3C64XX_GPN(7), 639 .ldo_ena = S3C64XX_GPN(7),
640 .gpio_base = CODEC_GPIO_BASE, 640 .gpio_base = CODEC_GPIO_BASE,
641 .micdet_def = 1, 641 .micdet_def = 1,
642 .inl_mode = WM8915_DIFFERRENTIAL_1, 642 .inl_mode = WM8996_DIFFERRENTIAL_1,
643 .inr_mode = WM8915_DIFFERRENTIAL_1, 643 .inr_mode = WM8996_DIFFERRENTIAL_1,
644 644
645 .irq_flags = IRQF_TRIGGER_RISING, 645 .irq_flags = IRQF_TRIGGER_RISING,
646 646
@@ -652,8 +652,8 @@ static struct wm8915_pdata wm8915_pdata __initdata = {
652 0x020e, /* GPIO5 == CLKOUT */ 652 0x020e, /* GPIO5 == CLKOUT */
653 }, 653 },
654 654
655 .retune_mobile_cfgs = wm8915_retune, 655 .retune_mobile_cfgs = wm8996_retune,
656 .num_retune_mobile_cfgs = ARRAY_SIZE(wm8915_retune), 656 .num_retune_mobile_cfgs = ARRAY_SIZE(wm8996_retune),
657}; 657};
658 658
659static struct wm8962_pdata wm8962_pdata __initdata = { 659static struct wm8962_pdata wm8962_pdata __initdata = {
@@ -679,8 +679,8 @@ static struct i2c_board_info i2c_devs1[] __initdata = {
679 .platform_data = &glenfarclas_pmic_pdata }, 679 .platform_data = &glenfarclas_pmic_pdata },
680 680
681 { I2C_BOARD_INFO("wm1250-ev1", 0x27) }, 681 { I2C_BOARD_INFO("wm1250-ev1", 0x27) },
682 { I2C_BOARD_INFO("wm8915", 0x1a), 682 { I2C_BOARD_INFO("wm8996", 0x1a),
683 .platform_data = &wm8915_pdata, 683 .platform_data = &wm8996_pdata,
684 .irq = GLENFARCLAS_PMIC_IRQ_BASE + WM831X_IRQ_GPIO_2, 684 .irq = GLENFARCLAS_PMIC_IRQ_BASE + WM831X_IRQ_GPIO_2,
685 }, 685 },
686 { I2C_BOARD_INFO("wm9081", 0x6c), 686 { I2C_BOARD_INFO("wm9081", 0x6c),
diff --git a/arch/arm/mach-sa1100/pci-nanoengine.c b/arch/arm/mach-sa1100/pci-nanoengine.c
index 964c6c3cd7a6..dd39fee59549 100644
--- a/arch/arm/mach-sa1100/pci-nanoengine.c
+++ b/arch/arm/mach-sa1100/pci-nanoengine.c
@@ -28,6 +28,7 @@
28#include <asm/mach-types.h> 28#include <asm/mach-types.h>
29 29
30#include <mach/nanoengine.h> 30#include <mach/nanoengine.h>
31#include <mach/hardware.h>
31 32
32static DEFINE_SPINLOCK(nano_lock); 33static DEFINE_SPINLOCK(nano_lock);
33 34
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index be7c638b648b..cfbcf8b95599 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -22,6 +22,7 @@
22#include <linux/sched.h> 22#include <linux/sched.h>
23#include <linux/uaccess.h> 23#include <linux/uaccess.h>
24 24
25#include <asm/system.h>
25#include <asm/unaligned.h> 26#include <asm/unaligned.h>
26 27
27#include "fault.h" 28#include "fault.h"
@@ -95,6 +96,33 @@ static const char *usermode_action[] = {
95 "signal+warn" 96 "signal+warn"
96}; 97};
97 98
99/* Return true if and only if the ARMv6 unaligned access model is in use. */
100static bool cpu_is_v6_unaligned(void)
101{
102 return cpu_architecture() >= CPU_ARCH_ARMv6 && (cr_alignment & CR_U);
103}
104
105static int safe_usermode(int new_usermode, bool warn)
106{
107 /*
108 * ARMv6 and later CPUs can perform unaligned accesses for
109 * most single load and store instructions up to word size.
110 * LDM, STM, LDRD and STRD still need to be handled.
111 *
112 * Ignoring the alignment fault is not an option on these
113 * CPUs since we spin re-faulting the instruction without
114 * making any progress.
115 */
116 if (cpu_is_v6_unaligned() && !(new_usermode & (UM_FIXUP | UM_SIGNAL))) {
117 new_usermode |= UM_FIXUP;
118
119 if (warn)
120 printk(KERN_WARNING "alignment: ignoring faults is unsafe on this CPU. Defaulting to fixup mode.\n");
121 }
122
123 return new_usermode;
124}
125
98static int alignment_proc_show(struct seq_file *m, void *v) 126static int alignment_proc_show(struct seq_file *m, void *v)
99{ 127{
100 seq_printf(m, "User:\t\t%lu\n", ai_user); 128 seq_printf(m, "User:\t\t%lu\n", ai_user);
@@ -125,7 +153,7 @@ static ssize_t alignment_proc_write(struct file *file, const char __user *buffer
125 if (get_user(mode, buffer)) 153 if (get_user(mode, buffer))
126 return -EFAULT; 154 return -EFAULT;
127 if (mode >= '0' && mode <= '5') 155 if (mode >= '0' && mode <= '5')
128 ai_usermode = mode - '0'; 156 ai_usermode = safe_usermode(mode - '0', true);
129 } 157 }
130 return count; 158 return count;
131} 159}
@@ -886,9 +914,16 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
886 if (ai_usermode & UM_FIXUP) 914 if (ai_usermode & UM_FIXUP)
887 goto fixup; 915 goto fixup;
888 916
889 if (ai_usermode & UM_SIGNAL) 917 if (ai_usermode & UM_SIGNAL) {
890 force_sig(SIGBUS, current); 918 siginfo_t si;
891 else { 919
920 si.si_signo = SIGBUS;
921 si.si_errno = 0;
922 si.si_code = BUS_ADRALN;
923 si.si_addr = (void __user *)addr;
924
925 force_sig_info(si.si_signo, &si, current);
926 } else {
892 /* 927 /*
893 * We're about to disable the alignment trap and return to 928 * We're about to disable the alignment trap and return to
894 * user space. But if an interrupt occurs before actually 929 * user space. But if an interrupt occurs before actually
@@ -926,20 +961,11 @@ static int __init alignment_init(void)
926 return -ENOMEM; 961 return -ENOMEM;
927#endif 962#endif
928 963
929 /* 964 if (cpu_is_v6_unaligned()) {
930 * ARMv6 and later CPUs can perform unaligned accesses for
931 * most single load and store instructions up to word size.
932 * LDM, STM, LDRD and STRD still need to be handled.
933 *
934 * Ignoring the alignment fault is not an option on these
935 * CPUs since we spin re-faulting the instruction without
936 * making any progress.
937 */
938 if (cpu_architecture() >= CPU_ARCH_ARMv6 && (cr_alignment & CR_U)) {
939 cr_alignment &= ~CR_A; 965 cr_alignment &= ~CR_A;
940 cr_no_alignment &= ~CR_A; 966 cr_no_alignment &= ~CR_A;
941 set_cr(cr_alignment); 967 set_cr(cr_alignment);
942 ai_usermode = UM_FIXUP; 968 ai_usermode = safe_usermode(ai_usermode, false);
943 } 969 }
944 970
945 hook_fault_code(1, do_alignment, SIGBUS, BUS_ADRALN, 971 hook_fault_code(1, do_alignment, SIGBUS, BUS_ADRALN,
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 2fee782077c1..91bca355cd31 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -441,7 +441,7 @@ static inline int free_area(unsigned long pfn, unsigned long end, char *s)
441static inline void poison_init_mem(void *s, size_t count) 441static inline void poison_init_mem(void *s, size_t count)
442{ 442{
443 u32 *p = (u32 *)s; 443 u32 *p = (u32 *)s;
444 while ((count = count - 4)) 444 for (; count != 0; count -= 4)
445 *p++ = 0xe7fddef0; 445 *p++ = 0xe7fddef0;
446} 446}
447 447
diff --git a/arch/arm/mm/proc-arm946.S b/arch/arm/mm/proc-arm946.S
index f8f7ea34bfc5..683af3a182b7 100644
--- a/arch/arm/mm/proc-arm946.S
+++ b/arch/arm/mm/proc-arm946.S
@@ -410,6 +410,7 @@ __arm946_proc_info:
410 .long 0x41009460 410 .long 0x41009460
411 .long 0xff00fff0 411 .long 0xff00fff0
412 .long 0 412 .long 0
413 .long 0
413 b __arm946_setup 414 b __arm946_setup
414 .long cpu_arch_name 415 .long cpu_arch_name
415 .long cpu_elf_name 416 .long cpu_elf_name
@@ -418,6 +419,6 @@ __arm946_proc_info:
418 .long arm946_processor_functions 419 .long arm946_processor_functions
419 .long 0 420 .long 0
420 .long 0 421 .long 0
421 .long arm940_cache_fns 422 .long arm946_cache_fns
422 .size __arm946_proc_info, . - __arm946_proc_info 423 .size __arm946_proc_info, . - __arm946_proc_info
423 424
diff --git a/arch/arm/plat-mxc/include/mach/debug-macro.S b/arch/arm/plat-mxc/include/mach/debug-macro.S
index 91fc7cdb5dc9..e4dde91f0231 100644
--- a/arch/arm/plat-mxc/include/mach/debug-macro.S
+++ b/arch/arm/plat-mxc/include/mach/debug-macro.S
@@ -44,6 +44,14 @@
44#define UART_PADDR MX51_UART1_BASE_ADDR 44#define UART_PADDR MX51_UART1_BASE_ADDR
45#endif 45#endif
46 46
47/* iMX50/53 have same addresses, but not iMX51 */
48#if defined(CONFIG_SOC_IMX50) || defined(CONFIG_SOC_IMX53)
49#ifdef UART_PADDR
50#error "CONFIG_DEBUG_LL is incompatible with multiple archs"
51#endif
52#define UART_PADDR MX53_UART1_BASE_ADDR
53#endif
54
47#define UART_VADDR IMX_IO_ADDRESS(UART_PADDR) 55#define UART_VADDR IMX_IO_ADDRESS(UART_PADDR)
48 56
49 .macro addruart, rp, rv 57 .macro addruart, rp, rv
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx53.h b/arch/arm/plat-mxc/include/mach/iomux-mx53.h
index 9440b9e00e89..5408fd1fc736 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx53.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx53.h
@@ -30,6 +30,9 @@
30#define MX53_SDHC_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_PKE | PAD_CTL_PUE | \ 30#define MX53_SDHC_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_PKE | PAD_CTL_PUE | \
31 PAD_CTL_PUS_47K_UP | PAD_CTL_DSE_HIGH | \ 31 PAD_CTL_PUS_47K_UP | PAD_CTL_DSE_HIGH | \
32 PAD_CTL_SRE_FAST) 32 PAD_CTL_SRE_FAST)
33#define PAD_CTRL_I2C (PAD_CTL_SRE_FAST | PAD_CTL_ODE | PAD_CTL_PKE | \
34 PAD_CTL_PUE | PAD_CTL_DSE_HIGH | PAD_CTL_PUS_100K_UP \
35 | PAD_CTL_HYS)
33 36
34#define _MX53_PAD_GPIO_19__KPP_COL_5 IOMUX_PAD(0x348, 0x20, 0, 0x840, 0, 0) 37#define _MX53_PAD_GPIO_19__KPP_COL_5 IOMUX_PAD(0x348, 0x20, 0, 0x840, 0, 0)
35#define _MX53_PAD_GPIO_19__GPIO4_5 IOMUX_PAD(0x348, 0x20, 1, 0x0, 0, 0) 38#define _MX53_PAD_GPIO_19__GPIO4_5 IOMUX_PAD(0x348, 0x20, 1, 0x0, 0, 0)
@@ -1256,7 +1259,7 @@
1256#define MX53_PAD_KEY_COL3__GPIO4_12 (_MX53_PAD_KEY_COL3__GPIO4_12 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1259#define MX53_PAD_KEY_COL3__GPIO4_12 (_MX53_PAD_KEY_COL3__GPIO4_12 | MUX_PAD_CTRL(NO_PAD_CTRL))
1257#define MX53_PAD_KEY_COL3__USBOH3_H2_DP (_MX53_PAD_KEY_COL3__USBOH3_H2_DP | MUX_PAD_CTRL(NO_PAD_CTRL)) 1260#define MX53_PAD_KEY_COL3__USBOH3_H2_DP (_MX53_PAD_KEY_COL3__USBOH3_H2_DP | MUX_PAD_CTRL(NO_PAD_CTRL))
1258#define MX53_PAD_KEY_COL3__SPDIF_IN1 (_MX53_PAD_KEY_COL3__SPDIF_IN1 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1261#define MX53_PAD_KEY_COL3__SPDIF_IN1 (_MX53_PAD_KEY_COL3__SPDIF_IN1 | MUX_PAD_CTRL(NO_PAD_CTRL))
1259#define MX53_PAD_KEY_COL3__I2C2_SCL (_MX53_PAD_KEY_COL3__I2C2_SCL | MUX_PAD_CTRL(NO_PAD_CTRL)) 1262#define MX53_PAD_KEY_COL3__I2C2_SCL (_MX53_PAD_KEY_COL3__I2C2_SCL | MUX_PAD_CTRL(PAD_CTRL_I2C))
1260#define MX53_PAD_KEY_COL3__ECSPI1_SS3 (_MX53_PAD_KEY_COL3__ECSPI1_SS3 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1263#define MX53_PAD_KEY_COL3__ECSPI1_SS3 (_MX53_PAD_KEY_COL3__ECSPI1_SS3 | MUX_PAD_CTRL(NO_PAD_CTRL))
1261#define MX53_PAD_KEY_COL3__FEC_CRS (_MX53_PAD_KEY_COL3__FEC_CRS | MUX_PAD_CTRL(NO_PAD_CTRL)) 1264#define MX53_PAD_KEY_COL3__FEC_CRS (_MX53_PAD_KEY_COL3__FEC_CRS | MUX_PAD_CTRL(NO_PAD_CTRL))
1262#define MX53_PAD_KEY_COL3__USBPHY1_SIECLOCK (_MX53_PAD_KEY_COL3__USBPHY1_SIECLOCK | MUX_PAD_CTRL(NO_PAD_CTRL)) 1265#define MX53_PAD_KEY_COL3__USBPHY1_SIECLOCK (_MX53_PAD_KEY_COL3__USBPHY1_SIECLOCK | MUX_PAD_CTRL(NO_PAD_CTRL))
@@ -1264,7 +1267,7 @@
1264#define MX53_PAD_KEY_ROW3__GPIO4_13 (_MX53_PAD_KEY_ROW3__GPIO4_13 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1267#define MX53_PAD_KEY_ROW3__GPIO4_13 (_MX53_PAD_KEY_ROW3__GPIO4_13 | MUX_PAD_CTRL(NO_PAD_CTRL))
1265#define MX53_PAD_KEY_ROW3__USBOH3_H2_DM (_MX53_PAD_KEY_ROW3__USBOH3_H2_DM | MUX_PAD_CTRL(NO_PAD_CTRL)) 1268#define MX53_PAD_KEY_ROW3__USBOH3_H2_DM (_MX53_PAD_KEY_ROW3__USBOH3_H2_DM | MUX_PAD_CTRL(NO_PAD_CTRL))
1266#define MX53_PAD_KEY_ROW3__CCM_ASRC_EXT_CLK (_MX53_PAD_KEY_ROW3__CCM_ASRC_EXT_CLK | MUX_PAD_CTRL(NO_PAD_CTRL)) 1269#define MX53_PAD_KEY_ROW3__CCM_ASRC_EXT_CLK (_MX53_PAD_KEY_ROW3__CCM_ASRC_EXT_CLK | MUX_PAD_CTRL(NO_PAD_CTRL))
1267#define MX53_PAD_KEY_ROW3__I2C2_SDA (_MX53_PAD_KEY_ROW3__I2C2_SDA | MUX_PAD_CTRL(NO_PAD_CTRL)) 1270#define MX53_PAD_KEY_ROW3__I2C2_SDA (_MX53_PAD_KEY_ROW3__I2C2_SDA | MUX_PAD_CTRL(PAD_CTRL_I2C))
1268#define MX53_PAD_KEY_ROW3__OSC32K_32K_OUT (_MX53_PAD_KEY_ROW3__OSC32K_32K_OUT | MUX_PAD_CTRL(NO_PAD_CTRL)) 1271#define MX53_PAD_KEY_ROW3__OSC32K_32K_OUT (_MX53_PAD_KEY_ROW3__OSC32K_32K_OUT | MUX_PAD_CTRL(NO_PAD_CTRL))
1269#define MX53_PAD_KEY_ROW3__CCM_PLL4_BYP (_MX53_PAD_KEY_ROW3__CCM_PLL4_BYP | MUX_PAD_CTRL(NO_PAD_CTRL)) 1272#define MX53_PAD_KEY_ROW3__CCM_PLL4_BYP (_MX53_PAD_KEY_ROW3__CCM_PLL4_BYP | MUX_PAD_CTRL(NO_PAD_CTRL))
1270#define MX53_PAD_KEY_ROW3__USBPHY1_LINESTATE_0 (_MX53_PAD_KEY_ROW3__USBPHY1_LINESTATE_0 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1273#define MX53_PAD_KEY_ROW3__USBPHY1_LINESTATE_0 (_MX53_PAD_KEY_ROW3__USBPHY1_LINESTATE_0 | MUX_PAD_CTRL(NO_PAD_CTRL))
@@ -1536,7 +1539,7 @@
1536#define MX53_PAD_CSI0_DAT8__KPP_COL_7 (_MX53_PAD_CSI0_DAT8__KPP_COL_7 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1539#define MX53_PAD_CSI0_DAT8__KPP_COL_7 (_MX53_PAD_CSI0_DAT8__KPP_COL_7 | MUX_PAD_CTRL(NO_PAD_CTRL))
1537#define MX53_PAD_CSI0_DAT8__ECSPI2_SCLK (_MX53_PAD_CSI0_DAT8__ECSPI2_SCLK | MUX_PAD_CTRL(NO_PAD_CTRL)) 1540#define MX53_PAD_CSI0_DAT8__ECSPI2_SCLK (_MX53_PAD_CSI0_DAT8__ECSPI2_SCLK | MUX_PAD_CTRL(NO_PAD_CTRL))
1538#define MX53_PAD_CSI0_DAT8__USBOH3_USBH3_OC (_MX53_PAD_CSI0_DAT8__USBOH3_USBH3_OC | MUX_PAD_CTRL(NO_PAD_CTRL)) 1541#define MX53_PAD_CSI0_DAT8__USBOH3_USBH3_OC (_MX53_PAD_CSI0_DAT8__USBOH3_USBH3_OC | MUX_PAD_CTRL(NO_PAD_CTRL))
1539#define MX53_PAD_CSI0_DAT8__I2C1_SDA (_MX53_PAD_CSI0_DAT8__I2C1_SDA | MUX_PAD_CTRL(NO_PAD_CTRL)) 1542#define MX53_PAD_CSI0_DAT8__I2C1_SDA (_MX53_PAD_CSI0_DAT8__I2C1_SDA | MUX_PAD_CTRL(PAD_CTRL_I2C))
1540#define MX53_PAD_CSI0_DAT8__EMI_EMI_DEBUG_37 (_MX53_PAD_CSI0_DAT8__EMI_EMI_DEBUG_37 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1543#define MX53_PAD_CSI0_DAT8__EMI_EMI_DEBUG_37 (_MX53_PAD_CSI0_DAT8__EMI_EMI_DEBUG_37 | MUX_PAD_CTRL(NO_PAD_CTRL))
1541#define MX53_PAD_CSI0_DAT8__TPIU_TRACE_5 (_MX53_PAD_CSI0_DAT8__TPIU_TRACE_5 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1544#define MX53_PAD_CSI0_DAT8__TPIU_TRACE_5 (_MX53_PAD_CSI0_DAT8__TPIU_TRACE_5 | MUX_PAD_CTRL(NO_PAD_CTRL))
1542#define MX53_PAD_CSI0_DAT9__IPU_CSI0_D_9 (_MX53_PAD_CSI0_DAT9__IPU_CSI0_D_9 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1545#define MX53_PAD_CSI0_DAT9__IPU_CSI0_D_9 (_MX53_PAD_CSI0_DAT9__IPU_CSI0_D_9 | MUX_PAD_CTRL(NO_PAD_CTRL))
@@ -1544,7 +1547,7 @@
1544#define MX53_PAD_CSI0_DAT9__KPP_ROW_7 (_MX53_PAD_CSI0_DAT9__KPP_ROW_7 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1547#define MX53_PAD_CSI0_DAT9__KPP_ROW_7 (_MX53_PAD_CSI0_DAT9__KPP_ROW_7 | MUX_PAD_CTRL(NO_PAD_CTRL))
1545#define MX53_PAD_CSI0_DAT9__ECSPI2_MOSI (_MX53_PAD_CSI0_DAT9__ECSPI2_MOSI | MUX_PAD_CTRL(NO_PAD_CTRL)) 1548#define MX53_PAD_CSI0_DAT9__ECSPI2_MOSI (_MX53_PAD_CSI0_DAT9__ECSPI2_MOSI | MUX_PAD_CTRL(NO_PAD_CTRL))
1546#define MX53_PAD_CSI0_DAT9__USBOH3_USBH3_PWR (_MX53_PAD_CSI0_DAT9__USBOH3_USBH3_PWR | MUX_PAD_CTRL(NO_PAD_CTRL)) 1549#define MX53_PAD_CSI0_DAT9__USBOH3_USBH3_PWR (_MX53_PAD_CSI0_DAT9__USBOH3_USBH3_PWR | MUX_PAD_CTRL(NO_PAD_CTRL))
1547#define MX53_PAD_CSI0_DAT9__I2C1_SCL (_MX53_PAD_CSI0_DAT9__I2C1_SCL | MUX_PAD_CTRL(NO_PAD_CTRL)) 1550#define MX53_PAD_CSI0_DAT9__I2C1_SCL (_MX53_PAD_CSI0_DAT9__I2C1_SCL | MUX_PAD_CTRL(PAD_CTRL_I2C))
1548#define MX53_PAD_CSI0_DAT9__EMI_EMI_DEBUG_38 (_MX53_PAD_CSI0_DAT9__EMI_EMI_DEBUG_38 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1551#define MX53_PAD_CSI0_DAT9__EMI_EMI_DEBUG_38 (_MX53_PAD_CSI0_DAT9__EMI_EMI_DEBUG_38 | MUX_PAD_CTRL(NO_PAD_CTRL))
1549#define MX53_PAD_CSI0_DAT9__TPIU_TRACE_6 (_MX53_PAD_CSI0_DAT9__TPIU_TRACE_6 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1552#define MX53_PAD_CSI0_DAT9__TPIU_TRACE_6 (_MX53_PAD_CSI0_DAT9__TPIU_TRACE_6 | MUX_PAD_CTRL(NO_PAD_CTRL))
1550#define MX53_PAD_CSI0_DAT10__IPU_CSI0_D_10 (_MX53_PAD_CSI0_DAT10__IPU_CSI0_D_10 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1553#define MX53_PAD_CSI0_DAT10__IPU_CSI0_D_10 (_MX53_PAD_CSI0_DAT10__IPU_CSI0_D_10 | MUX_PAD_CTRL(NO_PAD_CTRL))
@@ -1631,25 +1634,25 @@
1631#define MX53_PAD_EIM_EB2__CCM_DI1_EXT_CLK (_MX53_PAD_EIM_EB2__CCM_DI1_EXT_CLK | MUX_PAD_CTRL(NO_PAD_CTRL)) 1634#define MX53_PAD_EIM_EB2__CCM_DI1_EXT_CLK (_MX53_PAD_EIM_EB2__CCM_DI1_EXT_CLK | MUX_PAD_CTRL(NO_PAD_CTRL))
1632#define MX53_PAD_EIM_EB2__IPU_SER_DISP1_CS (_MX53_PAD_EIM_EB2__IPU_SER_DISP1_CS | MUX_PAD_CTRL(NO_PAD_CTRL)) 1635#define MX53_PAD_EIM_EB2__IPU_SER_DISP1_CS (_MX53_PAD_EIM_EB2__IPU_SER_DISP1_CS | MUX_PAD_CTRL(NO_PAD_CTRL))
1633#define MX53_PAD_EIM_EB2__ECSPI1_SS0 (_MX53_PAD_EIM_EB2__ECSPI1_SS0 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1636#define MX53_PAD_EIM_EB2__ECSPI1_SS0 (_MX53_PAD_EIM_EB2__ECSPI1_SS0 | MUX_PAD_CTRL(NO_PAD_CTRL))
1634#define MX53_PAD_EIM_EB2__I2C2_SCL (_MX53_PAD_EIM_EB2__I2C2_SCL | MUX_PAD_CTRL(NO_PAD_CTRL)) 1637#define MX53_PAD_EIM_EB2__I2C2_SCL (_MX53_PAD_EIM_EB2__I2C2_SCL | MUX_PAD_CTRL(PAD_CTRL_I2C))
1635#define MX53_PAD_EIM_D16__EMI_WEIM_D_16 (_MX53_PAD_EIM_D16__EMI_WEIM_D_16 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1638#define MX53_PAD_EIM_D16__EMI_WEIM_D_16 (_MX53_PAD_EIM_D16__EMI_WEIM_D_16 | MUX_PAD_CTRL(NO_PAD_CTRL))
1636#define MX53_PAD_EIM_D16__GPIO3_16 (_MX53_PAD_EIM_D16__GPIO3_16 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1639#define MX53_PAD_EIM_D16__GPIO3_16 (_MX53_PAD_EIM_D16__GPIO3_16 | MUX_PAD_CTRL(NO_PAD_CTRL))
1637#define MX53_PAD_EIM_D16__IPU_DI0_PIN5 (_MX53_PAD_EIM_D16__IPU_DI0_PIN5 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1640#define MX53_PAD_EIM_D16__IPU_DI0_PIN5 (_MX53_PAD_EIM_D16__IPU_DI0_PIN5 | MUX_PAD_CTRL(NO_PAD_CTRL))
1638#define MX53_PAD_EIM_D16__IPU_DISPB1_SER_CLK (_MX53_PAD_EIM_D16__IPU_DISPB1_SER_CLK | MUX_PAD_CTRL(NO_PAD_CTRL)) 1641#define MX53_PAD_EIM_D16__IPU_DISPB1_SER_CLK (_MX53_PAD_EIM_D16__IPU_DISPB1_SER_CLK | MUX_PAD_CTRL(NO_PAD_CTRL))
1639#define MX53_PAD_EIM_D16__ECSPI1_SCLK (_MX53_PAD_EIM_D16__ECSPI1_SCLK | MUX_PAD_CTRL(NO_PAD_CTRL)) 1642#define MX53_PAD_EIM_D16__ECSPI1_SCLK (_MX53_PAD_EIM_D16__ECSPI1_SCLK | MUX_PAD_CTRL(NO_PAD_CTRL))
1640#define MX53_PAD_EIM_D16__I2C2_SDA (_MX53_PAD_EIM_D16__I2C2_SDA | MUX_PAD_CTRL(NO_PAD_CTRL)) 1643#define MX53_PAD_EIM_D16__I2C2_SDA (_MX53_PAD_EIM_D16__I2C2_SDA | MUX_PAD_CTRL(PAD_CTRL_I2C))
1641#define MX53_PAD_EIM_D17__EMI_WEIM_D_17 (_MX53_PAD_EIM_D17__EMI_WEIM_D_17 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1644#define MX53_PAD_EIM_D17__EMI_WEIM_D_17 (_MX53_PAD_EIM_D17__EMI_WEIM_D_17 | MUX_PAD_CTRL(NO_PAD_CTRL))
1642#define MX53_PAD_EIM_D17__GPIO3_17 (_MX53_PAD_EIM_D17__GPIO3_17 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1645#define MX53_PAD_EIM_D17__GPIO3_17 (_MX53_PAD_EIM_D17__GPIO3_17 | MUX_PAD_CTRL(NO_PAD_CTRL))
1643#define MX53_PAD_EIM_D17__IPU_DI0_PIN6 (_MX53_PAD_EIM_D17__IPU_DI0_PIN6 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1646#define MX53_PAD_EIM_D17__IPU_DI0_PIN6 (_MX53_PAD_EIM_D17__IPU_DI0_PIN6 | MUX_PAD_CTRL(NO_PAD_CTRL))
1644#define MX53_PAD_EIM_D17__IPU_DISPB1_SER_DIN (_MX53_PAD_EIM_D17__IPU_DISPB1_SER_DIN | MUX_PAD_CTRL(NO_PAD_CTRL)) 1647#define MX53_PAD_EIM_D17__IPU_DISPB1_SER_DIN (_MX53_PAD_EIM_D17__IPU_DISPB1_SER_DIN | MUX_PAD_CTRL(NO_PAD_CTRL))
1645#define MX53_PAD_EIM_D17__ECSPI1_MISO (_MX53_PAD_EIM_D17__ECSPI1_MISO | MUX_PAD_CTRL(NO_PAD_CTRL)) 1648#define MX53_PAD_EIM_D17__ECSPI1_MISO (_MX53_PAD_EIM_D17__ECSPI1_MISO | MUX_PAD_CTRL(NO_PAD_CTRL))
1646#define MX53_PAD_EIM_D17__I2C3_SCL (_MX53_PAD_EIM_D17__I2C3_SCL | MUX_PAD_CTRL(NO_PAD_CTRL)) 1649#define MX53_PAD_EIM_D17__I2C3_SCL (_MX53_PAD_EIM_D17__I2C3_SCL | MUX_PAD_CTRL(PAD_CTRL_I2C))
1647#define MX53_PAD_EIM_D18__EMI_WEIM_D_18 (_MX53_PAD_EIM_D18__EMI_WEIM_D_18 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1650#define MX53_PAD_EIM_D18__EMI_WEIM_D_18 (_MX53_PAD_EIM_D18__EMI_WEIM_D_18 | MUX_PAD_CTRL(NO_PAD_CTRL))
1648#define MX53_PAD_EIM_D18__GPIO3_18 (_MX53_PAD_EIM_D18__GPIO3_18 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1651#define MX53_PAD_EIM_D18__GPIO3_18 (_MX53_PAD_EIM_D18__GPIO3_18 | MUX_PAD_CTRL(NO_PAD_CTRL))
1649#define MX53_PAD_EIM_D18__IPU_DI0_PIN7 (_MX53_PAD_EIM_D18__IPU_DI0_PIN7 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1652#define MX53_PAD_EIM_D18__IPU_DI0_PIN7 (_MX53_PAD_EIM_D18__IPU_DI0_PIN7 | MUX_PAD_CTRL(NO_PAD_CTRL))
1650#define MX53_PAD_EIM_D18__IPU_DISPB1_SER_DIO (_MX53_PAD_EIM_D18__IPU_DISPB1_SER_DIO | MUX_PAD_CTRL(NO_PAD_CTRL)) 1653#define MX53_PAD_EIM_D18__IPU_DISPB1_SER_DIO (_MX53_PAD_EIM_D18__IPU_DISPB1_SER_DIO | MUX_PAD_CTRL(NO_PAD_CTRL))
1651#define MX53_PAD_EIM_D18__ECSPI1_MOSI (_MX53_PAD_EIM_D18__ECSPI1_MOSI | MUX_PAD_CTRL(NO_PAD_CTRL)) 1654#define MX53_PAD_EIM_D18__ECSPI1_MOSI (_MX53_PAD_EIM_D18__ECSPI1_MOSI | MUX_PAD_CTRL(NO_PAD_CTRL))
1652#define MX53_PAD_EIM_D18__I2C3_SDA (_MX53_PAD_EIM_D18__I2C3_SDA | MUX_PAD_CTRL(NO_PAD_CTRL)) 1655#define MX53_PAD_EIM_D18__I2C3_SDA (_MX53_PAD_EIM_D18__I2C3_SDA | MUX_PAD_CTRL(PAD_CTRL_I2C))
1653#define MX53_PAD_EIM_D18__IPU_DI1_D0_CS (_MX53_PAD_EIM_D18__IPU_DI1_D0_CS | MUX_PAD_CTRL(NO_PAD_CTRL)) 1656#define MX53_PAD_EIM_D18__IPU_DI1_D0_CS (_MX53_PAD_EIM_D18__IPU_DI1_D0_CS | MUX_PAD_CTRL(NO_PAD_CTRL))
1654#define MX53_PAD_EIM_D19__EMI_WEIM_D_19 (_MX53_PAD_EIM_D19__EMI_WEIM_D_19 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1657#define MX53_PAD_EIM_D19__EMI_WEIM_D_19 (_MX53_PAD_EIM_D19__EMI_WEIM_D_19 | MUX_PAD_CTRL(NO_PAD_CTRL))
1655#define MX53_PAD_EIM_D19__GPIO3_19 (_MX53_PAD_EIM_D19__GPIO3_19 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1658#define MX53_PAD_EIM_D19__GPIO3_19 (_MX53_PAD_EIM_D19__GPIO3_19 | MUX_PAD_CTRL(NO_PAD_CTRL))
@@ -1672,7 +1675,7 @@
1672#define MX53_PAD_EIM_D21__IPU_DI0_PIN17 (_MX53_PAD_EIM_D21__IPU_DI0_PIN17 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1675#define MX53_PAD_EIM_D21__IPU_DI0_PIN17 (_MX53_PAD_EIM_D21__IPU_DI0_PIN17 | MUX_PAD_CTRL(NO_PAD_CTRL))
1673#define MX53_PAD_EIM_D21__IPU_DISPB0_SER_CLK (_MX53_PAD_EIM_D21__IPU_DISPB0_SER_CLK | MUX_PAD_CTRL(NO_PAD_CTRL)) 1676#define MX53_PAD_EIM_D21__IPU_DISPB0_SER_CLK (_MX53_PAD_EIM_D21__IPU_DISPB0_SER_CLK | MUX_PAD_CTRL(NO_PAD_CTRL))
1674#define MX53_PAD_EIM_D21__CSPI_SCLK (_MX53_PAD_EIM_D21__CSPI_SCLK | MUX_PAD_CTRL(NO_PAD_CTRL)) 1677#define MX53_PAD_EIM_D21__CSPI_SCLK (_MX53_PAD_EIM_D21__CSPI_SCLK | MUX_PAD_CTRL(NO_PAD_CTRL))
1675#define MX53_PAD_EIM_D21__I2C1_SCL (_MX53_PAD_EIM_D21__I2C1_SCL | MUX_PAD_CTRL(NO_PAD_CTRL)) 1678#define MX53_PAD_EIM_D21__I2C1_SCL (_MX53_PAD_EIM_D21__I2C1_SCL | MUX_PAD_CTRL(PAD_CTRL_I2C))
1676#define MX53_PAD_EIM_D21__USBOH3_USBOTG_OC (_MX53_PAD_EIM_D21__USBOH3_USBOTG_OC | MUX_PAD_CTRL(NO_PAD_CTRL)) 1679#define MX53_PAD_EIM_D21__USBOH3_USBOTG_OC (_MX53_PAD_EIM_D21__USBOH3_USBOTG_OC | MUX_PAD_CTRL(NO_PAD_CTRL))
1677#define MX53_PAD_EIM_D22__EMI_WEIM_D_22 (_MX53_PAD_EIM_D22__EMI_WEIM_D_22 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1680#define MX53_PAD_EIM_D22__EMI_WEIM_D_22 (_MX53_PAD_EIM_D22__EMI_WEIM_D_22 | MUX_PAD_CTRL(NO_PAD_CTRL))
1678#define MX53_PAD_EIM_D22__GPIO3_22 (_MX53_PAD_EIM_D22__GPIO3_22 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1681#define MX53_PAD_EIM_D22__GPIO3_22 (_MX53_PAD_EIM_D22__GPIO3_22 | MUX_PAD_CTRL(NO_PAD_CTRL))
@@ -1732,7 +1735,7 @@
1732#define MX53_PAD_EIM_D28__UART2_CTS (_MX53_PAD_EIM_D28__UART2_CTS | MUX_PAD_CTRL(MX53_UART_PAD_CTRL)) 1735#define MX53_PAD_EIM_D28__UART2_CTS (_MX53_PAD_EIM_D28__UART2_CTS | MUX_PAD_CTRL(MX53_UART_PAD_CTRL))
1733#define MX53_PAD_EIM_D28__IPU_DISPB0_SER_DIO (_MX53_PAD_EIM_D28__IPU_DISPB0_SER_DIO | MUX_PAD_CTRL(NO_PAD_CTRL)) 1736#define MX53_PAD_EIM_D28__IPU_DISPB0_SER_DIO (_MX53_PAD_EIM_D28__IPU_DISPB0_SER_DIO | MUX_PAD_CTRL(NO_PAD_CTRL))
1734#define MX53_PAD_EIM_D28__CSPI_MOSI (_MX53_PAD_EIM_D28__CSPI_MOSI | MUX_PAD_CTRL(NO_PAD_CTRL)) 1737#define MX53_PAD_EIM_D28__CSPI_MOSI (_MX53_PAD_EIM_D28__CSPI_MOSI | MUX_PAD_CTRL(NO_PAD_CTRL))
1735#define MX53_PAD_EIM_D28__I2C1_SDA (_MX53_PAD_EIM_D28__I2C1_SDA | MUX_PAD_CTRL(NO_PAD_CTRL)) 1738#define MX53_PAD_EIM_D28__I2C1_SDA (_MX53_PAD_EIM_D28__I2C1_SDA | MUX_PAD_CTRL(PAD_CTRL_I2C))
1736#define MX53_PAD_EIM_D28__IPU_EXT_TRIG (_MX53_PAD_EIM_D28__IPU_EXT_TRIG | MUX_PAD_CTRL(NO_PAD_CTRL)) 1739#define MX53_PAD_EIM_D28__IPU_EXT_TRIG (_MX53_PAD_EIM_D28__IPU_EXT_TRIG | MUX_PAD_CTRL(NO_PAD_CTRL))
1737#define MX53_PAD_EIM_D28__IPU_DI0_PIN13 (_MX53_PAD_EIM_D28__IPU_DI0_PIN13 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1740#define MX53_PAD_EIM_D28__IPU_DI0_PIN13 (_MX53_PAD_EIM_D28__IPU_DI0_PIN13 | MUX_PAD_CTRL(NO_PAD_CTRL))
1738#define MX53_PAD_EIM_D29__EMI_WEIM_D_29 (_MX53_PAD_EIM_D29__EMI_WEIM_D_29 | MUX_PAD_CTRL(NO_PAD_CTRL)) 1741#define MX53_PAD_EIM_D29__EMI_WEIM_D_29 (_MX53_PAD_EIM_D29__EMI_WEIM_D_29 | MUX_PAD_CTRL(NO_PAD_CTRL))
@@ -2297,7 +2300,7 @@
2297#define MX53_PAD_GPIO_9__SCC_FAIL_STATE (_MX53_PAD_GPIO_9__SCC_FAIL_STATE | MUX_PAD_CTRL(NO_PAD_CTRL)) 2300#define MX53_PAD_GPIO_9__SCC_FAIL_STATE (_MX53_PAD_GPIO_9__SCC_FAIL_STATE | MUX_PAD_CTRL(NO_PAD_CTRL))
2298#define MX53_PAD_GPIO_3__ESAI1_HCKR (_MX53_PAD_GPIO_3__ESAI1_HCKR | MUX_PAD_CTRL(NO_PAD_CTRL)) 2301#define MX53_PAD_GPIO_3__ESAI1_HCKR (_MX53_PAD_GPIO_3__ESAI1_HCKR | MUX_PAD_CTRL(NO_PAD_CTRL))
2299#define MX53_PAD_GPIO_3__GPIO1_3 (_MX53_PAD_GPIO_3__GPIO1_3 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2302#define MX53_PAD_GPIO_3__GPIO1_3 (_MX53_PAD_GPIO_3__GPIO1_3 | MUX_PAD_CTRL(NO_PAD_CTRL))
2300#define MX53_PAD_GPIO_3__I2C3_SCL (_MX53_PAD_GPIO_3__I2C3_SCL | MUX_PAD_CTRL(NO_PAD_CTRL)) 2303#define MX53_PAD_GPIO_3__I2C3_SCL (_MX53_PAD_GPIO_3__I2C3_SCL | MUX_PAD_CTRL(PAD_CTRL_I2C))
2301#define MX53_PAD_GPIO_3__DPLLIP1_TOG_EN (_MX53_PAD_GPIO_3__DPLLIP1_TOG_EN | MUX_PAD_CTRL(NO_PAD_CTRL)) 2304#define MX53_PAD_GPIO_3__DPLLIP1_TOG_EN (_MX53_PAD_GPIO_3__DPLLIP1_TOG_EN | MUX_PAD_CTRL(NO_PAD_CTRL))
2302#define MX53_PAD_GPIO_3__CCM_CLKO2 (_MX53_PAD_GPIO_3__CCM_CLKO2 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2305#define MX53_PAD_GPIO_3__CCM_CLKO2 (_MX53_PAD_GPIO_3__CCM_CLKO2 | MUX_PAD_CTRL(NO_PAD_CTRL))
2303#define MX53_PAD_GPIO_3__OBSERVE_MUX_OBSRV_INT_OUT0 (_MX53_PAD_GPIO_3__OBSERVE_MUX_OBSRV_INT_OUT0 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2306#define MX53_PAD_GPIO_3__OBSERVE_MUX_OBSRV_INT_OUT0 (_MX53_PAD_GPIO_3__OBSERVE_MUX_OBSRV_INT_OUT0 | MUX_PAD_CTRL(NO_PAD_CTRL))
@@ -2305,7 +2308,7 @@
2305#define MX53_PAD_GPIO_3__MLB_MLBCLK (_MX53_PAD_GPIO_3__MLB_MLBCLK | MUX_PAD_CTRL(NO_PAD_CTRL)) 2308#define MX53_PAD_GPIO_3__MLB_MLBCLK (_MX53_PAD_GPIO_3__MLB_MLBCLK | MUX_PAD_CTRL(NO_PAD_CTRL))
2306#define MX53_PAD_GPIO_6__ESAI1_SCKT (_MX53_PAD_GPIO_6__ESAI1_SCKT | MUX_PAD_CTRL(NO_PAD_CTRL)) 2309#define MX53_PAD_GPIO_6__ESAI1_SCKT (_MX53_PAD_GPIO_6__ESAI1_SCKT | MUX_PAD_CTRL(NO_PAD_CTRL))
2307#define MX53_PAD_GPIO_6__GPIO1_6 (_MX53_PAD_GPIO_6__GPIO1_6 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2310#define MX53_PAD_GPIO_6__GPIO1_6 (_MX53_PAD_GPIO_6__GPIO1_6 | MUX_PAD_CTRL(NO_PAD_CTRL))
2308#define MX53_PAD_GPIO_6__I2C3_SDA (_MX53_PAD_GPIO_6__I2C3_SDA | MUX_PAD_CTRL(NO_PAD_CTRL)) 2311#define MX53_PAD_GPIO_6__I2C3_SDA (_MX53_PAD_GPIO_6__I2C3_SDA | MUX_PAD_CTRL(PAD_CTRL_I2C))
2309#define MX53_PAD_GPIO_6__CCM_CCM_OUT_0 (_MX53_PAD_GPIO_6__CCM_CCM_OUT_0 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2312#define MX53_PAD_GPIO_6__CCM_CCM_OUT_0 (_MX53_PAD_GPIO_6__CCM_CCM_OUT_0 | MUX_PAD_CTRL(NO_PAD_CTRL))
2310#define MX53_PAD_GPIO_6__CSU_CSU_INT_DEB (_MX53_PAD_GPIO_6__CSU_CSU_INT_DEB | MUX_PAD_CTRL(NO_PAD_CTRL)) 2313#define MX53_PAD_GPIO_6__CSU_CSU_INT_DEB (_MX53_PAD_GPIO_6__CSU_CSU_INT_DEB | MUX_PAD_CTRL(NO_PAD_CTRL))
2311#define MX53_PAD_GPIO_6__OBSERVE_MUX_OBSRV_INT_OUT1 (_MX53_PAD_GPIO_6__OBSERVE_MUX_OBSRV_INT_OUT1 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2314#define MX53_PAD_GPIO_6__OBSERVE_MUX_OBSRV_INT_OUT1 (_MX53_PAD_GPIO_6__OBSERVE_MUX_OBSRV_INT_OUT1 | MUX_PAD_CTRL(NO_PAD_CTRL))
@@ -2333,7 +2336,7 @@
2333#define MX53_PAD_GPIO_5__CCM_CLKO (_MX53_PAD_GPIO_5__CCM_CLKO | MUX_PAD_CTRL(NO_PAD_CTRL)) 2336#define MX53_PAD_GPIO_5__CCM_CLKO (_MX53_PAD_GPIO_5__CCM_CLKO | MUX_PAD_CTRL(NO_PAD_CTRL))
2334#define MX53_PAD_GPIO_5__CSU_CSU_ALARM_AUT_2 (_MX53_PAD_GPIO_5__CSU_CSU_ALARM_AUT_2 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2337#define MX53_PAD_GPIO_5__CSU_CSU_ALARM_AUT_2 (_MX53_PAD_GPIO_5__CSU_CSU_ALARM_AUT_2 | MUX_PAD_CTRL(NO_PAD_CTRL))
2335#define MX53_PAD_GPIO_5__OBSERVE_MUX_OBSRV_INT_OUT4 (_MX53_PAD_GPIO_5__OBSERVE_MUX_OBSRV_INT_OUT4 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2338#define MX53_PAD_GPIO_5__OBSERVE_MUX_OBSRV_INT_OUT4 (_MX53_PAD_GPIO_5__OBSERVE_MUX_OBSRV_INT_OUT4 | MUX_PAD_CTRL(NO_PAD_CTRL))
2336#define MX53_PAD_GPIO_5__I2C3_SCL (_MX53_PAD_GPIO_5__I2C3_SCL | MUX_PAD_CTRL(NO_PAD_CTRL)) 2339#define MX53_PAD_GPIO_5__I2C3_SCL (_MX53_PAD_GPIO_5__I2C3_SCL | MUX_PAD_CTRL(PAD_CTRL_I2C))
2337#define MX53_PAD_GPIO_5__CCM_PLL1_BYP (_MX53_PAD_GPIO_5__CCM_PLL1_BYP | MUX_PAD_CTRL(NO_PAD_CTRL)) 2340#define MX53_PAD_GPIO_5__CCM_PLL1_BYP (_MX53_PAD_GPIO_5__CCM_PLL1_BYP | MUX_PAD_CTRL(NO_PAD_CTRL))
2338#define MX53_PAD_GPIO_7__ESAI1_TX4_RX1 (_MX53_PAD_GPIO_7__ESAI1_TX4_RX1 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2341#define MX53_PAD_GPIO_7__ESAI1_TX4_RX1 (_MX53_PAD_GPIO_7__ESAI1_TX4_RX1 | MUX_PAD_CTRL(NO_PAD_CTRL))
2339#define MX53_PAD_GPIO_7__GPIO1_7 (_MX53_PAD_GPIO_7__GPIO1_7 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2342#define MX53_PAD_GPIO_7__GPIO1_7 (_MX53_PAD_GPIO_7__GPIO1_7 | MUX_PAD_CTRL(NO_PAD_CTRL))
@@ -2356,7 +2359,7 @@
2356#define MX53_PAD_GPIO_16__TZIC_PWRFAIL_INT (_MX53_PAD_GPIO_16__TZIC_PWRFAIL_INT | MUX_PAD_CTRL(NO_PAD_CTRL)) 2359#define MX53_PAD_GPIO_16__TZIC_PWRFAIL_INT (_MX53_PAD_GPIO_16__TZIC_PWRFAIL_INT | MUX_PAD_CTRL(NO_PAD_CTRL))
2357#define MX53_PAD_GPIO_16__RTC_CE_RTC_EXT_TRIG1 (_MX53_PAD_GPIO_16__RTC_CE_RTC_EXT_TRIG1 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2360#define MX53_PAD_GPIO_16__RTC_CE_RTC_EXT_TRIG1 (_MX53_PAD_GPIO_16__RTC_CE_RTC_EXT_TRIG1 | MUX_PAD_CTRL(NO_PAD_CTRL))
2358#define MX53_PAD_GPIO_16__SPDIF_IN1 (_MX53_PAD_GPIO_16__SPDIF_IN1 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2361#define MX53_PAD_GPIO_16__SPDIF_IN1 (_MX53_PAD_GPIO_16__SPDIF_IN1 | MUX_PAD_CTRL(NO_PAD_CTRL))
2359#define MX53_PAD_GPIO_16__I2C3_SDA (_MX53_PAD_GPIO_16__I2C3_SDA | MUX_PAD_CTRL(NO_PAD_CTRL)) 2362#define MX53_PAD_GPIO_16__I2C3_SDA (_MX53_PAD_GPIO_16__I2C3_SDA | MUX_PAD_CTRL(PAD_CTRL_I2C))
2360#define MX53_PAD_GPIO_16__SJC_DE_B (_MX53_PAD_GPIO_16__SJC_DE_B | MUX_PAD_CTRL(NO_PAD_CTRL)) 2363#define MX53_PAD_GPIO_16__SJC_DE_B (_MX53_PAD_GPIO_16__SJC_DE_B | MUX_PAD_CTRL(NO_PAD_CTRL))
2361#define MX53_PAD_GPIO_17__ESAI1_TX0 (_MX53_PAD_GPIO_17__ESAI1_TX0 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2364#define MX53_PAD_GPIO_17__ESAI1_TX0 (_MX53_PAD_GPIO_17__ESAI1_TX0 | MUX_PAD_CTRL(NO_PAD_CTRL))
2362#define MX53_PAD_GPIO_17__GPIO7_12 (_MX53_PAD_GPIO_17__GPIO7_12 | MUX_PAD_CTRL(NO_PAD_CTRL)) 2365#define MX53_PAD_GPIO_17__GPIO7_12 (_MX53_PAD_GPIO_17__GPIO7_12 | MUX_PAD_CTRL(NO_PAD_CTRL))
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index 6e6735f04ee3..bb8f4a6b3e37 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -13,6 +13,7 @@ config ARCH_OMAP1
13 bool "TI OMAP1" 13 bool "TI OMAP1"
14 select CLKDEV_LOOKUP 14 select CLKDEV_LOOKUP
15 select CLKSRC_MMIO 15 select CLKSRC_MMIO
16 select GENERIC_IRQ_CHIP
16 help 17 help
17 "Systems based on omap7xx, omap15xx or omap16xx" 18 "Systems based on omap7xx, omap15xx or omap16xx"
18 19
diff --git a/arch/arm/plat-omap/include/plat/dma.h b/arch/arm/plat-omap/include/plat/dma.h
index d1c916fcf770..dc562a5c0a8a 100644
--- a/arch/arm/plat-omap/include/plat/dma.h
+++ b/arch/arm/plat-omap/include/plat/dma.h
@@ -195,6 +195,11 @@
195 195
196#define OMAP36XX_DMA_UART4_TX 81 /* S_DMA_80 */ 196#define OMAP36XX_DMA_UART4_TX 81 /* S_DMA_80 */
197#define OMAP36XX_DMA_UART4_RX 82 /* S_DMA_81 */ 197#define OMAP36XX_DMA_UART4_RX 82 /* S_DMA_81 */
198
199/* Only for AM35xx */
200#define AM35XX_DMA_UART4_TX 54
201#define AM35XX_DMA_UART4_RX 55
202
198/*----------------------------------------------------------------------------*/ 203/*----------------------------------------------------------------------------*/
199 204
200#define OMAP1_DMA_TOUT_IRQ (1 << 0) 205#define OMAP1_DMA_TOUT_IRQ (1 << 0)
diff --git a/arch/arm/plat-omap/include/plat/irqs.h b/arch/arm/plat-omap/include/plat/irqs.h
index 926d25c780f3..30e10719b774 100644
--- a/arch/arm/plat-omap/include/plat/irqs.h
+++ b/arch/arm/plat-omap/include/plat/irqs.h
@@ -357,6 +357,7 @@
357#define INT_35XX_EMAC_C0_TX_PULSE_IRQ 69 357#define INT_35XX_EMAC_C0_TX_PULSE_IRQ 69
358#define INT_35XX_EMAC_C0_MISC_PULSE_IRQ 70 358#define INT_35XX_EMAC_C0_MISC_PULSE_IRQ 70
359#define INT_35XX_USBOTG_IRQ 71 359#define INT_35XX_USBOTG_IRQ 71
360#define INT_35XX_UART4 84
360#define INT_35XX_CCDC_VD0_IRQ 88 361#define INT_35XX_CCDC_VD0_IRQ 88
361#define INT_35XX_CCDC_VD1_IRQ 92 362#define INT_35XX_CCDC_VD1_IRQ 92
362#define INT_35XX_CCDC_VD2_IRQ 93 363#define INT_35XX_CCDC_VD2_IRQ 93
diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/plat-omap/include/plat/serial.h
index 2723f9166ea2..de3b10c18127 100644
--- a/arch/arm/plat-omap/include/plat/serial.h
+++ b/arch/arm/plat-omap/include/plat/serial.h
@@ -56,6 +56,9 @@
56#define TI816X_UART2_BASE 0x48022000 56#define TI816X_UART2_BASE 0x48022000
57#define TI816X_UART3_BASE 0x48024000 57#define TI816X_UART3_BASE 0x48024000
58 58
59/* AM3505/3517 UART4 */
60#define AM35XX_UART4_BASE 0x4809E000 /* Only on AM3505/3517 */
61
59/* External port on Zoom2/3 */ 62/* External port on Zoom2/3 */
60#define ZOOM_UART_BASE 0x10000000 63#define ZOOM_UART_BASE 0x10000000
61#define ZOOM_UART_VIRT 0xfa400000 64#define ZOOM_UART_VIRT 0xfa400000
diff --git a/arch/arm/plat-omap/iovmm.c b/arch/arm/plat-omap/iovmm.c
index c60737c49a32..79e7fedb8602 100644
--- a/arch/arm/plat-omap/iovmm.c
+++ b/arch/arm/plat-omap/iovmm.c
@@ -423,9 +423,6 @@ static void sgtable_fill_kmalloc(struct sg_table *sgt, u32 pa, u32 da,
423{ 423{
424 unsigned int i; 424 unsigned int i;
425 struct scatterlist *sg; 425 struct scatterlist *sg;
426 void *va;
427
428 va = phys_to_virt(pa);
429 426
430 for_each_sg(sgt->sgl, sg, sgt->nents, i) { 427 for_each_sg(sgt->sgl, sg, sgt->nents, i) {
431 unsigned bytes; 428 unsigned bytes;
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index 3b3776d0a1a7..fff68d0d521b 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -910,7 +910,7 @@ omapl138_case_a3 MACH_OMAPL138_CASE_A3 OMAPL138_CASE_A3 3280
910uemd MACH_UEMD UEMD 3281 910uemd MACH_UEMD UEMD 3281
911ccwmx51mut MACH_CCWMX51MUT CCWMX51MUT 3282 911ccwmx51mut MACH_CCWMX51MUT CCWMX51MUT 3282
912rockhopper MACH_ROCKHOPPER ROCKHOPPER 3283 912rockhopper MACH_ROCKHOPPER ROCKHOPPER 3283
913nookcolor MACH_NOOKCOLOR NOOKCOLOR 3284 913encore MACH_ENCORE ENCORE 3284
914hkdkc100 MACH_HKDKC100 HKDKC100 3285 914hkdkc100 MACH_HKDKC100 HKDKC100 3285
915ts42xx MACH_TS42XX TS42XX 3286 915ts42xx MACH_TS42XX TS42XX 3286
916aebl MACH_AEBL AEBL 3287 916aebl MACH_AEBL AEBL 3287
diff --git a/arch/cris/include/asm/serial.h b/arch/cris/include/asm/serial.h
new file mode 100644
index 000000000000..af7535a955fb
--- /dev/null
+++ b/arch/cris/include/asm/serial.h
@@ -0,0 +1,9 @@
1#ifndef _ASM_SERIAL_H
2#define _ASM_SERIAL_H
3
4/*
5 * This assumes you have a 1.8432 MHz clock for your UART.
6 */
7#define BASE_BAUD (1843200 / 16)
8
9#endif /* _ASM_SERIAL_H */
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 124854714958..3ff7785b3beb 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -162,7 +162,6 @@ config IA64_GENERIC
162 select ACPI_NUMA 162 select ACPI_NUMA
163 select SWIOTLB 163 select SWIOTLB
164 select PCI_MSI 164 select PCI_MSI
165 select DMAR
166 help 165 help
167 This selects the system type of your hardware. A "generic" kernel 166 This selects the system type of your hardware. A "generic" kernel
168 will run on any supported IA-64 system. However, if you configure 167 will run on any supported IA-64 system. However, if you configure
diff --git a/arch/ia64/configs/generic_defconfig b/arch/ia64/configs/generic_defconfig
index 1d7bca0a396d..0e5cd1405e0e 100644
--- a/arch/ia64/configs/generic_defconfig
+++ b/arch/ia64/configs/generic_defconfig
@@ -234,3 +234,4 @@ CONFIG_CRYPTO_MD5=y
234# CONFIG_CRYPTO_ANSI_CPRNG is not set 234# CONFIG_CRYPTO_ANSI_CPRNG is not set
235CONFIG_CRC_T10DIF=y 235CONFIG_CRC_T10DIF=y
236CONFIG_MISC_DEVICES=y 236CONFIG_MISC_DEVICES=y
237CONFIG_DMAR=y
diff --git a/arch/m68k/include/asm/page_mm.h b/arch/m68k/include/asm/page_mm.h
index 31d5570d6567..89f201434b5a 100644
--- a/arch/m68k/include/asm/page_mm.h
+++ b/arch/m68k/include/asm/page_mm.h
@@ -162,7 +162,7 @@ static inline __attribute_const__ int __virt_to_node_shift(void)
162 pgdat->node_mem_map + (__pfn - pgdat->node_start_pfn); \ 162 pgdat->node_mem_map + (__pfn - pgdat->node_start_pfn); \
163}) 163})
164#define page_to_pfn(_page) ({ \ 164#define page_to_pfn(_page) ({ \
165 struct page *__p = (_page); \ 165 const struct page *__p = (_page); \
166 struct pglist_data *pgdat; \ 166 struct pglist_data *pgdat; \
167 pgdat = &pg_data_map[page_to_nid(__p)]; \ 167 pgdat = &pg_data_map[page_to_nid(__p)]; \
168 ((__p) - pgdat->node_mem_map) + pgdat->node_start_pfn; \ 168 ((__p) - pgdat->node_mem_map) + pgdat->node_start_pfn; \
diff --git a/arch/powerpc/include/asm/jump_label.h b/arch/powerpc/include/asm/jump_label.h
index 1f780b95c0f0..938986e412f1 100644
--- a/arch/powerpc/include/asm/jump_label.h
+++ b/arch/powerpc/include/asm/jump_label.h
@@ -22,7 +22,6 @@ static __always_inline bool arch_static_branch(struct jump_label_key *key)
22 asm goto("1:\n\t" 22 asm goto("1:\n\t"
23 "nop\n\t" 23 "nop\n\t"
24 ".pushsection __jump_table, \"aw\"\n\t" 24 ".pushsection __jump_table, \"aw\"\n\t"
25 ".align 4\n\t"
26 JUMP_ENTRY_TYPE "1b, %l[l_yes], %c0\n\t" 25 JUMP_ENTRY_TYPE "1b, %l[l_yes], %c0\n\t"
27 ".popsection \n\t" 26 ".popsection \n\t"
28 : : "i" (key) : : l_yes); 27 : : "i" (key) : : l_yes);
@@ -41,7 +40,6 @@ struct jump_entry {
41 jump_label_t code; 40 jump_label_t code;
42 jump_label_t target; 41 jump_label_t target;
43 jump_label_t key; 42 jump_label_t key;
44 jump_label_t pad;
45}; 43};
46 44
47#endif /* _ASM_POWERPC_JUMP_LABEL_H */ 45#endif /* _ASM_POWERPC_JUMP_LABEL_H */
diff --git a/arch/powerpc/include/asm/kdump.h b/arch/powerpc/include/asm/kdump.h
index 6857af58b02e..bffd062adf79 100644
--- a/arch/powerpc/include/asm/kdump.h
+++ b/arch/powerpc/include/asm/kdump.h
@@ -3,17 +3,7 @@
3 3
4#include <asm/page.h> 4#include <asm/page.h>
5 5
6/*
7 * If CONFIG_RELOCATABLE is enabled we can place the kdump kernel anywhere.
8 * To keep enough space in the RMO for the first stage kernel on 64bit, we
9 * place it at 64MB. If CONFIG_RELOCATABLE is not enabled we must place
10 * the second stage at 32MB.
11 */
12#if defined(CONFIG_RELOCATABLE) && defined(CONFIG_PPC64)
13#define KDUMP_KERNELBASE 0x4000000
14#else
15#define KDUMP_KERNELBASE 0x2000000 6#define KDUMP_KERNELBASE 0x2000000
16#endif
17 7
18/* How many bytes to reserve at zero for kdump. The reserve limit should 8/* How many bytes to reserve at zero for kdump. The reserve limit should
19 * be greater or equal to the trampoline's end address. 9 * be greater or equal to the trampoline's end address.
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index e8aaf6fce38b..559da199edb5 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -1003,7 +1003,6 @@
1003#define PV_970 0x0039 1003#define PV_970 0x0039
1004#define PV_POWER5 0x003A 1004#define PV_POWER5 0x003A
1005#define PV_POWER5p 0x003B 1005#define PV_POWER5p 0x003B
1006#define PV_POWER7 0x003F
1007#define PV_970FX 0x003C 1006#define PV_970FX 0x003C
1008#define PV_POWER6 0x003E 1007#define PV_POWER6 0x003E
1009#define PV_POWER7 0x003F 1008#define PV_POWER7 0x003F
@@ -1024,13 +1023,16 @@
1024#define mtmsrd(v) __mtmsrd((v), 0) 1023#define mtmsrd(v) __mtmsrd((v), 0)
1025#define mtmsr(v) mtmsrd(v) 1024#define mtmsr(v) mtmsrd(v)
1026#else 1025#else
1027#define mtmsr(v) asm volatile("mtmsr %0" : : "r" (v) : "memory") 1026#define mtmsr(v) asm volatile("mtmsr %0" : \
1027 : "r" ((unsigned long)(v)) \
1028 : "memory")
1028#endif 1029#endif
1029 1030
1030#define mfspr(rn) ({unsigned long rval; \ 1031#define mfspr(rn) ({unsigned long rval; \
1031 asm volatile("mfspr %0," __stringify(rn) \ 1032 asm volatile("mfspr %0," __stringify(rn) \
1032 : "=r" (rval)); rval;}) 1033 : "=r" (rval)); rval;})
1033#define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v)\ 1034#define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : \
1035 : "r" ((unsigned long)(v)) \
1034 : "memory") 1036 : "memory")
1035 1037
1036#ifdef __powerpc64__ 1038#ifdef __powerpc64__
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 9fb933248ab6..fa44ff538861 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -2051,7 +2051,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
2051 2051
2052static struct cpu_spec the_cpu_spec; 2052static struct cpu_spec the_cpu_spec;
2053 2053
2054static void __init setup_cpu_spec(unsigned long offset, struct cpu_spec *s) 2054static struct cpu_spec * __init setup_cpu_spec(unsigned long offset,
2055 struct cpu_spec *s)
2055{ 2056{
2056 struct cpu_spec *t = &the_cpu_spec; 2057 struct cpu_spec *t = &the_cpu_spec;
2057 struct cpu_spec old; 2058 struct cpu_spec old;
@@ -2114,6 +2115,8 @@ static void __init setup_cpu_spec(unsigned long offset, struct cpu_spec *s)
2114 t->cpu_setup(offset, t); 2115 t->cpu_setup(offset, t);
2115 } 2116 }
2116#endif /* CONFIG_PPC64 || CONFIG_BOOKE */ 2117#endif /* CONFIG_PPC64 || CONFIG_BOOKE */
2118
2119 return t;
2117} 2120}
2118 2121
2119struct cpu_spec * __init identify_cpu(unsigned long offset, unsigned int pvr) 2122struct cpu_spec * __init identify_cpu(unsigned long offset, unsigned int pvr)
@@ -2124,10 +2127,8 @@ struct cpu_spec * __init identify_cpu(unsigned long offset, unsigned int pvr)
2124 s = PTRRELOC(s); 2127 s = PTRRELOC(s);
2125 2128
2126 for (i = 0; i < ARRAY_SIZE(cpu_specs); i++,s++) { 2129 for (i = 0; i < ARRAY_SIZE(cpu_specs); i++,s++) {
2127 if ((pvr & s->pvr_mask) == s->pvr_value) { 2130 if ((pvr & s->pvr_mask) == s->pvr_value)
2128 setup_cpu_spec(offset, s); 2131 return setup_cpu_spec(offset, s);
2129 return s;
2130 }
2131 } 2132 }
2132 2133
2133 BUG(); 2134 BUG();
diff --git a/arch/powerpc/kernel/iomap.c b/arch/powerpc/kernel/iomap.c
index 1577434f4088..b25f6325fc70 100644
--- a/arch/powerpc/kernel/iomap.c
+++ b/arch/powerpc/kernel/iomap.c
@@ -117,6 +117,7 @@ void ioport_unmap(void __iomem *addr)
117EXPORT_SYMBOL(ioport_map); 117EXPORT_SYMBOL(ioport_map);
118EXPORT_SYMBOL(ioport_unmap); 118EXPORT_SYMBOL(ioport_unmap);
119 119
120#ifdef CONFIG_PCI
120void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) 121void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
121{ 122{
122 resource_size_t start = pci_resource_start(dev, bar); 123 resource_size_t start = pci_resource_start(dev, bar);
@@ -146,3 +147,4 @@ void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
146 147
147EXPORT_SYMBOL(pci_iomap); 148EXPORT_SYMBOL(pci_iomap);
148EXPORT_SYMBOL(pci_iounmap); 149EXPORT_SYMBOL(pci_iounmap);
150#endif /* CONFIG_PCI */
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index 6658a1589955..9ce1672afb59 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -136,12 +136,16 @@ void __init reserve_crashkernel(void)
136 crashk_res.start = KDUMP_KERNELBASE; 136 crashk_res.start = KDUMP_KERNELBASE;
137#else 137#else
138 if (!crashk_res.start) { 138 if (!crashk_res.start) {
139#ifdef CONFIG_PPC64
139 /* 140 /*
140 * unspecified address, choose a region of specified size 141 * On 64bit we split the RMO in half but cap it at half of
141 * can overlap with initrd (ignoring corruption when retained) 142 * a small SLB (128MB) since the crash kernel needs to place
142 * ppc64 requires kernel and some stacks to be in first segemnt 143 * itself and some stacks to be in the first segment.
143 */ 144 */
145 crashk_res.start = min(0x80000000ULL, (ppc64_rma_size / 2));
146#else
144 crashk_res.start = KDUMP_KERNELBASE; 147 crashk_res.start = KDUMP_KERNELBASE;
148#endif
145 } 149 }
146 150
147 crash_base = PAGE_ALIGN(crashk_res.start); 151 crash_base = PAGE_ALIGN(crashk_res.start);
diff --git a/arch/powerpc/kernel/perf_callchain.c b/arch/powerpc/kernel/perf_callchain.c
index d05ae4204bbf..564c1d8bdb5c 100644
--- a/arch/powerpc/kernel/perf_callchain.c
+++ b/arch/powerpc/kernel/perf_callchain.c
@@ -154,8 +154,12 @@ static int read_user_stack_64(unsigned long __user *ptr, unsigned long *ret)
154 ((unsigned long)ptr & 7)) 154 ((unsigned long)ptr & 7))
155 return -EFAULT; 155 return -EFAULT;
156 156
157 if (!__get_user_inatomic(*ret, ptr)) 157 pagefault_disable();
158 if (!__get_user_inatomic(*ret, ptr)) {
159 pagefault_enable();
158 return 0; 160 return 0;
161 }
162 pagefault_enable();
159 163
160 return read_user_stack_slow(ptr, ret, 8); 164 return read_user_stack_slow(ptr, ret, 8);
161} 165}
@@ -166,8 +170,12 @@ static int read_user_stack_32(unsigned int __user *ptr, unsigned int *ret)
166 ((unsigned long)ptr & 3)) 170 ((unsigned long)ptr & 3))
167 return -EFAULT; 171 return -EFAULT;
168 172
169 if (!__get_user_inatomic(*ret, ptr)) 173 pagefault_disable();
174 if (!__get_user_inatomic(*ret, ptr)) {
175 pagefault_enable();
170 return 0; 176 return 0;
177 }
178 pagefault_enable();
171 179
172 return read_user_stack_slow(ptr, ret, 4); 180 return read_user_stack_slow(ptr, ret, 4);
173} 181}
@@ -294,11 +302,17 @@ static inline int current_is_64bit(void)
294 */ 302 */
295static int read_user_stack_32(unsigned int __user *ptr, unsigned int *ret) 303static int read_user_stack_32(unsigned int __user *ptr, unsigned int *ret)
296{ 304{
305 int rc;
306
297 if ((unsigned long)ptr > TASK_SIZE - sizeof(unsigned int) || 307 if ((unsigned long)ptr > TASK_SIZE - sizeof(unsigned int) ||
298 ((unsigned long)ptr & 3)) 308 ((unsigned long)ptr & 3))
299 return -EFAULT; 309 return -EFAULT;
300 310
301 return __get_user_inatomic(*ret, ptr); 311 pagefault_disable();
312 rc = __get_user_inatomic(*ret, ptr);
313 pagefault_enable();
314
315 return rc;
302} 316}
303 317
304static inline void perf_callchain_user_64(struct perf_callchain_entry *entry, 318static inline void perf_callchain_user_64(struct perf_callchain_entry *entry,
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index c016033ba78d..a909f4e9343b 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -1020,7 +1020,7 @@ static unsigned long __init alloc_up(unsigned long size, unsigned long align)
1020 } 1020 }
1021 if (addr == 0) 1021 if (addr == 0)
1022 return 0; 1022 return 0;
1023 RELOC(alloc_bottom) = addr; 1023 RELOC(alloc_bottom) = addr + size;
1024 1024
1025 prom_debug(" -> %x\n", addr); 1025 prom_debug(" -> %x\n", addr);
1026 prom_debug(" alloc_bottom : %x\n", RELOC(alloc_bottom)); 1026 prom_debug(" alloc_bottom : %x\n", RELOC(alloc_bottom));
@@ -1830,11 +1830,13 @@ static void __init *make_room(unsigned long *mem_start, unsigned long *mem_end,
1830 if (room > DEVTREE_CHUNK_SIZE) 1830 if (room > DEVTREE_CHUNK_SIZE)
1831 room = DEVTREE_CHUNK_SIZE; 1831 room = DEVTREE_CHUNK_SIZE;
1832 if (room < PAGE_SIZE) 1832 if (room < PAGE_SIZE)
1833 prom_panic("No memory for flatten_device_tree (no room)"); 1833 prom_panic("No memory for flatten_device_tree "
1834 "(no room)\n");
1834 chunk = alloc_up(room, 0); 1835 chunk = alloc_up(room, 0);
1835 if (chunk == 0) 1836 if (chunk == 0)
1836 prom_panic("No memory for flatten_device_tree (claim failed)"); 1837 prom_panic("No memory for flatten_device_tree "
1837 *mem_end = RELOC(alloc_top); 1838 "(claim failed)\n");
1839 *mem_end = chunk + room;
1838 } 1840 }
1839 1841
1840 ret = (void *)*mem_start; 1842 ret = (void *)*mem_start;
@@ -2042,7 +2044,7 @@ static void __init flatten_device_tree(void)
2042 2044
2043 /* 2045 /*
2044 * Check how much room we have between alloc top & bottom (+/- a 2046 * Check how much room we have between alloc top & bottom (+/- a
2045 * few pages), crop to 4Mb, as this is our "chuck" size 2047 * few pages), crop to 1MB, as this is our "chunk" size
2046 */ 2048 */
2047 room = RELOC(alloc_top) - RELOC(alloc_bottom) - 0x4000; 2049 room = RELOC(alloc_top) - RELOC(alloc_bottom) - 0x4000;
2048 if (room > DEVTREE_CHUNK_SIZE) 2050 if (room > DEVTREE_CHUNK_SIZE)
@@ -2053,7 +2055,7 @@ static void __init flatten_device_tree(void)
2053 mem_start = (unsigned long)alloc_up(room, PAGE_SIZE); 2055 mem_start = (unsigned long)alloc_up(room, PAGE_SIZE);
2054 if (mem_start == 0) 2056 if (mem_start == 0)
2055 prom_panic("Can't allocate initial device-tree chunk\n"); 2057 prom_panic("Can't allocate initial device-tree chunk\n");
2056 mem_end = RELOC(alloc_top); 2058 mem_end = mem_start + room;
2057 2059
2058 /* Get root of tree */ 2060 /* Get root of tree */
2059 root = call_prom("peer", 1, 1, (phandle)0); 2061 root = call_prom("peer", 1, 1, (phandle)0);
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index 6dd33581a228..de2950135e6e 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -1251,7 +1251,7 @@ BEGIN_FTR_SECTION
1251 reg = 0 1251 reg = 0
1252 .rept 32 1252 .rept 32
1253 li r6,reg*16+VCPU_VSRS 1253 li r6,reg*16+VCPU_VSRS
1254 stxvd2x reg,r6,r3 1254 STXVD2X(reg,r6,r3)
1255 reg = reg + 1 1255 reg = reg + 1
1256 .endr 1256 .endr
1257FTR_SECTION_ELSE 1257FTR_SECTION_ELSE
@@ -1313,7 +1313,7 @@ BEGIN_FTR_SECTION
1313 reg = 0 1313 reg = 0
1314 .rept 32 1314 .rept 32
1315 li r7,reg*16+VCPU_VSRS 1315 li r7,reg*16+VCPU_VSRS
1316 lxvd2x reg,r7,r4 1316 LXVD2X(reg,r7,r4)
1317 reg = reg + 1 1317 reg = reg + 1
1318 .endr 1318 .endr
1319FTR_SECTION_ELSE 1319FTR_SECTION_ELSE
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index d0af7fb2f344..b9ba86191aed 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -24,7 +24,7 @@ source "arch/powerpc/platforms/wsp/Kconfig"
24 24
25config KVM_GUEST 25config KVM_GUEST
26 bool "KVM Guest support" 26 bool "KVM Guest support"
27 default y 27 default n
28 ---help--- 28 ---help---
29 This option enables various optimizations for running under the KVM 29 This option enables various optimizations for running under the KVM
30 hypervisor. Overhead for the kernel when not running inside KVM should 30 hypervisor. Overhead for the kernel when not running inside KVM should
diff --git a/arch/powerpc/platforms/pseries/dtl.c b/arch/powerpc/platforms/pseries/dtl.c
index e9190073bb97..0e8656370063 100644
--- a/arch/powerpc/platforms/pseries/dtl.c
+++ b/arch/powerpc/platforms/pseries/dtl.c
@@ -181,7 +181,7 @@ static void dtl_stop(struct dtl *dtl)
181 181
182 lppaca_of(dtl->cpu).dtl_enable_mask = 0x0; 182 lppaca_of(dtl->cpu).dtl_enable_mask = 0x0;
183 183
184 unregister_dtl(hwcpu, __pa(dtl->buf)); 184 unregister_dtl(hwcpu);
185} 185}
186 186
187static u64 dtl_current_index(struct dtl *dtl) 187static u64 dtl_current_index(struct dtl *dtl)
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index bc0288501f17..83a3ca2fd282 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -135,7 +135,7 @@ static void pseries_mach_cpu_die(void)
135 get_lppaca()->idle = 0; 135 get_lppaca()->idle = 0;
136 136
137 if (get_preferred_offline_state(cpu) == CPU_STATE_ONLINE) { 137 if (get_preferred_offline_state(cpu) == CPU_STATE_ONLINE) {
138 unregister_slb_shadow(hwcpu, __pa(get_slb_shadow())); 138 unregister_slb_shadow(hwcpu);
139 139
140 /* 140 /*
141 * Call to start_secondary_resume() will not return. 141 * Call to start_secondary_resume() will not return.
@@ -150,7 +150,7 @@ static void pseries_mach_cpu_die(void)
150 WARN_ON(get_preferred_offline_state(cpu) != CPU_STATE_OFFLINE); 150 WARN_ON(get_preferred_offline_state(cpu) != CPU_STATE_OFFLINE);
151 151
152 set_cpu_current_state(cpu, CPU_STATE_OFFLINE); 152 set_cpu_current_state(cpu, CPU_STATE_OFFLINE);
153 unregister_slb_shadow(hwcpu, __pa(get_slb_shadow())); 153 unregister_slb_shadow(hwcpu);
154 rtas_stop_self(); 154 rtas_stop_self();
155 155
156 /* Should never get here... */ 156 /* Should never get here... */
diff --git a/arch/powerpc/platforms/pseries/io_event_irq.c b/arch/powerpc/platforms/pseries/io_event_irq.c
index c829e6067d54..2c4dd1fb8333 100644
--- a/arch/powerpc/platforms/pseries/io_event_irq.c
+++ b/arch/powerpc/platforms/pseries/io_event_irq.c
@@ -212,17 +212,15 @@ static int __init ioei_init(void)
212 struct device_node *np; 212 struct device_node *np;
213 213
214 ioei_check_exception_token = rtas_token("check-exception"); 214 ioei_check_exception_token = rtas_token("check-exception");
215 if (ioei_check_exception_token == RTAS_UNKNOWN_SERVICE) { 215 if (ioei_check_exception_token == RTAS_UNKNOWN_SERVICE)
216 pr_warning("IO Event IRQ not supported on this system !\n");
217 return -ENODEV; 216 return -ENODEV;
218 } 217
219 np = of_find_node_by_path("/event-sources/ibm,io-events"); 218 np = of_find_node_by_path("/event-sources/ibm,io-events");
220 if (np) { 219 if (np) {
221 request_event_sources_irqs(np, ioei_interrupt, "IO_EVENT"); 220 request_event_sources_irqs(np, ioei_interrupt, "IO_EVENT");
221 pr_info("IBM I/O event interrupts enabled\n");
222 of_node_put(np); 222 of_node_put(np);
223 } else { 223 } else {
224 pr_err("io_event_irq: No ibm,io-events on system! "
225 "IO Event interrupt disabled.\n");
226 return -ENODEV; 224 return -ENODEV;
227 } 225 }
228 return 0; 226 return 0;
diff --git a/arch/powerpc/platforms/pseries/kexec.c b/arch/powerpc/platforms/pseries/kexec.c
index 54cf3a4aa16b..7d94bdc63d50 100644
--- a/arch/powerpc/platforms/pseries/kexec.c
+++ b/arch/powerpc/platforms/pseries/kexec.c
@@ -25,20 +25,30 @@ static void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
25{ 25{
26 /* Don't risk a hypervisor call if we're crashing */ 26 /* Don't risk a hypervisor call if we're crashing */
27 if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) { 27 if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) {
28 unsigned long addr; 28 int ret;
29 int cpu = smp_processor_id();
30 int hwcpu = hard_smp_processor_id();
29 31
30 addr = __pa(get_slb_shadow()); 32 if (get_lppaca()->dtl_enable_mask) {
31 if (unregister_slb_shadow(hard_smp_processor_id(), addr)) 33 ret = unregister_dtl(hwcpu);
32 printk("SLB shadow buffer deregistration of " 34 if (ret) {
33 "cpu %u (hw_cpu_id %d) failed\n", 35 pr_err("WARNING: DTL deregistration for cpu "
34 smp_processor_id(), 36 "%d (hw %d) failed with %d\n",
35 hard_smp_processor_id()); 37 cpu, hwcpu, ret);
38 }
39 }
40
41 ret = unregister_slb_shadow(hwcpu);
42 if (ret) {
43 pr_err("WARNING: SLB shadow buffer deregistration "
44 "for cpu %d (hw %d) failed with %d\n",
45 cpu, hwcpu, ret);
46 }
36 47
37 addr = __pa(get_lppaca()); 48 ret = unregister_vpa(hwcpu);
38 if (unregister_vpa(hard_smp_processor_id(), addr)) { 49 if (ret) {
39 printk("VPA deregistration of cpu %u (hw_cpu_id %d) " 50 pr_err("WARNING: VPA deregistration for cpu %d "
40 "failed\n", smp_processor_id(), 51 "(hw %d) failed with %d\n", cpu, hwcpu, ret);
41 hard_smp_processor_id());
42 } 52 }
43 } 53 }
44} 54}
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index f7205d344efd..c9a29dae8c05 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -67,9 +67,8 @@ void vpa_init(int cpu)
67 ret = register_vpa(hwcpu, addr); 67 ret = register_vpa(hwcpu, addr);
68 68
69 if (ret) { 69 if (ret) {
70 printk(KERN_ERR "WARNING: vpa_init: VPA registration for " 70 pr_err("WARNING: VPA registration for cpu %d (hw %d) of area "
71 "cpu %d (hw %d) of area %lx returns %ld\n", 71 "%lx failed with %ld\n", cpu, hwcpu, addr, ret);
72 cpu, hwcpu, addr, ret);
73 return; 72 return;
74 } 73 }
75 /* 74 /*
@@ -80,10 +79,9 @@ void vpa_init(int cpu)
80 if (firmware_has_feature(FW_FEATURE_SPLPAR)) { 79 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
81 ret = register_slb_shadow(hwcpu, addr); 80 ret = register_slb_shadow(hwcpu, addr);
82 if (ret) 81 if (ret)
83 printk(KERN_ERR 82 pr_err("WARNING: SLB shadow buffer registration for "
84 "WARNING: vpa_init: SLB shadow buffer " 83 "cpu %d (hw %d) of area %lx failed with %ld\n",
85 "registration for cpu %d (hw %d) of area %lx " 84 cpu, hwcpu, addr, ret);
86 "returns %ld\n", cpu, hwcpu, addr, ret);
87 } 85 }
88 86
89 /* 87 /*
@@ -100,8 +98,9 @@ void vpa_init(int cpu)
100 dtl->enqueue_to_dispatch_time = DISPATCH_LOG_BYTES; 98 dtl->enqueue_to_dispatch_time = DISPATCH_LOG_BYTES;
101 ret = register_dtl(hwcpu, __pa(dtl)); 99 ret = register_dtl(hwcpu, __pa(dtl));
102 if (ret) 100 if (ret)
103 pr_warn("DTL registration failed for cpu %d (%ld)\n", 101 pr_err("WARNING: DTL registration of cpu %d (hw %d) "
104 cpu, ret); 102 "failed with %ld\n", smp_processor_id(),
103 hwcpu, ret);
105 lppaca_of(cpu).dtl_enable_mask = 2; 104 lppaca_of(cpu).dtl_enable_mask = 2;
106 } 105 }
107} 106}
@@ -204,7 +203,7 @@ static void pSeries_lpar_hptab_clear(void)
204 unsigned long ptel; 203 unsigned long ptel;
205 } ptes[4]; 204 } ptes[4];
206 long lpar_rc; 205 long lpar_rc;
207 int i, j; 206 unsigned long i, j;
208 207
209 /* Read in batches of 4, 208 /* Read in batches of 4,
210 * invalidate only valid entries not in the VRMA 209 * invalidate only valid entries not in the VRMA
diff --git a/arch/powerpc/platforms/pseries/plpar_wrappers.h b/arch/powerpc/platforms/pseries/plpar_wrappers.h
index 4bf21207d7d3..41c24c146d6a 100644
--- a/arch/powerpc/platforms/pseries/plpar_wrappers.h
+++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h
@@ -53,9 +53,9 @@ static inline long vpa_call(unsigned long flags, unsigned long cpu,
53 return plpar_hcall_norets(H_REGISTER_VPA, flags, cpu, vpa); 53 return plpar_hcall_norets(H_REGISTER_VPA, flags, cpu, vpa);
54} 54}
55 55
56static inline long unregister_vpa(unsigned long cpu, unsigned long vpa) 56static inline long unregister_vpa(unsigned long cpu)
57{ 57{
58 return vpa_call(0x5, cpu, vpa); 58 return vpa_call(0x5, cpu, 0);
59} 59}
60 60
61static inline long register_vpa(unsigned long cpu, unsigned long vpa) 61static inline long register_vpa(unsigned long cpu, unsigned long vpa)
@@ -63,9 +63,9 @@ static inline long register_vpa(unsigned long cpu, unsigned long vpa)
63 return vpa_call(0x1, cpu, vpa); 63 return vpa_call(0x1, cpu, vpa);
64} 64}
65 65
66static inline long unregister_slb_shadow(unsigned long cpu, unsigned long vpa) 66static inline long unregister_slb_shadow(unsigned long cpu)
67{ 67{
68 return vpa_call(0x7, cpu, vpa); 68 return vpa_call(0x7, cpu, 0);
69} 69}
70 70
71static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa) 71static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa)
@@ -73,9 +73,9 @@ static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa)
73 return vpa_call(0x3, cpu, vpa); 73 return vpa_call(0x3, cpu, vpa);
74} 74}
75 75
76static inline long unregister_dtl(unsigned long cpu, unsigned long vpa) 76static inline long unregister_dtl(unsigned long cpu)
77{ 77{
78 return vpa_call(0x6, cpu, vpa); 78 return vpa_call(0x6, cpu, 0);
79} 79}
80 80
81static inline long register_dtl(unsigned long cpu, unsigned long vpa) 81static inline long register_dtl(unsigned long cpu, unsigned long vpa)
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index d00e52926b71..0969fd98c4fa 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -324,8 +324,9 @@ static int alloc_dispatch_logs(void)
324 dtl->enqueue_to_dispatch_time = DISPATCH_LOG_BYTES; 324 dtl->enqueue_to_dispatch_time = DISPATCH_LOG_BYTES;
325 ret = register_dtl(hard_smp_processor_id(), __pa(dtl)); 325 ret = register_dtl(hard_smp_processor_id(), __pa(dtl));
326 if (ret) 326 if (ret)
327 pr_warn("DTL registration failed for boot cpu %d (%d)\n", 327 pr_err("WARNING: DTL registration of cpu %d (hw %d) failed "
328 smp_processor_id(), ret); 328 "with %d\n", smp_processor_id(),
329 hard_smp_processor_id(), ret);
329 get_paca()->lppaca_ptr->dtl_enable_mask = 2; 330 get_paca()->lppaca_ptr->dtl_enable_mask = 2;
330 331
331 return 0; 332 return 0;
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 2de8551df40f..c65f75aa7ff7 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -54,6 +54,7 @@
54#define ODSR_CLEAR 0x1c00 54#define ODSR_CLEAR 0x1c00
55#define LTLEECSR_ENABLE_ALL 0xFFC000FC 55#define LTLEECSR_ENABLE_ALL 0xFFC000FC
56#define ESCSR_CLEAR 0x07120204 56#define ESCSR_CLEAR 0x07120204
57#define IECSR_CLEAR 0x80000000
57 58
58#define RIO_PORT1_EDCSR 0x0640 59#define RIO_PORT1_EDCSR 0x0640
59#define RIO_PORT2_EDCSR 0x0680 60#define RIO_PORT2_EDCSR 0x0680
@@ -1089,11 +1090,11 @@ static void port_error_handler(struct rio_mport *port, int offset)
1089 1090
1090 if (offset == 0) { 1091 if (offset == 0) {
1091 out_be32((u32 *)(rio_regs_win + RIO_PORT1_EDCSR), 0); 1092 out_be32((u32 *)(rio_regs_win + RIO_PORT1_EDCSR), 0);
1092 out_be32((u32 *)(rio_regs_win + RIO_PORT1_IECSR), 0); 1093 out_be32((u32 *)(rio_regs_win + RIO_PORT1_IECSR), IECSR_CLEAR);
1093 out_be32((u32 *)(rio_regs_win + RIO_ESCSR), ESCSR_CLEAR); 1094 out_be32((u32 *)(rio_regs_win + RIO_ESCSR), ESCSR_CLEAR);
1094 } else { 1095 } else {
1095 out_be32((u32 *)(rio_regs_win + RIO_PORT2_EDCSR), 0); 1096 out_be32((u32 *)(rio_regs_win + RIO_PORT2_EDCSR), 0);
1096 out_be32((u32 *)(rio_regs_win + RIO_PORT2_IECSR), 0); 1097 out_be32((u32 *)(rio_regs_win + RIO_PORT2_IECSR), IECSR_CLEAR);
1097 out_be32((u32 *)(rio_regs_win + RIO_PORT2_ESCSR), ESCSR_CLEAR); 1098 out_be32((u32 *)(rio_regs_win + RIO_PORT2_ESCSR), ESCSR_CLEAR);
1098 } 1099 }
1099} 1100}
diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c
index a59ba96d2c21..dbfe96bc878a 100644
--- a/arch/powerpc/sysdev/ppc4xx_pci.c
+++ b/arch/powerpc/sysdev/ppc4xx_pci.c
@@ -655,8 +655,6 @@ struct ppc4xx_pciex_hwops
655 655
656static struct ppc4xx_pciex_hwops *ppc4xx_pciex_hwops; 656static struct ppc4xx_pciex_hwops *ppc4xx_pciex_hwops;
657 657
658#ifdef CONFIG_44x
659
660static int __init ppc4xx_pciex_wait_on_sdr(struct ppc4xx_pciex_port *port, 658static int __init ppc4xx_pciex_wait_on_sdr(struct ppc4xx_pciex_port *port,
661 unsigned int sdr_offset, 659 unsigned int sdr_offset,
662 unsigned int mask, 660 unsigned int mask,
@@ -688,6 +686,7 @@ static int __init ppc4xx_pciex_port_reset_sdr(struct ppc4xx_pciex_port *port)
688 return 0; 686 return 0;
689} 687}
690 688
689
691static void __init ppc4xx_pciex_check_link_sdr(struct ppc4xx_pciex_port *port) 690static void __init ppc4xx_pciex_check_link_sdr(struct ppc4xx_pciex_port *port)
692{ 691{
693 printk(KERN_INFO "PCIE%d: Checking link...\n", port->index); 692 printk(KERN_INFO "PCIE%d: Checking link...\n", port->index);
@@ -718,6 +717,8 @@ static void __init ppc4xx_pciex_check_link_sdr(struct ppc4xx_pciex_port *port)
718 printk(KERN_INFO "PCIE%d: No device detected.\n", port->index); 717 printk(KERN_INFO "PCIE%d: No device detected.\n", port->index);
719} 718}
720 719
720#ifdef CONFIG_44x
721
721/* Check various reset bits of the 440SPe PCIe core */ 722/* Check various reset bits of the 440SPe PCIe core */
722static int __init ppc440spe_pciex_check_reset(struct device_node *np) 723static int __init ppc440spe_pciex_check_reset(struct device_node *np)
723{ 724{
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
index e915deafac89..05559295d2ca 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
@@ -15,6 +15,7 @@
15#include <linux/serial_sci.h> 15#include <linux/serial_sci.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/dma-mapping.h>
18#include <linux/sh_timer.h> 19#include <linux/sh_timer.h>
19#include <linux/sh_dma.h> 20#include <linux/sh_dma.h>
20 21
diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c
index d9006f8ffc14..7bbef95c9d1b 100644
--- a/arch/sh/kernel/traps_32.c
+++ b/arch/sh/kernel/traps_32.c
@@ -316,6 +316,35 @@ static int handle_unaligned_ins(insn_size_t instruction, struct pt_regs *regs,
316 break; 316 break;
317 } 317 }
318 break; 318 break;
319
320 case 9: /* mov.w @(disp,PC),Rn */
321 srcu = (unsigned char __user *)regs->pc;
322 srcu += 4;
323 srcu += (instruction & 0x00FF) << 1;
324 dst = (unsigned char *)rn;
325 *(unsigned long *)dst = 0;
326
327#if !defined(__LITTLE_ENDIAN__)
328 dst += 2;
329#endif
330
331 if (ma->from(dst, srcu, 2))
332 goto fetch_fault;
333 sign_extend(2, dst);
334 ret = 0;
335 break;
336
337 case 0xd: /* mov.l @(disp,PC),Rn */
338 srcu = (unsigned char __user *)(regs->pc & ~0x3);
339 srcu += 4;
340 srcu += (instruction & 0x00FF) << 2;
341 dst = (unsigned char *)rn;
342 *(unsigned long *)dst = 0;
343
344 if (ma->from(dst, srcu, 4))
345 goto fetch_fault;
346 ret = 0;
347 break;
319 } 348 }
320 return ret; 349 return ret;
321 350
@@ -466,6 +495,7 @@ int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
466 case 0x0500: /* mov.w @(disp,Rm),R0 */ 495 case 0x0500: /* mov.w @(disp,Rm),R0 */
467 goto simple; 496 goto simple;
468 case 0x0B00: /* bf lab - no delayslot*/ 497 case 0x0B00: /* bf lab - no delayslot*/
498 ret = 0;
469 break; 499 break;
470 case 0x0F00: /* bf/s lab */ 500 case 0x0F00: /* bf/s lab */
471 ret = handle_delayslot(regs, instruction, ma); 501 ret = handle_delayslot(regs, instruction, ma);
@@ -479,6 +509,7 @@ int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
479 } 509 }
480 break; 510 break;
481 case 0x0900: /* bt lab - no delayslot */ 511 case 0x0900: /* bt lab - no delayslot */
512 ret = 0;
482 break; 513 break;
483 case 0x0D00: /* bt/s lab */ 514 case 0x0D00: /* bt/s lab */
484 ret = handle_delayslot(regs, instruction, ma); 515 ret = handle_delayslot(regs, instruction, ma);
@@ -494,6 +525,9 @@ int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
494 } 525 }
495 break; 526 break;
496 527
528 case 0x9000: /* mov.w @(disp,Rm),Rn */
529 goto simple;
530
497 case 0xA000: /* bra label */ 531 case 0xA000: /* bra label */
498 ret = handle_delayslot(regs, instruction, ma); 532 ret = handle_delayslot(regs, instruction, ma);
499 if (ret==0) 533 if (ret==0)
@@ -507,6 +541,9 @@ int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
507 regs->pc += SH_PC_12BIT_OFFSET(instruction); 541 regs->pc += SH_PC_12BIT_OFFSET(instruction);
508 } 542 }
509 break; 543 break;
544
545 case 0xD000: /* mov.l @(disp,Rm),Rn */
546 goto simple;
510 } 547 }
511 return ret; 548 return ret;
512 549
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 42c67beadcae..1a6f20d4e7e6 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -55,6 +55,7 @@ config SPARC64
55 select PERF_USE_VMALLOC 55 select PERF_USE_VMALLOC
56 select IRQ_PREFLOW_FASTEOI 56 select IRQ_PREFLOW_FASTEOI
57 select ARCH_HAVE_NMI_SAFE_CMPXCHG 57 select ARCH_HAVE_NMI_SAFE_CMPXCHG
58 select HAVE_C_RECORDMCOUNT
58 59
59config ARCH_DEFCONFIG 60config ARCH_DEFCONFIG
60 string 61 string
diff --git a/arch/sparc/include/asm/sigcontext.h b/arch/sparc/include/asm/sigcontext.h
index a1607d180354..69914d748130 100644
--- a/arch/sparc/include/asm/sigcontext.h
+++ b/arch/sparc/include/asm/sigcontext.h
@@ -45,6 +45,19 @@ typedef struct {
45 int si_mask; 45 int si_mask;
46} __siginfo32_t; 46} __siginfo32_t;
47 47
48#define __SIGC_MAXWIN 7
49
50typedef struct {
51 unsigned long locals[8];
52 unsigned long ins[8];
53} __siginfo_reg_window;
54
55typedef struct {
56 int wsaved;
57 __siginfo_reg_window reg_window[__SIGC_MAXWIN];
58 unsigned long rwbuf_stkptrs[__SIGC_MAXWIN];
59} __siginfo_rwin_t;
60
48#ifdef CONFIG_SPARC64 61#ifdef CONFIG_SPARC64
49typedef struct { 62typedef struct {
50 unsigned int si_float_regs [64]; 63 unsigned int si_float_regs [64];
@@ -73,6 +86,7 @@ struct sigcontext {
73 unsigned long ss_size; 86 unsigned long ss_size;
74 } sigc_stack; 87 } sigc_stack;
75 unsigned long sigc_mask; 88 unsigned long sigc_mask;
89 __siginfo_rwin_t * sigc_rwin_save;
76}; 90};
77 91
78#else 92#else
diff --git a/arch/sparc/include/asm/spinlock_32.h b/arch/sparc/include/asm/spinlock_32.h
index 5f5b8bf3f50d..bcc98fc35281 100644
--- a/arch/sparc/include/asm/spinlock_32.h
+++ b/arch/sparc/include/asm/spinlock_32.h
@@ -131,6 +131,15 @@ static inline void arch_write_lock(arch_rwlock_t *rw)
131 *(volatile __u32 *)&lp->lock = ~0U; 131 *(volatile __u32 *)&lp->lock = ~0U;
132} 132}
133 133
134static void inline arch_write_unlock(arch_rwlock_t *lock)
135{
136 __asm__ __volatile__(
137" st %%g0, [%0]"
138 : /* no outputs */
139 : "r" (lock)
140 : "memory");
141}
142
134static inline int arch_write_trylock(arch_rwlock_t *rw) 143static inline int arch_write_trylock(arch_rwlock_t *rw)
135{ 144{
136 unsigned int val; 145 unsigned int val;
@@ -175,8 +184,6 @@ static inline int __arch_read_trylock(arch_rwlock_t *rw)
175 res; \ 184 res; \
176}) 185})
177 186
178#define arch_write_unlock(rw) do { (rw)->lock = 0; } while(0)
179
180#define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock) 187#define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock)
181#define arch_read_lock_flags(rw, flags) arch_read_lock(rw) 188#define arch_read_lock_flags(rw, flags) arch_read_lock(rw)
182#define arch_write_lock_flags(rw, flags) arch_write_lock(rw) 189#define arch_write_lock_flags(rw, flags) arch_write_lock(rw)
diff --git a/arch/sparc/include/asm/spinlock_64.h b/arch/sparc/include/asm/spinlock_64.h
index 073936a8b275..968917694978 100644
--- a/arch/sparc/include/asm/spinlock_64.h
+++ b/arch/sparc/include/asm/spinlock_64.h
@@ -210,14 +210,8 @@ static int inline arch_write_trylock(arch_rwlock_t *lock)
210 return result; 210 return result;
211} 211}
212 212
213#define arch_read_lock(p) arch_read_lock(p)
214#define arch_read_lock_flags(p, f) arch_read_lock(p) 213#define arch_read_lock_flags(p, f) arch_read_lock(p)
215#define arch_read_trylock(p) arch_read_trylock(p)
216#define arch_read_unlock(p) arch_read_unlock(p)
217#define arch_write_lock(p) arch_write_lock(p)
218#define arch_write_lock_flags(p, f) arch_write_lock(p) 214#define arch_write_lock_flags(p, f) arch_write_lock(p)
219#define arch_write_unlock(p) arch_write_unlock(p)
220#define arch_write_trylock(p) arch_write_trylock(p)
221 215
222#define arch_read_can_lock(rw) (!((rw)->lock & 0x80000000UL)) 216#define arch_read_can_lock(rw) (!((rw)->lock & 0x80000000UL))
223#define arch_write_can_lock(rw) (!(rw)->lock) 217#define arch_write_can_lock(rw) (!(rw)->lock)
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index b90b4a1d070a..cb85458f89d2 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -32,6 +32,7 @@ obj-$(CONFIG_SPARC32) += sun4m_irq.o sun4c_irq.o sun4d_irq.o
32 32
33obj-y += process_$(BITS).o 33obj-y += process_$(BITS).o
34obj-y += signal_$(BITS).o 34obj-y += signal_$(BITS).o
35obj-y += sigutil_$(BITS).o
35obj-$(CONFIG_SPARC32) += ioport.o 36obj-$(CONFIG_SPARC32) += ioport.o
36obj-y += setup_$(BITS).o 37obj-y += setup_$(BITS).o
37obj-y += idprom.o 38obj-y += idprom.o
diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c
index 490e5418740d..7429b47c3aca 100644
--- a/arch/sparc/kernel/ds.c
+++ b/arch/sparc/kernel/ds.c
@@ -1256,13 +1256,14 @@ static int __init ds_init(void)
1256{ 1256{
1257 unsigned long hv_ret, major, minor; 1257 unsigned long hv_ret, major, minor;
1258 1258
1259 hv_ret = sun4v_get_version(HV_GRP_REBOOT_DATA, &major, &minor); 1259 if (tlb_type == hypervisor) {
1260 if (hv_ret == HV_EOK) { 1260 hv_ret = sun4v_get_version(HV_GRP_REBOOT_DATA, &major, &minor);
1261 pr_info("SUN4V: Reboot data supported (maj=%lu,min=%lu).\n", 1261 if (hv_ret == HV_EOK) {
1262 major, minor); 1262 pr_info("SUN4V: Reboot data supported (maj=%lu,min=%lu).\n",
1263 reboot_data_supported = 1; 1263 major, minor);
1264 reboot_data_supported = 1;
1265 }
1264 } 1266 }
1265
1266 kthread_run(ds_thread, NULL, "kldomd"); 1267 kthread_run(ds_thread, NULL, "kldomd");
1267 1268
1268 return vio_register_driver(&ds_driver); 1269 return vio_register_driver(&ds_driver);
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index a19f04195478..1aaf8c180be5 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -352,8 +352,8 @@ int __init pcic_probe(void)
352 strcpy(pbm->prom_name, namebuf); 352 strcpy(pbm->prom_name, namebuf);
353 353
354 { 354 {
355 extern volatile int t_nmi[1]; 355 extern volatile int t_nmi[4];
356 extern int pcic_nmi_trap_patch[1]; 356 extern int pcic_nmi_trap_patch[4];
357 357
358 t_nmi[0] = pcic_nmi_trap_patch[0]; 358 t_nmi[0] = pcic_nmi_trap_patch[0];
359 t_nmi[1] = pcic_nmi_trap_patch[1]; 359 t_nmi[1] = pcic_nmi_trap_patch[1];
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c
index 75fad425e249..1ba95aff5d59 100644
--- a/arch/sparc/kernel/signal32.c
+++ b/arch/sparc/kernel/signal32.c
@@ -29,6 +29,8 @@
29#include <asm/visasm.h> 29#include <asm/visasm.h>
30#include <asm/compat_signal.h> 30#include <asm/compat_signal.h>
31 31
32#include "sigutil.h"
33
32#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 34#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
33 35
34/* This magic should be in g_upper[0] for all upper parts 36/* This magic should be in g_upper[0] for all upper parts
@@ -44,14 +46,14 @@ typedef struct {
44struct signal_frame32 { 46struct signal_frame32 {
45 struct sparc_stackf32 ss; 47 struct sparc_stackf32 ss;
46 __siginfo32_t info; 48 __siginfo32_t info;
47 /* __siginfo_fpu32_t * */ u32 fpu_save; 49 /* __siginfo_fpu_t * */ u32 fpu_save;
48 unsigned int insns[2]; 50 unsigned int insns[2];
49 unsigned int extramask[_COMPAT_NSIG_WORDS - 1]; 51 unsigned int extramask[_COMPAT_NSIG_WORDS - 1];
50 unsigned int extra_size; /* Should be sizeof(siginfo_extra_v8plus_t) */ 52 unsigned int extra_size; /* Should be sizeof(siginfo_extra_v8plus_t) */
51 /* Only valid if (info.si_regs.psr & (PSR_VERS|PSR_IMPL)) == PSR_V8PLUS */ 53 /* Only valid if (info.si_regs.psr & (PSR_VERS|PSR_IMPL)) == PSR_V8PLUS */
52 siginfo_extra_v8plus_t v8plus; 54 siginfo_extra_v8plus_t v8plus;
53 __siginfo_fpu_t fpu_state; 55 /* __siginfo_rwin_t * */u32 rwin_save;
54}; 56} __attribute__((aligned(8)));
55 57
56typedef struct compat_siginfo{ 58typedef struct compat_siginfo{
57 int si_signo; 59 int si_signo;
@@ -110,18 +112,14 @@ struct rt_signal_frame32 {
110 compat_siginfo_t info; 112 compat_siginfo_t info;
111 struct pt_regs32 regs; 113 struct pt_regs32 regs;
112 compat_sigset_t mask; 114 compat_sigset_t mask;
113 /* __siginfo_fpu32_t * */ u32 fpu_save; 115 /* __siginfo_fpu_t * */ u32 fpu_save;
114 unsigned int insns[2]; 116 unsigned int insns[2];
115 stack_t32 stack; 117 stack_t32 stack;
116 unsigned int extra_size; /* Should be sizeof(siginfo_extra_v8plus_t) */ 118 unsigned int extra_size; /* Should be sizeof(siginfo_extra_v8plus_t) */
117 /* Only valid if (regs.psr & (PSR_VERS|PSR_IMPL)) == PSR_V8PLUS */ 119 /* Only valid if (regs.psr & (PSR_VERS|PSR_IMPL)) == PSR_V8PLUS */
118 siginfo_extra_v8plus_t v8plus; 120 siginfo_extra_v8plus_t v8plus;
119 __siginfo_fpu_t fpu_state; 121 /* __siginfo_rwin_t * */u32 rwin_save;
120}; 122} __attribute__((aligned(8)));
121
122/* Align macros */
123#define SF_ALIGNEDSZ (((sizeof(struct signal_frame32) + 15) & (~15)))
124#define RT_ALIGNEDSZ (((sizeof(struct rt_signal_frame32) + 15) & (~15)))
125 123
126int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) 124int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from)
127{ 125{
@@ -192,30 +190,13 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)
192 return 0; 190 return 0;
193} 191}
194 192
195static int restore_fpu_state32(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
196{
197 unsigned long *fpregs = current_thread_info()->fpregs;
198 unsigned long fprs;
199 int err;
200
201 err = __get_user(fprs, &fpu->si_fprs);
202 fprs_write(0);
203 regs->tstate &= ~TSTATE_PEF;
204 if (fprs & FPRS_DL)
205 err |= copy_from_user(fpregs, &fpu->si_float_regs[0], (sizeof(unsigned int) * 32));
206 if (fprs & FPRS_DU)
207 err |= copy_from_user(fpregs+16, &fpu->si_float_regs[32], (sizeof(unsigned int) * 32));
208 err |= __get_user(current_thread_info()->xfsr[0], &fpu->si_fsr);
209 err |= __get_user(current_thread_info()->gsr[0], &fpu->si_gsr);
210 current_thread_info()->fpsaved[0] |= fprs;
211 return err;
212}
213
214void do_sigreturn32(struct pt_regs *regs) 193void do_sigreturn32(struct pt_regs *regs)
215{ 194{
216 struct signal_frame32 __user *sf; 195 struct signal_frame32 __user *sf;
196 compat_uptr_t fpu_save;
197 compat_uptr_t rwin_save;
217 unsigned int psr; 198 unsigned int psr;
218 unsigned pc, npc, fpu_save; 199 unsigned pc, npc;
219 sigset_t set; 200 sigset_t set;
220 unsigned seta[_COMPAT_NSIG_WORDS]; 201 unsigned seta[_COMPAT_NSIG_WORDS];
221 int err, i; 202 int err, i;
@@ -273,8 +254,13 @@ void do_sigreturn32(struct pt_regs *regs)
273 pt_regs_clear_syscall(regs); 254 pt_regs_clear_syscall(regs);
274 255
275 err |= __get_user(fpu_save, &sf->fpu_save); 256 err |= __get_user(fpu_save, &sf->fpu_save);
276 if (fpu_save) 257 if (!err && fpu_save)
277 err |= restore_fpu_state32(regs, &sf->fpu_state); 258 err |= restore_fpu_state(regs, compat_ptr(fpu_save));
259 err |= __get_user(rwin_save, &sf->rwin_save);
260 if (!err && rwin_save) {
261 if (restore_rwin_state(compat_ptr(rwin_save)))
262 goto segv;
263 }
278 err |= __get_user(seta[0], &sf->info.si_mask); 264 err |= __get_user(seta[0], &sf->info.si_mask);
279 err |= copy_from_user(seta+1, &sf->extramask, 265 err |= copy_from_user(seta+1, &sf->extramask,
280 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int)); 266 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int));
@@ -300,7 +286,9 @@ segv:
300asmlinkage void do_rt_sigreturn32(struct pt_regs *regs) 286asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
301{ 287{
302 struct rt_signal_frame32 __user *sf; 288 struct rt_signal_frame32 __user *sf;
303 unsigned int psr, pc, npc, fpu_save, u_ss_sp; 289 unsigned int psr, pc, npc, u_ss_sp;
290 compat_uptr_t fpu_save;
291 compat_uptr_t rwin_save;
304 mm_segment_t old_fs; 292 mm_segment_t old_fs;
305 sigset_t set; 293 sigset_t set;
306 compat_sigset_t seta; 294 compat_sigset_t seta;
@@ -359,8 +347,8 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
359 pt_regs_clear_syscall(regs); 347 pt_regs_clear_syscall(regs);
360 348
361 err |= __get_user(fpu_save, &sf->fpu_save); 349 err |= __get_user(fpu_save, &sf->fpu_save);
362 if (fpu_save) 350 if (!err && fpu_save)
363 err |= restore_fpu_state32(regs, &sf->fpu_state); 351 err |= restore_fpu_state(regs, compat_ptr(fpu_save));
364 err |= copy_from_user(&seta, &sf->mask, sizeof(compat_sigset_t)); 352 err |= copy_from_user(&seta, &sf->mask, sizeof(compat_sigset_t));
365 err |= __get_user(u_ss_sp, &sf->stack.ss_sp); 353 err |= __get_user(u_ss_sp, &sf->stack.ss_sp);
366 st.ss_sp = compat_ptr(u_ss_sp); 354 st.ss_sp = compat_ptr(u_ss_sp);
@@ -376,6 +364,12 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
376 do_sigaltstack((stack_t __user *) &st, NULL, (unsigned long)sf); 364 do_sigaltstack((stack_t __user *) &st, NULL, (unsigned long)sf);
377 set_fs(old_fs); 365 set_fs(old_fs);
378 366
367 err |= __get_user(rwin_save, &sf->rwin_save);
368 if (!err && rwin_save) {
369 if (restore_rwin_state(compat_ptr(rwin_save)))
370 goto segv;
371 }
372
379 switch (_NSIG_WORDS) { 373 switch (_NSIG_WORDS) {
380 case 4: set.sig[3] = seta.sig[6] + (((long)seta.sig[7]) << 32); 374 case 4: set.sig[3] = seta.sig[6] + (((long)seta.sig[7]) << 32);
381 case 3: set.sig[2] = seta.sig[4] + (((long)seta.sig[5]) << 32); 375 case 3: set.sig[2] = seta.sig[4] + (((long)seta.sig[5]) << 32);
@@ -433,26 +427,6 @@ static void __user *get_sigframe(struct sigaction *sa, struct pt_regs *regs, uns
433 return (void __user *) sp; 427 return (void __user *) sp;
434} 428}
435 429
436static int save_fpu_state32(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
437{
438 unsigned long *fpregs = current_thread_info()->fpregs;
439 unsigned long fprs;
440 int err = 0;
441
442 fprs = current_thread_info()->fpsaved[0];
443 if (fprs & FPRS_DL)
444 err |= copy_to_user(&fpu->si_float_regs[0], fpregs,
445 (sizeof(unsigned int) * 32));
446 if (fprs & FPRS_DU)
447 err |= copy_to_user(&fpu->si_float_regs[32], fpregs+16,
448 (sizeof(unsigned int) * 32));
449 err |= __put_user(current_thread_info()->xfsr[0], &fpu->si_fsr);
450 err |= __put_user(current_thread_info()->gsr[0], &fpu->si_gsr);
451 err |= __put_user(fprs, &fpu->si_fprs);
452
453 return err;
454}
455
456/* The I-cache flush instruction only works in the primary ASI, which 430/* The I-cache flush instruction only works in the primary ASI, which
457 * right now is the nucleus, aka. kernel space. 431 * right now is the nucleus, aka. kernel space.
458 * 432 *
@@ -515,18 +489,23 @@ static int setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
515 int signo, sigset_t *oldset) 489 int signo, sigset_t *oldset)
516{ 490{
517 struct signal_frame32 __user *sf; 491 struct signal_frame32 __user *sf;
492 int i, err, wsaved;
493 void __user *tail;
518 int sigframe_size; 494 int sigframe_size;
519 u32 psr; 495 u32 psr;
520 int i, err;
521 unsigned int seta[_COMPAT_NSIG_WORDS]; 496 unsigned int seta[_COMPAT_NSIG_WORDS];
522 497
523 /* 1. Make sure everything is clean */ 498 /* 1. Make sure everything is clean */
524 synchronize_user_stack(); 499 synchronize_user_stack();
525 save_and_clear_fpu(); 500 save_and_clear_fpu();
526 501
527 sigframe_size = SF_ALIGNEDSZ; 502 wsaved = get_thread_wsaved();
528 if (!(current_thread_info()->fpsaved[0] & FPRS_FEF)) 503
529 sigframe_size -= sizeof(__siginfo_fpu_t); 504 sigframe_size = sizeof(*sf);
505 if (current_thread_info()->fpsaved[0] & FPRS_FEF)
506 sigframe_size += sizeof(__siginfo_fpu_t);
507 if (wsaved)
508 sigframe_size += sizeof(__siginfo_rwin_t);
530 509
531 sf = (struct signal_frame32 __user *) 510 sf = (struct signal_frame32 __user *)
532 get_sigframe(&ka->sa, regs, sigframe_size); 511 get_sigframe(&ka->sa, regs, sigframe_size);
@@ -534,8 +513,7 @@ static int setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
534 if (invalid_frame_pointer(sf, sigframe_size)) 513 if (invalid_frame_pointer(sf, sigframe_size))
535 goto sigill; 514 goto sigill;
536 515
537 if (get_thread_wsaved() != 0) 516 tail = (sf + 1);
538 goto sigill;
539 517
540 /* 2. Save the current process state */ 518 /* 2. Save the current process state */
541 if (test_thread_flag(TIF_32BIT)) { 519 if (test_thread_flag(TIF_32BIT)) {
@@ -560,11 +538,22 @@ static int setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
560 &sf->v8plus.asi); 538 &sf->v8plus.asi);
561 539
562 if (psr & PSR_EF) { 540 if (psr & PSR_EF) {
563 err |= save_fpu_state32(regs, &sf->fpu_state); 541 __siginfo_fpu_t __user *fp = tail;
564 err |= __put_user((u64)&sf->fpu_state, &sf->fpu_save); 542 tail += sizeof(*fp);
543 err |= save_fpu_state(regs, fp);
544 err |= __put_user((u64)fp, &sf->fpu_save);
565 } else { 545 } else {
566 err |= __put_user(0, &sf->fpu_save); 546 err |= __put_user(0, &sf->fpu_save);
567 } 547 }
548 if (wsaved) {
549 __siginfo_rwin_t __user *rwp = tail;
550 tail += sizeof(*rwp);
551 err |= save_rwin_state(wsaved, rwp);
552 err |= __put_user((u64)rwp, &sf->rwin_save);
553 set_thread_wsaved(0);
554 } else {
555 err |= __put_user(0, &sf->rwin_save);
556 }
568 557
569 switch (_NSIG_WORDS) { 558 switch (_NSIG_WORDS) {
570 case 4: seta[7] = (oldset->sig[3] >> 32); 559 case 4: seta[7] = (oldset->sig[3] >> 32);
@@ -580,10 +569,21 @@ static int setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
580 err |= __copy_to_user(sf->extramask, seta + 1, 569 err |= __copy_to_user(sf->extramask, seta + 1,
581 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int)); 570 (_COMPAT_NSIG_WORDS - 1) * sizeof(unsigned int));
582 571
583 err |= copy_in_user((u32 __user *)sf, 572 if (!wsaved) {
584 (u32 __user *)(regs->u_regs[UREG_FP]), 573 err |= copy_in_user((u32 __user *)sf,
585 sizeof(struct reg_window32)); 574 (u32 __user *)(regs->u_regs[UREG_FP]),
586 575 sizeof(struct reg_window32));
576 } else {
577 struct reg_window *rp;
578
579 rp = &current_thread_info()->reg_window[wsaved - 1];
580 for (i = 0; i < 8; i++)
581 err |= __put_user(rp->locals[i], &sf->ss.locals[i]);
582 for (i = 0; i < 6; i++)
583 err |= __put_user(rp->ins[i], &sf->ss.ins[i]);
584 err |= __put_user(rp->ins[6], &sf->ss.fp);
585 err |= __put_user(rp->ins[7], &sf->ss.callers_pc);
586 }
587 if (err) 587 if (err)
588 goto sigsegv; 588 goto sigsegv;
589 589
@@ -613,7 +613,6 @@ static int setup_frame32(struct k_sigaction *ka, struct pt_regs *regs,
613 err |= __put_user(0x91d02010, &sf->insns[1]); /*t 0x10*/ 613 err |= __put_user(0x91d02010, &sf->insns[1]); /*t 0x10*/
614 if (err) 614 if (err)
615 goto sigsegv; 615 goto sigsegv;
616
617 flush_signal_insns(address); 616 flush_signal_insns(address);
618 } 617 }
619 return 0; 618 return 0;
@@ -632,18 +631,23 @@ static int setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs,
632 siginfo_t *info) 631 siginfo_t *info)
633{ 632{
634 struct rt_signal_frame32 __user *sf; 633 struct rt_signal_frame32 __user *sf;
634 int i, err, wsaved;
635 void __user *tail;
635 int sigframe_size; 636 int sigframe_size;
636 u32 psr; 637 u32 psr;
637 int i, err;
638 compat_sigset_t seta; 638 compat_sigset_t seta;
639 639
640 /* 1. Make sure everything is clean */ 640 /* 1. Make sure everything is clean */
641 synchronize_user_stack(); 641 synchronize_user_stack();
642 save_and_clear_fpu(); 642 save_and_clear_fpu();
643 643
644 sigframe_size = RT_ALIGNEDSZ; 644 wsaved = get_thread_wsaved();
645 if (!(current_thread_info()->fpsaved[0] & FPRS_FEF)) 645
646 sigframe_size -= sizeof(__siginfo_fpu_t); 646 sigframe_size = sizeof(*sf);
647 if (current_thread_info()->fpsaved[0] & FPRS_FEF)
648 sigframe_size += sizeof(__siginfo_fpu_t);
649 if (wsaved)
650 sigframe_size += sizeof(__siginfo_rwin_t);
647 651
648 sf = (struct rt_signal_frame32 __user *) 652 sf = (struct rt_signal_frame32 __user *)
649 get_sigframe(&ka->sa, regs, sigframe_size); 653 get_sigframe(&ka->sa, regs, sigframe_size);
@@ -651,8 +655,7 @@ static int setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs,
651 if (invalid_frame_pointer(sf, sigframe_size)) 655 if (invalid_frame_pointer(sf, sigframe_size))
652 goto sigill; 656 goto sigill;
653 657
654 if (get_thread_wsaved() != 0) 658 tail = (sf + 1);
655 goto sigill;
656 659
657 /* 2. Save the current process state */ 660 /* 2. Save the current process state */
658 if (test_thread_flag(TIF_32BIT)) { 661 if (test_thread_flag(TIF_32BIT)) {
@@ -677,11 +680,22 @@ static int setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs,
677 &sf->v8plus.asi); 680 &sf->v8plus.asi);
678 681
679 if (psr & PSR_EF) { 682 if (psr & PSR_EF) {
680 err |= save_fpu_state32(regs, &sf->fpu_state); 683 __siginfo_fpu_t __user *fp = tail;
681 err |= __put_user((u64)&sf->fpu_state, &sf->fpu_save); 684 tail += sizeof(*fp);
685 err |= save_fpu_state(regs, fp);
686 err |= __put_user((u64)fp, &sf->fpu_save);
682 } else { 687 } else {
683 err |= __put_user(0, &sf->fpu_save); 688 err |= __put_user(0, &sf->fpu_save);
684 } 689 }
690 if (wsaved) {
691 __siginfo_rwin_t __user *rwp = tail;
692 tail += sizeof(*rwp);
693 err |= save_rwin_state(wsaved, rwp);
694 err |= __put_user((u64)rwp, &sf->rwin_save);
695 set_thread_wsaved(0);
696 } else {
697 err |= __put_user(0, &sf->rwin_save);
698 }
685 699
686 /* Update the siginfo structure. */ 700 /* Update the siginfo structure. */
687 err |= copy_siginfo_to_user32(&sf->info, info); 701 err |= copy_siginfo_to_user32(&sf->info, info);
@@ -703,9 +717,21 @@ static int setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs,
703 } 717 }
704 err |= __copy_to_user(&sf->mask, &seta, sizeof(compat_sigset_t)); 718 err |= __copy_to_user(&sf->mask, &seta, sizeof(compat_sigset_t));
705 719
706 err |= copy_in_user((u32 __user *)sf, 720 if (!wsaved) {
707 (u32 __user *)(regs->u_regs[UREG_FP]), 721 err |= copy_in_user((u32 __user *)sf,
708 sizeof(struct reg_window32)); 722 (u32 __user *)(regs->u_regs[UREG_FP]),
723 sizeof(struct reg_window32));
724 } else {
725 struct reg_window *rp;
726
727 rp = &current_thread_info()->reg_window[wsaved - 1];
728 for (i = 0; i < 8; i++)
729 err |= __put_user(rp->locals[i], &sf->ss.locals[i]);
730 for (i = 0; i < 6; i++)
731 err |= __put_user(rp->ins[i], &sf->ss.ins[i]);
732 err |= __put_user(rp->ins[6], &sf->ss.fp);
733 err |= __put_user(rp->ins[7], &sf->ss.callers_pc);
734 }
709 if (err) 735 if (err)
710 goto sigsegv; 736 goto sigsegv;
711 737
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c
index 5e5c5fd03783..04ede8f04add 100644
--- a/arch/sparc/kernel/signal_32.c
+++ b/arch/sparc/kernel/signal_32.c
@@ -26,6 +26,8 @@
26#include <asm/pgtable.h> 26#include <asm/pgtable.h>
27#include <asm/cacheflush.h> /* flush_sig_insns */ 27#include <asm/cacheflush.h> /* flush_sig_insns */
28 28
29#include "sigutil.h"
30
29#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 31#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
30 32
31extern void fpsave(unsigned long *fpregs, unsigned long *fsr, 33extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
@@ -39,8 +41,8 @@ struct signal_frame {
39 unsigned long insns[2] __attribute__ ((aligned (8))); 41 unsigned long insns[2] __attribute__ ((aligned (8)));
40 unsigned int extramask[_NSIG_WORDS - 1]; 42 unsigned int extramask[_NSIG_WORDS - 1];
41 unsigned int extra_size; /* Should be 0 */ 43 unsigned int extra_size; /* Should be 0 */
42 __siginfo_fpu_t fpu_state; 44 __siginfo_rwin_t __user *rwin_save;
43}; 45} __attribute__((aligned(8)));
44 46
45struct rt_signal_frame { 47struct rt_signal_frame {
46 struct sparc_stackf ss; 48 struct sparc_stackf ss;
@@ -51,8 +53,8 @@ struct rt_signal_frame {
51 unsigned int insns[2]; 53 unsigned int insns[2];
52 stack_t stack; 54 stack_t stack;
53 unsigned int extra_size; /* Should be 0 */ 55 unsigned int extra_size; /* Should be 0 */
54 __siginfo_fpu_t fpu_state; 56 __siginfo_rwin_t __user *rwin_save;
55}; 57} __attribute__((aligned(8)));
56 58
57/* Align macros */ 59/* Align macros */
58#define SF_ALIGNEDSZ (((sizeof(struct signal_frame) + 7) & (~7))) 60#define SF_ALIGNEDSZ (((sizeof(struct signal_frame) + 7) & (~7)))
@@ -79,43 +81,13 @@ asmlinkage int sys_sigsuspend(old_sigset_t set)
79 return _sigpause_common(set); 81 return _sigpause_common(set);
80} 82}
81 83
82static inline int
83restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
84{
85 int err;
86#ifdef CONFIG_SMP
87 if (test_tsk_thread_flag(current, TIF_USEDFPU))
88 regs->psr &= ~PSR_EF;
89#else
90 if (current == last_task_used_math) {
91 last_task_used_math = NULL;
92 regs->psr &= ~PSR_EF;
93 }
94#endif
95 set_used_math();
96 clear_tsk_thread_flag(current, TIF_USEDFPU);
97
98 if (!access_ok(VERIFY_READ, fpu, sizeof(*fpu)))
99 return -EFAULT;
100
101 err = __copy_from_user(&current->thread.float_regs[0], &fpu->si_float_regs[0],
102 (sizeof(unsigned long) * 32));
103 err |= __get_user(current->thread.fsr, &fpu->si_fsr);
104 err |= __get_user(current->thread.fpqdepth, &fpu->si_fpqdepth);
105 if (current->thread.fpqdepth != 0)
106 err |= __copy_from_user(&current->thread.fpqueue[0],
107 &fpu->si_fpqueue[0],
108 ((sizeof(unsigned long) +
109 (sizeof(unsigned long *)))*16));
110 return err;
111}
112
113asmlinkage void do_sigreturn(struct pt_regs *regs) 84asmlinkage void do_sigreturn(struct pt_regs *regs)
114{ 85{
115 struct signal_frame __user *sf; 86 struct signal_frame __user *sf;
116 unsigned long up_psr, pc, npc; 87 unsigned long up_psr, pc, npc;
117 sigset_t set; 88 sigset_t set;
118 __siginfo_fpu_t __user *fpu_save; 89 __siginfo_fpu_t __user *fpu_save;
90 __siginfo_rwin_t __user *rwin_save;
119 int err; 91 int err;
120 92
121 /* Always make any pending restarted system calls return -EINTR */ 93 /* Always make any pending restarted system calls return -EINTR */
@@ -150,9 +122,11 @@ asmlinkage void do_sigreturn(struct pt_regs *regs)
150 pt_regs_clear_syscall(regs); 122 pt_regs_clear_syscall(regs);
151 123
152 err |= __get_user(fpu_save, &sf->fpu_save); 124 err |= __get_user(fpu_save, &sf->fpu_save);
153
154 if (fpu_save) 125 if (fpu_save)
155 err |= restore_fpu_state(regs, fpu_save); 126 err |= restore_fpu_state(regs, fpu_save);
127 err |= __get_user(rwin_save, &sf->rwin_save);
128 if (rwin_save)
129 err |= restore_rwin_state(rwin_save);
156 130
157 /* This is pretty much atomic, no amount locking would prevent 131 /* This is pretty much atomic, no amount locking would prevent
158 * the races which exist anyways. 132 * the races which exist anyways.
@@ -180,6 +154,7 @@ asmlinkage void do_rt_sigreturn(struct pt_regs *regs)
180 struct rt_signal_frame __user *sf; 154 struct rt_signal_frame __user *sf;
181 unsigned int psr, pc, npc; 155 unsigned int psr, pc, npc;
182 __siginfo_fpu_t __user *fpu_save; 156 __siginfo_fpu_t __user *fpu_save;
157 __siginfo_rwin_t __user *rwin_save;
183 mm_segment_t old_fs; 158 mm_segment_t old_fs;
184 sigset_t set; 159 sigset_t set;
185 stack_t st; 160 stack_t st;
@@ -207,8 +182,7 @@ asmlinkage void do_rt_sigreturn(struct pt_regs *regs)
207 pt_regs_clear_syscall(regs); 182 pt_regs_clear_syscall(regs);
208 183
209 err |= __get_user(fpu_save, &sf->fpu_save); 184 err |= __get_user(fpu_save, &sf->fpu_save);
210 185 if (!err && fpu_save)
211 if (fpu_save)
212 err |= restore_fpu_state(regs, fpu_save); 186 err |= restore_fpu_state(regs, fpu_save);
213 err |= __copy_from_user(&set, &sf->mask, sizeof(sigset_t)); 187 err |= __copy_from_user(&set, &sf->mask, sizeof(sigset_t));
214 188
@@ -228,6 +202,12 @@ asmlinkage void do_rt_sigreturn(struct pt_regs *regs)
228 do_sigaltstack((const stack_t __user *) &st, NULL, (unsigned long)sf); 202 do_sigaltstack((const stack_t __user *) &st, NULL, (unsigned long)sf);
229 set_fs(old_fs); 203 set_fs(old_fs);
230 204
205 err |= __get_user(rwin_save, &sf->rwin_save);
206 if (!err && rwin_save) {
207 if (restore_rwin_state(rwin_save))
208 goto segv;
209 }
210
231 sigdelsetmask(&set, ~_BLOCKABLE); 211 sigdelsetmask(&set, ~_BLOCKABLE);
232 spin_lock_irq(&current->sighand->siglock); 212 spin_lock_irq(&current->sighand->siglock);
233 current->blocked = set; 213 current->blocked = set;
@@ -280,53 +260,23 @@ static inline void __user *get_sigframe(struct sigaction *sa, struct pt_regs *re
280 return (void __user *) sp; 260 return (void __user *) sp;
281} 261}
282 262
283static inline int
284save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
285{
286 int err = 0;
287#ifdef CONFIG_SMP
288 if (test_tsk_thread_flag(current, TIF_USEDFPU)) {
289 put_psr(get_psr() | PSR_EF);
290 fpsave(&current->thread.float_regs[0], &current->thread.fsr,
291 &current->thread.fpqueue[0], &current->thread.fpqdepth);
292 regs->psr &= ~(PSR_EF);
293 clear_tsk_thread_flag(current, TIF_USEDFPU);
294 }
295#else
296 if (current == last_task_used_math) {
297 put_psr(get_psr() | PSR_EF);
298 fpsave(&current->thread.float_regs[0], &current->thread.fsr,
299 &current->thread.fpqueue[0], &current->thread.fpqdepth);
300 last_task_used_math = NULL;
301 regs->psr &= ~(PSR_EF);
302 }
303#endif
304 err |= __copy_to_user(&fpu->si_float_regs[0],
305 &current->thread.float_regs[0],
306 (sizeof(unsigned long) * 32));
307 err |= __put_user(current->thread.fsr, &fpu->si_fsr);
308 err |= __put_user(current->thread.fpqdepth, &fpu->si_fpqdepth);
309 if (current->thread.fpqdepth != 0)
310 err |= __copy_to_user(&fpu->si_fpqueue[0],
311 &current->thread.fpqueue[0],
312 ((sizeof(unsigned long) +
313 (sizeof(unsigned long *)))*16));
314 clear_used_math();
315 return err;
316}
317
318static int setup_frame(struct k_sigaction *ka, struct pt_regs *regs, 263static int setup_frame(struct k_sigaction *ka, struct pt_regs *regs,
319 int signo, sigset_t *oldset) 264 int signo, sigset_t *oldset)
320{ 265{
321 struct signal_frame __user *sf; 266 struct signal_frame __user *sf;
322 int sigframe_size, err; 267 int sigframe_size, err, wsaved;
268 void __user *tail;
323 269
324 /* 1. Make sure everything is clean */ 270 /* 1. Make sure everything is clean */
325 synchronize_user_stack(); 271 synchronize_user_stack();
326 272
327 sigframe_size = SF_ALIGNEDSZ; 273 wsaved = current_thread_info()->w_saved;
328 if (!used_math()) 274
329 sigframe_size -= sizeof(__siginfo_fpu_t); 275 sigframe_size = sizeof(*sf);
276 if (used_math())
277 sigframe_size += sizeof(__siginfo_fpu_t);
278 if (wsaved)
279 sigframe_size += sizeof(__siginfo_rwin_t);
330 280
331 sf = (struct signal_frame __user *) 281 sf = (struct signal_frame __user *)
332 get_sigframe(&ka->sa, regs, sigframe_size); 282 get_sigframe(&ka->sa, regs, sigframe_size);
@@ -334,8 +284,7 @@ static int setup_frame(struct k_sigaction *ka, struct pt_regs *regs,
334 if (invalid_frame_pointer(sf, sigframe_size)) 284 if (invalid_frame_pointer(sf, sigframe_size))
335 goto sigill_and_return; 285 goto sigill_and_return;
336 286
337 if (current_thread_info()->w_saved != 0) 287 tail = sf + 1;
338 goto sigill_and_return;
339 288
340 /* 2. Save the current process state */ 289 /* 2. Save the current process state */
341 err = __copy_to_user(&sf->info.si_regs, regs, sizeof(struct pt_regs)); 290 err = __copy_to_user(&sf->info.si_regs, regs, sizeof(struct pt_regs));
@@ -343,17 +292,34 @@ static int setup_frame(struct k_sigaction *ka, struct pt_regs *regs,
343 err |= __put_user(0, &sf->extra_size); 292 err |= __put_user(0, &sf->extra_size);
344 293
345 if (used_math()) { 294 if (used_math()) {
346 err |= save_fpu_state(regs, &sf->fpu_state); 295 __siginfo_fpu_t __user *fp = tail;
347 err |= __put_user(&sf->fpu_state, &sf->fpu_save); 296 tail += sizeof(*fp);
297 err |= save_fpu_state(regs, fp);
298 err |= __put_user(fp, &sf->fpu_save);
348 } else { 299 } else {
349 err |= __put_user(0, &sf->fpu_save); 300 err |= __put_user(0, &sf->fpu_save);
350 } 301 }
302 if (wsaved) {
303 __siginfo_rwin_t __user *rwp = tail;
304 tail += sizeof(*rwp);
305 err |= save_rwin_state(wsaved, rwp);
306 err |= __put_user(rwp, &sf->rwin_save);
307 } else {
308 err |= __put_user(0, &sf->rwin_save);
309 }
351 310
352 err |= __put_user(oldset->sig[0], &sf->info.si_mask); 311 err |= __put_user(oldset->sig[0], &sf->info.si_mask);
353 err |= __copy_to_user(sf->extramask, &oldset->sig[1], 312 err |= __copy_to_user(sf->extramask, &oldset->sig[1],
354 (_NSIG_WORDS - 1) * sizeof(unsigned int)); 313 (_NSIG_WORDS - 1) * sizeof(unsigned int));
355 err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP], 314 if (!wsaved) {
356 sizeof(struct reg_window32)); 315 err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP],
316 sizeof(struct reg_window32));
317 } else {
318 struct reg_window32 *rp;
319
320 rp = &current_thread_info()->reg_window[wsaved - 1];
321 err |= __copy_to_user(sf, rp, sizeof(struct reg_window32));
322 }
357 if (err) 323 if (err)
358 goto sigsegv; 324 goto sigsegv;
359 325
@@ -399,21 +365,24 @@ static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
399 int signo, sigset_t *oldset, siginfo_t *info) 365 int signo, sigset_t *oldset, siginfo_t *info)
400{ 366{
401 struct rt_signal_frame __user *sf; 367 struct rt_signal_frame __user *sf;
402 int sigframe_size; 368 int sigframe_size, wsaved;
369 void __user *tail;
403 unsigned int psr; 370 unsigned int psr;
404 int err; 371 int err;
405 372
406 synchronize_user_stack(); 373 synchronize_user_stack();
407 sigframe_size = RT_ALIGNEDSZ; 374 wsaved = current_thread_info()->w_saved;
408 if (!used_math()) 375 sigframe_size = sizeof(*sf);
409 sigframe_size -= sizeof(__siginfo_fpu_t); 376 if (used_math())
377 sigframe_size += sizeof(__siginfo_fpu_t);
378 if (wsaved)
379 sigframe_size += sizeof(__siginfo_rwin_t);
410 sf = (struct rt_signal_frame __user *) 380 sf = (struct rt_signal_frame __user *)
411 get_sigframe(&ka->sa, regs, sigframe_size); 381 get_sigframe(&ka->sa, regs, sigframe_size);
412 if (invalid_frame_pointer(sf, sigframe_size)) 382 if (invalid_frame_pointer(sf, sigframe_size))
413 goto sigill; 383 goto sigill;
414 if (current_thread_info()->w_saved != 0)
415 goto sigill;
416 384
385 tail = sf + 1;
417 err = __put_user(regs->pc, &sf->regs.pc); 386 err = __put_user(regs->pc, &sf->regs.pc);
418 err |= __put_user(regs->npc, &sf->regs.npc); 387 err |= __put_user(regs->npc, &sf->regs.npc);
419 err |= __put_user(regs->y, &sf->regs.y); 388 err |= __put_user(regs->y, &sf->regs.y);
@@ -425,11 +394,21 @@ static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
425 err |= __put_user(0, &sf->extra_size); 394 err |= __put_user(0, &sf->extra_size);
426 395
427 if (psr & PSR_EF) { 396 if (psr & PSR_EF) {
428 err |= save_fpu_state(regs, &sf->fpu_state); 397 __siginfo_fpu_t *fp = tail;
429 err |= __put_user(&sf->fpu_state, &sf->fpu_save); 398 tail += sizeof(*fp);
399 err |= save_fpu_state(regs, fp);
400 err |= __put_user(fp, &sf->fpu_save);
430 } else { 401 } else {
431 err |= __put_user(0, &sf->fpu_save); 402 err |= __put_user(0, &sf->fpu_save);
432 } 403 }
404 if (wsaved) {
405 __siginfo_rwin_t *rwp = tail;
406 tail += sizeof(*rwp);
407 err |= save_rwin_state(wsaved, rwp);
408 err |= __put_user(rwp, &sf->rwin_save);
409 } else {
410 err |= __put_user(0, &sf->rwin_save);
411 }
433 err |= __copy_to_user(&sf->mask, &oldset->sig[0], sizeof(sigset_t)); 412 err |= __copy_to_user(&sf->mask, &oldset->sig[0], sizeof(sigset_t));
434 413
435 /* Setup sigaltstack */ 414 /* Setup sigaltstack */
@@ -437,8 +416,15 @@ static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
437 err |= __put_user(sas_ss_flags(regs->u_regs[UREG_FP]), &sf->stack.ss_flags); 416 err |= __put_user(sas_ss_flags(regs->u_regs[UREG_FP]), &sf->stack.ss_flags);
438 err |= __put_user(current->sas_ss_size, &sf->stack.ss_size); 417 err |= __put_user(current->sas_ss_size, &sf->stack.ss_size);
439 418
440 err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP], 419 if (!wsaved) {
441 sizeof(struct reg_window32)); 420 err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP],
421 sizeof(struct reg_window32));
422 } else {
423 struct reg_window32 *rp;
424
425 rp = &current_thread_info()->reg_window[wsaved - 1];
426 err |= __copy_to_user(sf, rp, sizeof(struct reg_window32));
427 }
442 428
443 err |= copy_siginfo_to_user(&sf->info, info); 429 err |= copy_siginfo_to_user(&sf->info, info);
444 430
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c
index 006fe4515886..47509df3b893 100644
--- a/arch/sparc/kernel/signal_64.c
+++ b/arch/sparc/kernel/signal_64.c
@@ -34,6 +34,7 @@
34 34
35#include "entry.h" 35#include "entry.h"
36#include "systbls.h" 36#include "systbls.h"
37#include "sigutil.h"
37 38
38#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 39#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
39 40
@@ -236,7 +237,7 @@ struct rt_signal_frame {
236 __siginfo_fpu_t __user *fpu_save; 237 __siginfo_fpu_t __user *fpu_save;
237 stack_t stack; 238 stack_t stack;
238 sigset_t mask; 239 sigset_t mask;
239 __siginfo_fpu_t fpu_state; 240 __siginfo_rwin_t *rwin_save;
240}; 241};
241 242
242static long _sigpause_common(old_sigset_t set) 243static long _sigpause_common(old_sigset_t set)
@@ -266,33 +267,12 @@ asmlinkage long sys_sigsuspend(old_sigset_t set)
266 return _sigpause_common(set); 267 return _sigpause_common(set);
267} 268}
268 269
269static inline int
270restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
271{
272 unsigned long *fpregs = current_thread_info()->fpregs;
273 unsigned long fprs;
274 int err;
275
276 err = __get_user(fprs, &fpu->si_fprs);
277 fprs_write(0);
278 regs->tstate &= ~TSTATE_PEF;
279 if (fprs & FPRS_DL)
280 err |= copy_from_user(fpregs, &fpu->si_float_regs[0],
281 (sizeof(unsigned int) * 32));
282 if (fprs & FPRS_DU)
283 err |= copy_from_user(fpregs+16, &fpu->si_float_regs[32],
284 (sizeof(unsigned int) * 32));
285 err |= __get_user(current_thread_info()->xfsr[0], &fpu->si_fsr);
286 err |= __get_user(current_thread_info()->gsr[0], &fpu->si_gsr);
287 current_thread_info()->fpsaved[0] |= fprs;
288 return err;
289}
290
291void do_rt_sigreturn(struct pt_regs *regs) 270void do_rt_sigreturn(struct pt_regs *regs)
292{ 271{
293 struct rt_signal_frame __user *sf; 272 struct rt_signal_frame __user *sf;
294 unsigned long tpc, tnpc, tstate; 273 unsigned long tpc, tnpc, tstate;
295 __siginfo_fpu_t __user *fpu_save; 274 __siginfo_fpu_t __user *fpu_save;
275 __siginfo_rwin_t __user *rwin_save;
296 sigset_t set; 276 sigset_t set;
297 int err; 277 int err;
298 278
@@ -325,8 +305,8 @@ void do_rt_sigreturn(struct pt_regs *regs)
325 regs->tstate |= (tstate & (TSTATE_ASI | TSTATE_ICC | TSTATE_XCC)); 305 regs->tstate |= (tstate & (TSTATE_ASI | TSTATE_ICC | TSTATE_XCC));
326 306
327 err |= __get_user(fpu_save, &sf->fpu_save); 307 err |= __get_user(fpu_save, &sf->fpu_save);
328 if (fpu_save) 308 if (!err && fpu_save)
329 err |= restore_fpu_state(regs, &sf->fpu_state); 309 err |= restore_fpu_state(regs, fpu_save);
330 310
331 err |= __copy_from_user(&set, &sf->mask, sizeof(sigset_t)); 311 err |= __copy_from_user(&set, &sf->mask, sizeof(sigset_t));
332 err |= do_sigaltstack(&sf->stack, NULL, (unsigned long)sf); 312 err |= do_sigaltstack(&sf->stack, NULL, (unsigned long)sf);
@@ -334,6 +314,12 @@ void do_rt_sigreturn(struct pt_regs *regs)
334 if (err) 314 if (err)
335 goto segv; 315 goto segv;
336 316
317 err |= __get_user(rwin_save, &sf->rwin_save);
318 if (!err && rwin_save) {
319 if (restore_rwin_state(rwin_save))
320 goto segv;
321 }
322
337 regs->tpc = tpc; 323 regs->tpc = tpc;
338 regs->tnpc = tnpc; 324 regs->tnpc = tnpc;
339 325
@@ -351,34 +337,13 @@ segv:
351} 337}
352 338
353/* Checks if the fp is valid */ 339/* Checks if the fp is valid */
354static int invalid_frame_pointer(void __user *fp, int fplen) 340static int invalid_frame_pointer(void __user *fp)
355{ 341{
356 if (((unsigned long) fp) & 15) 342 if (((unsigned long) fp) & 15)
357 return 1; 343 return 1;
358 return 0; 344 return 0;
359} 345}
360 346
361static inline int
362save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
363{
364 unsigned long *fpregs = current_thread_info()->fpregs;
365 unsigned long fprs;
366 int err = 0;
367
368 fprs = current_thread_info()->fpsaved[0];
369 if (fprs & FPRS_DL)
370 err |= copy_to_user(&fpu->si_float_regs[0], fpregs,
371 (sizeof(unsigned int) * 32));
372 if (fprs & FPRS_DU)
373 err |= copy_to_user(&fpu->si_float_regs[32], fpregs+16,
374 (sizeof(unsigned int) * 32));
375 err |= __put_user(current_thread_info()->xfsr[0], &fpu->si_fsr);
376 err |= __put_user(current_thread_info()->gsr[0], &fpu->si_gsr);
377 err |= __put_user(fprs, &fpu->si_fprs);
378
379 return err;
380}
381
382static inline void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, unsigned long framesize) 347static inline void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, unsigned long framesize)
383{ 348{
384 unsigned long sp = regs->u_regs[UREG_FP] + STACK_BIAS; 349 unsigned long sp = regs->u_regs[UREG_FP] + STACK_BIAS;
@@ -414,34 +379,48 @@ setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
414 int signo, sigset_t *oldset, siginfo_t *info) 379 int signo, sigset_t *oldset, siginfo_t *info)
415{ 380{
416 struct rt_signal_frame __user *sf; 381 struct rt_signal_frame __user *sf;
417 int sigframe_size, err; 382 int wsaved, err, sf_size;
383 void __user *tail;
418 384
419 /* 1. Make sure everything is clean */ 385 /* 1. Make sure everything is clean */
420 synchronize_user_stack(); 386 synchronize_user_stack();
421 save_and_clear_fpu(); 387 save_and_clear_fpu();
422 388
423 sigframe_size = sizeof(struct rt_signal_frame); 389 wsaved = get_thread_wsaved();
424 if (!(current_thread_info()->fpsaved[0] & FPRS_FEF))
425 sigframe_size -= sizeof(__siginfo_fpu_t);
426 390
391 sf_size = sizeof(struct rt_signal_frame);
392 if (current_thread_info()->fpsaved[0] & FPRS_FEF)
393 sf_size += sizeof(__siginfo_fpu_t);
394 if (wsaved)
395 sf_size += sizeof(__siginfo_rwin_t);
427 sf = (struct rt_signal_frame __user *) 396 sf = (struct rt_signal_frame __user *)
428 get_sigframe(ka, regs, sigframe_size); 397 get_sigframe(ka, regs, sf_size);
429
430 if (invalid_frame_pointer (sf, sigframe_size))
431 goto sigill;
432 398
433 if (get_thread_wsaved() != 0) 399 if (invalid_frame_pointer (sf))
434 goto sigill; 400 goto sigill;
435 401
402 tail = (sf + 1);
403
436 /* 2. Save the current process state */ 404 /* 2. Save the current process state */
437 err = copy_to_user(&sf->regs, regs, sizeof (*regs)); 405 err = copy_to_user(&sf->regs, regs, sizeof (*regs));
438 406
439 if (current_thread_info()->fpsaved[0] & FPRS_FEF) { 407 if (current_thread_info()->fpsaved[0] & FPRS_FEF) {
440 err |= save_fpu_state(regs, &sf->fpu_state); 408 __siginfo_fpu_t __user *fpu_save = tail;
441 err |= __put_user((u64)&sf->fpu_state, &sf->fpu_save); 409 tail += sizeof(__siginfo_fpu_t);
410 err |= save_fpu_state(regs, fpu_save);
411 err |= __put_user((u64)fpu_save, &sf->fpu_save);
442 } else { 412 } else {
443 err |= __put_user(0, &sf->fpu_save); 413 err |= __put_user(0, &sf->fpu_save);
444 } 414 }
415 if (wsaved) {
416 __siginfo_rwin_t __user *rwin_save = tail;
417 tail += sizeof(__siginfo_rwin_t);
418 err |= save_rwin_state(wsaved, rwin_save);
419 err |= __put_user((u64)rwin_save, &sf->rwin_save);
420 set_thread_wsaved(0);
421 } else {
422 err |= __put_user(0, &sf->rwin_save);
423 }
445 424
446 /* Setup sigaltstack */ 425 /* Setup sigaltstack */
447 err |= __put_user(current->sas_ss_sp, &sf->stack.ss_sp); 426 err |= __put_user(current->sas_ss_sp, &sf->stack.ss_sp);
@@ -450,10 +429,17 @@ setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
450 429
451 err |= copy_to_user(&sf->mask, oldset, sizeof(sigset_t)); 430 err |= copy_to_user(&sf->mask, oldset, sizeof(sigset_t));
452 431
453 err |= copy_in_user((u64 __user *)sf, 432 if (!wsaved) {
454 (u64 __user *)(regs->u_regs[UREG_FP]+STACK_BIAS), 433 err |= copy_in_user((u64 __user *)sf,
455 sizeof(struct reg_window)); 434 (u64 __user *)(regs->u_regs[UREG_FP] +
435 STACK_BIAS),
436 sizeof(struct reg_window));
437 } else {
438 struct reg_window *rp;
456 439
440 rp = &current_thread_info()->reg_window[wsaved - 1];
441 err |= copy_to_user(sf, rp, sizeof(struct reg_window));
442 }
457 if (info) 443 if (info)
458 err |= copy_siginfo_to_user(&sf->info, info); 444 err |= copy_siginfo_to_user(&sf->info, info);
459 else { 445 else {
diff --git a/arch/sparc/kernel/sigutil.h b/arch/sparc/kernel/sigutil.h
new file mode 100644
index 000000000000..d223aa432bb6
--- /dev/null
+++ b/arch/sparc/kernel/sigutil.h
@@ -0,0 +1,9 @@
1#ifndef _SIGUTIL_H
2#define _SIGUTIL_H
3
4int save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu);
5int restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu);
6int save_rwin_state(int wsaved, __siginfo_rwin_t __user *rwin);
7int restore_rwin_state(__siginfo_rwin_t __user *rp);
8
9#endif /* _SIGUTIL_H */
diff --git a/arch/sparc/kernel/sigutil_32.c b/arch/sparc/kernel/sigutil_32.c
new file mode 100644
index 000000000000..35c7897b009a
--- /dev/null
+++ b/arch/sparc/kernel/sigutil_32.c
@@ -0,0 +1,120 @@
1#include <linux/kernel.h>
2#include <linux/types.h>
3#include <linux/thread_info.h>
4#include <linux/uaccess.h>
5#include <linux/sched.h>
6
7#include <asm/sigcontext.h>
8#include <asm/fpumacro.h>
9#include <asm/ptrace.h>
10
11#include "sigutil.h"
12
13int save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
14{
15 int err = 0;
16#ifdef CONFIG_SMP
17 if (test_tsk_thread_flag(current, TIF_USEDFPU)) {
18 put_psr(get_psr() | PSR_EF);
19 fpsave(&current->thread.float_regs[0], &current->thread.fsr,
20 &current->thread.fpqueue[0], &current->thread.fpqdepth);
21 regs->psr &= ~(PSR_EF);
22 clear_tsk_thread_flag(current, TIF_USEDFPU);
23 }
24#else
25 if (current == last_task_used_math) {
26 put_psr(get_psr() | PSR_EF);
27 fpsave(&current->thread.float_regs[0], &current->thread.fsr,
28 &current->thread.fpqueue[0], &current->thread.fpqdepth);
29 last_task_used_math = NULL;
30 regs->psr &= ~(PSR_EF);
31 }
32#endif
33 err |= __copy_to_user(&fpu->si_float_regs[0],
34 &current->thread.float_regs[0],
35 (sizeof(unsigned long) * 32));
36 err |= __put_user(current->thread.fsr, &fpu->si_fsr);
37 err |= __put_user(current->thread.fpqdepth, &fpu->si_fpqdepth);
38 if (current->thread.fpqdepth != 0)
39 err |= __copy_to_user(&fpu->si_fpqueue[0],
40 &current->thread.fpqueue[0],
41 ((sizeof(unsigned long) +
42 (sizeof(unsigned long *)))*16));
43 clear_used_math();
44 return err;
45}
46
47int restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
48{
49 int err;
50#ifdef CONFIG_SMP
51 if (test_tsk_thread_flag(current, TIF_USEDFPU))
52 regs->psr &= ~PSR_EF;
53#else
54 if (current == last_task_used_math) {
55 last_task_used_math = NULL;
56 regs->psr &= ~PSR_EF;
57 }
58#endif
59 set_used_math();
60 clear_tsk_thread_flag(current, TIF_USEDFPU);
61
62 if (!access_ok(VERIFY_READ, fpu, sizeof(*fpu)))
63 return -EFAULT;
64
65 err = __copy_from_user(&current->thread.float_regs[0], &fpu->si_float_regs[0],
66 (sizeof(unsigned long) * 32));
67 err |= __get_user(current->thread.fsr, &fpu->si_fsr);
68 err |= __get_user(current->thread.fpqdepth, &fpu->si_fpqdepth);
69 if (current->thread.fpqdepth != 0)
70 err |= __copy_from_user(&current->thread.fpqueue[0],
71 &fpu->si_fpqueue[0],
72 ((sizeof(unsigned long) +
73 (sizeof(unsigned long *)))*16));
74 return err;
75}
76
77int save_rwin_state(int wsaved, __siginfo_rwin_t __user *rwin)
78{
79 int i, err = __put_user(wsaved, &rwin->wsaved);
80
81 for (i = 0; i < wsaved; i++) {
82 struct reg_window32 *rp;
83 unsigned long fp;
84
85 rp = &current_thread_info()->reg_window[i];
86 fp = current_thread_info()->rwbuf_stkptrs[i];
87 err |= copy_to_user(&rwin->reg_window[i], rp,
88 sizeof(struct reg_window32));
89 err |= __put_user(fp, &rwin->rwbuf_stkptrs[i]);
90 }
91 return err;
92}
93
94int restore_rwin_state(__siginfo_rwin_t __user *rp)
95{
96 struct thread_info *t = current_thread_info();
97 int i, wsaved, err;
98
99 __get_user(wsaved, &rp->wsaved);
100 if (wsaved > NSWINS)
101 return -EFAULT;
102
103 err = 0;
104 for (i = 0; i < wsaved; i++) {
105 err |= copy_from_user(&t->reg_window[i],
106 &rp->reg_window[i],
107 sizeof(struct reg_window32));
108 err |= __get_user(t->rwbuf_stkptrs[i],
109 &rp->rwbuf_stkptrs[i]);
110 }
111 if (err)
112 return err;
113
114 t->w_saved = wsaved;
115 synchronize_user_stack();
116 if (t->w_saved)
117 return -EFAULT;
118 return 0;
119
120}
diff --git a/arch/sparc/kernel/sigutil_64.c b/arch/sparc/kernel/sigutil_64.c
new file mode 100644
index 000000000000..e7dc508c38eb
--- /dev/null
+++ b/arch/sparc/kernel/sigutil_64.c
@@ -0,0 +1,93 @@
1#include <linux/kernel.h>
2#include <linux/types.h>
3#include <linux/thread_info.h>
4#include <linux/uaccess.h>
5
6#include <asm/sigcontext.h>
7#include <asm/fpumacro.h>
8#include <asm/ptrace.h>
9
10#include "sigutil.h"
11
12int save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
13{
14 unsigned long *fpregs = current_thread_info()->fpregs;
15 unsigned long fprs;
16 int err = 0;
17
18 fprs = current_thread_info()->fpsaved[0];
19 if (fprs & FPRS_DL)
20 err |= copy_to_user(&fpu->si_float_regs[0], fpregs,
21 (sizeof(unsigned int) * 32));
22 if (fprs & FPRS_DU)
23 err |= copy_to_user(&fpu->si_float_regs[32], fpregs+16,
24 (sizeof(unsigned int) * 32));
25 err |= __put_user(current_thread_info()->xfsr[0], &fpu->si_fsr);
26 err |= __put_user(current_thread_info()->gsr[0], &fpu->si_gsr);
27 err |= __put_user(fprs, &fpu->si_fprs);
28
29 return err;
30}
31
32int restore_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
33{
34 unsigned long *fpregs = current_thread_info()->fpregs;
35 unsigned long fprs;
36 int err;
37
38 err = __get_user(fprs, &fpu->si_fprs);
39 fprs_write(0);
40 regs->tstate &= ~TSTATE_PEF;
41 if (fprs & FPRS_DL)
42 err |= copy_from_user(fpregs, &fpu->si_float_regs[0],
43 (sizeof(unsigned int) * 32));
44 if (fprs & FPRS_DU)
45 err |= copy_from_user(fpregs+16, &fpu->si_float_regs[32],
46 (sizeof(unsigned int) * 32));
47 err |= __get_user(current_thread_info()->xfsr[0], &fpu->si_fsr);
48 err |= __get_user(current_thread_info()->gsr[0], &fpu->si_gsr);
49 current_thread_info()->fpsaved[0] |= fprs;
50 return err;
51}
52
53int save_rwin_state(int wsaved, __siginfo_rwin_t __user *rwin)
54{
55 int i, err = __put_user(wsaved, &rwin->wsaved);
56
57 for (i = 0; i < wsaved; i++) {
58 struct reg_window *rp = &current_thread_info()->reg_window[i];
59 unsigned long fp = current_thread_info()->rwbuf_stkptrs[i];
60
61 err |= copy_to_user(&rwin->reg_window[i], rp,
62 sizeof(struct reg_window));
63 err |= __put_user(fp, &rwin->rwbuf_stkptrs[i]);
64 }
65 return err;
66}
67
68int restore_rwin_state(__siginfo_rwin_t __user *rp)
69{
70 struct thread_info *t = current_thread_info();
71 int i, wsaved, err;
72
73 __get_user(wsaved, &rp->wsaved);
74 if (wsaved > NSWINS)
75 return -EFAULT;
76
77 err = 0;
78 for (i = 0; i < wsaved; i++) {
79 err |= copy_from_user(&t->reg_window[i],
80 &rp->reg_window[i],
81 sizeof(struct reg_window));
82 err |= __get_user(t->rwbuf_stkptrs[i],
83 &rp->rwbuf_stkptrs[i]);
84 }
85 if (err)
86 return err;
87
88 set_thread_wsaved(wsaved);
89 synchronize_user_stack();
90 if (get_thread_wsaved())
91 return -EFAULT;
92 return 0;
93}
diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
index 7b439d9aea2a..41935fadfdfc 100644
--- a/arch/x86/include/asm/desc.h
+++ b/arch/x86/include/asm/desc.h
@@ -27,8 +27,8 @@ static inline void fill_ldt(struct desc_struct *desc, const struct user_desc *in
27 27
28 desc->base2 = (info->base_addr & 0xff000000) >> 24; 28 desc->base2 = (info->base_addr & 0xff000000) >> 24;
29 /* 29 /*
30 * Don't allow setting of the lm bit. It is useless anyway 30 * Don't allow setting of the lm bit. It would confuse
31 * because 64bit system calls require __USER_CS: 31 * user_64bit_mode and would get overridden by sysret anyway.
32 */ 32 */
33 desc->l = 0; 33 desc->l = 0;
34} 34}
diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
index f9a320984a10..7e50f06393aa 100644
--- a/arch/x86/include/asm/irq_vectors.h
+++ b/arch/x86/include/asm/irq_vectors.h
@@ -17,7 +17,6 @@
17 * Vectors 0 ... 31 : system traps and exceptions - hardcoded events 17 * Vectors 0 ... 31 : system traps and exceptions - hardcoded events
18 * Vectors 32 ... 127 : device interrupts 18 * Vectors 32 ... 127 : device interrupts
19 * Vector 128 : legacy int80 syscall interface 19 * Vector 128 : legacy int80 syscall interface
20 * Vector 204 : legacy x86_64 vsyscall emulation
21 * Vectors 129 ... INVALIDATE_TLB_VECTOR_START-1 except 204 : device interrupts 20 * Vectors 129 ... INVALIDATE_TLB_VECTOR_START-1 except 204 : device interrupts
22 * Vectors INVALIDATE_TLB_VECTOR_START ... 255 : special interrupts 21 * Vectors INVALIDATE_TLB_VECTOR_START ... 255 : special interrupts
23 * 22 *
@@ -51,9 +50,6 @@
51#ifdef CONFIG_X86_32 50#ifdef CONFIG_X86_32
52# define SYSCALL_VECTOR 0x80 51# define SYSCALL_VECTOR 0x80
53#endif 52#endif
54#ifdef CONFIG_X86_64
55# define VSYSCALL_EMU_VECTOR 0xcc
56#endif
57 53
58/* 54/*
59 * Vectors 0x30-0x3f are used for ISA interrupts. 55 * Vectors 0x30-0x3f are used for ISA interrupts.
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h
index 2c7652163111..8e8b9a4987ee 100644
--- a/arch/x86/include/asm/paravirt_types.h
+++ b/arch/x86/include/asm/paravirt_types.h
@@ -41,6 +41,7 @@
41 41
42#include <asm/desc_defs.h> 42#include <asm/desc_defs.h>
43#include <asm/kmap_types.h> 43#include <asm/kmap_types.h>
44#include <asm/pgtable_types.h>
44 45
45struct page; 46struct page;
46struct thread_struct; 47struct thread_struct;
@@ -63,6 +64,11 @@ struct paravirt_callee_save {
63struct pv_info { 64struct pv_info {
64 unsigned int kernel_rpl; 65 unsigned int kernel_rpl;
65 int shared_kernel_pmd; 66 int shared_kernel_pmd;
67
68#ifdef CONFIG_X86_64
69 u16 extra_user_64bit_cs; /* __USER_CS if none */
70#endif
71
66 int paravirt_enabled; 72 int paravirt_enabled;
67 const char *name; 73 const char *name;
68}; 74};
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 94e7618fcac8..35664547125b 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -131,6 +131,9 @@ struct pt_regs {
131#ifdef __KERNEL__ 131#ifdef __KERNEL__
132 132
133#include <linux/init.h> 133#include <linux/init.h>
134#ifdef CONFIG_PARAVIRT
135#include <asm/paravirt_types.h>
136#endif
134 137
135struct cpuinfo_x86; 138struct cpuinfo_x86;
136struct task_struct; 139struct task_struct;
@@ -187,6 +190,22 @@ static inline int v8086_mode(struct pt_regs *regs)
187#endif 190#endif
188} 191}
189 192
193#ifdef CONFIG_X86_64
194static inline bool user_64bit_mode(struct pt_regs *regs)
195{
196#ifndef CONFIG_PARAVIRT
197 /*
198 * On non-paravirt systems, this is the only long mode CPL 3
199 * selector. We do not allow long mode selectors in the LDT.
200 */
201 return regs->cs == __USER_CS;
202#else
203 /* Headers are too twisted for this to go in paravirt.h. */
204 return regs->cs == __USER_CS || regs->cs == pv_info.extra_user_64bit_cs;
205#endif
206}
207#endif
208
190/* 209/*
191 * X86_32 CPUs don't save ss and esp if the CPU is already in kernel mode 210 * X86_32 CPUs don't save ss and esp if the CPU is already in kernel mode
192 * when it traps. The previous stack will be directly underneath the saved 211 * when it traps. The previous stack will be directly underneath the saved
diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h
index 2bae0a513b40..0012d0902c5f 100644
--- a/arch/x86/include/asm/traps.h
+++ b/arch/x86/include/asm/traps.h
@@ -40,7 +40,6 @@ asmlinkage void alignment_check(void);
40asmlinkage void machine_check(void); 40asmlinkage void machine_check(void);
41#endif /* CONFIG_X86_MCE */ 41#endif /* CONFIG_X86_MCE */
42asmlinkage void simd_coprocessor_error(void); 42asmlinkage void simd_coprocessor_error(void);
43asmlinkage void emulate_vsyscall(void);
44 43
45dotraplinkage void do_divide_error(struct pt_regs *, long); 44dotraplinkage void do_divide_error(struct pt_regs *, long);
46dotraplinkage void do_debug(struct pt_regs *, long); 45dotraplinkage void do_debug(struct pt_regs *, long);
@@ -67,7 +66,6 @@ dotraplinkage void do_alignment_check(struct pt_regs *, long);
67dotraplinkage void do_machine_check(struct pt_regs *, long); 66dotraplinkage void do_machine_check(struct pt_regs *, long);
68#endif 67#endif
69dotraplinkage void do_simd_coprocessor_error(struct pt_regs *, long); 68dotraplinkage void do_simd_coprocessor_error(struct pt_regs *, long);
70dotraplinkage void do_emulate_vsyscall(struct pt_regs *, long);
71#ifdef CONFIG_X86_32 69#ifdef CONFIG_X86_32
72dotraplinkage void do_iret_error(struct pt_regs *, long); 70dotraplinkage void do_iret_error(struct pt_regs *, long);
73#endif 71#endif
diff --git a/arch/x86/include/asm/unistd_64.h b/arch/x86/include/asm/unistd_64.h
index 705bf139288c..d92641cc7acc 100644
--- a/arch/x86/include/asm/unistd_64.h
+++ b/arch/x86/include/asm/unistd_64.h
@@ -681,6 +681,8 @@ __SYSCALL(__NR_syncfs, sys_syncfs)
681__SYSCALL(__NR_sendmmsg, sys_sendmmsg) 681__SYSCALL(__NR_sendmmsg, sys_sendmmsg)
682#define __NR_setns 308 682#define __NR_setns 308
683__SYSCALL(__NR_setns, sys_setns) 683__SYSCALL(__NR_setns, sys_setns)
684#define __NR_getcpu 309
685__SYSCALL(__NR_getcpu, sys_getcpu)
684 686
685#ifndef __NO_STUBS 687#ifndef __NO_STUBS
686#define __ARCH_WANT_OLD_READDIR 688#define __ARCH_WANT_OLD_READDIR
diff --git a/arch/x86/include/asm/vsyscall.h b/arch/x86/include/asm/vsyscall.h
index 60107072c28b..eaea1d31f753 100644
--- a/arch/x86/include/asm/vsyscall.h
+++ b/arch/x86/include/asm/vsyscall.h
@@ -27,6 +27,12 @@ extern struct timezone sys_tz;
27 27
28extern void map_vsyscall(void); 28extern void map_vsyscall(void);
29 29
30/*
31 * Called on instruction fetch fault in vsyscall page.
32 * Returns true if handled.
33 */
34extern bool emulate_vsyscall(struct pt_regs *regs, unsigned long address);
35
30#endif /* __KERNEL__ */ 36#endif /* __KERNEL__ */
31 37
32#endif /* _ASM_X86_VSYSCALL_H */ 38#endif /* _ASM_X86_VSYSCALL_H */
diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h
index 64a619d47d34..7ff4669580cf 100644
--- a/arch/x86/include/asm/xen/page.h
+++ b/arch/x86/include/asm/xen/page.h
@@ -39,7 +39,7 @@ typedef struct xpaddr {
39 ((unsigned long)((u64)CONFIG_XEN_MAX_DOMAIN_MEMORY * 1024 * 1024 * 1024 / PAGE_SIZE)) 39 ((unsigned long)((u64)CONFIG_XEN_MAX_DOMAIN_MEMORY * 1024 * 1024 * 1024 / PAGE_SIZE))
40 40
41extern unsigned long *machine_to_phys_mapping; 41extern unsigned long *machine_to_phys_mapping;
42extern unsigned int machine_to_phys_order; 42extern unsigned long machine_to_phys_nr;
43 43
44extern unsigned long get_phys_to_machine(unsigned long pfn); 44extern unsigned long get_phys_to_machine(unsigned long pfn);
45extern bool set_phys_to_machine(unsigned long pfn, unsigned long mfn); 45extern bool set_phys_to_machine(unsigned long pfn, unsigned long mfn);
@@ -87,7 +87,7 @@ static inline unsigned long mfn_to_pfn(unsigned long mfn)
87 if (xen_feature(XENFEAT_auto_translated_physmap)) 87 if (xen_feature(XENFEAT_auto_translated_physmap))
88 return mfn; 88 return mfn;
89 89
90 if (unlikely((mfn >> machine_to_phys_order) != 0)) { 90 if (unlikely(mfn >= machine_to_phys_nr)) {
91 pfn = ~0; 91 pfn = ~0;
92 goto try_override; 92 goto try_override;
93 } 93 }
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 04105574c8e9..82f2912155a5 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -17,19 +17,6 @@ CFLAGS_REMOVE_ftrace.o = -pg
17CFLAGS_REMOVE_early_printk.o = -pg 17CFLAGS_REMOVE_early_printk.o = -pg
18endif 18endif
19 19
20#
21# vsyscalls (which work on the user stack) should have
22# no stack-protector checks:
23#
24nostackp := $(call cc-option, -fno-stack-protector)
25CFLAGS_vsyscall_64.o := $(PROFILING) -g0 $(nostackp)
26CFLAGS_hpet.o := $(nostackp)
27CFLAGS_paravirt.o := $(nostackp)
28GCOV_PROFILE_vsyscall_64.o := n
29GCOV_PROFILE_hpet.o := n
30GCOV_PROFILE_tsc.o := n
31GCOV_PROFILE_paravirt.o := n
32
33obj-y := process_$(BITS).o signal.o entry_$(BITS).o 20obj-y := process_$(BITS).o signal.o entry_$(BITS).o
34obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o 21obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o
35obj-y += time.o ioport.o ldt.o dumpstack.o 22obj-y += time.o ioport.o ldt.o dumpstack.o
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index adc66c3a1fef..34b18594e724 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -207,7 +207,6 @@ static int __cpuinit uv_wakeup_secondary(int phys_apicid, unsigned long start_ri
207 ((start_rip << UVH_IPI_INT_VECTOR_SHFT) >> 12) | 207 ((start_rip << UVH_IPI_INT_VECTOR_SHFT) >> 12) |
208 APIC_DM_INIT; 208 APIC_DM_INIT;
209 uv_write_global_mmr64(pnode, UVH_IPI_INT, val); 209 uv_write_global_mmr64(pnode, UVH_IPI_INT, val);
210 mdelay(10);
211 210
212 val = (1UL << UVH_IPI_INT_SEND_SHFT) | 211 val = (1UL << UVH_IPI_INT_SEND_SHFT) |
213 (phys_apicid << UVH_IPI_INT_APIC_ID_SHFT) | 212 (phys_apicid << UVH_IPI_INT_APIC_ID_SHFT) |
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index 08119a37e53c..6b96110bb0c3 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -149,7 +149,6 @@ struct set_mtrr_data {
149 */ 149 */
150static int mtrr_rendezvous_handler(void *info) 150static int mtrr_rendezvous_handler(void *info)
151{ 151{
152#ifdef CONFIG_SMP
153 struct set_mtrr_data *data = info; 152 struct set_mtrr_data *data = info;
154 153
155 /* 154 /*
@@ -171,7 +170,6 @@ static int mtrr_rendezvous_handler(void *info)
171 } else if (mtrr_aps_delayed_init || !cpu_online(smp_processor_id())) { 170 } else if (mtrr_aps_delayed_init || !cpu_online(smp_processor_id())) {
172 mtrr_if->set_all(); 171 mtrr_if->set_all();
173 } 172 }
174#endif
175 return 0; 173 return 0;
176} 174}
177 175
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 45fbb8f7f549..f88af2c2a561 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -1590,6 +1590,7 @@ static __init int intel_pmu_init(void)
1590 break; 1590 break;
1591 1591
1592 case 42: /* SandyBridge */ 1592 case 42: /* SandyBridge */
1593 case 45: /* SandyBridge, "Romely-EP" */
1593 memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, 1594 memcpy(hw_cache_event_ids, snb_hw_cache_event_ids,
1594 sizeof(hw_cache_event_ids)); 1595 sizeof(hw_cache_event_ids));
1595 1596
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 5c1a91974918..f3f6f5344001 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -54,6 +54,7 @@
54#include <asm/ftrace.h> 54#include <asm/ftrace.h>
55#include <asm/irq_vectors.h> 55#include <asm/irq_vectors.h>
56#include <asm/cpufeature.h> 56#include <asm/cpufeature.h>
57#include <asm/alternative-asm.h>
57 58
58/* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */ 59/* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */
59#include <linux/elf-em.h> 60#include <linux/elf-em.h>
@@ -873,12 +874,7 @@ ENTRY(simd_coprocessor_error)
873661: pushl_cfi $do_general_protection 874661: pushl_cfi $do_general_protection
874662: 875662:
875.section .altinstructions,"a" 876.section .altinstructions,"a"
876 .balign 4 877 altinstruction_entry 661b, 663f, X86_FEATURE_XMM, 662b-661b, 664f-663f
877 .long 661b
878 .long 663f
879 .word X86_FEATURE_XMM
880 .byte 662b-661b
881 .byte 664f-663f
882.previous 878.previous
883.section .altinstr_replacement,"ax" 879.section .altinstr_replacement,"ax"
884663: pushl $do_simd_coprocessor_error 880663: pushl $do_simd_coprocessor_error
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index e13329d800c8..6419bb05ecd5 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -1111,7 +1111,6 @@ zeroentry spurious_interrupt_bug do_spurious_interrupt_bug
1111zeroentry coprocessor_error do_coprocessor_error 1111zeroentry coprocessor_error do_coprocessor_error
1112errorentry alignment_check do_alignment_check 1112errorentry alignment_check do_alignment_check
1113zeroentry simd_coprocessor_error do_simd_coprocessor_error 1113zeroentry simd_coprocessor_error do_simd_coprocessor_error
1114zeroentry emulate_vsyscall do_emulate_vsyscall
1115 1114
1116 1115
1117 /* Reload gs selector with exception handling */ 1116 /* Reload gs selector with exception handling */
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index 613a7931ecc1..d90272e6bc40 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -307,6 +307,10 @@ struct pv_info pv_info = {
307 .paravirt_enabled = 0, 307 .paravirt_enabled = 0,
308 .kernel_rpl = 0, 308 .kernel_rpl = 0,
309 .shared_kernel_pmd = 1, /* Only used when CONFIG_X86_PAE is set */ 309 .shared_kernel_pmd = 1, /* Only used when CONFIG_X86_PAE is set */
310
311#ifdef CONFIG_X86_64
312 .extra_user_64bit_cs = __USER_CS,
313#endif
310}; 314};
311 315
312struct pv_init_ops pv_init_ops = { 316struct pv_init_ops pv_init_ops = {
diff --git a/arch/x86/kernel/step.c b/arch/x86/kernel/step.c
index 7977f0cfe339..c346d1161488 100644
--- a/arch/x86/kernel/step.c
+++ b/arch/x86/kernel/step.c
@@ -74,7 +74,7 @@ static int is_setting_trap_flag(struct task_struct *child, struct pt_regs *regs)
74 74
75#ifdef CONFIG_X86_64 75#ifdef CONFIG_X86_64
76 case 0x40 ... 0x4f: 76 case 0x40 ... 0x4f:
77 if (regs->cs != __USER_CS) 77 if (!user_64bit_mode(regs))
78 /* 32-bit mode: register increment */ 78 /* 32-bit mode: register increment */
79 return 0; 79 return 0;
80 /* 64-bit mode: REX prefix */ 80 /* 64-bit mode: REX prefix */
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 9682ec50180c..6913369c234c 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -872,12 +872,6 @@ void __init trap_init(void)
872 set_bit(SYSCALL_VECTOR, used_vectors); 872 set_bit(SYSCALL_VECTOR, used_vectors);
873#endif 873#endif
874 874
875#ifdef CONFIG_X86_64
876 BUG_ON(test_bit(VSYSCALL_EMU_VECTOR, used_vectors));
877 set_system_intr_gate(VSYSCALL_EMU_VECTOR, &emulate_vsyscall);
878 set_bit(VSYSCALL_EMU_VECTOR, used_vectors);
879#endif
880
881 /* 875 /*
882 * Should be a barrier for any external CPU state: 876 * Should be a barrier for any external CPU state:
883 */ 877 */
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 4aa9c54a9b76..0f703f10901a 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -71,7 +71,6 @@ PHDRS {
71 text PT_LOAD FLAGS(5); /* R_E */ 71 text PT_LOAD FLAGS(5); /* R_E */
72 data PT_LOAD FLAGS(6); /* RW_ */ 72 data PT_LOAD FLAGS(6); /* RW_ */
73#ifdef CONFIG_X86_64 73#ifdef CONFIG_X86_64
74 user PT_LOAD FLAGS(5); /* R_E */
75#ifdef CONFIG_SMP 74#ifdef CONFIG_SMP
76 percpu PT_LOAD FLAGS(6); /* RW_ */ 75 percpu PT_LOAD FLAGS(6); /* RW_ */
77#endif 76#endif
@@ -154,44 +153,16 @@ SECTIONS
154 153
155#ifdef CONFIG_X86_64 154#ifdef CONFIG_X86_64
156 155
157#define VSYSCALL_ADDR (-10*1024*1024) 156 . = ALIGN(PAGE_SIZE);
158
159#define VLOAD_OFFSET (VSYSCALL_ADDR - __vsyscall_0 + LOAD_OFFSET)
160#define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)
161
162#define VVIRT_OFFSET (VSYSCALL_ADDR - __vsyscall_0)
163#define VVIRT(x) (ADDR(x) - VVIRT_OFFSET)
164
165 . = ALIGN(4096);
166 __vsyscall_0 = .;
167
168 . = VSYSCALL_ADDR;
169 .vsyscall : AT(VLOAD(.vsyscall)) {
170 *(.vsyscall_0)
171
172 . = 1024;
173 *(.vsyscall_1)
174
175 . = 2048;
176 *(.vsyscall_2)
177
178 . = 4096; /* Pad the whole page. */
179 } :user =0xcc
180 . = ALIGN(__vsyscall_0 + PAGE_SIZE, PAGE_SIZE);
181
182#undef VSYSCALL_ADDR
183#undef VLOAD_OFFSET
184#undef VLOAD
185#undef VVIRT_OFFSET
186#undef VVIRT
187
188 __vvar_page = .; 157 __vvar_page = .;
189 158
190 .vvar : AT(ADDR(.vvar) - LOAD_OFFSET) { 159 .vvar : AT(ADDR(.vvar) - LOAD_OFFSET) {
160 /* work around gold bug 13023 */
161 __vvar_beginning_hack = .;
191 162
192 /* Place all vvars at the offsets in asm/vvar.h. */ 163 /* Place all vvars at the offsets in asm/vvar.h. */
193#define EMIT_VVAR(name, offset) \ 164#define EMIT_VVAR(name, offset) \
194 . = offset; \ 165 . = __vvar_beginning_hack + offset; \
195 *(.vvar_ ## name) 166 *(.vvar_ ## name)
196#define __VVAR_KERNEL_LDS 167#define __VVAR_KERNEL_LDS
197#include <asm/vvar.h> 168#include <asm/vvar.h>
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index dda7dff9cef7..18ae83dd1cd7 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -18,9 +18,6 @@
18 * use the vDSO. 18 * use the vDSO.
19 */ 19 */
20 20
21/* Disable profiling for userspace code: */
22#define DISABLE_BRANCH_PROFILING
23
24#include <linux/time.h> 21#include <linux/time.h>
25#include <linux/init.h> 22#include <linux/init.h>
26#include <linux/kernel.h> 23#include <linux/kernel.h>
@@ -50,12 +47,36 @@
50#include <asm/vgtod.h> 47#include <asm/vgtod.h>
51#include <asm/traps.h> 48#include <asm/traps.h>
52 49
50#define CREATE_TRACE_POINTS
51#include "vsyscall_trace.h"
52
53DEFINE_VVAR(int, vgetcpu_mode); 53DEFINE_VVAR(int, vgetcpu_mode);
54DEFINE_VVAR(struct vsyscall_gtod_data, vsyscall_gtod_data) = 54DEFINE_VVAR(struct vsyscall_gtod_data, vsyscall_gtod_data) =
55{ 55{
56 .lock = __SEQLOCK_UNLOCKED(__vsyscall_gtod_data.lock), 56 .lock = __SEQLOCK_UNLOCKED(__vsyscall_gtod_data.lock),
57}; 57};
58 58
59static enum { EMULATE, NATIVE, NONE } vsyscall_mode = EMULATE;
60
61static int __init vsyscall_setup(char *str)
62{
63 if (str) {
64 if (!strcmp("emulate", str))
65 vsyscall_mode = EMULATE;
66 else if (!strcmp("native", str))
67 vsyscall_mode = NATIVE;
68 else if (!strcmp("none", str))
69 vsyscall_mode = NONE;
70 else
71 return -EINVAL;
72
73 return 0;
74 }
75
76 return -EINVAL;
77}
78early_param("vsyscall", vsyscall_setup);
79
59void update_vsyscall_tz(void) 80void update_vsyscall_tz(void)
60{ 81{
61 unsigned long flags; 82 unsigned long flags;
@@ -100,7 +121,7 @@ static void warn_bad_vsyscall(const char *level, struct pt_regs *regs,
100 121
101 printk("%s%s[%d] %s ip:%lx cs:%lx sp:%lx ax:%lx si:%lx di:%lx\n", 122 printk("%s%s[%d] %s ip:%lx cs:%lx sp:%lx ax:%lx si:%lx di:%lx\n",
102 level, tsk->comm, task_pid_nr(tsk), 123 level, tsk->comm, task_pid_nr(tsk),
103 message, regs->ip - 2, regs->cs, 124 message, regs->ip, regs->cs,
104 regs->sp, regs->ax, regs->si, regs->di); 125 regs->sp, regs->ax, regs->si, regs->di);
105} 126}
106 127
@@ -118,46 +139,39 @@ static int addr_to_vsyscall_nr(unsigned long addr)
118 return nr; 139 return nr;
119} 140}
120 141
121void dotraplinkage do_emulate_vsyscall(struct pt_regs *regs, long error_code) 142bool emulate_vsyscall(struct pt_regs *regs, unsigned long address)
122{ 143{
123 struct task_struct *tsk; 144 struct task_struct *tsk;
124 unsigned long caller; 145 unsigned long caller;
125 int vsyscall_nr; 146 int vsyscall_nr;
126 long ret; 147 long ret;
127 148
128 local_irq_enable();
129
130 /* 149 /*
131 * Real 64-bit user mode code has cs == __USER_CS. Anything else 150 * No point in checking CS -- the only way to get here is a user mode
132 * is bogus. 151 * trap to a high address, which means that we're in 64-bit user code.
133 */ 152 */
134 if (regs->cs != __USER_CS) {
135 /*
136 * If we trapped from kernel mode, we might as well OOPS now
137 * instead of returning to some random address and OOPSing
138 * then.
139 */
140 BUG_ON(!user_mode(regs));
141 153
142 /* Compat mode and non-compat 32-bit CS should both segfault. */ 154 WARN_ON_ONCE(address != regs->ip);
143 warn_bad_vsyscall(KERN_WARNING, regs, 155
144 "illegal int 0xcc from 32-bit mode"); 156 if (vsyscall_mode == NONE) {
145 goto sigsegv; 157 warn_bad_vsyscall(KERN_INFO, regs,
158 "vsyscall attempted with vsyscall=none");
159 return false;
146 } 160 }
147 161
148 /* 162 vsyscall_nr = addr_to_vsyscall_nr(address);
149 * x86-ism here: regs->ip points to the instruction after the int 0xcc, 163
150 * and int 0xcc is two bytes long. 164 trace_emulate_vsyscall(vsyscall_nr);
151 */ 165
152 vsyscall_nr = addr_to_vsyscall_nr(regs->ip - 2);
153 if (vsyscall_nr < 0) { 166 if (vsyscall_nr < 0) {
154 warn_bad_vsyscall(KERN_WARNING, regs, 167 warn_bad_vsyscall(KERN_WARNING, regs,
155 "illegal int 0xcc (exploit attempt?)"); 168 "misaligned vsyscall (exploit attempt or buggy program) -- look up the vsyscall kernel parameter if you need a workaround");
156 goto sigsegv; 169 goto sigsegv;
157 } 170 }
158 171
159 if (get_user(caller, (unsigned long __user *)regs->sp) != 0) { 172 if (get_user(caller, (unsigned long __user *)regs->sp) != 0) {
160 warn_bad_vsyscall(KERN_WARNING, regs, "int 0xcc with bad stack (exploit attempt?)"); 173 warn_bad_vsyscall(KERN_WARNING, regs,
174 "vsyscall with bad stack (exploit attempt?)");
161 goto sigsegv; 175 goto sigsegv;
162 } 176 }
163 177
@@ -202,13 +216,11 @@ void dotraplinkage do_emulate_vsyscall(struct pt_regs *regs, long error_code)
202 regs->ip = caller; 216 regs->ip = caller;
203 regs->sp += 8; 217 regs->sp += 8;
204 218
205 local_irq_disable(); 219 return true;
206 return;
207 220
208sigsegv: 221sigsegv:
209 regs->ip -= 2; /* The faulting instruction should be the int 0xcc. */
210 force_sig(SIGSEGV, current); 222 force_sig(SIGSEGV, current);
211 local_irq_disable(); 223 return true;
212} 224}
213 225
214/* 226/*
@@ -256,15 +268,21 @@ cpu_vsyscall_notifier(struct notifier_block *n, unsigned long action, void *arg)
256 268
257void __init map_vsyscall(void) 269void __init map_vsyscall(void)
258{ 270{
259 extern char __vsyscall_0; 271 extern char __vsyscall_page;
260 unsigned long physaddr_page0 = __pa_symbol(&__vsyscall_0); 272 unsigned long physaddr_vsyscall = __pa_symbol(&__vsyscall_page);
261 extern char __vvar_page; 273 extern char __vvar_page;
262 unsigned long physaddr_vvar_page = __pa_symbol(&__vvar_page); 274 unsigned long physaddr_vvar_page = __pa_symbol(&__vvar_page);
263 275
264 /* Note that VSYSCALL_MAPPED_PAGES must agree with the code below. */ 276 __set_fixmap(VSYSCALL_FIRST_PAGE, physaddr_vsyscall,
265 __set_fixmap(VSYSCALL_FIRST_PAGE, physaddr_page0, PAGE_KERNEL_VSYSCALL); 277 vsyscall_mode == NATIVE
278 ? PAGE_KERNEL_VSYSCALL
279 : PAGE_KERNEL_VVAR);
280 BUILD_BUG_ON((unsigned long)__fix_to_virt(VSYSCALL_FIRST_PAGE) !=
281 (unsigned long)VSYSCALL_START);
282
266 __set_fixmap(VVAR_PAGE, physaddr_vvar_page, PAGE_KERNEL_VVAR); 283 __set_fixmap(VVAR_PAGE, physaddr_vvar_page, PAGE_KERNEL_VVAR);
267 BUILD_BUG_ON((unsigned long)__fix_to_virt(VVAR_PAGE) != (unsigned long)VVAR_ADDRESS); 284 BUILD_BUG_ON((unsigned long)__fix_to_virt(VVAR_PAGE) !=
285 (unsigned long)VVAR_ADDRESS);
268} 286}
269 287
270static int __init vsyscall_init(void) 288static int __init vsyscall_init(void)
diff --git a/arch/x86/kernel/vsyscall_emu_64.S b/arch/x86/kernel/vsyscall_emu_64.S
index ffa845eae5ca..c9596a9af159 100644
--- a/arch/x86/kernel/vsyscall_emu_64.S
+++ b/arch/x86/kernel/vsyscall_emu_64.S
@@ -7,21 +7,31 @@
7 */ 7 */
8 8
9#include <linux/linkage.h> 9#include <linux/linkage.h>
10
10#include <asm/irq_vectors.h> 11#include <asm/irq_vectors.h>
12#include <asm/page_types.h>
13#include <asm/unistd_64.h>
14
15__PAGE_ALIGNED_DATA
16 .globl __vsyscall_page
17 .balign PAGE_SIZE, 0xcc
18 .type __vsyscall_page, @object
19__vsyscall_page:
20
21 mov $__NR_gettimeofday, %rax
22 syscall
23 ret
11 24
12/* The unused parts of the page are filled with 0xcc by the linker script. */ 25 .balign 1024, 0xcc
26 mov $__NR_time, %rax
27 syscall
28 ret
13 29
14.section .vsyscall_0, "a" 30 .balign 1024, 0xcc
15ENTRY(vsyscall_0) 31 mov $__NR_getcpu, %rax
16 int $VSYSCALL_EMU_VECTOR 32 syscall
17END(vsyscall_0) 33 ret
18 34
19.section .vsyscall_1, "a" 35 .balign 4096, 0xcc
20ENTRY(vsyscall_1)
21 int $VSYSCALL_EMU_VECTOR
22END(vsyscall_1)
23 36
24.section .vsyscall_2, "a" 37 .size __vsyscall_page, 4096
25ENTRY(vsyscall_2)
26 int $VSYSCALL_EMU_VECTOR
27END(vsyscall_2)
diff --git a/arch/x86/kernel/vsyscall_trace.h b/arch/x86/kernel/vsyscall_trace.h
new file mode 100644
index 000000000000..a8b2edec54fe
--- /dev/null
+++ b/arch/x86/kernel/vsyscall_trace.h
@@ -0,0 +1,29 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM vsyscall
3
4#if !defined(__VSYSCALL_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
5#define __VSYSCALL_TRACE_H
6
7#include <linux/tracepoint.h>
8
9TRACE_EVENT(emulate_vsyscall,
10
11 TP_PROTO(int nr),
12
13 TP_ARGS(nr),
14
15 TP_STRUCT__entry(__field(int, nr)),
16
17 TP_fast_assign(
18 __entry->nr = nr;
19 ),
20
21 TP_printk("nr = %d", __entry->nr)
22);
23
24#endif
25
26#undef TRACE_INCLUDE_PATH
27#define TRACE_INCLUDE_PATH ../../arch/x86/kernel
28#define TRACE_INCLUDE_FILE vsyscall_trace
29#include <trace/define_trace.h>
diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig
index 988724b236b6..ff5790d8e990 100644
--- a/arch/x86/kvm/Kconfig
+++ b/arch/x86/kvm/Kconfig
@@ -22,6 +22,8 @@ config KVM
22 depends on HAVE_KVM 22 depends on HAVE_KVM
23 # for device assignment: 23 # for device assignment:
24 depends on PCI 24 depends on PCI
25 # for TASKSTATS/TASK_DELAY_ACCT:
26 depends on NET
25 select PREEMPT_NOTIFIERS 27 select PREEMPT_NOTIFIERS
26 select MMU_NOTIFIER 28 select MMU_NOTIFIER
27 select ANON_INODES 29 select ANON_INODES
@@ -31,6 +33,7 @@ config KVM
31 select KVM_ASYNC_PF 33 select KVM_ASYNC_PF
32 select USER_RETURN_NOTIFIER 34 select USER_RETURN_NOTIFIER
33 select KVM_MMIO 35 select KVM_MMIO
36 select TASKSTATS
34 select TASK_DELAY_ACCT 37 select TASK_DELAY_ACCT
35 ---help--- 38 ---help---
36 Support hosting fully virtualized guest machines using hardware 39 Support hosting fully virtualized guest machines using hardware
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 4d09df054e39..0d17c8c50acd 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -17,6 +17,7 @@
17#include <asm/traps.h> /* dotraplinkage, ... */ 17#include <asm/traps.h> /* dotraplinkage, ... */
18#include <asm/pgalloc.h> /* pgd_*(), ... */ 18#include <asm/pgalloc.h> /* pgd_*(), ... */
19#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */ 19#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */
20#include <asm/vsyscall.h>
20 21
21/* 22/*
22 * Page fault error code bits: 23 * Page fault error code bits:
@@ -105,7 +106,7 @@ check_prefetch_opcode(struct pt_regs *regs, unsigned char *instr,
105 * but for now it's good enough to assume that long 106 * but for now it's good enough to assume that long
106 * mode only uses well known segments or kernel. 107 * mode only uses well known segments or kernel.
107 */ 108 */
108 return (!user_mode(regs)) || (regs->cs == __USER_CS); 109 return (!user_mode(regs) || user_64bit_mode(regs));
109#endif 110#endif
110 case 0x60: 111 case 0x60:
111 /* 0x64 thru 0x67 are valid prefixes in all modes. */ 112 /* 0x64 thru 0x67 are valid prefixes in all modes. */
@@ -720,6 +721,18 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,
720 if (is_errata100(regs, address)) 721 if (is_errata100(regs, address))
721 return; 722 return;
722 723
724#ifdef CONFIG_X86_64
725 /*
726 * Instruction fetch faults in the vsyscall page might need
727 * emulation.
728 */
729 if (unlikely((error_code & PF_INSTR) &&
730 ((address & ~0xfff) == VSYSCALL_START))) {
731 if (emulate_vsyscall(regs, address))
732 return;
733 }
734#endif
735
723 if (unlikely(show_unhandled_signals)) 736 if (unlikely(show_unhandled_signals))
724 show_signal_msg(regs, error_code, address, tsk); 737 show_signal_msg(regs, error_code, address, tsk);
725 738
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index ae3cb23cd89b..c95330267f08 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -360,6 +360,15 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root)
360 } 360 }
361 } 361 }
362 362
363 /* After the PCI-E bus has been walked and all devices discovered,
364 * configure any settings of the fabric that might be necessary.
365 */
366 if (bus) {
367 struct pci_bus *child;
368 list_for_each_entry(child, &bus->children, node)
369 pcie_bus_configure_settings(child, child->self->pcie_mpss);
370 }
371
363 if (!bus) 372 if (!bus)
364 kfree(sd); 373 kfree(sd);
365 374
diff --git a/arch/x86/platform/olpc/olpc.c b/arch/x86/platform/olpc/olpc.c
index 8b9940e78e2f..7cce722667b8 100644
--- a/arch/x86/platform/olpc/olpc.c
+++ b/arch/x86/platform/olpc/olpc.c
@@ -161,13 +161,13 @@ restart:
161 if (inbuf && inlen) { 161 if (inbuf && inlen) {
162 /* write data to EC */ 162 /* write data to EC */
163 for (i = 0; i < inlen; i++) { 163 for (i = 0; i < inlen; i++) {
164 pr_devel("olpc-ec: sending cmd arg 0x%x\n", inbuf[i]);
165 outb(inbuf[i], 0x68);
164 if (wait_on_ibf(0x6c, 0)) { 166 if (wait_on_ibf(0x6c, 0)) {
165 printk(KERN_ERR "olpc-ec: timeout waiting for" 167 printk(KERN_ERR "olpc-ec: timeout waiting for"
166 " EC accept data!\n"); 168 " EC accept data!\n");
167 goto err; 169 goto err;
168 } 170 }
169 pr_devel("olpc-ec: sending cmd arg 0x%x\n", inbuf[i]);
170 outb(inbuf[i], 0x68);
171 } 171 }
172 } 172 }
173 if (outbuf && outlen) { 173 if (outbuf && outlen) {
diff --git a/arch/x86/vdso/vdso.S b/arch/x86/vdso/vdso.S
index 1b979c12ba85..01f5e3b4613c 100644
--- a/arch/x86/vdso/vdso.S
+++ b/arch/x86/vdso/vdso.S
@@ -9,6 +9,7 @@ __PAGE_ALIGNED_DATA
9vdso_start: 9vdso_start:
10 .incbin "arch/x86/vdso/vdso.so" 10 .incbin "arch/x86/vdso/vdso.so"
11vdso_end: 11vdso_end:
12 .align PAGE_SIZE /* extra data here leaks to userspace. */
12 13
13.previous 14.previous
14 15
diff --git a/arch/x86/vdso/vdso32/sysenter.S b/arch/x86/vdso/vdso32/sysenter.S
index e2800affa754..e354bceee0e0 100644
--- a/arch/x86/vdso/vdso32/sysenter.S
+++ b/arch/x86/vdso/vdso32/sysenter.S
@@ -43,7 +43,7 @@ __kernel_vsyscall:
43 .space 7,0x90 43 .space 7,0x90
44 44
45 /* 14: System call restart point is here! (SYSENTER_RETURN-2) */ 45 /* 14: System call restart point is here! (SYSENTER_RETURN-2) */
46 jmp .Lenter_kernel 46 int $0x80
47 /* 16: System call normal return point is here! */ 47 /* 16: System call normal return point is here! */
48VDSO32_SYSENTER_RETURN: /* Symbol used by sysenter.c via vdso32-syms.h */ 48VDSO32_SYSENTER_RETURN: /* Symbol used by sysenter.c via vdso32-syms.h */
49 pop %ebp 49 pop %ebp
diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile
index 3326204e251f..add2c2d729ce 100644
--- a/arch/x86/xen/Makefile
+++ b/arch/x86/xen/Makefile
@@ -15,7 +15,7 @@ obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \
15 grant-table.o suspend.o platform-pci-unplug.o \ 15 grant-table.o suspend.o platform-pci-unplug.o \
16 p2m.o 16 p2m.o
17 17
18obj-$(CONFIG_FTRACE) += trace.o 18obj-$(CONFIG_EVENT_TRACING) += trace.o
19 19
20obj-$(CONFIG_SMP) += smp.o 20obj-$(CONFIG_SMP) += smp.o
21obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o 21obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 974a528458a0..2d69617950f7 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -77,8 +77,8 @@ EXPORT_SYMBOL_GPL(xen_domain_type);
77 77
78unsigned long *machine_to_phys_mapping = (void *)MACH2PHYS_VIRT_START; 78unsigned long *machine_to_phys_mapping = (void *)MACH2PHYS_VIRT_START;
79EXPORT_SYMBOL(machine_to_phys_mapping); 79EXPORT_SYMBOL(machine_to_phys_mapping);
80unsigned int machine_to_phys_order; 80unsigned long machine_to_phys_nr;
81EXPORT_SYMBOL(machine_to_phys_order); 81EXPORT_SYMBOL(machine_to_phys_nr);
82 82
83struct start_info *xen_start_info; 83struct start_info *xen_start_info;
84EXPORT_SYMBOL_GPL(xen_start_info); 84EXPORT_SYMBOL_GPL(xen_start_info);
@@ -951,6 +951,10 @@ static const struct pv_info xen_info __initconst = {
951 .paravirt_enabled = 1, 951 .paravirt_enabled = 1,
952 .shared_kernel_pmd = 0, 952 .shared_kernel_pmd = 0,
953 953
954#ifdef CONFIG_X86_64
955 .extra_user_64bit_cs = FLAT_USER_CS64,
956#endif
957
954 .name = "Xen", 958 .name = "Xen",
955}; 959};
956 960
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index f987bde77c49..20a614275064 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1713,15 +1713,19 @@ static void __init xen_map_identity_early(pmd_t *pmd, unsigned long max_pfn)
1713void __init xen_setup_machphys_mapping(void) 1713void __init xen_setup_machphys_mapping(void)
1714{ 1714{
1715 struct xen_machphys_mapping mapping; 1715 struct xen_machphys_mapping mapping;
1716 unsigned long machine_to_phys_nr_ents;
1717 1716
1718 if (HYPERVISOR_memory_op(XENMEM_machphys_mapping, &mapping) == 0) { 1717 if (HYPERVISOR_memory_op(XENMEM_machphys_mapping, &mapping) == 0) {
1719 machine_to_phys_mapping = (unsigned long *)mapping.v_start; 1718 machine_to_phys_mapping = (unsigned long *)mapping.v_start;
1720 machine_to_phys_nr_ents = mapping.max_mfn + 1; 1719 machine_to_phys_nr = mapping.max_mfn + 1;
1721 } else { 1720 } else {
1722 machine_to_phys_nr_ents = MACH2PHYS_NR_ENTRIES; 1721 machine_to_phys_nr = MACH2PHYS_NR_ENTRIES;
1723 } 1722 }
1724 machine_to_phys_order = fls(machine_to_phys_nr_ents - 1); 1723#ifdef CONFIG_X86_32
1724 if ((machine_to_phys_mapping + machine_to_phys_nr)
1725 < machine_to_phys_mapping)
1726 machine_to_phys_nr = (unsigned long *)NULL
1727 - machine_to_phys_mapping;
1728#endif
1725} 1729}
1726 1730
1727#ifdef CONFIG_X86_64 1731#ifdef CONFIG_X86_64
@@ -1916,6 +1920,7 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
1916# endif 1920# endif
1917#else 1921#else
1918 case VSYSCALL_LAST_PAGE ... VSYSCALL_FIRST_PAGE: 1922 case VSYSCALL_LAST_PAGE ... VSYSCALL_FIRST_PAGE:
1923 case VVAR_PAGE:
1919#endif 1924#endif
1920 case FIX_TEXT_POKE0: 1925 case FIX_TEXT_POKE0:
1921 case FIX_TEXT_POKE1: 1926 case FIX_TEXT_POKE1:
@@ -1956,7 +1961,8 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
1956#ifdef CONFIG_X86_64 1961#ifdef CONFIG_X86_64
1957 /* Replicate changes to map the vsyscall page into the user 1962 /* Replicate changes to map the vsyscall page into the user
1958 pagetable vsyscall mapping. */ 1963 pagetable vsyscall mapping. */
1959 if (idx >= VSYSCALL_LAST_PAGE && idx <= VSYSCALL_FIRST_PAGE) { 1964 if ((idx >= VSYSCALL_LAST_PAGE && idx <= VSYSCALL_FIRST_PAGE) ||
1965 idx == VVAR_PAGE) {
1960 unsigned long vaddr = __fix_to_virt(idx); 1966 unsigned long vaddr = __fix_to_virt(idx);
1961 set_pte_vaddr_pud(level3_user_vsyscall, vaddr, pte); 1967 set_pte_vaddr_pud(level3_user_vsyscall, vaddr, pte);
1962 } 1968 }
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index b4533a86d7e4..e79dbb95482b 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -521,8 +521,6 @@ static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus)
521 native_smp_prepare_cpus(max_cpus); 521 native_smp_prepare_cpus(max_cpus);
522 WARN_ON(xen_smp_intr_init(0)); 522 WARN_ON(xen_smp_intr_init(0));
523 523
524 if (!xen_have_vector_callback)
525 return;
526 xen_init_lock_cpu(0); 524 xen_init_lock_cpu(0);
527 xen_init_spinlocks(); 525 xen_init_spinlocks();
528} 526}
@@ -546,6 +544,8 @@ static void xen_hvm_cpu_die(unsigned int cpu)
546 544
547void __init xen_hvm_smp_init(void) 545void __init xen_hvm_smp_init(void)
548{ 546{
547 if (!xen_have_vector_callback)
548 return;
549 smp_ops.smp_prepare_cpus = xen_hvm_smp_prepare_cpus; 549 smp_ops.smp_prepare_cpus = xen_hvm_smp_prepare_cpus;
550 smp_ops.smp_send_reschedule = xen_smp_send_reschedule; 550 smp_ops.smp_send_reschedule = xen_smp_send_reschedule;
551 smp_ops.cpu_up = xen_hvm_cpu_up; 551 smp_ops.cpu_up = xen_hvm_cpu_up;