aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/pci.c8
-rw-r--r--arch/arm/boot/dts/armada-370-db.dts24
-rw-r--r--arch/arm/boot/dts/at91sam9263.dtsi2
-rw-r--r--arch/arm/boot/dts/berlin2q-marvell-dmp.dts2
-rw-r--r--arch/arm/boot/dts/berlin2q.dtsi63
-rw-r--r--arch/arm/boot/dts/dra7-evm.dts10
-rw-r--r--arch/arm/boot/dts/dra7.dtsi6
-rw-r--r--arch/arm/boot/dts/exynos5250.dtsi2
-rw-r--r--arch/arm/boot/dts/exynos5420-arndale-octa.dts4
-rw-r--r--arch/arm/boot/dts/exynos5420.dtsi6
-rw-r--r--arch/arm/boot/dts/imx25.dtsi10
-rw-r--r--arch/arm/boot/dts/imx51-babbage.dts22
-rw-r--r--arch/arm/boot/dts/imx6qdl.dtsi4
-rw-r--r--arch/arm/boot/dts/imx6sx-sdb.dts15
-rw-r--r--arch/arm/boot/dts/ls1021a.dtsi1
-rw-r--r--arch/arm/boot/dts/omap3-n900.dts4
-rw-r--r--arch/arm/boot/dts/rk3288-evb.dtsi30
-rw-r--r--arch/arm/boot/dts/sama5d3xmb.dtsi2
-rw-r--r--arch/arm/boot/dts/sama5d4.dtsi2
-rw-r--r--arch/arm/boot/dts/ste-nomadik-nhk15.dts8
-rw-r--r--arch/arm/boot/dts/tegra20-seaboard.dts2
-rw-r--r--arch/arm/boot/dts/vf610-twr.dts15
-rw-r--r--arch/arm/configs/exynos_defconfig18
-rw-r--r--arch/arm/configs/multi_v7_defconfig1
-rw-r--r--arch/arm/configs/omap2plus_defconfig2
-rw-r--r--arch/arm/include/uapi/asm/unistd.h1
-rw-r--r--arch/arm/kernel/calls.S1
-rw-r--r--arch/arm/kernel/entry-header.S13
-rw-r--r--arch/arm/kernel/perf_event.c10
-rw-r--r--arch/arm/kernel/perf_regs.c8
-rw-r--r--arch/arm/kernel/setup.c16
-rw-r--r--arch/arm/kernel/smp.c12
-rw-r--r--arch/arm/mach-at91/board-dt-sama5.c18
-rw-r--r--arch/arm/mach-imx/clk-imx6q.c2
-rw-r--r--arch/arm/mach-imx/clk-imx6sx.c3
-rw-r--r--arch/arm/mach-mvebu/coherency.c7
-rw-r--r--arch/arm/mach-omap2/board-generic.c18
-rw-r--r--arch/arm/mach-omap2/common.h2
-rw-r--r--arch/arm/mach-omap2/control.h4
-rw-r--r--arch/arm/mach-omap2/omap-headsmp.S21
-rw-r--r--arch/arm/mach-omap2/omap-smp.c13
-rw-r--r--arch/arm/mach-omap2/omap4-common.c32
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c10
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.h1
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c5
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_54xx_data.c1
-rw-r--r--arch/arm/mach-omap2/prcm-common.h1
-rw-r--r--arch/arm/mach-omap2/prm44xx.c5
-rw-r--r--arch/arm/mach-omap2/prm_common.c14
-rw-r--r--arch/arm/mach-omap2/timer.c44
-rw-r--r--arch/arm/mach-omap2/twl-common.c7
-rw-r--r--arch/arm/mach-rockchip/rockchip.c27
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c7
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7778.c9
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c9
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c3
-rw-r--r--arch/arm/mm/dump.c9
-rw-r--r--arch/arm/mm/init.c4
-rw-r--r--arch/arm/mm/mmu.c4
-rw-r--r--arch/arm64/Makefile1
-rw-r--r--arch/arm64/boot/dts/Makefile2
-rw-r--r--arch/arm64/boot/dts/arm/juno.dts2
-rw-r--r--arch/arm64/include/asm/arch_timer.h1
-rw-r--r--arch/arm64/include/asm/cpu.h5
-rw-r--r--arch/arm64/include/asm/kvm_emulate.h2
-rw-r--r--arch/arm64/include/asm/processor.h4
-rw-r--r--arch/arm64/include/asm/unistd.h2
-rw-r--r--arch/arm64/include/asm/unistd32.h2
-rw-r--r--arch/arm64/kernel/cpuinfo.c10
-rw-r--r--arch/arm64/kernel/efi.c2
-rw-r--r--arch/arm64/kernel/module.c1
-rw-r--r--arch/arm64/kernel/perf_regs.c8
-rw-r--r--arch/arm64/kernel/setup.c1
-rw-r--r--arch/arm64/kernel/smp_spin_table.c1
-rw-r--r--arch/arm64/kvm/hyp.S1
-rw-r--r--arch/arm64/kvm/reset.c1
-rw-r--r--arch/arm64/mm/dump.c1
-rw-r--r--arch/arm64/mm/init.c8
-rw-r--r--arch/avr32/kernel/module.c13
-rw-r--r--arch/blackfin/mach-bf533/boards/stamp.c1
-rw-r--r--arch/cris/arch-v32/drivers/sync_serial.c2
-rw-r--r--arch/cris/kernel/module.c2
-rw-r--r--arch/frv/mb93090-mb00/pci-frv.c2
-rw-r--r--arch/ia64/include/asm/unistd.h2
-rw-r--r--arch/ia64/include/uapi/asm/unistd.h1
-rw-r--r--arch/ia64/kernel/acpi.c9
-rw-r--r--arch/ia64/kernel/entry.S1
-rw-r--r--arch/ia64/kernel/module.c6
-rw-r--r--arch/ia64/pci/pci.c48
-rw-r--r--arch/m68k/include/asm/unistd.h2
-rw-r--r--arch/m68k/include/uapi/asm/unistd.h1
-rw-r--r--arch/m68k/kernel/syscalltable.S1
-rw-r--r--arch/microblaze/pci/pci-common.c13
-rw-r--r--arch/mips/net/bpf_jit.c2
-rw-r--r--arch/mn10300/unit-asb2305/pci-asb2305.c2
-rw-r--r--arch/mn10300/unit-asb2305/pci.c47
-rw-r--r--arch/nios2/kernel/cpuinfo.c1
-rw-r--r--arch/nios2/kernel/entry.S20
-rw-r--r--arch/nios2/kernel/module.c2
-rw-r--r--arch/nios2/kernel/signal.c2
-rw-r--r--arch/parisc/kernel/module.c6
-rw-r--r--arch/powerpc/crypto/sha1.c1
-rw-r--r--arch/powerpc/include/asm/kexec.h10
-rw-r--r--arch/powerpc/include/asm/systbl.h1
-rw-r--r--arch/powerpc/include/asm/thread_info.h13
-rw-r--r--arch/powerpc/include/asm/unistd.h2
-rw-r--r--arch/powerpc/include/uapi/asm/unistd.h1
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c2
-rw-r--r--arch/powerpc/kernel/pci-common.c12
-rw-r--r--arch/powerpc/kernel/smp.c9
-rw-r--r--arch/powerpc/net/bpf_jit_comp.c2
-rw-r--r--arch/powerpc/platforms/powernv/opal-wrappers.S1
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c8
-rw-r--r--arch/s390/hypfs/hypfs_vm.c2
-rw-r--r--arch/s390/include/asm/irqflags.h2
-rw-r--r--arch/s390/include/asm/timex.h10
-rw-r--r--arch/s390/include/uapi/asm/unistd.h3
-rw-r--r--arch/s390/kernel/module.c10
-rw-r--r--arch/s390/kernel/syscalls.S1
-rw-r--r--arch/s390/kernel/uprobes.c69
-rw-r--r--arch/s390/kernel/vtime.c2
-rw-r--r--arch/s390/mm/pgtable.c5
-rw-r--r--arch/s390/net/bpf_jit.S28
-rw-r--r--arch/s390/net/bpf_jit_comp.c17
-rw-r--r--arch/sparc/kernel/pci.c5
-rw-r--r--arch/sparc/net/bpf_jit_comp.c4
-rw-r--r--arch/tile/kernel/module.c4
-rw-r--r--arch/um/Kconfig.common1
-rw-r--r--arch/x86/Kconfig6
-rw-r--r--arch/x86/boot/Makefile1
-rw-r--r--arch/x86/boot/compressed/misc.c9
-rw-r--r--arch/x86/crypto/Makefile2
-rw-r--r--arch/x86/crypto/aes_ctrby8_avx-x86_64.S46
-rw-r--r--arch/x86/crypto/sha-mb/sha1_mb.c2
-rw-r--r--arch/x86/include/asm/acpi.h1
-rw-r--r--arch/x86/include/asm/desc.h20
-rw-r--r--arch/x86/include/asm/mmu_context.h20
-rw-r--r--arch/x86/include/asm/vgtod.h6
-rw-r--r--arch/x86/kernel/acpi/boot.c35
-rw-r--r--arch/x86/kernel/cpu/Makefile1
-rw-r--r--arch/x86/kernel/cpu/mkcapflags.sh2
-rw-r--r--arch/x86/kernel/cpu/mshyperv.c1
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_ds.c4
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_rapl.c44
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore.h2
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c17
-rw-r--r--arch/x86/kernel/ftrace.c2
-rw-r--r--arch/x86/kernel/irq.c2
-rw-r--r--arch/x86/kernel/kprobes/core.c20
-rw-r--r--arch/x86/kernel/perf_regs.c90
-rw-r--r--arch/x86/kernel/tls.c25
-rw-r--r--arch/x86/kernel/tsc.c2
-rw-r--r--arch/x86/kvm/emulate.c31
-rw-r--r--arch/x86/lib/insn.c2
-rw-r--r--arch/x86/mm/init.c41
-rw-r--r--arch/x86/mm/mpx.c6
-rw-r--r--arch/x86/mm/pat.c7
-rw-r--r--arch/x86/pci/i386.c2
-rw-r--r--arch/x86/pci/xen.c49
-rw-r--r--arch/x86/um/sys_call_table_32.c2
-rw-r--r--arch/x86/um/sys_call_table_64.c2
-rw-r--r--arch/x86/vdso/vma.c45
-rw-r--r--arch/x86/xen/enlighten.c22
-rw-r--r--arch/x86/xen/p2m.c20
-rw-r--r--arch/x86/xen/setup.c42
-rw-r--r--arch/x86/xen/time.c18
166 files changed, 1156 insertions, 563 deletions
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 076c35cd6cde..98a1525fa164 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -285,8 +285,12 @@ pcibios_claim_one_bus(struct pci_bus *b)
285 if (r->parent || !r->start || !r->flags) 285 if (r->parent || !r->start || !r->flags)
286 continue; 286 continue;
287 if (pci_has_flag(PCI_PROBE_ONLY) || 287 if (pci_has_flag(PCI_PROBE_ONLY) ||
288 (r->flags & IORESOURCE_PCI_FIXED)) 288 (r->flags & IORESOURCE_PCI_FIXED)) {
289 pci_claim_resource(dev, i); 289 if (pci_claim_resource(dev, i) == 0)
290 continue;
291
292 pci_claim_bridge_resource(dev, i);
293 }
290 } 294 }
291 } 295 }
292 296
diff --git a/arch/arm/boot/dts/armada-370-db.dts b/arch/arm/boot/dts/armada-370-db.dts
index 1466580be295..70b1943a86b1 100644
--- a/arch/arm/boot/dts/armada-370-db.dts
+++ b/arch/arm/boot/dts/armada-370-db.dts
@@ -203,27 +203,3 @@
203 compatible = "linux,spdif-dir"; 203 compatible = "linux,spdif-dir";
204 }; 204 };
205}; 205};
206
207&pinctrl {
208 /*
209 * These pins might be muxed as I2S by
210 * the bootloader, but it conflicts
211 * with the real I2S pins that are
212 * muxed using i2s_pins. We must mux
213 * those pins to a function other than
214 * I2S.
215 */
216 pinctrl-0 = <&hog_pins1 &hog_pins2>;
217 pinctrl-names = "default";
218
219 hog_pins1: hog-pins1 {
220 marvell,pins = "mpp6", "mpp8", "mpp10",
221 "mpp12", "mpp13";
222 marvell,function = "gpio";
223 };
224
225 hog_pins2: hog-pins2 {
226 marvell,pins = "mpp5", "mpp7", "mpp9";
227 marvell,function = "gpo";
228 };
229};
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index 1467750e3377..e8c6c600a5b6 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -953,6 +953,8 @@
953 interrupts = <26 IRQ_TYPE_LEVEL_HIGH 3>; 953 interrupts = <26 IRQ_TYPE_LEVEL_HIGH 3>;
954 pinctrl-names = "default"; 954 pinctrl-names = "default";
955 pinctrl-0 = <&pinctrl_fb>; 955 pinctrl-0 = <&pinctrl_fb>;
956 clocks = <&lcd_clk>, <&lcd_clk>;
957 clock-names = "lcdc_clk", "hclk";
956 status = "disabled"; 958 status = "disabled";
957 }; 959 };
958 960
diff --git a/arch/arm/boot/dts/berlin2q-marvell-dmp.dts b/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
index 28e7e2060c33..a98ac1bd8f65 100644
--- a/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
+++ b/arch/arm/boot/dts/berlin2q-marvell-dmp.dts
@@ -65,6 +65,8 @@
65}; 65};
66 66
67&sdhci2 { 67&sdhci2 {
68 broken-cd;
69 bus-width = <8>;
68 non-removable; 70 non-removable;
69 status = "okay"; 71 status = "okay";
70}; 72};
diff --git a/arch/arm/boot/dts/berlin2q.dtsi b/arch/arm/boot/dts/berlin2q.dtsi
index 35253c947a7c..e2f61f27944e 100644
--- a/arch/arm/boot/dts/berlin2q.dtsi
+++ b/arch/arm/boot/dts/berlin2q.dtsi
@@ -83,7 +83,8 @@
83 compatible = "mrvl,pxav3-mmc"; 83 compatible = "mrvl,pxav3-mmc";
84 reg = <0xab1000 0x200>; 84 reg = <0xab1000 0x200>;
85 interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>; 85 interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
86 clocks = <&chip CLKID_SDIO1XIN>; 86 clocks = <&chip CLKID_NFC_ECC>, <&chip CLKID_NFC>;
87 clock-names = "io", "core";
87 status = "disabled"; 88 status = "disabled";
88 }; 89 };
89 90
@@ -348,36 +349,6 @@
348 interrupt-parent = <&gic>; 349 interrupt-parent = <&gic>;
349 interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>; 350 interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
350 }; 351 };
351
352 gpio4: gpio@5000 {
353 compatible = "snps,dw-apb-gpio";
354 reg = <0x5000 0x400>;
355 #address-cells = <1>;
356 #size-cells = <0>;
357
358 porte: gpio-port@4 {
359 compatible = "snps,dw-apb-gpio-port";
360 gpio-controller;
361 #gpio-cells = <2>;
362 snps,nr-gpios = <32>;
363 reg = <0>;
364 };
365 };
366
367 gpio5: gpio@c000 {
368 compatible = "snps,dw-apb-gpio";
369 reg = <0xc000 0x400>;
370 #address-cells = <1>;
371 #size-cells = <0>;
372
373 portf: gpio-port@5 {
374 compatible = "snps,dw-apb-gpio-port";
375 gpio-controller;
376 #gpio-cells = <2>;
377 snps,nr-gpios = <32>;
378 reg = <0>;
379 };
380 };
381 }; 352 };
382 353
383 chip: chip-control@ea0000 { 354 chip: chip-control@ea0000 {
@@ -466,6 +437,21 @@
466 ranges = <0 0xfc0000 0x10000>; 437 ranges = <0 0xfc0000 0x10000>;
467 interrupt-parent = <&sic>; 438 interrupt-parent = <&sic>;
468 439
440 sm_gpio1: gpio@5000 {
441 compatible = "snps,dw-apb-gpio";
442 reg = <0x5000 0x400>;
443 #address-cells = <1>;
444 #size-cells = <0>;
445
446 portf: gpio-port@5 {
447 compatible = "snps,dw-apb-gpio-port";
448 gpio-controller;
449 #gpio-cells = <2>;
450 snps,nr-gpios = <32>;
451 reg = <0>;
452 };
453 };
454
469 i2c2: i2c@7000 { 455 i2c2: i2c@7000 {
470 compatible = "snps,designware-i2c"; 456 compatible = "snps,designware-i2c";
471 #address-cells = <1>; 457 #address-cells = <1>;
@@ -516,6 +502,21 @@
516 status = "disabled"; 502 status = "disabled";
517 }; 503 };
518 504
505 sm_gpio0: gpio@c000 {
506 compatible = "snps,dw-apb-gpio";
507 reg = <0xc000 0x400>;
508 #address-cells = <1>;
509 #size-cells = <0>;
510
511 porte: gpio-port@4 {
512 compatible = "snps,dw-apb-gpio-port";
513 gpio-controller;
514 #gpio-cells = <2>;
515 snps,nr-gpios = <32>;
516 reg = <0>;
517 };
518 };
519
519 sysctrl: pin-controller@d000 { 520 sysctrl: pin-controller@d000 {
520 compatible = "marvell,berlin2q-system-ctrl"; 521 compatible = "marvell,berlin2q-system-ctrl";
521 reg = <0xd000 0x100>; 522 reg = <0xd000 0x100>;
diff --git a/arch/arm/boot/dts/dra7-evm.dts b/arch/arm/boot/dts/dra7-evm.dts
index 10b725c7bfc0..ad4118f7e1a6 100644
--- a/arch/arm/boot/dts/dra7-evm.dts
+++ b/arch/arm/boot/dts/dra7-evm.dts
@@ -499,23 +499,23 @@
499 }; 499 };
500 partition@5 { 500 partition@5 {
501 label = "QSPI.u-boot-spl-os"; 501 label = "QSPI.u-boot-spl-os";
502 reg = <0x00140000 0x00010000>; 502 reg = <0x00140000 0x00080000>;
503 }; 503 };
504 partition@6 { 504 partition@6 {
505 label = "QSPI.u-boot-env"; 505 label = "QSPI.u-boot-env";
506 reg = <0x00150000 0x00010000>; 506 reg = <0x001c0000 0x00010000>;
507 }; 507 };
508 partition@7 { 508 partition@7 {
509 label = "QSPI.u-boot-env.backup1"; 509 label = "QSPI.u-boot-env.backup1";
510 reg = <0x00160000 0x0010000>; 510 reg = <0x001d0000 0x0010000>;
511 }; 511 };
512 partition@8 { 512 partition@8 {
513 label = "QSPI.kernel"; 513 label = "QSPI.kernel";
514 reg = <0x00170000 0x0800000>; 514 reg = <0x001e0000 0x0800000>;
515 }; 515 };
516 partition@9 { 516 partition@9 {
517 label = "QSPI.file-system"; 517 label = "QSPI.file-system";
518 reg = <0x00970000 0x01690000>; 518 reg = <0x009e0000 0x01620000>;
519 }; 519 };
520 }; 520 };
521}; 521};
diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
index 22771bc1643a..63f8b007bdc5 100644
--- a/arch/arm/boot/dts/dra7.dtsi
+++ b/arch/arm/boot/dts/dra7.dtsi
@@ -1257,6 +1257,8 @@
1257 tx-fifo-resize; 1257 tx-fifo-resize;
1258 maximum-speed = "super-speed"; 1258 maximum-speed = "super-speed";
1259 dr_mode = "otg"; 1259 dr_mode = "otg";
1260 snps,dis_u3_susphy_quirk;
1261 snps,dis_u2_susphy_quirk;
1260 }; 1262 };
1261 }; 1263 };
1262 1264
@@ -1278,6 +1280,8 @@
1278 tx-fifo-resize; 1280 tx-fifo-resize;
1279 maximum-speed = "high-speed"; 1281 maximum-speed = "high-speed";
1280 dr_mode = "otg"; 1282 dr_mode = "otg";
1283 snps,dis_u3_susphy_quirk;
1284 snps,dis_u2_susphy_quirk;
1281 }; 1285 };
1282 }; 1286 };
1283 1287
@@ -1299,6 +1303,8 @@
1299 tx-fifo-resize; 1303 tx-fifo-resize;
1300 maximum-speed = "high-speed"; 1304 maximum-speed = "high-speed";
1301 dr_mode = "otg"; 1305 dr_mode = "otg";
1306 snps,dis_u3_susphy_quirk;
1307 snps,dis_u2_susphy_quirk;
1302 }; 1308 };
1303 }; 1309 };
1304 1310
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index 0a229fcd7acf..d75c89d7666a 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -736,7 +736,7 @@
736 736
737 dp_phy: video-phy@10040720 { 737 dp_phy: video-phy@10040720 {
738 compatible = "samsung,exynos5250-dp-video-phy"; 738 compatible = "samsung,exynos5250-dp-video-phy";
739 reg = <0x10040720 4>; 739 samsung,pmu-syscon = <&pmu_system_controller>;
740 #phy-cells = <0>; 740 #phy-cells = <0>;
741 }; 741 };
742 742
diff --git a/arch/arm/boot/dts/exynos5420-arndale-octa.dts b/arch/arm/boot/dts/exynos5420-arndale-octa.dts
index aa7a7d727a7e..db2c1c4cd900 100644
--- a/arch/arm/boot/dts/exynos5420-arndale-octa.dts
+++ b/arch/arm/boot/dts/exynos5420-arndale-octa.dts
@@ -372,3 +372,7 @@
372&usbdrd_dwc3_1 { 372&usbdrd_dwc3_1 {
373 dr_mode = "host"; 373 dr_mode = "host";
374}; 374};
375
376&cci {
377 status = "disabled";
378};
diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi
index 517e50f6760b..6d38f8bfd0e6 100644
--- a/arch/arm/boot/dts/exynos5420.dtsi
+++ b/arch/arm/boot/dts/exynos5420.dtsi
@@ -120,7 +120,7 @@
120 }; 120 };
121 }; 121 };
122 122
123 cci@10d20000 { 123 cci: cci@10d20000 {
124 compatible = "arm,cci-400"; 124 compatible = "arm,cci-400";
125 #address-cells = <1>; 125 #address-cells = <1>;
126 #size-cells = <1>; 126 #size-cells = <1>;
@@ -503,8 +503,8 @@
503 }; 503 };
504 504
505 dp_phy: video-phy@10040728 { 505 dp_phy: video-phy@10040728 {
506 compatible = "samsung,exynos5250-dp-video-phy"; 506 compatible = "samsung,exynos5420-dp-video-phy";
507 reg = <0x10040728 4>; 507 samsung,pmu-syscon = <&pmu_system_controller>;
508 #phy-cells = <0>; 508 #phy-cells = <0>;
509 }; 509 };
510 510
diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi
index 58d3c3cf2923..e4d3aecc4ed2 100644
--- a/arch/arm/boot/dts/imx25.dtsi
+++ b/arch/arm/boot/dts/imx25.dtsi
@@ -162,7 +162,7 @@
162 #size-cells = <0>; 162 #size-cells = <0>;
163 compatible = "fsl,imx25-cspi", "fsl,imx35-cspi"; 163 compatible = "fsl,imx25-cspi", "fsl,imx35-cspi";
164 reg = <0x43fa4000 0x4000>; 164 reg = <0x43fa4000 0x4000>;
165 clocks = <&clks 62>, <&clks 62>; 165 clocks = <&clks 78>, <&clks 78>;
166 clock-names = "ipg", "per"; 166 clock-names = "ipg", "per";
167 interrupts = <14>; 167 interrupts = <14>;
168 status = "disabled"; 168 status = "disabled";
@@ -369,7 +369,7 @@
369 compatible = "fsl,imx25-pwm", "fsl,imx27-pwm"; 369 compatible = "fsl,imx25-pwm", "fsl,imx27-pwm";
370 #pwm-cells = <2>; 370 #pwm-cells = <2>;
371 reg = <0x53fa0000 0x4000>; 371 reg = <0x53fa0000 0x4000>;
372 clocks = <&clks 106>, <&clks 36>; 372 clocks = <&clks 106>, <&clks 52>;
373 clock-names = "ipg", "per"; 373 clock-names = "ipg", "per";
374 interrupts = <36>; 374 interrupts = <36>;
375 }; 375 };
@@ -388,7 +388,7 @@
388 compatible = "fsl,imx25-pwm", "fsl,imx27-pwm"; 388 compatible = "fsl,imx25-pwm", "fsl,imx27-pwm";
389 #pwm-cells = <2>; 389 #pwm-cells = <2>;
390 reg = <0x53fa8000 0x4000>; 390 reg = <0x53fa8000 0x4000>;
391 clocks = <&clks 107>, <&clks 36>; 391 clocks = <&clks 107>, <&clks 52>;
392 clock-names = "ipg", "per"; 392 clock-names = "ipg", "per";
393 interrupts = <41>; 393 interrupts = <41>;
394 }; 394 };
@@ -429,7 +429,7 @@
429 pwm4: pwm@53fc8000 { 429 pwm4: pwm@53fc8000 {
430 compatible = "fsl,imx25-pwm", "fsl,imx27-pwm"; 430 compatible = "fsl,imx25-pwm", "fsl,imx27-pwm";
431 reg = <0x53fc8000 0x4000>; 431 reg = <0x53fc8000 0x4000>;
432 clocks = <&clks 108>, <&clks 36>; 432 clocks = <&clks 108>, <&clks 52>;
433 clock-names = "ipg", "per"; 433 clock-names = "ipg", "per";
434 interrupts = <42>; 434 interrupts = <42>;
435 }; 435 };
@@ -476,7 +476,7 @@
476 compatible = "fsl,imx25-pwm", "fsl,imx27-pwm"; 476 compatible = "fsl,imx25-pwm", "fsl,imx27-pwm";
477 #pwm-cells = <2>; 477 #pwm-cells = <2>;
478 reg = <0x53fe0000 0x4000>; 478 reg = <0x53fe0000 0x4000>;
479 clocks = <&clks 105>, <&clks 36>; 479 clocks = <&clks 105>, <&clks 52>;
480 clock-names = "ipg", "per"; 480 clock-names = "ipg", "per";
481 interrupts = <26>; 481 interrupts = <26>;
482 }; 482 };
diff --git a/arch/arm/boot/dts/imx51-babbage.dts b/arch/arm/boot/dts/imx51-babbage.dts
index 56569cecaa78..649befeb2cf9 100644
--- a/arch/arm/boot/dts/imx51-babbage.dts
+++ b/arch/arm/boot/dts/imx51-babbage.dts
@@ -127,24 +127,12 @@
127 #address-cells = <1>; 127 #address-cells = <1>;
128 #size-cells = <0>; 128 #size-cells = <0>;
129 129
130 reg_usbh1_vbus: regulator@0 { 130 reg_hub_reset: regulator@0 {
131 compatible = "regulator-fixed";
132 pinctrl-names = "default";
133 pinctrl-0 = <&pinctrl_usbh1reg>;
134 reg = <0>;
135 regulator-name = "usbh1_vbus";
136 regulator-min-microvolt = <5000000>;
137 regulator-max-microvolt = <5000000>;
138 gpio = <&gpio2 5 GPIO_ACTIVE_HIGH>;
139 enable-active-high;
140 };
141
142 reg_usbotg_vbus: regulator@1 {
143 compatible = "regulator-fixed"; 131 compatible = "regulator-fixed";
144 pinctrl-names = "default"; 132 pinctrl-names = "default";
145 pinctrl-0 = <&pinctrl_usbotgreg>; 133 pinctrl-0 = <&pinctrl_usbotgreg>;
146 reg = <1>; 134 reg = <0>;
147 regulator-name = "usbotg_vbus"; 135 regulator-name = "hub_reset";
148 regulator-min-microvolt = <5000000>; 136 regulator-min-microvolt = <5000000>;
149 regulator-max-microvolt = <5000000>; 137 regulator-max-microvolt = <5000000>;
150 gpio = <&gpio1 7 GPIO_ACTIVE_HIGH>; 138 gpio = <&gpio1 7 GPIO_ACTIVE_HIGH>;
@@ -176,6 +164,7 @@
176 reg = <0>; 164 reg = <0>;
177 clocks = <&clks IMX5_CLK_DUMMY>; 165 clocks = <&clks IMX5_CLK_DUMMY>;
178 clock-names = "main_clk"; 166 clock-names = "main_clk";
167 reset-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
179 }; 168 };
180 }; 169 };
181}; 170};
@@ -419,7 +408,7 @@
419&usbh1 { 408&usbh1 {
420 pinctrl-names = "default"; 409 pinctrl-names = "default";
421 pinctrl-0 = <&pinctrl_usbh1>; 410 pinctrl-0 = <&pinctrl_usbh1>;
422 vbus-supply = <&reg_usbh1_vbus>; 411 vbus-supply = <&reg_hub_reset>;
423 fsl,usbphy = <&usbh1phy>; 412 fsl,usbphy = <&usbh1phy>;
424 phy_type = "ulpi"; 413 phy_type = "ulpi";
425 status = "okay"; 414 status = "okay";
@@ -429,7 +418,6 @@
429 dr_mode = "otg"; 418 dr_mode = "otg";
430 disable-over-current; 419 disable-over-current;
431 phy_type = "utmi_wide"; 420 phy_type = "utmi_wide";
432 vbus-supply = <&reg_usbotg_vbus>;
433 status = "okay"; 421 status = "okay";
434}; 422};
435 423
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 4fc03b7f1cee..2109d0763c1b 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -335,8 +335,8 @@
335 vpu: vpu@02040000 { 335 vpu: vpu@02040000 {
336 compatible = "cnm,coda960"; 336 compatible = "cnm,coda960";
337 reg = <0x02040000 0x3c000>; 337 reg = <0x02040000 0x3c000>;
338 interrupts = <0 3 IRQ_TYPE_LEVEL_HIGH>, 338 interrupts = <0 12 IRQ_TYPE_LEVEL_HIGH>,
339 <0 12 IRQ_TYPE_LEVEL_HIGH>; 339 <0 3 IRQ_TYPE_LEVEL_HIGH>;
340 interrupt-names = "bit", "jpeg"; 340 interrupt-names = "bit", "jpeg";
341 clocks = <&clks IMX6QDL_CLK_VPU_AXI>, 341 clocks = <&clks IMX6QDL_CLK_VPU_AXI>,
342 <&clks IMX6QDL_CLK_MMDC_CH0_AXI>, 342 <&clks IMX6QDL_CLK_MMDC_CH0_AXI>,
diff --git a/arch/arm/boot/dts/imx6sx-sdb.dts b/arch/arm/boot/dts/imx6sx-sdb.dts
index 1e6e5cc1c14c..8c1febd7e3f2 100644
--- a/arch/arm/boot/dts/imx6sx-sdb.dts
+++ b/arch/arm/boot/dts/imx6sx-sdb.dts
@@ -159,13 +159,28 @@
159 pinctrl-0 = <&pinctrl_enet1>; 159 pinctrl-0 = <&pinctrl_enet1>;
160 phy-supply = <&reg_enet_3v3>; 160 phy-supply = <&reg_enet_3v3>;
161 phy-mode = "rgmii"; 161 phy-mode = "rgmii";
162 phy-handle = <&ethphy1>;
162 status = "okay"; 163 status = "okay";
164
165 mdio {
166 #address-cells = <1>;
167 #size-cells = <0>;
168
169 ethphy1: ethernet-phy@0 {
170 reg = <0>;
171 };
172
173 ethphy2: ethernet-phy@1 {
174 reg = <1>;
175 };
176 };
163}; 177};
164 178
165&fec2 { 179&fec2 {
166 pinctrl-names = "default"; 180 pinctrl-names = "default";
167 pinctrl-0 = <&pinctrl_enet2>; 181 pinctrl-0 = <&pinctrl_enet2>;
168 phy-mode = "rgmii"; 182 phy-mode = "rgmii";
183 phy-handle = <&ethphy2>;
169 status = "okay"; 184 status = "okay";
170}; 185};
171 186
diff --git a/arch/arm/boot/dts/ls1021a.dtsi b/arch/arm/boot/dts/ls1021a.dtsi
index 657da14cb4b5..c70bb27ac65a 100644
--- a/arch/arm/boot/dts/ls1021a.dtsi
+++ b/arch/arm/boot/dts/ls1021a.dtsi
@@ -142,6 +142,7 @@
142 scfg: scfg@1570000 { 142 scfg: scfg@1570000 {
143 compatible = "fsl,ls1021a-scfg", "syscon"; 143 compatible = "fsl,ls1021a-scfg", "syscon";
144 reg = <0x0 0x1570000 0x0 0x10000>; 144 reg = <0x0 0x1570000 0x0 0x10000>;
145 big-endian;
145 }; 146 };
146 147
147 clockgen: clocking@1ee1000 { 148 clockgen: clocking@1ee1000 {
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts
index 53f3ca064140..b550c41b46f1 100644
--- a/arch/arm/boot/dts/omap3-n900.dts
+++ b/arch/arm/boot/dts/omap3-n900.dts
@@ -700,11 +700,9 @@
700 }; 700 };
701 }; 701 };
702 702
703 /* Ethernet is on some early development boards and qemu */
703 ethernet@gpmc { 704 ethernet@gpmc {
704 compatible = "smsc,lan91c94"; 705 compatible = "smsc,lan91c94";
705
706 status = "disabled";
707
708 interrupt-parent = <&gpio2>; 706 interrupt-parent = <&gpio2>;
709 interrupts = <22 IRQ_TYPE_LEVEL_HIGH>; /* gpio54 */ 707 interrupts = <22 IRQ_TYPE_LEVEL_HIGH>; /* gpio54 */
710 reg = <1 0x300 0xf>; /* 16 byte IO range at offset 0x300 */ 708 reg = <1 0x300 0xf>; /* 16 byte IO range at offset 0x300 */
diff --git a/arch/arm/boot/dts/rk3288-evb.dtsi b/arch/arm/boot/dts/rk3288-evb.dtsi
index 3e067dd65d0c..6194d673e80b 100644
--- a/arch/arm/boot/dts/rk3288-evb.dtsi
+++ b/arch/arm/boot/dts/rk3288-evb.dtsi
@@ -155,6 +155,15 @@
155}; 155};
156 156
157&pinctrl { 157&pinctrl {
158 pcfg_pull_none_drv_8ma: pcfg-pull-none-drv-8ma {
159 drive-strength = <8>;
160 };
161
162 pcfg_pull_up_drv_8ma: pcfg-pull-up-drv-8ma {
163 bias-pull-up;
164 drive-strength = <8>;
165 };
166
158 backlight { 167 backlight {
159 bl_en: bl-en { 168 bl_en: bl-en {
160 rockchip,pins = <7 2 RK_FUNC_GPIO &pcfg_pull_none>; 169 rockchip,pins = <7 2 RK_FUNC_GPIO &pcfg_pull_none>;
@@ -173,6 +182,27 @@
173 }; 182 };
174 }; 183 };
175 184
185 sdmmc {
186 /*
187 * Default drive strength isn't enough to achieve even
188 * high-speed mode on EVB board so bump up to 8ma.
189 */
190 sdmmc_bus4: sdmmc-bus4 {
191 rockchip,pins = <6 16 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
192 <6 17 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
193 <6 18 RK_FUNC_1 &pcfg_pull_up_drv_8ma>,
194 <6 19 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
195 };
196
197 sdmmc_clk: sdmmc-clk {
198 rockchip,pins = <6 20 RK_FUNC_1 &pcfg_pull_none_drv_8ma>;
199 };
200
201 sdmmc_cmd: sdmmc-cmd {
202 rockchip,pins = <6 21 RK_FUNC_1 &pcfg_pull_up_drv_8ma>;
203 };
204 };
205
176 usb { 206 usb {
177 host_vbus_drv: host-vbus-drv { 207 host_vbus_drv: host-vbus-drv {
178 rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>; 208 rockchip,pins = <0 14 RK_FUNC_GPIO &pcfg_pull_none>;
diff --git a/arch/arm/boot/dts/sama5d3xmb.dtsi b/arch/arm/boot/dts/sama5d3xmb.dtsi
index 49c10d33df30..77e03655aca3 100644
--- a/arch/arm/boot/dts/sama5d3xmb.dtsi
+++ b/arch/arm/boot/dts/sama5d3xmb.dtsi
@@ -176,7 +176,7 @@
176 "Headphone Jack", "HPOUTR", 176 "Headphone Jack", "HPOUTR",
177 "IN2L", "Line In Jack", 177 "IN2L", "Line In Jack",
178 "IN2R", "Line In Jack", 178 "IN2R", "Line In Jack",
179 "MICBIAS", "IN1L", 179 "Mic", "MICBIAS",
180 "IN1L", "Mic"; 180 "IN1L", "Mic";
181 181
182 atmel,ssc-controller = <&ssc0>; 182 atmel,ssc-controller = <&ssc0>;
diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi
index 1b0f30c2c4a5..b94995d1889f 100644
--- a/arch/arm/boot/dts/sama5d4.dtsi
+++ b/arch/arm/boot/dts/sama5d4.dtsi
@@ -1008,7 +1008,7 @@
1008 1008
1009 pit: timer@fc068630 { 1009 pit: timer@fc068630 {
1010 compatible = "atmel,at91sam9260-pit"; 1010 compatible = "atmel,at91sam9260-pit";
1011 reg = <0xfc068630 0xf>; 1011 reg = <0xfc068630 0x10>;
1012 interrupts = <3 IRQ_TYPE_LEVEL_HIGH 5>; 1012 interrupts = <3 IRQ_TYPE_LEVEL_HIGH 5>;
1013 clocks = <&h32ck>; 1013 clocks = <&h32ck>;
1014 }; 1014 };
diff --git a/arch/arm/boot/dts/ste-nomadik-nhk15.dts b/arch/arm/boot/dts/ste-nomadik-nhk15.dts
index a8c00ee7522a..3d0b8755caee 100644
--- a/arch/arm/boot/dts/ste-nomadik-nhk15.dts
+++ b/arch/arm/boot/dts/ste-nomadik-nhk15.dts
@@ -25,11 +25,11 @@
25 stmpe2401_1 { 25 stmpe2401_1 {
26 stmpe2401_1_nhk_mode: stmpe2401_1_nhk { 26 stmpe2401_1_nhk_mode: stmpe2401_1_nhk {
27 nhk_cfg1 { 27 nhk_cfg1 {
28 ste,pins = "GPIO76_B20"; // IRQ line 28 pins = "GPIO76_B20"; // IRQ line
29 ste,input = <0>; 29 ste,input = <0>;
30 }; 30 };
31 nhk_cfg2 { 31 nhk_cfg2 {
32 ste,pins = "GPIO77_B8"; // reset line 32 pins = "GPIO77_B8"; // reset line
33 ste,output = <1>; 33 ste,output = <1>;
34 }; 34 };
35 }; 35 };
@@ -37,11 +37,11 @@
37 stmpe2401_2 { 37 stmpe2401_2 {
38 stmpe2401_2_nhk_mode: stmpe2401_2_nhk { 38 stmpe2401_2_nhk_mode: stmpe2401_2_nhk {
39 nhk_cfg1 { 39 nhk_cfg1 {
40 ste,pins = "GPIO78_A8"; // IRQ line 40 pins = "GPIO78_A8"; // IRQ line
41 ste,input = <0>; 41 ste,input = <0>;
42 }; 42 };
43 nhk_cfg2 { 43 nhk_cfg2 {
44 ste,pins = "GPIO79_C9"; // reset line 44 pins = "GPIO79_C9"; // reset line
45 ste,output = <1>; 45 ste,output = <1>;
46 }; 46 };
47 }; 47 };
diff --git a/arch/arm/boot/dts/tegra20-seaboard.dts b/arch/arm/boot/dts/tegra20-seaboard.dts
index ea282c7c0ca5..e2fed2712249 100644
--- a/arch/arm/boot/dts/tegra20-seaboard.dts
+++ b/arch/arm/boot/dts/tegra20-seaboard.dts
@@ -406,7 +406,7 @@
406 clock-frequency = <400000>; 406 clock-frequency = <400000>;
407 407
408 magnetometer@c { 408 magnetometer@c {
409 compatible = "ak,ak8975"; 409 compatible = "asahi-kasei,ak8975";
410 reg = <0xc>; 410 reg = <0xc>;
411 interrupt-parent = <&gpio>; 411 interrupt-parent = <&gpio>;
412 interrupts = <TEGRA_GPIO(N, 5) IRQ_TYPE_LEVEL_HIGH>; 412 interrupts = <TEGRA_GPIO(N, 5) IRQ_TYPE_LEVEL_HIGH>;
diff --git a/arch/arm/boot/dts/vf610-twr.dts b/arch/arm/boot/dts/vf610-twr.dts
index a0f762159cb2..f2b64b1b00fa 100644
--- a/arch/arm/boot/dts/vf610-twr.dts
+++ b/arch/arm/boot/dts/vf610-twr.dts
@@ -129,13 +129,28 @@
129 129
130&fec0 { 130&fec0 {
131 phy-mode = "rmii"; 131 phy-mode = "rmii";
132 phy-handle = <&ethphy0>;
132 pinctrl-names = "default"; 133 pinctrl-names = "default";
133 pinctrl-0 = <&pinctrl_fec0>; 134 pinctrl-0 = <&pinctrl_fec0>;
134 status = "okay"; 135 status = "okay";
136
137 mdio {
138 #address-cells = <1>;
139 #size-cells = <0>;
140
141 ethphy0: ethernet-phy@0 {
142 reg = <0>;
143 };
144
145 ethphy1: ethernet-phy@1 {
146 reg = <1>;
147 };
148 };
135}; 149};
136 150
137&fec1 { 151&fec1 {
138 phy-mode = "rmii"; 152 phy-mode = "rmii";
153 phy-handle = <&ethphy1>;
139 pinctrl-names = "default"; 154 pinctrl-names = "default";
140 pinctrl-0 = <&pinctrl_fec1>; 155 pinctrl-0 = <&pinctrl_fec1>;
141 status = "okay"; 156 status = "okay";
diff --git a/arch/arm/configs/exynos_defconfig b/arch/arm/configs/exynos_defconfig
index 5ef14de00a29..3d0c5d65c741 100644
--- a/arch/arm/configs/exynos_defconfig
+++ b/arch/arm/configs/exynos_defconfig
@@ -84,7 +84,8 @@ CONFIG_DEBUG_GPIO=y
84CONFIG_POWER_SUPPLY=y 84CONFIG_POWER_SUPPLY=y
85CONFIG_BATTERY_SBS=y 85CONFIG_BATTERY_SBS=y
86CONFIG_CHARGER_TPS65090=y 86CONFIG_CHARGER_TPS65090=y
87# CONFIG_HWMON is not set 87CONFIG_HWMON=y
88CONFIG_SENSORS_LM90=y
88CONFIG_THERMAL=y 89CONFIG_THERMAL=y
89CONFIG_EXYNOS_THERMAL=y 90CONFIG_EXYNOS_THERMAL=y
90CONFIG_EXYNOS_THERMAL_CORE=y 91CONFIG_EXYNOS_THERMAL_CORE=y
@@ -109,11 +110,26 @@ CONFIG_REGULATOR_S2MPA01=y
109CONFIG_REGULATOR_S2MPS11=y 110CONFIG_REGULATOR_S2MPS11=y
110CONFIG_REGULATOR_S5M8767=y 111CONFIG_REGULATOR_S5M8767=y
111CONFIG_REGULATOR_TPS65090=y 112CONFIG_REGULATOR_TPS65090=y
113CONFIG_DRM=y
114CONFIG_DRM_BRIDGE=y
115CONFIG_DRM_PTN3460=y
116CONFIG_DRM_PS8622=y
117CONFIG_DRM_EXYNOS=y
118CONFIG_DRM_EXYNOS_FIMD=y
119CONFIG_DRM_EXYNOS_DP=y
120CONFIG_DRM_PANEL=y
121CONFIG_DRM_PANEL_SIMPLE=y
112CONFIG_FB=y 122CONFIG_FB=y
113CONFIG_FB_MODE_HELPERS=y 123CONFIG_FB_MODE_HELPERS=y
114CONFIG_FB_SIMPLE=y 124CONFIG_FB_SIMPLE=y
115CONFIG_EXYNOS_VIDEO=y 125CONFIG_EXYNOS_VIDEO=y
116CONFIG_EXYNOS_MIPI_DSI=y 126CONFIG_EXYNOS_MIPI_DSI=y
127CONFIG_BACKLIGHT_LCD_SUPPORT=y
128CONFIG_LCD_CLASS_DEVICE=y
129CONFIG_LCD_PLATFORM=y
130CONFIG_BACKLIGHT_CLASS_DEVICE=y
131CONFIG_BACKLIGHT_GENERIC=y
132CONFIG_BACKLIGHT_PWM=y
117CONFIG_FRAMEBUFFER_CONSOLE=y 133CONFIG_FRAMEBUFFER_CONSOLE=y
118CONFIG_FONTS=y 134CONFIG_FONTS=y
119CONFIG_FONT_7x14=y 135CONFIG_FONT_7x14=y
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 2328fe752e9c..bc393b7e5ece 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -338,6 +338,7 @@ CONFIG_USB=y
338CONFIG_USB_XHCI_HCD=y 338CONFIG_USB_XHCI_HCD=y
339CONFIG_USB_XHCI_MVEBU=y 339CONFIG_USB_XHCI_MVEBU=y
340CONFIG_USB_EHCI_HCD=y 340CONFIG_USB_EHCI_HCD=y
341CONFIG_USB_EHCI_EXYNOS=y
341CONFIG_USB_EHCI_TEGRA=y 342CONFIG_USB_EHCI_TEGRA=y
342CONFIG_USB_EHCI_HCD_STI=y 343CONFIG_USB_EHCI_HCD_STI=y
343CONFIG_USB_EHCI_HCD_PLATFORM=y 344CONFIG_USB_EHCI_HCD_PLATFORM=y
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index c2c3a852af9f..667d9d52aa01 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -68,7 +68,7 @@ CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
68CONFIG_CPU_FREQ_GOV_POWERSAVE=y 68CONFIG_CPU_FREQ_GOV_POWERSAVE=y
69CONFIG_CPU_FREQ_GOV_USERSPACE=y 69CONFIG_CPU_FREQ_GOV_USERSPACE=y
70CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y 70CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
71CONFIG_GENERIC_CPUFREQ_CPU0=y 71CONFIG_CPUFREQ_DT=y
72# CONFIG_ARM_OMAP2PLUS_CPUFREQ is not set 72# CONFIG_ARM_OMAP2PLUS_CPUFREQ is not set
73CONFIG_CPU_IDLE=y 73CONFIG_CPU_IDLE=y
74CONFIG_BINFMT_MISC=y 74CONFIG_BINFMT_MISC=y
diff --git a/arch/arm/include/uapi/asm/unistd.h b/arch/arm/include/uapi/asm/unistd.h
index 705bb7620673..0c3f5a0dafd3 100644
--- a/arch/arm/include/uapi/asm/unistd.h
+++ b/arch/arm/include/uapi/asm/unistd.h
@@ -413,6 +413,7 @@
413#define __NR_getrandom (__NR_SYSCALL_BASE+384) 413#define __NR_getrandom (__NR_SYSCALL_BASE+384)
414#define __NR_memfd_create (__NR_SYSCALL_BASE+385) 414#define __NR_memfd_create (__NR_SYSCALL_BASE+385)
415#define __NR_bpf (__NR_SYSCALL_BASE+386) 415#define __NR_bpf (__NR_SYSCALL_BASE+386)
416#define __NR_execveat (__NR_SYSCALL_BASE+387)
416 417
417/* 418/*
418 * The following SWIs are ARM private. 419 * The following SWIs are ARM private.
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index e51833f8cc38..05745eb838c5 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -396,6 +396,7 @@
396 CALL(sys_getrandom) 396 CALL(sys_getrandom)
397/* 385 */ CALL(sys_memfd_create) 397/* 385 */ CALL(sys_memfd_create)
398 CALL(sys_bpf) 398 CALL(sys_bpf)
399 CALL(sys_execveat)
399#ifndef syscalls_counted 400#ifndef syscalls_counted
400.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls 401.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls
401#define syscalls_counted 402#define syscalls_counted
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
index 4176df721bf0..1a0045abead7 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
@@ -253,21 +253,22 @@
253 .endm 253 .endm
254 254
255 .macro restore_user_regs, fast = 0, offset = 0 255 .macro restore_user_regs, fast = 0, offset = 0
256 ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr 256 mov r2, sp
257 ldr lr, [sp, #\offset + S_PC]! @ get pc 257 ldr r1, [r2, #\offset + S_PSR] @ get calling cpsr
258 ldr lr, [r2, #\offset + S_PC]! @ get pc
258 msr spsr_cxsf, r1 @ save in spsr_svc 259 msr spsr_cxsf, r1 @ save in spsr_svc
259#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_32v6K) 260#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_32v6K)
260 @ We must avoid clrex due to Cortex-A15 erratum #830321 261 @ We must avoid clrex due to Cortex-A15 erratum #830321
261 strex r1, r2, [sp] @ clear the exclusive monitor 262 strex r1, r2, [r2] @ clear the exclusive monitor
262#endif 263#endif
263 .if \fast 264 .if \fast
264 ldmdb sp, {r1 - lr}^ @ get calling r1 - lr 265 ldmdb r2, {r1 - lr}^ @ get calling r1 - lr
265 .else 266 .else
266 ldmdb sp, {r0 - lr}^ @ get calling r0 - lr 267 ldmdb r2, {r0 - lr}^ @ get calling r0 - lr
267 .endif 268 .endif
268 mov r0, r0 @ ARMv5T and earlier require a nop 269 mov r0, r0 @ ARMv5T and earlier require a nop
269 @ after ldm {}^ 270 @ after ldm {}^
270 add sp, sp, #S_FRAME_SIZE - S_PC 271 add sp, sp, #\offset + S_FRAME_SIZE
271 movs pc, lr @ return & move spsr_svc into cpsr 272 movs pc, lr @ return & move spsr_svc into cpsr
272 .endm 273 .endm
273 274
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index f7c65adaa428..557e128e4df0 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -116,8 +116,14 @@ int armpmu_event_set_period(struct perf_event *event)
116 ret = 1; 116 ret = 1;
117 } 117 }
118 118
119 if (left > (s64)armpmu->max_period) 119 /*
120 left = armpmu->max_period; 120 * Limit the maximum period to prevent the counter value
121 * from overtaking the one we are about to program. In
122 * effect we are reducing max_period to account for
123 * interrupt latency (and we are being very conservative).
124 */
125 if (left > (armpmu->max_period >> 1))
126 left = armpmu->max_period >> 1;
121 127
122 local64_set(&hwc->prev_count, (u64)-left); 128 local64_set(&hwc->prev_count, (u64)-left);
123 129
diff --git a/arch/arm/kernel/perf_regs.c b/arch/arm/kernel/perf_regs.c
index 6e4379c67cbc..592dda3f21ff 100644
--- a/arch/arm/kernel/perf_regs.c
+++ b/arch/arm/kernel/perf_regs.c
@@ -28,3 +28,11 @@ u64 perf_reg_abi(struct task_struct *task)
28{ 28{
29 return PERF_SAMPLE_REGS_ABI_32; 29 return PERF_SAMPLE_REGS_ABI_32;
30} 30}
31
32void perf_get_regs_user(struct perf_regs *regs_user,
33 struct pt_regs *regs,
34 struct pt_regs *regs_user_copy)
35{
36 regs_user->regs = task_pt_regs(current);
37 regs_user->abi = perf_reg_abi(current);
38}
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index f9c863911038..e55408e96559 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -657,10 +657,13 @@ int __init arm_add_memory(u64 start, u64 size)
657 657
658 /* 658 /*
659 * Ensure that start/size are aligned to a page boundary. 659 * Ensure that start/size are aligned to a page boundary.
660 * Size is appropriately rounded down, start is rounded up. 660 * Size is rounded down, start is rounded up.
661 */ 661 */
662 size -= start & ~PAGE_MASK;
663 aligned_start = PAGE_ALIGN(start); 662 aligned_start = PAGE_ALIGN(start);
663 if (aligned_start > start + size)
664 size = 0;
665 else
666 size -= aligned_start - start;
664 667
665#ifndef CONFIG_ARCH_PHYS_ADDR_T_64BIT 668#ifndef CONFIG_ARCH_PHYS_ADDR_T_64BIT
666 if (aligned_start > ULONG_MAX) { 669 if (aligned_start > ULONG_MAX) {
@@ -1046,6 +1049,15 @@ static int c_show(struct seq_file *m, void *v)
1046 seq_printf(m, "model name\t: %s rev %d (%s)\n", 1049 seq_printf(m, "model name\t: %s rev %d (%s)\n",
1047 cpu_name, cpuid & 15, elf_platform); 1050 cpu_name, cpuid & 15, elf_platform);
1048 1051
1052#if defined(CONFIG_SMP)
1053 seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
1054 per_cpu(cpu_data, i).loops_per_jiffy / (500000UL/HZ),
1055 (per_cpu(cpu_data, i).loops_per_jiffy / (5000UL/HZ)) % 100);
1056#else
1057 seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
1058 loops_per_jiffy / (500000/HZ),
1059 (loops_per_jiffy / (5000/HZ)) % 100);
1060#endif
1049 /* dump out the processor features */ 1061 /* dump out the processor features */
1050 seq_puts(m, "Features\t: "); 1062 seq_puts(m, "Features\t: ");
1051 1063
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 5e6052e18850..86ef244c5a24 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -387,6 +387,18 @@ asmlinkage void secondary_start_kernel(void)
387 387
388void __init smp_cpus_done(unsigned int max_cpus) 388void __init smp_cpus_done(unsigned int max_cpus)
389{ 389{
390 int cpu;
391 unsigned long bogosum = 0;
392
393 for_each_online_cpu(cpu)
394 bogosum += per_cpu(cpu_data, cpu).loops_per_jiffy;
395
396 printk(KERN_INFO "SMP: Total of %d processors activated "
397 "(%lu.%02lu BogoMIPS).\n",
398 num_online_cpus(),
399 bogosum / (500000/HZ),
400 (bogosum / (5000/HZ)) % 100);
401
390 hyp_mode_check(); 402 hyp_mode_check();
391} 403}
392 404
diff --git a/arch/arm/mach-at91/board-dt-sama5.c b/arch/arm/mach-at91/board-dt-sama5.c
index 8fb9ef5333f1..97f7367d32b8 100644
--- a/arch/arm/mach-at91/board-dt-sama5.c
+++ b/arch/arm/mach-at91/board-dt-sama5.c
@@ -17,6 +17,7 @@
17#include <linux/of_platform.h> 17#include <linux/of_platform.h>
18#include <linux/phy.h> 18#include <linux/phy.h>
19#include <linux/clk-provider.h> 19#include <linux/clk-provider.h>
20#include <linux/phy.h>
20 21
21#include <asm/setup.h> 22#include <asm/setup.h>
22#include <asm/irq.h> 23#include <asm/irq.h>
@@ -26,8 +27,25 @@
26 27
27#include "generic.h" 28#include "generic.h"
28 29
30static int ksz8081_phy_fixup(struct phy_device *phy)
31{
32 int value;
33
34 value = phy_read(phy, 0x16);
35 value &= ~0x20;
36 phy_write(phy, 0x16, value);
37
38 return 0;
39}
40
29static void __init sama5_dt_device_init(void) 41static void __init sama5_dt_device_init(void)
30{ 42{
43 if (of_machine_is_compatible("atmel,sama5d4ek") &&
44 IS_ENABLED(CONFIG_PHYLIB)) {
45 phy_register_fixup_for_id("fc028000.etherne:00",
46 ksz8081_phy_fixup);
47 }
48
31 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 49 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
32} 50}
33 51
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
index 5951660d1bd2..2daef619d053 100644
--- a/arch/arm/mach-imx/clk-imx6q.c
+++ b/arch/arm/mach-imx/clk-imx6q.c
@@ -144,7 +144,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
144 post_div_table[1].div = 1; 144 post_div_table[1].div = 1;
145 post_div_table[2].div = 1; 145 post_div_table[2].div = 1;
146 video_div_table[1].div = 1; 146 video_div_table[1].div = 1;
147 video_div_table[2].div = 1; 147 video_div_table[3].div = 1;
148 } 148 }
149 149
150 clk[IMX6QDL_PLL1_BYPASS_SRC] = imx_clk_mux("pll1_bypass_src", base + 0x00, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); 150 clk[IMX6QDL_PLL1_BYPASS_SRC] = imx_clk_mux("pll1_bypass_src", base + 0x00, 14, 2, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
diff --git a/arch/arm/mach-imx/clk-imx6sx.c b/arch/arm/mach-imx/clk-imx6sx.c
index 17354a11356f..5a3e5a159e70 100644
--- a/arch/arm/mach-imx/clk-imx6sx.c
+++ b/arch/arm/mach-imx/clk-imx6sx.c
@@ -558,6 +558,9 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node)
558 clk_set_parent(clks[IMX6SX_CLK_GPU_CORE_SEL], clks[IMX6SX_CLK_PLL3_PFD0]); 558 clk_set_parent(clks[IMX6SX_CLK_GPU_CORE_SEL], clks[IMX6SX_CLK_PLL3_PFD0]);
559 clk_set_parent(clks[IMX6SX_CLK_GPU_AXI_SEL], clks[IMX6SX_CLK_PLL3_PFD0]); 559 clk_set_parent(clks[IMX6SX_CLK_GPU_AXI_SEL], clks[IMX6SX_CLK_PLL3_PFD0]);
560 560
561 clk_set_parent(clks[IMX6SX_CLK_QSPI1_SEL], clks[IMX6SX_CLK_PLL2_BUS]);
562 clk_set_parent(clks[IMX6SX_CLK_QSPI2_SEL], clks[IMX6SX_CLK_PLL2_BUS]);
563
561 /* Set initial power mode */ 564 /* Set initial power mode */
562 imx6q_set_lpm(WAIT_CLOCKED); 565 imx6q_set_lpm(WAIT_CLOCKED);
563} 566}
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c
index 3585cb394e9b..caa21e9b8cd9 100644
--- a/arch/arm/mach-mvebu/coherency.c
+++ b/arch/arm/mach-mvebu/coherency.c
@@ -246,9 +246,14 @@ static int coherency_type(void)
246 return type; 246 return type;
247} 247}
248 248
249/*
250 * As a precaution, we currently completely disable hardware I/O
251 * coherency, until enough testing is done with automatic I/O
252 * synchronization barriers to validate that it is a proper solution.
253 */
249int coherency_available(void) 254int coherency_available(void)
250{ 255{
251 return coherency_type() != COHERENCY_FABRIC_TYPE_NONE; 256 return false;
252} 257}
253 258
254int __init coherency_init(void) 259int __init coherency_init(void)
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 608079a1aba6..b61c049f92d6 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -77,6 +77,24 @@ MACHINE_END
77#endif 77#endif
78 78
79#ifdef CONFIG_ARCH_OMAP3 79#ifdef CONFIG_ARCH_OMAP3
80/* Some boards need board name for legacy userspace in /proc/cpuinfo */
81static const char *const n900_boards_compat[] __initconst = {
82 "nokia,omap3-n900",
83 NULL,
84};
85
86DT_MACHINE_START(OMAP3_N900_DT, "Nokia RX-51 board")
87 .reserve = omap_reserve,
88 .map_io = omap3_map_io,
89 .init_early = omap3430_init_early,
90 .init_machine = omap_generic_init,
91 .init_late = omap3_init_late,
92 .init_time = omap3_sync32k_timer_init,
93 .dt_compat = n900_boards_compat,
94 .restart = omap3xxx_restart,
95MACHINE_END
96
97/* Generic omap3 boards, most boards can use these */
80static const char *const omap3_boards_compat[] __initconst = { 98static const char *const omap3_boards_compat[] __initconst = {
81 "ti,omap3430", 99 "ti,omap3430",
82 "ti,omap3", 100 "ti,omap3",
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 377eea849e7b..64e44d6d07c0 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -211,6 +211,7 @@ extern struct device *omap2_get_iva_device(void);
211extern struct device *omap2_get_l3_device(void); 211extern struct device *omap2_get_l3_device(void);
212extern struct device *omap4_get_dsp_device(void); 212extern struct device *omap4_get_dsp_device(void);
213 213
214unsigned int omap4_xlate_irq(unsigned int hwirq);
214void omap_gic_of_init(void); 215void omap_gic_of_init(void);
215 216
216#ifdef CONFIG_CACHE_L2X0 217#ifdef CONFIG_CACHE_L2X0
@@ -249,6 +250,7 @@ extern void omap4_cpu_die(unsigned int cpu);
249extern struct smp_operations omap4_smp_ops; 250extern struct smp_operations omap4_smp_ops;
250 251
251extern void omap5_secondary_startup(void); 252extern void omap5_secondary_startup(void);
253extern void omap5_secondary_hyp_startup(void);
252#endif 254#endif
253 255
254#if defined(CONFIG_SMP) && defined(CONFIG_PM) 256#if defined(CONFIG_SMP) && defined(CONFIG_PM)
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index a3c013345c45..a80ac2d70bb1 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -286,6 +286,10 @@
286#define OMAP5XXX_CONTROL_STATUS 0x134 286#define OMAP5XXX_CONTROL_STATUS 0x134
287#define OMAP5_DEVICETYPE_MASK (0x7 << 6) 287#define OMAP5_DEVICETYPE_MASK (0x7 << 6)
288 288
289/* DRA7XX CONTROL CORE BOOTSTRAP */
290#define DRA7_CTRL_CORE_BOOTSTRAP 0x6c4
291#define DRA7_SPEEDSELECT_MASK (0x3 << 8)
292
289/* 293/*
290 * REVISIT: This list of registers is not comprehensive - there are more 294 * REVISIT: This list of registers is not comprehensive - there are more
291 * that should be added. 295 * that should be added.
diff --git a/arch/arm/mach-omap2/omap-headsmp.S b/arch/arm/mach-omap2/omap-headsmp.S
index 4993d4bfe9b2..6d1dffca6c7b 100644
--- a/arch/arm/mach-omap2/omap-headsmp.S
+++ b/arch/arm/mach-omap2/omap-headsmp.S
@@ -22,6 +22,7 @@
22 22
23/* Physical address needed since MMU not enabled yet on secondary core */ 23/* Physical address needed since MMU not enabled yet on secondary core */
24#define AUX_CORE_BOOT0_PA 0x48281800 24#define AUX_CORE_BOOT0_PA 0x48281800
25#define API_HYP_ENTRY 0x102
25 26
26/* 27/*
27 * OMAP5 specific entry point for secondary CPU to jump from ROM 28 * OMAP5 specific entry point for secondary CPU to jump from ROM
@@ -41,6 +42,26 @@ wait: ldr r2, =AUX_CORE_BOOT0_PA @ read from AuxCoreBoot0
41 b secondary_startup 42 b secondary_startup
42ENDPROC(omap5_secondary_startup) 43ENDPROC(omap5_secondary_startup)
43/* 44/*
45 * Same as omap5_secondary_startup except we call into the ROM to
46 * enable HYP mode first. This is called instead of
47 * omap5_secondary_startup if the primary CPU was put into HYP mode by
48 * the boot loader.
49 */
50ENTRY(omap5_secondary_hyp_startup)
51wait_2: ldr r2, =AUX_CORE_BOOT0_PA @ read from AuxCoreBoot0
52 ldr r0, [r2]
53 mov r0, r0, lsr #5
54 mrc p15, 0, r4, c0, c0, 5
55 and r4, r4, #0x0f
56 cmp r0, r4
57 bne wait_2
58 ldr r12, =API_HYP_ENTRY
59 adr r0, hyp_boot
60 smc #0
61hyp_boot:
62 b secondary_startup
63ENDPROC(omap5_secondary_hyp_startup)
64/*
44 * OMAP4 specific entry point for secondary CPU to jump from ROM 65 * OMAP4 specific entry point for secondary CPU to jump from ROM
45 * code. This routine also provides a holding flag into which 66 * code. This routine also provides a holding flag into which
46 * secondary core is held until we're ready for it to initialise. 67 * secondary core is held until we're ready for it to initialise.
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 256e84ef0f67..5305ec7341ec 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -22,6 +22,7 @@
22#include <linux/irqchip/arm-gic.h> 22#include <linux/irqchip/arm-gic.h>
23 23
24#include <asm/smp_scu.h> 24#include <asm/smp_scu.h>
25#include <asm/virt.h>
25 26
26#include "omap-secure.h" 27#include "omap-secure.h"
27#include "omap-wakeupgen.h" 28#include "omap-wakeupgen.h"
@@ -227,8 +228,16 @@ static void __init omap4_smp_prepare_cpus(unsigned int max_cpus)
227 if (omap_secure_apis_support()) 228 if (omap_secure_apis_support())
228 omap_auxcoreboot_addr(virt_to_phys(startup_addr)); 229 omap_auxcoreboot_addr(virt_to_phys(startup_addr));
229 else 230 else
230 writel_relaxed(virt_to_phys(omap5_secondary_startup), 231 /*
231 base + OMAP_AUX_CORE_BOOT_1); 232 * If the boot CPU is in HYP mode then start secondary
233 * CPU in HYP mode as well.
234 */
235 if ((__boot_cpu_mode & MODE_MASK) == HYP_MODE)
236 writel_relaxed(virt_to_phys(omap5_secondary_hyp_startup),
237 base + OMAP_AUX_CORE_BOOT_1);
238 else
239 writel_relaxed(virt_to_phys(omap5_secondary_startup),
240 base + OMAP_AUX_CORE_BOOT_1);
232 241
233} 242}
234 243
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index b7cb44abe49b..cc30e49a4cc2 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -256,6 +256,38 @@ static int __init omap4_sar_ram_init(void)
256} 256}
257omap_early_initcall(omap4_sar_ram_init); 257omap_early_initcall(omap4_sar_ram_init);
258 258
259static struct of_device_id gic_match[] = {
260 { .compatible = "arm,cortex-a9-gic", },
261 { .compatible = "arm,cortex-a15-gic", },
262 { },
263};
264
265static struct device_node *gic_node;
266
267unsigned int omap4_xlate_irq(unsigned int hwirq)
268{
269 struct of_phandle_args irq_data;
270 unsigned int irq;
271
272 if (!gic_node)
273 gic_node = of_find_matching_node(NULL, gic_match);
274
275 if (WARN_ON(!gic_node))
276 return hwirq;
277
278 irq_data.np = gic_node;
279 irq_data.args_count = 3;
280 irq_data.args[0] = 0;
281 irq_data.args[1] = hwirq - OMAP44XX_IRQ_GIC_START;
282 irq_data.args[2] = IRQ_TYPE_LEVEL_HIGH;
283
284 irq = irq_create_of_mapping(&irq_data);
285 if (WARN_ON(!irq))
286 irq = hwirq;
287
288 return irq;
289}
290
259void __init omap_gic_of_init(void) 291void __init omap_gic_of_init(void)
260{ 292{
261 struct device_node *np; 293 struct device_node *np;
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index cbb908dc5cf0..9025ffffd2dc 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -3534,9 +3534,15 @@ int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res)
3534 3534
3535 mpu_irqs_cnt = _count_mpu_irqs(oh); 3535 mpu_irqs_cnt = _count_mpu_irqs(oh);
3536 for (i = 0; i < mpu_irqs_cnt; i++) { 3536 for (i = 0; i < mpu_irqs_cnt; i++) {
3537 unsigned int irq;
3538
3539 if (oh->xlate_irq)
3540 irq = oh->xlate_irq((oh->mpu_irqs + i)->irq);
3541 else
3542 irq = (oh->mpu_irqs + i)->irq;
3537 (res + r)->name = (oh->mpu_irqs + i)->name; 3543 (res + r)->name = (oh->mpu_irqs + i)->name;
3538 (res + r)->start = (oh->mpu_irqs + i)->irq; 3544 (res + r)->start = irq;
3539 (res + r)->end = (oh->mpu_irqs + i)->irq; 3545 (res + r)->end = irq;
3540 (res + r)->flags = IORESOURCE_IRQ; 3546 (res + r)->flags = IORESOURCE_IRQ;
3541 r++; 3547 r++;
3542 } 3548 }
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index 35ca6efbec31..5b42fafcaf55 100644
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -676,6 +676,7 @@ struct omap_hwmod {
676 spinlock_t _lock; 676 spinlock_t _lock;
677 struct list_head node; 677 struct list_head node;
678 struct omap_hwmod_ocp_if *_mpu_port; 678 struct omap_hwmod_ocp_if *_mpu_port;
679 unsigned int (*xlate_irq)(unsigned int);
679 u16 flags; 680 u16 flags;
680 u8 mpu_rt_idx; 681 u8 mpu_rt_idx;
681 u8 response_lat; 682 u8 response_lat;
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index c314b3c31117..f5e68a782025 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -479,6 +479,7 @@ static struct omap_hwmod omap44xx_dma_system_hwmod = {
479 .class = &omap44xx_dma_hwmod_class, 479 .class = &omap44xx_dma_hwmod_class,
480 .clkdm_name = "l3_dma_clkdm", 480 .clkdm_name = "l3_dma_clkdm",
481 .mpu_irqs = omap44xx_dma_system_irqs, 481 .mpu_irqs = omap44xx_dma_system_irqs,
482 .xlate_irq = omap4_xlate_irq,
482 .main_clk = "l3_div_ck", 483 .main_clk = "l3_div_ck",
483 .prcm = { 484 .prcm = {
484 .omap4 = { 485 .omap4 = {
@@ -640,6 +641,7 @@ static struct omap_hwmod omap44xx_dss_dispc_hwmod = {
640 .class = &omap44xx_dispc_hwmod_class, 641 .class = &omap44xx_dispc_hwmod_class,
641 .clkdm_name = "l3_dss_clkdm", 642 .clkdm_name = "l3_dss_clkdm",
642 .mpu_irqs = omap44xx_dss_dispc_irqs, 643 .mpu_irqs = omap44xx_dss_dispc_irqs,
644 .xlate_irq = omap4_xlate_irq,
643 .sdma_reqs = omap44xx_dss_dispc_sdma_reqs, 645 .sdma_reqs = omap44xx_dss_dispc_sdma_reqs,
644 .main_clk = "dss_dss_clk", 646 .main_clk = "dss_dss_clk",
645 .prcm = { 647 .prcm = {
@@ -693,6 +695,7 @@ static struct omap_hwmod omap44xx_dss_dsi1_hwmod = {
693 .class = &omap44xx_dsi_hwmod_class, 695 .class = &omap44xx_dsi_hwmod_class,
694 .clkdm_name = "l3_dss_clkdm", 696 .clkdm_name = "l3_dss_clkdm",
695 .mpu_irqs = omap44xx_dss_dsi1_irqs, 697 .mpu_irqs = omap44xx_dss_dsi1_irqs,
698 .xlate_irq = omap4_xlate_irq,
696 .sdma_reqs = omap44xx_dss_dsi1_sdma_reqs, 699 .sdma_reqs = omap44xx_dss_dsi1_sdma_reqs,
697 .main_clk = "dss_dss_clk", 700 .main_clk = "dss_dss_clk",
698 .prcm = { 701 .prcm = {
@@ -726,6 +729,7 @@ static struct omap_hwmod omap44xx_dss_dsi2_hwmod = {
726 .class = &omap44xx_dsi_hwmod_class, 729 .class = &omap44xx_dsi_hwmod_class,
727 .clkdm_name = "l3_dss_clkdm", 730 .clkdm_name = "l3_dss_clkdm",
728 .mpu_irqs = omap44xx_dss_dsi2_irqs, 731 .mpu_irqs = omap44xx_dss_dsi2_irqs,
732 .xlate_irq = omap4_xlate_irq,
729 .sdma_reqs = omap44xx_dss_dsi2_sdma_reqs, 733 .sdma_reqs = omap44xx_dss_dsi2_sdma_reqs,
730 .main_clk = "dss_dss_clk", 734 .main_clk = "dss_dss_clk",
731 .prcm = { 735 .prcm = {
@@ -784,6 +788,7 @@ static struct omap_hwmod omap44xx_dss_hdmi_hwmod = {
784 */ 788 */
785 .flags = HWMOD_SWSUP_SIDLE, 789 .flags = HWMOD_SWSUP_SIDLE,
786 .mpu_irqs = omap44xx_dss_hdmi_irqs, 790 .mpu_irqs = omap44xx_dss_hdmi_irqs,
791 .xlate_irq = omap4_xlate_irq,
787 .sdma_reqs = omap44xx_dss_hdmi_sdma_reqs, 792 .sdma_reqs = omap44xx_dss_hdmi_sdma_reqs,
788 .main_clk = "dss_48mhz_clk", 793 .main_clk = "dss_48mhz_clk",
789 .prcm = { 794 .prcm = {
diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
index 3e9523084b2a..7c3fac035e93 100644
--- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
@@ -288,6 +288,7 @@ static struct omap_hwmod omap54xx_dma_system_hwmod = {
288 .class = &omap54xx_dma_hwmod_class, 288 .class = &omap54xx_dma_hwmod_class,
289 .clkdm_name = "dma_clkdm", 289 .clkdm_name = "dma_clkdm",
290 .mpu_irqs = omap54xx_dma_system_irqs, 290 .mpu_irqs = omap54xx_dma_system_irqs,
291 .xlate_irq = omap4_xlate_irq,
291 .main_clk = "l3_iclk_div", 292 .main_clk = "l3_iclk_div",
292 .prcm = { 293 .prcm = {
293 .omap4 = { 294 .omap4 = {
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
index a8e4b582c527..6163d66102a3 100644
--- a/arch/arm/mach-omap2/prcm-common.h
+++ b/arch/arm/mach-omap2/prcm-common.h
@@ -498,6 +498,7 @@ struct omap_prcm_irq_setup {
498 u8 nr_irqs; 498 u8 nr_irqs;
499 const struct omap_prcm_irq *irqs; 499 const struct omap_prcm_irq *irqs;
500 int irq; 500 int irq;
501 unsigned int (*xlate_irq)(unsigned int);
501 void (*read_pending_irqs)(unsigned long *events); 502 void (*read_pending_irqs)(unsigned long *events);
502 void (*ocp_barrier)(void); 503 void (*ocp_barrier)(void);
503 void (*save_and_clear_irqen)(u32 *saved_mask); 504 void (*save_and_clear_irqen)(u32 *saved_mask);
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index cc170fb81ff7..408c64efb807 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -49,6 +49,7 @@ static struct omap_prcm_irq_setup omap4_prcm_irq_setup = {
49 .irqs = omap4_prcm_irqs, 49 .irqs = omap4_prcm_irqs,
50 .nr_irqs = ARRAY_SIZE(omap4_prcm_irqs), 50 .nr_irqs = ARRAY_SIZE(omap4_prcm_irqs),
51 .irq = 11 + OMAP44XX_IRQ_GIC_START, 51 .irq = 11 + OMAP44XX_IRQ_GIC_START,
52 .xlate_irq = omap4_xlate_irq,
52 .read_pending_irqs = &omap44xx_prm_read_pending_irqs, 53 .read_pending_irqs = &omap44xx_prm_read_pending_irqs,
53 .ocp_barrier = &omap44xx_prm_ocp_barrier, 54 .ocp_barrier = &omap44xx_prm_ocp_barrier,
54 .save_and_clear_irqen = &omap44xx_prm_save_and_clear_irqen, 55 .save_and_clear_irqen = &omap44xx_prm_save_and_clear_irqen,
@@ -751,8 +752,10 @@ static int omap44xx_prm_late_init(void)
751 } 752 }
752 753
753 /* Once OMAP4 DT is filled as well */ 754 /* Once OMAP4 DT is filled as well */
754 if (irq_num >= 0) 755 if (irq_num >= 0) {
755 omap4_prcm_irq_setup.irq = irq_num; 756 omap4_prcm_irq_setup.irq = irq_num;
757 omap4_prcm_irq_setup.xlate_irq = NULL;
758 }
756 } 759 }
757 760
758 omap44xx_prm_enable_io_wakeup(); 761 omap44xx_prm_enable_io_wakeup();
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index 779940cb6e56..dea2833ca627 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -187,6 +187,7 @@ int omap_prcm_event_to_irq(const char *name)
187 */ 187 */
188void omap_prcm_irq_cleanup(void) 188void omap_prcm_irq_cleanup(void)
189{ 189{
190 unsigned int irq;
190 int i; 191 int i;
191 192
192 if (!prcm_irq_setup) { 193 if (!prcm_irq_setup) {
@@ -211,7 +212,11 @@ void omap_prcm_irq_cleanup(void)
211 kfree(prcm_irq_setup->priority_mask); 212 kfree(prcm_irq_setup->priority_mask);
212 prcm_irq_setup->priority_mask = NULL; 213 prcm_irq_setup->priority_mask = NULL;
213 214
214 irq_set_chained_handler(prcm_irq_setup->irq, NULL); 215 if (prcm_irq_setup->xlate_irq)
216 irq = prcm_irq_setup->xlate_irq(prcm_irq_setup->irq);
217 else
218 irq = prcm_irq_setup->irq;
219 irq_set_chained_handler(irq, NULL);
215 220
216 if (prcm_irq_setup->base_irq > 0) 221 if (prcm_irq_setup->base_irq > 0)
217 irq_free_descs(prcm_irq_setup->base_irq, 222 irq_free_descs(prcm_irq_setup->base_irq,
@@ -259,6 +264,7 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)
259 int offset, i; 264 int offset, i;
260 struct irq_chip_generic *gc; 265 struct irq_chip_generic *gc;
261 struct irq_chip_type *ct; 266 struct irq_chip_type *ct;
267 unsigned int irq;
262 268
263 if (!irq_setup) 269 if (!irq_setup)
264 return -EINVAL; 270 return -EINVAL;
@@ -298,7 +304,11 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)
298 1 << (offset & 0x1f); 304 1 << (offset & 0x1f);
299 } 305 }
300 306
301 irq_set_chained_handler(irq_setup->irq, omap_prcm_irq_handler); 307 if (irq_setup->xlate_irq)
308 irq = irq_setup->xlate_irq(irq_setup->irq);
309 else
310 irq = irq_setup->irq;
311 irq_set_chained_handler(irq, omap_prcm_irq_handler);
302 312
303 irq_setup->base_irq = irq_alloc_descs(-1, 0, irq_setup->nr_regs * 32, 313 irq_setup->base_irq = irq_alloc_descs(-1, 0, irq_setup->nr_regs * 32,
304 0); 314 0);
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 4f61148ec168..7d45c84c69ba 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -54,6 +54,7 @@
54 54
55#include "soc.h" 55#include "soc.h"
56#include "common.h" 56#include "common.h"
57#include "control.h"
57#include "powerdomain.h" 58#include "powerdomain.h"
58#include "omap-secure.h" 59#include "omap-secure.h"
59 60
@@ -496,7 +497,8 @@ static void __init realtime_counter_init(void)
496 void __iomem *base; 497 void __iomem *base;
497 static struct clk *sys_clk; 498 static struct clk *sys_clk;
498 unsigned long rate; 499 unsigned long rate;
499 unsigned int reg, num, den; 500 unsigned int reg;
501 unsigned long long num, den;
500 502
501 base = ioremap(REALTIME_COUNTER_BASE, SZ_32); 503 base = ioremap(REALTIME_COUNTER_BASE, SZ_32);
502 if (!base) { 504 if (!base) {
@@ -511,13 +513,42 @@ static void __init realtime_counter_init(void)
511 } 513 }
512 514
513 rate = clk_get_rate(sys_clk); 515 rate = clk_get_rate(sys_clk);
516
517 if (soc_is_dra7xx()) {
518 /*
519 * Errata i856 says the 32.768KHz crystal does not start at
520 * power on, so the CPU falls back to an emulated 32KHz clock
521 * based on sysclk / 610 instead. This causes the master counter
522 * frequency to not be 6.144MHz but at sysclk / 610 * 375 / 2
523 * (OR sysclk * 75 / 244)
524 *
525 * This affects at least the DRA7/AM572x 1.0, 1.1 revisions.
526 * Of course any board built without a populated 32.768KHz
527 * crystal would also need this fix even if the CPU is fixed
528 * later.
529 *
530 * Either case can be detected by using the two speedselect bits
531 * If they are not 0, then the 32.768KHz clock driving the
532 * coarse counter that corrects the fine counter every time it
533 * ticks is actually rate/610 rather than 32.768KHz and we
534 * should compensate to avoid the 570ppm (at 20MHz, much worse
535 * at other rates) too fast system time.
536 */
537 reg = omap_ctrl_readl(DRA7_CTRL_CORE_BOOTSTRAP);
538 if (reg & DRA7_SPEEDSELECT_MASK) {
539 num = 75;
540 den = 244;
541 goto sysclk1_based;
542 }
543 }
544
514 /* Numerator/denumerator values refer TRM Realtime Counter section */ 545 /* Numerator/denumerator values refer TRM Realtime Counter section */
515 switch (rate) { 546 switch (rate) {
516 case 1200000: 547 case 12000000:
517 num = 64; 548 num = 64;
518 den = 125; 549 den = 125;
519 break; 550 break;
520 case 1300000: 551 case 13000000:
521 num = 768; 552 num = 768;
522 den = 1625; 553 den = 1625;
523 break; 554 break;
@@ -529,11 +560,11 @@ static void __init realtime_counter_init(void)
529 num = 192; 560 num = 192;
530 den = 625; 561 den = 625;
531 break; 562 break;
532 case 2600000: 563 case 26000000:
533 num = 384; 564 num = 384;
534 den = 1625; 565 den = 1625;
535 break; 566 break;
536 case 2700000: 567 case 27000000:
537 num = 256; 568 num = 256;
538 den = 1125; 569 den = 1125;
539 break; 570 break;
@@ -545,6 +576,7 @@ static void __init realtime_counter_init(void)
545 break; 576 break;
546 } 577 }
547 578
579sysclk1_based:
548 /* Program numerator and denumerator registers */ 580 /* Program numerator and denumerator registers */
549 reg = readl_relaxed(base + INCREMENTER_NUMERATOR_OFFSET) & 581 reg = readl_relaxed(base + INCREMENTER_NUMERATOR_OFFSET) &
550 NUMERATOR_DENUMERATOR_MASK; 582 NUMERATOR_DENUMERATOR_MASK;
@@ -556,7 +588,7 @@ static void __init realtime_counter_init(void)
556 reg |= den; 588 reg |= den;
557 writel_relaxed(reg, base + INCREMENTER_DENUMERATOR_RELOAD_OFFSET); 589 writel_relaxed(reg, base + INCREMENTER_DENUMERATOR_RELOAD_OFFSET);
558 590
559 arch_timer_freq = (rate / den) * num; 591 arch_timer_freq = DIV_ROUND_UP_ULL(rate * num, den);
560 set_cntfreq(); 592 set_cntfreq();
561 593
562 iounmap(base); 594 iounmap(base);
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 4457e731f7a4..292eca0e78ed 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -66,19 +66,24 @@ void __init omap_pmic_init(int bus, u32 clkrate,
66 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); 66 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
67} 67}
68 68
69#ifdef CONFIG_ARCH_OMAP4
69void __init omap4_pmic_init(const char *pmic_type, 70void __init omap4_pmic_init(const char *pmic_type,
70 struct twl4030_platform_data *pmic_data, 71 struct twl4030_platform_data *pmic_data,
71 struct i2c_board_info *devices, int nr_devices) 72 struct i2c_board_info *devices, int nr_devices)
72{ 73{
73 /* PMIC part*/ 74 /* PMIC part*/
75 unsigned int irq;
76
74 omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE); 77 omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
75 omap_mux_init_signal("fref_clk0_out.sys_drm_msecure", OMAP_PIN_OUTPUT); 78 omap_mux_init_signal("fref_clk0_out.sys_drm_msecure", OMAP_PIN_OUTPUT);
76 omap_pmic_init(1, 400, pmic_type, 7 + OMAP44XX_IRQ_GIC_START, pmic_data); 79 irq = omap4_xlate_irq(7 + OMAP44XX_IRQ_GIC_START);
80 omap_pmic_init(1, 400, pmic_type, irq, pmic_data);
77 81
78 /* Register additional devices on i2c1 bus if needed */ 82 /* Register additional devices on i2c1 bus if needed */
79 if (devices) 83 if (devices)
80 i2c_register_board_info(1, devices, nr_devices); 84 i2c_register_board_info(1, devices, nr_devices);
81} 85}
86#endif
82 87
83void __init omap_pmic_late_init(void) 88void __init omap_pmic_late_init(void)
84{ 89{
diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
index d226b71d21d5..a611f4852582 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -19,11 +19,37 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/of_platform.h> 20#include <linux/of_platform.h>
21#include <linux/irqchip.h> 21#include <linux/irqchip.h>
22#include <linux/clk-provider.h>
23#include <linux/clocksource.h>
24#include <linux/mfd/syscon.h>
25#include <linux/regmap.h>
22#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
23#include <asm/mach/map.h> 27#include <asm/mach/map.h>
24#include <asm/hardware/cache-l2x0.h> 28#include <asm/hardware/cache-l2x0.h>
25#include "core.h" 29#include "core.h"
26 30
31#define RK3288_GRF_SOC_CON0 0x244
32
33static void __init rockchip_timer_init(void)
34{
35 if (of_machine_is_compatible("rockchip,rk3288")) {
36 struct regmap *grf;
37
38 /*
39 * Disable auto jtag/sdmmc switching that causes issues
40 * with the mmc controllers making them unreliable
41 */
42 grf = syscon_regmap_lookup_by_compatible("rockchip,rk3288-grf");
43 if (!IS_ERR(grf))
44 regmap_write(grf, RK3288_GRF_SOC_CON0, 0x10000000);
45 else
46 pr_err("rockchip: could not get grf syscon\n");
47 }
48
49 of_clk_init(NULL);
50 clocksource_of_init();
51}
52
27static void __init rockchip_dt_init(void) 53static void __init rockchip_dt_init(void)
28{ 54{
29 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 55 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
@@ -42,6 +68,7 @@ static const char * const rockchip_board_dt_compat[] = {
42DT_MACHINE_START(ROCKCHIP_DT, "Rockchip Cortex-A9 (Device Tree)") 68DT_MACHINE_START(ROCKCHIP_DT, "Rockchip Cortex-A9 (Device Tree)")
43 .l2c_aux_val = 0, 69 .l2c_aux_val = 0,
44 .l2c_aux_mask = ~0, 70 .l2c_aux_mask = ~0,
71 .init_time = rockchip_timer_init,
45 .dt_compat = rockchip_board_dt_compat, 72 .dt_compat = rockchip_board_dt_compat,
46 .init_machine = rockchip_dt_init, 73 .init_machine = rockchip_dt_init,
47MACHINE_END 74MACHINE_END
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index 79ad93dfdae4..d191cf419731 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -800,7 +800,14 @@ void __init r8a7740_init_irq_of(void)
800 void __iomem *intc_msk_base = ioremap_nocache(0xe6900040, 0x10); 800 void __iomem *intc_msk_base = ioremap_nocache(0xe6900040, 0x10);
801 void __iomem *pfc_inta_ctrl = ioremap_nocache(0xe605807c, 0x4); 801 void __iomem *pfc_inta_ctrl = ioremap_nocache(0xe605807c, 0x4);
802 802
803#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
804 void __iomem *gic_dist_base = ioremap_nocache(0xc2800000, 0x1000);
805 void __iomem *gic_cpu_base = ioremap_nocache(0xc2000000, 0x1000);
806
807 gic_init(0, 29, gic_dist_base, gic_cpu_base);
808#else
803 irqchip_init(); 809 irqchip_init();
810#endif
804 811
805 /* route signals to GIC */ 812 /* route signals to GIC */
806 iowrite32(0x0, pfc_inta_ctrl); 813 iowrite32(0x0, pfc_inta_ctrl);
diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
index 170bd146ba17..cef8895a9b82 100644
--- a/arch/arm/mach-shmobile/setup-r8a7778.c
+++ b/arch/arm/mach-shmobile/setup-r8a7778.c
@@ -576,11 +576,18 @@ void __init r8a7778_init_irq_extpin(int irlm)
576void __init r8a7778_init_irq_dt(void) 576void __init r8a7778_init_irq_dt(void)
577{ 577{
578 void __iomem *base = ioremap_nocache(0xfe700000, 0x00100000); 578 void __iomem *base = ioremap_nocache(0xfe700000, 0x00100000);
579#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
580 void __iomem *gic_dist_base = ioremap_nocache(0xfe438000, 0x1000);
581 void __iomem *gic_cpu_base = ioremap_nocache(0xfe430000, 0x1000);
582#endif
579 583
580 BUG_ON(!base); 584 BUG_ON(!base);
581 585
586#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
587 gic_init(0, 29, gic_dist_base, gic_cpu_base);
588#else
582 irqchip_init(); 589 irqchip_init();
583 590#endif
584 /* route all interrupts to ARM */ 591 /* route all interrupts to ARM */
585 __raw_writel(0x73ffffff, base + INT2NTSR0); 592 __raw_writel(0x73ffffff, base + INT2NTSR0);
586 __raw_writel(0xffffffff, base + INT2NTSR1); 593 __raw_writel(0xffffffff, base + INT2NTSR1);
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 6156d172cf31..27dceaf9e688 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -720,10 +720,17 @@ static int r8a7779_set_wake(struct irq_data *data, unsigned int on)
720 720
721void __init r8a7779_init_irq_dt(void) 721void __init r8a7779_init_irq_dt(void)
722{ 722{
723#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
724 void __iomem *gic_dist_base = ioremap_nocache(0xf0001000, 0x1000);
725 void __iomem *gic_cpu_base = ioremap_nocache(0xf0000100, 0x1000);
726#endif
723 gic_arch_extn.irq_set_wake = r8a7779_set_wake; 727 gic_arch_extn.irq_set_wake = r8a7779_set_wake;
724 728
729#ifdef CONFIG_ARCH_SHMOBILE_LEGACY
730 gic_init(0, 29, gic_dist_base, gic_cpu_base);
731#else
725 irqchip_init(); 732 irqchip_init();
726 733#endif
727 /* route all interrupts to ARM */ 734 /* route all interrupts to ARM */
728 __raw_writel(0xffffffff, INT2NTSR0); 735 __raw_writel(0xffffffff, INT2NTSR0);
729 __raw_writel(0x3fffffff, INT2NTSR1); 736 __raw_writel(0x3fffffff, INT2NTSR1);
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index 93ebe3430bfe..fb5e1bb34be8 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -595,6 +595,7 @@ static struct platform_device ipmmu_device = {
595 595
596static struct renesas_intc_irqpin_config irqpin0_platform_data = { 596static struct renesas_intc_irqpin_config irqpin0_platform_data = {
597 .irq_base = irq_pin(0), /* IRQ0 -> IRQ7 */ 597 .irq_base = irq_pin(0), /* IRQ0 -> IRQ7 */
598 .control_parent = true,
598}; 599};
599 600
600static struct resource irqpin0_resources[] = { 601static struct resource irqpin0_resources[] = {
@@ -656,6 +657,7 @@ static struct platform_device irqpin1_device = {
656 657
657static struct renesas_intc_irqpin_config irqpin2_platform_data = { 658static struct renesas_intc_irqpin_config irqpin2_platform_data = {
658 .irq_base = irq_pin(16), /* IRQ16 -> IRQ23 */ 659 .irq_base = irq_pin(16), /* IRQ16 -> IRQ23 */
660 .control_parent = true,
659}; 661};
660 662
661static struct resource irqpin2_resources[] = { 663static struct resource irqpin2_resources[] = {
@@ -686,6 +688,7 @@ static struct platform_device irqpin2_device = {
686 688
687static struct renesas_intc_irqpin_config irqpin3_platform_data = { 689static struct renesas_intc_irqpin_config irqpin3_platform_data = {
688 .irq_base = irq_pin(24), /* IRQ24 -> IRQ31 */ 690 .irq_base = irq_pin(24), /* IRQ24 -> IRQ31 */
691 .control_parent = true,
689}; 692};
690 693
691static struct resource irqpin3_resources[] = { 694static struct resource irqpin3_resources[] = {
diff --git a/arch/arm/mm/dump.c b/arch/arm/mm/dump.c
index 59424937e52b..9fe8e241335c 100644
--- a/arch/arm/mm/dump.c
+++ b/arch/arm/mm/dump.c
@@ -220,9 +220,6 @@ static void note_page(struct pg_state *st, unsigned long addr, unsigned level, u
220 static const char units[] = "KMGTPE"; 220 static const char units[] = "KMGTPE";
221 u64 prot = val & pg_level[level].mask; 221 u64 prot = val & pg_level[level].mask;
222 222
223 if (addr < USER_PGTABLES_CEILING)
224 return;
225
226 if (!st->level) { 223 if (!st->level) {
227 st->level = level; 224 st->level = level;
228 st->current_prot = prot; 225 st->current_prot = prot;
@@ -308,15 +305,13 @@ static void walk_pgd(struct seq_file *m)
308 pgd_t *pgd = swapper_pg_dir; 305 pgd_t *pgd = swapper_pg_dir;
309 struct pg_state st; 306 struct pg_state st;
310 unsigned long addr; 307 unsigned long addr;
311 unsigned i, pgdoff = USER_PGTABLES_CEILING / PGDIR_SIZE; 308 unsigned i;
312 309
313 memset(&st, 0, sizeof(st)); 310 memset(&st, 0, sizeof(st));
314 st.seq = m; 311 st.seq = m;
315 st.marker = address_markers; 312 st.marker = address_markers;
316 313
317 pgd += pgdoff; 314 for (i = 0; i < PTRS_PER_PGD; i++, pgd++) {
318
319 for (i = pgdoff; i < PTRS_PER_PGD; i++, pgd++) {
320 addr = i * PGDIR_SIZE; 315 addr = i * PGDIR_SIZE;
321 if (!pgd_none(*pgd)) { 316 if (!pgd_none(*pgd)) {
322 walk_pud(&st, pgd, addr); 317 walk_pud(&st, pgd, addr);
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 98ad9c79ea0e..2495c8cb47ba 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -658,8 +658,8 @@ static struct section_perm ro_perms[] = {
658 .start = (unsigned long)_stext, 658 .start = (unsigned long)_stext,
659 .end = (unsigned long)__init_begin, 659 .end = (unsigned long)__init_begin,
660#ifdef CONFIG_ARM_LPAE 660#ifdef CONFIG_ARM_LPAE
661 .mask = ~PMD_SECT_RDONLY, 661 .mask = ~L_PMD_SECT_RDONLY,
662 .prot = PMD_SECT_RDONLY, 662 .prot = L_PMD_SECT_RDONLY,
663#else 663#else
664 .mask = ~(PMD_SECT_APX | PMD_SECT_AP_WRITE), 664 .mask = ~(PMD_SECT_APX | PMD_SECT_AP_WRITE),
665 .prot = PMD_SECT_APX | PMD_SECT_AP_WRITE, 665 .prot = PMD_SECT_APX | PMD_SECT_AP_WRITE,
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index cda7c40999b6..4e6ef896c619 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -1329,8 +1329,8 @@ static void __init kmap_init(void)
1329static void __init map_lowmem(void) 1329static void __init map_lowmem(void)
1330{ 1330{
1331 struct memblock_region *reg; 1331 struct memblock_region *reg;
1332 unsigned long kernel_x_start = round_down(__pa(_stext), SECTION_SIZE); 1332 phys_addr_t kernel_x_start = round_down(__pa(_stext), SECTION_SIZE);
1333 unsigned long kernel_x_end = round_up(__pa(__init_end), SECTION_SIZE); 1333 phys_addr_t kernel_x_end = round_up(__pa(__init_end), SECTION_SIZE);
1334 1334
1335 /* Map all the lowmem memory banks. */ 1335 /* Map all the lowmem memory banks. */
1336 for_each_memblock(memory, reg) { 1336 for_each_memblock(memory, reg) {
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 1c43cec971b5..066688863920 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -85,6 +85,7 @@ vdso_install:
85# We use MRPROPER_FILES and CLEAN_FILES now 85# We use MRPROPER_FILES and CLEAN_FILES now
86archclean: 86archclean:
87 $(Q)$(MAKE) $(clean)=$(boot) 87 $(Q)$(MAKE) $(clean)=$(boot)
88 $(Q)$(MAKE) $(clean)=$(boot)/dts
88 89
89define archhelp 90define archhelp
90 echo '* Image.gz - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)' 91 echo '* Image.gz - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)'
diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile
index 3b8d427c3985..c62b0f4d9ef6 100644
--- a/arch/arm64/boot/dts/Makefile
+++ b/arch/arm64/boot/dts/Makefile
@@ -3,6 +3,4 @@ dts-dirs += apm
3dts-dirs += arm 3dts-dirs += arm
4dts-dirs += cavium 4dts-dirs += cavium
5 5
6always := $(dtb-y)
7subdir-y := $(dts-dirs) 6subdir-y := $(dts-dirs)
8clean-files := *.dtb
diff --git a/arch/arm64/boot/dts/arm/juno.dts b/arch/arm64/boot/dts/arm/juno.dts
index cb3073e4e7a8..d429129ecb3d 100644
--- a/arch/arm64/boot/dts/arm/juno.dts
+++ b/arch/arm64/boot/dts/arm/juno.dts
@@ -22,7 +22,7 @@
22 }; 22 };
23 23
24 chosen { 24 chosen {
25 stdout-path = &soc_uart0; 25 stdout-path = "serial0:115200n8";
26 }; 26 };
27 27
28 psci { 28 psci {
diff --git a/arch/arm64/include/asm/arch_timer.h b/arch/arm64/include/asm/arch_timer.h
index b1fa4e614718..fbe0ca31a99c 100644
--- a/arch/arm64/include/asm/arch_timer.h
+++ b/arch/arm64/include/asm/arch_timer.h
@@ -21,6 +21,7 @@
21 21
22#include <asm/barrier.h> 22#include <asm/barrier.h>
23 23
24#include <linux/bug.h>
24#include <linux/init.h> 25#include <linux/init.h>
25#include <linux/types.h> 26#include <linux/types.h>
26 27
diff --git a/arch/arm64/include/asm/cpu.h b/arch/arm64/include/asm/cpu.h
index ace70682499b..8e797b2fcc01 100644
--- a/arch/arm64/include/asm/cpu.h
+++ b/arch/arm64/include/asm/cpu.h
@@ -39,6 +39,7 @@ struct cpuinfo_arm64 {
39 u64 reg_id_aa64pfr0; 39 u64 reg_id_aa64pfr0;
40 u64 reg_id_aa64pfr1; 40 u64 reg_id_aa64pfr1;
41 41
42 u32 reg_id_dfr0;
42 u32 reg_id_isar0; 43 u32 reg_id_isar0;
43 u32 reg_id_isar1; 44 u32 reg_id_isar1;
44 u32 reg_id_isar2; 45 u32 reg_id_isar2;
@@ -51,6 +52,10 @@ struct cpuinfo_arm64 {
51 u32 reg_id_mmfr3; 52 u32 reg_id_mmfr3;
52 u32 reg_id_pfr0; 53 u32 reg_id_pfr0;
53 u32 reg_id_pfr1; 54 u32 reg_id_pfr1;
55
56 u32 reg_mvfr0;
57 u32 reg_mvfr1;
58 u32 reg_mvfr2;
54}; 59};
55 60
56DECLARE_PER_CPU(struct cpuinfo_arm64, cpu_data); 61DECLARE_PER_CPU(struct cpuinfo_arm64, cpu_data);
diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
index 8127e45e2637..865a7e28ea2d 100644
--- a/arch/arm64/include/asm/kvm_emulate.h
+++ b/arch/arm64/include/asm/kvm_emulate.h
@@ -41,6 +41,8 @@ void kvm_inject_pabt(struct kvm_vcpu *vcpu, unsigned long addr);
41static inline void vcpu_reset_hcr(struct kvm_vcpu *vcpu) 41static inline void vcpu_reset_hcr(struct kvm_vcpu *vcpu)
42{ 42{
43 vcpu->arch.hcr_el2 = HCR_GUEST_FLAGS; 43 vcpu->arch.hcr_el2 = HCR_GUEST_FLAGS;
44 if (test_bit(KVM_ARM_VCPU_EL1_32BIT, vcpu->arch.features))
45 vcpu->arch.hcr_el2 &= ~HCR_RW;
44} 46}
45 47
46static inline unsigned long *vcpu_pc(const struct kvm_vcpu *vcpu) 48static inline unsigned long *vcpu_pc(const struct kvm_vcpu *vcpu)
diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
index 286b1bec547c..f9be30ea1cbd 100644
--- a/arch/arm64/include/asm/processor.h
+++ b/arch/arm64/include/asm/processor.h
@@ -31,6 +31,7 @@
31 31
32#include <asm/fpsimd.h> 32#include <asm/fpsimd.h>
33#include <asm/hw_breakpoint.h> 33#include <asm/hw_breakpoint.h>
34#include <asm/pgtable-hwdef.h>
34#include <asm/ptrace.h> 35#include <asm/ptrace.h>
35#include <asm/types.h> 36#include <asm/types.h>
36 37
@@ -123,9 +124,6 @@ struct task_struct;
123/* Free all resources held by a thread. */ 124/* Free all resources held by a thread. */
124extern void release_thread(struct task_struct *); 125extern void release_thread(struct task_struct *);
125 126
126/* Prepare to copy thread state - unlazy all lazy status */
127#define prepare_to_copy(tsk) do { } while (0)
128
129unsigned long get_wchan(struct task_struct *p); 127unsigned long get_wchan(struct task_struct *p);
130 128
131#define cpu_relax() barrier() 129#define cpu_relax() barrier()
diff --git a/arch/arm64/include/asm/unistd.h b/arch/arm64/include/asm/unistd.h
index 49c9aefd24a5..23e9432ac112 100644
--- a/arch/arm64/include/asm/unistd.h
+++ b/arch/arm64/include/asm/unistd.h
@@ -44,7 +44,7 @@
44#define __ARM_NR_compat_cacheflush (__ARM_NR_COMPAT_BASE+2) 44#define __ARM_NR_compat_cacheflush (__ARM_NR_COMPAT_BASE+2)
45#define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE+5) 45#define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE+5)
46 46
47#define __NR_compat_syscalls 386 47#define __NR_compat_syscalls 388
48#endif 48#endif
49 49
50#define __ARCH_WANT_SYS_CLONE 50#define __ARCH_WANT_SYS_CLONE
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
index 8893cebcea5b..27224426e0bf 100644
--- a/arch/arm64/include/asm/unistd32.h
+++ b/arch/arm64/include/asm/unistd32.h
@@ -795,3 +795,5 @@ __SYSCALL(__NR_getrandom, sys_getrandom)
795__SYSCALL(__NR_memfd_create, sys_memfd_create) 795__SYSCALL(__NR_memfd_create, sys_memfd_create)
796#define __NR_bpf 386 796#define __NR_bpf 386
797__SYSCALL(__NR_bpf, sys_bpf) 797__SYSCALL(__NR_bpf, sys_bpf)
798#define __NR_execveat 387
799__SYSCALL(__NR_execveat, compat_sys_execveat)
diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
index 57b641747534..07d435cf2eea 100644
--- a/arch/arm64/kernel/cpuinfo.c
+++ b/arch/arm64/kernel/cpuinfo.c
@@ -147,6 +147,7 @@ static void cpuinfo_sanity_check(struct cpuinfo_arm64 *cur)
147 * If we have AArch32, we care about 32-bit features for compat. These 147 * If we have AArch32, we care about 32-bit features for compat. These
148 * registers should be RES0 otherwise. 148 * registers should be RES0 otherwise.
149 */ 149 */
150 diff |= CHECK(id_dfr0, boot, cur, cpu);
150 diff |= CHECK(id_isar0, boot, cur, cpu); 151 diff |= CHECK(id_isar0, boot, cur, cpu);
151 diff |= CHECK(id_isar1, boot, cur, cpu); 152 diff |= CHECK(id_isar1, boot, cur, cpu);
152 diff |= CHECK(id_isar2, boot, cur, cpu); 153 diff |= CHECK(id_isar2, boot, cur, cpu);
@@ -165,6 +166,10 @@ static void cpuinfo_sanity_check(struct cpuinfo_arm64 *cur)
165 diff |= CHECK(id_pfr0, boot, cur, cpu); 166 diff |= CHECK(id_pfr0, boot, cur, cpu);
166 diff |= CHECK(id_pfr1, boot, cur, cpu); 167 diff |= CHECK(id_pfr1, boot, cur, cpu);
167 168
169 diff |= CHECK(mvfr0, boot, cur, cpu);
170 diff |= CHECK(mvfr1, boot, cur, cpu);
171 diff |= CHECK(mvfr2, boot, cur, cpu);
172
168 /* 173 /*
169 * Mismatched CPU features are a recipe for disaster. Don't even 174 * Mismatched CPU features are a recipe for disaster. Don't even
170 * pretend to support them. 175 * pretend to support them.
@@ -189,6 +194,7 @@ static void __cpuinfo_store_cpu(struct cpuinfo_arm64 *info)
189 info->reg_id_aa64pfr0 = read_cpuid(ID_AA64PFR0_EL1); 194 info->reg_id_aa64pfr0 = read_cpuid(ID_AA64PFR0_EL1);
190 info->reg_id_aa64pfr1 = read_cpuid(ID_AA64PFR1_EL1); 195 info->reg_id_aa64pfr1 = read_cpuid(ID_AA64PFR1_EL1);
191 196
197 info->reg_id_dfr0 = read_cpuid(ID_DFR0_EL1);
192 info->reg_id_isar0 = read_cpuid(ID_ISAR0_EL1); 198 info->reg_id_isar0 = read_cpuid(ID_ISAR0_EL1);
193 info->reg_id_isar1 = read_cpuid(ID_ISAR1_EL1); 199 info->reg_id_isar1 = read_cpuid(ID_ISAR1_EL1);
194 info->reg_id_isar2 = read_cpuid(ID_ISAR2_EL1); 200 info->reg_id_isar2 = read_cpuid(ID_ISAR2_EL1);
@@ -202,6 +208,10 @@ static void __cpuinfo_store_cpu(struct cpuinfo_arm64 *info)
202 info->reg_id_pfr0 = read_cpuid(ID_PFR0_EL1); 208 info->reg_id_pfr0 = read_cpuid(ID_PFR0_EL1);
203 info->reg_id_pfr1 = read_cpuid(ID_PFR1_EL1); 209 info->reg_id_pfr1 = read_cpuid(ID_PFR1_EL1);
204 210
211 info->reg_mvfr0 = read_cpuid(MVFR0_EL1);
212 info->reg_mvfr1 = read_cpuid(MVFR1_EL1);
213 info->reg_mvfr2 = read_cpuid(MVFR2_EL1);
214
205 cpuinfo_detect_icache_policy(info); 215 cpuinfo_detect_icache_policy(info);
206 216
207 check_local_cpu_errata(); 217 check_local_cpu_errata();
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index 6fac253bc783..2bb4347d0edf 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -326,6 +326,7 @@ void __init efi_idmap_init(void)
326 326
327 /* boot time idmap_pg_dir is incomplete, so fill in missing parts */ 327 /* boot time idmap_pg_dir is incomplete, so fill in missing parts */
328 efi_setup_idmap(); 328 efi_setup_idmap();
329 early_memunmap(memmap.map, memmap.map_end - memmap.map);
329} 330}
330 331
331static int __init remap_region(efi_memory_desc_t *md, void **new) 332static int __init remap_region(efi_memory_desc_t *md, void **new)
@@ -380,7 +381,6 @@ static int __init arm64_enter_virtual_mode(void)
380 } 381 }
381 382
382 mapsize = memmap.map_end - memmap.map; 383 mapsize = memmap.map_end - memmap.map;
383 early_memunmap(memmap.map, mapsize);
384 384
385 if (efi_runtime_disabled()) { 385 if (efi_runtime_disabled()) {
386 pr_info("EFI runtime services will be disabled.\n"); 386 pr_info("EFI runtime services will be disabled.\n");
diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c
index fd027b101de5..9b6f71db2709 100644
--- a/arch/arm64/kernel/module.c
+++ b/arch/arm64/kernel/module.c
@@ -25,6 +25,7 @@
25#include <linux/mm.h> 25#include <linux/mm.h>
26#include <linux/moduleloader.h> 26#include <linux/moduleloader.h>
27#include <linux/vmalloc.h> 27#include <linux/vmalloc.h>
28#include <asm/alternative.h>
28#include <asm/insn.h> 29#include <asm/insn.h>
29#include <asm/sections.h> 30#include <asm/sections.h>
30 31
diff --git a/arch/arm64/kernel/perf_regs.c b/arch/arm64/kernel/perf_regs.c
index 6762ad705587..3f62b35fb6f1 100644
--- a/arch/arm64/kernel/perf_regs.c
+++ b/arch/arm64/kernel/perf_regs.c
@@ -50,3 +50,11 @@ u64 perf_reg_abi(struct task_struct *task)
50 else 50 else
51 return PERF_SAMPLE_REGS_ABI_64; 51 return PERF_SAMPLE_REGS_ABI_64;
52} 52}
53
54void perf_get_regs_user(struct perf_regs *regs_user,
55 struct pt_regs *regs,
56 struct pt_regs *regs_user_copy)
57{
58 regs_user->regs = task_pt_regs(current);
59 regs_user->abi = perf_reg_abi(current);
60}
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index b80991166754..20fe2932ad0c 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -402,6 +402,7 @@ void __init setup_arch(char **cmdline_p)
402 request_standard_resources(); 402 request_standard_resources();
403 403
404 efi_idmap_init(); 404 efi_idmap_init();
405 early_ioremap_reset();
405 406
406 unflatten_device_tree(); 407 unflatten_device_tree();
407 408
diff --git a/arch/arm64/kernel/smp_spin_table.c b/arch/arm64/kernel/smp_spin_table.c
index 4f93c67e63de..14944e5b28da 100644
--- a/arch/arm64/kernel/smp_spin_table.c
+++ b/arch/arm64/kernel/smp_spin_table.c
@@ -25,6 +25,7 @@
25#include <asm/cacheflush.h> 25#include <asm/cacheflush.h>
26#include <asm/cpu_ops.h> 26#include <asm/cpu_ops.h>
27#include <asm/cputype.h> 27#include <asm/cputype.h>
28#include <asm/io.h>
28#include <asm/smp_plat.h> 29#include <asm/smp_plat.h>
29 30
30extern void secondary_holding_pen(void); 31extern void secondary_holding_pen(void);
diff --git a/arch/arm64/kvm/hyp.S b/arch/arm64/kvm/hyp.S
index fbe909fb0a1a..c3ca89c27c6b 100644
--- a/arch/arm64/kvm/hyp.S
+++ b/arch/arm64/kvm/hyp.S
@@ -1014,6 +1014,7 @@ ENTRY(__kvm_tlb_flush_vmid_ipa)
1014 * Instead, we invalidate Stage-2 for this IPA, and the 1014 * Instead, we invalidate Stage-2 for this IPA, and the
1015 * whole of Stage-1. Weep... 1015 * whole of Stage-1. Weep...
1016 */ 1016 */
1017 lsr x1, x1, #12
1017 tlbi ipas2e1is, x1 1018 tlbi ipas2e1is, x1
1018 /* 1019 /*
1019 * We have to ensure completion of the invalidation at Stage-2, 1020 * We have to ensure completion of the invalidation at Stage-2,
diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c
index 70a7816535cd..0b4326578985 100644
--- a/arch/arm64/kvm/reset.c
+++ b/arch/arm64/kvm/reset.c
@@ -90,7 +90,6 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
90 if (!cpu_has_32bit_el1()) 90 if (!cpu_has_32bit_el1())
91 return -EINVAL; 91 return -EINVAL;
92 cpu_reset = &default_regs_reset32; 92 cpu_reset = &default_regs_reset32;
93 vcpu->arch.hcr_el2 &= ~HCR_RW;
94 } else { 93 } else {
95 cpu_reset = &default_regs_reset; 94 cpu_reset = &default_regs_reset;
96 } 95 }
diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c
index cf33f33333cc..d54dc9ac4b70 100644
--- a/arch/arm64/mm/dump.c
+++ b/arch/arm64/mm/dump.c
@@ -15,6 +15,7 @@
15 */ 15 */
16#include <linux/debugfs.h> 16#include <linux/debugfs.h>
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/io.h>
18#include <linux/mm.h> 19#include <linux/mm.h>
19#include <linux/sched.h> 20#include <linux/sched.h>
20#include <linux/seq_file.h> 21#include <linux/seq_file.h>
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index bac492c12fcc..c95464a33f36 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -335,14 +335,8 @@ static int keep_initrd;
335 335
336void free_initrd_mem(unsigned long start, unsigned long end) 336void free_initrd_mem(unsigned long start, unsigned long end)
337{ 337{
338 if (!keep_initrd) { 338 if (!keep_initrd)
339 if (start == initrd_start)
340 start = round_down(start, PAGE_SIZE);
341 if (end == initrd_end)
342 end = round_up(end, PAGE_SIZE);
343
344 free_reserved_area((void *)start, (void *)end, 0, "initrd"); 339 free_reserved_area((void *)start, (void *)end, 0, "initrd");
345 }
346} 340}
347 341
348static int __init keepinitrd_setup(char *__unused) 342static int __init keepinitrd_setup(char *__unused)
diff --git a/arch/avr32/kernel/module.c b/arch/avr32/kernel/module.c
index 2c9412908024..164efa009e5b 100644
--- a/arch/avr32/kernel/module.c
+++ b/arch/avr32/kernel/module.c
@@ -19,12 +19,10 @@
19#include <linux/moduleloader.h> 19#include <linux/moduleloader.h>
20#include <linux/vmalloc.h> 20#include <linux/vmalloc.h>
21 21
22void module_free(struct module *mod, void *module_region) 22void module_arch_freeing_init(struct module *mod)
23{ 23{
24 vfree(mod->arch.syminfo); 24 vfree(mod->arch.syminfo);
25 mod->arch.syminfo = NULL; 25 mod->arch.syminfo = NULL;
26
27 vfree(module_region);
28} 26}
29 27
30static inline int check_rela(Elf32_Rela *rela, struct module *module, 28static inline int check_rela(Elf32_Rela *rela, struct module *module,
@@ -291,12 +289,3 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
291 289
292 return ret; 290 return ret;
293} 291}
294
295int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
296 struct module *module)
297{
298 vfree(module->arch.syminfo);
299 module->arch.syminfo = NULL;
300
301 return 0;
302}
diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c
index 6f4bac969bf7..23eada79439c 100644
--- a/arch/blackfin/mach-bf533/boards/stamp.c
+++ b/arch/blackfin/mach-bf533/boards/stamp.c
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9#include <linux/device.h> 9#include <linux/device.h>
10#include <linux/delay.h>
10#include <linux/platform_device.h> 11#include <linux/platform_device.h>
11#include <linux/mtd/mtd.h> 12#include <linux/mtd/mtd.h>
12#include <linux/mtd/partitions.h> 13#include <linux/mtd/partitions.h>
diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c
index 08a313fc2241..f772068d9e79 100644
--- a/arch/cris/arch-v32/drivers/sync_serial.c
+++ b/arch/cris/arch-v32/drivers/sync_serial.c
@@ -604,7 +604,7 @@ static ssize_t __sync_serial_read(struct file *file,
604 struct timespec *ts) 604 struct timespec *ts)
605{ 605{
606 unsigned long flags; 606 unsigned long flags;
607 int dev = MINOR(file->f_dentry->d_inode->i_rdev); 607 int dev = MINOR(file_inode(file)->i_rdev);
608 int avail; 608 int avail;
609 struct sync_port *port; 609 struct sync_port *port;
610 unsigned char *start; 610 unsigned char *start;
diff --git a/arch/cris/kernel/module.c b/arch/cris/kernel/module.c
index 51123f985eb5..af04cb6b6dc9 100644
--- a/arch/cris/kernel/module.c
+++ b/arch/cris/kernel/module.c
@@ -36,7 +36,7 @@ void *module_alloc(unsigned long size)
36} 36}
37 37
38/* Free memory returned from module_alloc */ 38/* Free memory returned from module_alloc */
39void module_free(struct module *mod, void *module_region) 39void module_memfree(void *module_region)
40{ 40{
41 kfree(module_region); 41 kfree(module_region);
42} 42}
diff --git a/arch/frv/mb93090-mb00/pci-frv.c b/arch/frv/mb93090-mb00/pci-frv.c
index 67b1d1685759..0635bd6c2af3 100644
--- a/arch/frv/mb93090-mb00/pci-frv.c
+++ b/arch/frv/mb93090-mb00/pci-frv.c
@@ -94,7 +94,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
94 r = &dev->resource[idx]; 94 r = &dev->resource[idx];
95 if (!r->start) 95 if (!r->start)
96 continue; 96 continue;
97 pci_claim_resource(dev, idx); 97 pci_claim_bridge_resource(dev, idx);
98 } 98 }
99 } 99 }
100 pcibios_allocate_bus_resources(&bus->children); 100 pcibios_allocate_bus_resources(&bus->children);
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
index f3b51b57740a..95c39b95e97e 100644
--- a/arch/ia64/include/asm/unistd.h
+++ b/arch/ia64/include/asm/unistd.h
@@ -11,7 +11,7 @@
11 11
12 12
13 13
14#define NR_syscalls 318 /* length of syscall table */ 14#define NR_syscalls 319 /* length of syscall table */
15 15
16/* 16/*
17 * The following defines stop scripts/checksyscalls.sh from complaining about 17 * The following defines stop scripts/checksyscalls.sh from complaining about
diff --git a/arch/ia64/include/uapi/asm/unistd.h b/arch/ia64/include/uapi/asm/unistd.h
index 4c2240c1b0cb..461079560c78 100644
--- a/arch/ia64/include/uapi/asm/unistd.h
+++ b/arch/ia64/include/uapi/asm/unistd.h
@@ -331,5 +331,6 @@
331#define __NR_getrandom 1339 331#define __NR_getrandom 1339
332#define __NR_memfd_create 1340 332#define __NR_memfd_create 1340
333#define __NR_bpf 1341 333#define __NR_bpf 1341
334#define __NR_execveat 1342
334 335
335#endif /* _UAPI_ASM_IA64_UNISTD_H */ 336#endif /* _UAPI_ASM_IA64_UNISTD_H */
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 615ef81def49..e795cb848154 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -893,13 +893,13 @@ static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
893} 893}
894 894
895/* wrapper to silence section mismatch warning */ 895/* wrapper to silence section mismatch warning */
896int __ref acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu) 896int __ref acpi_map_cpu(acpi_handle handle, int physid, int *pcpu)
897{ 897{
898 return _acpi_map_lsapic(handle, physid, pcpu); 898 return _acpi_map_lsapic(handle, physid, pcpu);
899} 899}
900EXPORT_SYMBOL(acpi_map_lsapic); 900EXPORT_SYMBOL(acpi_map_cpu);
901 901
902int acpi_unmap_lsapic(int cpu) 902int acpi_unmap_cpu(int cpu)
903{ 903{
904 ia64_cpu_to_sapicid[cpu] = -1; 904 ia64_cpu_to_sapicid[cpu] = -1;
905 set_cpu_present(cpu, false); 905 set_cpu_present(cpu, false);
@@ -910,8 +910,7 @@ int acpi_unmap_lsapic(int cpu)
910 910
911 return (0); 911 return (0);
912} 912}
913 913EXPORT_SYMBOL(acpi_unmap_cpu);
914EXPORT_SYMBOL(acpi_unmap_lsapic);
915#endif /* CONFIG_ACPI_HOTPLUG_CPU */ 914#endif /* CONFIG_ACPI_HOTPLUG_CPU */
916 915
917#ifdef CONFIG_ACPI_NUMA 916#ifdef CONFIG_ACPI_NUMA
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index f5e96dffc63c..fcf8b8cbca0b 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1779,6 +1779,7 @@ sys_call_table:
1779 data8 sys_getrandom 1779 data8 sys_getrandom
1780 data8 sys_memfd_create // 1340 1780 data8 sys_memfd_create // 1340
1781 data8 sys_bpf 1781 data8 sys_bpf
1782 data8 sys_execveat
1782 1783
1783 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 1784 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
1784#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ 1785#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */
diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c
index 24603be24c14..29754aae5177 100644
--- a/arch/ia64/kernel/module.c
+++ b/arch/ia64/kernel/module.c
@@ -305,14 +305,12 @@ plt_target (struct plt_entry *plt)
305#endif /* !USE_BRL */ 305#endif /* !USE_BRL */
306 306
307void 307void
308module_free (struct module *mod, void *module_region) 308module_arch_freeing_init (struct module *mod)
309{ 309{
310 if (mod && mod->arch.init_unw_table && 310 if (mod->arch.init_unw_table) {
311 module_region == mod->module_init) {
312 unw_remove_unwind_table(mod->arch.init_unw_table); 311 unw_remove_unwind_table(mod->arch.init_unw_table);
313 mod->arch.init_unw_table = NULL; 312 mod->arch.init_unw_table = NULL;
314 } 313 }
315 vfree(module_region);
316} 314}
317 315
318/* Have we already seen one of these relocations? */ 316/* Have we already seen one of these relocations? */
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 291a582777cf..900cc93e5409 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -487,45 +487,39 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
487 return 0; 487 return 0;
488} 488}
489 489
490static int is_valid_resource(struct pci_dev *dev, int idx) 490void pcibios_fixup_device_resources(struct pci_dev *dev)
491{ 491{
492 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM; 492 int idx;
493 struct resource *devr = &dev->resource[idx], *busr;
494 493
495 if (!dev->bus) 494 if (!dev->bus)
496 return 0; 495 return;
497
498 pci_bus_for_each_resource(dev->bus, busr, i) {
499 if (!busr || ((busr->flags ^ devr->flags) & type_mask))
500 continue;
501 if ((devr->start) && (devr->start >= busr->start) &&
502 (devr->end <= busr->end))
503 return 1;
504 }
505 return 0;
506}
507 496
508static void pcibios_fixup_resources(struct pci_dev *dev, int start, int limit) 497 for (idx = 0; idx < PCI_BRIDGE_RESOURCES; idx++) {
509{ 498 struct resource *r = &dev->resource[idx];
510 int i;
511 499
512 for (i = start; i < limit; i++) { 500 if (!r->flags || r->parent || !r->start)
513 if (!dev->resource[i].flags)
514 continue; 501 continue;
515 if ((is_valid_resource(dev, i)))
516 pci_claim_resource(dev, i);
517 }
518}
519 502
520void pcibios_fixup_device_resources(struct pci_dev *dev) 503 pci_claim_resource(dev, idx);
521{ 504 }
522 pcibios_fixup_resources(dev, 0, PCI_BRIDGE_RESOURCES);
523} 505}
524EXPORT_SYMBOL_GPL(pcibios_fixup_device_resources); 506EXPORT_SYMBOL_GPL(pcibios_fixup_device_resources);
525 507
526static void pcibios_fixup_bridge_resources(struct pci_dev *dev) 508static void pcibios_fixup_bridge_resources(struct pci_dev *dev)
527{ 509{
528 pcibios_fixup_resources(dev, PCI_BRIDGE_RESOURCES, PCI_NUM_RESOURCES); 510 int idx;
511
512 if (!dev->bus)
513 return;
514
515 for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) {
516 struct resource *r = &dev->resource[idx];
517
518 if (!r->flags || r->parent || !r->start)
519 continue;
520
521 pci_claim_bridge_resource(dev, idx);
522 }
529} 523}
530 524
531/* 525/*
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h
index 75e75d7b1702..244e0dbe45db 100644
--- a/arch/m68k/include/asm/unistd.h
+++ b/arch/m68k/include/asm/unistd.h
@@ -4,7 +4,7 @@
4#include <uapi/asm/unistd.h> 4#include <uapi/asm/unistd.h>
5 5
6 6
7#define NR_syscalls 355 7#define NR_syscalls 356
8 8
9#define __ARCH_WANT_OLD_READDIR 9#define __ARCH_WANT_OLD_READDIR
10#define __ARCH_WANT_OLD_STAT 10#define __ARCH_WANT_OLD_STAT
diff --git a/arch/m68k/include/uapi/asm/unistd.h b/arch/m68k/include/uapi/asm/unistd.h
index 2c1bec9a14b6..61fb6cb9d2ae 100644
--- a/arch/m68k/include/uapi/asm/unistd.h
+++ b/arch/m68k/include/uapi/asm/unistd.h
@@ -360,5 +360,6 @@
360#define __NR_getrandom 352 360#define __NR_getrandom 352
361#define __NR_memfd_create 353 361#define __NR_memfd_create 353
362#define __NR_bpf 354 362#define __NR_bpf 354
363#define __NR_execveat 355
363 364
364#endif /* _UAPI_ASM_M68K_UNISTD_H_ */ 365#endif /* _UAPI_ASM_M68K_UNISTD_H_ */
diff --git a/arch/m68k/kernel/syscalltable.S b/arch/m68k/kernel/syscalltable.S
index 2ca219e184cd..a0ec4303f2c8 100644
--- a/arch/m68k/kernel/syscalltable.S
+++ b/arch/m68k/kernel/syscalltable.S
@@ -375,4 +375,5 @@ ENTRY(sys_call_table)
375 .long sys_getrandom 375 .long sys_getrandom
376 .long sys_memfd_create 376 .long sys_memfd_create
377 .long sys_bpf 377 .long sys_bpf
378 .long sys_execveat /* 355 */
378 379
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index b30e41c0c033..48528fb81eff 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1026,6 +1026,8 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)
1026 pr, (pr && pr->name) ? pr->name : "nil"); 1026 pr, (pr && pr->name) ? pr->name : "nil");
1027 1027
1028 if (pr && !(pr->flags & IORESOURCE_UNSET)) { 1028 if (pr && !(pr->flags & IORESOURCE_UNSET)) {
1029 struct pci_dev *dev = bus->self;
1030
1029 if (request_resource(pr, res) == 0) 1031 if (request_resource(pr, res) == 0)
1030 continue; 1032 continue;
1031 /* 1033 /*
@@ -1035,6 +1037,12 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)
1035 */ 1037 */
1036 if (reparent_resources(pr, res) == 0) 1038 if (reparent_resources(pr, res) == 0)
1037 continue; 1039 continue;
1040
1041 if (dev && i < PCI_BRIDGE_RESOURCE_NUM &&
1042 pci_claim_bridge_resource(dev,
1043 i + PCI_BRIDGE_RESOURCES) == 0)
1044 continue;
1045
1038 } 1046 }
1039 pr_warn("PCI: Cannot allocate resource region "); 1047 pr_warn("PCI: Cannot allocate resource region ");
1040 pr_cont("%d of PCI bridge %d, will remap\n", i, bus->number); 1048 pr_cont("%d of PCI bridge %d, will remap\n", i, bus->number);
@@ -1227,7 +1235,10 @@ void pcibios_claim_one_bus(struct pci_bus *bus)
1227 (unsigned long long)r->end, 1235 (unsigned long long)r->end,
1228 (unsigned int)r->flags); 1236 (unsigned int)r->flags);
1229 1237
1230 pci_claim_resource(dev, i); 1238 if (pci_claim_resource(dev, i) == 0)
1239 continue;
1240
1241 pci_claim_bridge_resource(dev, i);
1231 } 1242 }
1232 } 1243 }
1233 1244
diff --git a/arch/mips/net/bpf_jit.c b/arch/mips/net/bpf_jit.c
index 9fd6834a2172..5d6139390bf8 100644
--- a/arch/mips/net/bpf_jit.c
+++ b/arch/mips/net/bpf_jit.c
@@ -1388,7 +1388,7 @@ out:
1388void bpf_jit_free(struct bpf_prog *fp) 1388void bpf_jit_free(struct bpf_prog *fp)
1389{ 1389{
1390 if (fp->jited) 1390 if (fp->jited)
1391 module_free(NULL, fp->bpf_func); 1391 module_memfree(fp->bpf_func);
1392 1392
1393 bpf_prog_unlock_free(fp); 1393 bpf_prog_unlock_free(fp);
1394} 1394}
diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.c b/arch/mn10300/unit-asb2305/pci-asb2305.c
index febb9cd83177..b5b036f64275 100644
--- a/arch/mn10300/unit-asb2305/pci-asb2305.c
+++ b/arch/mn10300/unit-asb2305/pci-asb2305.c
@@ -106,7 +106,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
106 if (!r->flags) 106 if (!r->flags)
107 continue; 107 continue;
108 if (!r->start || 108 if (!r->start ||
109 pci_claim_resource(dev, idx) < 0) { 109 pci_claim_bridge_resource(dev, idx) < 0) {
110 printk(KERN_ERR "PCI:" 110 printk(KERN_ERR "PCI:"
111 " Cannot allocate resource" 111 " Cannot allocate resource"
112 " region %d of bridge %s\n", 112 " region %d of bridge %s\n",
diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c
index 6b4339f8c9c2..471ff398090c 100644
--- a/arch/mn10300/unit-asb2305/pci.c
+++ b/arch/mn10300/unit-asb2305/pci.c
@@ -281,42 +281,37 @@ static int __init pci_check_direct(void)
281 return -ENODEV; 281 return -ENODEV;
282} 282}
283 283
284static int is_valid_resource(struct pci_dev *dev, int idx) 284static void pcibios_fixup_device_resources(struct pci_dev *dev)
285{ 285{
286 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM; 286 int idx;
287 struct resource *devr = &dev->resource[idx], *busr;
288
289 if (dev->bus) {
290 pci_bus_for_each_resource(dev->bus, busr, i) {
291 if (!busr || (busr->flags ^ devr->flags) & type_mask)
292 continue;
293
294 if (devr->start &&
295 devr->start >= busr->start &&
296 devr->end <= busr->end)
297 return 1;
298 }
299 }
300 287
301 return 0; 288 if (!dev->bus)
289 return;
290
291 for (idx = 0; idx < PCI_BRIDGE_RESOURCES; idx++) {
292 struct resource *r = &dev->resource[idx];
293
294 if (!r->flags || r->parent || !r->start)
295 continue;
296
297 pci_claim_resource(dev, idx);
298 }
302} 299}
303 300
304static void pcibios_fixup_device_resources(struct pci_dev *dev) 301static void pcibios_fixup_bridge_resources(struct pci_dev *dev)
305{ 302{
306 int limit, i; 303 int idx;
307 304
308 if (dev->bus->number != 0) 305 if (!dev->bus)
309 return; 306 return;
310 307
311 limit = (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) ? 308 for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) {
312 PCI_BRIDGE_RESOURCES : PCI_NUM_RESOURCES; 309 struct resource *r = &dev->resource[idx];
313 310
314 for (i = 0; i < limit; i++) { 311 if (!r->flags || r->parent || !r->start)
315 if (!dev->resource[i].flags)
316 continue; 312 continue;
317 313
318 if (is_valid_resource(dev, i)) 314 pci_claim_bridge_resource(dev, idx);
319 pci_claim_resource(dev, i);
320 } 315 }
321} 316}
322 317
@@ -330,7 +325,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
330 325
331 if (bus->self) { 326 if (bus->self) {
332 pci_read_bridge_bases(bus); 327 pci_read_bridge_bases(bus);
333 pcibios_fixup_device_resources(bus->self); 328 pcibios_fixup_bridge_resources(bus->self);
334 } 329 }
335 330
336 list_for_each_entry(dev, &bus->devices, bus_list) 331 list_for_each_entry(dev, &bus->devices, bus_list)
diff --git a/arch/nios2/kernel/cpuinfo.c b/arch/nios2/kernel/cpuinfo.c
index 51d5bb90d3e5..a223691dff4f 100644
--- a/arch/nios2/kernel/cpuinfo.c
+++ b/arch/nios2/kernel/cpuinfo.c
@@ -72,6 +72,7 @@ void __init setup_cpuinfo(void)
72 cpuinfo.has_div = fcpu_has(cpu, "altr,has-div"); 72 cpuinfo.has_div = fcpu_has(cpu, "altr,has-div");
73 cpuinfo.has_mul = fcpu_has(cpu, "altr,has-mul"); 73 cpuinfo.has_mul = fcpu_has(cpu, "altr,has-mul");
74 cpuinfo.has_mulx = fcpu_has(cpu, "altr,has-mulx"); 74 cpuinfo.has_mulx = fcpu_has(cpu, "altr,has-mulx");
75 cpuinfo.mmu = fcpu_has(cpu, "altr,has-mmu");
75 76
76 if (IS_ENABLED(CONFIG_NIOS2_HW_DIV_SUPPORT) && !cpuinfo.has_div) 77 if (IS_ENABLED(CONFIG_NIOS2_HW_DIV_SUPPORT) && !cpuinfo.has_div)
77 err_cpu("DIV"); 78 err_cpu("DIV");
diff --git a/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S
index 83bca17d1008..0bdfd13ff98b 100644
--- a/arch/nios2/kernel/entry.S
+++ b/arch/nios2/kernel/entry.S
@@ -365,30 +365,14 @@ ENTRY(ret_from_interrupt)
365 GET_THREAD_INFO r1 365 GET_THREAD_INFO r1
366 ldw r4, TI_PREEMPT_COUNT(r1) 366 ldw r4, TI_PREEMPT_COUNT(r1)
367 bne r4, r0, restore_all 367 bne r4, r0, restore_all
368
369need_resched:
370 ldw r4, TI_FLAGS(r1) /* ? Need resched set */ 368 ldw r4, TI_FLAGS(r1) /* ? Need resched set */
371 BTBZ r10, r4, TIF_NEED_RESCHED, restore_all 369 BTBZ r10, r4, TIF_NEED_RESCHED, restore_all
372 ldw r4, PT_ESTATUS(sp) /* ? Interrupts off */ 370 ldw r4, PT_ESTATUS(sp) /* ? Interrupts off */
373 andi r10, r4, ESTATUS_EPIE 371 andi r10, r4, ESTATUS_EPIE
374 beq r10, r0, restore_all 372 beq r10, r0, restore_all
375 movia r4, PREEMPT_ACTIVE 373 call preempt_schedule_irq
376 stw r4, TI_PREEMPT_COUNT(r1)
377 rdctl r10, status /* enable intrs again */
378 ori r10, r10 ,STATUS_PIE
379 wrctl status, r10
380 PUSH r1
381 call schedule
382 POP r1
383 mov r4, r0
384 stw r4, TI_PREEMPT_COUNT(r1)
385 rdctl r10, status /* disable intrs */
386 andi r10, r10, %lo(~STATUS_PIE)
387 wrctl status, r10
388 br need_resched
389#else
390 br restore_all
391#endif 374#endif
375 br restore_all
392 376
393/*********************************************************************** 377/***********************************************************************
394 * A few syscall wrappers 378 * A few syscall wrappers
diff --git a/arch/nios2/kernel/module.c b/arch/nios2/kernel/module.c
index cc924a38f22a..e2e3f13f98d5 100644
--- a/arch/nios2/kernel/module.c
+++ b/arch/nios2/kernel/module.c
@@ -36,7 +36,7 @@ void *module_alloc(unsigned long size)
36} 36}
37 37
38/* Free memory returned from module_alloc */ 38/* Free memory returned from module_alloc */
39void module_free(struct module *mod, void *module_region) 39void module_memfree(void *module_region)
40{ 40{
41 kfree(module_region); 41 kfree(module_region);
42} 42}
diff --git a/arch/nios2/kernel/signal.c b/arch/nios2/kernel/signal.c
index f9d27883a714..2d0ea25be171 100644
--- a/arch/nios2/kernel/signal.c
+++ b/arch/nios2/kernel/signal.c
@@ -200,7 +200,7 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
200 200
201 /* Set up to return from userspace; jump to fixed address sigreturn 201 /* Set up to return from userspace; jump to fixed address sigreturn
202 trampoline on kuser page. */ 202 trampoline on kuser page. */
203 regs->ra = (unsigned long) (0x1040); 203 regs->ra = (unsigned long) (0x1044);
204 204
205 /* Set up registers for signal handler */ 205 /* Set up registers for signal handler */
206 regs->sp = (unsigned long) frame; 206 regs->sp = (unsigned long) frame;
diff --git a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c
index 50dfafc3f2c1..5822e8e200e6 100644
--- a/arch/parisc/kernel/module.c
+++ b/arch/parisc/kernel/module.c
@@ -298,14 +298,10 @@ static inline unsigned long count_stubs(const Elf_Rela *rela, unsigned long n)
298} 298}
299#endif 299#endif
300 300
301 301void module_arch_freeing_init(struct module *mod)
302/* Free memory returned from module_alloc */
303void module_free(struct module *mod, void *module_region)
304{ 302{
305 kfree(mod->arch.section); 303 kfree(mod->arch.section);
306 mod->arch.section = NULL; 304 mod->arch.section = NULL;
307
308 vfree(module_region);
309} 305}
310 306
311/* Additional bytes needed in front of individual sections */ 307/* Additional bytes needed in front of individual sections */
diff --git a/arch/powerpc/crypto/sha1.c b/arch/powerpc/crypto/sha1.c
index d3feba5a275f..c154cebc1041 100644
--- a/arch/powerpc/crypto/sha1.c
+++ b/arch/powerpc/crypto/sha1.c
@@ -154,4 +154,5 @@ module_exit(sha1_powerpc_mod_fini);
154MODULE_LICENSE("GPL"); 154MODULE_LICENSE("GPL");
155MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm"); 155MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm");
156 156
157MODULE_ALIAS_CRYPTO("sha1");
157MODULE_ALIAS_CRYPTO("sha1-powerpc"); 158MODULE_ALIAS_CRYPTO("sha1-powerpc");
diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h
index 19c36cba37c4..a46f5f45570c 100644
--- a/arch/powerpc/include/asm/kexec.h
+++ b/arch/powerpc/include/asm/kexec.h
@@ -86,6 +86,11 @@ extern int overlaps_crashkernel(unsigned long start, unsigned long size);
86extern void reserve_crashkernel(void); 86extern void reserve_crashkernel(void);
87extern void machine_kexec_mask_interrupts(void); 87extern void machine_kexec_mask_interrupts(void);
88 88
89static inline bool kdump_in_progress(void)
90{
91 return crashing_cpu >= 0;
92}
93
89#else /* !CONFIG_KEXEC */ 94#else /* !CONFIG_KEXEC */
90static inline void crash_kexec_secondary(struct pt_regs *regs) { } 95static inline void crash_kexec_secondary(struct pt_regs *regs) { }
91 96
@@ -106,6 +111,11 @@ static inline int crash_shutdown_unregister(crash_shutdown_t handler)
106 return 0; 111 return 0;
107} 112}
108 113
114static inline bool kdump_in_progress(void)
115{
116 return false;
117}
118
109#endif /* CONFIG_KEXEC */ 119#endif /* CONFIG_KEXEC */
110#endif /* ! __ASSEMBLY__ */ 120#endif /* ! __ASSEMBLY__ */
111#endif /* __KERNEL__ */ 121#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index ce9577d693be..91062eef582f 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -366,3 +366,4 @@ SYSCALL_SPU(seccomp)
366SYSCALL_SPU(getrandom) 366SYSCALL_SPU(getrandom)
367SYSCALL_SPU(memfd_create) 367SYSCALL_SPU(memfd_create)
368SYSCALL_SPU(bpf) 368SYSCALL_SPU(bpf)
369COMPAT_SYS(execveat)
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index ebc4f165690a..0be6c681cab1 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -23,9 +23,9 @@
23#define THREAD_SIZE (1 << THREAD_SHIFT) 23#define THREAD_SIZE (1 << THREAD_SHIFT)
24 24
25#ifdef CONFIG_PPC64 25#ifdef CONFIG_PPC64
26#define CURRENT_THREAD_INFO(dest, sp) clrrdi dest, sp, THREAD_SHIFT 26#define CURRENT_THREAD_INFO(dest, sp) stringify_in_c(clrrdi dest, sp, THREAD_SHIFT)
27#else 27#else
28#define CURRENT_THREAD_INFO(dest, sp) rlwinm dest, sp, 0, 0, 31-THREAD_SHIFT 28#define CURRENT_THREAD_INFO(dest, sp) stringify_in_c(rlwinm dest, sp, 0, 0, 31-THREAD_SHIFT)
29#endif 29#endif
30 30
31#ifndef __ASSEMBLY__ 31#ifndef __ASSEMBLY__
@@ -71,12 +71,13 @@ struct thread_info {
71#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) 71#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT)
72 72
73/* how to get the thread information struct from C */ 73/* how to get the thread information struct from C */
74register unsigned long __current_r1 asm("r1");
75static inline struct thread_info *current_thread_info(void) 74static inline struct thread_info *current_thread_info(void)
76{ 75{
77 /* gcc4, at least, is smart enough to turn this into a single 76 unsigned long val;
78 * rlwinm for ppc32 and clrrdi for ppc64 */ 77
79 return (struct thread_info *)(__current_r1 & ~(THREAD_SIZE-1)); 78 asm (CURRENT_THREAD_INFO(%0,1) : "=r" (val));
79
80 return (struct thread_info *)val;
80} 81}
81 82
82#endif /* __ASSEMBLY__ */ 83#endif /* __ASSEMBLY__ */
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index e0da021caa00..36b79c31eedd 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -12,7 +12,7 @@
12#include <uapi/asm/unistd.h> 12#include <uapi/asm/unistd.h>
13 13
14 14
15#define __NR_syscalls 362 15#define __NR_syscalls 363
16 16
17#define __NR__exit __NR_exit 17#define __NR__exit __NR_exit
18#define NR_syscalls __NR_syscalls 18#define NR_syscalls __NR_syscalls
diff --git a/arch/powerpc/include/uapi/asm/unistd.h b/arch/powerpc/include/uapi/asm/unistd.h
index f55351f2e66e..ef5b5b1f3123 100644
--- a/arch/powerpc/include/uapi/asm/unistd.h
+++ b/arch/powerpc/include/uapi/asm/unistd.h
@@ -384,5 +384,6 @@
384#define __NR_getrandom 359 384#define __NR_getrandom 359
385#define __NR_memfd_create 360 385#define __NR_memfd_create 360
386#define __NR_bpf 361 386#define __NR_bpf 361
387#define __NR_execveat 362
387 388
388#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ 389#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index 879b3aacac32..f96d1ec24189 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -330,7 +330,7 @@ void default_machine_kexec(struct kimage *image)
330 * using debugger IPI. 330 * using debugger IPI.
331 */ 331 */
332 332
333 if (crashing_cpu == -1) 333 if (!kdump_in_progress())
334 kexec_prepare_cpus(); 334 kexec_prepare_cpus();
335 335
336 pr_debug("kexec: Starting switchover sequence.\n"); 336 pr_debug("kexec: Starting switchover sequence.\n");
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 37d512d35943..2a525c938158 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1184,6 +1184,8 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)
1184 pr, (pr && pr->name) ? pr->name : "nil"); 1184 pr, (pr && pr->name) ? pr->name : "nil");
1185 1185
1186 if (pr && !(pr->flags & IORESOURCE_UNSET)) { 1186 if (pr && !(pr->flags & IORESOURCE_UNSET)) {
1187 struct pci_dev *dev = bus->self;
1188
1187 if (request_resource(pr, res) == 0) 1189 if (request_resource(pr, res) == 0)
1188 continue; 1190 continue;
1189 /* 1191 /*
@@ -1193,6 +1195,11 @@ static void pcibios_allocate_bus_resources(struct pci_bus *bus)
1193 */ 1195 */
1194 if (reparent_resources(pr, res) == 0) 1196 if (reparent_resources(pr, res) == 0)
1195 continue; 1197 continue;
1198
1199 if (dev && i < PCI_BRIDGE_RESOURCE_NUM &&
1200 pci_claim_bridge_resource(dev,
1201 i + PCI_BRIDGE_RESOURCES) == 0)
1202 continue;
1196 } 1203 }
1197 pr_warning("PCI: Cannot allocate resource region " 1204 pr_warning("PCI: Cannot allocate resource region "
1198 "%d of PCI bridge %d, will remap\n", i, bus->number); 1205 "%d of PCI bridge %d, will remap\n", i, bus->number);
@@ -1401,7 +1408,10 @@ void pcibios_claim_one_bus(struct pci_bus *bus)
1401 (unsigned long long)r->end, 1408 (unsigned long long)r->end,
1402 (unsigned int)r->flags); 1409 (unsigned int)r->flags);
1403 1410
1404 pci_claim_resource(dev, i); 1411 if (pci_claim_resource(dev, i) == 0)
1412 continue;
1413
1414 pci_claim_bridge_resource(dev, i);
1405 } 1415 }
1406 } 1416 }
1407 1417
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 8ec017cb4446..8b2d2dc8ef10 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -700,6 +700,7 @@ void start_secondary(void *unused)
700 smp_store_cpu_info(cpu); 700 smp_store_cpu_info(cpu);
701 set_dec(tb_ticks_per_jiffy); 701 set_dec(tb_ticks_per_jiffy);
702 preempt_disable(); 702 preempt_disable();
703 cpu_callin_map[cpu] = 1;
703 704
704 if (smp_ops->setup_cpu) 705 if (smp_ops->setup_cpu)
705 smp_ops->setup_cpu(cpu); 706 smp_ops->setup_cpu(cpu);
@@ -738,14 +739,6 @@ void start_secondary(void *unused)
738 notify_cpu_starting(cpu); 739 notify_cpu_starting(cpu);
739 set_cpu_online(cpu, true); 740 set_cpu_online(cpu, true);
740 741
741 /*
742 * CPU must be marked active and online before we signal back to the
743 * master, because the scheduler needs to see the cpu_online and
744 * cpu_active bits set.
745 */
746 smp_wmb();
747 cpu_callin_map[cpu] = 1;
748
749 local_irq_enable(); 742 local_irq_enable();
750 743
751 cpu_startup_entry(CPUHP_ONLINE); 744 cpu_startup_entry(CPUHP_ONLINE);
diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index 1ca125b9c226..d1916b577f2c 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -699,7 +699,7 @@ out:
699void bpf_jit_free(struct bpf_prog *fp) 699void bpf_jit_free(struct bpf_prog *fp)
700{ 700{
701 if (fp->jited) 701 if (fp->jited)
702 module_free(NULL, fp->bpf_func); 702 module_memfree(fp->bpf_func);
703 703
704 bpf_prog_unlock_free(fp); 704 bpf_prog_unlock_free(fp);
705} 705}
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
index 54eca8b3b288..0509bca5e830 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -40,7 +40,6 @@ BEGIN_FTR_SECTION; \
40 b 1f; \ 40 b 1f; \
41END_FTR_SECTION(0, 1); \ 41END_FTR_SECTION(0, 1); \
42 ld r12,opal_tracepoint_refcount@toc(r2); \ 42 ld r12,opal_tracepoint_refcount@toc(r2); \
43 std r12,32(r1); \
44 cmpdi r12,0; \ 43 cmpdi r12,0; \
45 bne- LABEL; \ 44 bne- LABEL; \
461: 451:
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 469751d92004..b5682fd6c984 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -43,6 +43,7 @@
43#include <asm/trace.h> 43#include <asm/trace.h>
44#include <asm/firmware.h> 44#include <asm/firmware.h>
45#include <asm/plpar_wrappers.h> 45#include <asm/plpar_wrappers.h>
46#include <asm/kexec.h>
46#include <asm/fadump.h> 47#include <asm/fadump.h>
47 48
48#include "pseries.h" 49#include "pseries.h"
@@ -267,8 +268,13 @@ static void pSeries_lpar_hptab_clear(void)
267 * out to the user, but at least this will stop us from 268 * out to the user, but at least this will stop us from
268 * continuing on further and creating an even more 269 * continuing on further and creating an even more
269 * difficult to debug situation. 270 * difficult to debug situation.
271 *
272 * There is a known problem when kdump'ing, if cpus are offline
273 * the above call will fail. Rather than panicking again, keep
274 * going and hope the kdump kernel is also little endian, which
275 * it usually is.
270 */ 276 */
271 if (rc) 277 if (rc && !kdump_in_progress())
272 panic("Could not enable big endian exceptions"); 278 panic("Could not enable big endian exceptions");
273 } 279 }
274#endif 280#endif
diff --git a/arch/s390/hypfs/hypfs_vm.c b/arch/s390/hypfs/hypfs_vm.c
index 32040ace00ea..afbe07907c10 100644
--- a/arch/s390/hypfs/hypfs_vm.c
+++ b/arch/s390/hypfs/hypfs_vm.c
@@ -231,7 +231,7 @@ failed:
231struct dbfs_d2fc_hdr { 231struct dbfs_d2fc_hdr {
232 u64 len; /* Length of d2fc buffer without header */ 232 u64 len; /* Length of d2fc buffer without header */
233 u16 version; /* Version of header */ 233 u16 version; /* Version of header */
234 char tod_ext[16]; /* TOD clock for d2fc */ 234 char tod_ext[STORE_CLOCK_EXT_SIZE]; /* TOD clock for d2fc */
235 u64 count; /* Number of VM guests in d2fc buffer */ 235 u64 count; /* Number of VM guests in d2fc buffer */
236 char reserved[30]; 236 char reserved[30];
237} __attribute__ ((packed)); 237} __attribute__ ((packed));
diff --git a/arch/s390/include/asm/irqflags.h b/arch/s390/include/asm/irqflags.h
index 37b9091ab8c0..16aa0c779e07 100644
--- a/arch/s390/include/asm/irqflags.h
+++ b/arch/s390/include/asm/irqflags.h
@@ -36,7 +36,7 @@ static inline notrace void __arch_local_irq_ssm(unsigned long flags)
36 36
37static inline notrace unsigned long arch_local_save_flags(void) 37static inline notrace unsigned long arch_local_save_flags(void)
38{ 38{
39 return __arch_local_irq_stosm(0x00); 39 return __arch_local_irq_stnsm(0xff);
40} 40}
41 41
42static inline notrace unsigned long arch_local_irq_save(void) 42static inline notrace unsigned long arch_local_irq_save(void)
diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h
index 8beee1cceba4..98eb2a579223 100644
--- a/arch/s390/include/asm/timex.h
+++ b/arch/s390/include/asm/timex.h
@@ -67,20 +67,22 @@ static inline void local_tick_enable(unsigned long long comp)
67 set_clock_comparator(S390_lowcore.clock_comparator); 67 set_clock_comparator(S390_lowcore.clock_comparator);
68} 68}
69 69
70#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ 70#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
71#define STORE_CLOCK_EXT_SIZE 16 /* stcke writes 16 bytes */
71 72
72typedef unsigned long long cycles_t; 73typedef unsigned long long cycles_t;
73 74
74static inline void get_tod_clock_ext(char clk[16]) 75static inline void get_tod_clock_ext(char *clk)
75{ 76{
76 typedef struct { char _[sizeof(clk)]; } addrtype; 77 typedef struct { char _[STORE_CLOCK_EXT_SIZE]; } addrtype;
77 78
78 asm volatile("stcke %0" : "=Q" (*(addrtype *) clk) : : "cc"); 79 asm volatile("stcke %0" : "=Q" (*(addrtype *) clk) : : "cc");
79} 80}
80 81
81static inline unsigned long long get_tod_clock(void) 82static inline unsigned long long get_tod_clock(void)
82{ 83{
83 unsigned char clk[16]; 84 unsigned char clk[STORE_CLOCK_EXT_SIZE];
85
84 get_tod_clock_ext(clk); 86 get_tod_clock_ext(clk);
85 return *((unsigned long long *)&clk[1]); 87 return *((unsigned long long *)&clk[1]);
86} 88}
diff --git a/arch/s390/include/uapi/asm/unistd.h b/arch/s390/include/uapi/asm/unistd.h
index 2b446cf0cc65..67878af257a0 100644
--- a/arch/s390/include/uapi/asm/unistd.h
+++ b/arch/s390/include/uapi/asm/unistd.h
@@ -289,7 +289,8 @@
289#define __NR_bpf 351 289#define __NR_bpf 351
290#define __NR_s390_pci_mmio_write 352 290#define __NR_s390_pci_mmio_write 352
291#define __NR_s390_pci_mmio_read 353 291#define __NR_s390_pci_mmio_read 353
292#define NR_syscalls 354 292#define __NR_execveat 354
293#define NR_syscalls 355
293 294
294/* 295/*
295 * There are some system calls that are not present on 64 bit, some 296 * There are some system calls that are not present on 64 bit, some
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
index b89b59158b95..409d152585be 100644
--- a/arch/s390/kernel/module.c
+++ b/arch/s390/kernel/module.c
@@ -55,14 +55,10 @@ void *module_alloc(unsigned long size)
55} 55}
56#endif 56#endif
57 57
58/* Free memory returned from module_alloc */ 58void module_arch_freeing_init(struct module *mod)
59void module_free(struct module *mod, void *module_region)
60{ 59{
61 if (mod) { 60 vfree(mod->arch.syminfo);
62 vfree(mod->arch.syminfo); 61 mod->arch.syminfo = NULL;
63 mod->arch.syminfo = NULL;
64 }
65 vfree(module_region);
66} 62}
67 63
68static void check_rela(Elf_Rela *rela, struct module *me) 64static void check_rela(Elf_Rela *rela, struct module *me)
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index a2987243bc76..939ec474b1dd 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -362,3 +362,4 @@ SYSCALL(sys_memfd_create,sys_memfd_create,compat_sys_memfd_create) /* 350 */
362SYSCALL(sys_bpf,sys_bpf,compat_sys_bpf) 362SYSCALL(sys_bpf,sys_bpf,compat_sys_bpf)
363SYSCALL(sys_ni_syscall,sys_s390_pci_mmio_write,compat_sys_s390_pci_mmio_write) 363SYSCALL(sys_ni_syscall,sys_s390_pci_mmio_write,compat_sys_s390_pci_mmio_write)
364SYSCALL(sys_ni_syscall,sys_s390_pci_mmio_read,compat_sys_s390_pci_mmio_read) 364SYSCALL(sys_ni_syscall,sys_s390_pci_mmio_read,compat_sys_s390_pci_mmio_read)
365SYSCALL(sys_execveat,sys_execveat,compat_sys_execveat)
diff --git a/arch/s390/kernel/uprobes.c b/arch/s390/kernel/uprobes.c
index f6b3cd056ec2..cc7328080b60 100644
--- a/arch/s390/kernel/uprobes.c
+++ b/arch/s390/kernel/uprobes.c
@@ -48,6 +48,30 @@ bool arch_uprobe_xol_was_trapped(struct task_struct *tsk)
48 return false; 48 return false;
49} 49}
50 50
51static int check_per_event(unsigned short cause, unsigned long control,
52 struct pt_regs *regs)
53{
54 if (!(regs->psw.mask & PSW_MASK_PER))
55 return 0;
56 /* user space single step */
57 if (control == 0)
58 return 1;
59 /* over indication for storage alteration */
60 if ((control & 0x20200000) && (cause & 0x2000))
61 return 1;
62 if (cause & 0x8000) {
63 /* all branches */
64 if ((control & 0x80800000) == 0x80000000)
65 return 1;
66 /* branch into selected range */
67 if (((control & 0x80800000) == 0x80800000) &&
68 regs->psw.addr >= current->thread.per_user.start &&
69 regs->psw.addr <= current->thread.per_user.end)
70 return 1;
71 }
72 return 0;
73}
74
51int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) 75int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
52{ 76{
53 int fixup = probe_get_fixup_type(auprobe->insn); 77 int fixup = probe_get_fixup_type(auprobe->insn);
@@ -71,9 +95,13 @@ int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
71 if (regs->psw.addr - utask->xol_vaddr == ilen) 95 if (regs->psw.addr - utask->xol_vaddr == ilen)
72 regs->psw.addr = utask->vaddr + ilen; 96 regs->psw.addr = utask->vaddr + ilen;
73 } 97 }
74 /* If per tracing was active generate trap */ 98 if (check_per_event(current->thread.per_event.cause,
75 if (regs->psw.mask & PSW_MASK_PER) 99 current->thread.per_user.control, regs)) {
76 do_per_trap(regs); 100 /* fix per address */
101 current->thread.per_event.address = utask->vaddr;
102 /* trigger per event */
103 set_pt_regs_flag(regs, PIF_PER_TRAP);
104 }
77 return 0; 105 return 0;
78} 106}
79 107
@@ -106,6 +134,7 @@ void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs)
106 clear_thread_flag(TIF_UPROBE_SINGLESTEP); 134 clear_thread_flag(TIF_UPROBE_SINGLESTEP);
107 regs->int_code = auprobe->saved_int_code; 135 regs->int_code = auprobe->saved_int_code;
108 regs->psw.addr = current->utask->vaddr; 136 regs->psw.addr = current->utask->vaddr;
137 current->thread.per_event.address = current->utask->vaddr;
109} 138}
110 139
111unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline, 140unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline,
@@ -146,17 +175,20 @@ static void adjust_psw_addr(psw_t *psw, unsigned long len)
146 __rc; \ 175 __rc; \
147}) 176})
148 177
149#define emu_store_ril(ptr, input) \ 178#define emu_store_ril(regs, ptr, input) \
150({ \ 179({ \
151 unsigned int mask = sizeof(*(ptr)) - 1; \ 180 unsigned int mask = sizeof(*(ptr)) - 1; \
181 __typeof__(ptr) __ptr = (ptr); \
152 int __rc = 0; \ 182 int __rc = 0; \
153 \ 183 \
154 if (!test_facility(34)) \ 184 if (!test_facility(34)) \
155 __rc = EMU_ILLEGAL_OP; \ 185 __rc = EMU_ILLEGAL_OP; \
156 else if ((u64 __force)ptr & mask) \ 186 else if ((u64 __force)__ptr & mask) \
157 __rc = EMU_SPECIFICATION; \ 187 __rc = EMU_SPECIFICATION; \
158 else if (put_user(*(input), ptr)) \ 188 else if (put_user(*(input), __ptr)) \
159 __rc = EMU_ADDRESSING; \ 189 __rc = EMU_ADDRESSING; \
190 if (__rc == 0) \
191 sim_stor_event(regs, __ptr, mask + 1); \
160 __rc; \ 192 __rc; \
161}) 193})
162 194
@@ -198,6 +230,25 @@ union split_register {
198}; 230};
199 231
200/* 232/*
233 * If user per registers are setup to trace storage alterations and an
234 * emulated store took place on a fitting address a user trap is generated.
235 */
236static void sim_stor_event(struct pt_regs *regs, void *addr, int len)
237{
238 if (!(regs->psw.mask & PSW_MASK_PER))
239 return;
240 if (!(current->thread.per_user.control & PER_EVENT_STORE))
241 return;
242 if ((void *)current->thread.per_user.start > (addr + len))
243 return;
244 if ((void *)current->thread.per_user.end < addr)
245 return;
246 current->thread.per_event.address = regs->psw.addr;
247 current->thread.per_event.cause = PER_EVENT_STORE >> 16;
248 set_pt_regs_flag(regs, PIF_PER_TRAP);
249}
250
251/*
201 * pc relative instructions are emulated, since parameters may not be 252 * pc relative instructions are emulated, since parameters may not be
202 * accessible from the xol area due to range limitations. 253 * accessible from the xol area due to range limitations.
203 */ 254 */
@@ -249,13 +300,13 @@ static void handle_insn_ril(struct arch_uprobe *auprobe, struct pt_regs *regs)
249 rc = emu_load_ril((u32 __user *)uptr, &rx->u64); 300 rc = emu_load_ril((u32 __user *)uptr, &rx->u64);
250 break; 301 break;
251 case 0x07: /* sthrl */ 302 case 0x07: /* sthrl */
252 rc = emu_store_ril((u16 __user *)uptr, &rx->u16[3]); 303 rc = emu_store_ril(regs, (u16 __user *)uptr, &rx->u16[3]);
253 break; 304 break;
254 case 0x0b: /* stgrl */ 305 case 0x0b: /* stgrl */
255 rc = emu_store_ril((u64 __user *)uptr, &rx->u64); 306 rc = emu_store_ril(regs, (u64 __user *)uptr, &rx->u64);
256 break; 307 break;
257 case 0x0f: /* strl */ 308 case 0x0f: /* strl */
258 rc = emu_store_ril((u32 __user *)uptr, &rx->u32[1]); 309 rc = emu_store_ril(regs, (u32 __user *)uptr, &rx->u32[1]);
259 break; 310 break;
260 } 311 }
261 break; 312 break;
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index 7f0089d9a4aa..e34122e539a1 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -128,8 +128,6 @@ void vtime_account_irq_enter(struct task_struct *tsk)
128 struct thread_info *ti = task_thread_info(tsk); 128 struct thread_info *ti = task_thread_info(tsk);
129 u64 timer, system; 129 u64 timer, system;
130 130
131 WARN_ON_ONCE(!irqs_disabled());
132
133 timer = S390_lowcore.last_update_timer; 131 timer = S390_lowcore.last_update_timer;
134 S390_lowcore.last_update_timer = get_vtimer(); 132 S390_lowcore.last_update_timer = get_vtimer();
135 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer; 133 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer;
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index be99357d238c..3cf8cc03fff6 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -322,11 +322,12 @@ static int gmap_alloc_table(struct gmap *gmap, unsigned long *table,
322static unsigned long __gmap_segment_gaddr(unsigned long *entry) 322static unsigned long __gmap_segment_gaddr(unsigned long *entry)
323{ 323{
324 struct page *page; 324 struct page *page;
325 unsigned long offset; 325 unsigned long offset, mask;
326 326
327 offset = (unsigned long) entry / sizeof(unsigned long); 327 offset = (unsigned long) entry / sizeof(unsigned long);
328 offset = (offset & (PTRS_PER_PMD - 1)) * PMD_SIZE; 328 offset = (offset & (PTRS_PER_PMD - 1)) * PMD_SIZE;
329 page = pmd_to_page((pmd_t *) entry); 329 mask = ~(PTRS_PER_PMD * sizeof(pmd_t) - 1);
330 page = virt_to_page((void *)((unsigned long) entry & mask));
330 return page->index + offset; 331 return page->index + offset;
331} 332}
332 333
diff --git a/arch/s390/net/bpf_jit.S b/arch/s390/net/bpf_jit.S
index 7e45d13816c1..ba44c9f55346 100644
--- a/arch/s390/net/bpf_jit.S
+++ b/arch/s390/net/bpf_jit.S
@@ -22,8 +22,8 @@
22 * skb_copy_bits takes 4 parameters: 22 * skb_copy_bits takes 4 parameters:
23 * %r2 = skb pointer 23 * %r2 = skb pointer
24 * %r3 = offset into skb data 24 * %r3 = offset into skb data
25 * %r4 = length to copy 25 * %r4 = pointer to temp buffer
26 * %r5 = pointer to temp buffer 26 * %r5 = length to copy
27 */ 27 */
28#define SKBDATA %r8 28#define SKBDATA %r8
29 29
@@ -44,8 +44,9 @@ ENTRY(sk_load_word)
44 44
45sk_load_word_slow: 45sk_load_word_slow:
46 lgr %r9,%r2 # save %r2 46 lgr %r9,%r2 # save %r2
47 lhi %r4,4 # 4 bytes 47 lgr %r3,%r1 # offset
48 la %r5,160(%r15) # pointer to temp buffer 48 la %r4,160(%r15) # pointer to temp buffer
49 lghi %r5,4 # 4 bytes
49 brasl %r14,skb_copy_bits # get data from skb 50 brasl %r14,skb_copy_bits # get data from skb
50 l %r5,160(%r15) # load result from temp buffer 51 l %r5,160(%r15) # load result from temp buffer
51 ltgr %r2,%r2 # set cc to (%r2 != 0) 52 ltgr %r2,%r2 # set cc to (%r2 != 0)
@@ -69,8 +70,9 @@ ENTRY(sk_load_half)
69 70
70sk_load_half_slow: 71sk_load_half_slow:
71 lgr %r9,%r2 # save %r2 72 lgr %r9,%r2 # save %r2
72 lhi %r4,2 # 2 bytes 73 lgr %r3,%r1 # offset
73 la %r5,162(%r15) # pointer to temp buffer 74 la %r4,162(%r15) # pointer to temp buffer
75 lghi %r5,2 # 2 bytes
74 brasl %r14,skb_copy_bits # get data from skb 76 brasl %r14,skb_copy_bits # get data from skb
75 xc 160(2,%r15),160(%r15) 77 xc 160(2,%r15),160(%r15)
76 l %r5,160(%r15) # load result from temp buffer 78 l %r5,160(%r15) # load result from temp buffer
@@ -95,8 +97,9 @@ ENTRY(sk_load_byte)
95 97
96sk_load_byte_slow: 98sk_load_byte_slow:
97 lgr %r9,%r2 # save %r2 99 lgr %r9,%r2 # save %r2
98 lhi %r4,1 # 1 bytes 100 lgr %r3,%r1 # offset
99 la %r5,163(%r15) # pointer to temp buffer 101 la %r4,163(%r15) # pointer to temp buffer
102 lghi %r5,1 # 1 byte
100 brasl %r14,skb_copy_bits # get data from skb 103 brasl %r14,skb_copy_bits # get data from skb
101 xc 160(3,%r15),160(%r15) 104 xc 160(3,%r15),160(%r15)
102 l %r5,160(%r15) # load result from temp buffer 105 l %r5,160(%r15) # load result from temp buffer
@@ -104,11 +107,11 @@ sk_load_byte_slow:
104 lgr %r2,%r9 # restore %r2 107 lgr %r2,%r9 # restore %r2
105 br %r8 108 br %r8
106 109
107 /* A = (*(u8 *)(skb->data+K) & 0xf) << 2 */ 110 /* X = (*(u8 *)(skb->data+K) & 0xf) << 2 */
108ENTRY(sk_load_byte_msh) 111ENTRY(sk_load_byte_msh)
109 llgfr %r1,%r3 # extend offset 112 llgfr %r1,%r3 # extend offset
110 clr %r11,%r3 # hlen < offset ? 113 clr %r11,%r3 # hlen < offset ?
111 jle sk_load_byte_slow 114 jle sk_load_byte_msh_slow
112 lhi %r12,0 115 lhi %r12,0
113 ic %r12,0(%r1,%r10) # get byte from skb 116 ic %r12,0(%r1,%r10) # get byte from skb
114 nill %r12,0x0f 117 nill %r12,0x0f
@@ -118,8 +121,9 @@ ENTRY(sk_load_byte_msh)
118 121
119sk_load_byte_msh_slow: 122sk_load_byte_msh_slow:
120 lgr %r9,%r2 # save %r2 123 lgr %r9,%r2 # save %r2
121 lhi %r4,2 # 2 bytes 124 lgr %r3,%r1 # offset
122 la %r5,162(%r15) # pointer to temp buffer 125 la %r4,163(%r15) # pointer to temp buffer
126 lghi %r5,1 # 1 byte
123 brasl %r14,skb_copy_bits # get data from skb 127 brasl %r14,skb_copy_bits # get data from skb
124 xc 160(3,%r15),160(%r15) 128 xc 160(3,%r15),160(%r15)
125 l %r12,160(%r15) # load result from temp buffer 129 l %r12,160(%r15) # load result from temp buffer
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index c52ac77408ca..bbd1981cc150 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -431,8 +431,8 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct sock_filter *filter,
431 EMIT4_DISP(0x88500000, K); 431 EMIT4_DISP(0x88500000, K);
432 break; 432 break;
433 case BPF_ALU | BPF_NEG: /* A = -A */ 433 case BPF_ALU | BPF_NEG: /* A = -A */
434 /* lnr %r5,%r5 */ 434 /* lcr %r5,%r5 */
435 EMIT2(0x1155); 435 EMIT2(0x1355);
436 break; 436 break;
437 case BPF_JMP | BPF_JA: /* ip += K */ 437 case BPF_JMP | BPF_JA: /* ip += K */
438 offset = addrs[i + K] + jit->start - jit->prg; 438 offset = addrs[i + K] + jit->start - jit->prg;
@@ -448,15 +448,12 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct sock_filter *filter,
448 mask = 0x800000; /* je */ 448 mask = 0x800000; /* je */
449kbranch: /* Emit compare if the branch targets are different */ 449kbranch: /* Emit compare if the branch targets are different */
450 if (filter->jt != filter->jf) { 450 if (filter->jt != filter->jf) {
451 if (K <= 16383) 451 if (test_facility(21))
452 /* chi %r5,<K> */
453 EMIT4_IMM(0xa75e0000, K);
454 else if (test_facility(21))
455 /* clfi %r5,<K> */ 452 /* clfi %r5,<K> */
456 EMIT6_IMM(0xc25f0000, K); 453 EMIT6_IMM(0xc25f0000, K);
457 else 454 else
458 /* c %r5,<d(K)>(%r13) */ 455 /* cl %r5,<d(K)>(%r13) */
459 EMIT4_DISP(0x5950d000, EMIT_CONST(K)); 456 EMIT4_DISP(0x5550d000, EMIT_CONST(K));
460 } 457 }
461branch: if (filter->jt == filter->jf) { 458branch: if (filter->jt == filter->jf) {
462 if (filter->jt == 0) 459 if (filter->jt == 0)
@@ -502,8 +499,8 @@ branch: if (filter->jt == filter->jf) {
502xbranch: /* Emit compare if the branch targets are different */ 499xbranch: /* Emit compare if the branch targets are different */
503 if (filter->jt != filter->jf) { 500 if (filter->jt != filter->jf) {
504 jit->seen |= SEEN_XREG; 501 jit->seen |= SEEN_XREG;
505 /* cr %r5,%r12 */ 502 /* clr %r5,%r12 */
506 EMIT2(0x195c); 503 EMIT2(0x155c);
507 } 504 }
508 goto branch; 505 goto branch;
509 case BPF_JMP | BPF_JSET | BPF_X: /* ip += (A & X) ? jt : jf */ 506 case BPF_JMP | BPF_JSET | BPF_X: /* ip += (A & X) ? jt : jf */
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index b36365f49478..9ce5afe167ff 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -639,7 +639,10 @@ static void pci_claim_bus_resources(struct pci_bus *bus)
639 (unsigned long long)r->end, 639 (unsigned long long)r->end,
640 (unsigned int)r->flags); 640 (unsigned int)r->flags);
641 641
642 pci_claim_resource(dev, i); 642 if (pci_claim_resource(dev, i) == 0)
643 continue;
644
645 pci_claim_bridge_resource(dev, i);
643 } 646 }
644 } 647 }
645 648
diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c
index f33e7c7a3bf7..7931eeeb649a 100644
--- a/arch/sparc/net/bpf_jit_comp.c
+++ b/arch/sparc/net/bpf_jit_comp.c
@@ -776,7 +776,7 @@ cond_branch: f_offset = addrs[i + filter[i].jf];
776 if (unlikely(proglen + ilen > oldproglen)) { 776 if (unlikely(proglen + ilen > oldproglen)) {
777 pr_err("bpb_jit_compile fatal error\n"); 777 pr_err("bpb_jit_compile fatal error\n");
778 kfree(addrs); 778 kfree(addrs);
779 module_free(NULL, image); 779 module_memfree(image);
780 return; 780 return;
781 } 781 }
782 memcpy(image + proglen, temp, ilen); 782 memcpy(image + proglen, temp, ilen);
@@ -822,7 +822,7 @@ out:
822void bpf_jit_free(struct bpf_prog *fp) 822void bpf_jit_free(struct bpf_prog *fp)
823{ 823{
824 if (fp->jited) 824 if (fp->jited)
825 module_free(NULL, fp->bpf_func); 825 module_memfree(fp->bpf_func);
826 826
827 bpf_prog_unlock_free(fp); 827 bpf_prog_unlock_free(fp);
828} 828}
diff --git a/arch/tile/kernel/module.c b/arch/tile/kernel/module.c
index 96447c9160a0..2305084c9b93 100644
--- a/arch/tile/kernel/module.c
+++ b/arch/tile/kernel/module.c
@@ -74,7 +74,7 @@ error:
74 74
75 75
76/* Free memory returned from module_alloc */ 76/* Free memory returned from module_alloc */
77void module_free(struct module *mod, void *module_region) 77void module_memfree(void *module_region)
78{ 78{
79 vfree(module_region); 79 vfree(module_region);
80 80
@@ -83,7 +83,7 @@ void module_free(struct module *mod, void *module_region)
83 0, 0, 0, NULL, NULL, 0); 83 0, 0, 0, NULL, NULL, 0);
84 84
85 /* 85 /*
86 * FIXME: If module_region == mod->module_init, trim exception 86 * FIXME: Add module_arch_freeing_init to trim exception
87 * table entries. 87 * table entries.
88 */ 88 */
89} 89}
diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common
index 87bc86821bc9..d195a87ca542 100644
--- a/arch/um/Kconfig.common
+++ b/arch/um/Kconfig.common
@@ -3,6 +3,7 @@ config UML
3 default y 3 default y
4 select HAVE_ARCH_AUDITSYSCALL 4 select HAVE_ARCH_AUDITSYSCALL
5 select HAVE_UID16 5 select HAVE_UID16
6 select HAVE_FUTEX_CMPXCHG if FUTEX
6 select GENERIC_IRQ_SHOW 7 select GENERIC_IRQ_SHOW
7 select GENERIC_CPU_DEVICES 8 select GENERIC_CPU_DEVICES
8 select GENERIC_IO 9 select GENERIC_IO
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index ba397bde7948..0dc9d0144a27 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -857,7 +857,7 @@ source "kernel/Kconfig.preempt"
857 857
858config X86_UP_APIC 858config X86_UP_APIC
859 bool "Local APIC support on uniprocessors" 859 bool "Local APIC support on uniprocessors"
860 depends on X86_32 && !SMP && !X86_32_NON_STANDARD && !PCI_MSI 860 depends on X86_32 && !SMP && !X86_32_NON_STANDARD
861 ---help--- 861 ---help---
862 A local APIC (Advanced Programmable Interrupt Controller) is an 862 A local APIC (Advanced Programmable Interrupt Controller) is an
863 integrated interrupt controller in the CPU. If you have a single-CPU 863 integrated interrupt controller in the CPU. If you have a single-CPU
@@ -868,6 +868,10 @@ config X86_UP_APIC
868 performance counters), and the NMI watchdog which detects hard 868 performance counters), and the NMI watchdog which detects hard
869 lockups. 869 lockups.
870 870
871config X86_UP_APIC_MSI
872 def_bool y
873 select X86_UP_APIC if X86_32 && !SMP && !X86_32_NON_STANDARD && PCI_MSI
874
871config X86_UP_IOAPIC 875config X86_UP_IOAPIC
872 bool "IO-APIC support on uniprocessors" 876 bool "IO-APIC support on uniprocessors"
873 depends on X86_UP_APIC 877 depends on X86_UP_APIC
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index 5b016e2498f3..3db07f30636f 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -51,6 +51,7 @@ targets += cpustr.h
51$(obj)/cpustr.h: $(obj)/mkcpustr FORCE 51$(obj)/cpustr.h: $(obj)/mkcpustr FORCE
52 $(call if_changed,cpustr) 52 $(call if_changed,cpustr)
53endif 53endif
54clean-files += cpustr.h
54 55
55# --------------------------------------------------------------------------- 56# ---------------------------------------------------------------------------
56 57
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index dcc1c536cc21..a950864a64da 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -373,6 +373,8 @@ asmlinkage __visible void *decompress_kernel(void *rmode, memptr heap,
373 unsigned long output_len, 373 unsigned long output_len,
374 unsigned long run_size) 374 unsigned long run_size)
375{ 375{
376 unsigned char *output_orig = output;
377
376 real_mode = rmode; 378 real_mode = rmode;
377 379
378 sanitize_boot_params(real_mode); 380 sanitize_boot_params(real_mode);
@@ -421,7 +423,12 @@ asmlinkage __visible void *decompress_kernel(void *rmode, memptr heap,
421 debug_putstr("\nDecompressing Linux... "); 423 debug_putstr("\nDecompressing Linux... ");
422 decompress(input_data, input_len, NULL, NULL, output, NULL, error); 424 decompress(input_data, input_len, NULL, NULL, output, NULL, error);
423 parse_elf(output); 425 parse_elf(output);
424 handle_relocations(output, output_len); 426 /*
427 * 32-bit always performs relocations. 64-bit relocations are only
428 * needed if kASLR has chosen a different load address.
429 */
430 if (!IS_ENABLED(CONFIG_X86_64) || output != output_orig)
431 handle_relocations(output, output_len);
425 debug_putstr("done.\nBooting the kernel.\n"); 432 debug_putstr("done.\nBooting the kernel.\n");
426 return output; 433 return output;
427} 434}
diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile
index fd0f848938cc..5a4a089e8b1f 100644
--- a/arch/x86/crypto/Makefile
+++ b/arch/x86/crypto/Makefile
@@ -26,7 +26,6 @@ obj-$(CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL) += ghash-clmulni-intel.o
26 26
27obj-$(CONFIG_CRYPTO_CRC32C_INTEL) += crc32c-intel.o 27obj-$(CONFIG_CRYPTO_CRC32C_INTEL) += crc32c-intel.o
28obj-$(CONFIG_CRYPTO_SHA1_SSSE3) += sha1-ssse3.o 28obj-$(CONFIG_CRYPTO_SHA1_SSSE3) += sha1-ssse3.o
29obj-$(CONFIG_CRYPTO_SHA1_MB) += sha-mb/
30obj-$(CONFIG_CRYPTO_CRC32_PCLMUL) += crc32-pclmul.o 29obj-$(CONFIG_CRYPTO_CRC32_PCLMUL) += crc32-pclmul.o
31obj-$(CONFIG_CRYPTO_SHA256_SSSE3) += sha256-ssse3.o 30obj-$(CONFIG_CRYPTO_SHA256_SSSE3) += sha256-ssse3.o
32obj-$(CONFIG_CRYPTO_SHA512_SSSE3) += sha512-ssse3.o 31obj-$(CONFIG_CRYPTO_SHA512_SSSE3) += sha512-ssse3.o
@@ -46,6 +45,7 @@ endif
46ifeq ($(avx2_supported),yes) 45ifeq ($(avx2_supported),yes)
47 obj-$(CONFIG_CRYPTO_CAMELLIA_AESNI_AVX2_X86_64) += camellia-aesni-avx2.o 46 obj-$(CONFIG_CRYPTO_CAMELLIA_AESNI_AVX2_X86_64) += camellia-aesni-avx2.o
48 obj-$(CONFIG_CRYPTO_SERPENT_AVX2_X86_64) += serpent-avx2.o 47 obj-$(CONFIG_CRYPTO_SERPENT_AVX2_X86_64) += serpent-avx2.o
48 obj-$(CONFIG_CRYPTO_SHA1_MB) += sha-mb/
49endif 49endif
50 50
51aes-i586-y := aes-i586-asm_32.o aes_glue.o 51aes-i586-y := aes-i586-asm_32.o aes_glue.o
diff --git a/arch/x86/crypto/aes_ctrby8_avx-x86_64.S b/arch/x86/crypto/aes_ctrby8_avx-x86_64.S
index 2df2a0298f5a..a916c4a61165 100644
--- a/arch/x86/crypto/aes_ctrby8_avx-x86_64.S
+++ b/arch/x86/crypto/aes_ctrby8_avx-x86_64.S
@@ -208,7 +208,7 @@ ddq_add_8:
208 208
209 .if (klen == KEY_128) 209 .if (klen == KEY_128)
210 .if (load_keys) 210 .if (load_keys)
211 vmovdqa 3*16(p_keys), xkeyA 211 vmovdqa 3*16(p_keys), xkey4
212 .endif 212 .endif
213 .else 213 .else
214 vmovdqa 3*16(p_keys), xkeyA 214 vmovdqa 3*16(p_keys), xkeyA
@@ -224,7 +224,7 @@ ddq_add_8:
224 add $(16*by), p_in 224 add $(16*by), p_in
225 225
226 .if (klen == KEY_128) 226 .if (klen == KEY_128)
227 vmovdqa 4*16(p_keys), xkey4 227 vmovdqa 4*16(p_keys), xkeyB
228 .else 228 .else
229 .if (load_keys) 229 .if (load_keys)
230 vmovdqa 4*16(p_keys), xkey4 230 vmovdqa 4*16(p_keys), xkey4
@@ -234,7 +234,12 @@ ddq_add_8:
234 .set i, 0 234 .set i, 0
235 .rept by 235 .rept by
236 club XDATA, i 236 club XDATA, i
237 vaesenc xkeyA, var_xdata, var_xdata /* key 3 */ 237 /* key 3 */
238 .if (klen == KEY_128)
239 vaesenc xkey4, var_xdata, var_xdata
240 .else
241 vaesenc xkeyA, var_xdata, var_xdata
242 .endif
238 .set i, (i +1) 243 .set i, (i +1)
239 .endr 244 .endr
240 245
@@ -243,13 +248,18 @@ ddq_add_8:
243 .set i, 0 248 .set i, 0
244 .rept by 249 .rept by
245 club XDATA, i 250 club XDATA, i
246 vaesenc xkey4, var_xdata, var_xdata /* key 4 */ 251 /* key 4 */
252 .if (klen == KEY_128)
253 vaesenc xkeyB, var_xdata, var_xdata
254 .else
255 vaesenc xkey4, var_xdata, var_xdata
256 .endif
247 .set i, (i +1) 257 .set i, (i +1)
248 .endr 258 .endr
249 259
250 .if (klen == KEY_128) 260 .if (klen == KEY_128)
251 .if (load_keys) 261 .if (load_keys)
252 vmovdqa 6*16(p_keys), xkeyB 262 vmovdqa 6*16(p_keys), xkey8
253 .endif 263 .endif
254 .else 264 .else
255 vmovdqa 6*16(p_keys), xkeyB 265 vmovdqa 6*16(p_keys), xkeyB
@@ -267,12 +277,17 @@ ddq_add_8:
267 .set i, 0 277 .set i, 0
268 .rept by 278 .rept by
269 club XDATA, i 279 club XDATA, i
270 vaesenc xkeyB, var_xdata, var_xdata /* key 6 */ 280 /* key 6 */
281 .if (klen == KEY_128)
282 vaesenc xkey8, var_xdata, var_xdata
283 .else
284 vaesenc xkeyB, var_xdata, var_xdata
285 .endif
271 .set i, (i +1) 286 .set i, (i +1)
272 .endr 287 .endr
273 288
274 .if (klen == KEY_128) 289 .if (klen == KEY_128)
275 vmovdqa 8*16(p_keys), xkey8 290 vmovdqa 8*16(p_keys), xkeyB
276 .else 291 .else
277 .if (load_keys) 292 .if (load_keys)
278 vmovdqa 8*16(p_keys), xkey8 293 vmovdqa 8*16(p_keys), xkey8
@@ -288,7 +303,7 @@ ddq_add_8:
288 303
289 .if (klen == KEY_128) 304 .if (klen == KEY_128)
290 .if (load_keys) 305 .if (load_keys)
291 vmovdqa 9*16(p_keys), xkeyA 306 vmovdqa 9*16(p_keys), xkey12
292 .endif 307 .endif
293 .else 308 .else
294 vmovdqa 9*16(p_keys), xkeyA 309 vmovdqa 9*16(p_keys), xkeyA
@@ -297,7 +312,12 @@ ddq_add_8:
297 .set i, 0 312 .set i, 0
298 .rept by 313 .rept by
299 club XDATA, i 314 club XDATA, i
300 vaesenc xkey8, var_xdata, var_xdata /* key 8 */ 315 /* key 8 */
316 .if (klen == KEY_128)
317 vaesenc xkeyB, var_xdata, var_xdata
318 .else
319 vaesenc xkey8, var_xdata, var_xdata
320 .endif
301 .set i, (i +1) 321 .set i, (i +1)
302 .endr 322 .endr
303 323
@@ -306,7 +326,12 @@ ddq_add_8:
306 .set i, 0 326 .set i, 0
307 .rept by 327 .rept by
308 club XDATA, i 328 club XDATA, i
309 vaesenc xkeyA, var_xdata, var_xdata /* key 9 */ 329 /* key 9 */
330 .if (klen == KEY_128)
331 vaesenc xkey12, var_xdata, var_xdata
332 .else
333 vaesenc xkeyA, var_xdata, var_xdata
334 .endif
310 .set i, (i +1) 335 .set i, (i +1)
311 .endr 336 .endr
312 337
@@ -412,7 +437,6 @@ ddq_add_8:
412/* main body of aes ctr load */ 437/* main body of aes ctr load */
413 438
414.macro do_aes_ctrmain key_len 439.macro do_aes_ctrmain key_len
415
416 cmp $16, num_bytes 440 cmp $16, num_bytes
417 jb .Ldo_return2\key_len 441 jb .Ldo_return2\key_len
418 442
diff --git a/arch/x86/crypto/sha-mb/sha1_mb.c b/arch/x86/crypto/sha-mb/sha1_mb.c
index a225a5ca1037..fd9f6b035b16 100644
--- a/arch/x86/crypto/sha-mb/sha1_mb.c
+++ b/arch/x86/crypto/sha-mb/sha1_mb.c
@@ -931,4 +931,4 @@ module_exit(sha1_mb_mod_fini);
931MODULE_LICENSE("GPL"); 931MODULE_LICENSE("GPL");
932MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm, multi buffer accelerated"); 932MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm, multi buffer accelerated");
933 933
934MODULE_ALIAS("sha1"); 934MODULE_ALIAS_CRYPTO("sha1");
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index 0ab4f9fd2687..3a45668f6dc3 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -50,6 +50,7 @@ void acpi_pic_sci_set_trigger(unsigned int, u16);
50 50
51extern int (*__acpi_register_gsi)(struct device *dev, u32 gsi, 51extern int (*__acpi_register_gsi)(struct device *dev, u32 gsi,
52 int trigger, int polarity); 52 int trigger, int polarity);
53extern void (*__acpi_unregister_gsi)(u32 gsi);
53 54
54static inline void disable_acpi(void) 55static inline void disable_acpi(void)
55{ 56{
diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
index 50d033a8947d..a94b82e8f156 100644
--- a/arch/x86/include/asm/desc.h
+++ b/arch/x86/include/asm/desc.h
@@ -251,7 +251,8 @@ static inline void native_load_tls(struct thread_struct *t, unsigned int cpu)
251 gdt[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i]; 251 gdt[GDT_ENTRY_TLS_MIN + i] = t->tls_array[i];
252} 252}
253 253
254#define _LDT_empty(info) \ 254/* This intentionally ignores lm, since 32-bit apps don't have that field. */
255#define LDT_empty(info) \
255 ((info)->base_addr == 0 && \ 256 ((info)->base_addr == 0 && \
256 (info)->limit == 0 && \ 257 (info)->limit == 0 && \
257 (info)->contents == 0 && \ 258 (info)->contents == 0 && \
@@ -261,11 +262,18 @@ static inline void native_load_tls(struct thread_struct *t, unsigned int cpu)
261 (info)->seg_not_present == 1 && \ 262 (info)->seg_not_present == 1 && \
262 (info)->useable == 0) 263 (info)->useable == 0)
263 264
264#ifdef CONFIG_X86_64 265/* Lots of programs expect an all-zero user_desc to mean "no segment at all". */
265#define LDT_empty(info) (_LDT_empty(info) && ((info)->lm == 0)) 266static inline bool LDT_zero(const struct user_desc *info)
266#else 267{
267#define LDT_empty(info) (_LDT_empty(info)) 268 return (info->base_addr == 0 &&
268#endif 269 info->limit == 0 &&
270 info->contents == 0 &&
271 info->read_exec_only == 0 &&
272 info->seg_32bit == 0 &&
273 info->limit_in_pages == 0 &&
274 info->seg_not_present == 0 &&
275 info->useable == 0);
276}
269 277
270static inline void clear_LDT(void) 278static inline void clear_LDT(void)
271{ 279{
diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h
index 40269a2bf6f9..4b75d591eb5e 100644
--- a/arch/x86/include/asm/mmu_context.h
+++ b/arch/x86/include/asm/mmu_context.h
@@ -130,7 +130,25 @@ static inline void arch_bprm_mm_init(struct mm_struct *mm,
130static inline void arch_unmap(struct mm_struct *mm, struct vm_area_struct *vma, 130static inline void arch_unmap(struct mm_struct *mm, struct vm_area_struct *vma,
131 unsigned long start, unsigned long end) 131 unsigned long start, unsigned long end)
132{ 132{
133 mpx_notify_unmap(mm, vma, start, end); 133 /*
134 * mpx_notify_unmap() goes and reads a rarely-hot
135 * cacheline in the mm_struct. That can be expensive
136 * enough to be seen in profiles.
137 *
138 * The mpx_notify_unmap() call and its contents have been
139 * observed to affect munmap() performance on hardware
140 * where MPX is not present.
141 *
142 * The unlikely() optimizes for the fast case: no MPX
143 * in the CPU, or no MPX use in the process. Even if
144 * we get this wrong (in the unlikely event that MPX
145 * is widely enabled on some system) the overhead of
146 * MPX itself (reading bounds tables) is expected to
147 * overwhelm the overhead of getting this unlikely()
148 * consistently wrong.
149 */
150 if (unlikely(cpu_feature_enabled(X86_FEATURE_MPX)))
151 mpx_notify_unmap(mm, vma, start, end);
134} 152}
135 153
136#endif /* _ASM_X86_MMU_CONTEXT_H */ 154#endif /* _ASM_X86_MMU_CONTEXT_H */
diff --git a/arch/x86/include/asm/vgtod.h b/arch/x86/include/asm/vgtod.h
index e7e9682a33e9..f556c4843aa1 100644
--- a/arch/x86/include/asm/vgtod.h
+++ b/arch/x86/include/asm/vgtod.h
@@ -80,9 +80,11 @@ static inline unsigned int __getcpu(void)
80 80
81 /* 81 /*
82 * Load per CPU data from GDT. LSL is faster than RDTSCP and 82 * Load per CPU data from GDT. LSL is faster than RDTSCP and
83 * works on all CPUs. 83 * works on all CPUs. This is volatile so that it orders
84 * correctly wrt barrier() and to keep gcc from cleverly
85 * hoisting it out of the calling function.
84 */ 86 */
85 asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG)); 87 asm volatile ("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG));
86 88
87 return p; 89 return p;
88} 90}
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 4433a4be8171..b9e30daa0881 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -611,20 +611,20 @@ void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
611 611
612int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp) 612int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp)
613{ 613{
614 int irq; 614 int rc, irq, trigger, polarity;
615 615
616 if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) { 616 rc = acpi_get_override_irq(gsi, &trigger, &polarity);
617 *irqp = gsi; 617 if (rc == 0) {
618 } else { 618 trigger = trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
619 mutex_lock(&acpi_ioapic_lock); 619 polarity = polarity ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
620 irq = mp_map_gsi_to_irq(gsi, 620 irq = acpi_register_gsi(NULL, gsi, trigger, polarity);
621 IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK); 621 if (irq >= 0) {
622 mutex_unlock(&acpi_ioapic_lock); 622 *irqp = irq;
623 if (irq < 0) 623 return 0;
624 return -1; 624 }
625 *irqp = irq;
626 } 625 }
627 return 0; 626
627 return -1;
628} 628}
629EXPORT_SYMBOL_GPL(acpi_gsi_to_irq); 629EXPORT_SYMBOL_GPL(acpi_gsi_to_irq);
630 630
@@ -750,13 +750,13 @@ static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
750} 750}
751 751
752/* wrapper to silence section mismatch warning */ 752/* wrapper to silence section mismatch warning */
753int __ref acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu) 753int __ref acpi_map_cpu(acpi_handle handle, int physid, int *pcpu)
754{ 754{
755 return _acpi_map_lsapic(handle, physid, pcpu); 755 return _acpi_map_lsapic(handle, physid, pcpu);
756} 756}
757EXPORT_SYMBOL(acpi_map_lsapic); 757EXPORT_SYMBOL(acpi_map_cpu);
758 758
759int acpi_unmap_lsapic(int cpu) 759int acpi_unmap_cpu(int cpu)
760{ 760{
761#ifdef CONFIG_ACPI_NUMA 761#ifdef CONFIG_ACPI_NUMA
762 set_apicid_to_node(per_cpu(x86_cpu_to_apicid, cpu), NUMA_NO_NODE); 762 set_apicid_to_node(per_cpu(x86_cpu_to_apicid, cpu), NUMA_NO_NODE);
@@ -768,8 +768,7 @@ int acpi_unmap_lsapic(int cpu)
768 768
769 return (0); 769 return (0);
770} 770}
771 771EXPORT_SYMBOL(acpi_unmap_cpu);
772EXPORT_SYMBOL(acpi_unmap_lsapic);
773#endif /* CONFIG_ACPI_HOTPLUG_CPU */ 772#endif /* CONFIG_ACPI_HOTPLUG_CPU */
774 773
775int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base) 774int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
index e27b49d7c922..80091ae54c2b 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -66,3 +66,4 @@ targets += capflags.c
66$(obj)/capflags.c: $(cpufeature) $(src)/mkcapflags.sh FORCE 66$(obj)/capflags.c: $(cpufeature) $(src)/mkcapflags.sh FORCE
67 $(call if_changed,mkcapflags) 67 $(call if_changed,mkcapflags)
68endif 68endif
69clean-files += capflags.c
diff --git a/arch/x86/kernel/cpu/mkcapflags.sh b/arch/x86/kernel/cpu/mkcapflags.sh
index e2b22df964cd..36d99a337b49 100644
--- a/arch/x86/kernel/cpu/mkcapflags.sh
+++ b/arch/x86/kernel/cpu/mkcapflags.sh
@@ -28,7 +28,7 @@ function dump_array()
28 # If the /* comment */ starts with a quote string, grab that. 28 # If the /* comment */ starts with a quote string, grab that.
29 VALUE="$(echo "$i" | sed -n 's@.*/\* *\("[^"]*"\).*\*/@\1@p')" 29 VALUE="$(echo "$i" | sed -n 's@.*/\* *\("[^"]*"\).*\*/@\1@p')"
30 [ -z "$VALUE" ] && VALUE="\"$NAME\"" 30 [ -z "$VALUE" ] && VALUE="\"$NAME\""
31 [ "$VALUE" == '""' ] && continue 31 [ "$VALUE" = '""' ] && continue
32 32
33 # Name is uppercase, VALUE is all lowercase 33 # Name is uppercase, VALUE is all lowercase
34 VALUE="$(echo "$VALUE" | tr A-Z a-z)" 34 VALUE="$(echo "$VALUE" | tr A-Z a-z)"
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index a450373e8e91..939155ffdece 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -107,6 +107,7 @@ static struct clocksource hyperv_cs = {
107 .rating = 400, /* use this when running on Hyperv*/ 107 .rating = 400, /* use this when running on Hyperv*/
108 .read = read_hv_clock, 108 .read = read_hv_clock,
109 .mask = CLOCKSOURCE_MASK(64), 109 .mask = CLOCKSOURCE_MASK(64),
110 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
110}; 111};
111 112
112static void __init ms_hyperv_init_platform(void) 113static void __init ms_hyperv_init_platform(void)
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 3c895d480cd7..073983398364 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -568,8 +568,8 @@ struct event_constraint intel_atom_pebs_event_constraints[] = {
568}; 568};
569 569
570struct event_constraint intel_slm_pebs_event_constraints[] = { 570struct event_constraint intel_slm_pebs_event_constraints[] = {
571 /* UOPS_RETIRED.ALL, inv=1, cmask=16 (cycles:p). */ 571 /* INST_RETIRED.ANY_P, inv=1, cmask=16 (cycles:p). */
572 INTEL_FLAGS_EVENT_CONSTRAINT(0x108001c2, 0xf), 572 INTEL_FLAGS_EVENT_CONSTRAINT(0x108000c0, 0x1),
573 /* Allow all events as PEBS with no flags */ 573 /* Allow all events as PEBS with no flags */
574 INTEL_ALL_EVENT_CONSTRAINT(0, 0x1), 574 INTEL_ALL_EVENT_CONSTRAINT(0, 0x1),
575 EVENT_CONSTRAINT_END 575 EVENT_CONSTRAINT_END
diff --git a/arch/x86/kernel/cpu/perf_event_intel_rapl.c b/arch/x86/kernel/cpu/perf_event_intel_rapl.c
index 673f930c700f..6e434f8e5fc8 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_rapl.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_rapl.c
@@ -103,6 +103,13 @@ static struct kobj_attribute format_attr_##_var = \
103 103
104#define RAPL_CNTR_WIDTH 32 /* 32-bit rapl counters */ 104#define RAPL_CNTR_WIDTH 32 /* 32-bit rapl counters */
105 105
106#define RAPL_EVENT_ATTR_STR(_name, v, str) \
107static struct perf_pmu_events_attr event_attr_##v = { \
108 .attr = __ATTR(_name, 0444, rapl_sysfs_show, NULL), \
109 .id = 0, \
110 .event_str = str, \
111};
112
106struct rapl_pmu { 113struct rapl_pmu {
107 spinlock_t lock; 114 spinlock_t lock;
108 int hw_unit; /* 1/2^hw_unit Joule */ 115 int hw_unit; /* 1/2^hw_unit Joule */
@@ -379,23 +386,36 @@ static struct attribute_group rapl_pmu_attr_group = {
379 .attrs = rapl_pmu_attrs, 386 .attrs = rapl_pmu_attrs,
380}; 387};
381 388
382EVENT_ATTR_STR(energy-cores, rapl_cores, "event=0x01"); 389static ssize_t rapl_sysfs_show(struct device *dev,
383EVENT_ATTR_STR(energy-pkg , rapl_pkg, "event=0x02"); 390 struct device_attribute *attr,
384EVENT_ATTR_STR(energy-ram , rapl_ram, "event=0x03"); 391 char *page)
385EVENT_ATTR_STR(energy-gpu , rapl_gpu, "event=0x04"); 392{
393 struct perf_pmu_events_attr *pmu_attr = \
394 container_of(attr, struct perf_pmu_events_attr, attr);
395
396 if (pmu_attr->event_str)
397 return sprintf(page, "%s", pmu_attr->event_str);
398
399 return 0;
400}
401
402RAPL_EVENT_ATTR_STR(energy-cores, rapl_cores, "event=0x01");
403RAPL_EVENT_ATTR_STR(energy-pkg , rapl_pkg, "event=0x02");
404RAPL_EVENT_ATTR_STR(energy-ram , rapl_ram, "event=0x03");
405RAPL_EVENT_ATTR_STR(energy-gpu , rapl_gpu, "event=0x04");
386 406
387EVENT_ATTR_STR(energy-cores.unit, rapl_cores_unit, "Joules"); 407RAPL_EVENT_ATTR_STR(energy-cores.unit, rapl_cores_unit, "Joules");
388EVENT_ATTR_STR(energy-pkg.unit , rapl_pkg_unit, "Joules"); 408RAPL_EVENT_ATTR_STR(energy-pkg.unit , rapl_pkg_unit, "Joules");
389EVENT_ATTR_STR(energy-ram.unit , rapl_ram_unit, "Joules"); 409RAPL_EVENT_ATTR_STR(energy-ram.unit , rapl_ram_unit, "Joules");
390EVENT_ATTR_STR(energy-gpu.unit , rapl_gpu_unit, "Joules"); 410RAPL_EVENT_ATTR_STR(energy-gpu.unit , rapl_gpu_unit, "Joules");
391 411
392/* 412/*
393 * we compute in 0.23 nJ increments regardless of MSR 413 * we compute in 0.23 nJ increments regardless of MSR
394 */ 414 */
395EVENT_ATTR_STR(energy-cores.scale, rapl_cores_scale, "2.3283064365386962890625e-10"); 415RAPL_EVENT_ATTR_STR(energy-cores.scale, rapl_cores_scale, "2.3283064365386962890625e-10");
396EVENT_ATTR_STR(energy-pkg.scale, rapl_pkg_scale, "2.3283064365386962890625e-10"); 416RAPL_EVENT_ATTR_STR(energy-pkg.scale, rapl_pkg_scale, "2.3283064365386962890625e-10");
397EVENT_ATTR_STR(energy-ram.scale, rapl_ram_scale, "2.3283064365386962890625e-10"); 417RAPL_EVENT_ATTR_STR(energy-ram.scale, rapl_ram_scale, "2.3283064365386962890625e-10");
398EVENT_ATTR_STR(energy-gpu.scale, rapl_gpu_scale, "2.3283064365386962890625e-10"); 418RAPL_EVENT_ATTR_STR(energy-gpu.scale, rapl_gpu_scale, "2.3283064365386962890625e-10");
399 419
400static struct attribute *rapl_events_srv_attr[] = { 420static struct attribute *rapl_events_srv_attr[] = {
401 EVENT_PTR(rapl_cores), 421 EVENT_PTR(rapl_cores),
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.h b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
index 18eb78bbdd10..863d9b02563e 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.h
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
@@ -17,7 +17,7 @@
17#define UNCORE_PCI_DEV_TYPE(data) ((data >> 8) & 0xff) 17#define UNCORE_PCI_DEV_TYPE(data) ((data >> 8) & 0xff)
18#define UNCORE_PCI_DEV_IDX(data) (data & 0xff) 18#define UNCORE_PCI_DEV_IDX(data) (data & 0xff)
19#define UNCORE_EXTRA_PCI_DEV 0xff 19#define UNCORE_EXTRA_PCI_DEV 0xff
20#define UNCORE_EXTRA_PCI_DEV_MAX 2 20#define UNCORE_EXTRA_PCI_DEV_MAX 3
21 21
22/* support up to 8 sockets */ 22/* support up to 8 sockets */
23#define UNCORE_SOCKET_MAX 8 23#define UNCORE_SOCKET_MAX 8
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c b/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c
index 745b158e9a65..21af6149edf2 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore_snbep.c
@@ -891,6 +891,7 @@ void snbep_uncore_cpu_init(void)
891enum { 891enum {
892 SNBEP_PCI_QPI_PORT0_FILTER, 892 SNBEP_PCI_QPI_PORT0_FILTER,
893 SNBEP_PCI_QPI_PORT1_FILTER, 893 SNBEP_PCI_QPI_PORT1_FILTER,
894 HSWEP_PCI_PCU_3,
894}; 895};
895 896
896static int snbep_qpi_hw_config(struct intel_uncore_box *box, struct perf_event *event) 897static int snbep_qpi_hw_config(struct intel_uncore_box *box, struct perf_event *event)
@@ -2026,6 +2027,17 @@ void hswep_uncore_cpu_init(void)
2026{ 2027{
2027 if (hswep_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores) 2028 if (hswep_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores)
2028 hswep_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores; 2029 hswep_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores;
2030
2031 /* Detect 6-8 core systems with only two SBOXes */
2032 if (uncore_extra_pci_dev[0][HSWEP_PCI_PCU_3]) {
2033 u32 capid4;
2034
2035 pci_read_config_dword(uncore_extra_pci_dev[0][HSWEP_PCI_PCU_3],
2036 0x94, &capid4);
2037 if (((capid4 >> 6) & 0x3) == 0)
2038 hswep_uncore_sbox.num_boxes = 2;
2039 }
2040
2029 uncore_msr_uncores = hswep_msr_uncores; 2041 uncore_msr_uncores = hswep_msr_uncores;
2030} 2042}
2031 2043
@@ -2287,6 +2299,11 @@ static DEFINE_PCI_DEVICE_TABLE(hswep_uncore_pci_ids) = {
2287 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV, 2299 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV,
2288 SNBEP_PCI_QPI_PORT1_FILTER), 2300 SNBEP_PCI_QPI_PORT1_FILTER),
2289 }, 2301 },
2302 { /* PCU.3 (for Capability registers) */
2303 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2fc0),
2304 .driver_data = UNCORE_PCI_DEV_DATA(UNCORE_EXTRA_PCI_DEV,
2305 HSWEP_PCI_PCU_3),
2306 },
2290 { /* end: all zeroes */ } 2307 { /* end: all zeroes */ }
2291}; 2308};
2292 2309
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 2142376dc8c6..8b7b0a51e742 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -674,7 +674,7 @@ static inline void *alloc_tramp(unsigned long size)
674} 674}
675static inline void tramp_free(void *tramp) 675static inline void tramp_free(void *tramp)
676{ 676{
677 module_free(NULL, tramp); 677 module_memfree(tramp);
678} 678}
679#else 679#else
680/* Trampolines can only be created if modules are supported */ 680/* Trampolines can only be created if modules are supported */
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 6307a0f0cf17..705ef8d48e2d 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -127,7 +127,7 @@ int arch_show_interrupts(struct seq_file *p, int prec)
127 seq_puts(p, " Machine check polls\n"); 127 seq_puts(p, " Machine check polls\n");
128#endif 128#endif
129#if IS_ENABLED(CONFIG_HYPERV) || defined(CONFIG_XEN) 129#if IS_ENABLED(CONFIG_HYPERV) || defined(CONFIG_XEN)
130 seq_printf(p, "%*s: ", prec, "THR"); 130 seq_printf(p, "%*s: ", prec, "HYP");
131 for_each_online_cpu(j) 131 for_each_online_cpu(j)
132 seq_printf(p, "%10u ", irq_stats(j)->irq_hv_callback_count); 132 seq_printf(p, "%10u ", irq_stats(j)->irq_hv_callback_count);
133 seq_puts(p, " Hypervisor callback interrupts\n"); 133 seq_puts(p, " Hypervisor callback interrupts\n");
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index f7e3cd50ece0..98f654d466e5 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -1020,6 +1020,15 @@ int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
1020 regs->flags &= ~X86_EFLAGS_IF; 1020 regs->flags &= ~X86_EFLAGS_IF;
1021 trace_hardirqs_off(); 1021 trace_hardirqs_off();
1022 regs->ip = (unsigned long)(jp->entry); 1022 regs->ip = (unsigned long)(jp->entry);
1023
1024 /*
1025 * jprobes use jprobe_return() which skips the normal return
1026 * path of the function, and this messes up the accounting of the
1027 * function graph tracer to get messed up.
1028 *
1029 * Pause function graph tracing while performing the jprobe function.
1030 */
1031 pause_graph_tracing();
1023 return 1; 1032 return 1;
1024} 1033}
1025NOKPROBE_SYMBOL(setjmp_pre_handler); 1034NOKPROBE_SYMBOL(setjmp_pre_handler);
@@ -1048,24 +1057,25 @@ int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
1048 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 1057 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
1049 u8 *addr = (u8 *) (regs->ip - 1); 1058 u8 *addr = (u8 *) (regs->ip - 1);
1050 struct jprobe *jp = container_of(p, struct jprobe, kp); 1059 struct jprobe *jp = container_of(p, struct jprobe, kp);
1060 void *saved_sp = kcb->jprobe_saved_sp;
1051 1061
1052 if ((addr > (u8 *) jprobe_return) && 1062 if ((addr > (u8 *) jprobe_return) &&
1053 (addr < (u8 *) jprobe_return_end)) { 1063 (addr < (u8 *) jprobe_return_end)) {
1054 if (stack_addr(regs) != kcb->jprobe_saved_sp) { 1064 if (stack_addr(regs) != saved_sp) {
1055 struct pt_regs *saved_regs = &kcb->jprobe_saved_regs; 1065 struct pt_regs *saved_regs = &kcb->jprobe_saved_regs;
1056 printk(KERN_ERR 1066 printk(KERN_ERR
1057 "current sp %p does not match saved sp %p\n", 1067 "current sp %p does not match saved sp %p\n",
1058 stack_addr(regs), kcb->jprobe_saved_sp); 1068 stack_addr(regs), saved_sp);
1059 printk(KERN_ERR "Saved registers for jprobe %p\n", jp); 1069 printk(KERN_ERR "Saved registers for jprobe %p\n", jp);
1060 show_regs(saved_regs); 1070 show_regs(saved_regs);
1061 printk(KERN_ERR "Current registers\n"); 1071 printk(KERN_ERR "Current registers\n");
1062 show_regs(regs); 1072 show_regs(regs);
1063 BUG(); 1073 BUG();
1064 } 1074 }
1075 /* It's OK to start function graph tracing again */
1076 unpause_graph_tracing();
1065 *regs = kcb->jprobe_saved_regs; 1077 *regs = kcb->jprobe_saved_regs;
1066 memcpy((kprobe_opcode_t *)(kcb->jprobe_saved_sp), 1078 memcpy(saved_sp, kcb->jprobes_stack, MIN_STACK_SIZE(saved_sp));
1067 kcb->jprobes_stack,
1068 MIN_STACK_SIZE(kcb->jprobe_saved_sp));
1069 preempt_enable_no_resched(); 1079 preempt_enable_no_resched();
1070 return 1; 1080 return 1;
1071 } 1081 }
diff --git a/arch/x86/kernel/perf_regs.c b/arch/x86/kernel/perf_regs.c
index e309cc5c276e..781861cc5ee8 100644
--- a/arch/x86/kernel/perf_regs.c
+++ b/arch/x86/kernel/perf_regs.c
@@ -78,6 +78,14 @@ u64 perf_reg_abi(struct task_struct *task)
78{ 78{
79 return PERF_SAMPLE_REGS_ABI_32; 79 return PERF_SAMPLE_REGS_ABI_32;
80} 80}
81
82void perf_get_regs_user(struct perf_regs *regs_user,
83 struct pt_regs *regs,
84 struct pt_regs *regs_user_copy)
85{
86 regs_user->regs = task_pt_regs(current);
87 regs_user->abi = perf_reg_abi(current);
88}
81#else /* CONFIG_X86_64 */ 89#else /* CONFIG_X86_64 */
82#define REG_NOSUPPORT ((1ULL << PERF_REG_X86_DS) | \ 90#define REG_NOSUPPORT ((1ULL << PERF_REG_X86_DS) | \
83 (1ULL << PERF_REG_X86_ES) | \ 91 (1ULL << PERF_REG_X86_ES) | \
@@ -102,4 +110,86 @@ u64 perf_reg_abi(struct task_struct *task)
102 else 110 else
103 return PERF_SAMPLE_REGS_ABI_64; 111 return PERF_SAMPLE_REGS_ABI_64;
104} 112}
113
114void perf_get_regs_user(struct perf_regs *regs_user,
115 struct pt_regs *regs,
116 struct pt_regs *regs_user_copy)
117{
118 struct pt_regs *user_regs = task_pt_regs(current);
119
120 /*
121 * If we're in an NMI that interrupted task_pt_regs setup, then
122 * we can't sample user regs at all. This check isn't really
123 * sufficient, though, as we could be in an NMI inside an interrupt
124 * that happened during task_pt_regs setup.
125 */
126 if (regs->sp > (unsigned long)&user_regs->r11 &&
127 regs->sp <= (unsigned long)(user_regs + 1)) {
128 regs_user->abi = PERF_SAMPLE_REGS_ABI_NONE;
129 regs_user->regs = NULL;
130 return;
131 }
132
133 /*
134 * RIP, flags, and the argument registers are usually saved.
135 * orig_ax is probably okay, too.
136 */
137 regs_user_copy->ip = user_regs->ip;
138 regs_user_copy->cx = user_regs->cx;
139 regs_user_copy->dx = user_regs->dx;
140 regs_user_copy->si = user_regs->si;
141 regs_user_copy->di = user_regs->di;
142 regs_user_copy->r8 = user_regs->r8;
143 regs_user_copy->r9 = user_regs->r9;
144 regs_user_copy->r10 = user_regs->r10;
145 regs_user_copy->r11 = user_regs->r11;
146 regs_user_copy->orig_ax = user_regs->orig_ax;
147 regs_user_copy->flags = user_regs->flags;
148
149 /*
150 * Don't even try to report the "rest" regs.
151 */
152 regs_user_copy->bx = -1;
153 regs_user_copy->bp = -1;
154 regs_user_copy->r12 = -1;
155 regs_user_copy->r13 = -1;
156 regs_user_copy->r14 = -1;
157 regs_user_copy->r15 = -1;
158
159 /*
160 * For this to be at all useful, we need a reasonable guess for
161 * sp and the ABI. Be careful: we're in NMI context, and we're
162 * considering current to be the current task, so we should
163 * be careful not to look at any other percpu variables that might
164 * change during context switches.
165 */
166 if (IS_ENABLED(CONFIG_IA32_EMULATION) &&
167 task_thread_info(current)->status & TS_COMPAT) {
168 /* Easy case: we're in a compat syscall. */
169 regs_user->abi = PERF_SAMPLE_REGS_ABI_32;
170 regs_user_copy->sp = user_regs->sp;
171 regs_user_copy->cs = user_regs->cs;
172 regs_user_copy->ss = user_regs->ss;
173 } else if (user_regs->orig_ax != -1) {
174 /*
175 * We're probably in a 64-bit syscall.
176 * Warning: this code is severely racy. At least it's better
177 * than just blindly copying user_regs.
178 */
179 regs_user->abi = PERF_SAMPLE_REGS_ABI_64;
180 regs_user_copy->sp = this_cpu_read(old_rsp);
181 regs_user_copy->cs = __USER_CS;
182 regs_user_copy->ss = __USER_DS;
183 regs_user_copy->cx = -1; /* usually contains garbage */
184 } else {
185 /* We're probably in an interrupt or exception. */
186 regs_user->abi = user_64bit_mode(user_regs) ?
187 PERF_SAMPLE_REGS_ABI_64 : PERF_SAMPLE_REGS_ABI_32;
188 regs_user_copy->sp = user_regs->sp;
189 regs_user_copy->cs = user_regs->cs;
190 regs_user_copy->ss = user_regs->ss;
191 }
192
193 regs_user->regs = regs_user_copy;
194}
105#endif /* CONFIG_X86_32 */ 195#endif /* CONFIG_X86_32 */
diff --git a/arch/x86/kernel/tls.c b/arch/x86/kernel/tls.c
index 4e942f31b1a7..7fc5e843f247 100644
--- a/arch/x86/kernel/tls.c
+++ b/arch/x86/kernel/tls.c
@@ -29,7 +29,28 @@ static int get_free_idx(void)
29 29
30static bool tls_desc_okay(const struct user_desc *info) 30static bool tls_desc_okay(const struct user_desc *info)
31{ 31{
32 if (LDT_empty(info)) 32 /*
33 * For historical reasons (i.e. no one ever documented how any
34 * of the segmentation APIs work), user programs can and do
35 * assume that a struct user_desc that's all zeros except for
36 * entry_number means "no segment at all". This never actually
37 * worked. In fact, up to Linux 3.19, a struct user_desc like
38 * this would create a 16-bit read-write segment with base and
39 * limit both equal to zero.
40 *
41 * That was close enough to "no segment at all" until we
42 * hardened this function to disallow 16-bit TLS segments. Fix
43 * it up by interpreting these zeroed segments the way that they
44 * were almost certainly intended to be interpreted.
45 *
46 * The correct way to ask for "no segment at all" is to specify
47 * a user_desc that satisfies LDT_empty. To keep everything
48 * working, we accept both.
49 *
50 * Note that there's a similar kludge in modify_ldt -- look at
51 * the distinction between modes 1 and 0x11.
52 */
53 if (LDT_empty(info) || LDT_zero(info))
33 return true; 54 return true;
34 55
35 /* 56 /*
@@ -71,7 +92,7 @@ static void set_tls_desc(struct task_struct *p, int idx,
71 cpu = get_cpu(); 92 cpu = get_cpu();
72 93
73 while (n-- > 0) { 94 while (n-- > 0) {
74 if (LDT_empty(info)) 95 if (LDT_empty(info) || LDT_zero(info))
75 desc->a = desc->b = 0; 96 desc->a = desc->b = 0;
76 else 97 else
77 fill_ldt(desc, info); 98 fill_ldt(desc, info);
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index b7e50bba3bbb..505449700e0c 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -617,7 +617,7 @@ static unsigned long quick_pit_calibrate(void)
617 goto success; 617 goto success;
618 } 618 }
619 } 619 }
620 pr_err("Fast TSC calibration failed\n"); 620 pr_info("Fast TSC calibration failed\n");
621 return 0; 621 return 0;
622 622
623success: 623success:
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 169b09d76ddd..de12c1d379f1 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2348,7 +2348,7 @@ static int em_sysenter(struct x86_emulate_ctxt *ctxt)
2348 * Not recognized on AMD in compat mode (but is recognized in legacy 2348 * Not recognized on AMD in compat mode (but is recognized in legacy
2349 * mode). 2349 * mode).
2350 */ 2350 */
2351 if ((ctxt->mode == X86EMUL_MODE_PROT32) && (efer & EFER_LMA) 2351 if ((ctxt->mode != X86EMUL_MODE_PROT64) && (efer & EFER_LMA)
2352 && !vendor_intel(ctxt)) 2352 && !vendor_intel(ctxt))
2353 return emulate_ud(ctxt); 2353 return emulate_ud(ctxt);
2354 2354
@@ -2359,25 +2359,13 @@ static int em_sysenter(struct x86_emulate_ctxt *ctxt)
2359 setup_syscalls_segments(ctxt, &cs, &ss); 2359 setup_syscalls_segments(ctxt, &cs, &ss);
2360 2360
2361 ops->get_msr(ctxt, MSR_IA32_SYSENTER_CS, &msr_data); 2361 ops->get_msr(ctxt, MSR_IA32_SYSENTER_CS, &msr_data);
2362 switch (ctxt->mode) { 2362 if ((msr_data & 0xfffc) == 0x0)
2363 case X86EMUL_MODE_PROT32: 2363 return emulate_gp(ctxt, 0);
2364 if ((msr_data & 0xfffc) == 0x0)
2365 return emulate_gp(ctxt, 0);
2366 break;
2367 case X86EMUL_MODE_PROT64:
2368 if (msr_data == 0x0)
2369 return emulate_gp(ctxt, 0);
2370 break;
2371 default:
2372 break;
2373 }
2374 2364
2375 ctxt->eflags &= ~(EFLG_VM | EFLG_IF); 2365 ctxt->eflags &= ~(EFLG_VM | EFLG_IF);
2376 cs_sel = (u16)msr_data; 2366 cs_sel = (u16)msr_data & ~SELECTOR_RPL_MASK;
2377 cs_sel &= ~SELECTOR_RPL_MASK;
2378 ss_sel = cs_sel + 8; 2367 ss_sel = cs_sel + 8;
2379 ss_sel &= ~SELECTOR_RPL_MASK; 2368 if (efer & EFER_LMA) {
2380 if (ctxt->mode == X86EMUL_MODE_PROT64 || (efer & EFER_LMA)) {
2381 cs.d = 0; 2369 cs.d = 0;
2382 cs.l = 1; 2370 cs.l = 1;
2383 } 2371 }
@@ -2386,10 +2374,11 @@ static int em_sysenter(struct x86_emulate_ctxt *ctxt)
2386 ops->set_segment(ctxt, ss_sel, &ss, 0, VCPU_SREG_SS); 2374 ops->set_segment(ctxt, ss_sel, &ss, 0, VCPU_SREG_SS);
2387 2375
2388 ops->get_msr(ctxt, MSR_IA32_SYSENTER_EIP, &msr_data); 2376 ops->get_msr(ctxt, MSR_IA32_SYSENTER_EIP, &msr_data);
2389 ctxt->_eip = msr_data; 2377 ctxt->_eip = (efer & EFER_LMA) ? msr_data : (u32)msr_data;
2390 2378
2391 ops->get_msr(ctxt, MSR_IA32_SYSENTER_ESP, &msr_data); 2379 ops->get_msr(ctxt, MSR_IA32_SYSENTER_ESP, &msr_data);
2392 *reg_write(ctxt, VCPU_REGS_RSP) = msr_data; 2380 *reg_write(ctxt, VCPU_REGS_RSP) = (efer & EFER_LMA) ? msr_data :
2381 (u32)msr_data;
2393 2382
2394 return X86EMUL_CONTINUE; 2383 return X86EMUL_CONTINUE;
2395} 2384}
@@ -3791,8 +3780,8 @@ static const struct opcode group5[] = {
3791}; 3780};
3792 3781
3793static const struct opcode group6[] = { 3782static const struct opcode group6[] = {
3794 DI(Prot, sldt), 3783 DI(Prot | DstMem, sldt),
3795 DI(Prot, str), 3784 DI(Prot | DstMem, str),
3796 II(Prot | Priv | SrcMem16, em_lldt, lldt), 3785 II(Prot | Priv | SrcMem16, em_lldt, lldt),
3797 II(Prot | Priv | SrcMem16, em_ltr, ltr), 3786 II(Prot | Priv | SrcMem16, em_ltr, ltr),
3798 N, N, N, N, 3787 N, N, N, N,
diff --git a/arch/x86/lib/insn.c b/arch/x86/lib/insn.c
index 2480978b31cc..1313ae6b478b 100644
--- a/arch/x86/lib/insn.c
+++ b/arch/x86/lib/insn.c
@@ -28,7 +28,7 @@
28 28
29/* Verify next sizeof(t) bytes can be on the same instruction */ 29/* Verify next sizeof(t) bytes can be on the same instruction */
30#define validate_next(t, insn, n) \ 30#define validate_next(t, insn, n) \
31 ((insn)->next_byte + sizeof(t) + n < (insn)->end_kaddr) 31 ((insn)->next_byte + sizeof(t) + n <= (insn)->end_kaddr)
32 32
33#define __get_next(t, insn) \ 33#define __get_next(t, insn) \
34 ({ t r = *(t*)insn->next_byte; insn->next_byte += sizeof(t); r; }) 34 ({ t r = *(t*)insn->next_byte; insn->next_byte += sizeof(t); r; })
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index a97ee0801475..079c3b6a3ff1 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -43,7 +43,7 @@ uint16_t __cachemode2pte_tbl[_PAGE_CACHE_MODE_NUM] = {
43 [_PAGE_CACHE_MODE_WT] = _PAGE_PCD, 43 [_PAGE_CACHE_MODE_WT] = _PAGE_PCD,
44 [_PAGE_CACHE_MODE_WP] = _PAGE_PCD, 44 [_PAGE_CACHE_MODE_WP] = _PAGE_PCD,
45}; 45};
46EXPORT_SYMBOL_GPL(__cachemode2pte_tbl); 46EXPORT_SYMBOL(__cachemode2pte_tbl);
47uint8_t __pte2cachemode_tbl[8] = { 47uint8_t __pte2cachemode_tbl[8] = {
48 [__pte2cm_idx(0)] = _PAGE_CACHE_MODE_WB, 48 [__pte2cm_idx(0)] = _PAGE_CACHE_MODE_WB,
49 [__pte2cm_idx(_PAGE_PWT)] = _PAGE_CACHE_MODE_WC, 49 [__pte2cm_idx(_PAGE_PWT)] = _PAGE_CACHE_MODE_WC,
@@ -54,7 +54,7 @@ uint8_t __pte2cachemode_tbl[8] = {
54 [__pte2cm_idx(_PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC_MINUS, 54 [__pte2cm_idx(_PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC_MINUS,
55 [__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC, 55 [__pte2cm_idx(_PAGE_PWT | _PAGE_PCD | _PAGE_PAT)] = _PAGE_CACHE_MODE_UC,
56}; 56};
57EXPORT_SYMBOL_GPL(__pte2cachemode_tbl); 57EXPORT_SYMBOL(__pte2cachemode_tbl);
58 58
59static unsigned long __initdata pgt_buf_start; 59static unsigned long __initdata pgt_buf_start;
60static unsigned long __initdata pgt_buf_end; 60static unsigned long __initdata pgt_buf_end;
@@ -438,20 +438,20 @@ static unsigned long __init init_range_memory_mapping(
438static unsigned long __init get_new_step_size(unsigned long step_size) 438static unsigned long __init get_new_step_size(unsigned long step_size)
439{ 439{
440 /* 440 /*
441 * Explain why we shift by 5 and why we don't have to worry about 441 * Initial mapped size is PMD_SIZE (2M).
442 * 'step_size << 5' overflowing:
443 *
444 * initial mapped size is PMD_SIZE (2M).
445 * We can not set step_size to be PUD_SIZE (1G) yet. 442 * We can not set step_size to be PUD_SIZE (1G) yet.
446 * In worse case, when we cross the 1G boundary, and 443 * In worse case, when we cross the 1G boundary, and
447 * PG_LEVEL_2M is not set, we will need 1+1+512 pages (2M + 8k) 444 * PG_LEVEL_2M is not set, we will need 1+1+512 pages (2M + 8k)
448 * to map 1G range with PTE. Use 5 as shift for now. 445 * to map 1G range with PTE. Hence we use one less than the
446 * difference of page table level shifts.
449 * 447 *
450 * Don't need to worry about overflow, on 32bit, when step_size 448 * Don't need to worry about overflow in the top-down case, on 32bit,
451 * is 0, round_down() returns 0 for start, and that turns it 449 * when step_size is 0, round_down() returns 0 for start, and that
452 * into 0x100000000ULL. 450 * turns it into 0x100000000ULL.
451 * In the bottom-up case, round_up(x, 0) returns 0 though too, which
452 * needs to be taken into consideration by the code below.
453 */ 453 */
454 return step_size << 5; 454 return step_size << (PMD_SHIFT - PAGE_SHIFT - 1);
455} 455}
456 456
457/** 457/**
@@ -471,7 +471,6 @@ static void __init memory_map_top_down(unsigned long map_start,
471 unsigned long step_size; 471 unsigned long step_size;
472 unsigned long addr; 472 unsigned long addr;
473 unsigned long mapped_ram_size = 0; 473 unsigned long mapped_ram_size = 0;
474 unsigned long new_mapped_ram_size;
475 474
476 /* xen has big range in reserved near end of ram, skip it at first.*/ 475 /* xen has big range in reserved near end of ram, skip it at first.*/
477 addr = memblock_find_in_range(map_start, map_end, PMD_SIZE, PMD_SIZE); 476 addr = memblock_find_in_range(map_start, map_end, PMD_SIZE, PMD_SIZE);
@@ -496,14 +495,12 @@ static void __init memory_map_top_down(unsigned long map_start,
496 start = map_start; 495 start = map_start;
497 } else 496 } else
498 start = map_start; 497 start = map_start;
499 new_mapped_ram_size = init_range_memory_mapping(start, 498 mapped_ram_size += init_range_memory_mapping(start,
500 last_start); 499 last_start);
501 last_start = start; 500 last_start = start;
502 min_pfn_mapped = last_start >> PAGE_SHIFT; 501 min_pfn_mapped = last_start >> PAGE_SHIFT;
503 /* only increase step_size after big range get mapped */ 502 if (mapped_ram_size >= step_size)
504 if (new_mapped_ram_size > mapped_ram_size)
505 step_size = get_new_step_size(step_size); 503 step_size = get_new_step_size(step_size);
506 mapped_ram_size += new_mapped_ram_size;
507 } 504 }
508 505
509 if (real_end < map_end) 506 if (real_end < map_end)
@@ -524,7 +521,7 @@ static void __init memory_map_top_down(unsigned long map_start,
524static void __init memory_map_bottom_up(unsigned long map_start, 521static void __init memory_map_bottom_up(unsigned long map_start,
525 unsigned long map_end) 522 unsigned long map_end)
526{ 523{
527 unsigned long next, new_mapped_ram_size, start; 524 unsigned long next, start;
528 unsigned long mapped_ram_size = 0; 525 unsigned long mapped_ram_size = 0;
529 /* step_size need to be small so pgt_buf from BRK could cover it */ 526 /* step_size need to be small so pgt_buf from BRK could cover it */
530 unsigned long step_size = PMD_SIZE; 527 unsigned long step_size = PMD_SIZE;
@@ -539,19 +536,19 @@ static void __init memory_map_bottom_up(unsigned long map_start,
539 * for page table. 536 * for page table.
540 */ 537 */
541 while (start < map_end) { 538 while (start < map_end) {
542 if (map_end - start > step_size) { 539 if (step_size && map_end - start > step_size) {
543 next = round_up(start + 1, step_size); 540 next = round_up(start + 1, step_size);
544 if (next > map_end) 541 if (next > map_end)
545 next = map_end; 542 next = map_end;
546 } else 543 } else {
547 next = map_end; 544 next = map_end;
545 }
548 546
549 new_mapped_ram_size = init_range_memory_mapping(start, next); 547 mapped_ram_size += init_range_memory_mapping(start, next);
550 start = next; 548 start = next;
551 549
552 if (new_mapped_ram_size > mapped_ram_size) 550 if (mapped_ram_size >= step_size)
553 step_size = get_new_step_size(step_size); 551 step_size = get_new_step_size(step_size);
554 mapped_ram_size += new_mapped_ram_size;
555 } 552 }
556} 553}
557 554
diff --git a/arch/x86/mm/mpx.c b/arch/x86/mm/mpx.c
index 67ebf5751222..c439ec478216 100644
--- a/arch/x86/mm/mpx.c
+++ b/arch/x86/mm/mpx.c
@@ -349,6 +349,12 @@ static __user void *task_get_bounds_dir(struct task_struct *tsk)
349 return MPX_INVALID_BOUNDS_DIR; 349 return MPX_INVALID_BOUNDS_DIR;
350 350
351 /* 351 /*
352 * 32-bit binaries on 64-bit kernels are currently
353 * unsupported.
354 */
355 if (IS_ENABLED(CONFIG_X86_64) && test_thread_flag(TIF_IA32))
356 return MPX_INVALID_BOUNDS_DIR;
357 /*
352 * The bounds directory pointer is stored in a register 358 * The bounds directory pointer is stored in a register
353 * only accessible if we first do an xsave. 359 * only accessible if we first do an xsave.
354 */ 360 */
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index edf299c8ff6c..7ac68698406c 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -234,8 +234,13 @@ void pat_init(void)
234 PAT(4, WB) | PAT(5, WC) | PAT(6, UC_MINUS) | PAT(7, UC); 234 PAT(4, WB) | PAT(5, WC) | PAT(6, UC_MINUS) | PAT(7, UC);
235 235
236 /* Boot CPU check */ 236 /* Boot CPU check */
237 if (!boot_pat_state) 237 if (!boot_pat_state) {
238 rdmsrl(MSR_IA32_CR_PAT, boot_pat_state); 238 rdmsrl(MSR_IA32_CR_PAT, boot_pat_state);
239 if (!boot_pat_state) {
240 pat_disable("PAT read returns always zero, disabled.");
241 return;
242 }
243 }
239 244
240 wrmsrl(MSR_IA32_CR_PAT, pat); 245 wrmsrl(MSR_IA32_CR_PAT, pat);
241 246
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 9b18ef315a55..349c0d32cc0b 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -216,7 +216,7 @@ static void pcibios_allocate_bridge_resources(struct pci_dev *dev)
216 continue; 216 continue;
217 if (r->parent) /* Already allocated */ 217 if (r->parent) /* Already allocated */
218 continue; 218 continue;
219 if (!r->start || pci_claim_resource(dev, idx) < 0) { 219 if (!r->start || pci_claim_bridge_resource(dev, idx) < 0) {
220 /* 220 /*
221 * Something is wrong with the region. 221 * Something is wrong with the region.
222 * Invalidate the resource to prevent 222 * Invalidate the resource to prevent
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index c489ef2c1a39..9098d880c476 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -458,6 +458,7 @@ int __init pci_xen_hvm_init(void)
458 * just how GSIs get registered. 458 * just how GSIs get registered.
459 */ 459 */
460 __acpi_register_gsi = acpi_register_gsi_xen_hvm; 460 __acpi_register_gsi = acpi_register_gsi_xen_hvm;
461 __acpi_unregister_gsi = NULL;
461#endif 462#endif
462 463
463#ifdef CONFIG_PCI_MSI 464#ifdef CONFIG_PCI_MSI
@@ -471,52 +472,6 @@ int __init pci_xen_hvm_init(void)
471} 472}
472 473
473#ifdef CONFIG_XEN_DOM0 474#ifdef CONFIG_XEN_DOM0
474static __init void xen_setup_acpi_sci(void)
475{
476 int rc;
477 int trigger, polarity;
478 int gsi = acpi_sci_override_gsi;
479 int irq = -1;
480 int gsi_override = -1;
481
482 if (!gsi)
483 return;
484
485 rc = acpi_get_override_irq(gsi, &trigger, &polarity);
486 if (rc) {
487 printk(KERN_WARNING "xen: acpi_get_override_irq failed for acpi"
488 " sci, rc=%d\n", rc);
489 return;
490 }
491 trigger = trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
492 polarity = polarity ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
493
494 printk(KERN_INFO "xen: sci override: global_irq=%d trigger=%d "
495 "polarity=%d\n", gsi, trigger, polarity);
496
497 /* Before we bind the GSI to a Linux IRQ, check whether
498 * we need to override it with bus_irq (IRQ) value. Usually for
499 * IRQs below IRQ_LEGACY_IRQ this holds IRQ == GSI, as so:
500 * ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 low level)
501 * but there are oddballs where the IRQ != GSI:
502 * ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 20 low level)
503 * which ends up being: gsi_to_irq[9] == 20
504 * (which is what acpi_gsi_to_irq ends up calling when starting the
505 * the ACPI interpreter and keels over since IRQ 9 has not been
506 * setup as we had setup IRQ 20 for it).
507 */
508 if (acpi_gsi_to_irq(gsi, &irq) == 0) {
509 /* Use the provided value if it's valid. */
510 if (irq >= 0)
511 gsi_override = irq;
512 }
513
514 gsi = xen_register_gsi(gsi, gsi_override, trigger, polarity);
515 printk(KERN_INFO "xen: acpi sci %d\n", gsi);
516
517 return;
518}
519
520int __init pci_xen_initial_domain(void) 475int __init pci_xen_initial_domain(void)
521{ 476{
522 int irq; 477 int irq;
@@ -527,8 +482,8 @@ int __init pci_xen_initial_domain(void)
527 x86_msi.restore_msi_irqs = xen_initdom_restore_msi_irqs; 482 x86_msi.restore_msi_irqs = xen_initdom_restore_msi_irqs;
528 pci_msi_ignore_mask = 1; 483 pci_msi_ignore_mask = 1;
529#endif 484#endif
530 xen_setup_acpi_sci();
531 __acpi_register_gsi = acpi_register_gsi_xen; 485 __acpi_register_gsi = acpi_register_gsi_xen;
486 __acpi_unregister_gsi = NULL;
532 /* Pre-allocate legacy irqs */ 487 /* Pre-allocate legacy irqs */
533 for (irq = 0; irq < nr_legacy_irqs(); irq++) { 488 for (irq = 0; irq < nr_legacy_irqs(); irq++) {
534 int trigger, polarity; 489 int trigger, polarity;
diff --git a/arch/x86/um/sys_call_table_32.c b/arch/x86/um/sys_call_table_32.c
index 531d4269e2e3..bd16d6c370ec 100644
--- a/arch/x86/um/sys_call_table_32.c
+++ b/arch/x86/um/sys_call_table_32.c
@@ -34,7 +34,7 @@ typedef asmlinkage void (*sys_call_ptr_t)(void);
34 34
35extern asmlinkage void sys_ni_syscall(void); 35extern asmlinkage void sys_ni_syscall(void);
36 36
37const sys_call_ptr_t sys_call_table[] __cacheline_aligned = { 37const sys_call_ptr_t sys_call_table[] ____cacheline_aligned = {
38 /* 38 /*
39 * Smells like a compiler bug -- it doesn't work 39 * Smells like a compiler bug -- it doesn't work
40 * when the & below is removed. 40 * when the & below is removed.
diff --git a/arch/x86/um/sys_call_table_64.c b/arch/x86/um/sys_call_table_64.c
index 20c3649d0691..5cdfa9db2217 100644
--- a/arch/x86/um/sys_call_table_64.c
+++ b/arch/x86/um/sys_call_table_64.c
@@ -47,7 +47,7 @@ typedef void (*sys_call_ptr_t)(void);
47 47
48extern void sys_ni_syscall(void); 48extern void sys_ni_syscall(void);
49 49
50const sys_call_ptr_t sys_call_table[] __cacheline_aligned = { 50const sys_call_ptr_t sys_call_table[] ____cacheline_aligned = {
51 /* 51 /*
52 * Smells like a compiler bug -- it doesn't work 52 * Smells like a compiler bug -- it doesn't work
53 * when the & below is removed. 53 * when the & below is removed.
diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c
index 009495b9ab4b..1c9f750c3859 100644
--- a/arch/x86/vdso/vma.c
+++ b/arch/x86/vdso/vma.c
@@ -41,12 +41,17 @@ void __init init_vdso_image(const struct vdso_image *image)
41 41
42struct linux_binprm; 42struct linux_binprm;
43 43
44/* Put the vdso above the (randomized) stack with another randomized offset. 44/*
45 This way there is no hole in the middle of address space. 45 * Put the vdso above the (randomized) stack with another randomized
46 To save memory make sure it is still in the same PTE as the stack top. 46 * offset. This way there is no hole in the middle of address space.
47 This doesn't give that many random bits. 47 * To save memory make sure it is still in the same PTE as the stack
48 48 * top. This doesn't give that many random bits.
49 Only used for the 64-bit and x32 vdsos. */ 49 *
50 * Note that this algorithm is imperfect: the distribution of the vdso
51 * start address within a PMD is biased toward the end.
52 *
53 * Only used for the 64-bit and x32 vdsos.
54 */
50static unsigned long vdso_addr(unsigned long start, unsigned len) 55static unsigned long vdso_addr(unsigned long start, unsigned len)
51{ 56{
52#ifdef CONFIG_X86_32 57#ifdef CONFIG_X86_32
@@ -54,22 +59,30 @@ static unsigned long vdso_addr(unsigned long start, unsigned len)
54#else 59#else
55 unsigned long addr, end; 60 unsigned long addr, end;
56 unsigned offset; 61 unsigned offset;
57 end = (start + PMD_SIZE - 1) & PMD_MASK; 62
63 /*
64 * Round up the start address. It can start out unaligned as a result
65 * of stack start randomization.
66 */
67 start = PAGE_ALIGN(start);
68
69 /* Round the lowest possible end address up to a PMD boundary. */
70 end = (start + len + PMD_SIZE - 1) & PMD_MASK;
58 if (end >= TASK_SIZE_MAX) 71 if (end >= TASK_SIZE_MAX)
59 end = TASK_SIZE_MAX; 72 end = TASK_SIZE_MAX;
60 end -= len; 73 end -= len;
61 /* This loses some more bits than a modulo, but is cheaper */ 74
62 offset = get_random_int() & (PTRS_PER_PTE - 1); 75 if (end > start) {
63 addr = start + (offset << PAGE_SHIFT); 76 offset = get_random_int() % (((end - start) >> PAGE_SHIFT) + 1);
64 if (addr >= end) 77 addr = start + (offset << PAGE_SHIFT);
65 addr = end; 78 } else {
79 addr = start;
80 }
66 81
67 /* 82 /*
68 * page-align it here so that get_unmapped_area doesn't 83 * Forcibly align the final address in case we have a hardware
69 * align it wrongfully again to the next page. addr can come in 4K 84 * issue that requires alignment for performance reasons.
70 * unaligned here as a result of stack start randomization.
71 */ 85 */
72 addr = PAGE_ALIGN(addr);
73 addr = align_vdso_addr(addr); 86 addr = align_vdso_addr(addr);
74 87
75 return addr; 88 return addr;
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 6bf3a13e3e0f..78a881b7fc41 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -40,6 +40,7 @@
40#include <xen/interface/physdev.h> 40#include <xen/interface/physdev.h>
41#include <xen/interface/vcpu.h> 41#include <xen/interface/vcpu.h>
42#include <xen/interface/memory.h> 42#include <xen/interface/memory.h>
43#include <xen/interface/nmi.h>
43#include <xen/interface/xen-mca.h> 44#include <xen/interface/xen-mca.h>
44#include <xen/features.h> 45#include <xen/features.h>
45#include <xen/page.h> 46#include <xen/page.h>
@@ -66,6 +67,7 @@
66#include <asm/reboot.h> 67#include <asm/reboot.h>
67#include <asm/stackprotector.h> 68#include <asm/stackprotector.h>
68#include <asm/hypervisor.h> 69#include <asm/hypervisor.h>
70#include <asm/mach_traps.h>
69#include <asm/mwait.h> 71#include <asm/mwait.h>
70#include <asm/pci_x86.h> 72#include <asm/pci_x86.h>
71#include <asm/pat.h> 73#include <asm/pat.h>
@@ -1351,6 +1353,21 @@ static const struct machine_ops xen_machine_ops __initconst = {
1351 .emergency_restart = xen_emergency_restart, 1353 .emergency_restart = xen_emergency_restart,
1352}; 1354};
1353 1355
1356static unsigned char xen_get_nmi_reason(void)
1357{
1358 unsigned char reason = 0;
1359
1360 /* Construct a value which looks like it came from port 0x61. */
1361 if (test_bit(_XEN_NMIREASON_io_error,
1362 &HYPERVISOR_shared_info->arch.nmi_reason))
1363 reason |= NMI_REASON_IOCHK;
1364 if (test_bit(_XEN_NMIREASON_pci_serr,
1365 &HYPERVISOR_shared_info->arch.nmi_reason))
1366 reason |= NMI_REASON_SERR;
1367
1368 return reason;
1369}
1370
1354static void __init xen_boot_params_init_edd(void) 1371static void __init xen_boot_params_init_edd(void)
1355{ 1372{
1356#if IS_ENABLED(CONFIG_EDD) 1373#if IS_ENABLED(CONFIG_EDD)
@@ -1535,9 +1552,12 @@ asmlinkage __visible void __init xen_start_kernel(void)
1535 pv_info = xen_info; 1552 pv_info = xen_info;
1536 pv_init_ops = xen_init_ops; 1553 pv_init_ops = xen_init_ops;
1537 pv_apic_ops = xen_apic_ops; 1554 pv_apic_ops = xen_apic_ops;
1538 if (!xen_pvh_domain()) 1555 if (!xen_pvh_domain()) {
1539 pv_cpu_ops = xen_cpu_ops; 1556 pv_cpu_ops = xen_cpu_ops;
1540 1557
1558 x86_platform.get_nmi_reason = xen_get_nmi_reason;
1559 }
1560
1541 if (xen_feature(XENFEAT_auto_translated_physmap)) 1561 if (xen_feature(XENFEAT_auto_translated_physmap))
1542 x86_init.resources.memory_setup = xen_auto_xlated_memory_setup; 1562 x86_init.resources.memory_setup = xen_auto_xlated_memory_setup;
1543 else 1563 else
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index edbc7a63fd73..70fb5075c901 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -167,10 +167,13 @@ static void * __ref alloc_p2m_page(void)
167 return (void *)__get_free_page(GFP_KERNEL | __GFP_REPEAT); 167 return (void *)__get_free_page(GFP_KERNEL | __GFP_REPEAT);
168} 168}
169 169
170/* Only to be called in case of a race for a page just allocated! */ 170static void __ref free_p2m_page(void *p)
171static void free_p2m_page(void *p)
172{ 171{
173 BUG_ON(!slab_is_available()); 172 if (unlikely(!slab_is_available())) {
173 free_bootmem((unsigned long)p, PAGE_SIZE);
174 return;
175 }
176
174 free_page((unsigned long)p); 177 free_page((unsigned long)p);
175} 178}
176 179
@@ -375,7 +378,7 @@ static void __init xen_rebuild_p2m_list(unsigned long *p2m)
375 p2m_missing_pte : p2m_identity_pte; 378 p2m_missing_pte : p2m_identity_pte;
376 for (i = 0; i < PMDS_PER_MID_PAGE; i++) { 379 for (i = 0; i < PMDS_PER_MID_PAGE; i++) {
377 pmdp = populate_extra_pmd( 380 pmdp = populate_extra_pmd(
378 (unsigned long)(p2m + pfn + i * PTRS_PER_PTE)); 381 (unsigned long)(p2m + pfn) + i * PMD_SIZE);
379 set_pmd(pmdp, __pmd(__pa(ptep) | _KERNPG_TABLE)); 382 set_pmd(pmdp, __pmd(__pa(ptep) | _KERNPG_TABLE));
380 } 383 }
381 } 384 }
@@ -436,10 +439,9 @@ EXPORT_SYMBOL_GPL(get_phys_to_machine);
436 * a new pmd is to replace p2m_missing_pte or p2m_identity_pte by a individual 439 * a new pmd is to replace p2m_missing_pte or p2m_identity_pte by a individual
437 * pmd. In case of PAE/x86-32 there are multiple pmds to allocate! 440 * pmd. In case of PAE/x86-32 there are multiple pmds to allocate!
438 */ 441 */
439static pte_t *alloc_p2m_pmd(unsigned long addr, pte_t *ptep, pte_t *pte_pg) 442static pte_t *alloc_p2m_pmd(unsigned long addr, pte_t *pte_pg)
440{ 443{
441 pte_t *ptechk; 444 pte_t *ptechk;
442 pte_t *pteret = ptep;
443 pte_t *pte_newpg[PMDS_PER_MID_PAGE]; 445 pte_t *pte_newpg[PMDS_PER_MID_PAGE];
444 pmd_t *pmdp; 446 pmd_t *pmdp;
445 unsigned int level; 447 unsigned int level;
@@ -473,8 +475,6 @@ static pte_t *alloc_p2m_pmd(unsigned long addr, pte_t *ptep, pte_t *pte_pg)
473 if (ptechk == pte_pg) { 475 if (ptechk == pte_pg) {
474 set_pmd(pmdp, 476 set_pmd(pmdp,
475 __pmd(__pa(pte_newpg[i]) | _KERNPG_TABLE)); 477 __pmd(__pa(pte_newpg[i]) | _KERNPG_TABLE));
476 if (vaddr == (addr & ~(PMD_SIZE - 1)))
477 pteret = pte_offset_kernel(pmdp, addr);
478 pte_newpg[i] = NULL; 478 pte_newpg[i] = NULL;
479 } 479 }
480 480
@@ -488,7 +488,7 @@ static pte_t *alloc_p2m_pmd(unsigned long addr, pte_t *ptep, pte_t *pte_pg)
488 vaddr += PMD_SIZE; 488 vaddr += PMD_SIZE;
489 } 489 }
490 490
491 return pteret; 491 return lookup_address(addr, &level);
492} 492}
493 493
494/* 494/*
@@ -517,7 +517,7 @@ static bool alloc_p2m(unsigned long pfn)
517 517
518 if (pte_pg == p2m_missing_pte || pte_pg == p2m_identity_pte) { 518 if (pte_pg == p2m_missing_pte || pte_pg == p2m_identity_pte) {
519 /* PMD level is missing, allocate a new one */ 519 /* PMD level is missing, allocate a new one */
520 ptep = alloc_p2m_pmd(addr, ptep, pte_pg); 520 ptep = alloc_p2m_pmd(addr, pte_pg);
521 if (!ptep) 521 if (!ptep)
522 return false; 522 return false;
523 } 523 }
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index dfd77dec8e2b..865e56cea7a0 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -140,7 +140,7 @@ static void __init xen_del_extra_mem(u64 start, u64 size)
140unsigned long __ref xen_chk_extra_mem(unsigned long pfn) 140unsigned long __ref xen_chk_extra_mem(unsigned long pfn)
141{ 141{
142 int i; 142 int i;
143 unsigned long addr = PFN_PHYS(pfn); 143 phys_addr_t addr = PFN_PHYS(pfn);
144 144
145 for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) { 145 for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) {
146 if (addr >= xen_extra_mem[i].start && 146 if (addr >= xen_extra_mem[i].start &&
@@ -160,6 +160,8 @@ void __init xen_inv_extra_mem(void)
160 int i; 160 int i;
161 161
162 for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) { 162 for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) {
163 if (!xen_extra_mem[i].size)
164 continue;
163 pfn_s = PFN_DOWN(xen_extra_mem[i].start); 165 pfn_s = PFN_DOWN(xen_extra_mem[i].start);
164 pfn_e = PFN_UP(xen_extra_mem[i].start + xen_extra_mem[i].size); 166 pfn_e = PFN_UP(xen_extra_mem[i].start + xen_extra_mem[i].size);
165 for (pfn = pfn_s; pfn < pfn_e; pfn++) 167 for (pfn = pfn_s; pfn < pfn_e; pfn++)
@@ -229,15 +231,14 @@ static int __init xen_free_mfn(unsigned long mfn)
229 * as a fallback if the remapping fails. 231 * as a fallback if the remapping fails.
230 */ 232 */
231static void __init xen_set_identity_and_release_chunk(unsigned long start_pfn, 233static void __init xen_set_identity_and_release_chunk(unsigned long start_pfn,
232 unsigned long end_pfn, unsigned long nr_pages, unsigned long *identity, 234 unsigned long end_pfn, unsigned long nr_pages, unsigned long *released)
233 unsigned long *released)
234{ 235{
235 unsigned long len = 0;
236 unsigned long pfn, end; 236 unsigned long pfn, end;
237 int ret; 237 int ret;
238 238
239 WARN_ON(start_pfn > end_pfn); 239 WARN_ON(start_pfn > end_pfn);
240 240
241 /* Release pages first. */
241 end = min(end_pfn, nr_pages); 242 end = min(end_pfn, nr_pages);
242 for (pfn = start_pfn; pfn < end; pfn++) { 243 for (pfn = start_pfn; pfn < end; pfn++) {
243 unsigned long mfn = pfn_to_mfn(pfn); 244 unsigned long mfn = pfn_to_mfn(pfn);
@@ -250,16 +251,14 @@ static void __init xen_set_identity_and_release_chunk(unsigned long start_pfn,
250 WARN(ret != 1, "Failed to release pfn %lx err=%d\n", pfn, ret); 251 WARN(ret != 1, "Failed to release pfn %lx err=%d\n", pfn, ret);
251 252
252 if (ret == 1) { 253 if (ret == 1) {
254 (*released)++;
253 if (!__set_phys_to_machine(pfn, INVALID_P2M_ENTRY)) 255 if (!__set_phys_to_machine(pfn, INVALID_P2M_ENTRY))
254 break; 256 break;
255 len++;
256 } else 257 } else
257 break; 258 break;
258 } 259 }
259 260
260 /* Need to release pages first */ 261 set_phys_range_identity(start_pfn, end_pfn);
261 *released += len;
262 *identity += set_phys_range_identity(start_pfn, end_pfn);
263} 262}
264 263
265/* 264/*
@@ -287,7 +286,7 @@ static void __init xen_update_mem_tables(unsigned long pfn, unsigned long mfn)
287 } 286 }
288 287
289 /* Update kernel mapping, but not for highmem. */ 288 /* Update kernel mapping, but not for highmem. */
290 if ((pfn << PAGE_SHIFT) >= __pa(high_memory)) 289 if (pfn >= PFN_UP(__pa(high_memory - 1)))
291 return; 290 return;
292 291
293 if (HYPERVISOR_update_va_mapping((unsigned long)__va(pfn << PAGE_SHIFT), 292 if (HYPERVISOR_update_va_mapping((unsigned long)__va(pfn << PAGE_SHIFT),
@@ -318,7 +317,6 @@ static void __init xen_do_set_identity_and_remap_chunk(
318 unsigned long ident_pfn_iter, remap_pfn_iter; 317 unsigned long ident_pfn_iter, remap_pfn_iter;
319 unsigned long ident_end_pfn = start_pfn + size; 318 unsigned long ident_end_pfn = start_pfn + size;
320 unsigned long left = size; 319 unsigned long left = size;
321 unsigned long ident_cnt = 0;
322 unsigned int i, chunk; 320 unsigned int i, chunk;
323 321
324 WARN_ON(size == 0); 322 WARN_ON(size == 0);
@@ -347,8 +345,7 @@ static void __init xen_do_set_identity_and_remap_chunk(
347 xen_remap_mfn = mfn; 345 xen_remap_mfn = mfn;
348 346
349 /* Set identity map */ 347 /* Set identity map */
350 ident_cnt += set_phys_range_identity(ident_pfn_iter, 348 set_phys_range_identity(ident_pfn_iter, ident_pfn_iter + chunk);
351 ident_pfn_iter + chunk);
352 349
353 left -= chunk; 350 left -= chunk;
354 } 351 }
@@ -371,7 +368,7 @@ static void __init xen_do_set_identity_and_remap_chunk(
371static unsigned long __init xen_set_identity_and_remap_chunk( 368static unsigned long __init xen_set_identity_and_remap_chunk(
372 const struct e820entry *list, size_t map_size, unsigned long start_pfn, 369 const struct e820entry *list, size_t map_size, unsigned long start_pfn,
373 unsigned long end_pfn, unsigned long nr_pages, unsigned long remap_pfn, 370 unsigned long end_pfn, unsigned long nr_pages, unsigned long remap_pfn,
374 unsigned long *identity, unsigned long *released) 371 unsigned long *released, unsigned long *remapped)
375{ 372{
376 unsigned long pfn; 373 unsigned long pfn;
377 unsigned long i = 0; 374 unsigned long i = 0;
@@ -386,8 +383,7 @@ static unsigned long __init xen_set_identity_and_remap_chunk(
386 /* Do not remap pages beyond the current allocation */ 383 /* Do not remap pages beyond the current allocation */
387 if (cur_pfn >= nr_pages) { 384 if (cur_pfn >= nr_pages) {
388 /* Identity map remaining pages */ 385 /* Identity map remaining pages */
389 *identity += set_phys_range_identity(cur_pfn, 386 set_phys_range_identity(cur_pfn, cur_pfn + size);
390 cur_pfn + size);
391 break; 387 break;
392 } 388 }
393 if (cur_pfn + size > nr_pages) 389 if (cur_pfn + size > nr_pages)
@@ -398,7 +394,7 @@ static unsigned long __init xen_set_identity_and_remap_chunk(
398 if (!remap_range_size) { 394 if (!remap_range_size) {
399 pr_warning("Unable to find available pfn range, not remapping identity pages\n"); 395 pr_warning("Unable to find available pfn range, not remapping identity pages\n");
400 xen_set_identity_and_release_chunk(cur_pfn, 396 xen_set_identity_and_release_chunk(cur_pfn,
401 cur_pfn + left, nr_pages, identity, released); 397 cur_pfn + left, nr_pages, released);
402 break; 398 break;
403 } 399 }
404 /* Adjust size to fit in current e820 RAM region */ 400 /* Adjust size to fit in current e820 RAM region */
@@ -410,7 +406,7 @@ static unsigned long __init xen_set_identity_and_remap_chunk(
410 /* Update variables to reflect new mappings. */ 406 /* Update variables to reflect new mappings. */
411 i += size; 407 i += size;
412 remap_pfn += size; 408 remap_pfn += size;
413 *identity += size; 409 *remapped += size;
414 } 410 }
415 411
416 /* 412 /*
@@ -427,13 +423,13 @@ static unsigned long __init xen_set_identity_and_remap_chunk(
427 423
428static void __init xen_set_identity_and_remap( 424static void __init xen_set_identity_and_remap(
429 const struct e820entry *list, size_t map_size, unsigned long nr_pages, 425 const struct e820entry *list, size_t map_size, unsigned long nr_pages,
430 unsigned long *released) 426 unsigned long *released, unsigned long *remapped)
431{ 427{
432 phys_addr_t start = 0; 428 phys_addr_t start = 0;
433 unsigned long identity = 0;
434 unsigned long last_pfn = nr_pages; 429 unsigned long last_pfn = nr_pages;
435 const struct e820entry *entry; 430 const struct e820entry *entry;
436 unsigned long num_released = 0; 431 unsigned long num_released = 0;
432 unsigned long num_remapped = 0;
437 int i; 433 int i;
438 434
439 /* 435 /*
@@ -460,14 +456,14 @@ static void __init xen_set_identity_and_remap(
460 last_pfn = xen_set_identity_and_remap_chunk( 456 last_pfn = xen_set_identity_and_remap_chunk(
461 list, map_size, start_pfn, 457 list, map_size, start_pfn,
462 end_pfn, nr_pages, last_pfn, 458 end_pfn, nr_pages, last_pfn,
463 &identity, &num_released); 459 &num_released, &num_remapped);
464 start = end; 460 start = end;
465 } 461 }
466 } 462 }
467 463
468 *released = num_released; 464 *released = num_released;
465 *remapped = num_remapped;
469 466
470 pr_info("Set %ld page(s) to 1-1 mapping\n", identity);
471 pr_info("Released %ld page(s)\n", num_released); 467 pr_info("Released %ld page(s)\n", num_released);
472} 468}
473 469
@@ -586,6 +582,7 @@ char * __init xen_memory_setup(void)
586 struct xen_memory_map memmap; 582 struct xen_memory_map memmap;
587 unsigned long max_pages; 583 unsigned long max_pages;
588 unsigned long extra_pages = 0; 584 unsigned long extra_pages = 0;
585 unsigned long remapped_pages;
589 int i; 586 int i;
590 int op; 587 int op;
591 588
@@ -635,9 +632,10 @@ char * __init xen_memory_setup(void)
635 * underlying RAM. 632 * underlying RAM.
636 */ 633 */
637 xen_set_identity_and_remap(map, memmap.nr_entries, max_pfn, 634 xen_set_identity_and_remap(map, memmap.nr_entries, max_pfn,
638 &xen_released_pages); 635 &xen_released_pages, &remapped_pages);
639 636
640 extra_pages += xen_released_pages; 637 extra_pages += xen_released_pages;
638 extra_pages += remapped_pages;
641 639
642 /* 640 /*
643 * Clamp the amount of extra memory to a EXTRA_MEM_RATIO 641 * Clamp the amount of extra memory to a EXTRA_MEM_RATIO
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index f473d268d387..69087341d9ae 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -391,7 +391,7 @@ static const struct clock_event_device *xen_clockevent =
391 391
392struct xen_clock_event_device { 392struct xen_clock_event_device {
393 struct clock_event_device evt; 393 struct clock_event_device evt;
394 char *name; 394 char name[16];
395}; 395};
396static DEFINE_PER_CPU(struct xen_clock_event_device, xen_clock_events) = { .evt.irq = -1 }; 396static DEFINE_PER_CPU(struct xen_clock_event_device, xen_clock_events) = { .evt.irq = -1 };
397 397
@@ -420,46 +420,38 @@ void xen_teardown_timer(int cpu)
420 if (evt->irq >= 0) { 420 if (evt->irq >= 0) {
421 unbind_from_irqhandler(evt->irq, NULL); 421 unbind_from_irqhandler(evt->irq, NULL);
422 evt->irq = -1; 422 evt->irq = -1;
423 kfree(per_cpu(xen_clock_events, cpu).name);
424 per_cpu(xen_clock_events, cpu).name = NULL;
425 } 423 }
426} 424}
427 425
428void xen_setup_timer(int cpu) 426void xen_setup_timer(int cpu)
429{ 427{
430 char *name; 428 struct xen_clock_event_device *xevt = &per_cpu(xen_clock_events, cpu);
431 struct clock_event_device *evt; 429 struct clock_event_device *evt = &xevt->evt;
432 int irq; 430 int irq;
433 431
434 evt = &per_cpu(xen_clock_events, cpu).evt;
435 WARN(evt->irq >= 0, "IRQ%d for CPU%d is already allocated\n", evt->irq, cpu); 432 WARN(evt->irq >= 0, "IRQ%d for CPU%d is already allocated\n", evt->irq, cpu);
436 if (evt->irq >= 0) 433 if (evt->irq >= 0)
437 xen_teardown_timer(cpu); 434 xen_teardown_timer(cpu);
438 435
439 printk(KERN_INFO "installing Xen timer for CPU %d\n", cpu); 436 printk(KERN_INFO "installing Xen timer for CPU %d\n", cpu);
440 437
441 name = kasprintf(GFP_KERNEL, "timer%d", cpu); 438 snprintf(xevt->name, sizeof(xevt->name), "timer%d", cpu);
442 if (!name)
443 name = "<timer kasprintf failed>";
444 439
445 irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt, 440 irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt,
446 IRQF_PERCPU|IRQF_NOBALANCING|IRQF_TIMER| 441 IRQF_PERCPU|IRQF_NOBALANCING|IRQF_TIMER|
447 IRQF_FORCE_RESUME|IRQF_EARLY_RESUME, 442 IRQF_FORCE_RESUME|IRQF_EARLY_RESUME,
448 name, NULL); 443 xevt->name, NULL);
449 (void)xen_set_irq_priority(irq, XEN_IRQ_PRIORITY_MAX); 444 (void)xen_set_irq_priority(irq, XEN_IRQ_PRIORITY_MAX);
450 445
451 memcpy(evt, xen_clockevent, sizeof(*evt)); 446 memcpy(evt, xen_clockevent, sizeof(*evt));
452 447
453 evt->cpumask = cpumask_of(cpu); 448 evt->cpumask = cpumask_of(cpu);
454 evt->irq = irq; 449 evt->irq = irq;
455 per_cpu(xen_clock_events, cpu).name = name;
456} 450}
457 451
458 452
459void xen_setup_cpu_clockevents(void) 453void xen_setup_cpu_clockevents(void)
460{ 454{
461 BUG_ON(preemptible());
462
463 clockevents_register_device(this_cpu_ptr(&xen_clock_events.evt)); 455 clockevents_register_device(this_cpu_ptr(&xen_clock_events.evt));
464} 456}
465 457