diff options
Diffstat (limited to 'arch')
106 files changed, 776 insertions, 398 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 245058b3b0ef..290f02ee0157 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -6,6 +6,7 @@ config ARM | |||
6 | select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST | 6 | select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST |
7 | select ARCH_HAVE_CUSTOM_GPIO_H | 7 | select ARCH_HAVE_CUSTOM_GPIO_H |
8 | select ARCH_MIGHT_HAVE_PC_PARPORT | 8 | select ARCH_MIGHT_HAVE_PC_PARPORT |
9 | select ARCH_SUPPORTS_ATOMIC_RMW | ||
9 | select ARCH_USE_BUILTIN_BSWAP | 10 | select ARCH_USE_BUILTIN_BSWAP |
10 | select ARCH_USE_CMPXCHG_LOCKREF | 11 | select ARCH_USE_CMPXCHG_LOCKREF |
11 | select ARCH_WANT_IPC_PARSE_VERSION | 12 | select ARCH_WANT_IPC_PARSE_VERSION |
@@ -312,7 +313,7 @@ config ARCH_MULTIPLATFORM | |||
312 | config ARCH_INTEGRATOR | 313 | config ARCH_INTEGRATOR |
313 | bool "ARM Ltd. Integrator family" | 314 | bool "ARM Ltd. Integrator family" |
314 | select ARM_AMBA | 315 | select ARM_AMBA |
315 | select ARM_PATCH_PHYS_VIRT | 316 | select ARM_PATCH_PHYS_VIRT if MMU |
316 | select AUTO_ZRELADDR | 317 | select AUTO_ZRELADDR |
317 | select COMMON_CLK | 318 | select COMMON_CLK |
318 | select COMMON_CLK_VERSATILE | 319 | select COMMON_CLK_VERSATILE |
@@ -658,7 +659,7 @@ config ARCH_MSM | |||
658 | config ARCH_SHMOBILE_LEGACY | 659 | config ARCH_SHMOBILE_LEGACY |
659 | bool "Renesas ARM SoCs (non-multiplatform)" | 660 | bool "Renesas ARM SoCs (non-multiplatform)" |
660 | select ARCH_SHMOBILE | 661 | select ARCH_SHMOBILE |
661 | select ARM_PATCH_PHYS_VIRT | 662 | select ARM_PATCH_PHYS_VIRT if MMU |
662 | select CLKDEV_LOOKUP | 663 | select CLKDEV_LOOKUP |
663 | select GENERIC_CLOCKEVENTS | 664 | select GENERIC_CLOCKEVENTS |
664 | select HAVE_ARM_SCU if SMP | 665 | select HAVE_ARM_SCU if SMP |
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi index 287795985e32..b84bac5bada4 100644 --- a/arch/arm/boot/dts/at91sam9n12.dtsi +++ b/arch/arm/boot/dts/at91sam9n12.dtsi | |||
@@ -925,7 +925,7 @@ | |||
925 | compatible = "atmel,at91rm9200-ohci", "usb-ohci"; | 925 | compatible = "atmel,at91rm9200-ohci", "usb-ohci"; |
926 | reg = <0x00500000 0x00100000>; | 926 | reg = <0x00500000 0x00100000>; |
927 | interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>; | 927 | interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>; |
928 | clocks = <&usb>, <&uhphs_clk>, <&udphs_clk>, | 928 | clocks = <&usb>, <&uhphs_clk>, <&uhphs_clk>, |
929 | <&uhpck>; | 929 | <&uhpck>; |
930 | clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck"; | 930 | clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck"; |
931 | status = "disabled"; | 931 | status = "disabled"; |
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi index 2ebc42140ea6..2c0d6ea3ab41 100644 --- a/arch/arm/boot/dts/at91sam9x5.dtsi +++ b/arch/arm/boot/dts/at91sam9x5.dtsi | |||
@@ -1124,6 +1124,7 @@ | |||
1124 | compatible = "atmel,at91sam9rl-pwm"; | 1124 | compatible = "atmel,at91sam9rl-pwm"; |
1125 | reg = <0xf8034000 0x300>; | 1125 | reg = <0xf8034000 0x300>; |
1126 | interrupts = <18 IRQ_TYPE_LEVEL_HIGH 4>; | 1126 | interrupts = <18 IRQ_TYPE_LEVEL_HIGH 4>; |
1127 | clocks = <&pwm_clk>; | ||
1127 | #pwm-cells = <3>; | 1128 | #pwm-cells = <3>; |
1128 | status = "disabled"; | 1129 | status = "disabled"; |
1129 | }; | 1130 | }; |
@@ -1155,8 +1156,7 @@ | |||
1155 | compatible = "atmel,at91rm9200-ohci", "usb-ohci"; | 1156 | compatible = "atmel,at91rm9200-ohci", "usb-ohci"; |
1156 | reg = <0x00600000 0x100000>; | 1157 | reg = <0x00600000 0x100000>; |
1157 | interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>; | 1158 | interrupts = <22 IRQ_TYPE_LEVEL_HIGH 2>; |
1158 | clocks = <&usb>, <&uhphs_clk>, <&udphs_clk>, | 1159 | clocks = <&usb>, <&uhphs_clk>, <&uhphs_clk>, <&uhpck>; |
1159 | <&uhpck>; | ||
1160 | clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck"; | 1160 | clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck"; |
1161 | status = "disabled"; | 1161 | status = "disabled"; |
1162 | }; | 1162 | }; |
diff --git a/arch/arm/boot/dts/hi3620.dtsi b/arch/arm/boot/dts/hi3620.dtsi index ab1116d086be..83a5b8685bd9 100644 --- a/arch/arm/boot/dts/hi3620.dtsi +++ b/arch/arm/boot/dts/hi3620.dtsi | |||
@@ -73,7 +73,7 @@ | |||
73 | 73 | ||
74 | L2: l2-cache { | 74 | L2: l2-cache { |
75 | compatible = "arm,pl310-cache"; | 75 | compatible = "arm,pl310-cache"; |
76 | reg = <0xfc10000 0x100000>; | 76 | reg = <0x100000 0x100000>; |
77 | interrupts = <0 15 4>; | 77 | interrupts = <0 15 4>; |
78 | cache-unified; | 78 | cache-unified; |
79 | cache-level = <2>; | 79 | cache-level = <2>; |
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts index 1fe45d1f75ec..b15f1a77d684 100644 --- a/arch/arm/boot/dts/omap3-n900.dts +++ b/arch/arm/boot/dts/omap3-n900.dts | |||
@@ -353,7 +353,7 @@ | |||
353 | }; | 353 | }; |
354 | 354 | ||
355 | twl_power: power { | 355 | twl_power: power { |
356 | compatible = "ti,twl4030-power-n900", "ti,twl4030-power-idle-osc-off"; | 356 | compatible = "ti,twl4030-power-n900"; |
357 | ti,use_poweroff; | 357 | ti,use_poweroff; |
358 | }; | 358 | }; |
359 | }; | 359 | }; |
diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi index 8d7ffaeff6e0..79f68acfd5d4 100644 --- a/arch/arm/boot/dts/r8a7791.dtsi +++ b/arch/arm/boot/dts/r8a7791.dtsi | |||
@@ -540,9 +540,9 @@ | |||
540 | #clock-cells = <0>; | 540 | #clock-cells = <0>; |
541 | clock-output-names = "sd1"; | 541 | clock-output-names = "sd1"; |
542 | }; | 542 | }; |
543 | sd2_clk: sd3_clk@e615007c { | 543 | sd2_clk: sd3_clk@e615026c { |
544 | compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock"; | 544 | compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock"; |
545 | reg = <0 0xe615007c 0 4>; | 545 | reg = <0 0xe615026c 0 4>; |
546 | clocks = <&pll1_div2_clk>; | 546 | clocks = <&pll1_div2_clk>; |
547 | #clock-cells = <0>; | 547 | #clock-cells = <0>; |
548 | clock-output-names = "sd2"; | 548 | clock-output-names = "sd2"; |
diff --git a/arch/arm/boot/dts/ste-nomadik-s8815.dts b/arch/arm/boot/dts/ste-nomadik-s8815.dts index f557feb997f4..90d8b6c7a205 100644 --- a/arch/arm/boot/dts/ste-nomadik-s8815.dts +++ b/arch/arm/boot/dts/ste-nomadik-s8815.dts | |||
@@ -4,7 +4,7 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | /dts-v1/; | 6 | /dts-v1/; |
7 | /include/ "ste-nomadik-stn8815.dtsi" | 7 | #include "ste-nomadik-stn8815.dtsi" |
8 | 8 | ||
9 | / { | 9 | / { |
10 | model = "Calao Systems USB-S8815"; | 10 | model = "Calao Systems USB-S8815"; |
diff --git a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi index d316c955bd5f..dbcf521b017f 100644 --- a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi +++ b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi | |||
@@ -1,7 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * Device Tree for the ST-Ericsson Nomadik 8815 STn8815 SoC | 2 | * Device Tree for the ST-Ericsson Nomadik 8815 STn8815 SoC |
3 | */ | 3 | */ |
4 | /include/ "skeleton.dtsi" | 4 | |
5 | #include <dt-bindings/gpio/gpio.h> | ||
6 | #include "skeleton.dtsi" | ||
5 | 7 | ||
6 | / { | 8 | / { |
7 | #address-cells = <1>; | 9 | #address-cells = <1>; |
@@ -842,8 +844,7 @@ | |||
842 | bus-width = <4>; | 844 | bus-width = <4>; |
843 | cap-mmc-highspeed; | 845 | cap-mmc-highspeed; |
844 | cap-sd-highspeed; | 846 | cap-sd-highspeed; |
845 | cd-gpios = <&gpio3 15 0x1>; | 847 | cd-gpios = <&gpio3 15 GPIO_ACTIVE_LOW>; |
846 | cd-inverted; | ||
847 | pinctrl-names = "default"; | 848 | pinctrl-names = "default"; |
848 | pinctrl-0 = <&mmcsd_default_mux>, <&mmcsd_default_mode>; | 849 | pinctrl-0 = <&mmcsd_default_mux>, <&mmcsd_default_mode>; |
849 | vmmc-supply = <&vmmc_regulator>; | 850 | vmmc-supply = <&vmmc_regulator>; |
diff --git a/arch/arm/crypto/aesbs-glue.c b/arch/arm/crypto/aesbs-glue.c index 4522366da759..15468fbbdea3 100644 --- a/arch/arm/crypto/aesbs-glue.c +++ b/arch/arm/crypto/aesbs-glue.c | |||
@@ -137,7 +137,7 @@ static int aesbs_cbc_encrypt(struct blkcipher_desc *desc, | |||
137 | dst += AES_BLOCK_SIZE; | 137 | dst += AES_BLOCK_SIZE; |
138 | } while (--blocks); | 138 | } while (--blocks); |
139 | } | 139 | } |
140 | err = blkcipher_walk_done(desc, &walk, 0); | 140 | err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE); |
141 | } | 141 | } |
142 | return err; | 142 | return err; |
143 | } | 143 | } |
@@ -158,7 +158,7 @@ static int aesbs_cbc_decrypt(struct blkcipher_desc *desc, | |||
158 | bsaes_cbc_encrypt(walk.src.virt.addr, walk.dst.virt.addr, | 158 | bsaes_cbc_encrypt(walk.src.virt.addr, walk.dst.virt.addr, |
159 | walk.nbytes, &ctx->dec, walk.iv); | 159 | walk.nbytes, &ctx->dec, walk.iv); |
160 | kernel_neon_end(); | 160 | kernel_neon_end(); |
161 | err = blkcipher_walk_done(desc, &walk, 0); | 161 | err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE); |
162 | } | 162 | } |
163 | while (walk.nbytes) { | 163 | while (walk.nbytes) { |
164 | u32 blocks = walk.nbytes / AES_BLOCK_SIZE; | 164 | u32 blocks = walk.nbytes / AES_BLOCK_SIZE; |
@@ -182,7 +182,7 @@ static int aesbs_cbc_decrypt(struct blkcipher_desc *desc, | |||
182 | dst += AES_BLOCK_SIZE; | 182 | dst += AES_BLOCK_SIZE; |
183 | src += AES_BLOCK_SIZE; | 183 | src += AES_BLOCK_SIZE; |
184 | } while (--blocks); | 184 | } while (--blocks); |
185 | err = blkcipher_walk_done(desc, &walk, 0); | 185 | err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE); |
186 | } | 186 | } |
187 | return err; | 187 | return err; |
188 | } | 188 | } |
@@ -268,7 +268,7 @@ static int aesbs_xts_encrypt(struct blkcipher_desc *desc, | |||
268 | bsaes_xts_encrypt(walk.src.virt.addr, walk.dst.virt.addr, | 268 | bsaes_xts_encrypt(walk.src.virt.addr, walk.dst.virt.addr, |
269 | walk.nbytes, &ctx->enc, walk.iv); | 269 | walk.nbytes, &ctx->enc, walk.iv); |
270 | kernel_neon_end(); | 270 | kernel_neon_end(); |
271 | err = blkcipher_walk_done(desc, &walk, 0); | 271 | err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE); |
272 | } | 272 | } |
273 | return err; | 273 | return err; |
274 | } | 274 | } |
@@ -292,7 +292,7 @@ static int aesbs_xts_decrypt(struct blkcipher_desc *desc, | |||
292 | bsaes_xts_decrypt(walk.src.virt.addr, walk.dst.virt.addr, | 292 | bsaes_xts_decrypt(walk.src.virt.addr, walk.dst.virt.addr, |
293 | walk.nbytes, &ctx->dec, walk.iv); | 293 | walk.nbytes, &ctx->dec, walk.iv); |
294 | kernel_neon_end(); | 294 | kernel_neon_end(); |
295 | err = blkcipher_walk_done(desc, &walk, 0); | 295 | err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE); |
296 | } | 296 | } |
297 | return err; | 297 | return err; |
298 | } | 298 | } |
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h index 060a75e99263..0406cb3f1af7 100644 --- a/arch/arm/include/asm/mach/arch.h +++ b/arch/arm/include/asm/mach/arch.h | |||
@@ -50,6 +50,7 @@ struct machine_desc { | |||
50 | struct smp_operations *smp; /* SMP operations */ | 50 | struct smp_operations *smp; /* SMP operations */ |
51 | bool (*smp_init)(void); | 51 | bool (*smp_init)(void); |
52 | void (*fixup)(struct tag *, char **); | 52 | void (*fixup)(struct tag *, char **); |
53 | void (*dt_fixup)(void); | ||
53 | void (*init_meminfo)(void); | 54 | void (*init_meminfo)(void); |
54 | void (*reserve)(void);/* reserve mem blocks */ | 55 | void (*reserve)(void);/* reserve mem blocks */ |
55 | void (*map_io)(void);/* IO mapping function */ | 56 | void (*map_io)(void);/* IO mapping function */ |
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c index e94a157ddff1..11c54de9f8cf 100644 --- a/arch/arm/kernel/devtree.c +++ b/arch/arm/kernel/devtree.c | |||
@@ -212,7 +212,7 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) | |||
212 | mdesc_best = &__mach_desc_GENERIC_DT; | 212 | mdesc_best = &__mach_desc_GENERIC_DT; |
213 | #endif | 213 | #endif |
214 | 214 | ||
215 | if (!dt_phys || !early_init_dt_scan(phys_to_virt(dt_phys))) | 215 | if (!dt_phys || !early_init_dt_verify(phys_to_virt(dt_phys))) |
216 | return NULL; | 216 | return NULL; |
217 | 217 | ||
218 | mdesc = of_flat_dt_match_machine(mdesc_best, arch_get_next_mach); | 218 | mdesc = of_flat_dt_match_machine(mdesc_best, arch_get_next_mach); |
@@ -237,6 +237,12 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) | |||
237 | dump_machine_table(); /* does not return */ | 237 | dump_machine_table(); /* does not return */ |
238 | } | 238 | } |
239 | 239 | ||
240 | /* We really don't want to do this, but sometimes firmware provides buggy data */ | ||
241 | if (mdesc->dt_fixup) | ||
242 | mdesc->dt_fixup(); | ||
243 | |||
244 | early_init_dt_scan_nodes(); | ||
245 | |||
240 | /* Change machine number to match the mdesc we're using */ | 246 | /* Change machine number to match the mdesc we're using */ |
241 | __machine_arch_type = mdesc->nr; | 247 | __machine_arch_type = mdesc->nr; |
242 | 248 | ||
diff --git a/arch/arm/kernel/iwmmxt.S b/arch/arm/kernel/iwmmxt.S index a5599cfc43cb..2b32978ae905 100644 --- a/arch/arm/kernel/iwmmxt.S +++ b/arch/arm/kernel/iwmmxt.S | |||
@@ -94,13 +94,19 @@ ENTRY(iwmmxt_task_enable) | |||
94 | 94 | ||
95 | mrc p15, 0, r2, c2, c0, 0 | 95 | mrc p15, 0, r2, c2, c0, 0 |
96 | mov r2, r2 @ cpwait | 96 | mov r2, r2 @ cpwait |
97 | bl concan_save | ||
97 | 98 | ||
98 | teq r1, #0 @ test for last ownership | 99 | #ifdef CONFIG_PREEMPT_COUNT |
99 | mov lr, r9 @ normal exit from exception | 100 | get_thread_info r10 |
100 | beq concan_load @ no owner, skip save | 101 | #endif |
102 | 4: dec_preempt_count r10, r3 | ||
103 | mov pc, r9 @ normal exit from exception | ||
101 | 104 | ||
102 | concan_save: | 105 | concan_save: |
103 | 106 | ||
107 | teq r1, #0 @ test for last ownership | ||
108 | beq concan_load @ no owner, skip save | ||
109 | |||
104 | tmrc r2, wCon | 110 | tmrc r2, wCon |
105 | 111 | ||
106 | @ CUP? wCx | 112 | @ CUP? wCx |
@@ -138,7 +144,7 @@ concan_dump: | |||
138 | wstrd wR15, [r1, #MMX_WR15] | 144 | wstrd wR15, [r1, #MMX_WR15] |
139 | 145 | ||
140 | 2: teq r0, #0 @ anything to load? | 146 | 2: teq r0, #0 @ anything to load? |
141 | beq 3f | 147 | moveq pc, lr @ if not, return |
142 | 148 | ||
143 | concan_load: | 149 | concan_load: |
144 | 150 | ||
@@ -171,14 +177,9 @@ concan_load: | |||
171 | @ clear CUP/MUP (only if r1 != 0) | 177 | @ clear CUP/MUP (only if r1 != 0) |
172 | teq r1, #0 | 178 | teq r1, #0 |
173 | mov r2, #0 | 179 | mov r2, #0 |
174 | beq 3f | 180 | moveq pc, lr |
175 | tmcr wCon, r2 | ||
176 | 181 | ||
177 | 3: | 182 | tmcr wCon, r2 |
178 | #ifdef CONFIG_PREEMPT_COUNT | ||
179 | get_thread_info r10 | ||
180 | #endif | ||
181 | 4: dec_preempt_count r10, r3 | ||
182 | mov pc, lr | 183 | mov pc, lr |
183 | 184 | ||
184 | /* | 185 | /* |
diff --git a/arch/arm/kernel/kgdb.c b/arch/arm/kernel/kgdb.c index 778c2f7024ff..a74b53c1b7df 100644 --- a/arch/arm/kernel/kgdb.c +++ b/arch/arm/kernel/kgdb.c | |||
@@ -160,12 +160,16 @@ static int kgdb_compiled_brk_fn(struct pt_regs *regs, unsigned int instr) | |||
160 | static struct undef_hook kgdb_brkpt_hook = { | 160 | static struct undef_hook kgdb_brkpt_hook = { |
161 | .instr_mask = 0xffffffff, | 161 | .instr_mask = 0xffffffff, |
162 | .instr_val = KGDB_BREAKINST, | 162 | .instr_val = KGDB_BREAKINST, |
163 | .cpsr_mask = MODE_MASK, | ||
164 | .cpsr_val = SVC_MODE, | ||
163 | .fn = kgdb_brk_fn | 165 | .fn = kgdb_brk_fn |
164 | }; | 166 | }; |
165 | 167 | ||
166 | static struct undef_hook kgdb_compiled_brkpt_hook = { | 168 | static struct undef_hook kgdb_compiled_brkpt_hook = { |
167 | .instr_mask = 0xffffffff, | 169 | .instr_mask = 0xffffffff, |
168 | .instr_val = KGDB_COMPILED_BREAK, | 170 | .instr_val = KGDB_COMPILED_BREAK, |
171 | .cpsr_mask = MODE_MASK, | ||
172 | .cpsr_val = SVC_MODE, | ||
169 | .fn = kgdb_compiled_brk_fn | 173 | .fn = kgdb_compiled_brk_fn |
170 | }; | 174 | }; |
171 | 175 | ||
diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index 9d853189028b..e35d880f9773 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c | |||
@@ -275,7 +275,7 @@ void store_cpu_topology(unsigned int cpuid) | |||
275 | cpu_topology[cpuid].socket_id, mpidr); | 275 | cpu_topology[cpuid].socket_id, mpidr); |
276 | } | 276 | } |
277 | 277 | ||
278 | static inline const int cpu_corepower_flags(void) | 278 | static inline int cpu_corepower_flags(void) |
279 | { | 279 | { |
280 | return SD_SHARE_PKG_RESOURCES | SD_SHARE_POWERDOMAIN; | 280 | return SD_SHARE_PKG_RESOURCES | SD_SHARE_POWERDOMAIN; |
281 | } | 281 | } |
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index 46d893fcbe85..66c9b9614f3c 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c | |||
@@ -335,6 +335,15 @@ static void __init exynos_reserve(void) | |||
335 | #endif | 335 | #endif |
336 | } | 336 | } |
337 | 337 | ||
338 | static void __init exynos_dt_fixup(void) | ||
339 | { | ||
340 | /* | ||
341 | * Some versions of uboot pass garbage entries in the memory node, | ||
342 | * use the old CONFIG_ARM_NR_BANKS | ||
343 | */ | ||
344 | of_fdt_limit_memory(8); | ||
345 | } | ||
346 | |||
338 | DT_MACHINE_START(EXYNOS_DT, "SAMSUNG EXYNOS (Flattened Device Tree)") | 347 | DT_MACHINE_START(EXYNOS_DT, "SAMSUNG EXYNOS (Flattened Device Tree)") |
339 | /* Maintainer: Thomas Abraham <thomas.abraham@linaro.org> */ | 348 | /* Maintainer: Thomas Abraham <thomas.abraham@linaro.org> */ |
340 | /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ | 349 | /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ |
@@ -348,4 +357,5 @@ DT_MACHINE_START(EXYNOS_DT, "SAMSUNG EXYNOS (Flattened Device Tree)") | |||
348 | .dt_compat = exynos_dt_compat, | 357 | .dt_compat = exynos_dt_compat, |
349 | .restart = exynos_restart, | 358 | .restart = exynos_restart, |
350 | .reserve = exynos_reserve, | 359 | .reserve = exynos_reserve, |
360 | .dt_fixup = exynos_dt_fixup, | ||
351 | MACHINE_END | 361 | MACHINE_END |
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c index 8a134d019cb3..920a4baa53cd 100644 --- a/arch/arm/mach-exynos/hotplug.c +++ b/arch/arm/mach-exynos/hotplug.c | |||
@@ -40,15 +40,17 @@ static inline void cpu_leave_lowpower(void) | |||
40 | 40 | ||
41 | static inline void platform_do_lowpower(unsigned int cpu, int *spurious) | 41 | static inline void platform_do_lowpower(unsigned int cpu, int *spurious) |
42 | { | 42 | { |
43 | u32 mpidr = cpu_logical_map(cpu); | ||
44 | u32 core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0); | ||
45 | |||
43 | for (;;) { | 46 | for (;;) { |
44 | 47 | ||
45 | /* make cpu1 to be turned off at next WFI command */ | 48 | /* Turn the CPU off on next WFI instruction. */ |
46 | if (cpu == 1) | 49 | exynos_cpu_power_down(core_id); |
47 | exynos_cpu_power_down(cpu); | ||
48 | 50 | ||
49 | wfi(); | 51 | wfi(); |
50 | 52 | ||
51 | if (pen_release == cpu_logical_map(cpu)) { | 53 | if (pen_release == core_id) { |
52 | /* | 54 | /* |
53 | * OK, proper wakeup, we're done | 55 | * OK, proper wakeup, we're done |
54 | */ | 56 | */ |
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index 1c8d31e39520..50b9aad5e27b 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c | |||
@@ -90,7 +90,8 @@ static void exynos_secondary_init(unsigned int cpu) | |||
90 | static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle) | 90 | static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle) |
91 | { | 91 | { |
92 | unsigned long timeout; | 92 | unsigned long timeout; |
93 | unsigned long phys_cpu = cpu_logical_map(cpu); | 93 | u32 mpidr = cpu_logical_map(cpu); |
94 | u32 core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0); | ||
94 | int ret = -ENOSYS; | 95 | int ret = -ENOSYS; |
95 | 96 | ||
96 | /* | 97 | /* |
@@ -104,17 +105,18 @@ static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle) | |||
104 | * the holding pen - release it, then wait for it to flag | 105 | * the holding pen - release it, then wait for it to flag |
105 | * that it has been released by resetting pen_release. | 106 | * that it has been released by resetting pen_release. |
106 | * | 107 | * |
107 | * Note that "pen_release" is the hardware CPU ID, whereas | 108 | * Note that "pen_release" is the hardware CPU core ID, whereas |
108 | * "cpu" is Linux's internal ID. | 109 | * "cpu" is Linux's internal ID. |
109 | */ | 110 | */ |
110 | write_pen_release(phys_cpu); | 111 | write_pen_release(core_id); |
111 | 112 | ||
112 | if (!exynos_cpu_power_state(cpu)) { | 113 | if (!exynos_cpu_power_state(core_id)) { |
113 | exynos_cpu_power_up(cpu); | 114 | exynos_cpu_power_up(core_id); |
114 | timeout = 10; | 115 | timeout = 10; |
115 | 116 | ||
116 | /* wait max 10 ms until cpu1 is on */ | 117 | /* wait max 10 ms until cpu1 is on */ |
117 | while (exynos_cpu_power_state(cpu) != S5P_CORE_LOCAL_PWR_EN) { | 118 | while (exynos_cpu_power_state(core_id) |
119 | != S5P_CORE_LOCAL_PWR_EN) { | ||
118 | if (timeout-- == 0) | 120 | if (timeout-- == 0) |
119 | break; | 121 | break; |
120 | 122 | ||
@@ -145,20 +147,20 @@ static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle) | |||
145 | * Try to set boot address using firmware first | 147 | * Try to set boot address using firmware first |
146 | * and fall back to boot register if it fails. | 148 | * and fall back to boot register if it fails. |
147 | */ | 149 | */ |
148 | ret = call_firmware_op(set_cpu_boot_addr, phys_cpu, boot_addr); | 150 | ret = call_firmware_op(set_cpu_boot_addr, core_id, boot_addr); |
149 | if (ret && ret != -ENOSYS) | 151 | if (ret && ret != -ENOSYS) |
150 | goto fail; | 152 | goto fail; |
151 | if (ret == -ENOSYS) { | 153 | if (ret == -ENOSYS) { |
152 | void __iomem *boot_reg = cpu_boot_reg(phys_cpu); | 154 | void __iomem *boot_reg = cpu_boot_reg(core_id); |
153 | 155 | ||
154 | if (IS_ERR(boot_reg)) { | 156 | if (IS_ERR(boot_reg)) { |
155 | ret = PTR_ERR(boot_reg); | 157 | ret = PTR_ERR(boot_reg); |
156 | goto fail; | 158 | goto fail; |
157 | } | 159 | } |
158 | __raw_writel(boot_addr, cpu_boot_reg(phys_cpu)); | 160 | __raw_writel(boot_addr, cpu_boot_reg(core_id)); |
159 | } | 161 | } |
160 | 162 | ||
161 | call_firmware_op(cpu_boot, phys_cpu); | 163 | call_firmware_op(cpu_boot, core_id); |
162 | 164 | ||
163 | arch_send_wakeup_ipi_mask(cpumask_of(cpu)); | 165 | arch_send_wakeup_ipi_mask(cpumask_of(cpu)); |
164 | 166 | ||
@@ -227,22 +229,24 @@ static void __init exynos_smp_prepare_cpus(unsigned int max_cpus) | |||
227 | * boot register if it fails. | 229 | * boot register if it fails. |
228 | */ | 230 | */ |
229 | for (i = 1; i < max_cpus; ++i) { | 231 | for (i = 1; i < max_cpus; ++i) { |
230 | unsigned long phys_cpu; | ||
231 | unsigned long boot_addr; | 232 | unsigned long boot_addr; |
233 | u32 mpidr; | ||
234 | u32 core_id; | ||
232 | int ret; | 235 | int ret; |
233 | 236 | ||
234 | phys_cpu = cpu_logical_map(i); | 237 | mpidr = cpu_logical_map(i); |
238 | core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0); | ||
235 | boot_addr = virt_to_phys(exynos4_secondary_startup); | 239 | boot_addr = virt_to_phys(exynos4_secondary_startup); |
236 | 240 | ||
237 | ret = call_firmware_op(set_cpu_boot_addr, phys_cpu, boot_addr); | 241 | ret = call_firmware_op(set_cpu_boot_addr, core_id, boot_addr); |
238 | if (ret && ret != -ENOSYS) | 242 | if (ret && ret != -ENOSYS) |
239 | break; | 243 | break; |
240 | if (ret == -ENOSYS) { | 244 | if (ret == -ENOSYS) { |
241 | void __iomem *boot_reg = cpu_boot_reg(phys_cpu); | 245 | void __iomem *boot_reg = cpu_boot_reg(core_id); |
242 | 246 | ||
243 | if (IS_ERR(boot_reg)) | 247 | if (IS_ERR(boot_reg)) |
244 | break; | 248 | break; |
245 | __raw_writel(boot_addr, cpu_boot_reg(phys_cpu)); | 249 | __raw_writel(boot_addr, cpu_boot_reg(core_id)); |
246 | } | 250 | } |
247 | } | 251 | } |
248 | } | 252 | } |
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c index 8e795dea02ec..8556c787e59c 100644 --- a/arch/arm/mach-imx/clk-imx6q.c +++ b/arch/arm/mach-imx/clk-imx6q.c | |||
@@ -70,7 +70,7 @@ static const char *cko_sels[] = { "cko1", "cko2", }; | |||
70 | static const char *lvds_sels[] = { | 70 | static const char *lvds_sels[] = { |
71 | "dummy", "dummy", "dummy", "dummy", "dummy", "dummy", | 71 | "dummy", "dummy", "dummy", "dummy", "dummy", "dummy", |
72 | "pll4_audio", "pll5_video", "pll8_mlb", "enet_ref", | 72 | "pll4_audio", "pll5_video", "pll8_mlb", "enet_ref", |
73 | "pcie_ref", "sata_ref", | 73 | "pcie_ref_125m", "sata_ref_100m", |
74 | }; | 74 | }; |
75 | 75 | ||
76 | enum mx6q_clks { | 76 | enum mx6q_clks { |
@@ -491,7 +491,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) | |||
491 | 491 | ||
492 | /* All existing boards with PCIe use LVDS1 */ | 492 | /* All existing boards with PCIe use LVDS1 */ |
493 | if (IS_ENABLED(CONFIG_PCI_IMX6)) | 493 | if (IS_ENABLED(CONFIG_PCI_IMX6)) |
494 | clk_set_parent(clk[lvds1_sel], clk[sata_ref]); | 494 | clk_set_parent(clk[lvds1_sel], clk[sata_ref_100m]); |
495 | 495 | ||
496 | /* Set initial power mode */ | 496 | /* Set initial power mode */ |
497 | imx6q_set_lpm(WAIT_CLOCKED); | 497 | imx6q_set_lpm(WAIT_CLOCKED); |
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c index 477202fd39cc..2bdc3233abe2 100644 --- a/arch/arm/mach-mvebu/coherency.c +++ b/arch/arm/mach-mvebu/coherency.c | |||
@@ -292,6 +292,10 @@ static struct notifier_block mvebu_hwcc_nb = { | |||
292 | .notifier_call = mvebu_hwcc_notifier, | 292 | .notifier_call = mvebu_hwcc_notifier, |
293 | }; | 293 | }; |
294 | 294 | ||
295 | static struct notifier_block mvebu_hwcc_pci_nb = { | ||
296 | .notifier_call = mvebu_hwcc_notifier, | ||
297 | }; | ||
298 | |||
295 | static void __init armada_370_coherency_init(struct device_node *np) | 299 | static void __init armada_370_coherency_init(struct device_node *np) |
296 | { | 300 | { |
297 | struct resource res; | 301 | struct resource res; |
@@ -427,7 +431,7 @@ static int __init coherency_pci_init(void) | |||
427 | { | 431 | { |
428 | if (coherency_available()) | 432 | if (coherency_available()) |
429 | bus_register_notifier(&pci_bus_type, | 433 | bus_register_notifier(&pci_bus_type, |
430 | &mvebu_hwcc_nb); | 434 | &mvebu_hwcc_pci_nb); |
431 | return 0; | 435 | return 0; |
432 | } | 436 | } |
433 | 437 | ||
diff --git a/arch/arm/mach-mvebu/headsmp-a9.S b/arch/arm/mach-mvebu/headsmp-a9.S index 5925366bc03c..da5bb292b91c 100644 --- a/arch/arm/mach-mvebu/headsmp-a9.S +++ b/arch/arm/mach-mvebu/headsmp-a9.S | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <linux/linkage.h> | 15 | #include <linux/linkage.h> |
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | 17 | ||
18 | #include <asm/assembler.h> | ||
19 | |||
18 | __CPUINIT | 20 | __CPUINIT |
19 | #define CPU_RESUME_ADDR_REG 0xf10182d4 | 21 | #define CPU_RESUME_ADDR_REG 0xf10182d4 |
20 | 22 | ||
@@ -22,13 +24,18 @@ | |||
22 | .global armada_375_smp_cpu1_enable_code_end | 24 | .global armada_375_smp_cpu1_enable_code_end |
23 | 25 | ||
24 | armada_375_smp_cpu1_enable_code_start: | 26 | armada_375_smp_cpu1_enable_code_start: |
25 | ldr r0, [pc, #4] | 27 | ARM_BE8(setend be) |
28 | adr r0, 1f | ||
29 | ldr r0, [r0] | ||
26 | ldr r1, [r0] | 30 | ldr r1, [r0] |
31 | ARM_BE8(rev r1, r1) | ||
27 | mov pc, r1 | 32 | mov pc, r1 |
33 | 1: | ||
28 | .word CPU_RESUME_ADDR_REG | 34 | .word CPU_RESUME_ADDR_REG |
29 | armada_375_smp_cpu1_enable_code_end: | 35 | armada_375_smp_cpu1_enable_code_end: |
30 | 36 | ||
31 | ENTRY(mvebu_cortex_a9_secondary_startup) | 37 | ENTRY(mvebu_cortex_a9_secondary_startup) |
38 | ARM_BE8(setend be) | ||
32 | bl v7_invalidate_l1 | 39 | bl v7_invalidate_l1 |
33 | b secondary_startup | 40 | b secondary_startup |
34 | ENDPROC(mvebu_cortex_a9_secondary_startup) | 41 | ENDPROC(mvebu_cortex_a9_secondary_startup) |
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c index a1d407c0febe..25aa8237d668 100644 --- a/arch/arm/mach-mvebu/pmsu.c +++ b/arch/arm/mach-mvebu/pmsu.c | |||
@@ -201,12 +201,12 @@ static noinline int do_armada_370_xp_cpu_suspend(unsigned long deepidle) | |||
201 | 201 | ||
202 | /* Test the CR_C bit and set it if it was cleared */ | 202 | /* Test the CR_C bit and set it if it was cleared */ |
203 | asm volatile( | 203 | asm volatile( |
204 | "mrc p15, 0, %0, c1, c0, 0 \n\t" | 204 | "mrc p15, 0, r0, c1, c0, 0 \n\t" |
205 | "tst %0, #(1 << 2) \n\t" | 205 | "tst r0, #(1 << 2) \n\t" |
206 | "orreq %0, %0, #(1 << 2) \n\t" | 206 | "orreq r0, r0, #(1 << 2) \n\t" |
207 | "mcreq p15, 0, %0, c1, c0, 0 \n\t" | 207 | "mcreq p15, 0, r0, c1, c0, 0 \n\t" |
208 | "isb " | 208 | "isb " |
209 | : : "r" (0)); | 209 | : : : "r0"); |
210 | 210 | ||
211 | pr_warn("Failed to suspend the system\n"); | 211 | pr_warn("Failed to suspend the system\n"); |
212 | 212 | ||
diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c index 17cd39360afe..93914d220069 100644 --- a/arch/arm/mach-omap2/gpmc-nand.c +++ b/arch/arm/mach-omap2/gpmc-nand.c | |||
@@ -50,6 +50,16 @@ static bool gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt) | |||
50 | soc_is_omap54xx() || soc_is_dra7xx()) | 50 | soc_is_omap54xx() || soc_is_dra7xx()) |
51 | return 1; | 51 | return 1; |
52 | 52 | ||
53 | if (ecc_opt == OMAP_ECC_BCH4_CODE_HW_DETECTION_SW || | ||
54 | ecc_opt == OMAP_ECC_BCH8_CODE_HW_DETECTION_SW) { | ||
55 | if (cpu_is_omap24xx()) | ||
56 | return 0; | ||
57 | else if (cpu_is_omap3630() && (GET_OMAP_REVISION() == 0)) | ||
58 | return 0; | ||
59 | else | ||
60 | return 1; | ||
61 | } | ||
62 | |||
53 | /* OMAP3xxx do not have ELM engine, so cannot support ECC schemes | 63 | /* OMAP3xxx do not have ELM engine, so cannot support ECC schemes |
54 | * which require H/W based ECC error detection */ | 64 | * which require H/W based ECC error detection */ |
55 | if ((cpu_is_omap34xx() || cpu_is_omap3630()) && | 65 | if ((cpu_is_omap34xx() || cpu_is_omap3630()) && |
@@ -57,14 +67,6 @@ static bool gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt) | |||
57 | (ecc_opt == OMAP_ECC_BCH8_CODE_HW))) | 67 | (ecc_opt == OMAP_ECC_BCH8_CODE_HW))) |
58 | return 0; | 68 | return 0; |
59 | 69 | ||
60 | /* | ||
61 | * For now, assume 4-bit mode is only supported on OMAP3630 ES1.x, x>=1 | ||
62 | * and AM33xx derivates. Other chips may be added if confirmed to work. | ||
63 | */ | ||
64 | if ((ecc_opt == OMAP_ECC_BCH4_CODE_HW_DETECTION_SW) && | ||
65 | (!cpu_is_omap3630() || (GET_OMAP_REVISION() == 0))) | ||
66 | return 0; | ||
67 | |||
68 | /* legacy platforms support only HAM1 (1-bit Hamming) ECC scheme */ | 70 | /* legacy platforms support only HAM1 (1-bit Hamming) ECC scheme */ |
69 | if (ecc_opt == OMAP_ECC_HAM1_CODE_HW) | 71 | if (ecc_opt == OMAP_ECC_HAM1_CODE_HW) |
70 | return 1; | 72 | return 1; |
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c index 539e8106eb96..a0fe747634c1 100644 --- a/arch/arm/mach-omap2/omap4-common.c +++ b/arch/arm/mach-omap2/omap4-common.c | |||
@@ -168,6 +168,10 @@ static void omap4_l2c310_write_sec(unsigned long val, unsigned reg) | |||
168 | smc_op = OMAP4_MON_L2X0_PREFETCH_INDEX; | 168 | smc_op = OMAP4_MON_L2X0_PREFETCH_INDEX; |
169 | break; | 169 | break; |
170 | 170 | ||
171 | case L310_POWER_CTRL: | ||
172 | pr_info_once("OMAP L2C310: ROM does not support power control setting\n"); | ||
173 | return; | ||
174 | |||
171 | default: | 175 | default: |
172 | WARN_ONCE(1, "OMAP L2C310: ignoring write to reg 0x%x\n", reg); | 176 | WARN_ONCE(1, "OMAP L2C310: ignoring write to reg 0x%x\n", reg); |
173 | return; | 177 | return; |
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 4c88935654ca..1f88db06b133 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -461,12 +461,21 @@ void __init dma_contiguous_remap(void) | |||
461 | map.type = MT_MEMORY_DMA_READY; | 461 | map.type = MT_MEMORY_DMA_READY; |
462 | 462 | ||
463 | /* | 463 | /* |
464 | * Clear previous low-memory mapping | 464 | * Clear previous low-memory mapping to ensure that the |
465 | * TLB does not see any conflicting entries, then flush | ||
466 | * the TLB of the old entries before creating new mappings. | ||
467 | * | ||
468 | * This ensures that any speculatively loaded TLB entries | ||
469 | * (even though they may be rare) can not cause any problems, | ||
470 | * and ensures that this code is architecturally compliant. | ||
465 | */ | 471 | */ |
466 | for (addr = __phys_to_virt(start); addr < __phys_to_virt(end); | 472 | for (addr = __phys_to_virt(start); addr < __phys_to_virt(end); |
467 | addr += PMD_SIZE) | 473 | addr += PMD_SIZE) |
468 | pmd_clear(pmd_off_k(addr)); | 474 | pmd_clear(pmd_off_k(addr)); |
469 | 475 | ||
476 | flush_tlb_kernel_range(__phys_to_virt(start), | ||
477 | __phys_to_virt(end)); | ||
478 | |||
470 | iotable_init(&map, 1); | 479 | iotable_init(&map, 1); |
471 | } | 480 | } |
472 | } | 481 | } |
diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c index 8e0e52eb76b5..c447ec70e868 100644 --- a/arch/arm/mm/idmap.c +++ b/arch/arm/mm/idmap.c | |||
@@ -9,6 +9,11 @@ | |||
9 | #include <asm/sections.h> | 9 | #include <asm/sections.h> |
10 | #include <asm/system_info.h> | 10 | #include <asm/system_info.h> |
11 | 11 | ||
12 | /* | ||
13 | * Note: accesses outside of the kernel image and the identity map area | ||
14 | * are not supported on any CPU using the idmap tables as its current | ||
15 | * page tables. | ||
16 | */ | ||
12 | pgd_t *idmap_pgd; | 17 | pgd_t *idmap_pgd; |
13 | phys_addr_t (*arch_virt_to_idmap) (unsigned long x); | 18 | phys_addr_t (*arch_virt_to_idmap) (unsigned long x); |
14 | 19 | ||
@@ -25,6 +30,13 @@ static void idmap_add_pmd(pud_t *pud, unsigned long addr, unsigned long end, | |||
25 | pr_warning("Failed to allocate identity pmd.\n"); | 30 | pr_warning("Failed to allocate identity pmd.\n"); |
26 | return; | 31 | return; |
27 | } | 32 | } |
33 | /* | ||
34 | * Copy the original PMD to ensure that the PMD entries for | ||
35 | * the kernel image are preserved. | ||
36 | */ | ||
37 | if (!pud_none(*pud)) | ||
38 | memcpy(pmd, pmd_offset(pud, 0), | ||
39 | PTRS_PER_PMD * sizeof(pmd_t)); | ||
28 | pud_populate(&init_mm, pud, pmd); | 40 | pud_populate(&init_mm, pud, pmd); |
29 | pmd += pmd_index(addr); | 41 | pmd += pmd_index(addr); |
30 | } else | 42 | } else |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index ab14b79b03f0..6e3ba8d112a2 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -1406,8 +1406,8 @@ void __init early_paging_init(const struct machine_desc *mdesc, | |||
1406 | return; | 1406 | return; |
1407 | 1407 | ||
1408 | /* remap kernel code and data */ | 1408 | /* remap kernel code and data */ |
1409 | map_start = init_mm.start_code; | 1409 | map_start = init_mm.start_code & PMD_MASK; |
1410 | map_end = init_mm.brk; | 1410 | map_end = ALIGN(init_mm.brk, PMD_SIZE); |
1411 | 1411 | ||
1412 | /* get a handle on things... */ | 1412 | /* get a handle on things... */ |
1413 | pgd0 = pgd_offset_k(0); | 1413 | pgd0 = pgd_offset_k(0); |
@@ -1442,7 +1442,7 @@ void __init early_paging_init(const struct machine_desc *mdesc, | |||
1442 | } | 1442 | } |
1443 | 1443 | ||
1444 | /* remap pmds for kernel mapping */ | 1444 | /* remap pmds for kernel mapping */ |
1445 | phys = __pa(map_start) & PMD_MASK; | 1445 | phys = __pa(map_start); |
1446 | do { | 1446 | do { |
1447 | *pmdk++ = __pmd(phys | pmdprot); | 1447 | *pmdk++ = __pmd(phys | pmdprot); |
1448 | phys += PMD_SIZE; | 1448 | phys += PMD_SIZE; |
diff --git a/arch/arm/xen/grant-table.c b/arch/arm/xen/grant-table.c index 859a9bb002d5..91cf08ba1e95 100644 --- a/arch/arm/xen/grant-table.c +++ b/arch/arm/xen/grant-table.c | |||
@@ -51,3 +51,8 @@ int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes, | |||
51 | { | 51 | { |
52 | return -ENOSYS; | 52 | return -ENOSYS; |
53 | } | 53 | } |
54 | |||
55 | int arch_gnttab_init(unsigned long nr_shared, unsigned long nr_status) | ||
56 | { | ||
57 | return 0; | ||
58 | } | ||
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index a474de346be6..839f48c26ef0 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig | |||
@@ -4,6 +4,7 @@ config ARM64 | |||
4 | select ARCH_HAS_OPP | 4 | select ARCH_HAS_OPP |
5 | select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST | 5 | select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST |
6 | select ARCH_USE_CMPXCHG_LOCKREF | 6 | select ARCH_USE_CMPXCHG_LOCKREF |
7 | select ARCH_SUPPORTS_ATOMIC_RMW | ||
7 | select ARCH_WANT_OPTIONAL_GPIOLIB | 8 | select ARCH_WANT_OPTIONAL_GPIOLIB |
8 | select ARCH_WANT_COMPAT_IPC_PARSE_VERSION | 9 | select ARCH_WANT_COMPAT_IPC_PARSE_VERSION |
9 | select ARCH_WANT_FRAME_POINTERS | 10 | select ARCH_WANT_FRAME_POINTERS |
diff --git a/arch/arm64/crypto/aes-glue.c b/arch/arm64/crypto/aes-glue.c index 60f2f4c12256..79cd911ef88c 100644 --- a/arch/arm64/crypto/aes-glue.c +++ b/arch/arm64/crypto/aes-glue.c | |||
@@ -106,7 +106,7 @@ static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | |||
106 | for (first = 1; (blocks = (walk.nbytes / AES_BLOCK_SIZE)); first = 0) { | 106 | for (first = 1; (blocks = (walk.nbytes / AES_BLOCK_SIZE)); first = 0) { |
107 | aes_ecb_encrypt(walk.dst.virt.addr, walk.src.virt.addr, | 107 | aes_ecb_encrypt(walk.dst.virt.addr, walk.src.virt.addr, |
108 | (u8 *)ctx->key_enc, rounds, blocks, first); | 108 | (u8 *)ctx->key_enc, rounds, blocks, first); |
109 | err = blkcipher_walk_done(desc, &walk, 0); | 109 | err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE); |
110 | } | 110 | } |
111 | kernel_neon_end(); | 111 | kernel_neon_end(); |
112 | return err; | 112 | return err; |
@@ -128,7 +128,7 @@ static int ecb_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | |||
128 | for (first = 1; (blocks = (walk.nbytes / AES_BLOCK_SIZE)); first = 0) { | 128 | for (first = 1; (blocks = (walk.nbytes / AES_BLOCK_SIZE)); first = 0) { |
129 | aes_ecb_decrypt(walk.dst.virt.addr, walk.src.virt.addr, | 129 | aes_ecb_decrypt(walk.dst.virt.addr, walk.src.virt.addr, |
130 | (u8 *)ctx->key_dec, rounds, blocks, first); | 130 | (u8 *)ctx->key_dec, rounds, blocks, first); |
131 | err = blkcipher_walk_done(desc, &walk, 0); | 131 | err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE); |
132 | } | 132 | } |
133 | kernel_neon_end(); | 133 | kernel_neon_end(); |
134 | return err; | 134 | return err; |
@@ -151,7 +151,7 @@ static int cbc_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | |||
151 | aes_cbc_encrypt(walk.dst.virt.addr, walk.src.virt.addr, | 151 | aes_cbc_encrypt(walk.dst.virt.addr, walk.src.virt.addr, |
152 | (u8 *)ctx->key_enc, rounds, blocks, walk.iv, | 152 | (u8 *)ctx->key_enc, rounds, blocks, walk.iv, |
153 | first); | 153 | first); |
154 | err = blkcipher_walk_done(desc, &walk, 0); | 154 | err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE); |
155 | } | 155 | } |
156 | kernel_neon_end(); | 156 | kernel_neon_end(); |
157 | return err; | 157 | return err; |
@@ -174,7 +174,7 @@ static int cbc_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | |||
174 | aes_cbc_decrypt(walk.dst.virt.addr, walk.src.virt.addr, | 174 | aes_cbc_decrypt(walk.dst.virt.addr, walk.src.virt.addr, |
175 | (u8 *)ctx->key_dec, rounds, blocks, walk.iv, | 175 | (u8 *)ctx->key_dec, rounds, blocks, walk.iv, |
176 | first); | 176 | first); |
177 | err = blkcipher_walk_done(desc, &walk, 0); | 177 | err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE); |
178 | } | 178 | } |
179 | kernel_neon_end(); | 179 | kernel_neon_end(); |
180 | return err; | 180 | return err; |
@@ -243,7 +243,7 @@ static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | |||
243 | aes_xts_encrypt(walk.dst.virt.addr, walk.src.virt.addr, | 243 | aes_xts_encrypt(walk.dst.virt.addr, walk.src.virt.addr, |
244 | (u8 *)ctx->key1.key_enc, rounds, blocks, | 244 | (u8 *)ctx->key1.key_enc, rounds, blocks, |
245 | (u8 *)ctx->key2.key_enc, walk.iv, first); | 245 | (u8 *)ctx->key2.key_enc, walk.iv, first); |
246 | err = blkcipher_walk_done(desc, &walk, 0); | 246 | err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE); |
247 | } | 247 | } |
248 | kernel_neon_end(); | 248 | kernel_neon_end(); |
249 | 249 | ||
@@ -267,7 +267,7 @@ static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, | |||
267 | aes_xts_decrypt(walk.dst.virt.addr, walk.src.virt.addr, | 267 | aes_xts_decrypt(walk.dst.virt.addr, walk.src.virt.addr, |
268 | (u8 *)ctx->key1.key_dec, rounds, blocks, | 268 | (u8 *)ctx->key1.key_dec, rounds, blocks, |
269 | (u8 *)ctx->key2.key_enc, walk.iv, first); | 269 | (u8 *)ctx->key2.key_enc, walk.iv, first); |
270 | err = blkcipher_walk_done(desc, &walk, 0); | 270 | err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE); |
271 | } | 271 | } |
272 | kernel_neon_end(); | 272 | kernel_neon_end(); |
273 | 273 | ||
diff --git a/arch/arm64/kernel/efi-stub.c b/arch/arm64/kernel/efi-stub.c index 60e98a639ac5..e786e6cdc400 100644 --- a/arch/arm64/kernel/efi-stub.c +++ b/arch/arm64/kernel/efi-stub.c | |||
@@ -12,8 +12,6 @@ | |||
12 | #include <linux/efi.h> | 12 | #include <linux/efi.h> |
13 | #include <linux/libfdt.h> | 13 | #include <linux/libfdt.h> |
14 | #include <asm/sections.h> | 14 | #include <asm/sections.h> |
15 | #include <generated/compile.h> | ||
16 | #include <generated/utsrelease.h> | ||
17 | 15 | ||
18 | /* | 16 | /* |
19 | * AArch64 requires the DTB to be 8-byte aligned in the first 512MiB from | 17 | * AArch64 requires the DTB to be 8-byte aligned in the first 512MiB from |
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index f43db8a69262..e90c5426fe14 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c | |||
@@ -60,6 +60,17 @@ static int __init early_initrd(char *p) | |||
60 | early_param("initrd", early_initrd); | 60 | early_param("initrd", early_initrd); |
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | /* | ||
64 | * Return the maximum physical address for ZONE_DMA (DMA_BIT_MASK(32)). It | ||
65 | * currently assumes that for memory starting above 4G, 32-bit devices will | ||
66 | * use a DMA offset. | ||
67 | */ | ||
68 | static phys_addr_t max_zone_dma_phys(void) | ||
69 | { | ||
70 | phys_addr_t offset = memblock_start_of_DRAM() & GENMASK_ULL(63, 32); | ||
71 | return min(offset + (1ULL << 32), memblock_end_of_DRAM()); | ||
72 | } | ||
73 | |||
63 | static void __init zone_sizes_init(unsigned long min, unsigned long max) | 74 | static void __init zone_sizes_init(unsigned long min, unsigned long max) |
64 | { | 75 | { |
65 | struct memblock_region *reg; | 76 | struct memblock_region *reg; |
@@ -70,9 +81,7 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max) | |||
70 | 81 | ||
71 | /* 4GB maximum for 32-bit only capable devices */ | 82 | /* 4GB maximum for 32-bit only capable devices */ |
72 | if (IS_ENABLED(CONFIG_ZONE_DMA)) { | 83 | if (IS_ENABLED(CONFIG_ZONE_DMA)) { |
73 | unsigned long max_dma_phys = | 84 | max_dma = PFN_DOWN(max_zone_dma_phys()); |
74 | (unsigned long)(dma_to_phys(NULL, DMA_BIT_MASK(32)) + 1); | ||
75 | max_dma = max(min, min(max, max_dma_phys >> PAGE_SHIFT)); | ||
76 | zone_size[ZONE_DMA] = max_dma - min; | 85 | zone_size[ZONE_DMA] = max_dma - min; |
77 | } | 86 | } |
78 | zone_size[ZONE_NORMAL] = max - max_dma; | 87 | zone_size[ZONE_NORMAL] = max - max_dma; |
@@ -146,7 +155,7 @@ void __init arm64_memblock_init(void) | |||
146 | 155 | ||
147 | /* 4GB maximum for 32-bit only capable devices */ | 156 | /* 4GB maximum for 32-bit only capable devices */ |
148 | if (IS_ENABLED(CONFIG_ZONE_DMA)) | 157 | if (IS_ENABLED(CONFIG_ZONE_DMA)) |
149 | dma_phys_limit = dma_to_phys(NULL, DMA_BIT_MASK(32)) + 1; | 158 | dma_phys_limit = max_zone_dma_phys(); |
150 | dma_contiguous_reserve(dma_phys_limit); | 159 | dma_contiguous_reserve(dma_phys_limit); |
151 | 160 | ||
152 | memblock_allow_resize(); | 161 | memblock_allow_resize(); |
diff --git a/arch/blackfin/configs/BF609-EZKIT_defconfig b/arch/blackfin/configs/BF609-EZKIT_defconfig index a7e9bfd84183..fcec5ce71392 100644 --- a/arch/blackfin/configs/BF609-EZKIT_defconfig +++ b/arch/blackfin/configs/BF609-EZKIT_defconfig | |||
@@ -102,7 +102,7 @@ CONFIG_I2C_CHARDEV=y | |||
102 | CONFIG_I2C_BLACKFIN_TWI=y | 102 | CONFIG_I2C_BLACKFIN_TWI=y |
103 | CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100 | 103 | CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100 |
104 | CONFIG_SPI=y | 104 | CONFIG_SPI=y |
105 | CONFIG_SPI_BFIN_V3=y | 105 | CONFIG_SPI_ADI_V3=y |
106 | CONFIG_GPIOLIB=y | 106 | CONFIG_GPIOLIB=y |
107 | CONFIG_GPIO_SYSFS=y | 107 | CONFIG_GPIO_SYSFS=y |
108 | # CONFIG_HWMON is not set | 108 | # CONFIG_HWMON is not set |
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S index ba35864b2b74..c9eec84aa258 100644 --- a/arch/blackfin/kernel/vmlinux.lds.S +++ b/arch/blackfin/kernel/vmlinux.lds.S | |||
@@ -145,7 +145,7 @@ SECTIONS | |||
145 | 145 | ||
146 | .text_l1 L1_CODE_START : AT(LOADADDR(.exit.data) + SIZEOF(.exit.data)) | 146 | .text_l1 L1_CODE_START : AT(LOADADDR(.exit.data) + SIZEOF(.exit.data)) |
147 | #else | 147 | #else |
148 | .init.data : AT(__data_lma + __data_len) | 148 | .init.data : AT(__data_lma + __data_len + 32) |
149 | { | 149 | { |
150 | __sinitdata = .; | 150 | __sinitdata = .; |
151 | INIT_DATA | 151 | INIT_DATA |
diff --git a/arch/blackfin/mach-bf533/boards/blackstamp.c b/arch/blackfin/mach-bf533/boards/blackstamp.c index 63b0e4fe760c..0ccf0cf4daaf 100644 --- a/arch/blackfin/mach-bf533/boards/blackstamp.c +++ b/arch/blackfin/mach-bf533/boards/blackstamp.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/spi/spi.h> | 20 | #include <linux/spi/spi.h> |
21 | #include <linux/spi/flash.h> | 21 | #include <linux/spi/flash.h> |
22 | #include <linux/irq.h> | 22 | #include <linux/irq.h> |
23 | #include <linux/gpio.h> | ||
23 | #include <linux/i2c.h> | 24 | #include <linux/i2c.h> |
24 | #include <asm/dma.h> | 25 | #include <asm/dma.h> |
25 | #include <asm/bfin5xx_spi.h> | 26 | #include <asm/bfin5xx_spi.h> |
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537e.c b/arch/blackfin/mach-bf537/boards/cm_bf537e.c index c65c6dbda3da..1e7290ef3525 100644 --- a/arch/blackfin/mach-bf537/boards/cm_bf537e.c +++ b/arch/blackfin/mach-bf537/boards/cm_bf537e.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #endif | 21 | #endif |
22 | #include <linux/ata_platform.h> | 22 | #include <linux/ata_platform.h> |
23 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
24 | #include <linux/gpio.h> | ||
24 | #include <asm/dma.h> | 25 | #include <asm/dma.h> |
25 | #include <asm/bfin5xx_spi.h> | 26 | #include <asm/bfin5xx_spi.h> |
26 | #include <asm/portmux.h> | 27 | #include <asm/portmux.h> |
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537u.c b/arch/blackfin/mach-bf537/boards/cm_bf537u.c index af58454b4bff..c7495dc74690 100644 --- a/arch/blackfin/mach-bf537/boards/cm_bf537u.c +++ b/arch/blackfin/mach-bf537/boards/cm_bf537u.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #endif | 21 | #endif |
22 | #include <linux/ata_platform.h> | 22 | #include <linux/ata_platform.h> |
23 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
24 | #include <linux/gpio.h> | ||
24 | #include <asm/dma.h> | 25 | #include <asm/dma.h> |
25 | #include <asm/bfin5xx_spi.h> | 26 | #include <asm/bfin5xx_spi.h> |
26 | #include <asm/portmux.h> | 27 | #include <asm/portmux.h> |
diff --git a/arch/blackfin/mach-bf537/boards/tcm_bf537.c b/arch/blackfin/mach-bf537/boards/tcm_bf537.c index a0211225748d..6b988ad653d8 100644 --- a/arch/blackfin/mach-bf537/boards/tcm_bf537.c +++ b/arch/blackfin/mach-bf537/boards/tcm_bf537.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #endif | 21 | #endif |
22 | #include <linux/ata_platform.h> | 22 | #include <linux/ata_platform.h> |
23 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
24 | #include <linux/gpio.h> | ||
24 | #include <asm/dma.h> | 25 | #include <asm/dma.h> |
25 | #include <asm/bfin5xx_spi.h> | 26 | #include <asm/bfin5xx_spi.h> |
26 | #include <asm/portmux.h> | 27 | #include <asm/portmux.h> |
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c index 90138e6112c1..1fe7ff286619 100644 --- a/arch/blackfin/mach-bf548/boards/ezkit.c +++ b/arch/blackfin/mach-bf548/boards/ezkit.c | |||
@@ -2118,7 +2118,7 @@ static struct pinctrl_map __initdata bfin_pinmux_map[] = { | |||
2118 | PIN_MAP_MUX_GROUP_DEFAULT("bfin-rotary", "pinctrl-adi2.0", NULL, "rotary"), | 2118 | PIN_MAP_MUX_GROUP_DEFAULT("bfin-rotary", "pinctrl-adi2.0", NULL, "rotary"), |
2119 | PIN_MAP_MUX_GROUP_DEFAULT("bfin_can.0", "pinctrl-adi2.0", NULL, "can0"), | 2119 | PIN_MAP_MUX_GROUP_DEFAULT("bfin_can.0", "pinctrl-adi2.0", NULL, "can0"), |
2120 | PIN_MAP_MUX_GROUP_DEFAULT("bfin_can.1", "pinctrl-adi2.0", NULL, "can1"), | 2120 | PIN_MAP_MUX_GROUP_DEFAULT("bfin_can.1", "pinctrl-adi2.0", NULL, "can1"), |
2121 | PIN_MAP_MUX_GROUP_DEFAULT("bf54x-lq043", "pinctrl-adi2.0", NULL, "ppi0_24b"), | 2121 | PIN_MAP_MUX_GROUP_DEFAULT("bf54x-lq043", "pinctrl-adi2.0", "ppi0_24bgrp", "ppi0"), |
2122 | PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.0", "pinctrl-adi2.0", NULL, "sport0"), | 2122 | PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.0", "pinctrl-adi2.0", NULL, "sport0"), |
2123 | PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.0", "pinctrl-adi2.0", NULL, "sport0"), | 2123 | PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.0", "pinctrl-adi2.0", NULL, "sport0"), |
2124 | PIN_MAP_MUX_GROUP_DEFAULT("bfin-ac97.0", "pinctrl-adi2.0", NULL, "sport0"), | 2124 | PIN_MAP_MUX_GROUP_DEFAULT("bfin-ac97.0", "pinctrl-adi2.0", NULL, "sport0"), |
@@ -2140,7 +2140,9 @@ static struct pinctrl_map __initdata bfin_pinmux_map[] = { | |||
2140 | PIN_MAP_MUX_GROUP_DEFAULT("pata-bf54x", "pinctrl-adi2.0", NULL, "atapi_alter"), | 2140 | PIN_MAP_MUX_GROUP_DEFAULT("pata-bf54x", "pinctrl-adi2.0", NULL, "atapi_alter"), |
2141 | #endif | 2141 | #endif |
2142 | PIN_MAP_MUX_GROUP_DEFAULT("bf5xx-nand.0", "pinctrl-adi2.0", NULL, "nfc0"), | 2142 | PIN_MAP_MUX_GROUP_DEFAULT("bf5xx-nand.0", "pinctrl-adi2.0", NULL, "nfc0"), |
2143 | PIN_MAP_MUX_GROUP_DEFAULT("bf54x-keys", "pinctrl-adi2.0", NULL, "keys_4x4"), | 2143 | PIN_MAP_MUX_GROUP_DEFAULT("bf54x-keys", "pinctrl-adi2.0", "keys_4x4grp", "keys"), |
2144 | PIN_MAP_MUX_GROUP("bf54x-keys", "4bit", "pinctrl-adi2.0", "keys_4x4grp", "keys"), | ||
2145 | PIN_MAP_MUX_GROUP("bf54x-keys", "8bit", "pinctrl-adi2.0", "keys_8x8grp", "keys"), | ||
2144 | }; | 2146 | }; |
2145 | 2147 | ||
2146 | static int __init ezkit_init(void) | 2148 | static int __init ezkit_init(void) |
diff --git a/arch/blackfin/mach-bf561/boards/acvilon.c b/arch/blackfin/mach-bf561/boards/acvilon.c index 430b16d5ccb1..6ab951534d79 100644 --- a/arch/blackfin/mach-bf561/boards/acvilon.c +++ b/arch/blackfin/mach-bf561/boards/acvilon.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/spi/flash.h> | 44 | #include <linux/spi/flash.h> |
45 | #include <linux/irq.h> | 45 | #include <linux/irq.h> |
46 | #include <linux/interrupt.h> | 46 | #include <linux/interrupt.h> |
47 | #include <linux/gpio.h> | ||
47 | #include <linux/jiffies.h> | 48 | #include <linux/jiffies.h> |
48 | #include <linux/i2c-pca-platform.h> | 49 | #include <linux/i2c-pca-platform.h> |
49 | #include <linux/delay.h> | 50 | #include <linux/delay.h> |
diff --git a/arch/blackfin/mach-bf561/boards/cm_bf561.c b/arch/blackfin/mach-bf561/boards/cm_bf561.c index 9f777df4cacc..e862f7823e68 100644 --- a/arch/blackfin/mach-bf561/boards/cm_bf561.c +++ b/arch/blackfin/mach-bf561/boards/cm_bf561.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #endif | 18 | #endif |
19 | #include <linux/ata_platform.h> | 19 | #include <linux/ata_platform.h> |
20 | #include <linux/irq.h> | 20 | #include <linux/irq.h> |
21 | #include <linux/gpio.h> | ||
21 | #include <asm/dma.h> | 22 | #include <asm/dma.h> |
22 | #include <asm/bfin5xx_spi.h> | 23 | #include <asm/bfin5xx_spi.h> |
23 | #include <asm/portmux.h> | 24 | #include <asm/portmux.h> |
diff --git a/arch/blackfin/mach-bf561/boards/ezkit.c b/arch/blackfin/mach-bf561/boards/ezkit.c index 88dee43e7abe..2de71e8c104b 100644 --- a/arch/blackfin/mach-bf561/boards/ezkit.c +++ b/arch/blackfin/mach-bf561/boards/ezkit.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/spi/spi.h> | 14 | #include <linux/spi/spi.h> |
15 | #include <linux/irq.h> | 15 | #include <linux/irq.h> |
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/gpio.h> | ||
17 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
18 | #include <asm/dma.h> | 19 | #include <asm/dma.h> |
19 | #include <asm/bfin5xx_spi.h> | 20 | #include <asm/bfin5xx_spi.h> |
diff --git a/arch/blackfin/mach-bf609/boards/ezkit.c b/arch/blackfin/mach-bf609/boards/ezkit.c index 1ba4600de69f..e2c0b024ce88 100644 --- a/arch/blackfin/mach-bf609/boards/ezkit.c +++ b/arch/blackfin/mach-bf609/boards/ezkit.c | |||
@@ -698,8 +698,6 @@ int bf609_nor_flash_init(struct platform_device *pdev) | |||
698 | { | 698 | { |
699 | #define CONFIG_SMC_GCTL_VAL 0x00000010 | 699 | #define CONFIG_SMC_GCTL_VAL 0x00000010 |
700 | 700 | ||
701 | if (!devm_pinctrl_get_select_default(&pdev->dev)) | ||
702 | return -EBUSY; | ||
703 | bfin_write32(SMC_GCTL, CONFIG_SMC_GCTL_VAL); | 701 | bfin_write32(SMC_GCTL, CONFIG_SMC_GCTL_VAL); |
704 | bfin_write32(SMC_B0CTL, 0x01002011); | 702 | bfin_write32(SMC_B0CTL, 0x01002011); |
705 | bfin_write32(SMC_B0TIM, 0x08170977); | 703 | bfin_write32(SMC_B0TIM, 0x08170977); |
@@ -709,7 +707,6 @@ int bf609_nor_flash_init(struct platform_device *pdev) | |||
709 | 707 | ||
710 | void bf609_nor_flash_exit(struct platform_device *pdev) | 708 | void bf609_nor_flash_exit(struct platform_device *pdev) |
711 | { | 709 | { |
712 | devm_pinctrl_put(pdev->dev.pins->p); | ||
713 | bfin_write32(SMC_GCTL, 0); | 710 | bfin_write32(SMC_GCTL, 0); |
714 | } | 711 | } |
715 | 712 | ||
@@ -2058,15 +2055,14 @@ static struct pinctrl_map __initdata bfin_pinmux_map[] = { | |||
2058 | PIN_MAP_MUX_GROUP_DEFAULT("bfin-rotary", "pinctrl-adi2.0", NULL, "rotary"), | 2055 | PIN_MAP_MUX_GROUP_DEFAULT("bfin-rotary", "pinctrl-adi2.0", NULL, "rotary"), |
2059 | PIN_MAP_MUX_GROUP_DEFAULT("bfin_can.0", "pinctrl-adi2.0", NULL, "can0"), | 2056 | PIN_MAP_MUX_GROUP_DEFAULT("bfin_can.0", "pinctrl-adi2.0", NULL, "can0"), |
2060 | PIN_MAP_MUX_GROUP_DEFAULT("physmap-flash.0", "pinctrl-adi2.0", NULL, "smc0"), | 2057 | PIN_MAP_MUX_GROUP_DEFAULT("physmap-flash.0", "pinctrl-adi2.0", NULL, "smc0"), |
2061 | PIN_MAP_MUX_GROUP_DEFAULT("bf609_nl8048.2", "pinctrl-adi2.0", NULL, "ppi2_16b"), | 2058 | PIN_MAP_MUX_GROUP_DEFAULT("bf609_nl8048.2", "pinctrl-adi2.0", "ppi2_16bgrp", "ppi2"), |
2062 | PIN_MAP_MUX_GROUP_DEFAULT("bfin_display.0", "pinctrl-adi2.0", NULL, "ppi0_16b"), | 2059 | PIN_MAP_MUX_GROUP("bfin_display.0", "8bit", "pinctrl-adi2.0", "ppi2_8bgrp", "ppi2"), |
2063 | #if IS_ENABLED(CONFIG_VIDEO_MT9M114) | 2060 | PIN_MAP_MUX_GROUP_DEFAULT("bfin_display.0", "pinctrl-adi2.0", "ppi2_16bgrp", "ppi2"), |
2064 | PIN_MAP_MUX_GROUP_DEFAULT("bfin_capture.0", "pinctrl-adi2.0", NULL, "ppi0_8b"), | 2061 | PIN_MAP_MUX_GROUP("bfin_display.0", "16bit", "pinctrl-adi2.0", "ppi2_16bgrp", "ppi2"), |
2065 | #elif IS_ENABLED(CONFIG_VIDEO_VS6624) | 2062 | PIN_MAP_MUX_GROUP("bfin_capture.0", "8bit", "pinctrl-adi2.0", "ppi0_8bgrp", "ppi0"), |
2066 | PIN_MAP_MUX_GROUP_DEFAULT("bfin_capture.0", "pinctrl-adi2.0", NULL, "ppi0_16b"), | 2063 | PIN_MAP_MUX_GROUP_DEFAULT("bfin_capture.0", "pinctrl-adi2.0", "ppi0_16bgrp", "ppi0"), |
2067 | #else | 2064 | PIN_MAP_MUX_GROUP("bfin_capture.0", "16bit", "pinctrl-adi2.0", "ppi0_16bgrp", "ppi0"), |
2068 | PIN_MAP_MUX_GROUP_DEFAULT("bfin_capture.0", "pinctrl-adi2.0", NULL, "ppi0_24b"), | 2065 | PIN_MAP_MUX_GROUP("bfin_capture.0", "24bit", "pinctrl-adi2.0", "ppi0_24bgrp", "ppi0"), |
2069 | #endif | ||
2070 | PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.0", "pinctrl-adi2.0", NULL, "sport0"), | 2066 | PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.0", "pinctrl-adi2.0", NULL, "sport0"), |
2071 | PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.0", "pinctrl-adi2.0", NULL, "sport0"), | 2067 | PIN_MAP_MUX_GROUP_DEFAULT("bfin-tdm.0", "pinctrl-adi2.0", NULL, "sport0"), |
2072 | PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.1", "pinctrl-adi2.0", NULL, "sport1"), | 2068 | PIN_MAP_MUX_GROUP_DEFAULT("bfin-i2s.1", "pinctrl-adi2.0", NULL, "sport1"), |
diff --git a/arch/blackfin/mach-bf609/include/mach/pm.h b/arch/blackfin/mach-bf609/include/mach/pm.h index 3ca0fb965636..a1efd936dd30 100644 --- a/arch/blackfin/mach-bf609/include/mach/pm.h +++ b/arch/blackfin/mach-bf609/include/mach/pm.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #define __MACH_BF609_PM_H__ | 10 | #define __MACH_BF609_PM_H__ |
11 | 11 | ||
12 | #include <linux/suspend.h> | 12 | #include <linux/suspend.h> |
13 | #include <linux/platform_device.h> | ||
13 | 14 | ||
14 | extern int bfin609_pm_enter(suspend_state_t state); | 15 | extern int bfin609_pm_enter(suspend_state_t state); |
15 | extern int bf609_pm_prepare(void); | 16 | extern int bf609_pm_prepare(void); |
@@ -19,6 +20,6 @@ void bf609_hibernate(void); | |||
19 | void bfin_sec_raise_irq(unsigned int sid); | 20 | void bfin_sec_raise_irq(unsigned int sid); |
20 | void coreb_enable(void); | 21 | void coreb_enable(void); |
21 | 22 | ||
22 | int bf609_nor_flash_init(void); | 23 | int bf609_nor_flash_init(struct platform_device *pdev); |
23 | void bf609_nor_flash_exit(void); | 24 | void bf609_nor_flash_exit(struct platform_device *pdev); |
24 | #endif | 25 | #endif |
diff --git a/arch/blackfin/mach-bf609/pm.c b/arch/blackfin/mach-bf609/pm.c index 0cdd6955c7be..b1bfcf434d16 100644 --- a/arch/blackfin/mach-bf609/pm.c +++ b/arch/blackfin/mach-bf609/pm.c | |||
@@ -291,13 +291,13 @@ static struct bfin_cpu_pm_fns bf609_cpu_pm = { | |||
291 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) | 291 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
292 | static int smc_pm_syscore_suspend(void) | 292 | static int smc_pm_syscore_suspend(void) |
293 | { | 293 | { |
294 | bf609_nor_flash_exit(); | 294 | bf609_nor_flash_exit(NULL); |
295 | return 0; | 295 | return 0; |
296 | } | 296 | } |
297 | 297 | ||
298 | static void smc_pm_syscore_resume(void) | 298 | static void smc_pm_syscore_resume(void) |
299 | { | 299 | { |
300 | bf609_nor_flash_init(); | 300 | bf609_nor_flash_init(NULL); |
301 | } | 301 | } |
302 | 302 | ||
303 | static struct syscore_ops smc_pm_syscore_ops = { | 303 | static struct syscore_ops smc_pm_syscore_ops = { |
diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c index 867b7cef204c..1f94784eab6d 100644 --- a/arch/blackfin/mach-common/ints-priority.c +++ b/arch/blackfin/mach-common/ints-priority.c | |||
@@ -1208,8 +1208,6 @@ int __init init_arch_irq(void) | |||
1208 | 1208 | ||
1209 | bfin_sec_set_priority(CONFIG_SEC_IRQ_PRIORITY_LEVELS, sec_int_priority); | 1209 | bfin_sec_set_priority(CONFIG_SEC_IRQ_PRIORITY_LEVELS, sec_int_priority); |
1210 | 1210 | ||
1211 | bfin_sec_set_priority(CONFIG_SEC_IRQ_PRIORITY_LEVELS, sec_int_priority); | ||
1212 | |||
1213 | /* Enable interrupts IVG7-15 */ | 1211 | /* Enable interrupts IVG7-15 */ |
1214 | bfin_irq_flags |= IMASK_IVG15 | | 1212 | bfin_irq_flags |= IMASK_IVG15 | |
1215 | IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 | | 1213 | IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 | |
diff --git a/arch/parisc/include/uapi/asm/signal.h b/arch/parisc/include/uapi/asm/signal.h index a2fa297196bc..f5645d6a89f2 100644 --- a/arch/parisc/include/uapi/asm/signal.h +++ b/arch/parisc/include/uapi/asm/signal.h | |||
@@ -69,8 +69,6 @@ | |||
69 | #define SA_NOMASK SA_NODEFER | 69 | #define SA_NOMASK SA_NODEFER |
70 | #define SA_ONESHOT SA_RESETHAND | 70 | #define SA_ONESHOT SA_RESETHAND |
71 | 71 | ||
72 | #define SA_RESTORER 0x04000000 /* obsolete -- ignored */ | ||
73 | |||
74 | #define MINSIGSTKSZ 2048 | 72 | #define MINSIGSTKSZ 2048 |
75 | #define SIGSTKSZ 8192 | 73 | #define SIGSTKSZ 8192 |
76 | 74 | ||
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c index ae085ad0fba0..0bef864264c0 100644 --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c | |||
@@ -728,7 +728,6 @@ static void __init pagetable_init(void) | |||
728 | #endif | 728 | #endif |
729 | 729 | ||
730 | empty_zero_page = alloc_bootmem_pages(PAGE_SIZE); | 730 | empty_zero_page = alloc_bootmem_pages(PAGE_SIZE); |
731 | memset(empty_zero_page, 0, PAGE_SIZE); | ||
732 | } | 731 | } |
733 | 732 | ||
734 | static void __init gateway_init(void) | 733 | static void __init gateway_init(void) |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index fefe7c8bf05f..80b94b0add1f 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -145,6 +145,7 @@ config PPC | |||
145 | select HAVE_IRQ_EXIT_ON_IRQ_STACK | 145 | select HAVE_IRQ_EXIT_ON_IRQ_STACK |
146 | select ARCH_USE_CMPXCHG_LOCKREF if PPC64 | 146 | select ARCH_USE_CMPXCHG_LOCKREF if PPC64 |
147 | select HAVE_ARCH_AUDITSYSCALL | 147 | select HAVE_ARCH_AUDITSYSCALL |
148 | select ARCH_SUPPORTS_ATOMIC_RMW | ||
148 | 149 | ||
149 | config GENERIC_CSUM | 150 | config GENERIC_CSUM |
150 | def_bool CPU_LITTLE_ENDIAN | 151 | def_bool CPU_LITTLE_ENDIAN |
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h index bc2347774f0a..0fdd7eece6d9 100644 --- a/arch/powerpc/include/asm/cputable.h +++ b/arch/powerpc/include/asm/cputable.h | |||
@@ -447,6 +447,7 @@ extern const char *powerpc_base_platform; | |||
447 | CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_DAWR | \ | 447 | CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_DAWR | \ |
448 | CPU_FTR_ARCH_207S | CPU_FTR_TM_COMP) | 448 | CPU_FTR_ARCH_207S | CPU_FTR_TM_COMP) |
449 | #define CPU_FTRS_POWER8E (CPU_FTRS_POWER8 | CPU_FTR_PMAO_BUG) | 449 | #define CPU_FTRS_POWER8E (CPU_FTRS_POWER8 | CPU_FTR_PMAO_BUG) |
450 | #define CPU_FTRS_POWER8_DD1 (CPU_FTRS_POWER8 & ~CPU_FTR_DBELL) | ||
450 | #define CPU_FTRS_CELL (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ | 451 | #define CPU_FTRS_CELL (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ |
451 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ | 452 | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ |
452 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ | 453 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ |
diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h index fddb72b48ce9..d645428a65a4 100644 --- a/arch/powerpc/include/asm/kvm_book3s_64.h +++ b/arch/powerpc/include/asm/kvm_book3s_64.h | |||
@@ -198,8 +198,10 @@ static inline unsigned long compute_tlbie_rb(unsigned long v, unsigned long r, | |||
198 | return rb; | 198 | return rb; |
199 | } | 199 | } |
200 | 200 | ||
201 | static inline unsigned long hpte_page_size(unsigned long h, unsigned long l) | 201 | static inline unsigned long __hpte_page_size(unsigned long h, unsigned long l, |
202 | bool is_base_size) | ||
202 | { | 203 | { |
204 | |||
203 | int size, a_psize; | 205 | int size, a_psize; |
204 | /* Look at the 8 bit LP value */ | 206 | /* Look at the 8 bit LP value */ |
205 | unsigned int lp = (l >> LP_SHIFT) & ((1 << LP_BITS) - 1); | 207 | unsigned int lp = (l >> LP_SHIFT) & ((1 << LP_BITS) - 1); |
@@ -214,14 +216,27 @@ static inline unsigned long hpte_page_size(unsigned long h, unsigned long l) | |||
214 | continue; | 216 | continue; |
215 | 217 | ||
216 | a_psize = __hpte_actual_psize(lp, size); | 218 | a_psize = __hpte_actual_psize(lp, size); |
217 | if (a_psize != -1) | 219 | if (a_psize != -1) { |
220 | if (is_base_size) | ||
221 | return 1ul << mmu_psize_defs[size].shift; | ||
218 | return 1ul << mmu_psize_defs[a_psize].shift; | 222 | return 1ul << mmu_psize_defs[a_psize].shift; |
223 | } | ||
219 | } | 224 | } |
220 | 225 | ||
221 | } | 226 | } |
222 | return 0; | 227 | return 0; |
223 | } | 228 | } |
224 | 229 | ||
230 | static inline unsigned long hpte_page_size(unsigned long h, unsigned long l) | ||
231 | { | ||
232 | return __hpte_page_size(h, l, 0); | ||
233 | } | ||
234 | |||
235 | static inline unsigned long hpte_base_page_size(unsigned long h, unsigned long l) | ||
236 | { | ||
237 | return __hpte_page_size(h, l, 1); | ||
238 | } | ||
239 | |||
225 | static inline unsigned long hpte_rpn(unsigned long ptel, unsigned long psize) | 240 | static inline unsigned long hpte_rpn(unsigned long ptel, unsigned long psize) |
226 | { | 241 | { |
227 | return ((ptel & HPTE_R_RPN) & ~(psize - 1)) >> PAGE_SHIFT; | 242 | return ((ptel & HPTE_R_RPN) & ~(psize - 1)) >> PAGE_SHIFT; |
diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h index 807014dde821..c2b4dcf23d03 100644 --- a/arch/powerpc/include/asm/mmu-hash64.h +++ b/arch/powerpc/include/asm/mmu-hash64.h | |||
@@ -22,6 +22,7 @@ | |||
22 | */ | 22 | */ |
23 | #include <asm/pgtable-ppc64.h> | 23 | #include <asm/pgtable-ppc64.h> |
24 | #include <asm/bug.h> | 24 | #include <asm/bug.h> |
25 | #include <asm/processor.h> | ||
25 | 26 | ||
26 | /* | 27 | /* |
27 | * Segment table | 28 | * Segment table |
@@ -496,7 +497,7 @@ extern void slb_set_size(u16 size); | |||
496 | */ | 497 | */ |
497 | struct subpage_prot_table { | 498 | struct subpage_prot_table { |
498 | unsigned long maxaddr; /* only addresses < this are protected */ | 499 | unsigned long maxaddr; /* only addresses < this are protected */ |
499 | unsigned int **protptrs[2]; | 500 | unsigned int **protptrs[(TASK_SIZE_USER64 >> 43)]; |
500 | unsigned int *low_prot[4]; | 501 | unsigned int *low_prot[4]; |
501 | }; | 502 | }; |
502 | 503 | ||
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h index 9ea266eae33e..7e4612528546 100644 --- a/arch/powerpc/include/asm/ppc_asm.h +++ b/arch/powerpc/include/asm/ppc_asm.h | |||
@@ -277,6 +277,8 @@ n: | |||
277 | .globl n; \ | 277 | .globl n; \ |
278 | n: | 278 | n: |
279 | 279 | ||
280 | #define _GLOBAL_TOC(name) _GLOBAL(name) | ||
281 | |||
280 | #define _KPROBE(n) \ | 282 | #define _KPROBE(n) \ |
281 | .section ".kprobes.text","a"; \ | 283 | .section ".kprobes.text","a"; \ |
282 | .globl n; \ | 284 | .globl n; \ |
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index 965291b4c2fa..0c157642c2a1 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c | |||
@@ -527,6 +527,26 @@ static struct cpu_spec __initdata cpu_specs[] = { | |||
527 | .machine_check_early = __machine_check_early_realmode_p8, | 527 | .machine_check_early = __machine_check_early_realmode_p8, |
528 | .platform = "power8", | 528 | .platform = "power8", |
529 | }, | 529 | }, |
530 | { /* Power8 DD1: Does not support doorbell IPIs */ | ||
531 | .pvr_mask = 0xffffff00, | ||
532 | .pvr_value = 0x004d0100, | ||
533 | .cpu_name = "POWER8 (raw)", | ||
534 | .cpu_features = CPU_FTRS_POWER8_DD1, | ||
535 | .cpu_user_features = COMMON_USER_POWER8, | ||
536 | .cpu_user_features2 = COMMON_USER2_POWER8, | ||
537 | .mmu_features = MMU_FTRS_POWER8, | ||
538 | .icache_bsize = 128, | ||
539 | .dcache_bsize = 128, | ||
540 | .num_pmcs = 6, | ||
541 | .pmc_type = PPC_PMC_IBM, | ||
542 | .oprofile_cpu_type = "ppc64/power8", | ||
543 | .oprofile_type = PPC_OPROFILE_INVALID, | ||
544 | .cpu_setup = __setup_cpu_power8, | ||
545 | .cpu_restore = __restore_cpu_power8, | ||
546 | .flush_tlb = __flush_tlb_power8, | ||
547 | .machine_check_early = __machine_check_early_realmode_p8, | ||
548 | .platform = "power8", | ||
549 | }, | ||
530 | { /* Power8 */ | 550 | { /* Power8 */ |
531 | .pvr_mask = 0xffff0000, | 551 | .pvr_mask = 0xffff0000, |
532 | .pvr_value = 0x004d0000, | 552 | .pvr_value = 0x004d0000, |
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c index 658e89d2025b..db2b482af658 100644 --- a/arch/powerpc/kernel/rtas_flash.c +++ b/arch/powerpc/kernel/rtas_flash.c | |||
@@ -611,17 +611,19 @@ static void rtas_flash_firmware(int reboot_type) | |||
611 | for (f = flist; f; f = next) { | 611 | for (f = flist; f; f = next) { |
612 | /* Translate data addrs to absolute */ | 612 | /* Translate data addrs to absolute */ |
613 | for (i = 0; i < f->num_blocks; i++) { | 613 | for (i = 0; i < f->num_blocks; i++) { |
614 | f->blocks[i].data = (char *)__pa(f->blocks[i].data); | 614 | f->blocks[i].data = (char *)cpu_to_be64(__pa(f->blocks[i].data)); |
615 | image_size += f->blocks[i].length; | 615 | image_size += f->blocks[i].length; |
616 | f->blocks[i].length = cpu_to_be64(f->blocks[i].length); | ||
616 | } | 617 | } |
617 | next = f->next; | 618 | next = f->next; |
618 | /* Don't translate NULL pointer for last entry */ | 619 | /* Don't translate NULL pointer for last entry */ |
619 | if (f->next) | 620 | if (f->next) |
620 | f->next = (struct flash_block_list *)__pa(f->next); | 621 | f->next = (struct flash_block_list *)cpu_to_be64(__pa(f->next)); |
621 | else | 622 | else |
622 | f->next = NULL; | 623 | f->next = NULL; |
623 | /* make num_blocks into the version/length field */ | 624 | /* make num_blocks into the version/length field */ |
624 | f->num_blocks = (FLASH_BLOCK_LIST_VERSION << 56) | ((f->num_blocks+1)*16); | 625 | f->num_blocks = (FLASH_BLOCK_LIST_VERSION << 56) | ((f->num_blocks+1)*16); |
626 | f->num_blocks = cpu_to_be64(f->num_blocks); | ||
625 | } | 627 | } |
626 | 628 | ||
627 | printk(KERN_ALERT "FLASH: flash image is %ld bytes\n", image_size); | 629 | printk(KERN_ALERT "FLASH: flash image is %ld bytes\n", image_size); |
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 51a3ff78838a..1007fb802e6b 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c | |||
@@ -747,7 +747,7 @@ int setup_profiling_timer(unsigned int multiplier) | |||
747 | 747 | ||
748 | #ifdef CONFIG_SCHED_SMT | 748 | #ifdef CONFIG_SCHED_SMT |
749 | /* cpumask of CPUs with asymetric SMT dependancy */ | 749 | /* cpumask of CPUs with asymetric SMT dependancy */ |
750 | static const int powerpc_smt_flags(void) | 750 | static int powerpc_smt_flags(void) |
751 | { | 751 | { |
752 | int flags = SD_SHARE_CPUCAPACITY | SD_SHARE_PKG_RESOURCES; | 752 | int flags = SD_SHARE_CPUCAPACITY | SD_SHARE_PKG_RESOURCES; |
753 | 753 | ||
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c index 80561074078d..68468d695f12 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c | |||
@@ -1562,7 +1562,7 @@ static ssize_t kvm_htab_write(struct file *file, const char __user *buf, | |||
1562 | goto out; | 1562 | goto out; |
1563 | } | 1563 | } |
1564 | if (!rma_setup && is_vrma_hpte(v)) { | 1564 | if (!rma_setup && is_vrma_hpte(v)) { |
1565 | unsigned long psize = hpte_page_size(v, r); | 1565 | unsigned long psize = hpte_base_page_size(v, r); |
1566 | unsigned long senc = slb_pgsize_encoding(psize); | 1566 | unsigned long senc = slb_pgsize_encoding(psize); |
1567 | unsigned long lpcr; | 1567 | unsigned long lpcr; |
1568 | 1568 | ||
diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c index 6e6224318c36..5a24d3c2b6b8 100644 --- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c +++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c | |||
@@ -814,13 +814,10 @@ long kvmppc_hv_find_lock_hpte(struct kvm *kvm, gva_t eaddr, unsigned long slb_v, | |||
814 | r = hpte[i+1]; | 814 | r = hpte[i+1]; |
815 | 815 | ||
816 | /* | 816 | /* |
817 | * Check the HPTE again, including large page size | 817 | * Check the HPTE again, including base page size |
818 | * Since we don't currently allow any MPSS (mixed | ||
819 | * page-size segment) page sizes, it is sufficient | ||
820 | * to check against the actual page size. | ||
821 | */ | 818 | */ |
822 | if ((v & valid) && (v & mask) == val && | 819 | if ((v & valid) && (v & mask) == val && |
823 | hpte_page_size(v, r) == (1ul << pshift)) | 820 | hpte_base_page_size(v, r) == (1ul << pshift)) |
824 | /* Return with the HPTE still locked */ | 821 | /* Return with the HPTE still locked */ |
825 | return (hash << 3) + (i >> 1); | 822 | return (hash << 3) + (i >> 1); |
826 | 823 | ||
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index 868347ef09fd..558a67df8126 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S | |||
@@ -48,7 +48,7 @@ | |||
48 | * | 48 | * |
49 | * LR = return address to continue at after eventually re-enabling MMU | 49 | * LR = return address to continue at after eventually re-enabling MMU |
50 | */ | 50 | */ |
51 | _GLOBAL(kvmppc_hv_entry_trampoline) | 51 | _GLOBAL_TOC(kvmppc_hv_entry_trampoline) |
52 | mflr r0 | 52 | mflr r0 |
53 | std r0, PPC_LR_STKOFF(r1) | 53 | std r0, PPC_LR_STKOFF(r1) |
54 | stdu r1, -112(r1) | 54 | stdu r1, -112(r1) |
diff --git a/arch/powerpc/kvm/book3s_interrupts.S b/arch/powerpc/kvm/book3s_interrupts.S index e2c29e381dc7..d044b8b7c69d 100644 --- a/arch/powerpc/kvm/book3s_interrupts.S +++ b/arch/powerpc/kvm/book3s_interrupts.S | |||
@@ -25,7 +25,11 @@ | |||
25 | #include <asm/exception-64s.h> | 25 | #include <asm/exception-64s.h> |
26 | 26 | ||
27 | #if defined(CONFIG_PPC_BOOK3S_64) | 27 | #if defined(CONFIG_PPC_BOOK3S_64) |
28 | #if defined(_CALL_ELF) && _CALL_ELF == 2 | ||
29 | #define FUNC(name) name | ||
30 | #else | ||
28 | #define FUNC(name) GLUE(.,name) | 31 | #define FUNC(name) GLUE(.,name) |
32 | #endif | ||
29 | #define GET_SHADOW_VCPU(reg) addi reg, r13, PACA_SVCPU | 33 | #define GET_SHADOW_VCPU(reg) addi reg, r13, PACA_SVCPU |
30 | 34 | ||
31 | #elif defined(CONFIG_PPC_BOOK3S_32) | 35 | #elif defined(CONFIG_PPC_BOOK3S_32) |
diff --git a/arch/powerpc/kvm/book3s_rmhandlers.S b/arch/powerpc/kvm/book3s_rmhandlers.S index 9eec675220e6..16c4d88ba27d 100644 --- a/arch/powerpc/kvm/book3s_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_rmhandlers.S | |||
@@ -36,7 +36,11 @@ | |||
36 | 36 | ||
37 | #if defined(CONFIG_PPC_BOOK3S_64) | 37 | #if defined(CONFIG_PPC_BOOK3S_64) |
38 | 38 | ||
39 | #if defined(_CALL_ELF) && _CALL_ELF == 2 | ||
40 | #define FUNC(name) name | ||
41 | #else | ||
39 | #define FUNC(name) GLUE(.,name) | 42 | #define FUNC(name) GLUE(.,name) |
43 | #endif | ||
40 | 44 | ||
41 | #elif defined(CONFIG_PPC_BOOK3S_32) | 45 | #elif defined(CONFIG_PPC_BOOK3S_32) |
42 | 46 | ||
@@ -146,7 +150,7 @@ kvmppc_handler_skip_ins: | |||
146 | * On entry, r4 contains the guest shadow MSR | 150 | * On entry, r4 contains the guest shadow MSR |
147 | * MSR.EE has to be 0 when calling this function | 151 | * MSR.EE has to be 0 when calling this function |
148 | */ | 152 | */ |
149 | _GLOBAL(kvmppc_entry_trampoline) | 153 | _GLOBAL_TOC(kvmppc_entry_trampoline) |
150 | mfmsr r5 | 154 | mfmsr r5 |
151 | LOAD_REG_ADDR(r7, kvmppc_handler_trampoline_enter) | 155 | LOAD_REG_ADDR(r7, kvmppc_handler_trampoline_enter) |
152 | toreal(r7) | 156 | toreal(r7) |
diff --git a/arch/powerpc/kvm/book3s_rtas.c b/arch/powerpc/kvm/book3s_rtas.c index edb14ba992b3..ef27fbd5d9c5 100644 --- a/arch/powerpc/kvm/book3s_rtas.c +++ b/arch/powerpc/kvm/book3s_rtas.c | |||
@@ -23,20 +23,20 @@ static void kvm_rtas_set_xive(struct kvm_vcpu *vcpu, struct rtas_args *args) | |||
23 | u32 irq, server, priority; | 23 | u32 irq, server, priority; |
24 | int rc; | 24 | int rc; |
25 | 25 | ||
26 | if (args->nargs != 3 || args->nret != 1) { | 26 | if (be32_to_cpu(args->nargs) != 3 || be32_to_cpu(args->nret) != 1) { |
27 | rc = -3; | 27 | rc = -3; |
28 | goto out; | 28 | goto out; |
29 | } | 29 | } |
30 | 30 | ||
31 | irq = args->args[0]; | 31 | irq = be32_to_cpu(args->args[0]); |
32 | server = args->args[1]; | 32 | server = be32_to_cpu(args->args[1]); |
33 | priority = args->args[2]; | 33 | priority = be32_to_cpu(args->args[2]); |
34 | 34 | ||
35 | rc = kvmppc_xics_set_xive(vcpu->kvm, irq, server, priority); | 35 | rc = kvmppc_xics_set_xive(vcpu->kvm, irq, server, priority); |
36 | if (rc) | 36 | if (rc) |
37 | rc = -3; | 37 | rc = -3; |
38 | out: | 38 | out: |
39 | args->rets[0] = rc; | 39 | args->rets[0] = cpu_to_be32(rc); |
40 | } | 40 | } |
41 | 41 | ||
42 | static void kvm_rtas_get_xive(struct kvm_vcpu *vcpu, struct rtas_args *args) | 42 | static void kvm_rtas_get_xive(struct kvm_vcpu *vcpu, struct rtas_args *args) |
@@ -44,12 +44,12 @@ static void kvm_rtas_get_xive(struct kvm_vcpu *vcpu, struct rtas_args *args) | |||
44 | u32 irq, server, priority; | 44 | u32 irq, server, priority; |
45 | int rc; | 45 | int rc; |
46 | 46 | ||
47 | if (args->nargs != 1 || args->nret != 3) { | 47 | if (be32_to_cpu(args->nargs) != 1 || be32_to_cpu(args->nret) != 3) { |
48 | rc = -3; | 48 | rc = -3; |
49 | goto out; | 49 | goto out; |
50 | } | 50 | } |
51 | 51 | ||
52 | irq = args->args[0]; | 52 | irq = be32_to_cpu(args->args[0]); |
53 | 53 | ||
54 | server = priority = 0; | 54 | server = priority = 0; |
55 | rc = kvmppc_xics_get_xive(vcpu->kvm, irq, &server, &priority); | 55 | rc = kvmppc_xics_get_xive(vcpu->kvm, irq, &server, &priority); |
@@ -58,10 +58,10 @@ static void kvm_rtas_get_xive(struct kvm_vcpu *vcpu, struct rtas_args *args) | |||
58 | goto out; | 58 | goto out; |
59 | } | 59 | } |
60 | 60 | ||
61 | args->rets[1] = server; | 61 | args->rets[1] = cpu_to_be32(server); |
62 | args->rets[2] = priority; | 62 | args->rets[2] = cpu_to_be32(priority); |
63 | out: | 63 | out: |
64 | args->rets[0] = rc; | 64 | args->rets[0] = cpu_to_be32(rc); |
65 | } | 65 | } |
66 | 66 | ||
67 | static void kvm_rtas_int_off(struct kvm_vcpu *vcpu, struct rtas_args *args) | 67 | static void kvm_rtas_int_off(struct kvm_vcpu *vcpu, struct rtas_args *args) |
@@ -69,18 +69,18 @@ static void kvm_rtas_int_off(struct kvm_vcpu *vcpu, struct rtas_args *args) | |||
69 | u32 irq; | 69 | u32 irq; |
70 | int rc; | 70 | int rc; |
71 | 71 | ||
72 | if (args->nargs != 1 || args->nret != 1) { | 72 | if (be32_to_cpu(args->nargs) != 1 || be32_to_cpu(args->nret) != 1) { |
73 | rc = -3; | 73 | rc = -3; |
74 | goto out; | 74 | goto out; |
75 | } | 75 | } |
76 | 76 | ||
77 | irq = args->args[0]; | 77 | irq = be32_to_cpu(args->args[0]); |
78 | 78 | ||
79 | rc = kvmppc_xics_int_off(vcpu->kvm, irq); | 79 | rc = kvmppc_xics_int_off(vcpu->kvm, irq); |
80 | if (rc) | 80 | if (rc) |
81 | rc = -3; | 81 | rc = -3; |
82 | out: | 82 | out: |
83 | args->rets[0] = rc; | 83 | args->rets[0] = cpu_to_be32(rc); |
84 | } | 84 | } |
85 | 85 | ||
86 | static void kvm_rtas_int_on(struct kvm_vcpu *vcpu, struct rtas_args *args) | 86 | static void kvm_rtas_int_on(struct kvm_vcpu *vcpu, struct rtas_args *args) |
@@ -88,18 +88,18 @@ static void kvm_rtas_int_on(struct kvm_vcpu *vcpu, struct rtas_args *args) | |||
88 | u32 irq; | 88 | u32 irq; |
89 | int rc; | 89 | int rc; |
90 | 90 | ||
91 | if (args->nargs != 1 || args->nret != 1) { | 91 | if (be32_to_cpu(args->nargs) != 1 || be32_to_cpu(args->nret) != 1) { |
92 | rc = -3; | 92 | rc = -3; |
93 | goto out; | 93 | goto out; |
94 | } | 94 | } |
95 | 95 | ||
96 | irq = args->args[0]; | 96 | irq = be32_to_cpu(args->args[0]); |
97 | 97 | ||
98 | rc = kvmppc_xics_int_on(vcpu->kvm, irq); | 98 | rc = kvmppc_xics_int_on(vcpu->kvm, irq); |
99 | if (rc) | 99 | if (rc) |
100 | rc = -3; | 100 | rc = -3; |
101 | out: | 101 | out: |
102 | args->rets[0] = rc; | 102 | args->rets[0] = cpu_to_be32(rc); |
103 | } | 103 | } |
104 | #endif /* CONFIG_KVM_XICS */ | 104 | #endif /* CONFIG_KVM_XICS */ |
105 | 105 | ||
@@ -205,32 +205,6 @@ int kvm_vm_ioctl_rtas_define_token(struct kvm *kvm, void __user *argp) | |||
205 | return rc; | 205 | return rc; |
206 | } | 206 | } |
207 | 207 | ||
208 | static void kvmppc_rtas_swap_endian_in(struct rtas_args *args) | ||
209 | { | ||
210 | #ifdef __LITTLE_ENDIAN__ | ||
211 | int i; | ||
212 | |||
213 | args->token = be32_to_cpu(args->token); | ||
214 | args->nargs = be32_to_cpu(args->nargs); | ||
215 | args->nret = be32_to_cpu(args->nret); | ||
216 | for (i = 0; i < args->nargs; i++) | ||
217 | args->args[i] = be32_to_cpu(args->args[i]); | ||
218 | #endif | ||
219 | } | ||
220 | |||
221 | static void kvmppc_rtas_swap_endian_out(struct rtas_args *args) | ||
222 | { | ||
223 | #ifdef __LITTLE_ENDIAN__ | ||
224 | int i; | ||
225 | |||
226 | for (i = 0; i < args->nret; i++) | ||
227 | args->args[i] = cpu_to_be32(args->args[i]); | ||
228 | args->token = cpu_to_be32(args->token); | ||
229 | args->nargs = cpu_to_be32(args->nargs); | ||
230 | args->nret = cpu_to_be32(args->nret); | ||
231 | #endif | ||
232 | } | ||
233 | |||
234 | int kvmppc_rtas_hcall(struct kvm_vcpu *vcpu) | 208 | int kvmppc_rtas_hcall(struct kvm_vcpu *vcpu) |
235 | { | 209 | { |
236 | struct rtas_token_definition *d; | 210 | struct rtas_token_definition *d; |
@@ -249,8 +223,6 @@ int kvmppc_rtas_hcall(struct kvm_vcpu *vcpu) | |||
249 | if (rc) | 223 | if (rc) |
250 | goto fail; | 224 | goto fail; |
251 | 225 | ||
252 | kvmppc_rtas_swap_endian_in(&args); | ||
253 | |||
254 | /* | 226 | /* |
255 | * args->rets is a pointer into args->args. Now that we've | 227 | * args->rets is a pointer into args->args. Now that we've |
256 | * copied args we need to fix it up to point into our copy, | 228 | * copied args we need to fix it up to point into our copy, |
@@ -258,13 +230,13 @@ int kvmppc_rtas_hcall(struct kvm_vcpu *vcpu) | |||
258 | * value so we can restore it on the way out. | 230 | * value so we can restore it on the way out. |
259 | */ | 231 | */ |
260 | orig_rets = args.rets; | 232 | orig_rets = args.rets; |
261 | args.rets = &args.args[args.nargs]; | 233 | args.rets = &args.args[be32_to_cpu(args.nargs)]; |
262 | 234 | ||
263 | mutex_lock(&vcpu->kvm->lock); | 235 | mutex_lock(&vcpu->kvm->lock); |
264 | 236 | ||
265 | rc = -ENOENT; | 237 | rc = -ENOENT; |
266 | list_for_each_entry(d, &vcpu->kvm->arch.rtas_tokens, list) { | 238 | list_for_each_entry(d, &vcpu->kvm->arch.rtas_tokens, list) { |
267 | if (d->token == args.token) { | 239 | if (d->token == be32_to_cpu(args.token)) { |
268 | d->handler->handler(vcpu, &args); | 240 | d->handler->handler(vcpu, &args); |
269 | rc = 0; | 241 | rc = 0; |
270 | break; | 242 | break; |
@@ -275,7 +247,6 @@ int kvmppc_rtas_hcall(struct kvm_vcpu *vcpu) | |||
275 | 247 | ||
276 | if (rc == 0) { | 248 | if (rc == 0) { |
277 | args.rets = orig_rets; | 249 | args.rets = orig_rets; |
278 | kvmppc_rtas_swap_endian_out(&args); | ||
279 | rc = kvm_write_guest(vcpu->kvm, args_phys, &args, sizeof(args)); | 250 | rc = kvm_write_guest(vcpu->kvm, args_phys, &args, sizeof(args)); |
280 | if (rc) | 251 | if (rc) |
281 | goto fail; | 252 | goto fail; |
diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c index dd2cc03f406f..86903d3f5a03 100644 --- a/arch/powerpc/kvm/e500_mmu_host.c +++ b/arch/powerpc/kvm/e500_mmu_host.c | |||
@@ -473,7 +473,8 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500, | |||
473 | if (printk_ratelimit()) | 473 | if (printk_ratelimit()) |
474 | pr_err("%s: pte not present: gfn %lx, pfn %lx\n", | 474 | pr_err("%s: pte not present: gfn %lx, pfn %lx\n", |
475 | __func__, (long)gfn, pfn); | 475 | __func__, (long)gfn, pfn); |
476 | return -EINVAL; | 476 | ret = -EINVAL; |
477 | goto out; | ||
477 | } | 478 | } |
478 | kvmppc_e500_ref_setup(ref, gtlbe, pfn, wimg); | 479 | kvmppc_e500_ref_setup(ref, gtlbe, pfn, wimg); |
479 | 480 | ||
diff --git a/arch/powerpc/lib/mem_64.S b/arch/powerpc/lib/mem_64.S index 0738f96befbf..43435c6892fb 100644 --- a/arch/powerpc/lib/mem_64.S +++ b/arch/powerpc/lib/mem_64.S | |||
@@ -77,7 +77,7 @@ _GLOBAL(memset) | |||
77 | stb r4,0(r6) | 77 | stb r4,0(r6) |
78 | blr | 78 | blr |
79 | 79 | ||
80 | _GLOBAL(memmove) | 80 | _GLOBAL_TOC(memmove) |
81 | cmplw 0,r3,r4 | 81 | cmplw 0,r3,r4 |
82 | bgt backwards_memcpy | 82 | bgt backwards_memcpy |
83 | b memcpy | 83 | b memcpy |
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c index 412dd46dd0b7..5c09f365c842 100644 --- a/arch/powerpc/lib/sstep.c +++ b/arch/powerpc/lib/sstep.c | |||
@@ -1198,7 +1198,7 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) | |||
1198 | sh = regs->gpr[rb] & 0x3f; | 1198 | sh = regs->gpr[rb] & 0x3f; |
1199 | ival = (signed int) regs->gpr[rd]; | 1199 | ival = (signed int) regs->gpr[rd]; |
1200 | regs->gpr[ra] = ival >> (sh < 32 ? sh : 31); | 1200 | regs->gpr[ra] = ival >> (sh < 32 ? sh : 31); |
1201 | if (ival < 0 && (sh >= 32 || (ival & ((1 << sh) - 1)) != 0)) | 1201 | if (ival < 0 && (sh >= 32 || (ival & ((1ul << sh) - 1)) != 0)) |
1202 | regs->xer |= XER_CA; | 1202 | regs->xer |= XER_CA; |
1203 | else | 1203 | else |
1204 | regs->xer &= ~XER_CA; | 1204 | regs->xer &= ~XER_CA; |
@@ -1208,7 +1208,7 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) | |||
1208 | sh = rb; | 1208 | sh = rb; |
1209 | ival = (signed int) regs->gpr[rd]; | 1209 | ival = (signed int) regs->gpr[rd]; |
1210 | regs->gpr[ra] = ival >> sh; | 1210 | regs->gpr[ra] = ival >> sh; |
1211 | if (ival < 0 && (ival & ((1 << sh) - 1)) != 0) | 1211 | if (ival < 0 && (ival & ((1ul << sh) - 1)) != 0) |
1212 | regs->xer |= XER_CA; | 1212 | regs->xer |= XER_CA; |
1213 | else | 1213 | else |
1214 | regs->xer &= ~XER_CA; | 1214 | regs->xer &= ~XER_CA; |
@@ -1216,7 +1216,7 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) | |||
1216 | 1216 | ||
1217 | #ifdef __powerpc64__ | 1217 | #ifdef __powerpc64__ |
1218 | case 27: /* sld */ | 1218 | case 27: /* sld */ |
1219 | sh = regs->gpr[rd] & 0x7f; | 1219 | sh = regs->gpr[rb] & 0x7f; |
1220 | if (sh < 64) | 1220 | if (sh < 64) |
1221 | regs->gpr[ra] = regs->gpr[rd] << sh; | 1221 | regs->gpr[ra] = regs->gpr[rd] << sh; |
1222 | else | 1222 | else |
@@ -1235,7 +1235,7 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) | |||
1235 | sh = regs->gpr[rb] & 0x7f; | 1235 | sh = regs->gpr[rb] & 0x7f; |
1236 | ival = (signed long int) regs->gpr[rd]; | 1236 | ival = (signed long int) regs->gpr[rd]; |
1237 | regs->gpr[ra] = ival >> (sh < 64 ? sh : 63); | 1237 | regs->gpr[ra] = ival >> (sh < 64 ? sh : 63); |
1238 | if (ival < 0 && (sh >= 64 || (ival & ((1 << sh) - 1)) != 0)) | 1238 | if (ival < 0 && (sh >= 64 || (ival & ((1ul << sh) - 1)) != 0)) |
1239 | regs->xer |= XER_CA; | 1239 | regs->xer |= XER_CA; |
1240 | else | 1240 | else |
1241 | regs->xer &= ~XER_CA; | 1241 | regs->xer &= ~XER_CA; |
@@ -1246,7 +1246,7 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) | |||
1246 | sh = rb | ((instr & 2) << 4); | 1246 | sh = rb | ((instr & 2) << 4); |
1247 | ival = (signed long int) regs->gpr[rd]; | 1247 | ival = (signed long int) regs->gpr[rd]; |
1248 | regs->gpr[ra] = ival >> sh; | 1248 | regs->gpr[ra] = ival >> sh; |
1249 | if (ival < 0 && (ival & ((1 << sh) - 1)) != 0) | 1249 | if (ival < 0 && (ival & ((1ul << sh) - 1)) != 0) |
1250 | regs->xer |= XER_CA; | 1250 | regs->xer |= XER_CA; |
1251 | else | 1251 | else |
1252 | regs->xer &= ~XER_CA; | 1252 | regs->xer &= ~XER_CA; |
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c index 6dcdadefd8d0..82e82cadcde5 100644 --- a/arch/powerpc/net/bpf_jit_comp.c +++ b/arch/powerpc/net/bpf_jit_comp.c | |||
@@ -390,12 +390,16 @@ static int bpf_jit_build_body(struct sk_filter *fp, u32 *image, | |||
390 | case BPF_ANC | SKF_AD_VLAN_TAG: | 390 | case BPF_ANC | SKF_AD_VLAN_TAG: |
391 | case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT: | 391 | case BPF_ANC | SKF_AD_VLAN_TAG_PRESENT: |
392 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2); | 392 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, vlan_tci) != 2); |
393 | BUILD_BUG_ON(VLAN_TAG_PRESENT != 0x1000); | ||
394 | |||
393 | PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff, | 395 | PPC_LHZ_OFFS(r_A, r_skb, offsetof(struct sk_buff, |
394 | vlan_tci)); | 396 | vlan_tci)); |
395 | if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) | 397 | if (code == (BPF_ANC | SKF_AD_VLAN_TAG)) { |
396 | PPC_ANDI(r_A, r_A, VLAN_VID_MASK); | 398 | PPC_ANDI(r_A, r_A, ~VLAN_TAG_PRESENT); |
397 | else | 399 | } else { |
398 | PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT); | 400 | PPC_ANDI(r_A, r_A, VLAN_TAG_PRESENT); |
401 | PPC_SRWI(r_A, r_A, 12); | ||
402 | } | ||
399 | break; | 403 | break; |
400 | case BPF_ANC | SKF_AD_QUEUE: | 404 | case BPF_ANC | SKF_AD_QUEUE: |
401 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, | 405 | BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, |
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c index 6b0641c3f03f..fe52db2eea6a 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c | |||
@@ -1307,6 +1307,9 @@ static void power_pmu_enable(struct pmu *pmu) | |||
1307 | out_enable: | 1307 | out_enable: |
1308 | pmao_restore_workaround(ebb); | 1308 | pmao_restore_workaround(ebb); |
1309 | 1309 | ||
1310 | if (ppmu->flags & PPMU_ARCH_207S) | ||
1311 | mtspr(SPRN_MMCR2, 0); | ||
1312 | |||
1310 | mmcr0 = ebb_switch_in(ebb, cpuhw->mmcr[0]); | 1313 | mmcr0 = ebb_switch_in(ebb, cpuhw->mmcr[0]); |
1311 | 1314 | ||
1312 | mb(); | 1315 | mb(); |
@@ -1315,9 +1318,6 @@ static void power_pmu_enable(struct pmu *pmu) | |||
1315 | 1318 | ||
1316 | write_mmcr0(cpuhw, mmcr0); | 1319 | write_mmcr0(cpuhw, mmcr0); |
1317 | 1320 | ||
1318 | if (ppmu->flags & PPMU_ARCH_207S) | ||
1319 | mtspr(SPRN_MMCR2, 0); | ||
1320 | |||
1321 | /* | 1321 | /* |
1322 | * Enable instruction sampling if necessary | 1322 | * Enable instruction sampling if necessary |
1323 | */ | 1323 | */ |
diff --git a/arch/powerpc/platforms/powernv/opal-elog.c b/arch/powerpc/platforms/powernv/opal-elog.c index 10268c41d830..0ad533b617f7 100644 --- a/arch/powerpc/platforms/powernv/opal-elog.c +++ b/arch/powerpc/platforms/powernv/opal-elog.c | |||
@@ -249,7 +249,7 @@ static void elog_work_fn(struct work_struct *work) | |||
249 | 249 | ||
250 | rc = opal_get_elog_size(&id, &size, &type); | 250 | rc = opal_get_elog_size(&id, &size, &type); |
251 | if (rc != OPAL_SUCCESS) { | 251 | if (rc != OPAL_SUCCESS) { |
252 | pr_err("ELOG: Opal log read failed\n"); | 252 | pr_err("ELOG: OPAL log info read failed\n"); |
253 | return; | 253 | return; |
254 | } | 254 | } |
255 | 255 | ||
@@ -257,7 +257,7 @@ static void elog_work_fn(struct work_struct *work) | |||
257 | log_id = be64_to_cpu(id); | 257 | log_id = be64_to_cpu(id); |
258 | elog_type = be64_to_cpu(type); | 258 | elog_type = be64_to_cpu(type); |
259 | 259 | ||
260 | BUG_ON(elog_size > OPAL_MAX_ERRLOG_SIZE); | 260 | WARN_ON(elog_size > OPAL_MAX_ERRLOG_SIZE); |
261 | 261 | ||
262 | if (elog_size >= OPAL_MAX_ERRLOG_SIZE) | 262 | if (elog_size >= OPAL_MAX_ERRLOG_SIZE) |
263 | elog_size = OPAL_MAX_ERRLOG_SIZE; | 263 | elog_size = OPAL_MAX_ERRLOG_SIZE; |
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c index 022b38e6a80b..2d0b4d68a40a 100644 --- a/arch/powerpc/platforms/pseries/dlpar.c +++ b/arch/powerpc/platforms/pseries/dlpar.c | |||
@@ -86,6 +86,7 @@ static struct device_node *dlpar_parse_cc_node(struct cc_workarea *ccwa, | |||
86 | } | 86 | } |
87 | 87 | ||
88 | of_node_set_flag(dn, OF_DYNAMIC); | 88 | of_node_set_flag(dn, OF_DYNAMIC); |
89 | of_node_init(dn); | ||
89 | 90 | ||
90 | return dn; | 91 | return dn; |
91 | } | 92 | } |
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c index 0435bb65d0aa..1c0a60d98867 100644 --- a/arch/powerpc/platforms/pseries/reconfig.c +++ b/arch/powerpc/platforms/pseries/reconfig.c | |||
@@ -69,6 +69,7 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist | |||
69 | 69 | ||
70 | np->properties = proplist; | 70 | np->properties = proplist; |
71 | of_node_set_flag(np, OF_DYNAMIC); | 71 | of_node_set_flag(np, OF_DYNAMIC); |
72 | of_node_init(np); | ||
72 | 73 | ||
73 | np->parent = derive_parent(path); | 74 | np->parent = derive_parent(path); |
74 | if (IS_ERR(np->parent)) { | 75 | if (IS_ERR(np->parent)) { |
diff --git a/arch/s390/include/asm/switch_to.h b/arch/s390/include/asm/switch_to.h index df38c70cd59e..18ea9e3f8142 100644 --- a/arch/s390/include/asm/switch_to.h +++ b/arch/s390/include/asm/switch_to.h | |||
@@ -51,8 +51,8 @@ static inline int restore_fp_ctl(u32 *fpc) | |||
51 | return 0; | 51 | return 0; |
52 | 52 | ||
53 | asm volatile( | 53 | asm volatile( |
54 | "0: lfpc %1\n" | 54 | " lfpc %1\n" |
55 | " la %0,0\n" | 55 | "0: la %0,0\n" |
56 | "1:\n" | 56 | "1:\n" |
57 | EX_TABLE(0b,1b) | 57 | EX_TABLE(0b,1b) |
58 | : "=d" (rc) : "Q" (*fpc), "0" (-EINVAL)); | 58 | : "=d" (rc) : "Q" (*fpc), "0" (-EINVAL)); |
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S index 7ba7d6784510..e88d35d74950 100644 --- a/arch/s390/kernel/head.S +++ b/arch/s390/kernel/head.S | |||
@@ -437,11 +437,11 @@ ENTRY(startup_kdump) | |||
437 | 437 | ||
438 | #if defined(CONFIG_64BIT) | 438 | #if defined(CONFIG_64BIT) |
439 | #if defined(CONFIG_MARCH_ZEC12) | 439 | #if defined(CONFIG_MARCH_ZEC12) |
440 | .long 3, 0xc100efea, 0xf46ce800, 0x00400000 | 440 | .long 3, 0xc100eff2, 0xf46ce800, 0x00400000 |
441 | #elif defined(CONFIG_MARCH_Z196) | 441 | #elif defined(CONFIG_MARCH_Z196) |
442 | .long 2, 0xc100efea, 0xf46c0000 | 442 | .long 2, 0xc100eff2, 0xf46c0000 |
443 | #elif defined(CONFIG_MARCH_Z10) | 443 | #elif defined(CONFIG_MARCH_Z10) |
444 | .long 2, 0xc100efea, 0xf0680000 | 444 | .long 2, 0xc100eff2, 0xf0680000 |
445 | #elif defined(CONFIG_MARCH_Z9_109) | 445 | #elif defined(CONFIG_MARCH_Z9_109) |
446 | .long 1, 0xc100efc2 | 446 | .long 1, 0xc100efc2 |
447 | #elif defined(CONFIG_MARCH_Z990) | 447 | #elif defined(CONFIG_MARCH_Z990) |
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index 2d716734b5b1..5dc7ad9e2fbf 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c | |||
@@ -334,9 +334,14 @@ static int __poke_user(struct task_struct *child, addr_t addr, addr_t data) | |||
334 | unsigned long mask = PSW_MASK_USER; | 334 | unsigned long mask = PSW_MASK_USER; |
335 | 335 | ||
336 | mask |= is_ri_task(child) ? PSW_MASK_RI : 0; | 336 | mask |= is_ri_task(child) ? PSW_MASK_RI : 0; |
337 | if ((data & ~mask) != PSW_USER_BITS) | 337 | if ((data ^ PSW_USER_BITS) & ~mask) |
338 | /* Invalid psw mask. */ | ||
339 | return -EINVAL; | ||
340 | if ((data & PSW_MASK_ASC) == PSW_ASC_HOME) | ||
341 | /* Invalid address-space-control bits */ | ||
338 | return -EINVAL; | 342 | return -EINVAL; |
339 | if ((data & PSW_MASK_EA) && !(data & PSW_MASK_BA)) | 343 | if ((data & PSW_MASK_EA) && !(data & PSW_MASK_BA)) |
344 | /* Invalid addressing mode bits */ | ||
340 | return -EINVAL; | 345 | return -EINVAL; |
341 | } | 346 | } |
342 | *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data; | 347 | *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data; |
@@ -672,9 +677,12 @@ static int __poke_user_compat(struct task_struct *child, | |||
672 | 677 | ||
673 | mask |= is_ri_task(child) ? PSW32_MASK_RI : 0; | 678 | mask |= is_ri_task(child) ? PSW32_MASK_RI : 0; |
674 | /* Build a 64 bit psw mask from 31 bit mask. */ | 679 | /* Build a 64 bit psw mask from 31 bit mask. */ |
675 | if ((tmp & ~mask) != PSW32_USER_BITS) | 680 | if ((tmp ^ PSW32_USER_BITS) & ~mask) |
676 | /* Invalid psw mask. */ | 681 | /* Invalid psw mask. */ |
677 | return -EINVAL; | 682 | return -EINVAL; |
683 | if ((data & PSW32_MASK_ASC) == PSW32_ASC_HOME) | ||
684 | /* Invalid address-space-control bits */ | ||
685 | return -EINVAL; | ||
678 | regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) | | 686 | regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) | |
679 | (regs->psw.mask & PSW_MASK_BA) | | 687 | (regs->psw.mask & PSW_MASK_BA) | |
680 | (__u64)(tmp & mask) << 32; | 688 | (__u64)(tmp & mask) << 32; |
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index 9ddc51eeb8d6..30de42730b2f 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c | |||
@@ -48,13 +48,10 @@ | |||
48 | static LIST_HEAD(zpci_list); | 48 | static LIST_HEAD(zpci_list); |
49 | static DEFINE_SPINLOCK(zpci_list_lock); | 49 | static DEFINE_SPINLOCK(zpci_list_lock); |
50 | 50 | ||
51 | static void zpci_enable_irq(struct irq_data *data); | ||
52 | static void zpci_disable_irq(struct irq_data *data); | ||
53 | |||
54 | static struct irq_chip zpci_irq_chip = { | 51 | static struct irq_chip zpci_irq_chip = { |
55 | .name = "zPCI", | 52 | .name = "zPCI", |
56 | .irq_unmask = zpci_enable_irq, | 53 | .irq_unmask = unmask_msi_irq, |
57 | .irq_mask = zpci_disable_irq, | 54 | .irq_mask = mask_msi_irq, |
58 | }; | 55 | }; |
59 | 56 | ||
60 | static DECLARE_BITMAP(zpci_domain, ZPCI_NR_DEVICES); | 57 | static DECLARE_BITMAP(zpci_domain, ZPCI_NR_DEVICES); |
@@ -244,43 +241,6 @@ static int zpci_cfg_store(struct zpci_dev *zdev, int offset, u32 val, u8 len) | |||
244 | return rc; | 241 | return rc; |
245 | } | 242 | } |
246 | 243 | ||
247 | static int zpci_msi_set_mask_bits(struct msi_desc *msi, u32 mask, u32 flag) | ||
248 | { | ||
249 | int offset, pos; | ||
250 | u32 mask_bits; | ||
251 | |||
252 | if (msi->msi_attrib.is_msix) { | ||
253 | offset = msi->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + | ||
254 | PCI_MSIX_ENTRY_VECTOR_CTRL; | ||
255 | msi->masked = readl(msi->mask_base + offset); | ||
256 | writel(flag, msi->mask_base + offset); | ||
257 | } else if (msi->msi_attrib.maskbit) { | ||
258 | pos = (long) msi->mask_base; | ||
259 | pci_read_config_dword(msi->dev, pos, &mask_bits); | ||
260 | mask_bits &= ~(mask); | ||
261 | mask_bits |= flag & mask; | ||
262 | pci_write_config_dword(msi->dev, pos, mask_bits); | ||
263 | } else | ||
264 | return 0; | ||
265 | |||
266 | msi->msi_attrib.maskbit = !!flag; | ||
267 | return 1; | ||
268 | } | ||
269 | |||
270 | static void zpci_enable_irq(struct irq_data *data) | ||
271 | { | ||
272 | struct msi_desc *msi = irq_get_msi_desc(data->irq); | ||
273 | |||
274 | zpci_msi_set_mask_bits(msi, 1, 0); | ||
275 | } | ||
276 | |||
277 | static void zpci_disable_irq(struct irq_data *data) | ||
278 | { | ||
279 | struct msi_desc *msi = irq_get_msi_desc(data->irq); | ||
280 | |||
281 | zpci_msi_set_mask_bits(msi, 1, 1); | ||
282 | } | ||
283 | |||
284 | void pcibios_fixup_bus(struct pci_bus *bus) | 244 | void pcibios_fixup_bus(struct pci_bus *bus) |
285 | { | 245 | { |
286 | } | 246 | } |
@@ -487,7 +447,10 @@ void arch_teardown_msi_irqs(struct pci_dev *pdev) | |||
487 | 447 | ||
488 | /* Release MSI interrupts */ | 448 | /* Release MSI interrupts */ |
489 | list_for_each_entry(msi, &pdev->msi_list, list) { | 449 | list_for_each_entry(msi, &pdev->msi_list, list) { |
490 | zpci_msi_set_mask_bits(msi, 1, 1); | 450 | if (msi->msi_attrib.is_msix) |
451 | default_msix_mask_irq(msi, 1); | ||
452 | else | ||
453 | default_msi_mask_irq(msi, 1, 1); | ||
491 | irq_set_msi_desc(msi->irq, NULL); | 454 | irq_set_msi_desc(msi->irq, NULL); |
492 | irq_free_desc(msi->irq); | 455 | irq_free_desc(msi->irq); |
493 | msi->msg.address_lo = 0; | 456 | msi->msg.address_lo = 0; |
diff --git a/arch/sh/Makefile b/arch/sh/Makefile index d4d16e4be07c..bf5b3f5f4962 100644 --- a/arch/sh/Makefile +++ b/arch/sh/Makefile | |||
@@ -32,7 +32,8 @@ endif | |||
32 | 32 | ||
33 | cflags-$(CONFIG_CPU_SH2) := $(call cc-option,-m2,) | 33 | cflags-$(CONFIG_CPU_SH2) := $(call cc-option,-m2,) |
34 | cflags-$(CONFIG_CPU_SH2A) += $(call cc-option,-m2a,) \ | 34 | cflags-$(CONFIG_CPU_SH2A) += $(call cc-option,-m2a,) \ |
35 | $(call cc-option,-m2a-nofpu,) | 35 | $(call cc-option,-m2a-nofpu,) \ |
36 | $(call cc-option,-m4-nofpu,) | ||
36 | cflags-$(CONFIG_CPU_SH3) := $(call cc-option,-m3,) | 37 | cflags-$(CONFIG_CPU_SH3) := $(call cc-option,-m3,) |
37 | cflags-$(CONFIG_CPU_SH4) := $(call cc-option,-m4,) \ | 38 | cflags-$(CONFIG_CPU_SH4) := $(call cc-option,-m4,) \ |
38 | $(call cc-option,-mno-implicit-fp,-m4-nofpu) | 39 | $(call cc-option,-mno-implicit-fp,-m4-nofpu) |
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 29f2e988c56a..407c87d9879a 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
@@ -78,6 +78,7 @@ config SPARC64 | |||
78 | select HAVE_C_RECORDMCOUNT | 78 | select HAVE_C_RECORDMCOUNT |
79 | select NO_BOOTMEM | 79 | select NO_BOOTMEM |
80 | select HAVE_ARCH_AUDITSYSCALL | 80 | select HAVE_ARCH_AUDITSYSCALL |
81 | select ARCH_SUPPORTS_ATOMIC_RMW | ||
81 | 82 | ||
82 | config ARCH_DEFCONFIG | 83 | config ARCH_DEFCONFIG |
83 | string | 84 | string |
diff --git a/arch/sparc/include/uapi/asm/unistd.h b/arch/sparc/include/uapi/asm/unistd.h index b73274fb961a..42f2bca1d338 100644 --- a/arch/sparc/include/uapi/asm/unistd.h +++ b/arch/sparc/include/uapi/asm/unistd.h | |||
@@ -410,8 +410,9 @@ | |||
410 | #define __NR_finit_module 342 | 410 | #define __NR_finit_module 342 |
411 | #define __NR_sched_setattr 343 | 411 | #define __NR_sched_setattr 343 |
412 | #define __NR_sched_getattr 344 | 412 | #define __NR_sched_getattr 344 |
413 | #define __NR_renameat2 345 | ||
413 | 414 | ||
414 | #define NR_syscalls 345 | 415 | #define NR_syscalls 346 |
415 | 416 | ||
416 | /* Bitmask values returned from kern_features system call. */ | 417 | /* Bitmask values returned from kern_features system call. */ |
417 | #define KERN_FEATURE_MIXED_MODE_STACK 0x00000001 | 418 | #define KERN_FEATURE_MIXED_MODE_STACK 0x00000001 |
diff --git a/arch/sparc/kernel/sys32.S b/arch/sparc/kernel/sys32.S index d066eb18650c..f834224208ed 100644 --- a/arch/sparc/kernel/sys32.S +++ b/arch/sparc/kernel/sys32.S | |||
@@ -48,6 +48,7 @@ SIGN1(sys32_futex, compat_sys_futex, %o1) | |||
48 | SIGN1(sys32_recvfrom, compat_sys_recvfrom, %o0) | 48 | SIGN1(sys32_recvfrom, compat_sys_recvfrom, %o0) |
49 | SIGN1(sys32_recvmsg, compat_sys_recvmsg, %o0) | 49 | SIGN1(sys32_recvmsg, compat_sys_recvmsg, %o0) |
50 | SIGN1(sys32_sendmsg, compat_sys_sendmsg, %o0) | 50 | SIGN1(sys32_sendmsg, compat_sys_sendmsg, %o0) |
51 | SIGN2(sys32_renameat2, sys_renameat2, %o0, %o2) | ||
51 | 52 | ||
52 | .globl sys32_mmap2 | 53 | .globl sys32_mmap2 |
53 | sys32_mmap2: | 54 | sys32_mmap2: |
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S index 151ace8766cc..85fe9b1087cd 100644 --- a/arch/sparc/kernel/systbls_32.S +++ b/arch/sparc/kernel/systbls_32.S | |||
@@ -86,3 +86,4 @@ sys_call_table: | |||
86 | /*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime | 86 | /*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime |
87 | /*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev | 87 | /*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev |
88 | /*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr | 88 | /*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr |
89 | /*345*/ .long sys_renameat2 | ||
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S index 4bd4e2bb26cf..33ecba2826ea 100644 --- a/arch/sparc/kernel/systbls_64.S +++ b/arch/sparc/kernel/systbls_64.S | |||
@@ -87,6 +87,7 @@ sys_call_table32: | |||
87 | /*330*/ .word compat_sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime | 87 | /*330*/ .word compat_sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime |
88 | .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev | 88 | .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev |
89 | /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr | 89 | /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr |
90 | .word sys32_renameat2 | ||
90 | 91 | ||
91 | #endif /* CONFIG_COMPAT */ | 92 | #endif /* CONFIG_COMPAT */ |
92 | 93 | ||
@@ -165,3 +166,4 @@ sys_call_table: | |||
165 | /*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime | 166 | /*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime |
166 | .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev | 167 | .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev |
167 | /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr | 168 | /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr |
169 | .word sys_renameat2 | ||
diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c index 9472079471bb..f1b3eb14b855 100644 --- a/arch/um/kernel/tlb.c +++ b/arch/um/kernel/tlb.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <mem_user.h> | 12 | #include <mem_user.h> |
13 | #include <os.h> | 13 | #include <os.h> |
14 | #include <skas.h> | 14 | #include <skas.h> |
15 | #include <kern_util.h> | ||
15 | 16 | ||
16 | struct host_vm_change { | 17 | struct host_vm_change { |
17 | struct host_vm_op { | 18 | struct host_vm_op { |
@@ -124,6 +125,9 @@ static int add_munmap(unsigned long addr, unsigned long len, | |||
124 | struct host_vm_op *last; | 125 | struct host_vm_op *last; |
125 | int ret = 0; | 126 | int ret = 0; |
126 | 127 | ||
128 | if ((addr >= STUB_START) && (addr < STUB_END)) | ||
129 | return -EINVAL; | ||
130 | |||
127 | if (hvc->index != 0) { | 131 | if (hvc->index != 0) { |
128 | last = &hvc->ops[hvc->index - 1]; | 132 | last = &hvc->ops[hvc->index - 1]; |
129 | if ((last->type == MUNMAP) && | 133 | if ((last->type == MUNMAP) && |
@@ -283,8 +287,11 @@ void fix_range_common(struct mm_struct *mm, unsigned long start_addr, | |||
283 | /* This is not an else because ret is modified above */ | 287 | /* This is not an else because ret is modified above */ |
284 | if (ret) { | 288 | if (ret) { |
285 | printk(KERN_ERR "fix_range_common: failed, killing current " | 289 | printk(KERN_ERR "fix_range_common: failed, killing current " |
286 | "process\n"); | 290 | "process: %d\n", task_tgid_vnr(current)); |
291 | /* We are under mmap_sem, release it such that current can terminate */ | ||
292 | up_write(¤t->mm->mmap_sem); | ||
287 | force_sig(SIGKILL, current); | 293 | force_sig(SIGKILL, current); |
294 | do_signal(); | ||
288 | } | 295 | } |
289 | } | 296 | } |
290 | 297 | ||
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c index 974b87474a99..5678c3571e7c 100644 --- a/arch/um/kernel/trap.c +++ b/arch/um/kernel/trap.c | |||
@@ -206,7 +206,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user, | |||
206 | int is_write = FAULT_WRITE(fi); | 206 | int is_write = FAULT_WRITE(fi); |
207 | unsigned long address = FAULT_ADDRESS(fi); | 207 | unsigned long address = FAULT_ADDRESS(fi); |
208 | 208 | ||
209 | if (regs) | 209 | if (!is_user && regs) |
210 | current->thread.segv_regs = container_of(regs, struct pt_regs, regs); | 210 | current->thread.segv_regs = container_of(regs, struct pt_regs, regs); |
211 | 211 | ||
212 | if (!is_user && (address >= start_vm) && (address < end_vm)) { | 212 | if (!is_user && (address >= start_vm) && (address < end_vm)) { |
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c index d531879a4617..908579f2b0ab 100644 --- a/arch/um/os-Linux/skas/process.c +++ b/arch/um/os-Linux/skas/process.c | |||
@@ -54,7 +54,7 @@ static int ptrace_dump_regs(int pid) | |||
54 | 54 | ||
55 | void wait_stub_done(int pid) | 55 | void wait_stub_done(int pid) |
56 | { | 56 | { |
57 | int n, status, err, bad_stop = 0; | 57 | int n, status, err; |
58 | 58 | ||
59 | while (1) { | 59 | while (1) { |
60 | CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED | __WALL)); | 60 | CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED | __WALL)); |
@@ -74,8 +74,6 @@ void wait_stub_done(int pid) | |||
74 | 74 | ||
75 | if (((1 << WSTOPSIG(status)) & STUB_DONE_MASK) != 0) | 75 | if (((1 << WSTOPSIG(status)) & STUB_DONE_MASK) != 0) |
76 | return; | 76 | return; |
77 | else | ||
78 | bad_stop = 1; | ||
79 | 77 | ||
80 | bad_wait: | 78 | bad_wait: |
81 | err = ptrace_dump_regs(pid); | 79 | err = ptrace_dump_regs(pid); |
@@ -85,10 +83,7 @@ bad_wait: | |||
85 | printk(UM_KERN_ERR "wait_stub_done : failed to wait for SIGTRAP, " | 83 | printk(UM_KERN_ERR "wait_stub_done : failed to wait for SIGTRAP, " |
86 | "pid = %d, n = %d, errno = %d, status = 0x%x\n", pid, n, errno, | 84 | "pid = %d, n = %d, errno = %d, status = 0x%x\n", pid, n, errno, |
87 | status); | 85 | status); |
88 | if (bad_stop) | 86 | fatal_sigsegv(); |
89 | kill(pid, SIGKILL); | ||
90 | else | ||
91 | fatal_sigsegv(); | ||
92 | } | 87 | } |
93 | 88 | ||
94 | extern unsigned long current_stub_stack(void); | 89 | extern unsigned long current_stub_stack(void); |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index a8f749ef0fdc..d24887b645dc 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -131,6 +131,7 @@ config X86 | |||
131 | select HAVE_CC_STACKPROTECTOR | 131 | select HAVE_CC_STACKPROTECTOR |
132 | select GENERIC_CPU_AUTOPROBE | 132 | select GENERIC_CPU_AUTOPROBE |
133 | select HAVE_ARCH_AUDITSYSCALL | 133 | select HAVE_ARCH_AUDITSYSCALL |
134 | select ARCH_SUPPORTS_ATOMIC_RMW | ||
134 | 135 | ||
135 | config INSTRUCTION_DECODER | 136 | config INSTRUCTION_DECODER |
136 | def_bool y | 137 | def_bool y |
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S index 84c223479e3c..7a6d43a554d7 100644 --- a/arch/x86/boot/header.S +++ b/arch/x86/boot/header.S | |||
@@ -91,10 +91,9 @@ bs_die: | |||
91 | 91 | ||
92 | .section ".bsdata", "a" | 92 | .section ".bsdata", "a" |
93 | bugger_off_msg: | 93 | bugger_off_msg: |
94 | .ascii "Direct floppy boot is not supported. " | 94 | .ascii "Use a boot loader.\r\n" |
95 | .ascii "Use a boot loader program instead.\r\n" | ||
96 | .ascii "\n" | 95 | .ascii "\n" |
97 | .ascii "Remove disk and press any key to reboot ...\r\n" | 96 | .ascii "Remove disk and press any key to reboot...\r\n" |
98 | .byte 0 | 97 | .byte 0 |
99 | 98 | ||
100 | #ifdef CONFIG_EFI_STUB | 99 | #ifdef CONFIG_EFI_STUB |
@@ -108,7 +107,7 @@ coff_header: | |||
108 | #else | 107 | #else |
109 | .word 0x8664 # x86-64 | 108 | .word 0x8664 # x86-64 |
110 | #endif | 109 | #endif |
111 | .word 3 # nr_sections | 110 | .word 4 # nr_sections |
112 | .long 0 # TimeDateStamp | 111 | .long 0 # TimeDateStamp |
113 | .long 0 # PointerToSymbolTable | 112 | .long 0 # PointerToSymbolTable |
114 | .long 1 # NumberOfSymbols | 113 | .long 1 # NumberOfSymbols |
@@ -250,6 +249,25 @@ section_table: | |||
250 | .word 0 # NumberOfLineNumbers | 249 | .word 0 # NumberOfLineNumbers |
251 | .long 0x60500020 # Characteristics (section flags) | 250 | .long 0x60500020 # Characteristics (section flags) |
252 | 251 | ||
252 | # | ||
253 | # The offset & size fields are filled in by build.c. | ||
254 | # | ||
255 | .ascii ".bss" | ||
256 | .byte 0 | ||
257 | .byte 0 | ||
258 | .byte 0 | ||
259 | .byte 0 | ||
260 | .long 0 | ||
261 | .long 0x0 | ||
262 | .long 0 # Size of initialized data | ||
263 | # on disk | ||
264 | .long 0x0 | ||
265 | .long 0 # PointerToRelocations | ||
266 | .long 0 # PointerToLineNumbers | ||
267 | .word 0 # NumberOfRelocations | ||
268 | .word 0 # NumberOfLineNumbers | ||
269 | .long 0xc8000080 # Characteristics (section flags) | ||
270 | |||
253 | #endif /* CONFIG_EFI_STUB */ | 271 | #endif /* CONFIG_EFI_STUB */ |
254 | 272 | ||
255 | # Kernel attributes; used by setup. This is part 1 of the | 273 | # Kernel attributes; used by setup. This is part 1 of the |
diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c index 1a2f2121cada..a7661c430cd9 100644 --- a/arch/x86/boot/tools/build.c +++ b/arch/x86/boot/tools/build.c | |||
@@ -143,7 +143,7 @@ static void usage(void) | |||
143 | 143 | ||
144 | #ifdef CONFIG_EFI_STUB | 144 | #ifdef CONFIG_EFI_STUB |
145 | 145 | ||
146 | static void update_pecoff_section_header(char *section_name, u32 offset, u32 size) | 146 | static void update_pecoff_section_header_fields(char *section_name, u32 vma, u32 size, u32 datasz, u32 offset) |
147 | { | 147 | { |
148 | unsigned int pe_header; | 148 | unsigned int pe_header; |
149 | unsigned short num_sections; | 149 | unsigned short num_sections; |
@@ -164,10 +164,10 @@ static void update_pecoff_section_header(char *section_name, u32 offset, u32 siz | |||
164 | put_unaligned_le32(size, section + 0x8); | 164 | put_unaligned_le32(size, section + 0x8); |
165 | 165 | ||
166 | /* section header vma field */ | 166 | /* section header vma field */ |
167 | put_unaligned_le32(offset, section + 0xc); | 167 | put_unaligned_le32(vma, section + 0xc); |
168 | 168 | ||
169 | /* section header 'size of initialised data' field */ | 169 | /* section header 'size of initialised data' field */ |
170 | put_unaligned_le32(size, section + 0x10); | 170 | put_unaligned_le32(datasz, section + 0x10); |
171 | 171 | ||
172 | /* section header 'file offset' field */ | 172 | /* section header 'file offset' field */ |
173 | put_unaligned_le32(offset, section + 0x14); | 173 | put_unaligned_le32(offset, section + 0x14); |
@@ -179,6 +179,11 @@ static void update_pecoff_section_header(char *section_name, u32 offset, u32 siz | |||
179 | } | 179 | } |
180 | } | 180 | } |
181 | 181 | ||
182 | static void update_pecoff_section_header(char *section_name, u32 offset, u32 size) | ||
183 | { | ||
184 | update_pecoff_section_header_fields(section_name, offset, size, size, offset); | ||
185 | } | ||
186 | |||
182 | static void update_pecoff_setup_and_reloc(unsigned int size) | 187 | static void update_pecoff_setup_and_reloc(unsigned int size) |
183 | { | 188 | { |
184 | u32 setup_offset = 0x200; | 189 | u32 setup_offset = 0x200; |
@@ -203,9 +208,6 @@ static void update_pecoff_text(unsigned int text_start, unsigned int file_sz) | |||
203 | 208 | ||
204 | pe_header = get_unaligned_le32(&buf[0x3c]); | 209 | pe_header = get_unaligned_le32(&buf[0x3c]); |
205 | 210 | ||
206 | /* Size of image */ | ||
207 | put_unaligned_le32(file_sz, &buf[pe_header + 0x50]); | ||
208 | |||
209 | /* | 211 | /* |
210 | * Size of code: Subtract the size of the first sector (512 bytes) | 212 | * Size of code: Subtract the size of the first sector (512 bytes) |
211 | * which includes the header. | 213 | * which includes the header. |
@@ -220,6 +222,22 @@ static void update_pecoff_text(unsigned int text_start, unsigned int file_sz) | |||
220 | update_pecoff_section_header(".text", text_start, text_sz); | 222 | update_pecoff_section_header(".text", text_start, text_sz); |
221 | } | 223 | } |
222 | 224 | ||
225 | static void update_pecoff_bss(unsigned int file_sz, unsigned int init_sz) | ||
226 | { | ||
227 | unsigned int pe_header; | ||
228 | unsigned int bss_sz = init_sz - file_sz; | ||
229 | |||
230 | pe_header = get_unaligned_le32(&buf[0x3c]); | ||
231 | |||
232 | /* Size of uninitialized data */ | ||
233 | put_unaligned_le32(bss_sz, &buf[pe_header + 0x24]); | ||
234 | |||
235 | /* Size of image */ | ||
236 | put_unaligned_le32(init_sz, &buf[pe_header + 0x50]); | ||
237 | |||
238 | update_pecoff_section_header_fields(".bss", file_sz, bss_sz, 0, 0); | ||
239 | } | ||
240 | |||
223 | static int reserve_pecoff_reloc_section(int c) | 241 | static int reserve_pecoff_reloc_section(int c) |
224 | { | 242 | { |
225 | /* Reserve 0x20 bytes for .reloc section */ | 243 | /* Reserve 0x20 bytes for .reloc section */ |
@@ -259,6 +277,8 @@ static void efi_stub_entry_update(void) | |||
259 | static inline void update_pecoff_setup_and_reloc(unsigned int size) {} | 277 | static inline void update_pecoff_setup_and_reloc(unsigned int size) {} |
260 | static inline void update_pecoff_text(unsigned int text_start, | 278 | static inline void update_pecoff_text(unsigned int text_start, |
261 | unsigned int file_sz) {} | 279 | unsigned int file_sz) {} |
280 | static inline void update_pecoff_bss(unsigned int file_sz, | ||
281 | unsigned int init_sz) {} | ||
262 | static inline void efi_stub_defaults(void) {} | 282 | static inline void efi_stub_defaults(void) {} |
263 | static inline void efi_stub_entry_update(void) {} | 283 | static inline void efi_stub_entry_update(void) {} |
264 | 284 | ||
@@ -310,7 +330,7 @@ static void parse_zoffset(char *fname) | |||
310 | 330 | ||
311 | int main(int argc, char ** argv) | 331 | int main(int argc, char ** argv) |
312 | { | 332 | { |
313 | unsigned int i, sz, setup_sectors; | 333 | unsigned int i, sz, setup_sectors, init_sz; |
314 | int c; | 334 | int c; |
315 | u32 sys_size; | 335 | u32 sys_size; |
316 | struct stat sb; | 336 | struct stat sb; |
@@ -376,7 +396,9 @@ int main(int argc, char ** argv) | |||
376 | buf[0x1f1] = setup_sectors-1; | 396 | buf[0x1f1] = setup_sectors-1; |
377 | put_unaligned_le32(sys_size, &buf[0x1f4]); | 397 | put_unaligned_le32(sys_size, &buf[0x1f4]); |
378 | 398 | ||
379 | update_pecoff_text(setup_sectors * 512, sz + i + ((sys_size * 16) - sz)); | 399 | update_pecoff_text(setup_sectors * 512, i + (sys_size * 16)); |
400 | init_sz = get_unaligned_le32(&buf[0x260]); | ||
401 | update_pecoff_bss(i + (sys_size * 16), init_sz); | ||
380 | 402 | ||
381 | efi_stub_entry_update(); | 403 | efi_stub_entry_update(); |
382 | 404 | ||
diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h index bba3cf88e624..0a8b519226b8 100644 --- a/arch/x86/include/asm/irqflags.h +++ b/arch/x86/include/asm/irqflags.h | |||
@@ -129,7 +129,7 @@ static inline notrace unsigned long arch_local_irq_save(void) | |||
129 | 129 | ||
130 | #define PARAVIRT_ADJUST_EXCEPTION_FRAME /* */ | 130 | #define PARAVIRT_ADJUST_EXCEPTION_FRAME /* */ |
131 | 131 | ||
132 | #define INTERRUPT_RETURN iretq | 132 | #define INTERRUPT_RETURN jmp native_iret |
133 | #define USERGS_SYSRET64 \ | 133 | #define USERGS_SYSRET64 \ |
134 | swapgs; \ | 134 | swapgs; \ |
135 | sysretq; | 135 | sysretq; |
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c index f3a1f04ed4cb..584874451414 100644 --- a/arch/x86/kernel/apm_32.c +++ b/arch/x86/kernel/apm_32.c | |||
@@ -841,7 +841,6 @@ static int apm_do_idle(void) | |||
841 | u32 eax; | 841 | u32 eax; |
842 | u8 ret = 0; | 842 | u8 ret = 0; |
843 | int idled = 0; | 843 | int idled = 0; |
844 | int polling; | ||
845 | int err = 0; | 844 | int err = 0; |
846 | 845 | ||
847 | if (!need_resched()) { | 846 | if (!need_resched()) { |
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index a80029035bf2..f9e4fdd3b877 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
@@ -370,6 +370,17 @@ static void init_intel(struct cpuinfo_x86 *c) | |||
370 | */ | 370 | */ |
371 | detect_extended_topology(c); | 371 | detect_extended_topology(c); |
372 | 372 | ||
373 | if (!cpu_has(c, X86_FEATURE_XTOPOLOGY)) { | ||
374 | /* | ||
375 | * let's use the legacy cpuid vector 0x1 and 0x4 for topology | ||
376 | * detection. | ||
377 | */ | ||
378 | c->x86_max_cores = intel_num_cpu_cores(c); | ||
379 | #ifdef CONFIG_X86_32 | ||
380 | detect_ht(c); | ||
381 | #endif | ||
382 | } | ||
383 | |||
373 | l2 = init_intel_cacheinfo(c); | 384 | l2 = init_intel_cacheinfo(c); |
374 | if (c->cpuid_level > 9) { | 385 | if (c->cpuid_level > 9) { |
375 | unsigned eax = cpuid_eax(10); | 386 | unsigned eax = cpuid_eax(10); |
@@ -438,17 +449,6 @@ static void init_intel(struct cpuinfo_x86 *c) | |||
438 | set_cpu_cap(c, X86_FEATURE_P3); | 449 | set_cpu_cap(c, X86_FEATURE_P3); |
439 | #endif | 450 | #endif |
440 | 451 | ||
441 | if (!cpu_has(c, X86_FEATURE_XTOPOLOGY)) { | ||
442 | /* | ||
443 | * let's use the legacy cpuid vector 0x1 and 0x4 for topology | ||
444 | * detection. | ||
445 | */ | ||
446 | c->x86_max_cores = intel_num_cpu_cores(c); | ||
447 | #ifdef CONFIG_X86_32 | ||
448 | detect_ht(c); | ||
449 | #endif | ||
450 | } | ||
451 | |||
452 | /* Work around errata */ | 452 | /* Work around errata */ |
453 | srat_detect_node(c); | 453 | srat_detect_node(c); |
454 | 454 | ||
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c index a952e9c85b6f..9c8f7394c612 100644 --- a/arch/x86/kernel/cpu/intel_cacheinfo.c +++ b/arch/x86/kernel/cpu/intel_cacheinfo.c | |||
@@ -730,6 +730,18 @@ unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c) | |||
730 | #endif | 730 | #endif |
731 | } | 731 | } |
732 | 732 | ||
733 | #ifdef CONFIG_X86_HT | ||
734 | /* | ||
735 | * If cpu_llc_id is not yet set, this means cpuid_level < 4 which in | ||
736 | * turns means that the only possibility is SMT (as indicated in | ||
737 | * cpuid1). Since cpuid2 doesn't specify shared caches, and we know | ||
738 | * that SMT shares all caches, we can unconditionally set cpu_llc_id to | ||
739 | * c->phys_proc_id. | ||
740 | */ | ||
741 | if (per_cpu(cpu_llc_id, cpu) == BAD_APICID) | ||
742 | per_cpu(cpu_llc_id, cpu) = c->phys_proc_id; | ||
743 | #endif | ||
744 | |||
733 | c->x86_cache_size = l3 ? l3 : (l2 ? l2 : (l1i+l1d)); | 745 | c->x86_cache_size = l3 ? l3 : (l2 ? l2 : (l1i+l1d)); |
734 | 746 | ||
735 | return l2; | 747 | return l2; |
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index bb92f38153b2..9a79c8dbd8e8 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
@@ -2451,6 +2451,12 @@ static __init int mcheck_init_device(void) | |||
2451 | for_each_online_cpu(i) { | 2451 | for_each_online_cpu(i) { |
2452 | err = mce_device_create(i); | 2452 | err = mce_device_create(i); |
2453 | if (err) { | 2453 | if (err) { |
2454 | /* | ||
2455 | * Register notifier anyway (and do not unreg it) so | ||
2456 | * that we don't leave undeleted timers, see notifier | ||
2457 | * callback above. | ||
2458 | */ | ||
2459 | __register_hotcpu_notifier(&mce_cpu_notifier); | ||
2454 | cpu_notifier_register_done(); | 2460 | cpu_notifier_register_done(); |
2455 | goto err_device_create; | 2461 | goto err_device_create; |
2456 | } | 2462 | } |
@@ -2471,10 +2477,6 @@ static __init int mcheck_init_device(void) | |||
2471 | err_register: | 2477 | err_register: |
2472 | unregister_syscore_ops(&mce_syscore_ops); | 2478 | unregister_syscore_ops(&mce_syscore_ops); |
2473 | 2479 | ||
2474 | cpu_notifier_register_begin(); | ||
2475 | __unregister_hotcpu_notifier(&mce_cpu_notifier); | ||
2476 | cpu_notifier_register_done(); | ||
2477 | |||
2478 | err_device_create: | 2480 | err_device_create: |
2479 | /* | 2481 | /* |
2480 | * We didn't keep track of which devices were created above, but | 2482 | * We didn't keep track of which devices were created above, but |
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 2bdfbff8a4f6..2879ecdaac43 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -118,6 +118,9 @@ static int x86_pmu_extra_regs(u64 config, struct perf_event *event) | |||
118 | continue; | 118 | continue; |
119 | if (event->attr.config1 & ~er->valid_mask) | 119 | if (event->attr.config1 & ~er->valid_mask) |
120 | return -EINVAL; | 120 | return -EINVAL; |
121 | /* Check if the extra msrs can be safely accessed*/ | ||
122 | if (!er->extra_msr_access) | ||
123 | return -ENXIO; | ||
121 | 124 | ||
122 | reg->idx = er->idx; | 125 | reg->idx = er->idx; |
123 | reg->config = event->attr.config1; | 126 | reg->config = event->attr.config1; |
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h index 3b2f9bdd974b..8ade93111e03 100644 --- a/arch/x86/kernel/cpu/perf_event.h +++ b/arch/x86/kernel/cpu/perf_event.h | |||
@@ -295,14 +295,16 @@ struct extra_reg { | |||
295 | u64 config_mask; | 295 | u64 config_mask; |
296 | u64 valid_mask; | 296 | u64 valid_mask; |
297 | int idx; /* per_xxx->regs[] reg index */ | 297 | int idx; /* per_xxx->regs[] reg index */ |
298 | bool extra_msr_access; | ||
298 | }; | 299 | }; |
299 | 300 | ||
300 | #define EVENT_EXTRA_REG(e, ms, m, vm, i) { \ | 301 | #define EVENT_EXTRA_REG(e, ms, m, vm, i) { \ |
301 | .event = (e), \ | 302 | .event = (e), \ |
302 | .msr = (ms), \ | 303 | .msr = (ms), \ |
303 | .config_mask = (m), \ | 304 | .config_mask = (m), \ |
304 | .valid_mask = (vm), \ | 305 | .valid_mask = (vm), \ |
305 | .idx = EXTRA_REG_##i, \ | 306 | .idx = EXTRA_REG_##i, \ |
307 | .extra_msr_access = true, \ | ||
306 | } | 308 | } |
307 | 309 | ||
308 | #define INTEL_EVENT_EXTRA_REG(event, msr, vm, idx) \ | 310 | #define INTEL_EVENT_EXTRA_REG(event, msr, vm, idx) \ |
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index adb02aa62af5..2502d0d9d246 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
@@ -1382,6 +1382,15 @@ again: | |||
1382 | intel_pmu_lbr_read(); | 1382 | intel_pmu_lbr_read(); |
1383 | 1383 | ||
1384 | /* | 1384 | /* |
1385 | * CondChgd bit 63 doesn't mean any overflow status. Ignore | ||
1386 | * and clear the bit. | ||
1387 | */ | ||
1388 | if (__test_and_clear_bit(63, (unsigned long *)&status)) { | ||
1389 | if (!status) | ||
1390 | goto done; | ||
1391 | } | ||
1392 | |||
1393 | /* | ||
1385 | * PEBS overflow sets bit 62 in the global status register | 1394 | * PEBS overflow sets bit 62 in the global status register |
1386 | */ | 1395 | */ |
1387 | if (__test_and_clear_bit(62, (unsigned long *)&status)) { | 1396 | if (__test_and_clear_bit(62, (unsigned long *)&status)) { |
@@ -2173,6 +2182,41 @@ static void intel_snb_check_microcode(void) | |||
2173 | } | 2182 | } |
2174 | } | 2183 | } |
2175 | 2184 | ||
2185 | /* | ||
2186 | * Under certain circumstances, access certain MSR may cause #GP. | ||
2187 | * The function tests if the input MSR can be safely accessed. | ||
2188 | */ | ||
2189 | static bool check_msr(unsigned long msr, u64 mask) | ||
2190 | { | ||
2191 | u64 val_old, val_new, val_tmp; | ||
2192 | |||
2193 | /* | ||
2194 | * Read the current value, change it and read it back to see if it | ||
2195 | * matches, this is needed to detect certain hardware emulators | ||
2196 | * (qemu/kvm) that don't trap on the MSR access and always return 0s. | ||
2197 | */ | ||
2198 | if (rdmsrl_safe(msr, &val_old)) | ||
2199 | return false; | ||
2200 | |||
2201 | /* | ||
2202 | * Only change the bits which can be updated by wrmsrl. | ||
2203 | */ | ||
2204 | val_tmp = val_old ^ mask; | ||
2205 | if (wrmsrl_safe(msr, val_tmp) || | ||
2206 | rdmsrl_safe(msr, &val_new)) | ||
2207 | return false; | ||
2208 | |||
2209 | if (val_new != val_tmp) | ||
2210 | return false; | ||
2211 | |||
2212 | /* Here it's sure that the MSR can be safely accessed. | ||
2213 | * Restore the old value and return. | ||
2214 | */ | ||
2215 | wrmsrl(msr, val_old); | ||
2216 | |||
2217 | return true; | ||
2218 | } | ||
2219 | |||
2176 | static __init void intel_sandybridge_quirk(void) | 2220 | static __init void intel_sandybridge_quirk(void) |
2177 | { | 2221 | { |
2178 | x86_pmu.check_microcode = intel_snb_check_microcode; | 2222 | x86_pmu.check_microcode = intel_snb_check_microcode; |
@@ -2262,7 +2306,8 @@ __init int intel_pmu_init(void) | |||
2262 | union cpuid10_ebx ebx; | 2306 | union cpuid10_ebx ebx; |
2263 | struct event_constraint *c; | 2307 | struct event_constraint *c; |
2264 | unsigned int unused; | 2308 | unsigned int unused; |
2265 | int version; | 2309 | struct extra_reg *er; |
2310 | int version, i; | ||
2266 | 2311 | ||
2267 | if (!cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) { | 2312 | if (!cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) { |
2268 | switch (boot_cpu_data.x86) { | 2313 | switch (boot_cpu_data.x86) { |
@@ -2465,6 +2510,9 @@ __init int intel_pmu_init(void) | |||
2465 | case 62: /* IvyBridge EP */ | 2510 | case 62: /* IvyBridge EP */ |
2466 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, | 2511 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, |
2467 | sizeof(hw_cache_event_ids)); | 2512 | sizeof(hw_cache_event_ids)); |
2513 | /* dTLB-load-misses on IVB is different than SNB */ | ||
2514 | hw_cache_event_ids[C(DTLB)][C(OP_READ)][C(RESULT_MISS)] = 0x8108; /* DTLB_LOAD_MISSES.DEMAND_LD_MISS_CAUSES_A_WALK */ | ||
2515 | |||
2468 | memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, | 2516 | memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, |
2469 | sizeof(hw_cache_extra_regs)); | 2517 | sizeof(hw_cache_extra_regs)); |
2470 | 2518 | ||
@@ -2565,6 +2613,34 @@ __init int intel_pmu_init(void) | |||
2565 | } | 2613 | } |
2566 | } | 2614 | } |
2567 | 2615 | ||
2616 | /* | ||
2617 | * Access LBR MSR may cause #GP under certain circumstances. | ||
2618 | * E.g. KVM doesn't support LBR MSR | ||
2619 | * Check all LBT MSR here. | ||
2620 | * Disable LBR access if any LBR MSRs can not be accessed. | ||
2621 | */ | ||
2622 | if (x86_pmu.lbr_nr && !check_msr(x86_pmu.lbr_tos, 0x3UL)) | ||
2623 | x86_pmu.lbr_nr = 0; | ||
2624 | for (i = 0; i < x86_pmu.lbr_nr; i++) { | ||
2625 | if (!(check_msr(x86_pmu.lbr_from + i, 0xffffUL) && | ||
2626 | check_msr(x86_pmu.lbr_to + i, 0xffffUL))) | ||
2627 | x86_pmu.lbr_nr = 0; | ||
2628 | } | ||
2629 | |||
2630 | /* | ||
2631 | * Access extra MSR may cause #GP under certain circumstances. | ||
2632 | * E.g. KVM doesn't support offcore event | ||
2633 | * Check all extra_regs here. | ||
2634 | */ | ||
2635 | if (x86_pmu.extra_regs) { | ||
2636 | for (er = x86_pmu.extra_regs; er->msr; er++) { | ||
2637 | er->extra_msr_access = check_msr(er->msr, 0x1ffUL); | ||
2638 | /* Disable LBR select mapping */ | ||
2639 | if ((er->idx == EXTRA_REG_LBR) && !er->extra_msr_access) | ||
2640 | x86_pmu.lbr_sel_map = NULL; | ||
2641 | } | ||
2642 | } | ||
2643 | |||
2568 | /* Support full width counters using alternative MSR range */ | 2644 | /* Support full width counters using alternative MSR range */ |
2569 | if (x86_pmu.intel_cap.full_width_write) { | 2645 | if (x86_pmu.intel_cap.full_width_write) { |
2570 | x86_pmu.max_period = x86_pmu.cntval_mask; | 2646 | x86_pmu.max_period = x86_pmu.cntval_mask; |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c index 980970cb744d..696ade311ded 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c | |||
@@ -311,9 +311,11 @@ static int alloc_bts_buffer(int cpu) | |||
311 | if (!x86_pmu.bts) | 311 | if (!x86_pmu.bts) |
312 | return 0; | 312 | return 0; |
313 | 313 | ||
314 | buffer = kzalloc_node(BTS_BUFFER_SIZE, GFP_KERNEL, node); | 314 | buffer = kzalloc_node(BTS_BUFFER_SIZE, GFP_KERNEL | __GFP_NOWARN, node); |
315 | if (unlikely(!buffer)) | 315 | if (unlikely(!buffer)) { |
316 | WARN_ONCE(1, "%s: BTS buffer allocation failure\n", __func__); | ||
316 | return -ENOMEM; | 317 | return -ENOMEM; |
318 | } | ||
317 | 319 | ||
318 | max = BTS_BUFFER_SIZE / BTS_RECORD_SIZE; | 320 | max = BTS_BUFFER_SIZE / BTS_RECORD_SIZE; |
319 | thresh = max / 16; | 321 | thresh = max / 16; |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c index 65bbbea38b9c..ae6552a0701f 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c | |||
@@ -550,16 +550,16 @@ static struct extra_reg snbep_uncore_cbox_extra_regs[] = { | |||
550 | SNBEP_CBO_EVENT_EXTRA_REG(0x4134, 0xffff, 0x6), | 550 | SNBEP_CBO_EVENT_EXTRA_REG(0x4134, 0xffff, 0x6), |
551 | SNBEP_CBO_EVENT_EXTRA_REG(0x0135, 0xffff, 0x8), | 551 | SNBEP_CBO_EVENT_EXTRA_REG(0x0135, 0xffff, 0x8), |
552 | SNBEP_CBO_EVENT_EXTRA_REG(0x0335, 0xffff, 0x8), | 552 | SNBEP_CBO_EVENT_EXTRA_REG(0x0335, 0xffff, 0x8), |
553 | SNBEP_CBO_EVENT_EXTRA_REG(0x4135, 0xffff, 0xc), | 553 | SNBEP_CBO_EVENT_EXTRA_REG(0x4135, 0xffff, 0xa), |
554 | SNBEP_CBO_EVENT_EXTRA_REG(0x4335, 0xffff, 0xc), | 554 | SNBEP_CBO_EVENT_EXTRA_REG(0x4335, 0xffff, 0xa), |
555 | SNBEP_CBO_EVENT_EXTRA_REG(0x4435, 0xffff, 0x2), | 555 | SNBEP_CBO_EVENT_EXTRA_REG(0x4435, 0xffff, 0x2), |
556 | SNBEP_CBO_EVENT_EXTRA_REG(0x4835, 0xffff, 0x2), | 556 | SNBEP_CBO_EVENT_EXTRA_REG(0x4835, 0xffff, 0x2), |
557 | SNBEP_CBO_EVENT_EXTRA_REG(0x4a35, 0xffff, 0x2), | 557 | SNBEP_CBO_EVENT_EXTRA_REG(0x4a35, 0xffff, 0x2), |
558 | SNBEP_CBO_EVENT_EXTRA_REG(0x5035, 0xffff, 0x2), | 558 | SNBEP_CBO_EVENT_EXTRA_REG(0x5035, 0xffff, 0x2), |
559 | SNBEP_CBO_EVENT_EXTRA_REG(0x0136, 0xffff, 0x8), | 559 | SNBEP_CBO_EVENT_EXTRA_REG(0x0136, 0xffff, 0x8), |
560 | SNBEP_CBO_EVENT_EXTRA_REG(0x0336, 0xffff, 0x8), | 560 | SNBEP_CBO_EVENT_EXTRA_REG(0x0336, 0xffff, 0x8), |
561 | SNBEP_CBO_EVENT_EXTRA_REG(0x4136, 0xffff, 0xc), | 561 | SNBEP_CBO_EVENT_EXTRA_REG(0x4136, 0xffff, 0xa), |
562 | SNBEP_CBO_EVENT_EXTRA_REG(0x4336, 0xffff, 0xc), | 562 | SNBEP_CBO_EVENT_EXTRA_REG(0x4336, 0xffff, 0xa), |
563 | SNBEP_CBO_EVENT_EXTRA_REG(0x4436, 0xffff, 0x2), | 563 | SNBEP_CBO_EVENT_EXTRA_REG(0x4436, 0xffff, 0x2), |
564 | SNBEP_CBO_EVENT_EXTRA_REG(0x4836, 0xffff, 0x2), | 564 | SNBEP_CBO_EVENT_EXTRA_REG(0x4836, 0xffff, 0x2), |
565 | SNBEP_CBO_EVENT_EXTRA_REG(0x4a36, 0xffff, 0x2), | 565 | SNBEP_CBO_EVENT_EXTRA_REG(0x4a36, 0xffff, 0x2), |
@@ -1222,6 +1222,7 @@ static struct extra_reg ivt_uncore_cbox_extra_regs[] = { | |||
1222 | SNBEP_CBO_EVENT_EXTRA_REG(SNBEP_CBO_PMON_CTL_TID_EN, | 1222 | SNBEP_CBO_EVENT_EXTRA_REG(SNBEP_CBO_PMON_CTL_TID_EN, |
1223 | SNBEP_CBO_PMON_CTL_TID_EN, 0x1), | 1223 | SNBEP_CBO_PMON_CTL_TID_EN, 0x1), |
1224 | SNBEP_CBO_EVENT_EXTRA_REG(0x1031, 0x10ff, 0x2), | 1224 | SNBEP_CBO_EVENT_EXTRA_REG(0x1031, 0x10ff, 0x2), |
1225 | |||
1225 | SNBEP_CBO_EVENT_EXTRA_REG(0x1134, 0xffff, 0x4), | 1226 | SNBEP_CBO_EVENT_EXTRA_REG(0x1134, 0xffff, 0x4), |
1226 | SNBEP_CBO_EVENT_EXTRA_REG(0x4134, 0xffff, 0xc), | 1227 | SNBEP_CBO_EVENT_EXTRA_REG(0x4134, 0xffff, 0xc), |
1227 | SNBEP_CBO_EVENT_EXTRA_REG(0x5134, 0xffff, 0xc), | 1228 | SNBEP_CBO_EVENT_EXTRA_REG(0x5134, 0xffff, 0xc), |
@@ -1245,7 +1246,7 @@ static struct extra_reg ivt_uncore_cbox_extra_regs[] = { | |||
1245 | SNBEP_CBO_EVENT_EXTRA_REG(0x8335, 0xffff, 0x10), | 1246 | SNBEP_CBO_EVENT_EXTRA_REG(0x8335, 0xffff, 0x10), |
1246 | SNBEP_CBO_EVENT_EXTRA_REG(0x0136, 0xffff, 0x10), | 1247 | SNBEP_CBO_EVENT_EXTRA_REG(0x0136, 0xffff, 0x10), |
1247 | SNBEP_CBO_EVENT_EXTRA_REG(0x0336, 0xffff, 0x10), | 1248 | SNBEP_CBO_EVENT_EXTRA_REG(0x0336, 0xffff, 0x10), |
1248 | SNBEP_CBO_EVENT_EXTRA_REG(0x2336, 0xffff, 0x10), | 1249 | SNBEP_CBO_EVENT_EXTRA_REG(0x2136, 0xffff, 0x10), |
1249 | SNBEP_CBO_EVENT_EXTRA_REG(0x2336, 0xffff, 0x10), | 1250 | SNBEP_CBO_EVENT_EXTRA_REG(0x2336, 0xffff, 0x10), |
1250 | SNBEP_CBO_EVENT_EXTRA_REG(0x4136, 0xffff, 0x18), | 1251 | SNBEP_CBO_EVENT_EXTRA_REG(0x4136, 0xffff, 0x18), |
1251 | SNBEP_CBO_EVENT_EXTRA_REG(0x4336, 0xffff, 0x18), | 1252 | SNBEP_CBO_EVENT_EXTRA_REG(0x4336, 0xffff, 0x18), |
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index dbaa23e78b36..0d0c9d4ab6d5 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
@@ -425,8 +425,8 @@ sysenter_do_call: | |||
425 | cmpl $(NR_syscalls), %eax | 425 | cmpl $(NR_syscalls), %eax |
426 | jae sysenter_badsys | 426 | jae sysenter_badsys |
427 | call *sys_call_table(,%eax,4) | 427 | call *sys_call_table(,%eax,4) |
428 | movl %eax,PT_EAX(%esp) | ||
429 | sysenter_after_call: | 428 | sysenter_after_call: |
429 | movl %eax,PT_EAX(%esp) | ||
430 | LOCKDEP_SYS_EXIT | 430 | LOCKDEP_SYS_EXIT |
431 | DISABLE_INTERRUPTS(CLBR_ANY) | 431 | DISABLE_INTERRUPTS(CLBR_ANY) |
432 | TRACE_IRQS_OFF | 432 | TRACE_IRQS_OFF |
@@ -502,6 +502,7 @@ ENTRY(system_call) | |||
502 | jae syscall_badsys | 502 | jae syscall_badsys |
503 | syscall_call: | 503 | syscall_call: |
504 | call *sys_call_table(,%eax,4) | 504 | call *sys_call_table(,%eax,4) |
505 | syscall_after_call: | ||
505 | movl %eax,PT_EAX(%esp) # store the return value | 506 | movl %eax,PT_EAX(%esp) # store the return value |
506 | syscall_exit: | 507 | syscall_exit: |
507 | LOCKDEP_SYS_EXIT | 508 | LOCKDEP_SYS_EXIT |
@@ -675,12 +676,12 @@ syscall_fault: | |||
675 | END(syscall_fault) | 676 | END(syscall_fault) |
676 | 677 | ||
677 | syscall_badsys: | 678 | syscall_badsys: |
678 | movl $-ENOSYS,PT_EAX(%esp) | 679 | movl $-ENOSYS,%eax |
679 | jmp syscall_exit | 680 | jmp syscall_after_call |
680 | END(syscall_badsys) | 681 | END(syscall_badsys) |
681 | 682 | ||
682 | sysenter_badsys: | 683 | sysenter_badsys: |
683 | movl $-ENOSYS,PT_EAX(%esp) | 684 | movl $-ENOSYS,%eax |
684 | jmp sysenter_after_call | 685 | jmp sysenter_after_call |
685 | END(syscall_badsys) | 686 | END(syscall_badsys) |
686 | CFI_ENDPROC | 687 | CFI_ENDPROC |
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S index b25ca969edd2..c844f0816ab8 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S | |||
@@ -830,27 +830,24 @@ restore_args: | |||
830 | RESTORE_ARGS 1,8,1 | 830 | RESTORE_ARGS 1,8,1 |
831 | 831 | ||
832 | irq_return: | 832 | irq_return: |
833 | INTERRUPT_RETURN | ||
834 | |||
835 | ENTRY(native_iret) | ||
833 | /* | 836 | /* |
834 | * Are we returning to a stack segment from the LDT? Note: in | 837 | * Are we returning to a stack segment from the LDT? Note: in |
835 | * 64-bit mode SS:RSP on the exception stack is always valid. | 838 | * 64-bit mode SS:RSP on the exception stack is always valid. |
836 | */ | 839 | */ |
837 | #ifdef CONFIG_X86_ESPFIX64 | 840 | #ifdef CONFIG_X86_ESPFIX64 |
838 | testb $4,(SS-RIP)(%rsp) | 841 | testb $4,(SS-RIP)(%rsp) |
839 | jnz irq_return_ldt | 842 | jnz native_irq_return_ldt |
840 | #endif | 843 | #endif |
841 | 844 | ||
842 | irq_return_iret: | 845 | native_irq_return_iret: |
843 | INTERRUPT_RETURN | ||
844 | _ASM_EXTABLE(irq_return_iret, bad_iret) | ||
845 | |||
846 | #ifdef CONFIG_PARAVIRT | ||
847 | ENTRY(native_iret) | ||
848 | iretq | 846 | iretq |
849 | _ASM_EXTABLE(native_iret, bad_iret) | 847 | _ASM_EXTABLE(native_irq_return_iret, bad_iret) |
850 | #endif | ||
851 | 848 | ||
852 | #ifdef CONFIG_X86_ESPFIX64 | 849 | #ifdef CONFIG_X86_ESPFIX64 |
853 | irq_return_ldt: | 850 | native_irq_return_ldt: |
854 | pushq_cfi %rax | 851 | pushq_cfi %rax |
855 | pushq_cfi %rdi | 852 | pushq_cfi %rdi |
856 | SWAPGS | 853 | SWAPGS |
@@ -872,7 +869,7 @@ irq_return_ldt: | |||
872 | SWAPGS | 869 | SWAPGS |
873 | movq %rax,%rsp | 870 | movq %rax,%rsp |
874 | popq_cfi %rax | 871 | popq_cfi %rax |
875 | jmp irq_return_iret | 872 | jmp native_irq_return_iret |
876 | #endif | 873 | #endif |
877 | 874 | ||
878 | .section .fixup,"ax" | 875 | .section .fixup,"ax" |
@@ -956,13 +953,8 @@ __do_double_fault: | |||
956 | cmpl $__KERNEL_CS,CS(%rdi) | 953 | cmpl $__KERNEL_CS,CS(%rdi) |
957 | jne do_double_fault | 954 | jne do_double_fault |
958 | movq RIP(%rdi),%rax | 955 | movq RIP(%rdi),%rax |
959 | cmpq $irq_return_iret,%rax | 956 | cmpq $native_irq_return_iret,%rax |
960 | #ifdef CONFIG_PARAVIRT | ||
961 | je 1f | ||
962 | cmpq $native_iret,%rax | ||
963 | #endif | ||
964 | jne do_double_fault /* This shouldn't happen... */ | 957 | jne do_double_fault /* This shouldn't happen... */ |
965 | 1: | ||
966 | movq PER_CPU_VAR(kernel_stack),%rax | 958 | movq PER_CPU_VAR(kernel_stack),%rax |
967 | subq $(6*8-KERNEL_STACK_OFFSET),%rax /* Reset to original stack */ | 959 | subq $(6*8-KERNEL_STACK_OFFSET),%rax /* Reset to original stack */ |
968 | movq %rax,RSP(%rdi) | 960 | movq %rax,RSP(%rdi) |
@@ -1428,7 +1420,7 @@ error_sti: | |||
1428 | */ | 1420 | */ |
1429 | error_kernelspace: | 1421 | error_kernelspace: |
1430 | incl %ebx | 1422 | incl %ebx |
1431 | leaq irq_return_iret(%rip),%rcx | 1423 | leaq native_irq_return_iret(%rip),%rcx |
1432 | cmpq %rcx,RIP+8(%rsp) | 1424 | cmpq %rcx,RIP+8(%rsp) |
1433 | je error_swapgs | 1425 | je error_swapgs |
1434 | movl %ecx,%eax /* zero extend */ | 1426 | movl %ecx,%eax /* zero extend */ |
diff --git a/arch/x86/kernel/espfix_64.c b/arch/x86/kernel/espfix_64.c index 6afbb16e9b79..94d857fb1033 100644 --- a/arch/x86/kernel/espfix_64.c +++ b/arch/x86/kernel/espfix_64.c | |||
@@ -175,7 +175,7 @@ void init_espfix_ap(void) | |||
175 | if (!pud_present(pud)) { | 175 | if (!pud_present(pud)) { |
176 | pmd_p = (pmd_t *)__get_free_page(PGALLOC_GFP); | 176 | pmd_p = (pmd_t *)__get_free_page(PGALLOC_GFP); |
177 | pud = __pud(__pa(pmd_p) | (PGTABLE_PROT & ptemask)); | 177 | pud = __pud(__pa(pmd_p) | (PGTABLE_PROT & ptemask)); |
178 | paravirt_alloc_pud(&init_mm, __pa(pmd_p) >> PAGE_SHIFT); | 178 | paravirt_alloc_pmd(&init_mm, __pa(pmd_p) >> PAGE_SHIFT); |
179 | for (n = 0; n < ESPFIX_PUD_CLONES; n++) | 179 | for (n = 0; n < ESPFIX_PUD_CLONES; n++) |
180 | set_pud(&pud_p[n], pud); | 180 | set_pud(&pud_p[n], pud); |
181 | } | 181 | } |
@@ -185,7 +185,7 @@ void init_espfix_ap(void) | |||
185 | if (!pmd_present(pmd)) { | 185 | if (!pmd_present(pmd)) { |
186 | pte_p = (pte_t *)__get_free_page(PGALLOC_GFP); | 186 | pte_p = (pte_t *)__get_free_page(PGALLOC_GFP); |
187 | pmd = __pmd(__pa(pte_p) | (PGTABLE_PROT & ptemask)); | 187 | pmd = __pmd(__pa(pte_p) | (PGTABLE_PROT & ptemask)); |
188 | paravirt_alloc_pmd(&init_mm, __pa(pte_p) >> PAGE_SHIFT); | 188 | paravirt_alloc_pte(&init_mm, __pa(pte_p) >> PAGE_SHIFT); |
189 | for (n = 0; n < ESPFIX_PMD_CLONES; n++) | 189 | for (n = 0; n < ESPFIX_PMD_CLONES; n++) |
190 | set_pmd(&pmd_p[n], pmd); | 190 | set_pmd(&pmd_p[n], pmd); |
191 | } | 191 | } |
@@ -193,7 +193,6 @@ void init_espfix_ap(void) | |||
193 | pte_p = pte_offset_kernel(&pmd, addr); | 193 | pte_p = pte_offset_kernel(&pmd, addr); |
194 | stack_page = (void *)__get_free_page(GFP_KERNEL); | 194 | stack_page = (void *)__get_free_page(GFP_KERNEL); |
195 | pte = __pte(__pa(stack_page) | (__PAGE_KERNEL_RO & ptemask)); | 195 | pte = __pte(__pa(stack_page) | (__PAGE_KERNEL_RO & ptemask)); |
196 | paravirt_alloc_pte(&init_mm, __pa(stack_page) >> PAGE_SHIFT); | ||
197 | for (n = 0; n < ESPFIX_PTE_CLONES; n++) | 196 | for (n = 0; n < ESPFIX_PTE_CLONES; n++) |
198 | set_pte(&pte_p[n*PTE_STRIDE], pte); | 197 | set_pte(&pte_p[n*PTE_STRIDE], pte); |
199 | 198 | ||
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index 7596df664901..67e6d19ef1be 100644 --- a/arch/x86/kernel/kprobes/core.c +++ b/arch/x86/kernel/kprobes/core.c | |||
@@ -574,6 +574,9 @@ int kprobe_int3_handler(struct pt_regs *regs) | |||
574 | struct kprobe *p; | 574 | struct kprobe *p; |
575 | struct kprobe_ctlblk *kcb; | 575 | struct kprobe_ctlblk *kcb; |
576 | 576 | ||
577 | if (user_mode_vm(regs)) | ||
578 | return 0; | ||
579 | |||
577 | addr = (kprobe_opcode_t *)(regs->ip - sizeof(kprobe_opcode_t)); | 580 | addr = (kprobe_opcode_t *)(regs->ip - sizeof(kprobe_opcode_t)); |
578 | /* | 581 | /* |
579 | * We don't want to be preempted for the entire | 582 | * We don't want to be preempted for the entire |
diff --git a/arch/x86/kernel/paravirt_patch_64.c b/arch/x86/kernel/paravirt_patch_64.c index 3f08f34f93eb..a1da6737ba5b 100644 --- a/arch/x86/kernel/paravirt_patch_64.c +++ b/arch/x86/kernel/paravirt_patch_64.c | |||
@@ -6,7 +6,6 @@ DEF_NATIVE(pv_irq_ops, irq_disable, "cli"); | |||
6 | DEF_NATIVE(pv_irq_ops, irq_enable, "sti"); | 6 | DEF_NATIVE(pv_irq_ops, irq_enable, "sti"); |
7 | DEF_NATIVE(pv_irq_ops, restore_fl, "pushq %rdi; popfq"); | 7 | DEF_NATIVE(pv_irq_ops, restore_fl, "pushq %rdi; popfq"); |
8 | DEF_NATIVE(pv_irq_ops, save_fl, "pushfq; popq %rax"); | 8 | DEF_NATIVE(pv_irq_ops, save_fl, "pushfq; popq %rax"); |
9 | DEF_NATIVE(pv_cpu_ops, iret, "iretq"); | ||
10 | DEF_NATIVE(pv_mmu_ops, read_cr2, "movq %cr2, %rax"); | 9 | DEF_NATIVE(pv_mmu_ops, read_cr2, "movq %cr2, %rax"); |
11 | DEF_NATIVE(pv_mmu_ops, read_cr3, "movq %cr3, %rax"); | 10 | DEF_NATIVE(pv_mmu_ops, read_cr3, "movq %cr3, %rax"); |
12 | DEF_NATIVE(pv_mmu_ops, write_cr3, "movq %rdi, %cr3"); | 11 | DEF_NATIVE(pv_mmu_ops, write_cr3, "movq %rdi, %cr3"); |
@@ -50,7 +49,6 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf, | |||
50 | PATCH_SITE(pv_irq_ops, save_fl); | 49 | PATCH_SITE(pv_irq_ops, save_fl); |
51 | PATCH_SITE(pv_irq_ops, irq_enable); | 50 | PATCH_SITE(pv_irq_ops, irq_enable); |
52 | PATCH_SITE(pv_irq_ops, irq_disable); | 51 | PATCH_SITE(pv_irq_ops, irq_disable); |
53 | PATCH_SITE(pv_cpu_ops, iret); | ||
54 | PATCH_SITE(pv_cpu_ops, irq_enable_sysexit); | 52 | PATCH_SITE(pv_cpu_ops, irq_enable_sysexit); |
55 | PATCH_SITE(pv_cpu_ops, usergs_sysret32); | 53 | PATCH_SITE(pv_cpu_ops, usergs_sysret32); |
56 | PATCH_SITE(pv_cpu_ops, usergs_sysret64); | 54 | PATCH_SITE(pv_cpu_ops, usergs_sysret64); |
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 57e5ce126d5a..ea030319b321 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
@@ -920,9 +920,9 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, | |||
920 | tsc_khz = cpufreq_scale(tsc_khz_ref, ref_freq, freq->new); | 920 | tsc_khz = cpufreq_scale(tsc_khz_ref, ref_freq, freq->new); |
921 | if (!(freq->flags & CPUFREQ_CONST_LOOPS)) | 921 | if (!(freq->flags & CPUFREQ_CONST_LOOPS)) |
922 | mark_tsc_unstable("cpufreq changes"); | 922 | mark_tsc_unstable("cpufreq changes"); |
923 | } | ||
924 | 923 | ||
925 | set_cyc2ns_scale(tsc_khz, freq->cpu); | 924 | set_cyc2ns_scale(tsc_khz, freq->cpu); |
925 | } | ||
926 | 926 | ||
927 | return 0; | 927 | return 0; |
928 | } | 928 | } |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index f6449334ec45..ef432f891d30 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -5887,6 +5887,18 @@ static int inject_pending_event(struct kvm_vcpu *vcpu, bool req_int_win) | |||
5887 | kvm_x86_ops->set_nmi(vcpu); | 5887 | kvm_x86_ops->set_nmi(vcpu); |
5888 | } | 5888 | } |
5889 | } else if (kvm_cpu_has_injectable_intr(vcpu)) { | 5889 | } else if (kvm_cpu_has_injectable_intr(vcpu)) { |
5890 | /* | ||
5891 | * Because interrupts can be injected asynchronously, we are | ||
5892 | * calling check_nested_events again here to avoid a race condition. | ||
5893 | * See https://lkml.org/lkml/2014/7/2/60 for discussion about this | ||
5894 | * proposal and current concerns. Perhaps we should be setting | ||
5895 | * KVM_REQ_EVENT only on certain events and not unconditionally? | ||
5896 | */ | ||
5897 | if (is_guest_mode(vcpu) && kvm_x86_ops->check_nested_events) { | ||
5898 | r = kvm_x86_ops->check_nested_events(vcpu, req_int_win); | ||
5899 | if (r != 0) | ||
5900 | return r; | ||
5901 | } | ||
5890 | if (kvm_x86_ops->interrupt_allowed(vcpu)) { | 5902 | if (kvm_x86_ops->interrupt_allowed(vcpu)) { |
5891 | kvm_queue_interrupt(vcpu, kvm_cpu_get_interrupt(vcpu), | 5903 | kvm_queue_interrupt(vcpu, kvm_cpu_get_interrupt(vcpu), |
5892 | false); | 5904 | false); |
diff --git a/arch/x86/xen/grant-table.c b/arch/x86/xen/grant-table.c index c98583588580..ebfa9b2c871d 100644 --- a/arch/x86/xen/grant-table.c +++ b/arch/x86/xen/grant-table.c | |||
@@ -36,99 +36,133 @@ | |||
36 | 36 | ||
37 | #include <linux/sched.h> | 37 | #include <linux/sched.h> |
38 | #include <linux/mm.h> | 38 | #include <linux/mm.h> |
39 | #include <linux/slab.h> | ||
39 | #include <linux/vmalloc.h> | 40 | #include <linux/vmalloc.h> |
40 | 41 | ||
41 | #include <xen/interface/xen.h> | 42 | #include <xen/interface/xen.h> |
42 | #include <xen/page.h> | 43 | #include <xen/page.h> |
43 | #include <xen/grant_table.h> | 44 | #include <xen/grant_table.h> |
45 | #include <xen/xen.h> | ||
44 | 46 | ||
45 | #include <asm/pgtable.h> | 47 | #include <asm/pgtable.h> |
46 | 48 | ||
47 | static int map_pte_fn(pte_t *pte, struct page *pmd_page, | 49 | static struct gnttab_vm_area { |
48 | unsigned long addr, void *data) | 50 | struct vm_struct *area; |
51 | pte_t **ptes; | ||
52 | } gnttab_shared_vm_area, gnttab_status_vm_area; | ||
53 | |||
54 | int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes, | ||
55 | unsigned long max_nr_gframes, | ||
56 | void **__shared) | ||
49 | { | 57 | { |
50 | unsigned long **frames = (unsigned long **)data; | 58 | void *shared = *__shared; |
59 | unsigned long addr; | ||
60 | unsigned long i; | ||
51 | 61 | ||
52 | set_pte_at(&init_mm, addr, pte, mfn_pte((*frames)[0], PAGE_KERNEL)); | 62 | if (shared == NULL) |
53 | (*frames)++; | 63 | *__shared = shared = gnttab_shared_vm_area.area->addr; |
54 | return 0; | ||
55 | } | ||
56 | 64 | ||
57 | /* | 65 | addr = (unsigned long)shared; |
58 | * This function is used to map shared frames to store grant status. It is | 66 | |
59 | * different from map_pte_fn above, the frames type here is uint64_t. | 67 | for (i = 0; i < nr_gframes; i++) { |
60 | */ | 68 | set_pte_at(&init_mm, addr, gnttab_shared_vm_area.ptes[i], |
61 | static int map_pte_fn_status(pte_t *pte, struct page *pmd_page, | 69 | mfn_pte(frames[i], PAGE_KERNEL)); |
62 | unsigned long addr, void *data) | 70 | addr += PAGE_SIZE; |
63 | { | 71 | } |
64 | uint64_t **frames = (uint64_t **)data; | ||
65 | 72 | ||
66 | set_pte_at(&init_mm, addr, pte, mfn_pte((*frames)[0], PAGE_KERNEL)); | ||
67 | (*frames)++; | ||
68 | return 0; | 73 | return 0; |
69 | } | 74 | } |
70 | 75 | ||
71 | static int unmap_pte_fn(pte_t *pte, struct page *pmd_page, | 76 | int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes, |
72 | unsigned long addr, void *data) | 77 | unsigned long max_nr_gframes, |
78 | grant_status_t **__shared) | ||
73 | { | 79 | { |
80 | grant_status_t *shared = *__shared; | ||
81 | unsigned long addr; | ||
82 | unsigned long i; | ||
83 | |||
84 | if (shared == NULL) | ||
85 | *__shared = shared = gnttab_status_vm_area.area->addr; | ||
86 | |||
87 | addr = (unsigned long)shared; | ||
88 | |||
89 | for (i = 0; i < nr_gframes; i++) { | ||
90 | set_pte_at(&init_mm, addr, gnttab_status_vm_area.ptes[i], | ||
91 | mfn_pte(frames[i], PAGE_KERNEL)); | ||
92 | addr += PAGE_SIZE; | ||
93 | } | ||
74 | 94 | ||
75 | set_pte_at(&init_mm, addr, pte, __pte(0)); | ||
76 | return 0; | 95 | return 0; |
77 | } | 96 | } |
78 | 97 | ||
79 | int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes, | 98 | void arch_gnttab_unmap(void *shared, unsigned long nr_gframes) |
80 | unsigned long max_nr_gframes, | ||
81 | void **__shared) | ||
82 | { | 99 | { |
83 | int rc; | 100 | pte_t **ptes; |
84 | void *shared = *__shared; | 101 | unsigned long addr; |
102 | unsigned long i; | ||
85 | 103 | ||
86 | if (shared == NULL) { | 104 | if (shared == gnttab_status_vm_area.area->addr) |
87 | struct vm_struct *area = | 105 | ptes = gnttab_status_vm_area.ptes; |
88 | alloc_vm_area(PAGE_SIZE * max_nr_gframes, NULL); | 106 | else |
89 | BUG_ON(area == NULL); | 107 | ptes = gnttab_shared_vm_area.ptes; |
90 | shared = area->addr; | ||
91 | *__shared = shared; | ||
92 | } | ||
93 | 108 | ||
94 | rc = apply_to_page_range(&init_mm, (unsigned long)shared, | 109 | addr = (unsigned long)shared; |
95 | PAGE_SIZE * nr_gframes, | 110 | |
96 | map_pte_fn, &frames); | 111 | for (i = 0; i < nr_gframes; i++) { |
97 | return rc; | 112 | set_pte_at(&init_mm, addr, ptes[i], __pte(0)); |
113 | addr += PAGE_SIZE; | ||
114 | } | ||
98 | } | 115 | } |
99 | 116 | ||
100 | int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes, | 117 | static int arch_gnttab_valloc(struct gnttab_vm_area *area, unsigned nr_frames) |
101 | unsigned long max_nr_gframes, | ||
102 | grant_status_t **__shared) | ||
103 | { | 118 | { |
104 | int rc; | 119 | area->ptes = kmalloc(sizeof(pte_t *) * nr_frames, GFP_KERNEL); |
105 | grant_status_t *shared = *__shared; | 120 | if (area->ptes == NULL) |
121 | return -ENOMEM; | ||
106 | 122 | ||
107 | if (shared == NULL) { | 123 | area->area = alloc_vm_area(PAGE_SIZE * nr_frames, area->ptes); |
108 | /* No need to pass in PTE as we are going to do it | 124 | if (area->area == NULL) { |
109 | * in apply_to_page_range anyhow. */ | 125 | kfree(area->ptes); |
110 | struct vm_struct *area = | 126 | return -ENOMEM; |
111 | alloc_vm_area(PAGE_SIZE * max_nr_gframes, NULL); | ||
112 | BUG_ON(area == NULL); | ||
113 | shared = area->addr; | ||
114 | *__shared = shared; | ||
115 | } | 127 | } |
116 | 128 | ||
117 | rc = apply_to_page_range(&init_mm, (unsigned long)shared, | 129 | return 0; |
118 | PAGE_SIZE * nr_gframes, | ||
119 | map_pte_fn_status, &frames); | ||
120 | return rc; | ||
121 | } | 130 | } |
122 | 131 | ||
123 | void arch_gnttab_unmap(void *shared, unsigned long nr_gframes) | 132 | static void arch_gnttab_vfree(struct gnttab_vm_area *area) |
133 | { | ||
134 | free_vm_area(area->area); | ||
135 | kfree(area->ptes); | ||
136 | } | ||
137 | |||
138 | int arch_gnttab_init(unsigned long nr_shared, unsigned long nr_status) | ||
124 | { | 139 | { |
125 | apply_to_page_range(&init_mm, (unsigned long)shared, | 140 | int ret; |
126 | PAGE_SIZE * nr_gframes, unmap_pte_fn, NULL); | 141 | |
142 | if (!xen_pv_domain()) | ||
143 | return 0; | ||
144 | |||
145 | ret = arch_gnttab_valloc(&gnttab_shared_vm_area, nr_shared); | ||
146 | if (ret < 0) | ||
147 | return ret; | ||
148 | |||
149 | /* | ||
150 | * Always allocate the space for the status frames in case | ||
151 | * we're migrated to a host with V2 support. | ||
152 | */ | ||
153 | ret = arch_gnttab_valloc(&gnttab_status_vm_area, nr_status); | ||
154 | if (ret < 0) | ||
155 | goto err; | ||
156 | |||
157 | return 0; | ||
158 | err: | ||
159 | arch_gnttab_vfree(&gnttab_shared_vm_area); | ||
160 | return -ENOMEM; | ||
127 | } | 161 | } |
162 | |||
128 | #ifdef CONFIG_XEN_PVH | 163 | #ifdef CONFIG_XEN_PVH |
129 | #include <xen/balloon.h> | 164 | #include <xen/balloon.h> |
130 | #include <xen/events.h> | 165 | #include <xen/events.h> |
131 | #include <xen/xen.h> | ||
132 | #include <linux/slab.h> | 166 | #include <linux/slab.h> |
133 | static int __init xlated_setup_gnttab_pages(void) | 167 | static int __init xlated_setup_gnttab_pages(void) |
134 | { | 168 | { |
diff --git a/arch/xtensa/kernel/vectors.S b/arch/xtensa/kernel/vectors.S index f9e1ec346e35..8453e6e39895 100644 --- a/arch/xtensa/kernel/vectors.S +++ b/arch/xtensa/kernel/vectors.S | |||
@@ -376,38 +376,42 @@ _DoubleExceptionVector_WindowOverflow: | |||
376 | beqz a2, 1f # if at start of vector, don't restore | 376 | beqz a2, 1f # if at start of vector, don't restore |
377 | 377 | ||
378 | addi a0, a0, -128 | 378 | addi a0, a0, -128 |
379 | bbsi a0, 8, 1f # don't restore except for overflow 8 and 12 | 379 | bbsi.l a0, 8, 1f # don't restore except for overflow 8 and 12 |
380 | bbsi a0, 7, 2f | 380 | |
381 | /* | ||
382 | * This fixup handler is for the extremely unlikely case where the | ||
383 | * overflow handler's reference thru a0 gets a hardware TLB refill | ||
384 | * that bumps out the (distinct, aliasing) TLB entry that mapped its | ||
385 | * prior references thru a9/a13, and where our reference now thru | ||
386 | * a9/a13 gets a 2nd-level miss exception (not hardware TLB refill). | ||
387 | */ | ||
388 | movi a2, window_overflow_restore_a0_fixup | ||
389 | s32i a2, a3, EXC_TABLE_FIXUP | ||
390 | l32i a2, a3, EXC_TABLE_DOUBLE_SAVE | ||
391 | xsr a3, excsave1 | ||
392 | |||
393 | bbsi.l a0, 7, 2f | ||
381 | 394 | ||
382 | /* | 395 | /* |
383 | * Restore a0 as saved by _WindowOverflow8(). | 396 | * Restore a0 as saved by _WindowOverflow8(). |
384 | * | ||
385 | * FIXME: we really need a fixup handler for this L32E, | ||
386 | * for the extremely unlikely case where the overflow handler's | ||
387 | * reference thru a0 gets a hardware TLB refill that bumps out | ||
388 | * the (distinct, aliasing) TLB entry that mapped its prior | ||
389 | * references thru a9, and where our reference now thru a9 | ||
390 | * gets a 2nd-level miss exception (not hardware TLB refill). | ||
391 | */ | 397 | */ |
392 | 398 | ||
393 | l32e a2, a9, -16 | 399 | l32e a0, a9, -16 |
394 | wsr a2, depc # replace the saved a0 | 400 | wsr a0, depc # replace the saved a0 |
395 | j 1f | 401 | j 3f |
396 | 402 | ||
397 | 2: | 403 | 2: |
398 | /* | 404 | /* |
399 | * Restore a0 as saved by _WindowOverflow12(). | 405 | * Restore a0 as saved by _WindowOverflow12(). |
400 | * | ||
401 | * FIXME: we really need a fixup handler for this L32E, | ||
402 | * for the extremely unlikely case where the overflow handler's | ||
403 | * reference thru a0 gets a hardware TLB refill that bumps out | ||
404 | * the (distinct, aliasing) TLB entry that mapped its prior | ||
405 | * references thru a13, and where our reference now thru a13 | ||
406 | * gets a 2nd-level miss exception (not hardware TLB refill). | ||
407 | */ | 406 | */ |
408 | 407 | ||
409 | l32e a2, a13, -16 | 408 | l32e a0, a13, -16 |
410 | wsr a2, depc # replace the saved a0 | 409 | wsr a0, depc # replace the saved a0 |
410 | 3: | ||
411 | xsr a3, excsave1 | ||
412 | movi a0, 0 | ||
413 | s32i a0, a3, EXC_TABLE_FIXUP | ||
414 | s32i a2, a3, EXC_TABLE_DOUBLE_SAVE | ||
411 | 1: | 415 | 1: |
412 | /* | 416 | /* |
413 | * Restore WindowBase while leaving all address registers restored. | 417 | * Restore WindowBase while leaving all address registers restored. |
@@ -449,6 +453,7 @@ _DoubleExceptionVector_WindowOverflow: | |||
449 | 453 | ||
450 | s32i a0, a2, PT_DEPC | 454 | s32i a0, a2, PT_DEPC |
451 | 455 | ||
456 | _DoubleExceptionVector_handle_exception: | ||
452 | addx4 a0, a0, a3 | 457 | addx4 a0, a0, a3 |
453 | l32i a0, a0, EXC_TABLE_FAST_USER | 458 | l32i a0, a0, EXC_TABLE_FAST_USER |
454 | xsr a3, excsave1 | 459 | xsr a3, excsave1 |
@@ -464,11 +469,120 @@ _DoubleExceptionVector_WindowOverflow: | |||
464 | rotw -3 | 469 | rotw -3 |
465 | j 1b | 470 | j 1b |
466 | 471 | ||
467 | .end literal_prefix | ||
468 | 472 | ||
469 | ENDPROC(_DoubleExceptionVector) | 473 | ENDPROC(_DoubleExceptionVector) |
470 | 474 | ||
471 | /* | 475 | /* |
476 | * Fixup handler for TLB miss in double exception handler for window owerflow. | ||
477 | * We get here with windowbase set to the window that was being spilled and | ||
478 | * a0 trashed. a0 bit 7 determines if this is a call8 (bit clear) or call12 | ||
479 | * (bit set) window. | ||
480 | * | ||
481 | * We do the following here: | ||
482 | * - go to the original window retaining a0 value; | ||
483 | * - set up exception stack to return back to appropriate a0 restore code | ||
484 | * (we'll need to rotate window back and there's no place to save this | ||
485 | * information, use different return address for that); | ||
486 | * - handle the exception; | ||
487 | * - go to the window that was being spilled; | ||
488 | * - set up window_overflow_restore_a0_fixup as a fixup routine; | ||
489 | * - reload a0; | ||
490 | * - restore the original window; | ||
491 | * - reset the default fixup routine; | ||
492 | * - return to user. By the time we get to this fixup handler all information | ||
493 | * about the conditions of the original double exception that happened in | ||
494 | * the window overflow handler is lost, so we just return to userspace to | ||
495 | * retry overflow from start. | ||
496 | * | ||
497 | * a0: value of depc, original value in depc | ||
498 | * a2: trashed, original value in EXC_TABLE_DOUBLE_SAVE | ||
499 | * a3: exctable, original value in excsave1 | ||
500 | */ | ||
501 | |||
502 | ENTRY(window_overflow_restore_a0_fixup) | ||
503 | |||
504 | rsr a0, ps | ||
505 | extui a0, a0, PS_OWB_SHIFT, PS_OWB_WIDTH | ||
506 | rsr a2, windowbase | ||
507 | sub a0, a2, a0 | ||
508 | extui a0, a0, 0, 3 | ||
509 | l32i a2, a3, EXC_TABLE_DOUBLE_SAVE | ||
510 | xsr a3, excsave1 | ||
511 | |||
512 | _beqi a0, 1, .Lhandle_1 | ||
513 | _beqi a0, 3, .Lhandle_3 | ||
514 | |||
515 | .macro overflow_fixup_handle_exception_pane n | ||
516 | |||
517 | rsr a0, depc | ||
518 | rotw -\n | ||
519 | |||
520 | xsr a3, excsave1 | ||
521 | wsr a2, depc | ||
522 | l32i a2, a3, EXC_TABLE_KSTK | ||
523 | s32i a0, a2, PT_AREG0 | ||
524 | |||
525 | movi a0, .Lrestore_\n | ||
526 | s32i a0, a2, PT_DEPC | ||
527 | rsr a0, exccause | ||
528 | j _DoubleExceptionVector_handle_exception | ||
529 | |||
530 | .endm | ||
531 | |||
532 | overflow_fixup_handle_exception_pane 2 | ||
533 | .Lhandle_1: | ||
534 | overflow_fixup_handle_exception_pane 1 | ||
535 | .Lhandle_3: | ||
536 | overflow_fixup_handle_exception_pane 3 | ||
537 | |||
538 | .macro overflow_fixup_restore_a0_pane n | ||
539 | |||
540 | rotw \n | ||
541 | /* Need to preserve a0 value here to be able to handle exception | ||
542 | * that may occur on a0 reload from stack. It may occur because | ||
543 | * TLB miss handler may not be atomic and pointer to page table | ||
544 | * may be lost before we get here. There are no free registers, | ||
545 | * so we need to use EXC_TABLE_DOUBLE_SAVE area. | ||
546 | */ | ||
547 | xsr a3, excsave1 | ||
548 | s32i a2, a3, EXC_TABLE_DOUBLE_SAVE | ||
549 | movi a2, window_overflow_restore_a0_fixup | ||
550 | s32i a2, a3, EXC_TABLE_FIXUP | ||
551 | l32i a2, a3, EXC_TABLE_DOUBLE_SAVE | ||
552 | xsr a3, excsave1 | ||
553 | bbsi.l a0, 7, 1f | ||
554 | l32e a0, a9, -16 | ||
555 | j 2f | ||
556 | 1: | ||
557 | l32e a0, a13, -16 | ||
558 | 2: | ||
559 | rotw -\n | ||
560 | |||
561 | .endm | ||
562 | |||
563 | .Lrestore_2: | ||
564 | overflow_fixup_restore_a0_pane 2 | ||
565 | |||
566 | .Lset_default_fixup: | ||
567 | xsr a3, excsave1 | ||
568 | s32i a2, a3, EXC_TABLE_DOUBLE_SAVE | ||
569 | movi a2, 0 | ||
570 | s32i a2, a3, EXC_TABLE_FIXUP | ||
571 | l32i a2, a3, EXC_TABLE_DOUBLE_SAVE | ||
572 | xsr a3, excsave1 | ||
573 | rfe | ||
574 | |||
575 | .Lrestore_1: | ||
576 | overflow_fixup_restore_a0_pane 1 | ||
577 | j .Lset_default_fixup | ||
578 | .Lrestore_3: | ||
579 | overflow_fixup_restore_a0_pane 3 | ||
580 | j .Lset_default_fixup | ||
581 | |||
582 | ENDPROC(window_overflow_restore_a0_fixup) | ||
583 | |||
584 | .end literal_prefix | ||
585 | /* | ||
472 | * Debug interrupt vector | 586 | * Debug interrupt vector |
473 | * | 587 | * |
474 | * There is not much space here, so simply jump to another handler. | 588 | * There is not much space here, so simply jump to another handler. |
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S index ee32c0085dff..d16db6df86f8 100644 --- a/arch/xtensa/kernel/vmlinux.lds.S +++ b/arch/xtensa/kernel/vmlinux.lds.S | |||
@@ -269,13 +269,13 @@ SECTIONS | |||
269 | .UserExceptionVector.literal) | 269 | .UserExceptionVector.literal) |
270 | SECTION_VECTOR (_DoubleExceptionVector_literal, | 270 | SECTION_VECTOR (_DoubleExceptionVector_literal, |
271 | .DoubleExceptionVector.literal, | 271 | .DoubleExceptionVector.literal, |
272 | DOUBLEEXC_VECTOR_VADDR - 16, | 272 | DOUBLEEXC_VECTOR_VADDR - 40, |
273 | SIZEOF(.UserExceptionVector.text), | 273 | SIZEOF(.UserExceptionVector.text), |
274 | .UserExceptionVector.text) | 274 | .UserExceptionVector.text) |
275 | SECTION_VECTOR (_DoubleExceptionVector_text, | 275 | SECTION_VECTOR (_DoubleExceptionVector_text, |
276 | .DoubleExceptionVector.text, | 276 | .DoubleExceptionVector.text, |
277 | DOUBLEEXC_VECTOR_VADDR, | 277 | DOUBLEEXC_VECTOR_VADDR, |
278 | 32, | 278 | 40, |
279 | .DoubleExceptionVector.literal) | 279 | .DoubleExceptionVector.literal) |
280 | 280 | ||
281 | . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3; | 281 | . = (LOADADDR( .DoubleExceptionVector.text ) + SIZEOF( .DoubleExceptionVector.text ) + 3) & ~ 3; |
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c index 4224256bb215..77ed20209ca5 100644 --- a/arch/xtensa/mm/init.c +++ b/arch/xtensa/mm/init.c | |||
@@ -191,7 +191,7 @@ int __init mem_reserve(unsigned long start, unsigned long end, int must_exist) | |||
191 | return -EINVAL; | 191 | return -EINVAL; |
192 | } | 192 | } |
193 | 193 | ||
194 | if (it && start - it->start < bank_sz) { | 194 | if (it && start - it->start <= bank_sz) { |
195 | if (start == it->start) { | 195 | if (start == it->start) { |
196 | if (end - it->start < bank_sz) { | 196 | if (end - it->start < bank_sz) { |
197 | it->start = end; | 197 | it->start = end; |