aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig14
-rw-r--r--arch/arm/include/asm/futex.h34
-rw-r--r--arch/arm/include/asm/unistd.h4
-rw-r--r--arch/arm/kernel/smp_scu.c10
-rw-r--r--arch/arm/kernel/vmlinux.lds.S15
-rw-r--r--arch/arm/mach-exynos4/clock.c6
-rw-r--r--arch/arm/mach-s3c2443/clock.c2
-rw-r--r--arch/arm/mach-s5pv210/clock.c6
-rw-r--r--arch/arm/mach-tegra/common.c2
-rw-r--r--arch/arm/mach-tegra/cpu-tegra.c6
-rw-r--r--arch/arm/mach-tegra/devices.c2
-rw-r--r--arch/arm/mach-tegra/dma.c14
-rw-r--r--arch/arm/mach-tegra/include/mach/io.h18
-rw-r--r--arch/arm/mach-tegra/include/mach/powergate.h1
-rw-r--r--arch/arm/mach-tegra/io.c8
-rw-r--r--arch/arm/mach-tegra/pcie.c8
-rw-r--r--arch/arm/mach-tegra/powergate.c5
-rw-r--r--arch/arm/mach-tegra/tegra2_clocks.c50
-rw-r--r--arch/arm/mach-tegra/timer.c6
-rw-r--r--arch/arm/mm/cache-v7.S20
-rw-r--r--arch/arm/mm/dma-mapping.c2
-rw-r--r--arch/arm/plat-s5p/irq-gpioint.c9
-rw-r--r--arch/powerpc/platforms/powermac/pci.c14
-rw-r--r--arch/s390/include/asm/elf.h3
-rw-r--r--arch/s390/include/asm/pgtable.h2
-rw-r--r--arch/s390/kernel/asm-offsets.c3
-rw-r--r--arch/s390/kernel/entry64.S6
-rw-r--r--arch/s390/kvm/kvm-s390.c5
-rw-r--r--arch/s390/mm/pgtable.c17
-rw-r--r--arch/sparc/include/asm/spitfire.h2
-rw-r--r--arch/sparc/include/asm/xor_64.h4
-rw-r--r--arch/sparc/kernel/cpu.c12
-rw-r--r--arch/sparc/kernel/cpumap.c2
-rw-r--r--arch/sparc/kernel/head_64.S25
-rw-r--r--arch/sparc/kernel/process_32.c3
-rw-r--r--arch/sparc/kernel/process_64.c3
-rw-r--r--arch/sparc/kernel/setup_32.c2
-rw-r--r--arch/sparc/kernel/setup_64.c18
-rw-r--r--arch/sparc/mm/init_64.c5
-rw-r--r--arch/x86/kernel/rtc.c23
-rw-r--r--arch/x86/kvm/emulate.c2
-rw-r--r--arch/x86/kvm/mmu.c3
-rw-r--r--arch/x86/platform/mrst/vrtc.c9
43 files changed, 274 insertions, 131 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 2ad79b288b69..9277237810e9 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1285,6 +1285,20 @@ config ARM_ERRATA_364296
1285 processor into full low interrupt latency mode. ARM11MPCore 1285 processor into full low interrupt latency mode. ARM11MPCore
1286 is not affected. 1286 is not affected.
1287 1287
1288config ARM_ERRATA_764369
1289 bool "ARM errata: Data cache line maintenance operation by MVA may not succeed"
1290 depends on CPU_V7 && SMP
1291 help
1292 This option enables the workaround for erratum 764369
1293 affecting Cortex-A9 MPCore with two or more processors (all
1294 current revisions). Under certain timing circumstances, a data
1295 cache line maintenance operation by MVA targeting an Inner
1296 Shareable memory region may fail to proceed up to either the
1297 Point of Coherency or to the Point of Unification of the
1298 system. This workaround adds a DSB instruction before the
1299 relevant cache maintenance functions and sets a specific bit
1300 in the diagnostic control register of the SCU.
1301
1288endmenu 1302endmenu
1289 1303
1290source "arch/arm/common/Kconfig" 1304source "arch/arm/common/Kconfig"
diff --git a/arch/arm/include/asm/futex.h b/arch/arm/include/asm/futex.h
index 8c73900da9ed..253cc86318bf 100644
--- a/arch/arm/include/asm/futex.h
+++ b/arch/arm/include/asm/futex.h
@@ -25,17 +25,17 @@
25 25
26#ifdef CONFIG_SMP 26#ifdef CONFIG_SMP
27 27
28#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ 28#define __futex_atomic_op(insn, ret, oldval, tmp, uaddr, oparg) \
29 smp_mb(); \ 29 smp_mb(); \
30 __asm__ __volatile__( \ 30 __asm__ __volatile__( \
31 "1: ldrex %1, [%2]\n" \ 31 "1: ldrex %1, [%3]\n" \
32 " " insn "\n" \ 32 " " insn "\n" \
33 "2: strex %1, %0, [%2]\n" \ 33 "2: strex %2, %0, [%3]\n" \
34 " teq %1, #0\n" \ 34 " teq %2, #0\n" \
35 " bne 1b\n" \ 35 " bne 1b\n" \
36 " mov %0, #0\n" \ 36 " mov %0, #0\n" \
37 __futex_atomic_ex_table("%4") \ 37 __futex_atomic_ex_table("%5") \
38 : "=&r" (ret), "=&r" (oldval) \ 38 : "=&r" (ret), "=&r" (oldval), "=&r" (tmp) \
39 : "r" (uaddr), "r" (oparg), "Ir" (-EFAULT) \ 39 : "r" (uaddr), "r" (oparg), "Ir" (-EFAULT) \
40 : "cc", "memory") 40 : "cc", "memory")
41 41
@@ -73,14 +73,14 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
73#include <linux/preempt.h> 73#include <linux/preempt.h>
74#include <asm/domain.h> 74#include <asm/domain.h>
75 75
76#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ 76#define __futex_atomic_op(insn, ret, oldval, tmp, uaddr, oparg) \
77 __asm__ __volatile__( \ 77 __asm__ __volatile__( \
78 "1: " T(ldr) " %1, [%2]\n" \ 78 "1: " T(ldr) " %1, [%3]\n" \
79 " " insn "\n" \ 79 " " insn "\n" \
80 "2: " T(str) " %0, [%2]\n" \ 80 "2: " T(str) " %0, [%3]\n" \
81 " mov %0, #0\n" \ 81 " mov %0, #0\n" \
82 __futex_atomic_ex_table("%4") \ 82 __futex_atomic_ex_table("%5") \
83 : "=&r" (ret), "=&r" (oldval) \ 83 : "=&r" (ret), "=&r" (oldval), "=&r" (tmp) \
84 : "r" (uaddr), "r" (oparg), "Ir" (-EFAULT) \ 84 : "r" (uaddr), "r" (oparg), "Ir" (-EFAULT) \
85 : "cc", "memory") 85 : "cc", "memory")
86 86
@@ -117,7 +117,7 @@ futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
117 int cmp = (encoded_op >> 24) & 15; 117 int cmp = (encoded_op >> 24) & 15;
118 int oparg = (encoded_op << 8) >> 20; 118 int oparg = (encoded_op << 8) >> 20;
119 int cmparg = (encoded_op << 20) >> 20; 119 int cmparg = (encoded_op << 20) >> 20;
120 int oldval = 0, ret; 120 int oldval = 0, ret, tmp;
121 121
122 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) 122 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
123 oparg = 1 << oparg; 123 oparg = 1 << oparg;
@@ -129,19 +129,19 @@ futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
129 129
130 switch (op) { 130 switch (op) {
131 case FUTEX_OP_SET: 131 case FUTEX_OP_SET:
132 __futex_atomic_op("mov %0, %3", ret, oldval, uaddr, oparg); 132 __futex_atomic_op("mov %0, %4", ret, oldval, tmp, uaddr, oparg);
133 break; 133 break;
134 case FUTEX_OP_ADD: 134 case FUTEX_OP_ADD:
135 __futex_atomic_op("add %0, %1, %3", ret, oldval, uaddr, oparg); 135 __futex_atomic_op("add %0, %1, %4", ret, oldval, tmp, uaddr, oparg);
136 break; 136 break;
137 case FUTEX_OP_OR: 137 case FUTEX_OP_OR:
138 __futex_atomic_op("orr %0, %1, %3", ret, oldval, uaddr, oparg); 138 __futex_atomic_op("orr %0, %1, %4", ret, oldval, tmp, uaddr, oparg);
139 break; 139 break;
140 case FUTEX_OP_ANDN: 140 case FUTEX_OP_ANDN:
141 __futex_atomic_op("and %0, %1, %3", ret, oldval, uaddr, ~oparg); 141 __futex_atomic_op("and %0, %1, %4", ret, oldval, tmp, uaddr, ~oparg);
142 break; 142 break;
143 case FUTEX_OP_XOR: 143 case FUTEX_OP_XOR:
144 __futex_atomic_op("eor %0, %1, %3", ret, oldval, uaddr, oparg); 144 __futex_atomic_op("eor %0, %1, %4", ret, oldval, tmp, uaddr, oparg);
145 break; 145 break;
146 default: 146 default:
147 ret = -ENOSYS; 147 ret = -ENOSYS;
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
index 2c04ed5efeb5..c60a2944f95b 100644
--- a/arch/arm/include/asm/unistd.h
+++ b/arch/arm/include/asm/unistd.h
@@ -478,8 +478,8 @@
478/* 478/*
479 * Unimplemented (or alternatively implemented) syscalls 479 * Unimplemented (or alternatively implemented) syscalls
480 */ 480 */
481#define __IGNORE_fadvise64_64 1 481#define __IGNORE_fadvise64_64
482#define __IGNORE_migrate_pages 1 482#define __IGNORE_migrate_pages
483 483
484#endif /* __KERNEL__ */ 484#endif /* __KERNEL__ */
485#endif /* __ASM_ARM_UNISTD_H */ 485#endif /* __ASM_ARM_UNISTD_H */
diff --git a/arch/arm/kernel/smp_scu.c b/arch/arm/kernel/smp_scu.c
index 79ed5e7f204a..7fcddb75c877 100644
--- a/arch/arm/kernel/smp_scu.c
+++ b/arch/arm/kernel/smp_scu.c
@@ -13,6 +13,7 @@
13 13
14#include <asm/smp_scu.h> 14#include <asm/smp_scu.h>
15#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
16#include <asm/cputype.h>
16 17
17#define SCU_CTRL 0x00 18#define SCU_CTRL 0x00
18#define SCU_CONFIG 0x04 19#define SCU_CONFIG 0x04
@@ -37,6 +38,15 @@ void __init scu_enable(void __iomem *scu_base)
37{ 38{
38 u32 scu_ctrl; 39 u32 scu_ctrl;
39 40
41#ifdef CONFIG_ARM_ERRATA_764369
42 /* Cortex-A9 only */
43 if ((read_cpuid(CPUID_ID) & 0xff0ffff0) == 0x410fc090) {
44 scu_ctrl = __raw_readl(scu_base + 0x30);
45 if (!(scu_ctrl & 1))
46 __raw_writel(scu_ctrl | 0x1, scu_base + 0x30);
47 }
48#endif
49
40 scu_ctrl = __raw_readl(scu_base + SCU_CTRL); 50 scu_ctrl = __raw_readl(scu_base + SCU_CTRL);
41 /* already enabled? */ 51 /* already enabled? */
42 if (scu_ctrl & 1) 52 if (scu_ctrl & 1)
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index bf977f8514f6..4e66f62b8d41 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -23,8 +23,10 @@
23 23
24#if defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK) 24#if defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)
25#define ARM_EXIT_KEEP(x) x 25#define ARM_EXIT_KEEP(x) x
26#define ARM_EXIT_DISCARD(x)
26#else 27#else
27#define ARM_EXIT_KEEP(x) 28#define ARM_EXIT_KEEP(x)
29#define ARM_EXIT_DISCARD(x) x
28#endif 30#endif
29 31
30OUTPUT_ARCH(arm) 32OUTPUT_ARCH(arm)
@@ -39,6 +41,11 @@ jiffies = jiffies_64 + 4;
39SECTIONS 41SECTIONS
40{ 42{
41 /* 43 /*
44 * XXX: The linker does not define how output sections are
45 * assigned to input sections when there are multiple statements
46 * matching the same input section name. There is no documented
47 * order of matching.
48 *
42 * unwind exit sections must be discarded before the rest of the 49 * unwind exit sections must be discarded before the rest of the
43 * unwind sections get included. 50 * unwind sections get included.
44 */ 51 */
@@ -47,6 +54,9 @@ SECTIONS
47 *(.ARM.extab.exit.text) 54 *(.ARM.extab.exit.text)
48 ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text)) 55 ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))
49 ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text)) 56 ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))
57 ARM_EXIT_DISCARD(EXIT_TEXT)
58 ARM_EXIT_DISCARD(EXIT_DATA)
59 EXIT_CALL
50#ifndef CONFIG_HOTPLUG 60#ifndef CONFIG_HOTPLUG
51 *(.ARM.exidx.devexit.text) 61 *(.ARM.exidx.devexit.text)
52 *(.ARM.extab.devexit.text) 62 *(.ARM.extab.devexit.text)
@@ -58,6 +68,8 @@ SECTIONS
58#ifndef CONFIG_SMP_ON_UP 68#ifndef CONFIG_SMP_ON_UP
59 *(.alt.smp.init) 69 *(.alt.smp.init)
60#endif 70#endif
71 *(.discard)
72 *(.discard.*)
61 } 73 }
62 74
63#ifdef CONFIG_XIP_KERNEL 75#ifdef CONFIG_XIP_KERNEL
@@ -279,9 +291,6 @@ SECTIONS
279 291
280 STABS_DEBUG 292 STABS_DEBUG
281 .comment 0 : { *(.comment) } 293 .comment 0 : { *(.comment) }
282
283 /* Default discards */
284 DISCARDS
285} 294}
286 295
287/* 296/*
diff --git a/arch/arm/mach-exynos4/clock.c b/arch/arm/mach-exynos4/clock.c
index 79d6cd0c8e7b..86964d2e9e1b 100644
--- a/arch/arm/mach-exynos4/clock.c
+++ b/arch/arm/mach-exynos4/clock.c
@@ -899,8 +899,7 @@ static struct clksrc_clk clksrcs[] = {
899 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 28, .size = 4 }, 899 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 28, .size = 4 },
900 }, { 900 }, {
901 .clk = { 901 .clk = {
902 .name = "sclk_cam", 902 .name = "sclk_cam0",
903 .devname = "exynos4-fimc.0",
904 .enable = exynos4_clksrc_mask_cam_ctrl, 903 .enable = exynos4_clksrc_mask_cam_ctrl,
905 .ctrlbit = (1 << 16), 904 .ctrlbit = (1 << 16),
906 }, 905 },
@@ -909,8 +908,7 @@ static struct clksrc_clk clksrcs[] = {
909 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 16, .size = 4 }, 908 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 16, .size = 4 },
910 }, { 909 }, {
911 .clk = { 910 .clk = {
912 .name = "sclk_cam", 911 .name = "sclk_cam1",
913 .devname = "exynos4-fimc.1",
914 .enable = exynos4_clksrc_mask_cam_ctrl, 912 .enable = exynos4_clksrc_mask_cam_ctrl,
915 .ctrlbit = (1 << 20), 913 .ctrlbit = (1 << 20),
916 }, 914 },
diff --git a/arch/arm/mach-s3c2443/clock.c b/arch/arm/mach-s3c2443/clock.c
index a1a7176675b9..38058af48972 100644
--- a/arch/arm/mach-s3c2443/clock.c
+++ b/arch/arm/mach-s3c2443/clock.c
@@ -128,7 +128,7 @@ static int s3c2443_armclk_setrate(struct clk *clk, unsigned long rate)
128 unsigned long clkcon0; 128 unsigned long clkcon0;
129 129
130 clkcon0 = __raw_readl(S3C2443_CLKDIV0); 130 clkcon0 = __raw_readl(S3C2443_CLKDIV0);
131 clkcon0 &= S3C2443_CLKDIV0_ARMDIV_MASK; 131 clkcon0 &= ~S3C2443_CLKDIV0_ARMDIV_MASK;
132 clkcon0 |= val << S3C2443_CLKDIV0_ARMDIV_SHIFT; 132 clkcon0 |= val << S3C2443_CLKDIV0_ARMDIV_SHIFT;
133 __raw_writel(clkcon0, S3C2443_CLKDIV0); 133 __raw_writel(clkcon0, S3C2443_CLKDIV0);
134 } 134 }
diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c
index 52a8e607bcc2..f5f8fa89679c 100644
--- a/arch/arm/mach-s5pv210/clock.c
+++ b/arch/arm/mach-s5pv210/clock.c
@@ -815,8 +815,7 @@ static struct clksrc_clk clksrcs[] = {
815 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 20, .size = 4 }, 815 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 20, .size = 4 },
816 }, { 816 }, {
817 .clk = { 817 .clk = {
818 .name = "sclk_cam", 818 .name = "sclk_cam0",
819 .devname = "s5pv210-fimc.0",
820 .enable = s5pv210_clk_mask0_ctrl, 819 .enable = s5pv210_clk_mask0_ctrl,
821 .ctrlbit = (1 << 3), 820 .ctrlbit = (1 << 3),
822 }, 821 },
@@ -825,8 +824,7 @@ static struct clksrc_clk clksrcs[] = {
825 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 12, .size = 4 }, 824 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 12, .size = 4 },
826 }, { 825 }, {
827 .clk = { 826 .clk = {
828 .name = "sclk_cam", 827 .name = "sclk_cam1",
829 .devname = "s5pv210-fimc.1",
830 .enable = s5pv210_clk_mask0_ctrl, 828 .enable = s5pv210_clk_mask0_ctrl,
831 .ctrlbit = (1 << 4), 829 .ctrlbit = (1 << 4),
832 }, 830 },
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
index d5e3f89b05af..690b888be506 100644
--- a/arch/arm/mach-tegra/common.c
+++ b/arch/arm/mach-tegra/common.c
@@ -61,7 +61,7 @@ static __initdata struct tegra_clk_init_table common_clk_init_table[] = {
61 { NULL, NULL, 0, 0}, 61 { NULL, NULL, 0, 0},
62}; 62};
63 63
64void __init tegra_init_cache(void) 64static void __init tegra_init_cache(void)
65{ 65{
66#ifdef CONFIG_CACHE_L2X0 66#ifdef CONFIG_CACHE_L2X0
67 void __iomem *p = IO_ADDRESS(TEGRA_ARM_PERIF_BASE) + 0x3000; 67 void __iomem *p = IO_ADDRESS(TEGRA_ARM_PERIF_BASE) + 0x3000;
diff --git a/arch/arm/mach-tegra/cpu-tegra.c b/arch/arm/mach-tegra/cpu-tegra.c
index 0e1016a827ac..b2647ec709d4 100644
--- a/arch/arm/mach-tegra/cpu-tegra.c
+++ b/arch/arm/mach-tegra/cpu-tegra.c
@@ -57,12 +57,12 @@ static unsigned long target_cpu_speed[NUM_CPUS];
57static DEFINE_MUTEX(tegra_cpu_lock); 57static DEFINE_MUTEX(tegra_cpu_lock);
58static bool is_suspended; 58static bool is_suspended;
59 59
60int tegra_verify_speed(struct cpufreq_policy *policy) 60static int tegra_verify_speed(struct cpufreq_policy *policy)
61{ 61{
62 return cpufreq_frequency_table_verify(policy, freq_table); 62 return cpufreq_frequency_table_verify(policy, freq_table);
63} 63}
64 64
65unsigned int tegra_getspeed(unsigned int cpu) 65static unsigned int tegra_getspeed(unsigned int cpu)
66{ 66{
67 unsigned long rate; 67 unsigned long rate;
68 68
@@ -130,7 +130,7 @@ static int tegra_target(struct cpufreq_policy *policy,
130 unsigned int target_freq, 130 unsigned int target_freq,
131 unsigned int relation) 131 unsigned int relation)
132{ 132{
133 int idx; 133 unsigned int idx;
134 unsigned int freq; 134 unsigned int freq;
135 int ret = 0; 135 int ret = 0;
136 136
diff --git a/arch/arm/mach-tegra/devices.c b/arch/arm/mach-tegra/devices.c
index 57e35d20c24c..489e82b5282a 100644
--- a/arch/arm/mach-tegra/devices.c
+++ b/arch/arm/mach-tegra/devices.c
@@ -29,7 +29,9 @@
29#include <mach/iomap.h> 29#include <mach/iomap.h>
30#include <mach/dma.h> 30#include <mach/dma.h>
31#include <mach/usb_phy.h> 31#include <mach/usb_phy.h>
32
32#include "gpio-names.h" 33#include "gpio-names.h"
34#include "devices.h"
33 35
34static struct resource i2c_resource1[] = { 36static struct resource i2c_resource1[] = {
35 [0] = { 37 [0] = {
diff --git a/arch/arm/mach-tegra/dma.c b/arch/arm/mach-tegra/dma.c
index f4ef5eb317bd..c0cf967e47d3 100644
--- a/arch/arm/mach-tegra/dma.c
+++ b/arch/arm/mach-tegra/dma.c
@@ -105,13 +105,17 @@
105 105
106#define NV_DMA_MAX_TRASFER_SIZE 0x10000 106#define NV_DMA_MAX_TRASFER_SIZE 0x10000
107 107
108const unsigned int ahb_addr_wrap_table[8] = { 108static const unsigned int ahb_addr_wrap_table[8] = {
109 0, 32, 64, 128, 256, 512, 1024, 2048 109 0, 32, 64, 128, 256, 512, 1024, 2048
110}; 110};
111 111
112const unsigned int apb_addr_wrap_table[8] = {0, 1, 2, 4, 8, 16, 32, 64}; 112static const unsigned int apb_addr_wrap_table[8] = {
113 0, 1, 2, 4, 8, 16, 32, 64
114};
113 115
114const unsigned int bus_width_table[5] = {8, 16, 32, 64, 128}; 116static const unsigned int bus_width_table[5] = {
117 8, 16, 32, 64, 128
118};
115 119
116#define TEGRA_DMA_NAME_SIZE 16 120#define TEGRA_DMA_NAME_SIZE 16
117struct tegra_dma_channel { 121struct tegra_dma_channel {
@@ -157,7 +161,7 @@ void tegra_dma_dequeue(struct tegra_dma_channel *ch)
157 return; 161 return;
158} 162}
159 163
160void tegra_dma_stop(struct tegra_dma_channel *ch) 164static void tegra_dma_stop(struct tegra_dma_channel *ch)
161{ 165{
162 u32 csr; 166 u32 csr;
163 u32 status; 167 u32 status;
@@ -174,7 +178,7 @@ void tegra_dma_stop(struct tegra_dma_channel *ch)
174 writel(status, ch->addr + APB_DMA_CHAN_STA); 178 writel(status, ch->addr + APB_DMA_CHAN_STA);
175} 179}
176 180
177int tegra_dma_cancel(struct tegra_dma_channel *ch) 181static int tegra_dma_cancel(struct tegra_dma_channel *ch)
178{ 182{
179 u32 csr; 183 u32 csr;
180 unsigned long irq_flags; 184 unsigned long irq_flags;
diff --git a/arch/arm/mach-tegra/include/mach/io.h b/arch/arm/mach-tegra/include/mach/io.h
index 4cea2230c8dc..35a011fbc42d 100644
--- a/arch/arm/mach-tegra/include/mach/io.h
+++ b/arch/arm/mach-tegra/include/mach/io.h
@@ -33,20 +33,26 @@
33 * 33 *
34 */ 34 */
35 35
36#ifdef __ASSEMBLY__
37#define IOMEM(x) (x)
38#else
39#define IOMEM(x) ((void __force __iomem *)(x))
40#endif
41
36#define IO_IRAM_PHYS 0x40000000 42#define IO_IRAM_PHYS 0x40000000
37#define IO_IRAM_VIRT 0xFE400000 43#define IO_IRAM_VIRT IOMEM(0xFE400000)
38#define IO_IRAM_SIZE SZ_256K 44#define IO_IRAM_SIZE SZ_256K
39 45
40#define IO_CPU_PHYS 0x50040000 46#define IO_CPU_PHYS 0x50040000
41#define IO_CPU_VIRT 0xFE000000 47#define IO_CPU_VIRT IOMEM(0xFE000000)
42#define IO_CPU_SIZE SZ_16K 48#define IO_CPU_SIZE SZ_16K
43 49
44#define IO_PPSB_PHYS 0x60000000 50#define IO_PPSB_PHYS 0x60000000
45#define IO_PPSB_VIRT 0xFE200000 51#define IO_PPSB_VIRT IOMEM(0xFE200000)
46#define IO_PPSB_SIZE SZ_1M 52#define IO_PPSB_SIZE SZ_1M
47 53
48#define IO_APB_PHYS 0x70000000 54#define IO_APB_PHYS 0x70000000
49#define IO_APB_VIRT 0xFE300000 55#define IO_APB_VIRT IOMEM(0xFE300000)
50#define IO_APB_SIZE SZ_1M 56#define IO_APB_SIZE SZ_1M
51 57
52#define IO_TO_VIRT_BETWEEN(p, st, sz) ((p) >= (st) && (p) < ((st) + (sz))) 58#define IO_TO_VIRT_BETWEEN(p, st, sz) ((p) >= (st) && (p) < ((st) + (sz)))
@@ -61,7 +67,7 @@
61 IO_TO_VIRT_XLATE((n), IO_CPU_PHYS, IO_CPU_VIRT) : \ 67 IO_TO_VIRT_XLATE((n), IO_CPU_PHYS, IO_CPU_VIRT) : \
62 IO_TO_VIRT_BETWEEN((n), IO_IRAM_PHYS, IO_IRAM_SIZE) ? \ 68 IO_TO_VIRT_BETWEEN((n), IO_IRAM_PHYS, IO_IRAM_SIZE) ? \
63 IO_TO_VIRT_XLATE((n), IO_IRAM_PHYS, IO_IRAM_VIRT) : \ 69 IO_TO_VIRT_XLATE((n), IO_IRAM_PHYS, IO_IRAM_VIRT) : \
64 0) 70 NULL)
65 71
66#ifndef __ASSEMBLER__ 72#ifndef __ASSEMBLER__
67 73
@@ -71,7 +77,7 @@
71void __iomem *tegra_ioremap(unsigned long phys, size_t size, unsigned int type); 77void __iomem *tegra_ioremap(unsigned long phys, size_t size, unsigned int type);
72void tegra_iounmap(volatile void __iomem *addr); 78void tegra_iounmap(volatile void __iomem *addr);
73 79
74#define IO_ADDRESS(n) ((void __iomem *) IO_TO_VIRT(n)) 80#define IO_ADDRESS(n) (IO_TO_VIRT(n))
75 81
76#ifdef CONFIG_TEGRA_PCI 82#ifdef CONFIG_TEGRA_PCI
77extern void __iomem *tegra_pcie_io_base; 83extern void __iomem *tegra_pcie_io_base;
diff --git a/arch/arm/mach-tegra/include/mach/powergate.h b/arch/arm/mach-tegra/include/mach/powergate.h
index 401d1b725291..39c396d2ddb0 100644
--- a/arch/arm/mach-tegra/include/mach/powergate.h
+++ b/arch/arm/mach-tegra/include/mach/powergate.h
@@ -31,7 +31,6 @@
31 31
32int tegra_powergate_power_on(int id); 32int tegra_powergate_power_on(int id);
33int tegra_powergate_power_off(int id); 33int tegra_powergate_power_off(int id);
34bool tegra_powergate_is_powered(int id);
35int tegra_powergate_remove_clamping(int id); 34int tegra_powergate_remove_clamping(int id);
36 35
37/* Must be called with clk disabled, and returns with clk enabled */ 36/* Must be called with clk disabled, and returns with clk enabled */
diff --git a/arch/arm/mach-tegra/io.c b/arch/arm/mach-tegra/io.c
index ea50fe28cf6a..5489f8b5d6ad 100644
--- a/arch/arm/mach-tegra/io.c
+++ b/arch/arm/mach-tegra/io.c
@@ -31,25 +31,25 @@
31 31
32static struct map_desc tegra_io_desc[] __initdata = { 32static struct map_desc tegra_io_desc[] __initdata = {
33 { 33 {
34 .virtual = IO_PPSB_VIRT, 34 .virtual = (unsigned long)IO_PPSB_VIRT,
35 .pfn = __phys_to_pfn(IO_PPSB_PHYS), 35 .pfn = __phys_to_pfn(IO_PPSB_PHYS),
36 .length = IO_PPSB_SIZE, 36 .length = IO_PPSB_SIZE,
37 .type = MT_DEVICE, 37 .type = MT_DEVICE,
38 }, 38 },
39 { 39 {
40 .virtual = IO_APB_VIRT, 40 .virtual = (unsigned long)IO_APB_VIRT,
41 .pfn = __phys_to_pfn(IO_APB_PHYS), 41 .pfn = __phys_to_pfn(IO_APB_PHYS),
42 .length = IO_APB_SIZE, 42 .length = IO_APB_SIZE,
43 .type = MT_DEVICE, 43 .type = MT_DEVICE,
44 }, 44 },
45 { 45 {
46 .virtual = IO_CPU_VIRT, 46 .virtual = (unsigned long)IO_CPU_VIRT,
47 .pfn = __phys_to_pfn(IO_CPU_PHYS), 47 .pfn = __phys_to_pfn(IO_CPU_PHYS),
48 .length = IO_CPU_SIZE, 48 .length = IO_CPU_SIZE,
49 .type = MT_DEVICE, 49 .type = MT_DEVICE,
50 }, 50 },
51 { 51 {
52 .virtual = IO_IRAM_VIRT, 52 .virtual = (unsigned long)IO_IRAM_VIRT,
53 .pfn = __phys_to_pfn(IO_IRAM_PHYS), 53 .pfn = __phys_to_pfn(IO_IRAM_PHYS),
54 .length = IO_IRAM_SIZE, 54 .length = IO_IRAM_SIZE,
55 .type = MT_DEVICE, 55 .type = MT_DEVICE,
diff --git a/arch/arm/mach-tegra/pcie.c b/arch/arm/mach-tegra/pcie.c
index f1f699d86c32..f5aa173c26b3 100644
--- a/arch/arm/mach-tegra/pcie.c
+++ b/arch/arm/mach-tegra/pcie.c
@@ -41,6 +41,8 @@
41#include <mach/clk.h> 41#include <mach/clk.h>
42#include <mach/powergate.h> 42#include <mach/powergate.h>
43 43
44#include "board.h"
45
44/* register definitions */ 46/* register definitions */
45#define AFI_OFFSET 0x3800 47#define AFI_OFFSET 0x3800
46#define PADS_OFFSET 0x3000 48#define PADS_OFFSET 0x3000
@@ -150,9 +152,9 @@
150static void __iomem *reg_pmc_base = IO_ADDRESS(TEGRA_PMC_BASE); 152static void __iomem *reg_pmc_base = IO_ADDRESS(TEGRA_PMC_BASE);
151 153
152#define pmc_writel(value, reg) \ 154#define pmc_writel(value, reg) \
153 __raw_writel(value, (u32)reg_pmc_base + (reg)) 155 __raw_writel(value, reg_pmc_base + (reg))
154#define pmc_readl(reg) \ 156#define pmc_readl(reg) \
155 __raw_readl((u32)reg_pmc_base + (reg)) 157 __raw_readl(reg_pmc_base + (reg))
156 158
157/* 159/*
158 * Tegra2 defines 1GB in the AXI address map for PCIe. 160 * Tegra2 defines 1GB in the AXI address map for PCIe.
@@ -460,7 +462,7 @@ static struct pci_bus __init *tegra_pcie_scan_bus(int nr,
460 struct tegra_pcie_port *pp; 462 struct tegra_pcie_port *pp;
461 463
462 if (nr >= tegra_pcie.num_ports) 464 if (nr >= tegra_pcie.num_ports)
463 return 0; 465 return NULL;
464 466
465 pp = tegra_pcie.port + nr; 467 pp = tegra_pcie.port + nr;
466 pp->root_bus_nr = sys->busnr; 468 pp->root_bus_nr = sys->busnr;
diff --git a/arch/arm/mach-tegra/powergate.c b/arch/arm/mach-tegra/powergate.c
index 3cee9aa1f2c8..948306491a59 100644
--- a/arch/arm/mach-tegra/powergate.c
+++ b/arch/arm/mach-tegra/powergate.c
@@ -89,12 +89,11 @@ int tegra_powergate_power_off(int id)
89 return tegra_powergate_set(id, false); 89 return tegra_powergate_set(id, false);
90} 90}
91 91
92bool tegra_powergate_is_powered(int id) 92static bool tegra_powergate_is_powered(int id)
93{ 93{
94 u32 status; 94 u32 status;
95 95
96 if (id < 0 || id >= TEGRA_NUM_POWERGATE) 96 WARN_ON(id < 0 || id >= TEGRA_NUM_POWERGATE);
97 return -EINVAL;
98 97
99 status = pmc_read(PWRGATE_STATUS) & (1 << id); 98 status = pmc_read(PWRGATE_STATUS) & (1 << id);
100 return !!status; 99 return !!status;
diff --git a/arch/arm/mach-tegra/tegra2_clocks.c b/arch/arm/mach-tegra/tegra2_clocks.c
index 0fe9b3ee2947..371869d8ea01 100644
--- a/arch/arm/mach-tegra/tegra2_clocks.c
+++ b/arch/arm/mach-tegra/tegra2_clocks.c
@@ -166,13 +166,13 @@ static DEFINE_SPINLOCK(clock_register_lock);
166static int tegra_periph_clk_enable_refcount[3 * 32]; 166static int tegra_periph_clk_enable_refcount[3 * 32];
167 167
168#define clk_writel(value, reg) \ 168#define clk_writel(value, reg) \
169 __raw_writel(value, (u32)reg_clk_base + (reg)) 169 __raw_writel(value, reg_clk_base + (reg))
170#define clk_readl(reg) \ 170#define clk_readl(reg) \
171 __raw_readl((u32)reg_clk_base + (reg)) 171 __raw_readl(reg_clk_base + (reg))
172#define pmc_writel(value, reg) \ 172#define pmc_writel(value, reg) \
173 __raw_writel(value, (u32)reg_pmc_base + (reg)) 173 __raw_writel(value, reg_pmc_base + (reg))
174#define pmc_readl(reg) \ 174#define pmc_readl(reg) \
175 __raw_readl((u32)reg_pmc_base + (reg)) 175 __raw_readl(reg_pmc_base + (reg))
176 176
177unsigned long clk_measure_input_freq(void) 177unsigned long clk_measure_input_freq(void)
178{ 178{
@@ -918,7 +918,7 @@ static struct clk_ops tegra_pll_div_ops = {
918static void tegra2_periph_clk_init(struct clk *c) 918static void tegra2_periph_clk_init(struct clk *c)
919{ 919{
920 u32 val = clk_readl(c->reg); 920 u32 val = clk_readl(c->reg);
921 const struct clk_mux_sel *mux = 0; 921 const struct clk_mux_sel *mux = NULL;
922 const struct clk_mux_sel *sel; 922 const struct clk_mux_sel *sel;
923 if (c->flags & MUX) { 923 if (c->flags & MUX) {
924 for (sel = c->inputs; sel->input != NULL; sel++) { 924 for (sel = c->inputs; sel->input != NULL; sel++) {
@@ -1459,7 +1459,7 @@ static struct clk tegra_pll_s = {
1459static struct clk_mux_sel tegra_clk_m_sel[] = { 1459static struct clk_mux_sel tegra_clk_m_sel[] = {
1460 { .input = &tegra_clk_32k, .value = 0}, 1460 { .input = &tegra_clk_32k, .value = 0},
1461 { .input = &tegra_pll_s, .value = 1}, 1461 { .input = &tegra_pll_s, .value = 1},
1462 { 0, 0}, 1462 { NULL , 0},
1463}; 1463};
1464 1464
1465static struct clk tegra_clk_m = { 1465static struct clk tegra_clk_m = {
@@ -1861,7 +1861,7 @@ static const struct audio_sources {
1861 { .name = "ext_audio_clk1", .value = 6 }, 1861 { .name = "ext_audio_clk1", .value = 6 },
1862 { .name = "ext_vimclk", .value = 7 }, 1862 { .name = "ext_vimclk", .value = 7 },
1863#endif 1863#endif
1864 { 0, 0 } 1864 { NULL, 0 }
1865}; 1865};
1866 1866
1867static struct clk tegra_clk_audio = { 1867static struct clk tegra_clk_audio = {
@@ -1885,7 +1885,7 @@ static struct clk tegra_clk_audio_2x = {
1885 }, 1885 },
1886}; 1886};
1887 1887
1888struct clk_lookup tegra_audio_clk_lookups[] = { 1888static struct clk_lookup tegra_audio_clk_lookups[] = {
1889 { .con_id = "audio", .clk = &tegra_clk_audio }, 1889 { .con_id = "audio", .clk = &tegra_clk_audio },
1890 { .con_id = "audio_2x", .clk = &tegra_clk_audio_2x } 1890 { .con_id = "audio_2x", .clk = &tegra_clk_audio_2x }
1891}; 1891};
@@ -1926,7 +1926,7 @@ static struct clk_mux_sel mux_cclk[] = {
1926 { .input = &tegra_pll_p_out3, .value = 6}, 1926 { .input = &tegra_pll_p_out3, .value = 6},
1927 { .input = &tegra_clk_d, .value = 7}, 1927 { .input = &tegra_clk_d, .value = 7},
1928 { .input = &tegra_pll_x, .value = 8}, 1928 { .input = &tegra_pll_x, .value = 8},
1929 { 0, 0}, 1929 { NULL, 0},
1930}; 1930};
1931 1931
1932static struct clk_mux_sel mux_sclk[] = { 1932static struct clk_mux_sel mux_sclk[] = {
@@ -1938,7 +1938,7 @@ static struct clk_mux_sel mux_sclk[] = {
1938 { .input = &tegra_clk_d, .value = 5}, 1938 { .input = &tegra_clk_d, .value = 5},
1939 { .input = &tegra_clk_32k, .value = 6}, 1939 { .input = &tegra_clk_32k, .value = 6},
1940 { .input = &tegra_pll_m_out1, .value = 7}, 1940 { .input = &tegra_pll_m_out1, .value = 7},
1941 { 0, 0}, 1941 { NULL, 0},
1942}; 1942};
1943 1943
1944static struct clk tegra_clk_cclk = { 1944static struct clk tegra_clk_cclk = {
@@ -2009,7 +2009,7 @@ static struct clk_mux_sel mux_pllm_pllc_pllp_plla[] = {
2009 { .input = &tegra_pll_c, .value = 1}, 2009 { .input = &tegra_pll_c, .value = 1},
2010 { .input = &tegra_pll_p, .value = 2}, 2010 { .input = &tegra_pll_p, .value = 2},
2011 { .input = &tegra_pll_a_out0, .value = 3}, 2011 { .input = &tegra_pll_a_out0, .value = 3},
2012 { 0, 0}, 2012 { NULL, 0},
2013}; 2013};
2014 2014
2015static struct clk_mux_sel mux_pllm_pllc_pllp_clkm[] = { 2015static struct clk_mux_sel mux_pllm_pllc_pllp_clkm[] = {
@@ -2017,7 +2017,7 @@ static struct clk_mux_sel mux_pllm_pllc_pllp_clkm[] = {
2017 { .input = &tegra_pll_c, .value = 1}, 2017 { .input = &tegra_pll_c, .value = 1},
2018 { .input = &tegra_pll_p, .value = 2}, 2018 { .input = &tegra_pll_p, .value = 2},
2019 { .input = &tegra_clk_m, .value = 3}, 2019 { .input = &tegra_clk_m, .value = 3},
2020 { 0, 0}, 2020 { NULL, 0},
2021}; 2021};
2022 2022
2023static struct clk_mux_sel mux_pllp_pllc_pllm_clkm[] = { 2023static struct clk_mux_sel mux_pllp_pllc_pllm_clkm[] = {
@@ -2025,7 +2025,7 @@ static struct clk_mux_sel mux_pllp_pllc_pllm_clkm[] = {
2025 { .input = &tegra_pll_c, .value = 1}, 2025 { .input = &tegra_pll_c, .value = 1},
2026 { .input = &tegra_pll_m, .value = 2}, 2026 { .input = &tegra_pll_m, .value = 2},
2027 { .input = &tegra_clk_m, .value = 3}, 2027 { .input = &tegra_clk_m, .value = 3},
2028 { 0, 0}, 2028 { NULL, 0},
2029}; 2029};
2030 2030
2031static struct clk_mux_sel mux_pllaout0_audio2x_pllp_clkm[] = { 2031static struct clk_mux_sel mux_pllaout0_audio2x_pllp_clkm[] = {
@@ -2033,7 +2033,7 @@ static struct clk_mux_sel mux_pllaout0_audio2x_pllp_clkm[] = {
2033 {.input = &tegra_clk_audio_2x, .value = 1}, 2033 {.input = &tegra_clk_audio_2x, .value = 1},
2034 {.input = &tegra_pll_p, .value = 2}, 2034 {.input = &tegra_pll_p, .value = 2},
2035 {.input = &tegra_clk_m, .value = 3}, 2035 {.input = &tegra_clk_m, .value = 3},
2036 { 0, 0}, 2036 { NULL, 0},
2037}; 2037};
2038 2038
2039static struct clk_mux_sel mux_pllp_plld_pllc_clkm[] = { 2039static struct clk_mux_sel mux_pllp_plld_pllc_clkm[] = {
@@ -2041,7 +2041,7 @@ static struct clk_mux_sel mux_pllp_plld_pllc_clkm[] = {
2041 {.input = &tegra_pll_d_out0, .value = 1}, 2041 {.input = &tegra_pll_d_out0, .value = 1},
2042 {.input = &tegra_pll_c, .value = 2}, 2042 {.input = &tegra_pll_c, .value = 2},
2043 {.input = &tegra_clk_m, .value = 3}, 2043 {.input = &tegra_clk_m, .value = 3},
2044 { 0, 0}, 2044 { NULL, 0},
2045}; 2045};
2046 2046
2047static struct clk_mux_sel mux_pllp_pllc_audio_clkm_clk32[] = { 2047static struct clk_mux_sel mux_pllp_pllc_audio_clkm_clk32[] = {
@@ -2050,39 +2050,39 @@ static struct clk_mux_sel mux_pllp_pllc_audio_clkm_clk32[] = {
2050 {.input = &tegra_clk_audio, .value = 2}, 2050 {.input = &tegra_clk_audio, .value = 2},
2051 {.input = &tegra_clk_m, .value = 3}, 2051 {.input = &tegra_clk_m, .value = 3},
2052 {.input = &tegra_clk_32k, .value = 4}, 2052 {.input = &tegra_clk_32k, .value = 4},
2053 { 0, 0}, 2053 { NULL, 0},
2054}; 2054};
2055 2055
2056static struct clk_mux_sel mux_pllp_pllc_pllm[] = { 2056static struct clk_mux_sel mux_pllp_pllc_pllm[] = {
2057 {.input = &tegra_pll_p, .value = 0}, 2057 {.input = &tegra_pll_p, .value = 0},
2058 {.input = &tegra_pll_c, .value = 1}, 2058 {.input = &tegra_pll_c, .value = 1},
2059 {.input = &tegra_pll_m, .value = 2}, 2059 {.input = &tegra_pll_m, .value = 2},
2060 { 0, 0}, 2060 { NULL, 0},
2061}; 2061};
2062 2062
2063static struct clk_mux_sel mux_clk_m[] = { 2063static struct clk_mux_sel mux_clk_m[] = {
2064 { .input = &tegra_clk_m, .value = 0}, 2064 { .input = &tegra_clk_m, .value = 0},
2065 { 0, 0}, 2065 { NULL, 0},
2066}; 2066};
2067 2067
2068static struct clk_mux_sel mux_pllp_out3[] = { 2068static struct clk_mux_sel mux_pllp_out3[] = {
2069 { .input = &tegra_pll_p_out3, .value = 0}, 2069 { .input = &tegra_pll_p_out3, .value = 0},
2070 { 0, 0}, 2070 { NULL, 0},
2071}; 2071};
2072 2072
2073static struct clk_mux_sel mux_plld[] = { 2073static struct clk_mux_sel mux_plld[] = {
2074 { .input = &tegra_pll_d, .value = 0}, 2074 { .input = &tegra_pll_d, .value = 0},
2075 { 0, 0}, 2075 { NULL, 0},
2076}; 2076};
2077 2077
2078static struct clk_mux_sel mux_clk_32k[] = { 2078static struct clk_mux_sel mux_clk_32k[] = {
2079 { .input = &tegra_clk_32k, .value = 0}, 2079 { .input = &tegra_clk_32k, .value = 0},
2080 { 0, 0}, 2080 { NULL, 0},
2081}; 2081};
2082 2082
2083static struct clk_mux_sel mux_pclk[] = { 2083static struct clk_mux_sel mux_pclk[] = {
2084 { .input = &tegra_clk_pclk, .value = 0}, 2084 { .input = &tegra_clk_pclk, .value = 0},
2085 { 0, 0}, 2085 { NULL, 0},
2086}; 2086};
2087 2087
2088static struct clk tegra_clk_emc = { 2088static struct clk tegra_clk_emc = {
@@ -2125,7 +2125,7 @@ static struct clk tegra_clk_emc = {
2125 .parent = _parent, \ 2125 .parent = _parent, \
2126 } 2126 }
2127 2127
2128struct clk tegra_list_clks[] = { 2128static struct clk tegra_list_clks[] = {
2129 PERIPH_CLK("apbdma", "tegra-dma", NULL, 34, 0, 108000000, mux_pclk, 0), 2129 PERIPH_CLK("apbdma", "tegra-dma", NULL, 34, 0, 108000000, mux_pclk, 0),
2130 PERIPH_CLK("rtc", "rtc-tegra", NULL, 4, 0, 32768, mux_clk_32k, PERIPH_NO_RESET), 2130 PERIPH_CLK("rtc", "rtc-tegra", NULL, 4, 0, 32768, mux_clk_32k, PERIPH_NO_RESET),
2131 PERIPH_CLK("timer", "timer", NULL, 5, 0, 26000000, mux_clk_m, 0), 2131 PERIPH_CLK("timer", "timer", NULL, 5, 0, 26000000, mux_clk_m, 0),
@@ -2221,7 +2221,7 @@ struct clk tegra_list_clks[] = {
2221 * configuration. List those here to register them twice in the clock lookup 2221 * configuration. List those here to register them twice in the clock lookup
2222 * table under two names. 2222 * table under two names.
2223 */ 2223 */
2224struct clk_duplicate tegra_clk_duplicates[] = { 2224static struct clk_duplicate tegra_clk_duplicates[] = {
2225 CLK_DUPLICATE("uarta", "tegra_uart.0", NULL), 2225 CLK_DUPLICATE("uarta", "tegra_uart.0", NULL),
2226 CLK_DUPLICATE("uartb", "tegra_uart.1", NULL), 2226 CLK_DUPLICATE("uartb", "tegra_uart.1", NULL),
2227 CLK_DUPLICATE("uartc", "tegra_uart.2", NULL), 2227 CLK_DUPLICATE("uartc", "tegra_uart.2", NULL),
@@ -2252,7 +2252,7 @@ struct clk_duplicate tegra_clk_duplicates[] = {
2252 .clk = ck, \ 2252 .clk = ck, \
2253 } 2253 }
2254 2254
2255struct clk *tegra_ptr_clks[] = { 2255static struct clk *tegra_ptr_clks[] = {
2256 &tegra_clk_32k, 2256 &tegra_clk_32k,
2257 &tegra_pll_s, 2257 &tegra_pll_s,
2258 &tegra_clk_m, 2258 &tegra_clk_m,
diff --git a/arch/arm/mach-tegra/timer.c b/arch/arm/mach-tegra/timer.c
index 90350420c4e9..e2272d263a83 100644
--- a/arch/arm/mach-tegra/timer.c
+++ b/arch/arm/mach-tegra/timer.c
@@ -62,9 +62,9 @@ static struct timespec persistent_ts;
62static u64 persistent_ms, last_persistent_ms; 62static u64 persistent_ms, last_persistent_ms;
63 63
64#define timer_writel(value, reg) \ 64#define timer_writel(value, reg) \
65 __raw_writel(value, (u32)timer_reg_base + (reg)) 65 __raw_writel(value, timer_reg_base + (reg))
66#define timer_readl(reg) \ 66#define timer_readl(reg) \
67 __raw_readl((u32)timer_reg_base + (reg)) 67 __raw_readl(timer_reg_base + (reg))
68 68
69static int tegra_timer_set_next_event(unsigned long cycles, 69static int tegra_timer_set_next_event(unsigned long cycles,
70 struct clock_event_device *evt) 70 struct clock_event_device *evt)
@@ -133,7 +133,7 @@ static void notrace tegra_update_sched_clock(void)
133 * tegra_rtc driver could be executing to avoid race conditions 133 * tegra_rtc driver could be executing to avoid race conditions
134 * on the RTC shadow register 134 * on the RTC shadow register
135 */ 135 */
136u64 tegra_rtc_read_ms(void) 136static u64 tegra_rtc_read_ms(void)
137{ 137{
138 u32 ms = readl(rtc_base + RTC_MILLISECONDS); 138 u32 ms = readl(rtc_base + RTC_MILLISECONDS);
139 u32 s = readl(rtc_base + RTC_SHADOW_SECONDS); 139 u32 s = readl(rtc_base + RTC_SHADOW_SECONDS);
diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S
index 3b24bfa3b828..07c4bc8ea0a4 100644
--- a/arch/arm/mm/cache-v7.S
+++ b/arch/arm/mm/cache-v7.S
@@ -174,6 +174,10 @@ ENTRY(v7_coherent_user_range)
174 dcache_line_size r2, r3 174 dcache_line_size r2, r3
175 sub r3, r2, #1 175 sub r3, r2, #1
176 bic r12, r0, r3 176 bic r12, r0, r3
177#ifdef CONFIG_ARM_ERRATA_764369
178 ALT_SMP(W(dsb))
179 ALT_UP(W(nop))
180#endif
1771: 1811:
178 USER( mcr p15, 0, r12, c7, c11, 1 ) @ clean D line to the point of unification 182 USER( mcr p15, 0, r12, c7, c11, 1 ) @ clean D line to the point of unification
179 add r12, r12, r2 183 add r12, r12, r2
@@ -223,6 +227,10 @@ ENTRY(v7_flush_kern_dcache_area)
223 add r1, r0, r1 227 add r1, r0, r1
224 sub r3, r2, #1 228 sub r3, r2, #1
225 bic r0, r0, r3 229 bic r0, r0, r3
230#ifdef CONFIG_ARM_ERRATA_764369
231 ALT_SMP(W(dsb))
232 ALT_UP(W(nop))
233#endif
2261: 2341:
227 mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line / unified line 235 mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line / unified line
228 add r0, r0, r2 236 add r0, r0, r2
@@ -247,6 +255,10 @@ v7_dma_inv_range:
247 sub r3, r2, #1 255 sub r3, r2, #1
248 tst r0, r3 256 tst r0, r3
249 bic r0, r0, r3 257 bic r0, r0, r3
258#ifdef CONFIG_ARM_ERRATA_764369
259 ALT_SMP(W(dsb))
260 ALT_UP(W(nop))
261#endif
250 mcrne p15, 0, r0, c7, c14, 1 @ clean & invalidate D / U line 262 mcrne p15, 0, r0, c7, c14, 1 @ clean & invalidate D / U line
251 263
252 tst r1, r3 264 tst r1, r3
@@ -270,6 +282,10 @@ v7_dma_clean_range:
270 dcache_line_size r2, r3 282 dcache_line_size r2, r3
271 sub r3, r2, #1 283 sub r3, r2, #1
272 bic r0, r0, r3 284 bic r0, r0, r3
285#ifdef CONFIG_ARM_ERRATA_764369
286 ALT_SMP(W(dsb))
287 ALT_UP(W(nop))
288#endif
2731: 2891:
274 mcr p15, 0, r0, c7, c10, 1 @ clean D / U line 290 mcr p15, 0, r0, c7, c10, 1 @ clean D / U line
275 add r0, r0, r2 291 add r0, r0, r2
@@ -288,6 +304,10 @@ ENTRY(v7_dma_flush_range)
288 dcache_line_size r2, r3 304 dcache_line_size r2, r3
289 sub r3, r2, #1 305 sub r3, r2, #1
290 bic r0, r0, r3 306 bic r0, r0, r3
307#ifdef CONFIG_ARM_ERRATA_764369
308 ALT_SMP(W(dsb))
309 ALT_UP(W(nop))
310#endif
2911: 3111:
292 mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D / U line 312 mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D / U line
293 add r0, r0, r2 313 add r0, r0, r2
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 50be842e89fd..01f5987eb1ad 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -347,6 +347,8 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp,
347 347
348 if (addr) 348 if (addr)
349 *handle = pfn_to_dma(dev, page_to_pfn(page)); 349 *handle = pfn_to_dma(dev, page_to_pfn(page));
350 else
351 __dma_free_buffer(page, size);
350 352
351 return addr; 353 return addr;
352} 354}
diff --git a/arch/arm/plat-s5p/irq-gpioint.c b/arch/arm/plat-s5p/irq-gpioint.c
index f71078ef6bb5..f88216d23991 100644
--- a/arch/arm/plat-s5p/irq-gpioint.c
+++ b/arch/arm/plat-s5p/irq-gpioint.c
@@ -114,17 +114,18 @@ static __init int s5p_gpioint_add(struct s3c_gpio_chip *chip)
114{ 114{
115 static int used_gpioint_groups = 0; 115 static int used_gpioint_groups = 0;
116 int group = chip->group; 116 int group = chip->group;
117 struct s5p_gpioint_bank *bank = NULL; 117 struct s5p_gpioint_bank *b, *bank = NULL;
118 struct irq_chip_generic *gc; 118 struct irq_chip_generic *gc;
119 struct irq_chip_type *ct; 119 struct irq_chip_type *ct;
120 120
121 if (used_gpioint_groups >= S5P_GPIOINT_GROUP_COUNT) 121 if (used_gpioint_groups >= S5P_GPIOINT_GROUP_COUNT)
122 return -ENOMEM; 122 return -ENOMEM;
123 123
124 list_for_each_entry(bank, &banks, list) { 124 list_for_each_entry(b, &banks, list) {
125 if (group >= bank->start && 125 if (group >= b->start && group < b->start + b->nr_groups) {
126 group < bank->start + bank->nr_groups) 126 bank = b;
127 break; 127 break;
128 }
128 } 129 }
129 if (!bank) 130 if (!bank)
130 return -EINVAL; 131 return -EINVAL;
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index 5cc83851ad06..31a7d3a7ce25 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -561,6 +561,20 @@ static struct pci_ops u4_pcie_pci_ops =
561 .write = u4_pcie_write_config, 561 .write = u4_pcie_write_config,
562}; 562};
563 563
564static void __devinit pmac_pci_fixup_u4_of_node(struct pci_dev *dev)
565{
566 /* Apple's device-tree "hides" the root complex virtual P2P bridge
567 * on U4. However, Linux sees it, causing the PCI <-> OF matching
568 * code to fail to properly match devices below it. This works around
569 * it by setting the node of the bridge to point to the PHB node,
570 * which is not entirely correct but fixes the matching code and
571 * doesn't break anything else. It's also the simplest possible fix.
572 */
573 if (dev->dev.of_node == NULL)
574 dev->dev.of_node = pcibios_get_phb_of_node(dev->bus);
575}
576DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, 0x5b, pmac_pci_fixup_u4_of_node);
577
564#endif /* CONFIG_PPC64 */ 578#endif /* CONFIG_PPC64 */
565 579
566#ifdef CONFIG_PPC32 580#ifdef CONFIG_PPC32
diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h
index 64b61bf72e93..547f1a6a35d4 100644
--- a/arch/s390/include/asm/elf.h
+++ b/arch/s390/include/asm/elf.h
@@ -188,7 +188,8 @@ extern char elf_platform[];
188#define SET_PERSONALITY(ex) \ 188#define SET_PERSONALITY(ex) \
189do { \ 189do { \
190 if (personality(current->personality) != PER_LINUX32) \ 190 if (personality(current->personality) != PER_LINUX32) \
191 set_personality(PER_LINUX); \ 191 set_personality(PER_LINUX | \
192 (current->personality & ~PER_MASK)); \
192 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \ 193 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
193 set_thread_flag(TIF_31BIT); \ 194 set_thread_flag(TIF_31BIT); \
194 else \ 195 else \
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 519eb5f187ef..c0cb794bb365 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -658,12 +658,14 @@ static inline void pgste_set_pte(pte_t *ptep, pgste_t pgste)
658 * struct gmap_struct - guest address space 658 * struct gmap_struct - guest address space
659 * @mm: pointer to the parent mm_struct 659 * @mm: pointer to the parent mm_struct
660 * @table: pointer to the page directory 660 * @table: pointer to the page directory
661 * @asce: address space control element for gmap page table
661 * @crst_list: list of all crst tables used in the guest address space 662 * @crst_list: list of all crst tables used in the guest address space
662 */ 663 */
663struct gmap { 664struct gmap {
664 struct list_head list; 665 struct list_head list;
665 struct mm_struct *mm; 666 struct mm_struct *mm;
666 unsigned long *table; 667 unsigned long *table;
668 unsigned long asce;
667 struct list_head crst_list; 669 struct list_head crst_list;
668}; 670};
669 671
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c
index 532fd4322156..2b45591e1582 100644
--- a/arch/s390/kernel/asm-offsets.c
+++ b/arch/s390/kernel/asm-offsets.c
@@ -10,6 +10,7 @@
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <asm/vdso.h> 11#include <asm/vdso.h>
12#include <asm/sigp.h> 12#include <asm/sigp.h>
13#include <asm/pgtable.h>
13 14
14/* 15/*
15 * Make sure that the compiler is new enough. We want a compiler that 16 * Make sure that the compiler is new enough. We want a compiler that
@@ -126,6 +127,7 @@ int main(void)
126 DEFINE(__LC_KERNEL_STACK, offsetof(struct _lowcore, kernel_stack)); 127 DEFINE(__LC_KERNEL_STACK, offsetof(struct _lowcore, kernel_stack));
127 DEFINE(__LC_ASYNC_STACK, offsetof(struct _lowcore, async_stack)); 128 DEFINE(__LC_ASYNC_STACK, offsetof(struct _lowcore, async_stack));
128 DEFINE(__LC_PANIC_STACK, offsetof(struct _lowcore, panic_stack)); 129 DEFINE(__LC_PANIC_STACK, offsetof(struct _lowcore, panic_stack));
130 DEFINE(__LC_USER_ASCE, offsetof(struct _lowcore, user_asce));
129 DEFINE(__LC_INT_CLOCK, offsetof(struct _lowcore, int_clock)); 131 DEFINE(__LC_INT_CLOCK, offsetof(struct _lowcore, int_clock));
130 DEFINE(__LC_MCCK_CLOCK, offsetof(struct _lowcore, mcck_clock)); 132 DEFINE(__LC_MCCK_CLOCK, offsetof(struct _lowcore, mcck_clock));
131 DEFINE(__LC_MACHINE_FLAGS, offsetof(struct _lowcore, machine_flags)); 133 DEFINE(__LC_MACHINE_FLAGS, offsetof(struct _lowcore, machine_flags));
@@ -151,6 +153,7 @@ int main(void)
151 DEFINE(__LC_VDSO_PER_CPU, offsetof(struct _lowcore, vdso_per_cpu_data)); 153 DEFINE(__LC_VDSO_PER_CPU, offsetof(struct _lowcore, vdso_per_cpu_data));
152 DEFINE(__LC_GMAP, offsetof(struct _lowcore, gmap)); 154 DEFINE(__LC_GMAP, offsetof(struct _lowcore, gmap));
153 DEFINE(__LC_CMF_HPP, offsetof(struct _lowcore, cmf_hpp)); 155 DEFINE(__LC_CMF_HPP, offsetof(struct _lowcore, cmf_hpp));
156 DEFINE(__GMAP_ASCE, offsetof(struct gmap, asce));
154#endif /* CONFIG_32BIT */ 157#endif /* CONFIG_32BIT */
155 return 0; 158 return 0;
156} 159}
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 5f729d627cef..713da0760538 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -1076,6 +1076,11 @@ sie_loop:
1076 lg %r14,__LC_THREAD_INFO # pointer thread_info struct 1076 lg %r14,__LC_THREAD_INFO # pointer thread_info struct
1077 tm __TI_flags+7(%r14),_TIF_EXIT_SIE 1077 tm __TI_flags+7(%r14),_TIF_EXIT_SIE
1078 jnz sie_exit 1078 jnz sie_exit
1079 lg %r14,__LC_GMAP # get gmap pointer
1080 ltgr %r14,%r14
1081 jz sie_gmap
1082 lctlg %c1,%c1,__GMAP_ASCE(%r14) # load primary asce
1083sie_gmap:
1079 lg %r14,__SF_EMPTY(%r15) # get control block pointer 1084 lg %r14,__SF_EMPTY(%r15) # get control block pointer
1080 SPP __SF_EMPTY(%r15) # set guest id 1085 SPP __SF_EMPTY(%r15) # set guest id
1081 sie 0(%r14) 1086 sie 0(%r14)
@@ -1083,6 +1088,7 @@ sie_done:
1083 SPP __LC_CMF_HPP # set host id 1088 SPP __LC_CMF_HPP # set host id
1084 lg %r14,__LC_THREAD_INFO # pointer thread_info struct 1089 lg %r14,__LC_THREAD_INFO # pointer thread_info struct
1085sie_exit: 1090sie_exit:
1091 lctlg %c1,%c1,__LC_USER_ASCE # load primary asce
1086 ni __TI_flags+6(%r14),255-(_TIF_SIE>>8) 1092 ni __TI_flags+6(%r14),255-(_TIF_SIE>>8)
1087 lg %r14,__SF_EMPTY+8(%r15) # load guest register save area 1093 lg %r14,__SF_EMPTY+8(%r15) # load guest register save area
1088 stmg %r0,%r13,0(%r14) # save guest gprs 0-13 1094 stmg %r0,%r13,0(%r14) # save guest gprs 0-13
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index f17296e4fc89..dc2b580e27bc 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -123,6 +123,7 @@ int kvm_dev_ioctl_check_extension(long ext)
123 123
124 switch (ext) { 124 switch (ext) {
125 case KVM_CAP_S390_PSW: 125 case KVM_CAP_S390_PSW:
126 case KVM_CAP_S390_GMAP:
126 r = 1; 127 r = 1;
127 break; 128 break;
128 default: 129 default:
@@ -263,10 +264,12 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
263 vcpu->arch.guest_fpregs.fpc &= FPC_VALID_MASK; 264 vcpu->arch.guest_fpregs.fpc &= FPC_VALID_MASK;
264 restore_fp_regs(&vcpu->arch.guest_fpregs); 265 restore_fp_regs(&vcpu->arch.guest_fpregs);
265 restore_access_regs(vcpu->arch.guest_acrs); 266 restore_access_regs(vcpu->arch.guest_acrs);
267 gmap_enable(vcpu->arch.gmap);
266} 268}
267 269
268void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) 270void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
269{ 271{
272 gmap_disable(vcpu->arch.gmap);
270 save_fp_regs(&vcpu->arch.guest_fpregs); 273 save_fp_regs(&vcpu->arch.guest_fpregs);
271 save_access_regs(vcpu->arch.guest_acrs); 274 save_access_regs(vcpu->arch.guest_acrs);
272 restore_fp_regs(&vcpu->arch.host_fpregs); 275 restore_fp_regs(&vcpu->arch.host_fpregs);
@@ -461,7 +464,6 @@ static void __vcpu_run(struct kvm_vcpu *vcpu)
461 local_irq_disable(); 464 local_irq_disable();
462 kvm_guest_enter(); 465 kvm_guest_enter();
463 local_irq_enable(); 466 local_irq_enable();
464 gmap_enable(vcpu->arch.gmap);
465 VCPU_EVENT(vcpu, 6, "entering sie flags %x", 467 VCPU_EVENT(vcpu, 6, "entering sie flags %x",
466 atomic_read(&vcpu->arch.sie_block->cpuflags)); 468 atomic_read(&vcpu->arch.sie_block->cpuflags));
467 if (sie64a(vcpu->arch.sie_block, vcpu->arch.guest_gprs)) { 469 if (sie64a(vcpu->arch.sie_block, vcpu->arch.guest_gprs)) {
@@ -470,7 +472,6 @@ static void __vcpu_run(struct kvm_vcpu *vcpu)
470 } 472 }
471 VCPU_EVENT(vcpu, 6, "exit sie icptcode %d", 473 VCPU_EVENT(vcpu, 6, "exit sie icptcode %d",
472 vcpu->arch.sie_block->icptcode); 474 vcpu->arch.sie_block->icptcode);
473 gmap_disable(vcpu->arch.gmap);
474 local_irq_disable(); 475 local_irq_disable();
475 kvm_guest_exit(); 476 kvm_guest_exit();
476 local_irq_enable(); 477 local_irq_enable();
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 4d1f2bce87b3..5d56c2b95b14 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -160,6 +160,8 @@ struct gmap *gmap_alloc(struct mm_struct *mm)
160 table = (unsigned long *) page_to_phys(page); 160 table = (unsigned long *) page_to_phys(page);
161 crst_table_init(table, _REGION1_ENTRY_EMPTY); 161 crst_table_init(table, _REGION1_ENTRY_EMPTY);
162 gmap->table = table; 162 gmap->table = table;
163 gmap->asce = _ASCE_TYPE_REGION1 | _ASCE_TABLE_LENGTH |
164 _ASCE_USER_BITS | __pa(table);
163 list_add(&gmap->list, &mm->context.gmap_list); 165 list_add(&gmap->list, &mm->context.gmap_list);
164 return gmap; 166 return gmap;
165 167
@@ -240,10 +242,6 @@ EXPORT_SYMBOL_GPL(gmap_free);
240 */ 242 */
241void gmap_enable(struct gmap *gmap) 243void gmap_enable(struct gmap *gmap)
242{ 244{
243 /* Load primary space page table origin. */
244 S390_lowcore.user_asce = _ASCE_TYPE_REGION1 | _ASCE_TABLE_LENGTH |
245 _ASCE_USER_BITS | __pa(gmap->table);
246 asm volatile("lctlg 1,1,%0\n" : : "m" (S390_lowcore.user_asce) );
247 S390_lowcore.gmap = (unsigned long) gmap; 245 S390_lowcore.gmap = (unsigned long) gmap;
248} 246}
249EXPORT_SYMBOL_GPL(gmap_enable); 247EXPORT_SYMBOL_GPL(gmap_enable);
@@ -254,10 +252,6 @@ EXPORT_SYMBOL_GPL(gmap_enable);
254 */ 252 */
255void gmap_disable(struct gmap *gmap) 253void gmap_disable(struct gmap *gmap)
256{ 254{
257 /* Load primary space page table origin. */
258 S390_lowcore.user_asce =
259 gmap->mm->context.asce_bits | __pa(gmap->mm->pgd);
260 asm volatile("lctlg 1,1,%0\n" : : "m" (S390_lowcore.user_asce) );
261 S390_lowcore.gmap = 0UL; 255 S390_lowcore.gmap = 0UL;
262} 256}
263EXPORT_SYMBOL_GPL(gmap_disable); 257EXPORT_SYMBOL_GPL(gmap_disable);
@@ -309,15 +303,15 @@ int gmap_unmap_segment(struct gmap *gmap, unsigned long to, unsigned long len)
309 /* Walk the guest addr space page table */ 303 /* Walk the guest addr space page table */
310 table = gmap->table + (((to + off) >> 53) & 0x7ff); 304 table = gmap->table + (((to + off) >> 53) & 0x7ff);
311 if (*table & _REGION_ENTRY_INV) 305 if (*table & _REGION_ENTRY_INV)
312 return 0; 306 goto out;
313 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); 307 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
314 table = table + (((to + off) >> 42) & 0x7ff); 308 table = table + (((to + off) >> 42) & 0x7ff);
315 if (*table & _REGION_ENTRY_INV) 309 if (*table & _REGION_ENTRY_INV)
316 return 0; 310 goto out;
317 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); 311 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
318 table = table + (((to + off) >> 31) & 0x7ff); 312 table = table + (((to + off) >> 31) & 0x7ff);
319 if (*table & _REGION_ENTRY_INV) 313 if (*table & _REGION_ENTRY_INV)
320 return 0; 314 goto out;
321 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); 315 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
322 table = table + (((to + off) >> 20) & 0x7ff); 316 table = table + (((to + off) >> 20) & 0x7ff);
323 317
@@ -325,6 +319,7 @@ int gmap_unmap_segment(struct gmap *gmap, unsigned long to, unsigned long len)
325 flush |= gmap_unlink_segment(gmap, table); 319 flush |= gmap_unlink_segment(gmap, table);
326 *table = _SEGMENT_ENTRY_INV; 320 *table = _SEGMENT_ENTRY_INV;
327 } 321 }
322out:
328 up_read(&gmap->mm->mmap_sem); 323 up_read(&gmap->mm->mmap_sem);
329 if (flush) 324 if (flush)
330 gmap_flush_tlb(gmap); 325 gmap_flush_tlb(gmap);
diff --git a/arch/sparc/include/asm/spitfire.h b/arch/sparc/include/asm/spitfire.h
index 55a17c6efeb8..d06a26601753 100644
--- a/arch/sparc/include/asm/spitfire.h
+++ b/arch/sparc/include/asm/spitfire.h
@@ -43,6 +43,8 @@
43#define SUN4V_CHIP_NIAGARA1 0x01 43#define SUN4V_CHIP_NIAGARA1 0x01
44#define SUN4V_CHIP_NIAGARA2 0x02 44#define SUN4V_CHIP_NIAGARA2 0x02
45#define SUN4V_CHIP_NIAGARA3 0x03 45#define SUN4V_CHIP_NIAGARA3 0x03
46#define SUN4V_CHIP_NIAGARA4 0x04
47#define SUN4V_CHIP_NIAGARA5 0x05
46#define SUN4V_CHIP_UNKNOWN 0xff 48#define SUN4V_CHIP_UNKNOWN 0xff
47 49
48#ifndef __ASSEMBLY__ 50#ifndef __ASSEMBLY__
diff --git a/arch/sparc/include/asm/xor_64.h b/arch/sparc/include/asm/xor_64.h
index 9ed6ff679ab7..ee8edc68423e 100644
--- a/arch/sparc/include/asm/xor_64.h
+++ b/arch/sparc/include/asm/xor_64.h
@@ -66,6 +66,8 @@ static struct xor_block_template xor_block_niagara = {
66 ((tlb_type == hypervisor && \ 66 ((tlb_type == hypervisor && \
67 (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || \ 67 (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || \
68 sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || \ 68 sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || \
69 sun4v_chip_type == SUN4V_CHIP_NIAGARA3)) ? \ 69 sun4v_chip_type == SUN4V_CHIP_NIAGARA3 || \
70 sun4v_chip_type == SUN4V_CHIP_NIAGARA4 || \
71 sun4v_chip_type == SUN4V_CHIP_NIAGARA5)) ? \
70 &xor_block_niagara : \ 72 &xor_block_niagara : \
71 &xor_block_VIS) 73 &xor_block_VIS)
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c
index 9810fd881058..ba9b1cec4e6b 100644
--- a/arch/sparc/kernel/cpu.c
+++ b/arch/sparc/kernel/cpu.c
@@ -481,6 +481,18 @@ static void __init sun4v_cpu_probe(void)
481 sparc_pmu_type = "niagara3"; 481 sparc_pmu_type = "niagara3";
482 break; 482 break;
483 483
484 case SUN4V_CHIP_NIAGARA4:
485 sparc_cpu_type = "UltraSparc T4 (Niagara4)";
486 sparc_fpu_type = "UltraSparc T4 integrated FPU";
487 sparc_pmu_type = "niagara4";
488 break;
489
490 case SUN4V_CHIP_NIAGARA5:
491 sparc_cpu_type = "UltraSparc T5 (Niagara5)";
492 sparc_fpu_type = "UltraSparc T5 integrated FPU";
493 sparc_pmu_type = "niagara5";
494 break;
495
484 default: 496 default:
485 printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n", 497 printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n",
486 prom_cpu_compatible); 498 prom_cpu_compatible);
diff --git a/arch/sparc/kernel/cpumap.c b/arch/sparc/kernel/cpumap.c
index 4197e8d62d4c..9323eafccb93 100644
--- a/arch/sparc/kernel/cpumap.c
+++ b/arch/sparc/kernel/cpumap.c
@@ -325,6 +325,8 @@ static int iterate_cpu(struct cpuinfo_tree *t, unsigned int root_index)
325 case SUN4V_CHIP_NIAGARA1: 325 case SUN4V_CHIP_NIAGARA1:
326 case SUN4V_CHIP_NIAGARA2: 326 case SUN4V_CHIP_NIAGARA2:
327 case SUN4V_CHIP_NIAGARA3: 327 case SUN4V_CHIP_NIAGARA3:
328 case SUN4V_CHIP_NIAGARA4:
329 case SUN4V_CHIP_NIAGARA5:
328 rover_inc_table = niagara_iterate_method; 330 rover_inc_table = niagara_iterate_method;
329 break; 331 break;
330 default: 332 default:
diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S
index 0eac1b2fc53d..0d810c2f1d00 100644
--- a/arch/sparc/kernel/head_64.S
+++ b/arch/sparc/kernel/head_64.S
@@ -133,7 +133,7 @@ prom_sun4v_name:
133prom_niagara_prefix: 133prom_niagara_prefix:
134 .asciz "SUNW,UltraSPARC-T" 134 .asciz "SUNW,UltraSPARC-T"
135prom_sparc_prefix: 135prom_sparc_prefix:
136 .asciz "SPARC-T" 136 .asciz "SPARC-"
137 .align 4 137 .align 4
138prom_root_compatible: 138prom_root_compatible:
139 .skip 64 139 .skip 64
@@ -396,7 +396,7 @@ sun4v_chip_type:
396 or %g1, %lo(prom_cpu_compatible), %g1 396 or %g1, %lo(prom_cpu_compatible), %g1
397 sethi %hi(prom_sparc_prefix), %g7 397 sethi %hi(prom_sparc_prefix), %g7
398 or %g7, %lo(prom_sparc_prefix), %g7 398 or %g7, %lo(prom_sparc_prefix), %g7
399 mov 7, %g3 399 mov 6, %g3
40090: ldub [%g7], %g2 40090: ldub [%g7], %g2
401 ldub [%g1], %g4 401 ldub [%g1], %g4
402 cmp %g2, %g4 402 cmp %g2, %g4
@@ -408,10 +408,23 @@ sun4v_chip_type:
408 408
409 sethi %hi(prom_cpu_compatible), %g1 409 sethi %hi(prom_cpu_compatible), %g1
410 or %g1, %lo(prom_cpu_compatible), %g1 410 or %g1, %lo(prom_cpu_compatible), %g1
411 ldub [%g1 + 7], %g2 411 ldub [%g1 + 6], %g2
412 cmp %g2, 'T'
413 be,pt %xcc, 70f
414 cmp %g2, 'M'
415 bne,pn %xcc, 4f
416 nop
417
41870: ldub [%g1 + 7], %g2
412 cmp %g2, '3' 419 cmp %g2, '3'
413 be,pt %xcc, 5f 420 be,pt %xcc, 5f
414 mov SUN4V_CHIP_NIAGARA3, %g4 421 mov SUN4V_CHIP_NIAGARA3, %g4
422 cmp %g2, '4'
423 be,pt %xcc, 5f
424 mov SUN4V_CHIP_NIAGARA4, %g4
425 cmp %g2, '5'
426 be,pt %xcc, 5f
427 mov SUN4V_CHIP_NIAGARA5, %g4
415 ba,pt %xcc, 4f 428 ba,pt %xcc, 4f
416 nop 429 nop
417 430
@@ -545,6 +558,12 @@ niagara_tlb_fixup:
545 cmp %g1, SUN4V_CHIP_NIAGARA3 558 cmp %g1, SUN4V_CHIP_NIAGARA3
546 be,pt %xcc, niagara2_patch 559 be,pt %xcc, niagara2_patch
547 nop 560 nop
561 cmp %g1, SUN4V_CHIP_NIAGARA4
562 be,pt %xcc, niagara2_patch
563 nop
564 cmp %g1, SUN4V_CHIP_NIAGARA5
565 be,pt %xcc, niagara2_patch
566 nop
548 567
549 call generic_patch_copyops 568 call generic_patch_copyops
550 nop 569 nop
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index c8cc461ff75f..f793742eec2b 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -380,8 +380,7 @@ void flush_thread(void)
380#endif 380#endif
381 } 381 }
382 382
383 /* Now, this task is no longer a kernel thread. */ 383 /* This task is no longer a kernel thread. */
384 current->thread.current_ds = USER_DS;
385 if (current->thread.flags & SPARC_FLAG_KTHREAD) { 384 if (current->thread.flags & SPARC_FLAG_KTHREAD) {
386 current->thread.flags &= ~SPARC_FLAG_KTHREAD; 385 current->thread.flags &= ~SPARC_FLAG_KTHREAD;
387 386
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index c158a95ec664..d959cd0a4aa4 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -368,9 +368,6 @@ void flush_thread(void)
368 368
369 /* Clear FPU register state. */ 369 /* Clear FPU register state. */
370 t->fpsaved[0] = 0; 370 t->fpsaved[0] = 0;
371
372 if (get_thread_current_ds() != ASI_AIUS)
373 set_fs(USER_DS);
374} 371}
375 372
376/* It's a bit more tricky when 64-bit tasks are involved... */ 373/* It's a bit more tricky when 64-bit tasks are involved... */
diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c
index d26e1f6c717a..3e3e2914c70b 100644
--- a/arch/sparc/kernel/setup_32.c
+++ b/arch/sparc/kernel/setup_32.c
@@ -137,7 +137,7 @@ static void __init process_switch(char c)
137 prom_halt(); 137 prom_halt();
138 break; 138 break;
139 case 'p': 139 case 'p':
140 /* Just ignore, this behavior is now the default. */ 140 prom_early_console.flags &= ~CON_BOOT;
141 break; 141 break;
142 default: 142 default:
143 printk("Unknown boot switch (-%c)\n", c); 143 printk("Unknown boot switch (-%c)\n", c);
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index 3c5bb784214f..c965595aa7e9 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -106,7 +106,7 @@ static void __init process_switch(char c)
106 prom_halt(); 106 prom_halt();
107 break; 107 break;
108 case 'p': 108 case 'p':
109 /* Just ignore, this behavior is now the default. */ 109 prom_early_console.flags &= ~CON_BOOT;
110 break; 110 break;
111 case 'P': 111 case 'P':
112 /* Force UltraSPARC-III P-Cache on. */ 112 /* Force UltraSPARC-III P-Cache on. */
@@ -425,10 +425,14 @@ static void __init init_sparc64_elf_hwcap(void)
425 else if (tlb_type == hypervisor) { 425 else if (tlb_type == hypervisor) {
426 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || 426 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 ||
427 sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || 427 sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
428 sun4v_chip_type == SUN4V_CHIP_NIAGARA3) 428 sun4v_chip_type == SUN4V_CHIP_NIAGARA3 ||
429 sun4v_chip_type == SUN4V_CHIP_NIAGARA4 ||
430 sun4v_chip_type == SUN4V_CHIP_NIAGARA5)
429 cap |= HWCAP_SPARC_BLKINIT; 431 cap |= HWCAP_SPARC_BLKINIT;
430 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || 432 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
431 sun4v_chip_type == SUN4V_CHIP_NIAGARA3) 433 sun4v_chip_type == SUN4V_CHIP_NIAGARA3 ||
434 sun4v_chip_type == SUN4V_CHIP_NIAGARA4 ||
435 sun4v_chip_type == SUN4V_CHIP_NIAGARA5)
432 cap |= HWCAP_SPARC_N2; 436 cap |= HWCAP_SPARC_N2;
433 } 437 }
434 438
@@ -452,11 +456,15 @@ static void __init init_sparc64_elf_hwcap(void)
452 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1) 456 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1)
453 cap |= AV_SPARC_ASI_BLK_INIT; 457 cap |= AV_SPARC_ASI_BLK_INIT;
454 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || 458 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
455 sun4v_chip_type == SUN4V_CHIP_NIAGARA3) 459 sun4v_chip_type == SUN4V_CHIP_NIAGARA3 ||
460 sun4v_chip_type == SUN4V_CHIP_NIAGARA4 ||
461 sun4v_chip_type == SUN4V_CHIP_NIAGARA5)
456 cap |= (AV_SPARC_VIS | AV_SPARC_VIS2 | 462 cap |= (AV_SPARC_VIS | AV_SPARC_VIS2 |
457 AV_SPARC_ASI_BLK_INIT | 463 AV_SPARC_ASI_BLK_INIT |
458 AV_SPARC_POPC); 464 AV_SPARC_POPC);
459 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA3) 465 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA3 ||
466 sun4v_chip_type == SUN4V_CHIP_NIAGARA4 ||
467 sun4v_chip_type == SUN4V_CHIP_NIAGARA5)
460 cap |= (AV_SPARC_VIS3 | AV_SPARC_HPC | 468 cap |= (AV_SPARC_VIS3 | AV_SPARC_HPC |
461 AV_SPARC_FMAF); 469 AV_SPARC_FMAF);
462 } 470 }
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 581531dbc8b5..8e073d802139 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -511,6 +511,11 @@ static void __init read_obp_translations(void)
511 for (i = 0; i < prom_trans_ents; i++) 511 for (i = 0; i < prom_trans_ents; i++)
512 prom_trans[i].data &= ~0x0003fe0000000000UL; 512 prom_trans[i].data &= ~0x0003fe0000000000UL;
513 } 513 }
514
515 /* Force execute bit on. */
516 for (i = 0; i < prom_trans_ents; i++)
517 prom_trans[i].data |= (tlb_type == hypervisor ?
518 _PAGE_EXEC_4V : _PAGE_EXEC_4U);
514} 519}
515 520
516static void __init hypervisor_tlb_lock(unsigned long vaddr, 521static void __init hypervisor_tlb_lock(unsigned long vaddr,
diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c
index 3f2ad2640d85..ccdbc16b8941 100644
--- a/arch/x86/kernel/rtc.c
+++ b/arch/x86/kernel/rtc.c
@@ -42,8 +42,11 @@ int mach_set_rtc_mmss(unsigned long nowtime)
42{ 42{
43 int real_seconds, real_minutes, cmos_minutes; 43 int real_seconds, real_minutes, cmos_minutes;
44 unsigned char save_control, save_freq_select; 44 unsigned char save_control, save_freq_select;
45 unsigned long flags;
45 int retval = 0; 46 int retval = 0;
46 47
48 spin_lock_irqsave(&rtc_lock, flags);
49
47 /* tell the clock it's being set */ 50 /* tell the clock it's being set */
48 save_control = CMOS_READ(RTC_CONTROL); 51 save_control = CMOS_READ(RTC_CONTROL);
49 CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL); 52 CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL);
@@ -93,12 +96,17 @@ int mach_set_rtc_mmss(unsigned long nowtime)
93 CMOS_WRITE(save_control, RTC_CONTROL); 96 CMOS_WRITE(save_control, RTC_CONTROL);
94 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); 97 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
95 98
99 spin_unlock_irqrestore(&rtc_lock, flags);
100
96 return retval; 101 return retval;
97} 102}
98 103
99unsigned long mach_get_cmos_time(void) 104unsigned long mach_get_cmos_time(void)
100{ 105{
101 unsigned int status, year, mon, day, hour, min, sec, century = 0; 106 unsigned int status, year, mon, day, hour, min, sec, century = 0;
107 unsigned long flags;
108
109 spin_lock_irqsave(&rtc_lock, flags);
102 110
103 /* 111 /*
104 * If UIP is clear, then we have >= 244 microseconds before 112 * If UIP is clear, then we have >= 244 microseconds before
@@ -125,6 +133,8 @@ unsigned long mach_get_cmos_time(void)
125 status = CMOS_READ(RTC_CONTROL); 133 status = CMOS_READ(RTC_CONTROL);
126 WARN_ON_ONCE(RTC_ALWAYS_BCD && (status & RTC_DM_BINARY)); 134 WARN_ON_ONCE(RTC_ALWAYS_BCD && (status & RTC_DM_BINARY));
127 135
136 spin_unlock_irqrestore(&rtc_lock, flags);
137
128 if (RTC_ALWAYS_BCD || !(status & RTC_DM_BINARY)) { 138 if (RTC_ALWAYS_BCD || !(status & RTC_DM_BINARY)) {
129 sec = bcd2bin(sec); 139 sec = bcd2bin(sec);
130 min = bcd2bin(min); 140 min = bcd2bin(min);
@@ -169,24 +179,15 @@ EXPORT_SYMBOL(rtc_cmos_write);
169 179
170int update_persistent_clock(struct timespec now) 180int update_persistent_clock(struct timespec now)
171{ 181{
172 unsigned long flags; 182 return x86_platform.set_wallclock(now.tv_sec);
173 int retval;
174
175 spin_lock_irqsave(&rtc_lock, flags);
176 retval = x86_platform.set_wallclock(now.tv_sec);
177 spin_unlock_irqrestore(&rtc_lock, flags);
178
179 return retval;
180} 183}
181 184
182/* not static: needed by APM */ 185/* not static: needed by APM */
183void read_persistent_clock(struct timespec *ts) 186void read_persistent_clock(struct timespec *ts)
184{ 187{
185 unsigned long retval, flags; 188 unsigned long retval;
186 189
187 spin_lock_irqsave(&rtc_lock, flags);
188 retval = x86_platform.get_wallclock(); 190 retval = x86_platform.get_wallclock();
189 spin_unlock_irqrestore(&rtc_lock, flags);
190 191
191 ts->tv_sec = retval; 192 ts->tv_sec = retval;
192 ts->tv_nsec = 0; 193 ts->tv_nsec = 0;
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 6f08bc940fa8..8b4cc5f067de 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -3603,7 +3603,7 @@ done_prefixes:
3603 break; 3603 break;
3604 case Src2CL: 3604 case Src2CL:
3605 ctxt->src2.bytes = 1; 3605 ctxt->src2.bytes = 1;
3606 ctxt->src2.val = ctxt->regs[VCPU_REGS_RCX] & 0x8; 3606 ctxt->src2.val = ctxt->regs[VCPU_REGS_RCX] & 0xff;
3607 break; 3607 break;
3608 case Src2ImmByte: 3608 case Src2ImmByte:
3609 rc = decode_imm(ctxt, &ctxt->src2, 1, true); 3609 rc = decode_imm(ctxt, &ctxt->src2, 1, true);
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 1c5b69373a00..8e8da7960dbe 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -400,7 +400,8 @@ static u64 __update_clear_spte_slow(u64 *sptep, u64 spte)
400 400
401 /* xchg acts as a barrier before the setting of the high bits */ 401 /* xchg acts as a barrier before the setting of the high bits */
402 orig.spte_low = xchg(&ssptep->spte_low, sspte.spte_low); 402 orig.spte_low = xchg(&ssptep->spte_low, sspte.spte_low);
403 orig.spte_high = ssptep->spte_high = sspte.spte_high; 403 orig.spte_high = ssptep->spte_high;
404 ssptep->spte_high = sspte.spte_high;
404 count_spte_clear(sptep, spte); 405 count_spte_clear(sptep, spte);
405 406
406 return orig.spte; 407 return orig.spte;
diff --git a/arch/x86/platform/mrst/vrtc.c b/arch/x86/platform/mrst/vrtc.c
index 73d70d65e76e..6d5dbcdd444a 100644
--- a/arch/x86/platform/mrst/vrtc.c
+++ b/arch/x86/platform/mrst/vrtc.c
@@ -58,8 +58,11 @@ EXPORT_SYMBOL_GPL(vrtc_cmos_write);
58unsigned long vrtc_get_time(void) 58unsigned long vrtc_get_time(void)
59{ 59{
60 u8 sec, min, hour, mday, mon; 60 u8 sec, min, hour, mday, mon;
61 unsigned long flags;
61 u32 year; 62 u32 year;
62 63
64 spin_lock_irqsave(&rtc_lock, flags);
65
63 while ((vrtc_cmos_read(RTC_FREQ_SELECT) & RTC_UIP)) 66 while ((vrtc_cmos_read(RTC_FREQ_SELECT) & RTC_UIP))
64 cpu_relax(); 67 cpu_relax();
65 68
@@ -70,6 +73,8 @@ unsigned long vrtc_get_time(void)
70 mon = vrtc_cmos_read(RTC_MONTH); 73 mon = vrtc_cmos_read(RTC_MONTH);
71 year = vrtc_cmos_read(RTC_YEAR); 74 year = vrtc_cmos_read(RTC_YEAR);
72 75
76 spin_unlock_irqrestore(&rtc_lock, flags);
77
73 /* vRTC YEAR reg contains the offset to 1960 */ 78 /* vRTC YEAR reg contains the offset to 1960 */
74 year += 1960; 79 year += 1960;
75 80
@@ -83,8 +88,10 @@ unsigned long vrtc_get_time(void)
83int vrtc_set_mmss(unsigned long nowtime) 88int vrtc_set_mmss(unsigned long nowtime)
84{ 89{
85 int real_sec, real_min; 90 int real_sec, real_min;
91 unsigned long flags;
86 int vrtc_min; 92 int vrtc_min;
87 93
94 spin_lock_irqsave(&rtc_lock, flags);
88 vrtc_min = vrtc_cmos_read(RTC_MINUTES); 95 vrtc_min = vrtc_cmos_read(RTC_MINUTES);
89 96
90 real_sec = nowtime % 60; 97 real_sec = nowtime % 60;
@@ -95,6 +102,8 @@ int vrtc_set_mmss(unsigned long nowtime)
95 102
96 vrtc_cmos_write(real_sec, RTC_SECONDS); 103 vrtc_cmos_write(real_sec, RTC_SECONDS);
97 vrtc_cmos_write(real_min, RTC_MINUTES); 104 vrtc_cmos_write(real_min, RTC_MINUTES);
105 spin_unlock_irqrestore(&rtc_lock, flags);
106
98 return 0; 107 return 0;
99} 108}
100 109