summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig.debug5
-rw-r--r--arch/arm/boot/dts/bcm47094-linksys-panamera.dts3
-rw-r--r--arch/arm/boot/dts/imx6ul-14x14-evk.dtsi2
-rw-r--r--arch/arm/boot/dts/imx6ul-geam.dts2
-rw-r--r--arch/arm/boot/dts/imx6ul-isiot.dtsi2
-rw-r--r--arch/arm/boot/dts/imx6ul-pico-hobbit.dts2
-rw-r--r--arch/arm/boot/dts/imx6ul-pico-pi.dts4
-rw-r--r--arch/arm/boot/dts/imx7ulp.dtsi2
-rw-r--r--arch/arm/configs/u8500_defconfig34
-rw-r--r--arch/arm/mach-davinci/sleep.S1
-rw-r--r--arch/arm/mach-netx/Kconfig22
-rw-r--r--arch/arm/mach-netx/Makefile13
-rw-r--r--arch/arm/mach-netx/Makefile.boot3
-rw-r--r--arch/arm/mach-netx/fb.c65
-rw-r--r--arch/arm/mach-netx/fb.h12
-rw-r--r--arch/arm/mach-netx/generic.c182
-rw-r--r--arch/arm/mach-netx/generic.h14
-rw-r--r--arch/arm/mach-netx/include/mach/hardware.h27
-rw-r--r--arch/arm/mach-netx/include/mach/irqs.h58
-rw-r--r--arch/arm/mach-netx/include/mach/netx-regs.h420
-rw-r--r--arch/arm/mach-netx/include/mach/pfifo.h42
-rw-r--r--arch/arm/mach-netx/include/mach/uncompress.h63
-rw-r--r--arch/arm/mach-netx/include/mach/xc.h30
-rw-r--r--arch/arm/mach-netx/nxdb500.c197
-rw-r--r--arch/arm/mach-netx/nxdkn.c90
-rw-r--r--arch/arm/mach-netx/nxeb500hmi.c174
-rw-r--r--arch/arm/mach-netx/pfifo.c56
-rw-r--r--arch/arm/mach-netx/time.c141
-rw-r--r--arch/arm/mach-netx/xc.c246
-rw-r--r--arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h4
-rw-r--r--arch/arm64/boot/dts/freescale/imx8mq.dtsi3
-rw-r--r--arch/arm64/include/asm/elf.h2
-rw-r--r--arch/arm64/include/asm/pgtable.h1
-rw-r--r--arch/arm64/include/asm/processor.h14
-rw-r--r--arch/arm64/include/asm/stacktrace.h78
-rw-r--r--arch/arm64/include/uapi/asm/bpf_perf_event.h2
-rw-r--r--arch/arm64/kernel/entry.S22
-rw-r--r--arch/arm64/kernel/fpsimd.c29
-rw-r--r--arch/arm64/kernel/perf_callchain.c7
-rw-r--r--arch/arm64/kernel/process.c36
-rw-r--r--arch/arm64/kernel/return_address.c9
-rw-r--r--arch/arm64/kernel/stacktrace.c59
-rw-r--r--arch/arm64/kernel/time.c7
-rw-r--r--arch/arm64/kernel/traps.c13
-rw-r--r--arch/arm64/kernel/vdso/Makefile13
-rw-r--r--arch/arm64/kernel/vdso32/Makefile14
-rw-r--r--arch/csky/include/uapi/asm/byteorder.h2
-rw-r--r--arch/csky/include/uapi/asm/cachectl.h2
-rw-r--r--arch/csky/include/uapi/asm/perf_regs.h2
-rw-r--r--arch/csky/include/uapi/asm/ptrace.h2
-rw-r--r--arch/csky/include/uapi/asm/sigcontext.h2
-rw-r--r--arch/csky/include/uapi/asm/unistd.h2
-rw-r--r--arch/nds32/include/uapi/asm/auxvec.h2
-rw-r--r--arch/nds32/include/uapi/asm/byteorder.h2
-rw-r--r--arch/nds32/include/uapi/asm/cachectl.h2
-rw-r--r--arch/nds32/include/uapi/asm/fp_udfiex_crtl.h2
-rw-r--r--arch/nds32/include/uapi/asm/param.h2
-rw-r--r--arch/nds32/include/uapi/asm/ptrace.h2
-rw-r--r--arch/nds32/include/uapi/asm/sigcontext.h2
-rw-r--r--arch/nds32/include/uapi/asm/unistd.h2
-rw-r--r--arch/parisc/include/asm/kprobes.h4
-rw-r--r--arch/parisc/kernel/pacache.S3
-rw-r--r--arch/powerpc/Kconfig1
-rw-r--r--arch/powerpc/include/asm/hvcall.h11
-rw-r--r--arch/powerpc/include/asm/pmc.h5
-rw-r--r--arch/powerpc/include/uapi/asm/bpf_perf_event.h2
-rw-r--r--arch/powerpc/include/uapi/asm/kvm_para.h2
-rw-r--r--arch/powerpc/kernel/Makefile3
-rw-r--r--arch/powerpc/kernel/dma-common.c17
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S2
-rw-r--r--arch/powerpc/kernel/signal_32.c3
-rw-r--r--arch/powerpc/kernel/signal_64.c5
-rw-r--r--arch/powerpc/kvm/book3s_hv.c13
-rw-r--r--arch/powerpc/kvm/book3s_xive.c4
-rw-r--r--arch/powerpc/kvm/book3s_xive_native.c4
-rw-r--r--arch/powerpc/mm/book3s64/hash_utils.c9
-rw-r--r--arch/powerpc/mm/mem.c2
-rw-r--r--arch/powerpc/platforms/pseries/papr_scm.c44
-rw-r--r--arch/powerpc/sysdev/xive/common.c7
-rw-r--r--arch/riscv/boot/dts/sifive/fu540-c000.dtsi15
-rw-r--r--arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts9
-rw-r--r--arch/riscv/include/asm/Kbuild1
-rw-r--r--arch/riscv/include/uapi/asm/auxvec.h2
-rw-r--r--arch/riscv/include/uapi/asm/bitsperlong.h2
-rw-r--r--arch/riscv/include/uapi/asm/byteorder.h2
-rw-r--r--arch/riscv/include/uapi/asm/hwcap.h2
-rw-r--r--arch/riscv/include/uapi/asm/ptrace.h2
-rw-r--r--arch/riscv/include/uapi/asm/sigcontext.h2
-rw-r--r--arch/riscv/include/uapi/asm/ucontext.h2
-rw-r--r--arch/riscv/include/uapi/asm/unistd.h1
-rw-r--r--arch/s390/boot/Makefile2
-rw-r--r--arch/s390/boot/boot.h1
-rw-r--r--arch/s390/boot/head.S1
-rw-r--r--arch/s390/boot/version.c7
-rw-r--r--arch/s390/hypfs/hypfs_vm.c4
-rw-r--r--arch/s390/include/asm/bitops.h73
-rw-r--r--arch/s390/include/asm/page.h2
-rw-r--r--arch/s390/include/asm/setup.h4
-rw-r--r--arch/s390/include/asm/unistd.h1
-rw-r--r--arch/s390/include/uapi/asm/bpf_perf_event.h2
-rw-r--r--arch/s390/include/uapi/asm/ipl.h2
-rw-r--r--arch/s390/include/uapi/asm/zcrypt.h35
-rw-r--r--arch/s390/kernel/syscalls/syscall.tbl2
-rw-r--r--arch/s390/mm/pgalloc.c6
-rw-r--r--arch/sh/include/uapi/asm/setup.h2
-rw-r--r--arch/sh/include/uapi/asm/types.h2
-rw-r--r--arch/sparc/include/uapi/asm/oradax.h2
-rw-r--r--arch/x86/entry/entry_32.S13
-rw-r--r--arch/x86/events/intel/core.c9
-rw-r--r--arch/x86/events/intel/ds.c2
-rw-r--r--arch/x86/include/asm/kvm_host.h7
-rw-r--r--arch/x86/include/uapi/asm/byteorder.h2
-rw-r--r--arch/x86/include/uapi/asm/hwcap2.h2
-rw-r--r--arch/x86/include/uapi/asm/sigcontext32.h2
-rw-r--r--arch/x86/include/uapi/asm/types.h2
-rw-r--r--arch/x86/kernel/cpu/bugs.c2
-rw-r--r--arch/x86/kernel/head_64.S8
-rw-r--r--arch/x86/kernel/hpet.c12
-rw-r--r--arch/x86/kernel/stacktrace.c2
-rw-r--r--arch/x86/kernel/sysfb_efi.c46
-rw-r--r--arch/x86/kvm/mmu.c2
-rw-r--r--arch/x86/kvm/svm.c13
-rw-r--r--arch/x86/kvm/vmx/nested.c4
-rw-r--r--arch/x86/kvm/vmx/vmx.c13
-rw-r--r--arch/x86/kvm/x86.c16
-rw-r--r--arch/x86/mm/fault.c15
126 files changed, 612 insertions, 2142 deletions
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index c929bea9a9ff..85710e078afb 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -1535,7 +1535,6 @@ config DEBUG_LL_INCLUDE
1535 DEBUG_IMX7D_UART 1535 DEBUG_IMX7D_UART
1536 default "debug/ks8695.S" if DEBUG_KS8695_UART 1536 default "debug/ks8695.S" if DEBUG_KS8695_UART
1537 default "debug/msm.S" if DEBUG_QCOM_UARTDM 1537 default "debug/msm.S" if DEBUG_QCOM_UARTDM
1538 default "debug/netx.S" if DEBUG_NETX_UART
1539 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART 1538 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART
1540 default "debug/renesas-scif.S" if DEBUG_R7S72100_SCIF2 1539 default "debug/renesas-scif.S" if DEBUG_R7S72100_SCIF2
1541 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN1_SCIF0 1540 default "debug/renesas-scif.S" if DEBUG_RCAR_GEN1_SCIF0
@@ -1575,7 +1574,6 @@ config DEBUG_UART_8250
1575 1574
1576config DEBUG_UART_PHYS 1575config DEBUG_UART_PHYS
1577 hex "Physical base address of debug UART" 1576 hex "Physical base address of debug UART"
1578 default 0x00100a00 if DEBUG_NETX_UART
1579 default 0x01c20000 if DEBUG_DAVINCI_DMx_UART0 1577 default 0x01c20000 if DEBUG_DAVINCI_DMx_UART0
1580 default 0x01c28000 if DEBUG_SUNXI_UART0 1578 default 0x01c28000 if DEBUG_SUNXI_UART0
1581 default 0x01c28400 if DEBUG_SUNXI_UART1 1579 default 0x01c28400 if DEBUG_SUNXI_UART1
@@ -1700,7 +1698,6 @@ config DEBUG_UART_PHYS
1700 DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ 1698 DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \
1701 DEBUG_LL_UART_EFM32 || \ 1699 DEBUG_LL_UART_EFM32 || \
1702 DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ 1700 DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \
1703 DEBUG_NETX_UART || \
1704 DEBUG_QCOM_UARTDM || DEBUG_R7S72100_SCIF2 || \ 1701 DEBUG_QCOM_UARTDM || DEBUG_R7S72100_SCIF2 || \
1705 DEBUG_RCAR_GEN1_SCIF0 || DEBUG_RCAR_GEN1_SCIF2 || \ 1702 DEBUG_RCAR_GEN1_SCIF0 || DEBUG_RCAR_GEN1_SCIF2 || \
1706 DEBUG_RCAR_GEN2_SCIF0 || DEBUG_RCAR_GEN2_SCIF1 || \ 1703 DEBUG_RCAR_GEN2_SCIF0 || DEBUG_RCAR_GEN2_SCIF1 || \
@@ -1717,7 +1714,6 @@ config DEBUG_UART_VIRT
1717 default 0xc881f000 if DEBUG_RV1108_UART2 1714 default 0xc881f000 if DEBUG_RV1108_UART2
1718 default 0xc8821000 if DEBUG_RV1108_UART1 1715 default 0xc8821000 if DEBUG_RV1108_UART1
1719 default 0xc8912000 if DEBUG_RV1108_UART0 1716 default 0xc8912000 if DEBUG_RV1108_UART0
1720 default 0xe0000a00 if DEBUG_NETX_UART
1721 default 0xe0010fe0 if ARCH_RPC 1717 default 0xe0010fe0 if ARCH_RPC
1722 default 0xf0000be0 if ARCH_EBSA110 1718 default 0xf0000be0 if ARCH_EBSA110
1723 default 0xf0010000 if DEBUG_ASM9260_UART 1719 default 0xf0010000 if DEBUG_ASM9260_UART
@@ -1822,7 +1818,6 @@ config DEBUG_UART_VIRT
1822 default DEBUG_UART_PHYS if !MMU 1818 default DEBUG_UART_PHYS if !MMU
1823 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ 1819 depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \
1824 DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \ 1820 DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_MESON_UARTAO || \
1825 DEBUG_NETX_UART || \
1826 DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \ 1821 DEBUG_QCOM_UARTDM || DEBUG_S3C24XX_UART || \
1827 DEBUG_S3C64XX_UART || \ 1822 DEBUG_S3C64XX_UART || \
1828 DEBUG_BCM63XX_UART || DEBUG_ASM9260_UART || \ 1823 DEBUG_BCM63XX_UART || DEBUG_ASM9260_UART || \
diff --git a/arch/arm/boot/dts/bcm47094-linksys-panamera.dts b/arch/arm/boot/dts/bcm47094-linksys-panamera.dts
index 18d0ae46e76c..0faae8950375 100644
--- a/arch/arm/boot/dts/bcm47094-linksys-panamera.dts
+++ b/arch/arm/boot/dts/bcm47094-linksys-panamera.dts
@@ -124,6 +124,9 @@
124 }; 124 };
125 125
126 mdio-bus-mux { 126 mdio-bus-mux {
127 #address-cells = <1>;
128 #size-cells = <0>;
129
127 /* BIT(9) = 1 => external mdio */ 130 /* BIT(9) = 1 => external mdio */
128 mdio_ext: mdio@200 { 131 mdio_ext: mdio@200 {
129 reg = <0x200>; 132 reg = <0x200>;
diff --git a/arch/arm/boot/dts/imx6ul-14x14-evk.dtsi b/arch/arm/boot/dts/imx6ul-14x14-evk.dtsi
index cbe61b61a212..c2a9dd57e56a 100644
--- a/arch/arm/boot/dts/imx6ul-14x14-evk.dtsi
+++ b/arch/arm/boot/dts/imx6ul-14x14-evk.dtsi
@@ -112,7 +112,7 @@
112}; 112};
113 113
114&i2c2 { 114&i2c2 {
115 clock_frequency = <100000>; 115 clock-frequency = <100000>;
116 pinctrl-names = "default"; 116 pinctrl-names = "default";
117 pinctrl-0 = <&pinctrl_i2c2>; 117 pinctrl-0 = <&pinctrl_i2c2>;
118 status = "okay"; 118 status = "okay";
diff --git a/arch/arm/boot/dts/imx6ul-geam.dts b/arch/arm/boot/dts/imx6ul-geam.dts
index 21ddd359d3ed..9f63706383a7 100644
--- a/arch/arm/boot/dts/imx6ul-geam.dts
+++ b/arch/arm/boot/dts/imx6ul-geam.dts
@@ -156,7 +156,7 @@
156}; 156};
157 157
158&i2c2 { 158&i2c2 {
159 clock_frequency = <100000>; 159 clock-frequency = <100000>;
160 pinctrl-names = "default"; 160 pinctrl-names = "default";
161 pinctrl-0 = <&pinctrl_i2c2>; 161 pinctrl-0 = <&pinctrl_i2c2>;
162 status = "okay"; 162 status = "okay";
diff --git a/arch/arm/boot/dts/imx6ul-isiot.dtsi b/arch/arm/boot/dts/imx6ul-isiot.dtsi
index b26d4f57c655..cc9adce638f5 100644
--- a/arch/arm/boot/dts/imx6ul-isiot.dtsi
+++ b/arch/arm/boot/dts/imx6ul-isiot.dtsi
@@ -148,7 +148,7 @@
148}; 148};
149 149
150&i2c2 { 150&i2c2 {
151 clock_frequency = <100000>; 151 clock-frequency = <100000>;
152 pinctrl-names = "default"; 152 pinctrl-names = "default";
153 pinctrl-0 = <&pinctrl_i2c2>; 153 pinctrl-0 = <&pinctrl_i2c2>;
154 status = "okay"; 154 status = "okay";
diff --git a/arch/arm/boot/dts/imx6ul-pico-hobbit.dts b/arch/arm/boot/dts/imx6ul-pico-hobbit.dts
index 39eeeddac39e..09f7ffa9ad8c 100644
--- a/arch/arm/boot/dts/imx6ul-pico-hobbit.dts
+++ b/arch/arm/boot/dts/imx6ul-pico-hobbit.dts
@@ -43,7 +43,7 @@
43}; 43};
44 44
45&i2c2 { 45&i2c2 {
46 clock_frequency = <100000>; 46 clock-frequency = <100000>;
47 pinctrl-names = "default"; 47 pinctrl-names = "default";
48 pinctrl-0 = <&pinctrl_i2c2>; 48 pinctrl-0 = <&pinctrl_i2c2>;
49 status = "okay"; 49 status = "okay";
diff --git a/arch/arm/boot/dts/imx6ul-pico-pi.dts b/arch/arm/boot/dts/imx6ul-pico-pi.dts
index de07357b27fc..6cd7d5877d20 100644
--- a/arch/arm/boot/dts/imx6ul-pico-pi.dts
+++ b/arch/arm/boot/dts/imx6ul-pico-pi.dts
@@ -43,7 +43,7 @@
43}; 43};
44 44
45&i2c2 { 45&i2c2 {
46 clock_frequency = <100000>; 46 clock-frequency = <100000>;
47 pinctrl-names = "default"; 47 pinctrl-names = "default";
48 pinctrl-0 = <&pinctrl_i2c2>; 48 pinctrl-0 = <&pinctrl_i2c2>;
49 status = "okay"; 49 status = "okay";
@@ -58,7 +58,7 @@
58}; 58};
59 59
60&i2c3 { 60&i2c3 {
61 clock_frequency = <100000>; 61 clock-frequency = <100000>;
62 pinctrl-names = "default"; 62 pinctrl-names = "default";
63 pinctrl-0 = <&pinctrl_i2c3>; 63 pinctrl-0 = <&pinctrl_i2c3>;
64 status = "okay"; 64 status = "okay";
diff --git a/arch/arm/boot/dts/imx7ulp.dtsi b/arch/arm/boot/dts/imx7ulp.dtsi
index 992747a57442..56907bb4b329 100644
--- a/arch/arm/boot/dts/imx7ulp.dtsi
+++ b/arch/arm/boot/dts/imx7ulp.dtsi
@@ -186,7 +186,7 @@
186 reg = <0x40330200 0x200>; 186 reg = <0x40330200 0x200>;
187 }; 187 };
188 188
189 usbphy1: usb-phy@0x40350000 { 189 usbphy1: usb-phy@40350000 {
190 compatible = "fsl,imx7ulp-usbphy", "fsl,imx6ul-usbphy"; 190 compatible = "fsl,imx7ulp-usbphy", "fsl,imx6ul-usbphy";
191 reg = <0x40350000 0x1000>; 191 reg = <0x40350000 0x1000>;
192 interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>; 192 interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index e6b98b6eb88d..822cddfbf1af 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -4,17 +4,9 @@ CONFIG_NO_HZ_IDLE=y
4CONFIG_HIGH_RES_TIMERS=y 4CONFIG_HIGH_RES_TIMERS=y
5CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
6CONFIG_KALLSYMS_ALL=y 6CONFIG_KALLSYMS_ALL=y
7CONFIG_MODULES=y
8CONFIG_MODULE_UNLOAD=y
9# CONFIG_BLK_DEV_BSG is not set
10CONFIG_PARTITION_ADVANCED=y
11CONFIG_ARCH_U8500=y 7CONFIG_ARCH_U8500=y
12CONFIG_MACH_HREFV60=y
13CONFIG_MACH_SNOWBALL=y
14CONFIG_SMP=y 8CONFIG_SMP=y
15CONFIG_NR_CPUS=2 9CONFIG_NR_CPUS=2
16CONFIG_PREEMPT=y
17CONFIG_AEABI=y
18CONFIG_HIGHMEM=y 10CONFIG_HIGHMEM=y
19CONFIG_ARM_APPENDED_DTB=y 11CONFIG_ARM_APPENDED_DTB=y
20CONFIG_ARM_ATAG_DTB_COMPAT=y 12CONFIG_ARM_ATAG_DTB_COMPAT=y
@@ -25,6 +17,11 @@ CONFIG_CPU_IDLE=y
25CONFIG_ARM_U8500_CPUIDLE=y 17CONFIG_ARM_U8500_CPUIDLE=y
26CONFIG_VFP=y 18CONFIG_VFP=y
27CONFIG_NEON=y 19CONFIG_NEON=y
20CONFIG_MODULES=y
21CONFIG_MODULE_UNLOAD=y
22# CONFIG_BLK_DEV_BSG is not set
23CONFIG_PARTITION_ADVANCED=y
24CONFIG_CMA=y
28CONFIG_NET=y 25CONFIG_NET=y
29CONFIG_PACKET=y 26CONFIG_PACKET=y
30CONFIG_UNIX=y 27CONFIG_UNIX=y
@@ -47,7 +44,6 @@ CONFIG_SMSC911X=y
47CONFIG_SMSC_PHY=y 44CONFIG_SMSC_PHY=y
48CONFIG_CW1200=y 45CONFIG_CW1200=y
49CONFIG_CW1200_WLAN_SDIO=y 46CONFIG_CW1200_WLAN_SDIO=y
50# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
51CONFIG_INPUT_EVDEV=y 47CONFIG_INPUT_EVDEV=y
52# CONFIG_KEYBOARD_ATKBD is not set 48# CONFIG_KEYBOARD_ATKBD is not set
53CONFIG_KEYBOARD_GPIO=y 49CONFIG_KEYBOARD_GPIO=y
@@ -63,7 +59,6 @@ CONFIG_RMI4_CORE=y
63CONFIG_RMI4_I2C=y 59CONFIG_RMI4_I2C=y
64CONFIG_RMI4_F11=y 60CONFIG_RMI4_F11=y
65# CONFIG_SERIO is not set 61# CONFIG_SERIO is not set
66CONFIG_VT_HW_CONSOLE_BINDING=y
67# CONFIG_LEGACY_PTYS is not set 62# CONFIG_LEGACY_PTYS is not set
68CONFIG_SERIAL_AMBA_PL011=y 63CONFIG_SERIAL_AMBA_PL011=y
69CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 64CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
@@ -72,6 +67,7 @@ CONFIG_SPI=y
72CONFIG_SPI_PL022=y 67CONFIG_SPI_PL022=y
73CONFIG_GPIO_STMPE=y 68CONFIG_GPIO_STMPE=y
74CONFIG_GPIO_TC3589X=y 69CONFIG_GPIO_TC3589X=y
70CONFIG_SENSORS_IIO_HWMON=y
75CONFIG_THERMAL=y 71CONFIG_THERMAL=y
76CONFIG_CPU_THERMAL=y 72CONFIG_CPU_THERMAL=y
77CONFIG_WATCHDOG=y 73CONFIG_WATCHDOG=y
@@ -79,6 +75,13 @@ CONFIG_MFD_STMPE=y
79CONFIG_MFD_TC3589X=y 75CONFIG_MFD_TC3589X=y
80CONFIG_REGULATOR_AB8500=y 76CONFIG_REGULATOR_AB8500=y
81CONFIG_REGULATOR_GPIO=y 77CONFIG_REGULATOR_GPIO=y
78CONFIG_DRM=y
79CONFIG_DRM_PANEL_SAMSUNG_S6D16D0=y
80CONFIG_DRM_LIMA=y
81CONFIG_DRM_MCDE=y
82CONFIG_BACKLIGHT_CLASS_DEVICE=y
83CONFIG_BACKLIGHT_GENERIC=m
84CONFIG_LOGO=y
82CONFIG_SOUND=y 85CONFIG_SOUND=y
83CONFIG_SND=y 86CONFIG_SND=y
84CONFIG_SND_SOC=y 87CONFIG_SND_SOC=y
@@ -87,6 +90,7 @@ CONFIG_SND_SOC_UX500_MACH_MOP500=y
87CONFIG_USB=y 90CONFIG_USB=y
88CONFIG_USB_MUSB_HDRC=y 91CONFIG_USB_MUSB_HDRC=y
89CONFIG_USB_MUSB_UX500=y 92CONFIG_USB_MUSB_UX500=y
93CONFIG_MUSB_PIO_ONLY=y
90CONFIG_AB8500_USB=y 94CONFIG_AB8500_USB=y
91CONFIG_USB_GADGET=y 95CONFIG_USB_GADGET=y
92CONFIG_USB_ETH=m 96CONFIG_USB_ETH=m
@@ -103,6 +107,7 @@ CONFIG_RTC_DRV_AB8500=y
103CONFIG_RTC_DRV_PL031=y 107CONFIG_RTC_DRV_PL031=y
104CONFIG_DMADEVICES=y 108CONFIG_DMADEVICES=y
105CONFIG_STE_DMA40=y 109CONFIG_STE_DMA40=y
110CONFIG_HWSPINLOCK=y
106CONFIG_HSEM_U8500=y 111CONFIG_HSEM_U8500=y
107CONFIG_IIO=y 112CONFIG_IIO=y
108CONFIG_IIO_SW_TRIGGER=y 113CONFIG_IIO_SW_TRIGGER=y
@@ -126,20 +131,19 @@ CONFIG_NFS_FS=y
126CONFIG_ROOT_NFS=y 131CONFIG_ROOT_NFS=y
127CONFIG_NLS_CODEPAGE_437=y 132CONFIG_NLS_CODEPAGE_437=y
128CONFIG_NLS_ISO8859_1=y 133CONFIG_NLS_ISO8859_1=y
134CONFIG_CRYPTO_DEV_UX500=y
135CONFIG_CRYPTO_DEV_UX500_CRYP=y
136CONFIG_CRYPTO_DEV_UX500_HASH=y
137CONFIG_CRYPTO_DEV_UX500_DEBUG=y
129CONFIG_PRINTK_TIME=y 138CONFIG_PRINTK_TIME=y
130CONFIG_DEBUG_INFO=y 139CONFIG_DEBUG_INFO=y
131CONFIG_DEBUG_FS=y 140CONFIG_DEBUG_FS=y
132CONFIG_MAGIC_SYSRQ=y 141CONFIG_MAGIC_SYSRQ=y
133CONFIG_DEBUG_KERNEL=y 142CONFIG_DEBUG_KERNEL=y
134# CONFIG_SCHED_DEBUG is not set 143# CONFIG_SCHED_DEBUG is not set
135# CONFIG_DEBUG_PREEMPT is not set
136# CONFIG_FTRACE is not set 144# CONFIG_FTRACE is not set
137CONFIG_DEBUG_USER=y 145CONFIG_DEBUG_USER=y
138CONFIG_CORESIGHT=y 146CONFIG_CORESIGHT=y
139CONFIG_CORESIGHT_SINK_TPIU=y 147CONFIG_CORESIGHT_SINK_TPIU=y
140CONFIG_CORESIGHT_SINK_ETBV10=y 148CONFIG_CORESIGHT_SINK_ETBV10=y
141CONFIG_CORESIGHT_SOURCE_ETM3X=y 149CONFIG_CORESIGHT_SOURCE_ETM3X=y
142CONFIG_CRYPTO_DEV_UX500=y
143CONFIG_CRYPTO_DEV_UX500_CRYP=y
144CONFIG_CRYPTO_DEV_UX500_HASH=y
145CONFIG_CRYPTO_DEV_UX500_DEBUG=y
diff --git a/arch/arm/mach-davinci/sleep.S b/arch/arm/mach-davinci/sleep.S
index 05d03f09ff54..71262dcdbca3 100644
--- a/arch/arm/mach-davinci/sleep.S
+++ b/arch/arm/mach-davinci/sleep.S
@@ -24,6 +24,7 @@
24#define DEEPSLEEP_SLEEPENABLE_BIT BIT(31) 24#define DEEPSLEEP_SLEEPENABLE_BIT BIT(31)
25 25
26 .text 26 .text
27 .arch armv5te
27/* 28/*
28 * Move DaVinci into deep sleep state 29 * Move DaVinci into deep sleep state
29 * 30 *
diff --git a/arch/arm/mach-netx/Kconfig b/arch/arm/mach-netx/Kconfig
deleted file mode 100644
index 1e5d9c870784..000000000000
--- a/arch/arm/mach-netx/Kconfig
+++ /dev/null
@@ -1,22 +0,0 @@
1# SPDX-License-Identifier: GPL-2.0-only
2menu "NetX Implementations"
3 depends on ARCH_NETX
4
5config MACH_NXDKN
6 bool "Enable Hilscher nxdkn Eval Board support"
7 help
8 Board support for the Hilscher NetX Eval Board
9
10config MACH_NXDB500
11 bool "Enable Hilscher nxdb500 Eval Board support"
12 select ARM_AMBA
13 help
14 Board support for the Hilscher nxdb500 Eval Board
15
16config MACH_NXEB500HMI
17 bool "Enable Hilscher nxeb500hmi Eval Board support"
18 select ARM_AMBA
19 help
20 Board support for the Hilscher nxeb500hmi Eval Board
21
22endmenu
diff --git a/arch/arm/mach-netx/Makefile b/arch/arm/mach-netx/Makefile
deleted file mode 100644
index 44ea83f7d9c2..000000000000
--- a/arch/arm/mach-netx/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
1# SPDX-License-Identifier: GPL-2.0-only
2#
3# Makefile for the linux kernel.
4#
5
6# Object file lists.
7
8obj-y += time.o generic.o pfifo.o xc.o
9
10# Specific board support
11obj-$(CONFIG_MACH_NXDKN) += nxdkn.o
12obj-$(CONFIG_MACH_NXDB500) += nxdb500.o fb.o
13obj-$(CONFIG_MACH_NXEB500HMI) += nxeb500hmi.o fb.o
diff --git a/arch/arm/mach-netx/Makefile.boot b/arch/arm/mach-netx/Makefile.boot
deleted file mode 100644
index 2eb23c0cb6b0..000000000000
--- a/arch/arm/mach-netx/Makefile.boot
+++ /dev/null
@@ -1,3 +0,0 @@
1# SPDX-License-Identifier: GPL-2.0-only
2 zreladdr-y += 0x80008000
3
diff --git a/arch/arm/mach-netx/fb.c b/arch/arm/mach-netx/fb.c
deleted file mode 100644
index 2dc80db07390..000000000000
--- a/arch/arm/mach-netx/fb.c
+++ /dev/null
@@ -1,65 +0,0 @@
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * arch/arm/mach-netx/fb.c
4 *
5 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 */
7
8#include <linux/device.h>
9#include <linux/init.h>
10#include <linux/dma-mapping.h>
11#include <linux/amba/bus.h>
12#include <linux/amba/clcd.h>
13#include <linux/err.h>
14#include <linux/gfp.h>
15
16#include <asm/irq.h>
17
18#include <mach/netx-regs.h>
19#include <mach/hardware.h>
20
21static struct clcd_panel *netx_panel;
22
23void netx_clcd_enable(struct clcd_fb *fb)
24{
25}
26
27int netx_clcd_setup(struct clcd_fb *fb)
28{
29 dma_addr_t dma;
30
31 fb->panel = netx_panel;
32
33 fb->fb.screen_base = dma_alloc_wc(&fb->dev->dev, 1024 * 1024, &dma,
34 GFP_KERNEL);
35 if (!fb->fb.screen_base) {
36 printk(KERN_ERR "CLCD: unable to map framebuffer\n");
37 return -ENOMEM;
38 }
39
40 fb->fb.fix.smem_start = dma;
41 fb->fb.fix.smem_len = 1024*1024;
42
43 return 0;
44}
45
46int netx_clcd_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
47{
48 return dma_mmap_wc(&fb->dev->dev, vma, fb->fb.screen_base,
49 fb->fb.fix.smem_start, fb->fb.fix.smem_len);
50}
51
52void netx_clcd_remove(struct clcd_fb *fb)
53{
54 dma_free_wc(&fb->dev->dev, fb->fb.fix.smem_len, fb->fb.screen_base,
55 fb->fb.fix.smem_start);
56}
57
58static AMBA_AHB_DEVICE(fb, "fb", 0, 0x00104000, { NETX_IRQ_LCD }, NULL);
59
60int netx_fb_init(struct clcd_board *board, struct clcd_panel *panel)
61{
62 netx_panel = panel;
63 fb_device.dev.platform_data = board;
64 return amba_device_register(&fb_device, &iomem_resource);
65}
diff --git a/arch/arm/mach-netx/fb.h b/arch/arm/mach-netx/fb.h
deleted file mode 100644
index 5cdc01fc3c86..000000000000
--- a/arch/arm/mach-netx/fb.h
+++ /dev/null
@@ -1,12 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * arch/arm/mach-netx/fb.h
4 *
5 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 */
7
8void netx_clcd_enable(struct clcd_fb *fb);
9int netx_clcd_setup(struct clcd_fb *fb);
10int netx_clcd_mmap(struct clcd_fb *fb, struct vm_area_struct *vma);
11void netx_clcd_remove(struct clcd_fb *fb);
12int netx_fb_init(struct clcd_board *board, struct clcd_panel *panel);
diff --git a/arch/arm/mach-netx/generic.c b/arch/arm/mach-netx/generic.c
deleted file mode 100644
index 88881fd45e9f..000000000000
--- a/arch/arm/mach-netx/generic.c
+++ /dev/null
@@ -1,182 +0,0 @@
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * arch/arm/mach-netx/generic.c
4 *
5 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 */
7
8#include <linux/device.h>
9#include <linux/init.h>
10#include <linux/kernel.h>
11#include <linux/module.h>
12#include <linux/platform_device.h>
13#include <linux/io.h>
14#include <linux/irqchip/arm-vic.h>
15#include <linux/reboot.h>
16#include <mach/hardware.h>
17#include <asm/mach/map.h>
18#include <mach/netx-regs.h>
19#include <asm/mach/irq.h>
20
21static struct map_desc netx_io_desc[] __initdata = {
22 {
23 .virtual = NETX_IO_VIRT,
24 .pfn = __phys_to_pfn(NETX_IO_PHYS),
25 .length = NETX_IO_SIZE,
26 .type = MT_DEVICE
27 }
28};
29
30void __init netx_map_io(void)
31{
32 iotable_init(netx_io_desc, ARRAY_SIZE(netx_io_desc));
33}
34
35static struct resource netx_rtc_resources[] = {
36 [0] = {
37 .start = 0x00101200,
38 .end = 0x00101220,
39 .flags = IORESOURCE_MEM,
40 },
41};
42
43static struct platform_device netx_rtc_device = {
44 .name = "netx-rtc",
45 .id = 0,
46 .num_resources = ARRAY_SIZE(netx_rtc_resources),
47 .resource = netx_rtc_resources,
48};
49
50static struct platform_device *devices[] __initdata = {
51 &netx_rtc_device,
52};
53
54#if 0
55#define DEBUG_IRQ(fmt...) printk(fmt)
56#else
57#define DEBUG_IRQ(fmt...) while (0) {}
58#endif
59
60static void netx_hif_demux_handler(struct irq_desc *desc)
61{
62 unsigned int irq = NETX_IRQ_HIF_CHAINED(0);
63 unsigned int stat;
64
65 stat = ((readl(NETX_DPMAS_INT_EN) &
66 readl(NETX_DPMAS_INT_STAT)) >> 24) & 0x1f;
67
68 while (stat) {
69 if (stat & 1) {
70 DEBUG_IRQ("handling irq %d\n", irq);
71 generic_handle_irq(irq);
72 }
73 irq++;
74 stat >>= 1;
75 }
76}
77
78static int
79netx_hif_irq_type(struct irq_data *d, unsigned int type)
80{
81 unsigned int val, irq;
82
83 val = readl(NETX_DPMAS_IF_CONF1);
84
85 irq = d->irq - NETX_IRQ_HIF_CHAINED(0);
86
87 if (type & IRQ_TYPE_EDGE_RISING) {
88 DEBUG_IRQ("rising edges\n");
89 val |= (1 << 26) << irq;
90 }
91 if (type & IRQ_TYPE_EDGE_FALLING) {
92 DEBUG_IRQ("falling edges\n");
93 val &= ~((1 << 26) << irq);
94 }
95 if (type & IRQ_TYPE_LEVEL_LOW) {
96 DEBUG_IRQ("low level\n");
97 val &= ~((1 << 26) << irq);
98 }
99 if (type & IRQ_TYPE_LEVEL_HIGH) {
100 DEBUG_IRQ("high level\n");
101 val |= (1 << 26) << irq;
102 }
103
104 writel(val, NETX_DPMAS_IF_CONF1);
105
106 return 0;
107}
108
109static void
110netx_hif_ack_irq(struct irq_data *d)
111{
112 unsigned int val, irq;
113
114 irq = d->irq - NETX_IRQ_HIF_CHAINED(0);
115 writel((1 << 24) << irq, NETX_DPMAS_INT_STAT);
116
117 val = readl(NETX_DPMAS_INT_EN);
118 val &= ~((1 << 24) << irq);
119 writel(val, NETX_DPMAS_INT_EN);
120
121 DEBUG_IRQ("%s: irq %d\n", __func__, d->irq);
122}
123
124static void
125netx_hif_mask_irq(struct irq_data *d)
126{
127 unsigned int val, irq;
128
129 irq = d->irq - NETX_IRQ_HIF_CHAINED(0);
130 val = readl(NETX_DPMAS_INT_EN);
131 val &= ~((1 << 24) << irq);
132 writel(val, NETX_DPMAS_INT_EN);
133 DEBUG_IRQ("%s: irq %d\n", __func__, d->irq);
134}
135
136static void
137netx_hif_unmask_irq(struct irq_data *d)
138{
139 unsigned int val, irq;
140
141 irq = d->irq - NETX_IRQ_HIF_CHAINED(0);
142 val = readl(NETX_DPMAS_INT_EN);
143 val |= (1 << 24) << irq;
144 writel(val, NETX_DPMAS_INT_EN);
145 DEBUG_IRQ("%s: irq %d\n", __func__, d->irq);
146}
147
148static struct irq_chip netx_hif_chip = {
149 .irq_ack = netx_hif_ack_irq,
150 .irq_mask = netx_hif_mask_irq,
151 .irq_unmask = netx_hif_unmask_irq,
152 .irq_set_type = netx_hif_irq_type,
153};
154
155void __init netx_init_irq(void)
156{
157 int irq;
158
159 vic_init(io_p2v(NETX_PA_VIC), NETX_IRQ_VIC_START, ~0, 0);
160
161 for (irq = NETX_IRQ_HIF_CHAINED(0); irq <= NETX_IRQ_HIF_LAST; irq++) {
162 irq_set_chip_and_handler(irq, &netx_hif_chip,
163 handle_level_irq);
164 irq_clear_status_flags(irq, IRQ_NOREQUEST);
165 }
166
167 writel(NETX_DPMAS_INT_EN_GLB_EN, NETX_DPMAS_INT_EN);
168 irq_set_chained_handler(NETX_IRQ_HIF, netx_hif_demux_handler);
169}
170
171static int __init netx_init(void)
172{
173 return platform_add_devices(devices, ARRAY_SIZE(devices));
174}
175
176subsys_initcall(netx_init);
177
178void netx_restart(enum reboot_mode mode, const char *cmd)
179{
180 writel(NETX_SYSTEM_RES_CR_FIRMW_RES_EN | NETX_SYSTEM_RES_CR_FIRMW_RES,
181 NETX_SYSTEM_RES_CR);
182}
diff --git a/arch/arm/mach-netx/generic.h b/arch/arm/mach-netx/generic.h
deleted file mode 100644
index 223e304574a5..000000000000
--- a/arch/arm/mach-netx/generic.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * arch/arm/mach-netx/generic.h
4 *
5 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 */
7
8#include <linux/reboot.h>
9
10extern void __init netx_map_io(void);
11extern void __init netx_init_irq(void);
12extern void netx_restart(enum reboot_mode, const char *);
13
14extern void netx_timer_init(void);
diff --git a/arch/arm/mach-netx/include/mach/hardware.h b/arch/arm/mach-netx/include/mach/hardware.h
deleted file mode 100644
index 84253993d1e0..000000000000
--- a/arch/arm/mach-netx/include/mach/hardware.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * arch/arm/mach-netx/include/mach/hardware.h
4 *
5 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 */
7#ifndef __ASM_ARCH_HARDWARE_H
8#define __ASM_ARCH_HARDWARE_H
9
10#define NETX_IO_PHYS 0x00100000
11#define NETX_IO_VIRT 0xe0000000
12#define NETX_IO_SIZE 0x00100000
13
14#define SRAM_INTERNAL_PHYS_0 0x00000
15#define SRAM_INTERNAL_PHYS_1 0x08000
16#define SRAM_INTERNAL_PHYS_2 0x10000
17#define SRAM_INTERNAL_PHYS_3 0x18000
18#define SRAM_INTERNAL_PHYS(no) ((no) * 0x8000)
19
20#define XPEC_MEM_SIZE 0x4000
21#define XMAC_MEM_SIZE 0x1000
22#define SRAM_MEM_SIZE 0x8000
23
24#define io_p2v(x) IOMEM((x) - NETX_IO_PHYS + NETX_IO_VIRT)
25#define io_v2p(x) ((x) - NETX_IO_VIRT + NETX_IO_PHYS)
26
27#endif
diff --git a/arch/arm/mach-netx/include/mach/irqs.h b/arch/arm/mach-netx/include/mach/irqs.h
deleted file mode 100644
index 540c92104fe8..000000000000
--- a/arch/arm/mach-netx/include/mach/irqs.h
+++ /dev/null
@@ -1,58 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * arch/arm/mach-netx/include/mach/irqs.h
4 *
5 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 */
7
8#define NETX_IRQ_VIC_START 64
9#define NETX_IRQ_SOFTINT (NETX_IRQ_VIC_START + 0)
10#define NETX_IRQ_TIMER0 (NETX_IRQ_VIC_START + 1)
11#define NETX_IRQ_TIMER1 (NETX_IRQ_VIC_START + 2)
12#define NETX_IRQ_TIMER2 (NETX_IRQ_VIC_START + 3)
13#define NETX_IRQ_SYSTIME_NS (NETX_IRQ_VIC_START + 4)
14#define NETX_IRQ_SYSTIME_S (NETX_IRQ_VIC_START + 5)
15#define NETX_IRQ_GPIO_15 (NETX_IRQ_VIC_START + 6)
16#define NETX_IRQ_WATCHDOG (NETX_IRQ_VIC_START + 7)
17#define NETX_IRQ_UART0 (NETX_IRQ_VIC_START + 8)
18#define NETX_IRQ_UART1 (NETX_IRQ_VIC_START + 9)
19#define NETX_IRQ_UART2 (NETX_IRQ_VIC_START + 10)
20#define NETX_IRQ_USB (NETX_IRQ_VIC_START + 11)
21#define NETX_IRQ_SPI (NETX_IRQ_VIC_START + 12)
22#define NETX_IRQ_I2C (NETX_IRQ_VIC_START + 13)
23#define NETX_IRQ_LCD (NETX_IRQ_VIC_START + 14)
24#define NETX_IRQ_HIF (NETX_IRQ_VIC_START + 15)
25#define NETX_IRQ_GPIO_0_14 (NETX_IRQ_VIC_START + 16)
26#define NETX_IRQ_XPEC0 (NETX_IRQ_VIC_START + 17)
27#define NETX_IRQ_XPEC1 (NETX_IRQ_VIC_START + 18)
28#define NETX_IRQ_XPEC2 (NETX_IRQ_VIC_START + 19)
29#define NETX_IRQ_XPEC3 (NETX_IRQ_VIC_START + 20)
30#define NETX_IRQ_XPEC(no) (NETX_IRQ_VIC_START + 17 + (no))
31#define NETX_IRQ_MSYNC0 (NETX_IRQ_VIC_START + 21)
32#define NETX_IRQ_MSYNC1 (NETX_IRQ_VIC_START + 22)
33#define NETX_IRQ_MSYNC2 (NETX_IRQ_VIC_START + 23)
34#define NETX_IRQ_MSYNC3 (NETX_IRQ_VIC_START + 24)
35#define NETX_IRQ_IRQ_PHY (NETX_IRQ_VIC_START + 25)
36#define NETX_IRQ_ISO_AREA (NETX_IRQ_VIC_START + 26)
37/* int 27 is reserved */
38/* int 28 is reserved */
39#define NETX_IRQ_TIMER3 (NETX_IRQ_VIC_START + 29)
40#define NETX_IRQ_TIMER4 (NETX_IRQ_VIC_START + 30)
41/* int 31 is reserved */
42
43#define NETX_IRQS (NETX_IRQ_VIC_START + 32)
44
45/* for multiplexed irqs on gpio 0..14 */
46#define NETX_IRQ_GPIO(x) (NETX_IRQS + (x))
47#define NETX_IRQ_GPIO_LAST NETX_IRQ_GPIO(14)
48
49/* Host interface interrupts */
50#define NETX_IRQ_HIF_CHAINED(x) (NETX_IRQ_GPIO_LAST + 1 + (x))
51#define NETX_IRQ_HIF_PIO35 NETX_IRQ_HIF_CHAINED(0)
52#define NETX_IRQ_HIF_PIO36 NETX_IRQ_HIF_CHAINED(1)
53#define NETX_IRQ_HIF_PIO40 NETX_IRQ_HIF_CHAINED(2)
54#define NETX_IRQ_HIF_PIO47 NETX_IRQ_HIF_CHAINED(3)
55#define NETX_IRQ_HIF_PIO72 NETX_IRQ_HIF_CHAINED(4)
56#define NETX_IRQ_HIF_LAST NETX_IRQ_HIF_CHAINED(4)
57
58#define NR_IRQS (NETX_IRQ_HIF_LAST + 1)
diff --git a/arch/arm/mach-netx/include/mach/netx-regs.h b/arch/arm/mach-netx/include/mach/netx-regs.h
deleted file mode 100644
index 7c356a6ab80b..000000000000
--- a/arch/arm/mach-netx/include/mach/netx-regs.h
+++ /dev/null
@@ -1,420 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * arch/arm/mach-netx/include/mach/netx-regs.h
4 *
5 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 */
7
8#ifndef __ASM_ARCH_NETX_REGS_H
9#define __ASM_ARCH_NETX_REGS_H
10
11/* offsets relative to the beginning of the io space */
12#define NETX_OFS_SYSTEM 0x00000
13#define NETX_OFS_MEMCR 0x00100
14#define NETX_OFS_DPMAS 0x03000
15#define NETX_OFS_GPIO 0x00800
16#define NETX_OFS_PIO 0x00900
17#define NETX_OFS_UART0 0x00a00
18#define NETX_OFS_UART1 0x00a40
19#define NETX_OFS_UART2 0x00a80
20#define NETX_OF_MIIMU 0x00b00
21#define NETX_OFS_SPI 0x00c00
22#define NETX_OFS_I2C 0x00d00
23#define NETX_OFS_SYSTIME 0x01100
24#define NETX_OFS_RTC 0x01200
25#define NETX_OFS_EXTBUS 0x03600
26#define NETX_OFS_LCD 0x04000
27#define NETX_OFS_USB 0x20000
28#define NETX_OFS_XMAC0 0x60000
29#define NETX_OFS_XMAC1 0x61000
30#define NETX_OFS_XMAC2 0x62000
31#define NETX_OFS_XMAC3 0x63000
32#define NETX_OFS_XMAC(no) (0x60000 + (no) * 0x1000)
33#define NETX_OFS_PFIFO 0x64000
34#define NETX_OFS_XPEC0 0x70000
35#define NETX_OFS_XPEC1 0x74000
36#define NETX_OFS_XPEC2 0x78000
37#define NETX_OFS_XPEC3 0x7c000
38#define NETX_OFS_XPEC(no) (0x70000 + (no) * 0x4000)
39#define NETX_OFS_VIC 0xff000
40
41/* physical addresses */
42#define NETX_PA_SYSTEM (NETX_IO_PHYS + NETX_OFS_SYSTEM)
43#define NETX_PA_MEMCR (NETX_IO_PHYS + NETX_OFS_MEMCR)
44#define NETX_PA_DPMAS (NETX_IO_PHYS + NETX_OFS_DPMAS)
45#define NETX_PA_GPIO (NETX_IO_PHYS + NETX_OFS_GPIO)
46#define NETX_PA_PIO (NETX_IO_PHYS + NETX_OFS_PIO)
47#define NETX_PA_UART0 (NETX_IO_PHYS + NETX_OFS_UART0)
48#define NETX_PA_UART1 (NETX_IO_PHYS + NETX_OFS_UART1)
49#define NETX_PA_UART2 (NETX_IO_PHYS + NETX_OFS_UART2)
50#define NETX_PA_MIIMU (NETX_IO_PHYS + NETX_OF_MIIMU)
51#define NETX_PA_SPI (NETX_IO_PHYS + NETX_OFS_SPI)
52#define NETX_PA_I2C (NETX_IO_PHYS + NETX_OFS_I2C)
53#define NETX_PA_SYSTIME (NETX_IO_PHYS + NETX_OFS_SYSTIME)
54#define NETX_PA_RTC (NETX_IO_PHYS + NETX_OFS_RTC)
55#define NETX_PA_EXTBUS (NETX_IO_PHYS + NETX_OFS_EXTBUS)
56#define NETX_PA_LCD (NETX_IO_PHYS + NETX_OFS_LCD)
57#define NETX_PA_USB (NETX_IO_PHYS + NETX_OFS_USB)
58#define NETX_PA_XMAC0 (NETX_IO_PHYS + NETX_OFS_XMAC0)
59#define NETX_PA_XMAC1 (NETX_IO_PHYS + NETX_OFS_XMAC1)
60#define NETX_PA_XMAC2 (NETX_IO_PHYS + NETX_OFS_XMAC2)
61#define NETX_PA_XMAC3 (NETX_IO_PHYS + NETX_OFS_XMAC3)
62#define NETX_PA_XMAC(no) (NETX_IO_PHYS + NETX_OFS_XMAC(no))
63#define NETX_PA_PFIFO (NETX_IO_PHYS + NETX_OFS_PFIFO)
64#define NETX_PA_XPEC0 (NETX_IO_PHYS + NETX_OFS_XPEC0)
65#define NETX_PA_XPEC1 (NETX_IO_PHYS + NETX_OFS_XPEC1)
66#define NETX_PA_XPEC2 (NETX_IO_PHYS + NETX_OFS_XPEC2)
67#define NETX_PA_XPEC3 (NETX_IO_PHYS + NETX_OFS_XPEC3)
68#define NETX_PA_XPEC(no) (NETX_IO_PHYS + NETX_OFS_XPEC(no))
69#define NETX_PA_VIC (NETX_IO_PHYS + NETX_OFS_VIC)
70
71/* virtual addresses */
72#define NETX_VA_SYSTEM (NETX_IO_VIRT + NETX_OFS_SYSTEM)
73#define NETX_VA_MEMCR (NETX_IO_VIRT + NETX_OFS_MEMCR)
74#define NETX_VA_DPMAS (NETX_IO_VIRT + NETX_OFS_DPMAS)
75#define NETX_VA_GPIO (NETX_IO_VIRT + NETX_OFS_GPIO)
76#define NETX_VA_PIO (NETX_IO_VIRT + NETX_OFS_PIO)
77#define NETX_VA_UART0 (NETX_IO_VIRT + NETX_OFS_UART0)
78#define NETX_VA_UART1 (NETX_IO_VIRT + NETX_OFS_UART1)
79#define NETX_VA_UART2 (NETX_IO_VIRT + NETX_OFS_UART2)
80#define NETX_VA_MIIMU (NETX_IO_VIRT + NETX_OF_MIIMU)
81#define NETX_VA_SPI (NETX_IO_VIRT + NETX_OFS_SPI)
82#define NETX_VA_I2C (NETX_IO_VIRT + NETX_OFS_I2C)
83#define NETX_VA_SYSTIME (NETX_IO_VIRT + NETX_OFS_SYSTIME)
84#define NETX_VA_RTC (NETX_IO_VIRT + NETX_OFS_RTC)
85#define NETX_VA_EXTBUS (NETX_IO_VIRT + NETX_OFS_EXTBUS)
86#define NETX_VA_LCD (NETX_IO_VIRT + NETX_OFS_LCD)
87#define NETX_VA_USB (NETX_IO_VIRT + NETX_OFS_USB)
88#define NETX_VA_XMAC0 (NETX_IO_VIRT + NETX_OFS_XMAC0)
89#define NETX_VA_XMAC1 (NETX_IO_VIRT + NETX_OFS_XMAC1)
90#define NETX_VA_XMAC2 (NETX_IO_VIRT + NETX_OFS_XMAC2)
91#define NETX_VA_XMAC3 (NETX_IO_VIRT + NETX_OFS_XMAC3)
92#define NETX_VA_XMAC(no) (NETX_IO_VIRT + NETX_OFS_XMAC(no))
93#define NETX_VA_PFIFO (NETX_IO_VIRT + NETX_OFS_PFIFO)
94#define NETX_VA_XPEC0 (NETX_IO_VIRT + NETX_OFS_XPEC0)
95#define NETX_VA_XPEC1 (NETX_IO_VIRT + NETX_OFS_XPEC1)
96#define NETX_VA_XPEC2 (NETX_IO_VIRT + NETX_OFS_XPEC2)
97#define NETX_VA_XPEC3 (NETX_IO_VIRT + NETX_OFS_XPEC3)
98#define NETX_VA_XPEC(no) (NETX_IO_VIRT + NETX_OFS_XPEC(no))
99#define NETX_VA_VIC (NETX_IO_VIRT + NETX_OFS_VIC)
100
101/*********************************
102 * System functions *
103 *********************************/
104
105/* Registers */
106#define NETX_SYSTEM_REG(ofs) IOMEM(NETX_VA_SYSTEM + (ofs))
107#define NETX_SYSTEM_BOO_SR NETX_SYSTEM_REG(0x00)
108#define NETX_SYSTEM_IOC_CR NETX_SYSTEM_REG(0x04)
109#define NETX_SYSTEM_IOC_MR NETX_SYSTEM_REG(0x08)
110
111/* FIXME: Docs are not consistent */
112/* #define NETX_SYSTEM_RES_CR NETX_SYSTEM_REG(0x08) */
113#define NETX_SYSTEM_RES_CR NETX_SYSTEM_REG(0x0c)
114
115#define NETX_SYSTEM_PHY_CONTROL NETX_SYSTEM_REG(0x10)
116#define NETX_SYSTEM_REV NETX_SYSTEM_REG(0x34)
117#define NETX_SYSTEM_IOC_ACCESS_KEY NETX_SYSTEM_REG(0x70)
118#define NETX_SYSTEM_WDG_TR NETX_SYSTEM_REG(0x200)
119#define NETX_SYSTEM_WDG_CTR NETX_SYSTEM_REG(0x204)
120#define NETX_SYSTEM_WDG_IRQ_TIMEOUT NETX_SYSTEM_REG(0x208)
121#define NETX_SYSTEM_WDG_RES_TIMEOUT NETX_SYSTEM_REG(0x20c)
122
123/* Bits */
124#define NETX_SYSTEM_RES_CR_RSTIN (1<<0)
125#define NETX_SYSTEM_RES_CR_WDG_RES (1<<1)
126#define NETX_SYSTEM_RES_CR_HOST_RES (1<<2)
127#define NETX_SYSTEM_RES_CR_FIRMW_RES (1<<3)
128#define NETX_SYSTEM_RES_CR_XPEC0_RES (1<<4)
129#define NETX_SYSTEM_RES_CR_XPEC1_RES (1<<5)
130#define NETX_SYSTEM_RES_CR_XPEC2_RES (1<<6)
131#define NETX_SYSTEM_RES_CR_XPEC3_RES (1<<7)
132#define NETX_SYSTEM_RES_CR_DIS_XPEC0_RES (1<<16)
133#define NETX_SYSTEM_RES_CR_DIS_XPEC1_RES (1<<17)
134#define NETX_SYSTEM_RES_CR_DIS_XPEC2_RES (1<<18)
135#define NETX_SYSTEM_RES_CR_DIS_XPEC3_RES (1<<19)
136#define NETX_SYSTEM_RES_CR_FIRMW_FLG0 (1<<20)
137#define NETX_SYSTEM_RES_CR_FIRMW_FLG1 (1<<21)
138#define NETX_SYSTEM_RES_CR_FIRMW_FLG2 (1<<22)
139#define NETX_SYSTEM_RES_CR_FIRMW_FLG3 (1<<23)
140#define NETX_SYSTEM_RES_CR_FIRMW_RES_EN (1<<24)
141#define NETX_SYSTEM_RES_CR_RSTOUT (1<<25)
142#define NETX_SYSTEM_RES_CR_EN_RSTOUT (1<<26)
143
144#define PHY_CONTROL_RESET (1<<31)
145#define PHY_CONTROL_SIM_BYP (1<<30)
146#define PHY_CONTROL_CLK_XLATIN (1<<29)
147#define PHY_CONTROL_PHY1_EN (1<<21)
148#define PHY_CONTROL_PHY1_NP_MSG_CODE
149#define PHY_CONTROL_PHY1_AUTOMDIX (1<<17)
150#define PHY_CONTROL_PHY1_FIXMODE (1<<16)
151#define PHY_CONTROL_PHY1_MODE(mode) (((mode) & 0x7) << 13)
152#define PHY_CONTROL_PHY0_EN (1<<12)
153#define PHY_CONTROL_PHY0_NP_MSG_CODE
154#define PHY_CONTROL_PHY0_AUTOMDIX (1<<8)
155#define PHY_CONTROL_PHY0_FIXMODE (1<<7)
156#define PHY_CONTROL_PHY0_MODE(mode) (((mode) & 0x7) << 4)
157#define PHY_CONTROL_PHY_ADDRESS(adr) ((adr) & 0xf)
158
159#define PHY_MODE_10BASE_T_HALF 0
160#define PHY_MODE_10BASE_T_FULL 1
161#define PHY_MODE_100BASE_TX_FX_FULL 2
162#define PHY_MODE_100BASE_TX_FX_HALF 3
163#define PHY_MODE_100BASE_TX_HALF 4
164#define PHY_MODE_REPEATER 5
165#define PHY_MODE_POWER_DOWN 6
166#define PHY_MODE_ALL 7
167
168/* Bits */
169#define VECT_CNTL_ENABLE (1 << 5)
170
171/*******************************
172 * GPIO and timer module *
173 *******************************/
174
175/* Registers */
176#define NETX_GPIO_REG(ofs) IOMEM(NETX_VA_GPIO + (ofs))
177#define NETX_GPIO_CFG(gpio) NETX_GPIO_REG(0x0 + ((gpio)<<2))
178#define NETX_GPIO_THRESHOLD_CAPTURE(gpio) NETX_GPIO_REG(0x40 + ((gpio)<<2))
179#define NETX_GPIO_COUNTER_CTRL(counter) NETX_GPIO_REG(0x80 + ((counter)<<2))
180#define NETX_GPIO_COUNTER_MAX(counter) NETX_GPIO_REG(0x94 + ((counter)<<2))
181#define NETX_GPIO_COUNTER_CURRENT(counter) NETX_GPIO_REG(0xa8 + ((counter)<<2))
182#define NETX_GPIO_IRQ_ENABLE NETX_GPIO_REG(0xbc)
183#define NETX_GPIO_IRQ_DISABLE NETX_GPIO_REG(0xc0)
184#define NETX_GPIO_SYSTIME_NS_CMP NETX_GPIO_REG(0xc4)
185#define NETX_GPIO_LINE NETX_GPIO_REG(0xc8)
186#define NETX_GPIO_IRQ NETX_GPIO_REG(0xd0)
187
188/* Bits */
189#define NETX_GPIO_CFG_IOCFG_GP_INPUT (0x0)
190#define NETX_GPIO_CFG_IOCFG_GP_OUTPUT (0x1)
191#define NETX_GPIO_CFG_IOCFG_GP_UART (0x2)
192#define NETX_GPIO_CFG_INV (1<<2)
193#define NETX_GPIO_CFG_MODE_INPUT_READ (0<<3)
194#define NETX_GPIO_CFG_MODE_INPUT_CAPTURE_CONT_RISING (1<<3)
195#define NETX_GPIO_CFG_MODE_INPUT_CAPTURE_ONCE_RISING (2<<3)
196#define NETX_GPIO_CFG_MODE_INPUT_CAPTURE_HIGH_LEVEL (3<<3)
197#define NETX_GPIO_CFG_COUNT_REF_COUNTER0 (0<<5)
198#define NETX_GPIO_CFG_COUNT_REF_COUNTER1 (1<<5)
199#define NETX_GPIO_CFG_COUNT_REF_COUNTER2 (2<<5)
200#define NETX_GPIO_CFG_COUNT_REF_COUNTER3 (3<<5)
201#define NETX_GPIO_CFG_COUNT_REF_COUNTER4 (4<<5)
202#define NETX_GPIO_CFG_COUNT_REF_SYSTIME (7<<5)
203
204#define NETX_GPIO_COUNTER_CTRL_RUN (1<<0)
205#define NETX_GPIO_COUNTER_CTRL_SYM (1<<1)
206#define NETX_GPIO_COUNTER_CTRL_ONCE (1<<2)
207#define NETX_GPIO_COUNTER_CTRL_IRQ_EN (1<<3)
208#define NETX_GPIO_COUNTER_CTRL_CNT_EVENT (1<<4)
209#define NETX_GPIO_COUNTER_CTRL_RST_EN (1<<5)
210#define NETX_GPIO_COUNTER_CTRL_SEL_EVENT (1<<6)
211#define NETX_GPIO_COUNTER_CTRL_GPIO_REF /* FIXME */
212
213#define GPIO_BIT(gpio) (1<<(gpio))
214#define COUNTER_BIT(counter) ((1<<16)<<(counter))
215
216/*******************************
217 * PIO *
218 *******************************/
219
220/* Registers */
221#define NETX_PIO_REG(ofs) IOMEM(NETX_VA_PIO + (ofs))
222#define NETX_PIO_INPIO NETX_PIO_REG(0x0)
223#define NETX_PIO_OUTPIO NETX_PIO_REG(0x4)
224#define NETX_PIO_OEPIO NETX_PIO_REG(0x8)
225
226/*******************************
227 * MII Unit *
228 *******************************/
229
230/* Registers */
231#define NETX_MIIMU IOMEM(NETX_VA_MIIMU)
232
233/* Bits */
234#define MIIMU_SNRDY (1<<0)
235#define MIIMU_PREAMBLE (1<<1)
236#define MIIMU_OPMODE_WRITE (1<<2)
237#define MIIMU_MDC_PERIOD (1<<3)
238#define MIIMU_PHY_NRES (1<<4)
239#define MIIMU_RTA (1<<5)
240#define MIIMU_REGADDR(adr) (((adr) & 0x1f) << 6)
241#define MIIMU_PHYADDR(adr) (((adr) & 0x1f) << 11)
242#define MIIMU_DATA(data) (((data) & 0xffff) << 16)
243
244/*******************************
245 * xmac / xpec *
246 *******************************/
247
248/* XPEC register offsets relative to NETX_VA_XPEC(no) */
249#define NETX_XPEC_R0_OFS 0x00
250#define NETX_XPEC_R1_OFS 0x04
251#define NETX_XPEC_R2_OFS 0x08
252#define NETX_XPEC_R3_OFS 0x0c
253#define NETX_XPEC_R4_OFS 0x10
254#define NETX_XPEC_R5_OFS 0x14
255#define NETX_XPEC_R6_OFS 0x18
256#define NETX_XPEC_R7_OFS 0x1c
257#define NETX_XPEC_RANGE01_OFS 0x20
258#define NETX_XPEC_RANGE23_OFS 0x24
259#define NETX_XPEC_RANGE45_OFS 0x28
260#define NETX_XPEC_RANGE67_OFS 0x2c
261#define NETX_XPEC_PC_OFS 0x48
262#define NETX_XPEC_TIMER_OFS(timer) (0x30 + ((timer)<<2))
263#define NETX_XPEC_IRQ_OFS 0x8c
264#define NETX_XPEC_SYSTIME_NS_OFS 0x90
265#define NETX_XPEC_FIFO_DATA_OFS 0x94
266#define NETX_XPEC_SYSTIME_S_OFS 0x98
267#define NETX_XPEC_ADC_OFS 0x9c
268#define NETX_XPEC_URX_COUNT_OFS 0x40
269#define NETX_XPEC_UTX_COUNT_OFS 0x44
270#define NETX_XPEC_PC_OFS 0x48
271#define NETX_XPEC_ZERO_OFS 0x4c
272#define NETX_XPEC_STATCFG_OFS 0x50
273#define NETX_XPEC_EC_MASKA_OFS 0x54
274#define NETX_XPEC_EC_MASKB_OFS 0x58
275#define NETX_XPEC_EC_MASK0_OFS 0x5c
276#define NETX_XPEC_EC_MASK8_OFS 0x7c
277#define NETX_XPEC_EC_MASK9_OFS 0x80
278#define NETX_XPEC_XPU_HOLD_PC_OFS 0x100
279#define NETX_XPEC_RAM_START_OFS 0x2000
280
281/* Bits */
282#define XPU_HOLD_PC (1<<0)
283
284/* XMAC register offsets relative to NETX_VA_XMAC(no) */
285#define NETX_XMAC_RPU_PROGRAM_START_OFS 0x000
286#define NETX_XMAC_RPU_PROGRAM_END_OFS 0x3ff
287#define NETX_XMAC_TPU_PROGRAM_START_OFS 0x400
288#define NETX_XMAC_TPU_PROGRAM_END_OFS 0x7ff
289#define NETX_XMAC_RPU_HOLD_PC_OFS 0xa00
290#define NETX_XMAC_TPU_HOLD_PC_OFS 0xa04
291#define NETX_XMAC_STATUS_SHARED0_OFS 0x840
292#define NETX_XMAC_CONFIG_SHARED0_OFS 0x844
293#define NETX_XMAC_STATUS_SHARED1_OFS 0x848
294#define NETX_XMAC_CONFIG_SHARED1_OFS 0x84c
295#define NETX_XMAC_STATUS_SHARED2_OFS 0x850
296#define NETX_XMAC_CONFIG_SHARED2_OFS 0x854
297#define NETX_XMAC_STATUS_SHARED3_OFS 0x858
298#define NETX_XMAC_CONFIG_SHARED3_OFS 0x85c
299
300#define RPU_HOLD_PC (1<<15)
301#define TPU_HOLD_PC (1<<15)
302
303/*******************************
304 * Pointer FIFO *
305 *******************************/
306
307/* Registers */
308#define NETX_PFIFO_REG(ofs) IOMEM(NETX_VA_PFIFO + (ofs))
309#define NETX_PFIFO_BASE(pfifo) NETX_PFIFO_REG(0x00 + ((pfifo)<<2))
310#define NETX_PFIFO_BORDER_BASE(pfifo) NETX_PFIFO_REG(0x80 + ((pfifo)<<2))
311#define NETX_PFIFO_RESET NETX_PFIFO_REG(0x100)
312#define NETX_PFIFO_FULL NETX_PFIFO_REG(0x104)
313#define NETX_PFIFO_EMPTY NETX_PFIFO_REG(0x108)
314#define NETX_PFIFO_OVEFLOW NETX_PFIFO_REG(0x10c)
315#define NETX_PFIFO_UNDERRUN NETX_PFIFO_REG(0x110)
316#define NETX_PFIFO_FILL_LEVEL(pfifo) NETX_PFIFO_REG(0x180 + ((pfifo)<<2))
317#define NETX_PFIFO_XPEC_ISR(xpec) NETX_PFIFO_REG(0x400 + ((xpec) << 2))
318
319
320/*******************************
321 * Memory Controller *
322 *******************************/
323
324/* Registers */
325#define NETX_MEMCR_REG(ofs) IOMEM(NETX_VA_MEMCR + (ofs))
326#define NETX_MEMCR_SRAM_CTRL(cs) NETX_MEMCR_REG(0x0 + 4 * (cs)) /* SRAM for CS 0..2 */
327#define NETX_MEMCR_SDRAM_CFG_CTRL NETX_MEMCR_REG(0x40)
328#define NETX_MEMCR_SDRAM_TIMING_CTRL NETX_MEMCR_REG(0x44)
329#define NETX_MEMCR_SDRAM_MODE NETX_MEMCR_REG(0x48)
330#define NETX_MEMCR_SDRAM_EXT_MODE NETX_MEMCR_REG(0x4c)
331#define NETX_MEMCR_PRIO_TIMESLOT_CTRL NETX_MEMCR_REG(0x80)
332#define NETX_MEMCR_PRIO_ACCESS_CTRL NETX_MEMCR_REG(0x84)
333
334/* Bits */
335#define NETX_MEMCR_SRAM_CTRL_WIDTHEXTMEM(x) (((x) & 0x3) << 24)
336#define NETX_MEMCR_SRAM_CTRL_WSPOSTPAUSEEXTMEM(x) (((x) & 0x3) << 16)
337#define NETX_MEMCR_SRAM_CTRL_WSPREPASEEXTMEM(x) (((x) & 0x3) << 8)
338#define NETX_MEMCR_SRAM_CTRL_WSEXTMEM(x) (((x) & 0x1f) << 0)
339
340
341/*******************************
342 * Dual Port Memory *
343 *******************************/
344
345/* Registers */
346#define NETX_DPMAS_REG(ofs) IOMEM(NETX_VA_DPMAS + (ofs))
347#define NETX_DPMAS_SYS_STAT NETX_DPMAS_REG(0x4d8)
348#define NETX_DPMAS_INT_STAT NETX_DPMAS_REG(0x4e0)
349#define NETX_DPMAS_INT_EN NETX_DPMAS_REG(0x4f0)
350#define NETX_DPMAS_IF_CONF0 NETX_DPMAS_REG(0x608)
351#define NETX_DPMAS_IF_CONF1 NETX_DPMAS_REG(0x60c)
352#define NETX_DPMAS_EXT_CONFIG(cs) NETX_DPMAS_REG(0x610 + 4 * (cs))
353#define NETX_DPMAS_IO_MODE0 NETX_DPMAS_REG(0x620) /* I/O 32..63 */
354#define NETX_DPMAS_DRV_EN0 NETX_DPMAS_REG(0x624)
355#define NETX_DPMAS_DATA0 NETX_DPMAS_REG(0x628)
356#define NETX_DPMAS_IO_MODE1 NETX_DPMAS_REG(0x630) /* I/O 64..84 */
357#define NETX_DPMAS_DRV_EN1 NETX_DPMAS_REG(0x634)
358#define NETX_DPMAS_DATA1 NETX_DPMAS_REG(0x638)
359
360/* Bits */
361#define NETX_DPMAS_INT_EN_GLB_EN (1<<31)
362#define NETX_DPMAS_INT_EN_MEM_LCK (1<<30)
363#define NETX_DPMAS_INT_EN_WDG (1<<29)
364#define NETX_DPMAS_INT_EN_PIO72 (1<<28)
365#define NETX_DPMAS_INT_EN_PIO47 (1<<27)
366#define NETX_DPMAS_INT_EN_PIO40 (1<<26)
367#define NETX_DPMAS_INT_EN_PIO36 (1<<25)
368#define NETX_DPMAS_INT_EN_PIO35 (1<<24)
369
370#define NETX_DPMAS_IF_CONF0_HIF_DISABLED (0<<28)
371#define NETX_DPMAS_IF_CONF0_HIF_EXT_BUS (1<<28)
372#define NETX_DPMAS_IF_CONF0_HIF_UP_8BIT (2<<28)
373#define NETX_DPMAS_IF_CONF0_HIF_UP_16BIT (3<<28)
374#define NETX_DPMAS_IF_CONF0_HIF_IO (4<<28)
375#define NETX_DPMAS_IF_CONF0_WAIT_DRV_PP (1<<14)
376#define NETX_DPMAS_IF_CONF0_WAIT_DRV_OD (2<<14)
377#define NETX_DPMAS_IF_CONF0_WAIT_DRV_TRI (3<<14)
378
379#define NETX_DPMAS_IF_CONF1_IRQ_POL_PIO35 (1<<26)
380#define NETX_DPMAS_IF_CONF1_IRQ_POL_PIO36 (1<<27)
381#define NETX_DPMAS_IF_CONF1_IRQ_POL_PIO40 (1<<28)
382#define NETX_DPMAS_IF_CONF1_IRQ_POL_PIO47 (1<<29)
383#define NETX_DPMAS_IF_CONF1_IRQ_POL_PIO72 (1<<30)
384
385#define NETX_EXT_CONFIG_TALEWIDTH(x) (((x) & 0x7) << 29)
386#define NETX_EXT_CONFIG_TADRHOLD(x) (((x) & 0x7) << 26)
387#define NETX_EXT_CONFIG_TCSON(x) (((x) & 0x7) << 23)
388#define NETX_EXT_CONFIG_TRDON(x) (((x) & 0x7) << 20)
389#define NETX_EXT_CONFIG_TWRON(x) (((x) & 0x7) << 17)
390#define NETX_EXT_CONFIG_TWROFF(x) (((x) & 0x1f) << 12)
391#define NETX_EXT_CONFIG_TRDWRCYC(x) (((x) & 0x1f) << 7)
392#define NETX_EXT_CONFIG_WAIT_POL (1<<6)
393#define NETX_EXT_CONFIG_WAIT_EN (1<<5)
394#define NETX_EXT_CONFIG_NRD_MODE (1<<4)
395#define NETX_EXT_CONFIG_DS_MODE (1<<3)
396#define NETX_EXT_CONFIG_NWR_MODE (1<<2)
397#define NETX_EXT_CONFIG_16BIT (1<<1)
398#define NETX_EXT_CONFIG_CS_ENABLE (1<<0)
399
400#define NETX_DPMAS_IO_MODE0_WRL (1<<13)
401#define NETX_DPMAS_IO_MODE0_WAIT (1<<14)
402#define NETX_DPMAS_IO_MODE0_READY (1<<15)
403#define NETX_DPMAS_IO_MODE0_CS0 (1<<19)
404#define NETX_DPMAS_IO_MODE0_EXTRD (1<<20)
405
406#define NETX_DPMAS_IO_MODE1_CS2 (1<<15)
407#define NETX_DPMAS_IO_MODE1_CS1 (1<<16)
408#define NETX_DPMAS_IO_MODE1_SAMPLE_NPOR (0<<30)
409#define NETX_DPMAS_IO_MODE1_SAMPLE_100MHZ (1<<30)
410#define NETX_DPMAS_IO_MODE1_SAMPLE_NPIO36 (2<<30)
411#define NETX_DPMAS_IO_MODE1_SAMPLE_PIO36 (3<<30)
412
413/*******************************
414 * I2C *
415 *******************************/
416#define NETX_I2C_REG(ofs) IOMEM(NETX_VA_I2C, (ofs))
417#define NETX_I2C_CTRL NETX_I2C_REG(0x0)
418#define NETX_I2C_DATA NETX_I2C_REG(0x4)
419
420#endif /* __ASM_ARCH_NETX_REGS_H */
diff --git a/arch/arm/mach-netx/include/mach/pfifo.h b/arch/arm/mach-netx/include/mach/pfifo.h
deleted file mode 100644
index de23180bc937..000000000000
--- a/arch/arm/mach-netx/include/mach/pfifo.h
+++ /dev/null
@@ -1,42 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * arch/arm/mach-netx/include/mach/pfifo.h
4 *
5 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 */
7
8
9#ifndef ASM_ARCH_PFIFO_H
10#define ASM_ARCH_PFIFO_H
11
12static inline int pfifo_push(int no, unsigned int pointer)
13{
14 writel(pointer, NETX_PFIFO_BASE(no));
15 return 0;
16}
17
18static inline unsigned int pfifo_pop(int no)
19{
20 return readl(NETX_PFIFO_BASE(no));
21}
22
23static inline int pfifo_fill_level(int no)
24{
25
26 return readl(NETX_PFIFO_FILL_LEVEL(no));
27}
28
29static inline int pfifo_full(int no)
30{
31 return readl(NETX_PFIFO_FULL) & (1<<no) ? 1 : 0;
32}
33
34static inline int pfifo_empty(int no)
35{
36 return readl(NETX_PFIFO_EMPTY) & (1<<no) ? 1 : 0;
37}
38
39int pfifo_request(unsigned int pfifo_mask);
40void pfifo_free(unsigned int pfifo_mask);
41
42#endif /* ASM_ARCH_PFIFO_H */
diff --git a/arch/arm/mach-netx/include/mach/uncompress.h b/arch/arm/mach-netx/include/mach/uncompress.h
deleted file mode 100644
index edc1ac997eab..000000000000
--- a/arch/arm/mach-netx/include/mach/uncompress.h
+++ /dev/null
@@ -1,63 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * arch/arm/mach-netx/include/mach/uncompress.h
4 *
5 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 */
7
8/*
9 * The following code assumes the serial port has already been
10 * initialized by the bootloader. We search for the first enabled
11 * port in the most probable order. If you didn't setup a port in
12 * your bootloader then nothing will appear (which might be desired).
13 *
14 * This does not append a newline
15 */
16
17#define REG(x) (*(volatile unsigned long *)(x))
18
19#define UART1_BASE 0x100a00
20#define UART2_BASE 0x100a80
21
22#define UART_DR 0x0
23
24#define UART_CR 0x14
25#define CR_UART_EN (1<<0)
26
27#define UART_FR 0x18
28#define FR_BUSY (1<<3)
29#define FR_TXFF (1<<5)
30
31static inline void putc(char c)
32{
33 unsigned long base;
34
35 if (REG(UART1_BASE + UART_CR) & CR_UART_EN)
36 base = UART1_BASE;
37 else if (REG(UART2_BASE + UART_CR) & CR_UART_EN)
38 base = UART2_BASE;
39 else
40 return;
41
42 while (REG(base + UART_FR) & FR_TXFF);
43 REG(base + UART_DR) = c;
44}
45
46static inline void flush(void)
47{
48 unsigned long base;
49
50 if (REG(UART1_BASE + UART_CR) & CR_UART_EN)
51 base = UART1_BASE;
52 else if (REG(UART2_BASE + UART_CR) & CR_UART_EN)
53 base = UART2_BASE;
54 else
55 return;
56
57 while (REG(base + UART_FR) & FR_BUSY);
58}
59
60/*
61 * nothing to do
62 */
63#define arch_decomp_setup()
diff --git a/arch/arm/mach-netx/include/mach/xc.h b/arch/arm/mach-netx/include/mach/xc.h
deleted file mode 100644
index 465d5e250ab8..000000000000
--- a/arch/arm/mach-netx/include/mach/xc.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * arch/arm/mach-netx/include/mach/xc.h
4 *
5 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 */
7
8#ifndef __ASM_ARCH_XC_H
9#define __ASM_ARCH_XC_H
10
11struct xc {
12 int no;
13 unsigned int type;
14 unsigned int version;
15 void __iomem *xpec_base;
16 void __iomem *xmac_base;
17 void __iomem *sram_base;
18 int irq;
19 struct device *dev;
20};
21
22int xc_reset(struct xc *x);
23int xc_stop(struct xc* x);
24int xc_start(struct xc *x);
25int xc_running(struct xc *x);
26int xc_request_firmware(struct xc* x);
27struct xc* request_xc(int xcno, struct device *dev);
28void free_xc(struct xc *x);
29
30#endif /* __ASM_ARCH_XC_H */
diff --git a/arch/arm/mach-netx/nxdb500.c b/arch/arm/mach-netx/nxdb500.c
deleted file mode 100644
index ad5e6747b834..000000000000
--- a/arch/arm/mach-netx/nxdb500.c
+++ /dev/null
@@ -1,197 +0,0 @@
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * arch/arm/mach-netx/nxdb500.c
4 *
5 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 */
7
8#include <linux/dma-mapping.h>
9#include <linux/init.h>
10#include <linux/interrupt.h>
11#include <linux/mtd/plat-ram.h>
12#include <linux/platform_device.h>
13#include <linux/amba/bus.h>
14#include <linux/amba/clcd.h>
15
16#include <mach/hardware.h>
17#include <asm/mach-types.h>
18#include <asm/mach/arch.h>
19#include <mach/netx-regs.h>
20#include <linux/platform_data/eth-netx.h>
21
22#include "generic.h"
23#include "fb.h"
24
25static struct clcd_panel qvga = {
26 .mode = {
27 .name = "QVGA",
28 .refresh = 60,
29 .xres = 240,
30 .yres = 320,
31 .pixclock = 187617,
32 .left_margin = 6,
33 .right_margin = 26,
34 .upper_margin = 0,
35 .lower_margin = 6,
36 .hsync_len = 6,
37 .vsync_len = 1,
38 .sync = 0,
39 .vmode = FB_VMODE_NONINTERLACED,
40 },
41 .width = -1,
42 .height = -1,
43 .tim2 = 16,
44 .cntl = CNTL_LCDTFT | CNTL_BGR,
45 .bpp = 16,
46 .grayscale = 0,
47};
48
49static inline int nxdb500_check(struct clcd_fb *fb, struct fb_var_screeninfo *var)
50{
51 var->green.length = 5;
52 var->green.msb_right = 0;
53
54 return clcdfb_check(fb, var);
55}
56
57static int nxdb500_clcd_setup(struct clcd_fb *fb)
58{
59 unsigned int val;
60
61 fb->fb.var.green.length = 5;
62 fb->fb.var.green.msb_right = 0;
63
64 /* enable asic control */
65 val = readl(NETX_SYSTEM_IOC_ACCESS_KEY);
66 writel(val, NETX_SYSTEM_IOC_ACCESS_KEY);
67
68 writel(3, NETX_SYSTEM_IOC_CR);
69
70 val = readl(NETX_PIO_OUTPIO);
71 writel(val | 1, NETX_PIO_OUTPIO);
72
73 val = readl(NETX_PIO_OEPIO);
74 writel(val | 1, NETX_PIO_OEPIO);
75 return netx_clcd_setup(fb);
76}
77
78static struct clcd_board clcd_data = {
79 .name = "netX",
80 .check = nxdb500_check,
81 .decode = clcdfb_decode,
82 .enable = netx_clcd_enable,
83 .setup = nxdb500_clcd_setup,
84 .mmap = netx_clcd_mmap,
85 .remove = netx_clcd_remove,
86};
87
88static struct netxeth_platform_data eth0_platform_data = {
89 .xcno = 0,
90};
91
92static struct platform_device netx_eth0_device = {
93 .name = "netx-eth",
94 .id = 0,
95 .num_resources = 0,
96 .resource = NULL,
97 .dev = {
98 .platform_data = &eth0_platform_data,
99 }
100};
101
102static struct netxeth_platform_data eth1_platform_data = {
103 .xcno = 1,
104};
105
106static struct platform_device netx_eth1_device = {
107 .name = "netx-eth",
108 .id = 1,
109 .num_resources = 0,
110 .resource = NULL,
111 .dev = {
112 .platform_data = &eth1_platform_data,
113 }
114};
115
116static struct resource netx_uart0_resources[] = {
117 [0] = {
118 .start = 0x00100A00,
119 .end = 0x00100A3F,
120 .flags = IORESOURCE_MEM,
121 },
122 [1] = {
123 .start = (NETX_IRQ_UART0),
124 .end = (NETX_IRQ_UART0),
125 .flags = IORESOURCE_IRQ,
126 },
127};
128
129static struct platform_device netx_uart0_device = {
130 .name = "netx-uart",
131 .id = 0,
132 .num_resources = ARRAY_SIZE(netx_uart0_resources),
133 .resource = netx_uart0_resources,
134};
135
136static struct resource netx_uart1_resources[] = {
137 [0] = {
138 .start = 0x00100A40,
139 .end = 0x00100A7F,
140 .flags = IORESOURCE_MEM,
141 },
142 [1] = {
143 .start = (NETX_IRQ_UART1),
144 .end = (NETX_IRQ_UART1),
145 .flags = IORESOURCE_IRQ,
146 },
147};
148
149static struct platform_device netx_uart1_device = {
150 .name = "netx-uart",
151 .id = 1,
152 .num_resources = ARRAY_SIZE(netx_uart1_resources),
153 .resource = netx_uart1_resources,
154};
155
156static struct resource netx_uart2_resources[] = {
157 [0] = {
158 .start = 0x00100A80,
159 .end = 0x00100ABF,
160 .flags = IORESOURCE_MEM,
161 },
162 [1] = {
163 .start = (NETX_IRQ_UART2),
164 .end = (NETX_IRQ_UART2),
165 .flags = IORESOURCE_IRQ,
166 },
167};
168
169static struct platform_device netx_uart2_device = {
170 .name = "netx-uart",
171 .id = 2,
172 .num_resources = ARRAY_SIZE(netx_uart2_resources),
173 .resource = netx_uart2_resources,
174};
175
176static struct platform_device *devices[] __initdata = {
177 &netx_eth0_device,
178 &netx_eth1_device,
179 &netx_uart0_device,
180 &netx_uart1_device,
181 &netx_uart2_device,
182};
183
184static void __init nxdb500_init(void)
185{
186 netx_fb_init(&clcd_data, &qvga);
187 platform_add_devices(devices, ARRAY_SIZE(devices));
188}
189
190MACHINE_START(NXDB500, "Hilscher nxdb500")
191 .atag_offset = 0x100,
192 .map_io = netx_map_io,
193 .init_irq = netx_init_irq,
194 .init_time = netx_timer_init,
195 .init_machine = nxdb500_init,
196 .restart = netx_restart,
197MACHINE_END
diff --git a/arch/arm/mach-netx/nxdkn.c b/arch/arm/mach-netx/nxdkn.c
deleted file mode 100644
index 917381559628..000000000000
--- a/arch/arm/mach-netx/nxdkn.c
+++ /dev/null
@@ -1,90 +0,0 @@
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * arch/arm/mach-netx/nxdkn.c
4 *
5 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 */
7
8#include <linux/dma-mapping.h>
9#include <linux/init.h>
10#include <linux/interrupt.h>
11#include <linux/mtd/plat-ram.h>
12#include <linux/platform_device.h>
13#include <linux/amba/bus.h>
14#include <linux/amba/clcd.h>
15
16#include <mach/hardware.h>
17#include <asm/mach-types.h>
18#include <asm/mach/arch.h>
19#include <mach/netx-regs.h>
20#include <linux/platform_data/eth-netx.h>
21
22#include "generic.h"
23
24static struct netxeth_platform_data eth0_platform_data = {
25 .xcno = 0,
26};
27
28static struct platform_device nxdkn_eth0_device = {
29 .name = "netx-eth",
30 .id = 0,
31 .num_resources = 0,
32 .resource = NULL,
33 .dev = {
34 .platform_data = &eth0_platform_data,
35 }
36};
37
38static struct netxeth_platform_data eth1_platform_data = {
39 .xcno = 1,
40};
41
42static struct platform_device nxdkn_eth1_device = {
43 .name = "netx-eth",
44 .id = 1,
45 .num_resources = 0,
46 .resource = NULL,
47 .dev = {
48 .platform_data = &eth1_platform_data,
49 }
50};
51
52static struct resource netx_uart0_resources[] = {
53 [0] = {
54 .start = 0x00100A00,
55 .end = 0x00100A3F,
56 .flags = IORESOURCE_MEM,
57 },
58 [1] = {
59 .start = (NETX_IRQ_UART0),
60 .end = (NETX_IRQ_UART0),
61 .flags = IORESOURCE_IRQ,
62 },
63};
64
65static struct platform_device netx_uart0_device = {
66 .name = "netx-uart",
67 .id = 0,
68 .num_resources = ARRAY_SIZE(netx_uart0_resources),
69 .resource = netx_uart0_resources,
70};
71
72static struct platform_device *devices[] __initdata = {
73 &nxdkn_eth0_device,
74 &nxdkn_eth1_device,
75 &netx_uart0_device,
76};
77
78static void __init nxdkn_init(void)
79{
80 platform_add_devices(devices, ARRAY_SIZE(devices));
81}
82
83MACHINE_START(NXDKN, "Hilscher nxdkn")
84 .atag_offset = 0x100,
85 .map_io = netx_map_io,
86 .init_irq = netx_init_irq,
87 .init_time = netx_timer_init,
88 .init_machine = nxdkn_init,
89 .restart = netx_restart,
90MACHINE_END
diff --git a/arch/arm/mach-netx/nxeb500hmi.c b/arch/arm/mach-netx/nxeb500hmi.c
deleted file mode 100644
index aa0d5b2ca712..000000000000
--- a/arch/arm/mach-netx/nxeb500hmi.c
+++ /dev/null
@@ -1,174 +0,0 @@
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * arch/arm/mach-netx/nxeb500hmi.c
4 *
5 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 */
7
8#include <linux/dma-mapping.h>
9#include <linux/init.h>
10#include <linux/interrupt.h>
11#include <linux/mtd/plat-ram.h>
12#include <linux/platform_device.h>
13#include <linux/amba/bus.h>
14#include <linux/amba/clcd.h>
15
16#include <mach/hardware.h>
17#include <asm/mach-types.h>
18#include <asm/mach/arch.h>
19#include <mach/netx-regs.h>
20#include <linux/platform_data/eth-netx.h>
21
22#include "generic.h"
23#include "fb.h"
24
25static struct clcd_panel qvga = {
26 .mode = {
27 .name = "QVGA",
28 .refresh = 60,
29 .xres = 240,
30 .yres = 320,
31 .pixclock = 187617,
32 .left_margin = 6,
33 .right_margin = 26,
34 .upper_margin = 0,
35 .lower_margin = 6,
36 .hsync_len = 6,
37 .vsync_len = 1,
38 .sync = 0,
39 .vmode = FB_VMODE_NONINTERLACED,
40 },
41 .width = -1,
42 .height = -1,
43 .tim2 = 16,
44 .cntl = CNTL_LCDTFT | CNTL_BGR,
45 .bpp = 16,
46 .grayscale = 0,
47};
48
49static inline int nxeb500hmi_check(struct clcd_fb *fb, struct fb_var_screeninfo *var)
50{
51 var->green.length = 5;
52 var->green.msb_right = 0;
53
54 return clcdfb_check(fb, var);
55}
56
57static int nxeb500hmi_clcd_setup(struct clcd_fb *fb)
58{
59 unsigned int val;
60
61 fb->fb.var.green.length = 5;
62 fb->fb.var.green.msb_right = 0;
63
64 /* enable asic control */
65 val = readl(NETX_SYSTEM_IOC_ACCESS_KEY);
66 writel(val, NETX_SYSTEM_IOC_ACCESS_KEY);
67
68 writel(3, NETX_SYSTEM_IOC_CR);
69
70 /* GPIO 14 is used for display enable on newer boards */
71 writel(9, NETX_GPIO_CFG(14));
72
73 val = readl(NETX_PIO_OUTPIO);
74 writel(val | 1, NETX_PIO_OUTPIO);
75
76 val = readl(NETX_PIO_OEPIO);
77 writel(val | 1, NETX_PIO_OEPIO);
78 return netx_clcd_setup(fb);
79}
80
81static struct clcd_board clcd_data = {
82 .name = "netX",
83 .check = nxeb500hmi_check,
84 .decode = clcdfb_decode,
85 .enable = netx_clcd_enable,
86 .setup = nxeb500hmi_clcd_setup,
87 .mmap = netx_clcd_mmap,
88 .remove = netx_clcd_remove,
89};
90
91static struct netxeth_platform_data eth0_platform_data = {
92 .xcno = 0,
93};
94
95static struct platform_device netx_eth0_device = {
96 .name = "netx-eth",
97 .id = 0,
98 .num_resources = 0,
99 .resource = NULL,
100 .dev = {
101 .platform_data = &eth0_platform_data,
102 }
103};
104
105static struct netxeth_platform_data eth1_platform_data = {
106 .xcno = 1,
107};
108
109static struct platform_device netx_eth1_device = {
110 .name = "netx-eth",
111 .id = 1,
112 .num_resources = 0,
113 .resource = NULL,
114 .dev = {
115 .platform_data = &eth1_platform_data,
116 }
117};
118
119static struct resource netx_cf_resources[] = {
120 [0] = {
121 .start = 0x20000000,
122 .end = 0x25ffffff,
123 .flags = IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT,
124 },
125};
126
127static struct platform_device netx_cf_device = {
128 .name = "netx-cf",
129 .id = 0,
130 .resource = netx_cf_resources,
131 .num_resources = ARRAY_SIZE(netx_cf_resources),
132};
133
134static struct resource netx_uart0_resources[] = {
135 [0] = {
136 .start = 0x00100A00,
137 .end = 0x00100A3F,
138 .flags = IORESOURCE_MEM,
139 },
140 [1] = {
141 .start = (NETX_IRQ_UART0),
142 .end = (NETX_IRQ_UART0),
143 .flags = IORESOURCE_IRQ,
144 },
145};
146
147static struct platform_device netx_uart0_device = {
148 .name = "netx-uart",
149 .id = 0,
150 .num_resources = ARRAY_SIZE(netx_uart0_resources),
151 .resource = netx_uart0_resources,
152};
153
154static struct platform_device *devices[] __initdata = {
155 &netx_eth0_device,
156 &netx_eth1_device,
157 &netx_cf_device,
158 &netx_uart0_device,
159};
160
161static void __init nxeb500hmi_init(void)
162{
163 netx_fb_init(&clcd_data, &qvga);
164 platform_add_devices(devices, ARRAY_SIZE(devices));
165}
166
167MACHINE_START(NXEB500HMI, "Hilscher nxeb500hmi")
168 .atag_offset = 0x100,
169 .map_io = netx_map_io,
170 .init_irq = netx_init_irq,
171 .init_time = netx_timer_init,
172 .init_machine = nxeb500hmi_init,
173 .restart = netx_restart,
174MACHINE_END
diff --git a/arch/arm/mach-netx/pfifo.c b/arch/arm/mach-netx/pfifo.c
deleted file mode 100644
index 2e5cc777329f..000000000000
--- a/arch/arm/mach-netx/pfifo.c
+++ /dev/null
@@ -1,56 +0,0 @@
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * arch/arm/mach-netx/pfifo.c
4 *
5 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 */
7
8#include <linux/init.h>
9#include <linux/module.h>
10#include <linux/mutex.h>
11#include <linux/io.h>
12
13#include <mach/hardware.h>
14#include <mach/netx-regs.h>
15#include <mach/pfifo.h>
16
17static DEFINE_MUTEX(pfifo_lock);
18
19static unsigned int pfifo_used = 0;
20
21int pfifo_request(unsigned int pfifo_mask)
22{
23 int err = 0;
24 unsigned int val;
25
26 mutex_lock(&pfifo_lock);
27
28 if (pfifo_mask & pfifo_used) {
29 err = -EBUSY;
30 goto out;
31 }
32
33 pfifo_used |= pfifo_mask;
34
35 val = readl(NETX_PFIFO_RESET);
36 writel(val | pfifo_mask, NETX_PFIFO_RESET);
37 writel(val, NETX_PFIFO_RESET);
38
39out:
40 mutex_unlock(&pfifo_lock);
41 return err;
42}
43
44void pfifo_free(unsigned int pfifo_mask)
45{
46 mutex_lock(&pfifo_lock);
47 pfifo_used &= ~pfifo_mask;
48 mutex_unlock(&pfifo_lock);
49}
50
51EXPORT_SYMBOL(pfifo_push);
52EXPORT_SYMBOL(pfifo_pop);
53EXPORT_SYMBOL(pfifo_fill_level);
54EXPORT_SYMBOL(pfifo_empty);
55EXPORT_SYMBOL(pfifo_request);
56EXPORT_SYMBOL(pfifo_free);
diff --git a/arch/arm/mach-netx/time.c b/arch/arm/mach-netx/time.c
deleted file mode 100644
index d9defa1ab605..000000000000
--- a/arch/arm/mach-netx/time.c
+++ /dev/null
@@ -1,141 +0,0 @@
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * arch/arm/mach-netx/time.c
4 *
5 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 */
7
8#include <linux/init.h>
9#include <linux/interrupt.h>
10#include <linux/irq.h>
11#include <linux/clocksource.h>
12#include <linux/clockchips.h>
13#include <linux/io.h>
14
15#include <mach/hardware.h>
16#include <asm/mach/time.h>
17#include <mach/netx-regs.h>
18
19#define NETX_CLOCK_FREQ 100000000
20#define NETX_LATCH DIV_ROUND_CLOSEST(NETX_CLOCK_FREQ, HZ)
21
22#define TIMER_CLOCKEVENT 0
23#define TIMER_CLOCKSOURCE 1
24
25static inline void timer_shutdown(struct clock_event_device *evt)
26{
27 /* disable timer */
28 writel(0, NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKEVENT));
29}
30
31static int netx_shutdown(struct clock_event_device *evt)
32{
33 timer_shutdown(evt);
34
35 return 0;
36}
37
38static int netx_set_oneshot(struct clock_event_device *evt)
39{
40 u32 tmode = NETX_GPIO_COUNTER_CTRL_IRQ_EN | NETX_GPIO_COUNTER_CTRL_RUN;
41
42 timer_shutdown(evt);
43 writel(0, NETX_GPIO_COUNTER_MAX(TIMER_CLOCKEVENT));
44 writel(tmode, NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKEVENT));
45
46 return 0;
47}
48
49static int netx_set_periodic(struct clock_event_device *evt)
50{
51 u32 tmode = NETX_GPIO_COUNTER_CTRL_RST_EN |
52 NETX_GPIO_COUNTER_CTRL_IRQ_EN | NETX_GPIO_COUNTER_CTRL_RUN;
53
54 timer_shutdown(evt);
55 writel(NETX_LATCH, NETX_GPIO_COUNTER_MAX(TIMER_CLOCKEVENT));
56 writel(tmode, NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKEVENT));
57
58 return 0;
59}
60
61static int netx_set_next_event(unsigned long evt,
62 struct clock_event_device *clk)
63{
64 writel(0 - evt, NETX_GPIO_COUNTER_CURRENT(TIMER_CLOCKEVENT));
65 return 0;
66}
67
68static struct clock_event_device netx_clockevent = {
69 .name = "netx-timer" __stringify(TIMER_CLOCKEVENT),
70 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
71 .set_next_event = netx_set_next_event,
72 .set_state_shutdown = netx_shutdown,
73 .set_state_periodic = netx_set_periodic,
74 .set_state_oneshot = netx_set_oneshot,
75 .tick_resume = netx_shutdown,
76};
77
78/*
79 * IRQ handler for the timer
80 */
81static irqreturn_t
82netx_timer_interrupt(int irq, void *dev_id)
83{
84 struct clock_event_device *evt = &netx_clockevent;
85
86 /* acknowledge interrupt */
87 writel(COUNTER_BIT(0), NETX_GPIO_IRQ);
88
89 evt->event_handler(evt);
90
91 return IRQ_HANDLED;
92}
93
94static struct irqaction netx_timer_irq = {
95 .name = "NetX Timer Tick",
96 .flags = IRQF_TIMER | IRQF_IRQPOLL,
97 .handler = netx_timer_interrupt,
98};
99
100/*
101 * Set up timer interrupt
102 */
103void __init netx_timer_init(void)
104{
105 /* disable timer initially */
106 writel(0, NETX_GPIO_COUNTER_CTRL(0));
107
108 /* Reset the timer value to zero */
109 writel(0, NETX_GPIO_COUNTER_CURRENT(0));
110
111 writel(NETX_LATCH, NETX_GPIO_COUNTER_MAX(0));
112
113 /* acknowledge interrupt */
114 writel(COUNTER_BIT(0), NETX_GPIO_IRQ);
115
116 /* Enable the interrupt in the specific timer
117 * register and start timer
118 */
119 writel(COUNTER_BIT(0), NETX_GPIO_IRQ_ENABLE);
120 writel(NETX_GPIO_COUNTER_CTRL_IRQ_EN | NETX_GPIO_COUNTER_CTRL_RUN,
121 NETX_GPIO_COUNTER_CTRL(0));
122
123 setup_irq(NETX_IRQ_TIMER0, &netx_timer_irq);
124
125 /* Setup timer one for clocksource */
126 writel(0, NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKSOURCE));
127 writel(0, NETX_GPIO_COUNTER_CURRENT(TIMER_CLOCKSOURCE));
128 writel(0xffffffff, NETX_GPIO_COUNTER_MAX(TIMER_CLOCKSOURCE));
129
130 writel(NETX_GPIO_COUNTER_CTRL_RUN,
131 NETX_GPIO_COUNTER_CTRL(TIMER_CLOCKSOURCE));
132
133 clocksource_mmio_init(NETX_GPIO_COUNTER_CURRENT(TIMER_CLOCKSOURCE),
134 "netx_timer", NETX_CLOCK_FREQ, 200, 32, clocksource_mmio_readl_up);
135
136 /* with max_delta_ns >= delta2ns(0x800) the system currently runs fine.
137 * Adding some safety ... */
138 netx_clockevent.cpumask = cpumask_of(0);
139 clockevents_config_and_register(&netx_clockevent, NETX_CLOCK_FREQ,
140 0xa00, 0xfffffffe);
141}
diff --git a/arch/arm/mach-netx/xc.c b/arch/arm/mach-netx/xc.c
deleted file mode 100644
index 885a618b2651..000000000000
--- a/arch/arm/mach-netx/xc.c
+++ /dev/null
@@ -1,246 +0,0 @@
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * arch/arm/mach-netx/xc.c
4 *
5 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 */
7
8#include <linux/init.h>
9#include <linux/device.h>
10#include <linux/firmware.h>
11#include <linux/mutex.h>
12#include <linux/slab.h>
13#include <linux/io.h>
14#include <linux/export.h>
15
16#include <mach/hardware.h>
17#include <mach/irqs.h>
18#include <mach/netx-regs.h>
19
20#include <mach/xc.h>
21
22static DEFINE_MUTEX(xc_lock);
23
24static int xc_in_use = 0;
25
26struct fw_desc {
27 unsigned int ofs;
28 unsigned int size;
29 unsigned int patch_ofs;
30 unsigned int patch_entries;
31};
32
33struct fw_header {
34 unsigned int magic;
35 unsigned int type;
36 unsigned int version;
37 unsigned int reserved[5];
38 struct fw_desc fw_desc[3];
39} __attribute__ ((packed));
40
41int xc_stop(struct xc *x)
42{
43 writel(RPU_HOLD_PC, x->xmac_base + NETX_XMAC_RPU_HOLD_PC_OFS);
44 writel(TPU_HOLD_PC, x->xmac_base + NETX_XMAC_TPU_HOLD_PC_OFS);
45 writel(XPU_HOLD_PC, x->xpec_base + NETX_XPEC_XPU_HOLD_PC_OFS);
46 return 0;
47}
48
49int xc_start(struct xc *x)
50{
51 writel(0, x->xmac_base + NETX_XMAC_RPU_HOLD_PC_OFS);
52 writel(0, x->xmac_base + NETX_XMAC_TPU_HOLD_PC_OFS);
53 writel(0, x->xpec_base + NETX_XPEC_XPU_HOLD_PC_OFS);
54 return 0;
55}
56
57int xc_running(struct xc *x)
58{
59 return (readl(x->xmac_base + NETX_XMAC_RPU_HOLD_PC_OFS) & RPU_HOLD_PC)
60 || (readl(x->xmac_base + NETX_XMAC_TPU_HOLD_PC_OFS) & TPU_HOLD_PC)
61 || (readl(x->xpec_base + NETX_XPEC_XPU_HOLD_PC_OFS) & XPU_HOLD_PC) ?
62 0 : 1;
63}
64
65int xc_reset(struct xc *x)
66{
67 writel(0, x->xpec_base + NETX_XPEC_PC_OFS);
68 return 0;
69}
70
71static int xc_check_ptr(struct xc *x, unsigned long adr, unsigned int size)
72{
73 if (adr >= NETX_PA_XMAC(x->no) &&
74 adr + size < NETX_PA_XMAC(x->no) + XMAC_MEM_SIZE)
75 return 0;
76
77 if (adr >= NETX_PA_XPEC(x->no) &&
78 adr + size < NETX_PA_XPEC(x->no) + XPEC_MEM_SIZE)
79 return 0;
80
81 dev_err(x->dev, "Illegal pointer in firmware found. aborting\n");
82
83 return -1;
84}
85
86static int xc_patch(struct xc *x, const void *patch, int count)
87{
88 unsigned int val, adr;
89 const unsigned int *data = patch;
90
91 int i;
92 for (i = 0; i < count; i++) {
93 adr = *data++;
94 val = *data++;
95 if (xc_check_ptr(x, adr, 4) < 0)
96 return -EINVAL;
97
98 writel(val, (void __iomem *)io_p2v(adr));
99 }
100 return 0;
101}
102
103int xc_request_firmware(struct xc *x)
104{
105 int ret;
106 char name[16];
107 const struct firmware *fw;
108 struct fw_header *head;
109 unsigned int size;
110 int i;
111 const void *src;
112 unsigned long dst;
113
114 sprintf(name, "xc%d.bin", x->no);
115
116 ret = request_firmware(&fw, name, x->dev);
117
118 if (ret < 0) {
119 dev_err(x->dev, "request_firmware failed\n");
120 return ret;
121 }
122
123 head = (struct fw_header *)fw->data;
124 if (head->magic != 0x4e657458) {
125 if (head->magic == 0x5874654e) {
126 dev_err(x->dev,
127 "firmware magic is 'XteN'. Endianness problems?\n");
128 ret = -ENODEV;
129 goto exit_release_firmware;
130 }
131 dev_err(x->dev, "unrecognized firmware magic 0x%08x\n",
132 head->magic);
133 ret = -ENODEV;
134 goto exit_release_firmware;
135 }
136
137 x->type = head->type;
138 x->version = head->version;
139
140 ret = -EINVAL;
141
142 for (i = 0; i < 3; i++) {
143 src = fw->data + head->fw_desc[i].ofs;
144 dst = *(unsigned int *)src;
145 src += sizeof (unsigned int);
146 size = head->fw_desc[i].size - sizeof (unsigned int);
147
148 if (xc_check_ptr(x, dst, size))
149 goto exit_release_firmware;
150
151 memcpy((void *)io_p2v(dst), src, size);
152
153 src = fw->data + head->fw_desc[i].patch_ofs;
154 size = head->fw_desc[i].patch_entries;
155 ret = xc_patch(x, src, size);
156 if (ret < 0)
157 goto exit_release_firmware;
158 }
159
160 ret = 0;
161
162 exit_release_firmware:
163 release_firmware(fw);
164
165 return ret;
166}
167
168struct xc *request_xc(int xcno, struct device *dev)
169{
170 struct xc *x = NULL;
171
172 mutex_lock(&xc_lock);
173
174 if (xcno > 3)
175 goto exit;
176 if (xc_in_use & (1 << xcno))
177 goto exit;
178
179 x = kmalloc(sizeof (struct xc), GFP_KERNEL);
180 if (!x)
181 goto exit;
182
183 if (!request_mem_region
184 (NETX_PA_XPEC(xcno), XPEC_MEM_SIZE, kobject_name(&dev->kobj)))
185 goto exit_free;
186
187 if (!request_mem_region
188 (NETX_PA_XMAC(xcno), XMAC_MEM_SIZE, kobject_name(&dev->kobj)))
189 goto exit_release_1;
190
191 if (!request_mem_region
192 (SRAM_INTERNAL_PHYS(xcno), SRAM_MEM_SIZE, kobject_name(&dev->kobj)))
193 goto exit_release_2;
194
195 x->xpec_base = (void * __iomem)io_p2v(NETX_PA_XPEC(xcno));
196 x->xmac_base = (void * __iomem)io_p2v(NETX_PA_XMAC(xcno));
197 x->sram_base = ioremap(SRAM_INTERNAL_PHYS(xcno), SRAM_MEM_SIZE);
198 if (!x->sram_base)
199 goto exit_release_3;
200
201 x->irq = NETX_IRQ_XPEC(xcno);
202
203 x->no = xcno;
204 x->dev = dev;
205
206 xc_in_use |= (1 << xcno);
207
208 goto exit;
209
210 exit_release_3:
211 release_mem_region(SRAM_INTERNAL_PHYS(xcno), SRAM_MEM_SIZE);
212 exit_release_2:
213 release_mem_region(NETX_PA_XMAC(xcno), XMAC_MEM_SIZE);
214 exit_release_1:
215 release_mem_region(NETX_PA_XPEC(xcno), XPEC_MEM_SIZE);
216 exit_free:
217 kfree(x);
218 x = NULL;
219 exit:
220 mutex_unlock(&xc_lock);
221 return x;
222}
223
224void free_xc(struct xc *x)
225{
226 int xcno = x->no;
227
228 mutex_lock(&xc_lock);
229
230 iounmap(x->sram_base);
231 release_mem_region(SRAM_INTERNAL_PHYS(xcno), SRAM_MEM_SIZE);
232 release_mem_region(NETX_PA_XMAC(xcno), XMAC_MEM_SIZE);
233 release_mem_region(NETX_PA_XPEC(xcno), XPEC_MEM_SIZE);
234 xc_in_use &= ~(1 << x->no);
235 kfree(x);
236
237 mutex_unlock(&xc_lock);
238}
239
240EXPORT_SYMBOL(free_xc);
241EXPORT_SYMBOL(request_xc);
242EXPORT_SYMBOL(xc_request_firmware);
243EXPORT_SYMBOL(xc_reset);
244EXPORT_SYMBOL(xc_running);
245EXPORT_SYMBOL(xc_start);
246EXPORT_SYMBOL(xc_stop);
diff --git a/arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h b/arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h
index e25f7fcd7997..cffa8991880d 100644
--- a/arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h
+++ b/arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h
@@ -462,7 +462,7 @@
462#define MX8MM_IOMUXC_SAI3_RXFS_GPIO4_IO28 0x1CC 0x434 0x000 0x5 0x0 462#define MX8MM_IOMUXC_SAI3_RXFS_GPIO4_IO28 0x1CC 0x434 0x000 0x5 0x0
463#define MX8MM_IOMUXC_SAI3_RXFS_TPSMP_HTRANS0 0x1CC 0x434 0x000 0x7 0x0 463#define MX8MM_IOMUXC_SAI3_RXFS_TPSMP_HTRANS0 0x1CC 0x434 0x000 0x7 0x0
464#define MX8MM_IOMUXC_SAI3_RXC_SAI3_RX_BCLK 0x1D0 0x438 0x000 0x0 0x0 464#define MX8MM_IOMUXC_SAI3_RXC_SAI3_RX_BCLK 0x1D0 0x438 0x000 0x0 0x0
465#define MX8MM_IOMUXC_SAI3_RXC_GPT1_CAPTURE2 0x1D0 0x438 0x000 0x1 0x0 465#define MX8MM_IOMUXC_SAI3_RXC_GPT1_CLK 0x1D0 0x438 0x000 0x1 0x0
466#define MX8MM_IOMUXC_SAI3_RXC_SAI5_RX_BCLK 0x1D0 0x438 0x4D0 0x2 0x2 466#define MX8MM_IOMUXC_SAI3_RXC_SAI5_RX_BCLK 0x1D0 0x438 0x4D0 0x2 0x2
467#define MX8MM_IOMUXC_SAI3_RXC_GPIO4_IO29 0x1D0 0x438 0x000 0x5 0x0 467#define MX8MM_IOMUXC_SAI3_RXC_GPIO4_IO29 0x1D0 0x438 0x000 0x5 0x0
468#define MX8MM_IOMUXC_SAI3_RXC_TPSMP_HTRANS1 0x1D0 0x438 0x000 0x7 0x0 468#define MX8MM_IOMUXC_SAI3_RXC_TPSMP_HTRANS1 0x1D0 0x438 0x000 0x7 0x0
@@ -472,7 +472,7 @@
472#define MX8MM_IOMUXC_SAI3_RXD_GPIO4_IO30 0x1D4 0x43C 0x000 0x5 0x0 472#define MX8MM_IOMUXC_SAI3_RXD_GPIO4_IO30 0x1D4 0x43C 0x000 0x5 0x0
473#define MX8MM_IOMUXC_SAI3_RXD_TPSMP_HDATA0 0x1D4 0x43C 0x000 0x7 0x0 473#define MX8MM_IOMUXC_SAI3_RXD_TPSMP_HDATA0 0x1D4 0x43C 0x000 0x7 0x0
474#define MX8MM_IOMUXC_SAI3_TXFS_SAI3_TX_SYNC 0x1D8 0x440 0x000 0x0 0x0 474#define MX8MM_IOMUXC_SAI3_TXFS_SAI3_TX_SYNC 0x1D8 0x440 0x000 0x0 0x0
475#define MX8MM_IOMUXC_SAI3_TXFS_GPT1_CLK 0x1D8 0x440 0x000 0x1 0x0 475#define MX8MM_IOMUXC_SAI3_TXFS_GPT1_CAPTURE2 0x1D8 0x440 0x000 0x1 0x0
476#define MX8MM_IOMUXC_SAI3_TXFS_SAI5_RX_DATA1 0x1D8 0x440 0x4D8 0x2 0x2 476#define MX8MM_IOMUXC_SAI3_TXFS_SAI5_RX_DATA1 0x1D8 0x440 0x4D8 0x2 0x2
477#define MX8MM_IOMUXC_SAI3_TXFS_GPIO4_IO31 0x1D8 0x440 0x000 0x5 0x0 477#define MX8MM_IOMUXC_SAI3_TXFS_GPIO4_IO31 0x1D8 0x440 0x000 0x5 0x0
478#define MX8MM_IOMUXC_SAI3_TXFS_TPSMP_HDATA1 0x1D8 0x440 0x000 0x7 0x0 478#define MX8MM_IOMUXC_SAI3_TXFS_TPSMP_HDATA1 0x1D8 0x440 0x000 0x7 0x0
diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi b/arch/arm64/boot/dts/freescale/imx8mq.dtsi
index d09b808eff87..52aae341d0da 100644
--- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi
@@ -715,8 +715,7 @@
715 715
716 sai2: sai@308b0000 { 716 sai2: sai@308b0000 {
717 #sound-dai-cells = <0>; 717 #sound-dai-cells = <0>;
718 compatible = "fsl,imx8mq-sai", 718 compatible = "fsl,imx8mq-sai";
719 "fsl,imx6sx-sai";
720 reg = <0x308b0000 0x10000>; 719 reg = <0x308b0000 0x10000>;
721 interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>; 720 interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
722 clocks = <&clk IMX8MQ_CLK_SAI2_IPG>, 721 clocks = <&clk IMX8MQ_CLK_SAI2_IPG>,
diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h
index 3c7037c6ba9b..b618017205a3 100644
--- a/arch/arm64/include/asm/elf.h
+++ b/arch/arm64/include/asm/elf.h
@@ -202,7 +202,7 @@ typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG];
202({ \ 202({ \
203 set_thread_flag(TIF_32BIT); \ 203 set_thread_flag(TIF_32BIT); \
204 }) 204 })
205#ifdef CONFIG_GENERIC_COMPAT_VDSO 205#ifdef CONFIG_COMPAT_VDSO
206#define COMPAT_ARCH_DLINFO \ 206#define COMPAT_ARCH_DLINFO \
207do { \ 207do { \
208 /* \ 208 /* \
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 87a4b2ddc1a1..3f5461f7b560 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -301,7 +301,6 @@ static inline int pte_same(pte_t pte_a, pte_t pte_b)
301/* 301/*
302 * Huge pte definitions. 302 * Huge pte definitions.
303 */ 303 */
304#define pte_huge(pte) (!(pte_val(pte) & PTE_TABLE_BIT))
305#define pte_mkhuge(pte) (__pte(pte_val(pte) & ~PTE_TABLE_BIT)) 304#define pte_mkhuge(pte) (__pte(pte_val(pte) & ~PTE_TABLE_BIT))
306 305
307/* 306/*
diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
index fd5b1a4efc70..844e2964b0f5 100644
--- a/arch/arm64/include/asm/processor.h
+++ b/arch/arm64/include/asm/processor.h
@@ -193,6 +193,16 @@ static inline void start_thread_common(struct pt_regs *regs, unsigned long pc)
193 regs->pmr_save = GIC_PRIO_IRQON; 193 regs->pmr_save = GIC_PRIO_IRQON;
194} 194}
195 195
196static inline void set_ssbs_bit(struct pt_regs *regs)
197{
198 regs->pstate |= PSR_SSBS_BIT;
199}
200
201static inline void set_compat_ssbs_bit(struct pt_regs *regs)
202{
203 regs->pstate |= PSR_AA32_SSBS_BIT;
204}
205
196static inline void start_thread(struct pt_regs *regs, unsigned long pc, 206static inline void start_thread(struct pt_regs *regs, unsigned long pc,
197 unsigned long sp) 207 unsigned long sp)
198{ 208{
@@ -200,7 +210,7 @@ static inline void start_thread(struct pt_regs *regs, unsigned long pc,
200 regs->pstate = PSR_MODE_EL0t; 210 regs->pstate = PSR_MODE_EL0t;
201 211
202 if (arm64_get_ssbd_state() != ARM64_SSBD_FORCE_ENABLE) 212 if (arm64_get_ssbd_state() != ARM64_SSBD_FORCE_ENABLE)
203 regs->pstate |= PSR_SSBS_BIT; 213 set_ssbs_bit(regs);
204 214
205 regs->sp = sp; 215 regs->sp = sp;
206} 216}
@@ -219,7 +229,7 @@ static inline void compat_start_thread(struct pt_regs *regs, unsigned long pc,
219#endif 229#endif
220 230
221 if (arm64_get_ssbd_state() != ARM64_SSBD_FORCE_ENABLE) 231 if (arm64_get_ssbd_state() != ARM64_SSBD_FORCE_ENABLE)
222 regs->pstate |= PSR_AA32_SSBS_BIT; 232 set_compat_ssbs_bit(regs);
223 233
224 regs->compat_sp = sp; 234 regs->compat_sp = sp;
225} 235}
diff --git a/arch/arm64/include/asm/stacktrace.h b/arch/arm64/include/asm/stacktrace.h
index df45af931459..4d9b1f48dc39 100644
--- a/arch/arm64/include/asm/stacktrace.h
+++ b/arch/arm64/include/asm/stacktrace.h
@@ -8,19 +8,12 @@
8#include <linux/percpu.h> 8#include <linux/percpu.h>
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/sched/task_stack.h> 10#include <linux/sched/task_stack.h>
11#include <linux/types.h>
11 12
12#include <asm/memory.h> 13#include <asm/memory.h>
13#include <asm/ptrace.h> 14#include <asm/ptrace.h>
14#include <asm/sdei.h> 15#include <asm/sdei.h>
15 16
16struct stackframe {
17 unsigned long fp;
18 unsigned long pc;
19#ifdef CONFIG_FUNCTION_GRAPH_TRACER
20 int graph;
21#endif
22};
23
24enum stack_type { 17enum stack_type {
25 STACK_TYPE_UNKNOWN, 18 STACK_TYPE_UNKNOWN,
26 STACK_TYPE_TASK, 19 STACK_TYPE_TASK,
@@ -28,6 +21,7 @@ enum stack_type {
28 STACK_TYPE_OVERFLOW, 21 STACK_TYPE_OVERFLOW,
29 STACK_TYPE_SDEI_NORMAL, 22 STACK_TYPE_SDEI_NORMAL,
30 STACK_TYPE_SDEI_CRITICAL, 23 STACK_TYPE_SDEI_CRITICAL,
24 __NR_STACK_TYPES
31}; 25};
32 26
33struct stack_info { 27struct stack_info {
@@ -36,6 +30,37 @@ struct stack_info {
36 enum stack_type type; 30 enum stack_type type;
37}; 31};
38 32
33/*
34 * A snapshot of a frame record or fp/lr register values, along with some
35 * accounting information necessary for robust unwinding.
36 *
37 * @fp: The fp value in the frame record (or the real fp)
38 * @pc: The fp value in the frame record (or the real lr)
39 *
40 * @stacks_done: Stacks which have been entirely unwound, for which it is no
41 * longer valid to unwind to.
42 *
43 * @prev_fp: The fp that pointed to this frame record, or a synthetic value
44 * of 0. This is used to ensure that within a stack, each
45 * subsequent frame record is at an increasing address.
46 * @prev_type: The type of stack this frame record was on, or a synthetic
47 * value of STACK_TYPE_UNKNOWN. This is used to detect a
48 * transition from one stack to another.
49 *
50 * @graph: When FUNCTION_GRAPH_TRACER is selected, holds the index of a
51 * replacement lr value in the ftrace graph stack.
52 */
53struct stackframe {
54 unsigned long fp;
55 unsigned long pc;
56 DECLARE_BITMAP(stacks_done, __NR_STACK_TYPES);
57 unsigned long prev_fp;
58 enum stack_type prev_type;
59#ifdef CONFIG_FUNCTION_GRAPH_TRACER
60 int graph;
61#endif
62};
63
39extern int unwind_frame(struct task_struct *tsk, struct stackframe *frame); 64extern int unwind_frame(struct task_struct *tsk, struct stackframe *frame);
40extern void walk_stackframe(struct task_struct *tsk, struct stackframe *frame, 65extern void walk_stackframe(struct task_struct *tsk, struct stackframe *frame,
41 int (*fn)(struct stackframe *, void *), void *data); 66 int (*fn)(struct stackframe *, void *), void *data);
@@ -64,8 +89,9 @@ static inline bool on_irq_stack(unsigned long sp,
64 return true; 89 return true;
65} 90}
66 91
67static inline bool on_task_stack(struct task_struct *tsk, unsigned long sp, 92static inline bool on_task_stack(const struct task_struct *tsk,
68 struct stack_info *info) 93 unsigned long sp,
94 struct stack_info *info)
69{ 95{
70 unsigned long low = (unsigned long)task_stack_page(tsk); 96 unsigned long low = (unsigned long)task_stack_page(tsk);
71 unsigned long high = low + THREAD_SIZE; 97 unsigned long high = low + THREAD_SIZE;
@@ -112,10 +138,13 @@ static inline bool on_overflow_stack(unsigned long sp,
112 * We can only safely access per-cpu stacks from current in a non-preemptible 138 * We can only safely access per-cpu stacks from current in a non-preemptible
113 * context. 139 * context.
114 */ 140 */
115static inline bool on_accessible_stack(struct task_struct *tsk, 141static inline bool on_accessible_stack(const struct task_struct *tsk,
116 unsigned long sp, 142 unsigned long sp,
117 struct stack_info *info) 143 struct stack_info *info)
118{ 144{
145 if (info)
146 info->type = STACK_TYPE_UNKNOWN;
147
119 if (on_task_stack(tsk, sp, info)) 148 if (on_task_stack(tsk, sp, info))
120 return true; 149 return true;
121 if (tsk != current || preemptible()) 150 if (tsk != current || preemptible())
@@ -130,4 +159,27 @@ static inline bool on_accessible_stack(struct task_struct *tsk,
130 return false; 159 return false;
131} 160}
132 161
162static inline void start_backtrace(struct stackframe *frame,
163 unsigned long fp, unsigned long pc)
164{
165 frame->fp = fp;
166 frame->pc = pc;
167#ifdef CONFIG_FUNCTION_GRAPH_TRACER
168 frame->graph = 0;
169#endif
170
171 /*
172 * Prime the first unwind.
173 *
174 * In unwind_frame() we'll check that the FP points to a valid stack,
175 * which can't be STACK_TYPE_UNKNOWN, and the first unwind will be
176 * treated as a transition to whichever stack that happens to be. The
177 * prev_fp value won't be used, but we set it to 0 such that it is
178 * definitely not an accessible stack address.
179 */
180 bitmap_zero(frame->stacks_done, __NR_STACK_TYPES);
181 frame->prev_fp = 0;
182 frame->prev_type = STACK_TYPE_UNKNOWN;
183}
184
133#endif /* __ASM_STACKTRACE_H */ 185#endif /* __ASM_STACKTRACE_H */
diff --git a/arch/arm64/include/uapi/asm/bpf_perf_event.h b/arch/arm64/include/uapi/asm/bpf_perf_event.h
index b551b741653d..5e1e648aeec4 100644
--- a/arch/arm64/include/uapi/asm/bpf_perf_event.h
+++ b/arch/arm64/include/uapi/asm/bpf_perf_event.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__ 2#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__
3#define _UAPI__ASM_BPF_PERF_EVENT_H__ 3#define _UAPI__ASM_BPF_PERF_EVENT_H__
4 4
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index 9cdc4592da3e..320a30dbe35e 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -586,10 +586,8 @@ el1_sync:
586 b.eq el1_ia 586 b.eq el1_ia
587 cmp x24, #ESR_ELx_EC_SYS64 // configurable trap 587 cmp x24, #ESR_ELx_EC_SYS64 // configurable trap
588 b.eq el1_undef 588 b.eq el1_undef
589 cmp x24, #ESR_ELx_EC_SP_ALIGN // stack alignment exception
590 b.eq el1_sp_pc
591 cmp x24, #ESR_ELx_EC_PC_ALIGN // pc alignment exception 589 cmp x24, #ESR_ELx_EC_PC_ALIGN // pc alignment exception
592 b.eq el1_sp_pc 590 b.eq el1_pc
593 cmp x24, #ESR_ELx_EC_UNKNOWN // unknown exception in EL1 591 cmp x24, #ESR_ELx_EC_UNKNOWN // unknown exception in EL1
594 b.eq el1_undef 592 b.eq el1_undef
595 cmp x24, #ESR_ELx_EC_BREAKPT_CUR // debug exception in EL1 593 cmp x24, #ESR_ELx_EC_BREAKPT_CUR // debug exception in EL1
@@ -611,9 +609,11 @@ el1_da:
611 bl do_mem_abort 609 bl do_mem_abort
612 610
613 kernel_exit 1 611 kernel_exit 1
614el1_sp_pc: 612el1_pc:
615 /* 613 /*
616 * Stack or PC alignment exception handling 614 * PC alignment exception handling. We don't handle SP alignment faults,
615 * since we will have hit a recursive exception when trying to push the
616 * initial pt_regs.
617 */ 617 */
618 mrs x0, far_el1 618 mrs x0, far_el1
619 inherit_daif pstate=x23, tmp=x2 619 inherit_daif pstate=x23, tmp=x2
@@ -732,9 +732,9 @@ el0_sync:
732 ccmp x24, #ESR_ELx_EC_WFx, #4, ne 732 ccmp x24, #ESR_ELx_EC_WFx, #4, ne
733 b.eq el0_sys 733 b.eq el0_sys
734 cmp x24, #ESR_ELx_EC_SP_ALIGN // stack alignment exception 734 cmp x24, #ESR_ELx_EC_SP_ALIGN // stack alignment exception
735 b.eq el0_sp_pc 735 b.eq el0_sp
736 cmp x24, #ESR_ELx_EC_PC_ALIGN // pc alignment exception 736 cmp x24, #ESR_ELx_EC_PC_ALIGN // pc alignment exception
737 b.eq el0_sp_pc 737 b.eq el0_pc
738 cmp x24, #ESR_ELx_EC_UNKNOWN // unknown exception in EL0 738 cmp x24, #ESR_ELx_EC_UNKNOWN // unknown exception in EL0
739 b.eq el0_undef 739 b.eq el0_undef
740 cmp x24, #ESR_ELx_EC_BREAKPT_LOW // debug exception in EL0 740 cmp x24, #ESR_ELx_EC_BREAKPT_LOW // debug exception in EL0
@@ -758,7 +758,7 @@ el0_sync_compat:
758 cmp x24, #ESR_ELx_EC_FP_EXC32 // FP/ASIMD exception 758 cmp x24, #ESR_ELx_EC_FP_EXC32 // FP/ASIMD exception
759 b.eq el0_fpsimd_exc 759 b.eq el0_fpsimd_exc
760 cmp x24, #ESR_ELx_EC_PC_ALIGN // pc alignment exception 760 cmp x24, #ESR_ELx_EC_PC_ALIGN // pc alignment exception
761 b.eq el0_sp_pc 761 b.eq el0_pc
762 cmp x24, #ESR_ELx_EC_UNKNOWN // unknown exception in EL0 762 cmp x24, #ESR_ELx_EC_UNKNOWN // unknown exception in EL0
763 b.eq el0_undef 763 b.eq el0_undef
764 cmp x24, #ESR_ELx_EC_CP15_32 // CP15 MRC/MCR trap 764 cmp x24, #ESR_ELx_EC_CP15_32 // CP15 MRC/MCR trap
@@ -858,11 +858,15 @@ el0_fpsimd_exc:
858 mov x1, sp 858 mov x1, sp
859 bl do_fpsimd_exc 859 bl do_fpsimd_exc
860 b ret_to_user 860 b ret_to_user
861el0_sp:
862 ldr x26, [sp, #S_SP]
863 b el0_sp_pc
864el0_pc:
865 mrs x26, far_el1
861el0_sp_pc: 866el0_sp_pc:
862 /* 867 /*
863 * Stack or PC alignment exception handling 868 * Stack or PC alignment exception handling
864 */ 869 */
865 mrs x26, far_el1
866 gic_prio_kentry_setup tmp=x0 870 gic_prio_kentry_setup tmp=x0
867 enable_da_f 871 enable_da_f
868#ifdef CONFIG_TRACE_IRQFLAGS 872#ifdef CONFIG_TRACE_IRQFLAGS
diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
index eec4776ae5f0..37d3912cfe06 100644
--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -406,6 +406,18 @@ static __uint128_t arm64_cpu_to_le128(__uint128_t x)
406 406
407#define arm64_le128_to_cpu(x) arm64_cpu_to_le128(x) 407#define arm64_le128_to_cpu(x) arm64_cpu_to_le128(x)
408 408
409static void __fpsimd_to_sve(void *sst, struct user_fpsimd_state const *fst,
410 unsigned int vq)
411{
412 unsigned int i;
413 __uint128_t *p;
414
415 for (i = 0; i < SVE_NUM_ZREGS; ++i) {
416 p = (__uint128_t *)ZREG(sst, vq, i);
417 *p = arm64_cpu_to_le128(fst->vregs[i]);
418 }
419}
420
409/* 421/*
410 * Transfer the FPSIMD state in task->thread.uw.fpsimd_state to 422 * Transfer the FPSIMD state in task->thread.uw.fpsimd_state to
411 * task->thread.sve_state. 423 * task->thread.sve_state.
@@ -423,17 +435,12 @@ static void fpsimd_to_sve(struct task_struct *task)
423 unsigned int vq; 435 unsigned int vq;
424 void *sst = task->thread.sve_state; 436 void *sst = task->thread.sve_state;
425 struct user_fpsimd_state const *fst = &task->thread.uw.fpsimd_state; 437 struct user_fpsimd_state const *fst = &task->thread.uw.fpsimd_state;
426 unsigned int i;
427 __uint128_t *p;
428 438
429 if (!system_supports_sve()) 439 if (!system_supports_sve())
430 return; 440 return;
431 441
432 vq = sve_vq_from_vl(task->thread.sve_vl); 442 vq = sve_vq_from_vl(task->thread.sve_vl);
433 for (i = 0; i < 32; ++i) { 443 __fpsimd_to_sve(sst, fst, vq);
434 p = (__uint128_t *)ZREG(sst, vq, i);
435 *p = arm64_cpu_to_le128(fst->vregs[i]);
436 }
437} 444}
438 445
439/* 446/*
@@ -459,7 +466,7 @@ static void sve_to_fpsimd(struct task_struct *task)
459 return; 466 return;
460 467
461 vq = sve_vq_from_vl(task->thread.sve_vl); 468 vq = sve_vq_from_vl(task->thread.sve_vl);
462 for (i = 0; i < 32; ++i) { 469 for (i = 0; i < SVE_NUM_ZREGS; ++i) {
463 p = (__uint128_t const *)ZREG(sst, vq, i); 470 p = (__uint128_t const *)ZREG(sst, vq, i);
464 fst->vregs[i] = arm64_le128_to_cpu(*p); 471 fst->vregs[i] = arm64_le128_to_cpu(*p);
465 } 472 }
@@ -550,8 +557,6 @@ void sve_sync_from_fpsimd_zeropad(struct task_struct *task)
550 unsigned int vq; 557 unsigned int vq;
551 void *sst = task->thread.sve_state; 558 void *sst = task->thread.sve_state;
552 struct user_fpsimd_state const *fst = &task->thread.uw.fpsimd_state; 559 struct user_fpsimd_state const *fst = &task->thread.uw.fpsimd_state;
553 unsigned int i;
554 __uint128_t *p;
555 560
556 if (!test_tsk_thread_flag(task, TIF_SVE)) 561 if (!test_tsk_thread_flag(task, TIF_SVE))
557 return; 562 return;
@@ -559,11 +564,7 @@ void sve_sync_from_fpsimd_zeropad(struct task_struct *task)
559 vq = sve_vq_from_vl(task->thread.sve_vl); 564 vq = sve_vq_from_vl(task->thread.sve_vl);
560 565
561 memset(sst, 0, SVE_SIG_REGS_SIZE(vq)); 566 memset(sst, 0, SVE_SIG_REGS_SIZE(vq));
562 567 __fpsimd_to_sve(sst, fst, vq);
563 for (i = 0; i < 32; ++i) {
564 p = (__uint128_t *)ZREG(sst, vq, i);
565 *p = arm64_cpu_to_le128(fst->vregs[i]);
566 }
567} 568}
568 569
569int sve_set_vector_length(struct task_struct *task, 570int sve_set_vector_length(struct task_struct *task,
diff --git a/arch/arm64/kernel/perf_callchain.c b/arch/arm64/kernel/perf_callchain.c
index 9d63514b9836..b0e03e052dd1 100644
--- a/arch/arm64/kernel/perf_callchain.c
+++ b/arch/arm64/kernel/perf_callchain.c
@@ -154,12 +154,7 @@ void perf_callchain_kernel(struct perf_callchain_entry_ctx *entry,
154 return; 154 return;
155 } 155 }
156 156
157 frame.fp = regs->regs[29]; 157 start_backtrace(&frame, regs->regs[29], regs->pc);
158 frame.pc = regs->pc;
159#ifdef CONFIG_FUNCTION_GRAPH_TRACER
160 frame.graph = 0;
161#endif
162
163 walk_stackframe(current, &frame, callchain_trace, entry); 158 walk_stackframe(current, &frame, callchain_trace, entry);
164} 159}
165 160
diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 6a869d9f304f..f674f28df663 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -398,7 +398,7 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start,
398 childregs->pstate |= PSR_UAO_BIT; 398 childregs->pstate |= PSR_UAO_BIT;
399 399
400 if (arm64_get_ssbd_state() == ARM64_SSBD_FORCE_DISABLE) 400 if (arm64_get_ssbd_state() == ARM64_SSBD_FORCE_DISABLE)
401 childregs->pstate |= PSR_SSBS_BIT; 401 set_ssbs_bit(childregs);
402 402
403 if (system_uses_irq_prio_masking()) 403 if (system_uses_irq_prio_masking())
404 childregs->pmr_save = GIC_PRIO_IRQON; 404 childregs->pmr_save = GIC_PRIO_IRQON;
@@ -443,6 +443,32 @@ void uao_thread_switch(struct task_struct *next)
443} 443}
444 444
445/* 445/*
446 * Force SSBS state on context-switch, since it may be lost after migrating
447 * from a CPU which treats the bit as RES0 in a heterogeneous system.
448 */
449static void ssbs_thread_switch(struct task_struct *next)
450{
451 struct pt_regs *regs = task_pt_regs(next);
452
453 /*
454 * Nothing to do for kernel threads, but 'regs' may be junk
455 * (e.g. idle task) so check the flags and bail early.
456 */
457 if (unlikely(next->flags & PF_KTHREAD))
458 return;
459
460 /* If the mitigation is enabled, then we leave SSBS clear. */
461 if ((arm64_get_ssbd_state() == ARM64_SSBD_FORCE_ENABLE) ||
462 test_tsk_thread_flag(next, TIF_SSBD))
463 return;
464
465 if (compat_user_mode(regs))
466 set_compat_ssbs_bit(regs);
467 else if (user_mode(regs))
468 set_ssbs_bit(regs);
469}
470
471/*
446 * We store our current task in sp_el0, which is clobbered by userspace. Keep a 472 * We store our current task in sp_el0, which is clobbered by userspace. Keep a
447 * shadow copy so that we can restore this upon entry from userspace. 473 * shadow copy so that we can restore this upon entry from userspace.
448 * 474 *
@@ -471,6 +497,7 @@ __notrace_funcgraph struct task_struct *__switch_to(struct task_struct *prev,
471 entry_task_switch(next); 497 entry_task_switch(next);
472 uao_thread_switch(next); 498 uao_thread_switch(next);
473 ptrauth_thread_switch(next); 499 ptrauth_thread_switch(next);
500 ssbs_thread_switch(next);
474 501
475 /* 502 /*
476 * Complete any pending TLB or cache maintenance on this CPU in case 503 * Complete any pending TLB or cache maintenance on this CPU in case
@@ -498,11 +525,8 @@ unsigned long get_wchan(struct task_struct *p)
498 if (!stack_page) 525 if (!stack_page)
499 return 0; 526 return 0;
500 527
501 frame.fp = thread_saved_fp(p); 528 start_backtrace(&frame, thread_saved_fp(p), thread_saved_pc(p));
502 frame.pc = thread_saved_pc(p); 529
503#ifdef CONFIG_FUNCTION_GRAPH_TRACER
504 frame.graph = 0;
505#endif
506 do { 530 do {
507 if (unwind_frame(p, &frame)) 531 if (unwind_frame(p, &frame))
508 goto out; 532 goto out;
diff --git a/arch/arm64/kernel/return_address.c b/arch/arm64/kernel/return_address.c
index b21cba90f82d..c4ae647d2306 100644
--- a/arch/arm64/kernel/return_address.c
+++ b/arch/arm64/kernel/return_address.c
@@ -38,12 +38,9 @@ void *return_address(unsigned int level)
38 data.level = level + 2; 38 data.level = level + 2;
39 data.addr = NULL; 39 data.addr = NULL;
40 40
41 frame.fp = (unsigned long)__builtin_frame_address(0); 41 start_backtrace(&frame,
42 frame.pc = (unsigned long)return_address; /* dummy */ 42 (unsigned long)__builtin_frame_address(0),
43#ifdef CONFIG_FUNCTION_GRAPH_TRACER 43 (unsigned long)return_address);
44 frame.graph = 0;
45#endif
46
47 walk_stackframe(current, &frame, save_return_addr, &data); 44 walk_stackframe(current, &frame, save_return_addr, &data);
48 45
49 if (!data.level) 46 if (!data.level)
diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c
index 62d395151abe..2b160ae594eb 100644
--- a/arch/arm64/kernel/stacktrace.c
+++ b/arch/arm64/kernel/stacktrace.c
@@ -29,9 +29,18 @@
29 * ldp x29, x30, [sp] 29 * ldp x29, x30, [sp]
30 * add sp, sp, #0x10 30 * add sp, sp, #0x10
31 */ 31 */
32
33/*
34 * Unwind from one frame record (A) to the next frame record (B).
35 *
36 * We terminate early if the location of B indicates a malformed chain of frame
37 * records (e.g. a cycle), determined based on the location and fp value of A
38 * and the location (but not the fp value) of B.
39 */
32int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame) 40int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame)
33{ 41{
34 unsigned long fp = frame->fp; 42 unsigned long fp = frame->fp;
43 struct stack_info info;
35 44
36 if (fp & 0xf) 45 if (fp & 0xf)
37 return -EINVAL; 46 return -EINVAL;
@@ -39,11 +48,40 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame)
39 if (!tsk) 48 if (!tsk)
40 tsk = current; 49 tsk = current;
41 50
42 if (!on_accessible_stack(tsk, fp, NULL)) 51 if (!on_accessible_stack(tsk, fp, &info))
52 return -EINVAL;
53
54 if (test_bit(info.type, frame->stacks_done))
43 return -EINVAL; 55 return -EINVAL;
44 56
57 /*
58 * As stacks grow downward, any valid record on the same stack must be
59 * at a strictly higher address than the prior record.
60 *
61 * Stacks can nest in several valid orders, e.g.
62 *
63 * TASK -> IRQ -> OVERFLOW -> SDEI_NORMAL
64 * TASK -> SDEI_NORMAL -> SDEI_CRITICAL -> OVERFLOW
65 *
66 * ... but the nesting itself is strict. Once we transition from one
67 * stack to another, it's never valid to unwind back to that first
68 * stack.
69 */
70 if (info.type == frame->prev_type) {
71 if (fp <= frame->prev_fp)
72 return -EINVAL;
73 } else {
74 set_bit(frame->prev_type, frame->stacks_done);
75 }
76
77 /*
78 * Record this frame record's values and location. The prev_fp and
79 * prev_type are only meaningful to the next unwind_frame() invocation.
80 */
45 frame->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp)); 81 frame->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp));
46 frame->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp + 8)); 82 frame->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp + 8));
83 frame->prev_fp = fp;
84 frame->prev_type = info.type;
47 85
48#ifdef CONFIG_FUNCTION_GRAPH_TRACER 86#ifdef CONFIG_FUNCTION_GRAPH_TRACER
49 if (tsk->ret_stack && 87 if (tsk->ret_stack &&
@@ -122,12 +160,7 @@ void save_stack_trace_regs(struct pt_regs *regs, struct stack_trace *trace)
122 data.skip = trace->skip; 160 data.skip = trace->skip;
123 data.no_sched_functions = 0; 161 data.no_sched_functions = 0;
124 162
125 frame.fp = regs->regs[29]; 163 start_backtrace(&frame, regs->regs[29], regs->pc);
126 frame.pc = regs->pc;
127#ifdef CONFIG_FUNCTION_GRAPH_TRACER
128 frame.graph = 0;
129#endif
130
131 walk_stackframe(current, &frame, save_trace, &data); 164 walk_stackframe(current, &frame, save_trace, &data);
132} 165}
133EXPORT_SYMBOL_GPL(save_stack_trace_regs); 166EXPORT_SYMBOL_GPL(save_stack_trace_regs);
@@ -146,17 +179,15 @@ static noinline void __save_stack_trace(struct task_struct *tsk,
146 data.no_sched_functions = nosched; 179 data.no_sched_functions = nosched;
147 180
148 if (tsk != current) { 181 if (tsk != current) {
149 frame.fp = thread_saved_fp(tsk); 182 start_backtrace(&frame, thread_saved_fp(tsk),
150 frame.pc = thread_saved_pc(tsk); 183 thread_saved_pc(tsk));
151 } else { 184 } else {
152 /* We don't want this function nor the caller */ 185 /* We don't want this function nor the caller */
153 data.skip += 2; 186 data.skip += 2;
154 frame.fp = (unsigned long)__builtin_frame_address(0); 187 start_backtrace(&frame,
155 frame.pc = (unsigned long)__save_stack_trace; 188 (unsigned long)__builtin_frame_address(0),
189 (unsigned long)__save_stack_trace);
156 } 190 }
157#ifdef CONFIG_FUNCTION_GRAPH_TRACER
158 frame.graph = 0;
159#endif
160 191
161 walk_stackframe(tsk, &frame, save_trace, &data); 192 walk_stackframe(tsk, &frame, save_trace, &data);
162 193
diff --git a/arch/arm64/kernel/time.c b/arch/arm64/kernel/time.c
index 9f25aedeac9d..0b2946414dc9 100644
--- a/arch/arm64/kernel/time.c
+++ b/arch/arm64/kernel/time.c
@@ -38,11 +38,8 @@ unsigned long profile_pc(struct pt_regs *regs)
38 if (!in_lock_functions(regs->pc)) 38 if (!in_lock_functions(regs->pc))
39 return regs->pc; 39 return regs->pc;
40 40
41 frame.fp = regs->regs[29]; 41 start_backtrace(&frame, regs->regs[29], regs->pc);
42 frame.pc = regs->pc; 42
43#ifdef CONFIG_FUNCTION_GRAPH_TRACER
44 frame.graph = 0;
45#endif
46 do { 43 do {
47 int ret = unwind_frame(NULL, &frame); 44 int ret = unwind_frame(NULL, &frame);
48 if (ret < 0) 45 if (ret < 0)
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index 8c03456dade6..d3313797cca9 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -100,18 +100,17 @@ void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
100 return; 100 return;
101 101
102 if (tsk == current) { 102 if (tsk == current) {
103 frame.fp = (unsigned long)__builtin_frame_address(0); 103 start_backtrace(&frame,
104 frame.pc = (unsigned long)dump_backtrace; 104 (unsigned long)__builtin_frame_address(0),
105 (unsigned long)dump_backtrace);
105 } else { 106 } else {
106 /* 107 /*
107 * task blocked in __switch_to 108 * task blocked in __switch_to
108 */ 109 */
109 frame.fp = thread_saved_fp(tsk); 110 start_backtrace(&frame,
110 frame.pc = thread_saved_pc(tsk); 111 thread_saved_fp(tsk),
112 thread_saved_pc(tsk));
111 } 113 }
112#ifdef CONFIG_FUNCTION_GRAPH_TRACER
113 frame.graph = 0;
114#endif
115 114
116 printk("Call trace:\n"); 115 printk("Call trace:\n");
117 do { 116 do {
diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile
index 4ab863045188..dd2514bb1511 100644
--- a/arch/arm64/kernel/vdso/Makefile
+++ b/arch/arm64/kernel/vdso/Makefile
@@ -32,10 +32,10 @@ UBSAN_SANITIZE := n
32OBJECT_FILES_NON_STANDARD := y 32OBJECT_FILES_NON_STANDARD := y
33KCOV_INSTRUMENT := n 33KCOV_INSTRUMENT := n
34 34
35ifeq ($(c-gettimeofday-y),)
36CFLAGS_vgettimeofday.o = -O2 -mcmodel=tiny 35CFLAGS_vgettimeofday.o = -O2 -mcmodel=tiny
37else 36
38CFLAGS_vgettimeofday.o = -O2 -mcmodel=tiny -include $(c-gettimeofday-y) 37ifneq ($(c-gettimeofday-y),)
38 CFLAGS_vgettimeofday.o += -include $(c-gettimeofday-y)
39endif 39endif
40 40
41# Clang versions less than 8 do not support -mcmodel=tiny 41# Clang versions less than 8 do not support -mcmodel=tiny
@@ -57,8 +57,7 @@ $(obj)/vdso.o : $(obj)/vdso.so
57 57
58# Link rule for the .so file, .lds has to be first 58# Link rule for the .so file, .lds has to be first
59$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE 59$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE
60 $(call if_changed,ld) 60 $(call if_changed,vdsold_and_vdso_check)
61 $(call if_changed,vdso_check)
62 61
63# Strip rule for the .so file 62# Strip rule for the .so file
64$(obj)/%.so: OBJCOPYFLAGS := -S 63$(obj)/%.so: OBJCOPYFLAGS := -S
@@ -74,8 +73,8 @@ include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE
74 $(call if_changed,vdsosym) 73 $(call if_changed,vdsosym)
75 74
76# Actual build commands 75# Actual build commands
77quiet_cmd_vdsocc = VDSOCC $@ 76quiet_cmd_vdsold_and_vdso_check = LD $@
78 cmd_vdsocc = $(CC) $(a_flags) $(c_flags) -c -o $@ $< 77 cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check)
79 78
80# Install commands for the unstripped file 79# Install commands for the unstripped file
81quiet_cmd_vdso_install = INSTALL $@ 80quiet_cmd_vdso_install = INSTALL $@
diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
index 60a4c6239712..1fba0776ed40 100644
--- a/arch/arm64/kernel/vdso32/Makefile
+++ b/arch/arm64/kernel/vdso32/Makefile
@@ -144,8 +144,7 @@ $(obj)/vdso.so.dbg: $(obj)/vdso.so.raw $(obj)/$(munge) FORCE
144 144
145# Link rule for the .so file, .lds has to be first 145# Link rule for the .so file, .lds has to be first
146$(obj)/vdso.so.raw: $(src)/vdso.lds $(obj-vdso) FORCE 146$(obj)/vdso.so.raw: $(src)/vdso.lds $(obj-vdso) FORCE
147 $(call if_changed,vdsold) 147 $(call if_changed,vdsold_and_vdso_check)
148 $(call if_changed,vdso_check)
149 148
150# Compilation rules for the vDSO sources 149# Compilation rules for the vDSO sources
151$(c-obj-vdso): %.o: %.c FORCE 150$(c-obj-vdso): %.o: %.c FORCE
@@ -156,14 +155,17 @@ $(asm-obj-vdso): %.o: %.S FORCE
156 $(call if_changed_dep,vdsoas) 155 $(call if_changed_dep,vdsoas)
157 156
158# Actual build commands 157# Actual build commands
159quiet_cmd_vdsold = VDSOL $@ 158quiet_cmd_vdsold_and_vdso_check = LD32 $@
159 cmd_vdsold_and_vdso_check = $(cmd_vdsold); $(cmd_vdso_check)
160
161quiet_cmd_vdsold = LD32 $@
160 cmd_vdsold = $(COMPATCC) -Wp,-MD,$(depfile) $(VDSO_LDFLAGS) \ 162 cmd_vdsold = $(COMPATCC) -Wp,-MD,$(depfile) $(VDSO_LDFLAGS) \
161 -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@ 163 -Wl,-T $(filter %.lds,$^) $(filter %.o,$^) -o $@
162quiet_cmd_vdsocc = VDSOC $@ 164quiet_cmd_vdsocc = CC32 $@
163 cmd_vdsocc = $(COMPATCC) -Wp,-MD,$(depfile) $(VDSO_CFLAGS) -c -o $@ $< 165 cmd_vdsocc = $(COMPATCC) -Wp,-MD,$(depfile) $(VDSO_CFLAGS) -c -o $@ $<
164quiet_cmd_vdsocc_gettimeofday = VDSOC_GTD $@ 166quiet_cmd_vdsocc_gettimeofday = CC32 $@
165 cmd_vdsocc_gettimeofday = $(COMPATCC) -Wp,-MD,$(depfile) $(VDSO_CFLAGS) $(VDSO_CFLAGS_gettimeofday_o) -c -o $@ $< 167 cmd_vdsocc_gettimeofday = $(COMPATCC) -Wp,-MD,$(depfile) $(VDSO_CFLAGS) $(VDSO_CFLAGS_gettimeofday_o) -c -o $@ $<
166quiet_cmd_vdsoas = VDSOA $@ 168quiet_cmd_vdsoas = AS32 $@
167 cmd_vdsoas = $(COMPATCC) -Wp,-MD,$(depfile) $(VDSO_AFLAGS) -c -o $@ $< 169 cmd_vdsoas = $(COMPATCC) -Wp,-MD,$(depfile) $(VDSO_AFLAGS) -c -o $@ $<
168 170
169quiet_cmd_vdsomunge = MUNGE $@ 171quiet_cmd_vdsomunge = MUNGE $@
diff --git a/arch/csky/include/uapi/asm/byteorder.h b/arch/csky/include/uapi/asm/byteorder.h
index b079ec715cdf..d150cd664873 100644
--- a/arch/csky/include/uapi/asm/byteorder.h
+++ b/arch/csky/include/uapi/asm/byteorder.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. 2// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
3 3
4#ifndef __ASM_CSKY_BYTEORDER_H 4#ifndef __ASM_CSKY_BYTEORDER_H
diff --git a/arch/csky/include/uapi/asm/cachectl.h b/arch/csky/include/uapi/asm/cachectl.h
index ddf2f39aa925..ed7fad1ea20d 100644
--- a/arch/csky/include/uapi/asm/cachectl.h
+++ b/arch/csky/include/uapi/asm/cachectl.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 2
3#ifndef __ASM_CSKY_CACHECTL_H 3#ifndef __ASM_CSKY_CACHECTL_H
4#define __ASM_CSKY_CACHECTL_H 4#define __ASM_CSKY_CACHECTL_H
diff --git a/arch/csky/include/uapi/asm/perf_regs.h b/arch/csky/include/uapi/asm/perf_regs.h
index ee323d818592..49d4e147a559 100644
--- a/arch/csky/include/uapi/asm/perf_regs.h
+++ b/arch/csky/include/uapi/asm/perf_regs.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2// Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd. 2// Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd.
3 3
4#ifndef _ASM_CSKY_PERF_REGS_H 4#ifndef _ASM_CSKY_PERF_REGS_H
diff --git a/arch/csky/include/uapi/asm/ptrace.h b/arch/csky/include/uapi/asm/ptrace.h
index 4e248d5b86ef..66b2268e324e 100644
--- a/arch/csky/include/uapi/asm/ptrace.h
+++ b/arch/csky/include/uapi/asm/ptrace.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. 2// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
3 3
4#ifndef _CSKY_PTRACE_H 4#ifndef _CSKY_PTRACE_H
diff --git a/arch/csky/include/uapi/asm/sigcontext.h b/arch/csky/include/uapi/asm/sigcontext.h
index e81e7ff11e36..670c020f2cb8 100644
--- a/arch/csky/include/uapi/asm/sigcontext.h
+++ b/arch/csky/include/uapi/asm/sigcontext.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. 2// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
3 3
4#ifndef __ASM_CSKY_SIGCONTEXT_H 4#ifndef __ASM_CSKY_SIGCONTEXT_H
diff --git a/arch/csky/include/uapi/asm/unistd.h b/arch/csky/include/uapi/asm/unistd.h
index ec60e49cea66..211c983c7282 100644
--- a/arch/csky/include/uapi/asm/unistd.h
+++ b/arch/csky/include/uapi/asm/unistd.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. 2// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
3 3
4#define __ARCH_WANT_SYS_CLONE 4#define __ARCH_WANT_SYS_CLONE
diff --git a/arch/nds32/include/uapi/asm/auxvec.h b/arch/nds32/include/uapi/asm/auxvec.h
index b5d58ea8decb..bc0b92ab8c15 100644
--- a/arch/nds32/include/uapi/asm/auxvec.h
+++ b/arch/nds32/include/uapi/asm/auxvec.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2// Copyright (C) 2005-2017 Andes Technology Corporation 2// Copyright (C) 2005-2017 Andes Technology Corporation
3 3
4#ifndef __ASM_AUXVEC_H 4#ifndef __ASM_AUXVEC_H
diff --git a/arch/nds32/include/uapi/asm/byteorder.h b/arch/nds32/include/uapi/asm/byteorder.h
index 511e653c709d..c264ef12c49c 100644
--- a/arch/nds32/include/uapi/asm/byteorder.h
+++ b/arch/nds32/include/uapi/asm/byteorder.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2// Copyright (C) 2005-2017 Andes Technology Corporation 2// Copyright (C) 2005-2017 Andes Technology Corporation
3 3
4#ifndef __NDS32_BYTEORDER_H__ 4#ifndef __NDS32_BYTEORDER_H__
diff --git a/arch/nds32/include/uapi/asm/cachectl.h b/arch/nds32/include/uapi/asm/cachectl.h
index 73793662815c..31b9b439d819 100644
--- a/arch/nds32/include/uapi/asm/cachectl.h
+++ b/arch/nds32/include/uapi/asm/cachectl.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2// Copyright (C) 1994, 1995, 1996 by Ralf Baechle 2// Copyright (C) 1994, 1995, 1996 by Ralf Baechle
3// Copyright (C) 2005-2017 Andes Technology Corporation 3// Copyright (C) 2005-2017 Andes Technology Corporation
4#ifndef _ASM_CACHECTL 4#ifndef _ASM_CACHECTL
diff --git a/arch/nds32/include/uapi/asm/fp_udfiex_crtl.h b/arch/nds32/include/uapi/asm/fp_udfiex_crtl.h
index d54a5d6c6538..f17396db16ec 100644
--- a/arch/nds32/include/uapi/asm/fp_udfiex_crtl.h
+++ b/arch/nds32/include/uapi/asm/fp_udfiex_crtl.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2/* Copyright (C) 2005-2019 Andes Technology Corporation */ 2/* Copyright (C) 2005-2019 Andes Technology Corporation */
3#ifndef _FP_UDF_IEX_CRTL_H 3#ifndef _FP_UDF_IEX_CRTL_H
4#define _FP_UDF_IEX_CRTL_H 4#define _FP_UDF_IEX_CRTL_H
diff --git a/arch/nds32/include/uapi/asm/param.h b/arch/nds32/include/uapi/asm/param.h
index 2977534a6bd3..48d00328d328 100644
--- a/arch/nds32/include/uapi/asm/param.h
+++ b/arch/nds32/include/uapi/asm/param.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2// Copyright (C) 2005-2017 Andes Technology Corporation 2// Copyright (C) 2005-2017 Andes Technology Corporation
3 3
4#ifndef __ASM_NDS32_PARAM_H 4#ifndef __ASM_NDS32_PARAM_H
diff --git a/arch/nds32/include/uapi/asm/ptrace.h b/arch/nds32/include/uapi/asm/ptrace.h
index 1a6e01c00e6f..d76217c7c010 100644
--- a/arch/nds32/include/uapi/asm/ptrace.h
+++ b/arch/nds32/include/uapi/asm/ptrace.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2// Copyright (C) 2005-2017 Andes Technology Corporation 2// Copyright (C) 2005-2017 Andes Technology Corporation
3 3
4#ifndef __UAPI_ASM_NDS32_PTRACE_H 4#ifndef __UAPI_ASM_NDS32_PTRACE_H
diff --git a/arch/nds32/include/uapi/asm/sigcontext.h b/arch/nds32/include/uapi/asm/sigcontext.h
index dc89af7ddcc3..6c1e6648878f 100644
--- a/arch/nds32/include/uapi/asm/sigcontext.h
+++ b/arch/nds32/include/uapi/asm/sigcontext.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2// Copyright (C) 2005-2017 Andes Technology Corporation 2// Copyright (C) 2005-2017 Andes Technology Corporation
3 3
4#ifndef _ASMNDS32_SIGCONTEXT_H 4#ifndef _ASMNDS32_SIGCONTEXT_H
diff --git a/arch/nds32/include/uapi/asm/unistd.h b/arch/nds32/include/uapi/asm/unistd.h
index a0b2f7b9c0f2..410795e280fe 100644
--- a/arch/nds32/include/uapi/asm/unistd.h
+++ b/arch/nds32/include/uapi/asm/unistd.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2// Copyright (C) 2005-2017 Andes Technology Corporation 2// Copyright (C) 2005-2017 Andes Technology Corporation
3 3
4#define __ARCH_WANT_STAT64 4#define __ARCH_WANT_STAT64
diff --git a/arch/parisc/include/asm/kprobes.h b/arch/parisc/include/asm/kprobes.h
index e09cf2deeafe..904034da4974 100644
--- a/arch/parisc/include/asm/kprobes.h
+++ b/arch/parisc/include/asm/kprobes.h
@@ -50,6 +50,10 @@ struct kprobe_ctlblk {
50 50
51int __kprobes parisc_kprobe_break_handler(struct pt_regs *regs); 51int __kprobes parisc_kprobe_break_handler(struct pt_regs *regs);
52int __kprobes parisc_kprobe_ss_handler(struct pt_regs *regs); 52int __kprobes parisc_kprobe_ss_handler(struct pt_regs *regs);
53static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
54{
55 return 0;
56}
53 57
54#endif /* CONFIG_KPROBES */ 58#endif /* CONFIG_KPROBES */
55#endif /* _PARISC_KPROBES_H */ 59#endif /* _PARISC_KPROBES_H */
diff --git a/arch/parisc/kernel/pacache.S b/arch/parisc/kernel/pacache.S
index ba67893a1d72..df46b0e5a915 100644
--- a/arch/parisc/kernel/pacache.S
+++ b/arch/parisc/kernel/pacache.S
@@ -63,7 +63,7 @@ ENTRY_CFI(flush_tlb_all_local)
63 63
64 /* Flush Instruction Tlb */ 64 /* Flush Instruction Tlb */
65 65
66 LDREG ITLB_SID_BASE(%r1), %r20 6688: LDREG ITLB_SID_BASE(%r1), %r20
67 LDREG ITLB_SID_STRIDE(%r1), %r21 67 LDREG ITLB_SID_STRIDE(%r1), %r21
68 LDREG ITLB_SID_COUNT(%r1), %r22 68 LDREG ITLB_SID_COUNT(%r1), %r22
69 LDREG ITLB_OFF_BASE(%r1), %arg0 69 LDREG ITLB_OFF_BASE(%r1), %arg0
@@ -103,6 +103,7 @@ fitonemiddle: /* Loop if LOOP = 1 */
103 add %r21, %r20, %r20 /* increment space */ 103 add %r21, %r20, %r20 /* increment space */
104 104
105fitdone: 105fitdone:
106 ALTERNATIVE(88b, fitdone, ALT_COND_NO_SPLIT_TLB, INSN_NOP)
106 107
107 /* Flush Data Tlb */ 108 /* Flush Data Tlb */
108 109
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index d8dcd8820369..77f6ebf97113 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -121,6 +121,7 @@ config PPC
121 select ARCH_32BIT_OFF_T if PPC32 121 select ARCH_32BIT_OFF_T if PPC32
122 select ARCH_HAS_DEBUG_VIRTUAL 122 select ARCH_HAS_DEBUG_VIRTUAL
123 select ARCH_HAS_DEVMEM_IS_ALLOWED 123 select ARCH_HAS_DEVMEM_IS_ALLOWED
124 select ARCH_HAS_DMA_MMAP_PGPROT
124 select ARCH_HAS_ELF_RANDOMIZE 125 select ARCH_HAS_ELF_RANDOMIZE
125 select ARCH_HAS_FORTIFY_SOURCE 126 select ARCH_HAS_FORTIFY_SOURCE
126 select ARCH_HAS_GCOV_PROFILE_ALL 127 select ARCH_HAS_GCOV_PROFILE_ALL
diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
index 463c63a9fcf1..11112023e327 100644
--- a/arch/powerpc/include/asm/hvcall.h
+++ b/arch/powerpc/include/asm/hvcall.h
@@ -302,9 +302,14 @@
302#define H_SCM_UNBIND_MEM 0x3F0 302#define H_SCM_UNBIND_MEM 0x3F0
303#define H_SCM_QUERY_BLOCK_MEM_BINDING 0x3F4 303#define H_SCM_QUERY_BLOCK_MEM_BINDING 0x3F4
304#define H_SCM_QUERY_LOGICAL_MEM_BINDING 0x3F8 304#define H_SCM_QUERY_LOGICAL_MEM_BINDING 0x3F8
305#define H_SCM_MEM_QUERY 0x3FC 305#define H_SCM_UNBIND_ALL 0x3FC
306#define H_SCM_BLOCK_CLEAR 0x400 306#define H_SCM_HEALTH 0x400
307#define MAX_HCALL_OPCODE H_SCM_BLOCK_CLEAR 307#define H_SCM_PERFORMANCE_STATS 0x418
308#define MAX_HCALL_OPCODE H_SCM_PERFORMANCE_STATS
309
310/* Scope args for H_SCM_UNBIND_ALL */
311#define H_UNBIND_SCOPE_ALL (0x1)
312#define H_UNBIND_SCOPE_DRC (0x2)
308 313
309/* H_VIOCTL functions */ 314/* H_VIOCTL functions */
310#define H_GET_VIOA_DUMP_SIZE 0x01 315#define H_GET_VIOA_DUMP_SIZE 0x01
diff --git a/arch/powerpc/include/asm/pmc.h b/arch/powerpc/include/asm/pmc.h
index dc9a1ca70edf..c6bbe9778d3c 100644
--- a/arch/powerpc/include/asm/pmc.h
+++ b/arch/powerpc/include/asm/pmc.h
@@ -27,11 +27,10 @@ static inline void ppc_set_pmu_inuse(int inuse)
27#ifdef CONFIG_PPC_PSERIES 27#ifdef CONFIG_PPC_PSERIES
28 get_lppaca()->pmcregs_in_use = inuse; 28 get_lppaca()->pmcregs_in_use = inuse;
29#endif 29#endif
30 } else { 30 }
31#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE 31#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
32 get_paca()->pmcregs_in_use = inuse; 32 get_paca()->pmcregs_in_use = inuse;
33#endif 33#endif
34 }
35#endif 34#endif
36} 35}
37 36
diff --git a/arch/powerpc/include/uapi/asm/bpf_perf_event.h b/arch/powerpc/include/uapi/asm/bpf_perf_event.h
index b551b741653d..5e1e648aeec4 100644
--- a/arch/powerpc/include/uapi/asm/bpf_perf_event.h
+++ b/arch/powerpc/include/uapi/asm/bpf_perf_event.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__ 2#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__
3#define _UAPI__ASM_BPF_PERF_EVENT_H__ 3#define _UAPI__ASM_BPF_PERF_EVENT_H__
4 4
diff --git a/arch/powerpc/include/uapi/asm/kvm_para.h b/arch/powerpc/include/uapi/asm/kvm_para.h
index 01555c6ae0f5..be48c2215fa2 100644
--- a/arch/powerpc/include/uapi/asm/kvm_para.h
+++ b/arch/powerpc/include/uapi/asm/kvm_para.h
@@ -31,7 +31,7 @@
31 * Struct fields are always 32 or 64 bit aligned, depending on them being 32 31 * Struct fields are always 32 or 64 bit aligned, depending on them being 32
32 * or 64 bit wide respectively. 32 * or 64 bit wide respectively.
33 * 33 *
34 * See Documentation/virtual/kvm/ppc-pv.txt 34 * See Documentation/virt/kvm/ppc-pv.txt
35 */ 35 */
36struct kvm_vcpu_arch_shared { 36struct kvm_vcpu_arch_shared {
37 __u64 scratch1; 37 __u64 scratch1;
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 56dfa7a2a6f2..ea0c69236789 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -49,7 +49,8 @@ obj-y := cputable.o ptrace.o syscalls.o \
49 signal.o sysfs.o cacheinfo.o time.o \ 49 signal.o sysfs.o cacheinfo.o time.o \
50 prom.o traps.o setup-common.o \ 50 prom.o traps.o setup-common.o \
51 udbg.o misc.o io.o misc_$(BITS).o \ 51 udbg.o misc.o io.o misc_$(BITS).o \
52 of_platform.o prom_parse.o 52 of_platform.o prom_parse.o \
53 dma-common.o
53obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \ 54obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \
54 signal_64.o ptrace32.o \ 55 signal_64.o ptrace32.o \
55 paca.o nvram_64.o firmware.o 56 paca.o nvram_64.o firmware.o
diff --git a/arch/powerpc/kernel/dma-common.c b/arch/powerpc/kernel/dma-common.c
new file mode 100644
index 000000000000..dc7ef6b17b69
--- /dev/null
+++ b/arch/powerpc/kernel/dma-common.c
@@ -0,0 +1,17 @@
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Contains common dma routines for all powerpc platforms.
4 *
5 * Copyright (C) 2019 Shawn Anastasio.
6 */
7
8#include <linux/mm.h>
9#include <linux/dma-noncoherent.h>
10
11pgprot_t arch_dma_mmap_pgprot(struct device *dev, pgprot_t prot,
12 unsigned long attrs)
13{
14 if (!dev_is_dma_coherent(dev))
15 return pgprot_noncached(prot);
16 return prot;
17}
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index eee5bef736c8..6ba3cc2ef8ab 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -1531,7 +1531,7 @@ EXC_COMMON(trap_0b_common, 0xb00, unknown_exception)
1531 * 1531 *
1532 * Call convention: 1532 * Call convention:
1533 * 1533 *
1534 * syscall register convention is in Documentation/powerpc/syscall64-abi.txt 1534 * syscall register convention is in Documentation/powerpc/syscall64-abi.rst
1535 * 1535 *
1536 * For hypercalls, the register convention is as follows: 1536 * For hypercalls, the register convention is as follows:
1537 * r0 volatile 1537 * r0 volatile
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index f50b708d6d77..98600b276f76 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -1198,6 +1198,9 @@ SYSCALL_DEFINE0(rt_sigreturn)
1198 goto bad; 1198 goto bad;
1199 1199
1200 if (MSR_TM_ACTIVE(msr_hi<<32)) { 1200 if (MSR_TM_ACTIVE(msr_hi<<32)) {
1201 /* Trying to start TM on non TM system */
1202 if (!cpu_has_feature(CPU_FTR_TM))
1203 goto bad;
1201 /* We only recheckpoint on return if we're 1204 /* We only recheckpoint on return if we're
1202 * transaction. 1205 * transaction.
1203 */ 1206 */
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 2f80e270c7b0..117515564ec7 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -771,6 +771,11 @@ SYSCALL_DEFINE0(rt_sigreturn)
771 if (MSR_TM_ACTIVE(msr)) { 771 if (MSR_TM_ACTIVE(msr)) {
772 /* We recheckpoint on return. */ 772 /* We recheckpoint on return. */
773 struct ucontext __user *uc_transact; 773 struct ucontext __user *uc_transact;
774
775 /* Trying to start TM on non TM system */
776 if (!cpu_has_feature(CPU_FTR_TM))
777 goto badframe;
778
774 if (__get_user(uc_transact, &uc->uc_link)) 779 if (__get_user(uc_transact, &uc->uc_link))
775 goto badframe; 780 goto badframe;
776 if (restore_tm_sigcontexts(current, &uc->uc_mcontext, 781 if (restore_tm_sigcontexts(current, &uc->uc_mcontext,
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index ec1804f822af..cde3f5a4b3e4 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -3569,9 +3569,18 @@ int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit,
3569 mtspr(SPRN_DEC, vcpu->arch.dec_expires - mftb()); 3569 mtspr(SPRN_DEC, vcpu->arch.dec_expires - mftb());
3570 3570
3571 if (kvmhv_on_pseries()) { 3571 if (kvmhv_on_pseries()) {
3572 /*
3573 * We need to save and restore the guest visible part of the
3574 * psscr (i.e. using SPRN_PSSCR_PR) since the hypervisor
3575 * doesn't do this for us. Note only required if pseries since
3576 * this is done in kvmhv_load_hv_regs_and_go() below otherwise.
3577 */
3578 unsigned long host_psscr;
3572 /* call our hypervisor to load up HV regs and go */ 3579 /* call our hypervisor to load up HV regs and go */
3573 struct hv_guest_state hvregs; 3580 struct hv_guest_state hvregs;
3574 3581
3582 host_psscr = mfspr(SPRN_PSSCR_PR);
3583 mtspr(SPRN_PSSCR_PR, vcpu->arch.psscr);
3575 kvmhv_save_hv_regs(vcpu, &hvregs); 3584 kvmhv_save_hv_regs(vcpu, &hvregs);
3576 hvregs.lpcr = lpcr; 3585 hvregs.lpcr = lpcr;
3577 vcpu->arch.regs.msr = vcpu->arch.shregs.msr; 3586 vcpu->arch.regs.msr = vcpu->arch.shregs.msr;
@@ -3590,6 +3599,8 @@ int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit,
3590 vcpu->arch.shregs.msr = vcpu->arch.regs.msr; 3599 vcpu->arch.shregs.msr = vcpu->arch.regs.msr;
3591 vcpu->arch.shregs.dar = mfspr(SPRN_DAR); 3600 vcpu->arch.shregs.dar = mfspr(SPRN_DAR);
3592 vcpu->arch.shregs.dsisr = mfspr(SPRN_DSISR); 3601 vcpu->arch.shregs.dsisr = mfspr(SPRN_DSISR);
3602 vcpu->arch.psscr = mfspr(SPRN_PSSCR_PR);
3603 mtspr(SPRN_PSSCR_PR, host_psscr);
3593 3604
3594 /* H_CEDE has to be handled now, not later */ 3605 /* H_CEDE has to be handled now, not later */
3595 if (trap == BOOK3S_INTERRUPT_SYSCALL && !vcpu->arch.nested && 3606 if (trap == BOOK3S_INTERRUPT_SYSCALL && !vcpu->arch.nested &&
@@ -3654,6 +3665,8 @@ int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit,
3654 vcpu->arch.vpa.dirty = 1; 3665 vcpu->arch.vpa.dirty = 1;
3655 save_pmu = lp->pmcregs_in_use; 3666 save_pmu = lp->pmcregs_in_use;
3656 } 3667 }
3668 /* Must save pmu if this guest is capable of running nested guests */
3669 save_pmu |= nesting_enabled(vcpu->kvm);
3657 3670
3658 kvmhv_save_guest_pmu(vcpu, save_pmu); 3671 kvmhv_save_guest_pmu(vcpu, save_pmu);
3659 3672
diff --git a/arch/powerpc/kvm/book3s_xive.c b/arch/powerpc/kvm/book3s_xive.c
index 6ca0d7376a9f..e3ba67095895 100644
--- a/arch/powerpc/kvm/book3s_xive.c
+++ b/arch/powerpc/kvm/book3s_xive.c
@@ -1986,10 +1986,8 @@ static int kvmppc_xive_create(struct kvm_device *dev, u32 type)
1986 1986
1987 xive->single_escalation = xive_native_has_single_escalation(); 1987 xive->single_escalation = xive_native_has_single_escalation();
1988 1988
1989 if (ret) { 1989 if (ret)
1990 kfree(xive);
1991 return ret; 1990 return ret;
1992 }
1993 1991
1994 return 0; 1992 return 0;
1995} 1993}
diff --git a/arch/powerpc/kvm/book3s_xive_native.c b/arch/powerpc/kvm/book3s_xive_native.c
index 5596c8ec221a..a998823f68a3 100644
--- a/arch/powerpc/kvm/book3s_xive_native.c
+++ b/arch/powerpc/kvm/book3s_xive_native.c
@@ -1090,9 +1090,9 @@ static int kvmppc_xive_native_create(struct kvm_device *dev, u32 type)
1090 xive->ops = &kvmppc_xive_native_ops; 1090 xive->ops = &kvmppc_xive_native_ops;
1091 1091
1092 if (ret) 1092 if (ret)
1093 kfree(xive); 1093 return ret;
1094 1094
1095 return ret; 1095 return 0;
1096} 1096}
1097 1097
1098/* 1098/*
diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c
index 9a5963e07a82..b8ad14bb1170 100644
--- a/arch/powerpc/mm/book3s64/hash_utils.c
+++ b/arch/powerpc/mm/book3s64/hash_utils.c
@@ -1899,11 +1899,20 @@ void hash__setup_initial_memory_limit(phys_addr_t first_memblock_base,
1899 * 1899 *
1900 * For guests on platforms before POWER9, we clamp the it limit to 1G 1900 * For guests on platforms before POWER9, we clamp the it limit to 1G
1901 * to avoid some funky things such as RTAS bugs etc... 1901 * to avoid some funky things such as RTAS bugs etc...
1902 *
1903 * On POWER9 we limit to 1TB in case the host erroneously told us that
1904 * the RMA was >1TB. Effective address bits 0:23 are treated as zero
1905 * (meaning the access is aliased to zero i.e. addr = addr % 1TB)
1906 * for virtual real mode addressing and so it doesn't make sense to
1907 * have an area larger than 1TB as it can't be addressed.
1902 */ 1908 */
1903 if (!early_cpu_has_feature(CPU_FTR_HVMODE)) { 1909 if (!early_cpu_has_feature(CPU_FTR_HVMODE)) {
1904 ppc64_rma_size = first_memblock_size; 1910 ppc64_rma_size = first_memblock_size;
1905 if (!early_cpu_has_feature(CPU_FTR_ARCH_300)) 1911 if (!early_cpu_has_feature(CPU_FTR_ARCH_300))
1906 ppc64_rma_size = min_t(u64, ppc64_rma_size, 0x40000000); 1912 ppc64_rma_size = min_t(u64, ppc64_rma_size, 0x40000000);
1913 else
1914 ppc64_rma_size = min_t(u64, ppc64_rma_size,
1915 1UL << SID_SHIFT_1T);
1907 1916
1908 /* Finally limit subsequent allocations */ 1917 /* Finally limit subsequent allocations */
1909 memblock_set_current_limit(ppc64_rma_size); 1918 memblock_set_current_limit(ppc64_rma_size);
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 9259337d7374..9191a66b3bc5 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -239,7 +239,7 @@ void __init paging_init(void)
239 239
240#ifdef CONFIG_ZONE_DMA 240#ifdef CONFIG_ZONE_DMA
241 max_zone_pfns[ZONE_DMA] = min(max_low_pfn, 241 max_zone_pfns[ZONE_DMA] = min(max_low_pfn,
242 ((1UL << ARCH_ZONE_DMA_BITS) - 1) >> PAGE_SHIFT); 242 1UL << (ARCH_ZONE_DMA_BITS - PAGE_SHIFT));
243#endif 243#endif
244 max_zone_pfns[ZONE_NORMAL] = max_low_pfn; 244 max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
245#ifdef CONFIG_HIGHMEM 245#ifdef CONFIG_HIGHMEM
diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c
index c8ec670ee924..2c07908359b2 100644
--- a/arch/powerpc/platforms/pseries/papr_scm.c
+++ b/arch/powerpc/platforms/pseries/papr_scm.c
@@ -11,6 +11,7 @@
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <linux/libnvdimm.h> 12#include <linux/libnvdimm.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/delay.h>
14 15
15#include <asm/plpar_wrappers.h> 16#include <asm/plpar_wrappers.h>
16 17
@@ -43,8 +44,9 @@ struct papr_scm_priv {
43static int drc_pmem_bind(struct papr_scm_priv *p) 44static int drc_pmem_bind(struct papr_scm_priv *p)
44{ 45{
45 unsigned long ret[PLPAR_HCALL_BUFSIZE]; 46 unsigned long ret[PLPAR_HCALL_BUFSIZE];
46 uint64_t rc, token;
47 uint64_t saved = 0; 47 uint64_t saved = 0;
48 uint64_t token;
49 int64_t rc;
48 50
49 /* 51 /*
50 * When the hypervisor cannot map all the requested memory in a single 52 * When the hypervisor cannot map all the requested memory in a single
@@ -64,6 +66,10 @@ static int drc_pmem_bind(struct papr_scm_priv *p)
64 } while (rc == H_BUSY); 66 } while (rc == H_BUSY);
65 67
66 if (rc) { 68 if (rc) {
69 /* H_OVERLAP needs a separate error path */
70 if (rc == H_OVERLAP)
71 return -EBUSY;
72
67 dev_err(&p->pdev->dev, "bind err: %lld\n", rc); 73 dev_err(&p->pdev->dev, "bind err: %lld\n", rc);
68 return -ENXIO; 74 return -ENXIO;
69 } 75 }
@@ -78,22 +84,36 @@ static int drc_pmem_bind(struct papr_scm_priv *p)
78static int drc_pmem_unbind(struct papr_scm_priv *p) 84static int drc_pmem_unbind(struct papr_scm_priv *p)
79{ 85{
80 unsigned long ret[PLPAR_HCALL_BUFSIZE]; 86 unsigned long ret[PLPAR_HCALL_BUFSIZE];
81 uint64_t rc, token; 87 uint64_t token = 0;
88 int64_t rc;
82 89
83 token = 0; 90 dev_dbg(&p->pdev->dev, "unbind drc %x\n", p->drc_index);
84 91
85 /* NB: unbind has the same retry requirements mentioned above */ 92 /* NB: unbind has the same retry requirements as drc_pmem_bind() */
86 do { 93 do {
87 rc = plpar_hcall(H_SCM_UNBIND_MEM, ret, p->drc_index, 94
88 p->bound_addr, p->blocks, token); 95 /* Unbind of all SCM resources associated with drcIndex */
96 rc = plpar_hcall(H_SCM_UNBIND_ALL, ret, H_UNBIND_SCOPE_DRC,
97 p->drc_index, token);
89 token = ret[0]; 98 token = ret[0];
90 cond_resched(); 99
100 /* Check if we are stalled for some time */
101 if (H_IS_LONG_BUSY(rc)) {
102 msleep(get_longbusy_msecs(rc));
103 rc = H_BUSY;
104 } else if (rc == H_BUSY) {
105 cond_resched();
106 }
107
91 } while (rc == H_BUSY); 108 } while (rc == H_BUSY);
92 109
93 if (rc) 110 if (rc)
94 dev_err(&p->pdev->dev, "unbind error: %lld\n", rc); 111 dev_err(&p->pdev->dev, "unbind error: %lld\n", rc);
112 else
113 dev_dbg(&p->pdev->dev, "unbind drc %x complete\n",
114 p->drc_index);
95 115
96 return !!rc; 116 return rc == H_SUCCESS ? 0 : -ENXIO;
97} 117}
98 118
99static int papr_scm_meta_get(struct papr_scm_priv *p, 119static int papr_scm_meta_get(struct papr_scm_priv *p,
@@ -389,6 +409,14 @@ static int papr_scm_probe(struct platform_device *pdev)
389 409
390 /* request the hypervisor to bind this region to somewhere in memory */ 410 /* request the hypervisor to bind this region to somewhere in memory */
391 rc = drc_pmem_bind(p); 411 rc = drc_pmem_bind(p);
412
413 /* If phyp says drc memory still bound then force unbound and retry */
414 if (rc == -EBUSY) {
415 dev_warn(&pdev->dev, "Retrying bind after unbinding\n");
416 drc_pmem_unbind(p);
417 rc = drc_pmem_bind(p);
418 }
419
392 if (rc) 420 if (rc)
393 goto err; 421 goto err;
394 422
diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
index 082c7e1c20f0..1cdb39575eae 100644
--- a/arch/powerpc/sysdev/xive/common.c
+++ b/arch/powerpc/sysdev/xive/common.c
@@ -479,7 +479,7 @@ static int xive_find_target_in_mask(const struct cpumask *mask,
479 * Now go through the entire mask until we find a valid 479 * Now go through the entire mask until we find a valid
480 * target. 480 * target.
481 */ 481 */
482 for (;;) { 482 do {
483 /* 483 /*
484 * We re-check online as the fallback case passes us 484 * We re-check online as the fallback case passes us
485 * an untested affinity mask 485 * an untested affinity mask
@@ -487,12 +487,11 @@ static int xive_find_target_in_mask(const struct cpumask *mask,
487 if (cpu_online(cpu) && xive_try_pick_target(cpu)) 487 if (cpu_online(cpu) && xive_try_pick_target(cpu))
488 return cpu; 488 return cpu;
489 cpu = cpumask_next(cpu, mask); 489 cpu = cpumask_next(cpu, mask);
490 if (cpu == first)
491 break;
492 /* Wrap around */ 490 /* Wrap around */
493 if (cpu >= nr_cpu_ids) 491 if (cpu >= nr_cpu_ids)
494 cpu = cpumask_first(mask); 492 cpu = cpumask_first(mask);
495 } 493 } while (cpu != first);
494
496 return -1; 495 return -1;
497} 496}
498 497
diff --git a/arch/riscv/boot/dts/sifive/fu540-c000.dtsi b/arch/riscv/boot/dts/sifive/fu540-c000.dtsi
index 40983491b95f..9bf63f0ab253 100644
--- a/arch/riscv/boot/dts/sifive/fu540-c000.dtsi
+++ b/arch/riscv/boot/dts/sifive/fu540-c000.dtsi
@@ -217,5 +217,20 @@
217 #size-cells = <0>; 217 #size-cells = <0>;
218 status = "disabled"; 218 status = "disabled";
219 }; 219 };
220 eth0: ethernet@10090000 {
221 compatible = "sifive,fu540-c000-gem";
222 interrupt-parent = <&plic0>;
223 interrupts = <53>;
224 reg = <0x0 0x10090000 0x0 0x2000
225 0x0 0x100a0000 0x0 0x1000>;
226 local-mac-address = [00 00 00 00 00 00];
227 clock-names = "pclk", "hclk";
228 clocks = <&prci PRCI_CLK_GEMGXLPLL>,
229 <&prci PRCI_CLK_GEMGXLPLL>;
230 #address-cells = <1>;
231 #size-cells = <0>;
232 status = "disabled";
233 };
234
220 }; 235 };
221}; 236};
diff --git a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts b/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
index 0b55c53c08c7..93d68cbd64fe 100644
--- a/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
+++ b/arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
@@ -76,3 +76,12 @@
76 disable-wp; 76 disable-wp;
77 }; 77 };
78}; 78};
79
80&eth0 {
81 status = "okay";
82 phy-mode = "gmii";
83 phy-handle = <&phy0>;
84 phy0: ethernet-phy@0 {
85 reg = <0>;
86 };
87};
diff --git a/arch/riscv/include/asm/Kbuild b/arch/riscv/include/asm/Kbuild
index 1efaeddf1e4b..16970f246860 100644
--- a/arch/riscv/include/asm/Kbuild
+++ b/arch/riscv/include/asm/Kbuild
@@ -22,6 +22,7 @@ generic-y += kvm_para.h
22generic-y += local.h 22generic-y += local.h
23generic-y += local64.h 23generic-y += local64.h
24generic-y += mm-arch-hooks.h 24generic-y += mm-arch-hooks.h
25generic-y += msi.h
25generic-y += percpu.h 26generic-y += percpu.h
26generic-y += preempt.h 27generic-y += preempt.h
27generic-y += sections.h 28generic-y += sections.h
diff --git a/arch/riscv/include/uapi/asm/auxvec.h b/arch/riscv/include/uapi/asm/auxvec.h
index 62716653554b..d86cb17bbabe 100644
--- a/arch/riscv/include/uapi/asm/auxvec.h
+++ b/arch/riscv/include/uapi/asm/auxvec.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0-only */ 1/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
2/* 2/*
3 * Copyright (C) 2012 ARM Ltd. 3 * Copyright (C) 2012 ARM Ltd.
4 * Copyright (C) 2015 Regents of the University of California 4 * Copyright (C) 2015 Regents of the University of California
diff --git a/arch/riscv/include/uapi/asm/bitsperlong.h b/arch/riscv/include/uapi/asm/bitsperlong.h
index 0b9b58b57ff6..7d0b32e3b701 100644
--- a/arch/riscv/include/uapi/asm/bitsperlong.h
+++ b/arch/riscv/include/uapi/asm/bitsperlong.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0-only */ 1/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
2/* 2/*
3 * Copyright (C) 2012 ARM Ltd. 3 * Copyright (C) 2012 ARM Ltd.
4 * Copyright (C) 2015 Regents of the University of California 4 * Copyright (C) 2015 Regents of the University of California
diff --git a/arch/riscv/include/uapi/asm/byteorder.h b/arch/riscv/include/uapi/asm/byteorder.h
index 1920debc09c0..f671e16bf6af 100644
--- a/arch/riscv/include/uapi/asm/byteorder.h
+++ b/arch/riscv/include/uapi/asm/byteorder.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0-only */ 1/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
2/* 2/*
3 * Copyright (C) 2012 ARM Ltd. 3 * Copyright (C) 2012 ARM Ltd.
4 * Copyright (C) 2015 Regents of the University of California 4 * Copyright (C) 2015 Regents of the University of California
diff --git a/arch/riscv/include/uapi/asm/hwcap.h b/arch/riscv/include/uapi/asm/hwcap.h
index 7d786145183b..4e7646077056 100644
--- a/arch/riscv/include/uapi/asm/hwcap.h
+++ b/arch/riscv/include/uapi/asm/hwcap.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0-only */ 1/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
2/* 2/*
3 * Copied from arch/arm64/include/asm/hwcap.h 3 * Copied from arch/arm64/include/asm/hwcap.h
4 * 4 *
diff --git a/arch/riscv/include/uapi/asm/ptrace.h b/arch/riscv/include/uapi/asm/ptrace.h
index 92d8f7cd8f84..882547f6bd5c 100644
--- a/arch/riscv/include/uapi/asm/ptrace.h
+++ b/arch/riscv/include/uapi/asm/ptrace.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0-only */ 1/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
2/* 2/*
3 * Copyright (C) 2012 Regents of the University of California 3 * Copyright (C) 2012 Regents of the University of California
4 */ 4 */
diff --git a/arch/riscv/include/uapi/asm/sigcontext.h b/arch/riscv/include/uapi/asm/sigcontext.h
index 053f809e52ce..84f2dfcfdbce 100644
--- a/arch/riscv/include/uapi/asm/sigcontext.h
+++ b/arch/riscv/include/uapi/asm/sigcontext.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0-only */ 1/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
2/* 2/*
3 * Copyright (C) 2012 Regents of the University of California 3 * Copyright (C) 2012 Regents of the University of California
4 */ 4 */
diff --git a/arch/riscv/include/uapi/asm/ucontext.h b/arch/riscv/include/uapi/asm/ucontext.h
index b58e00cee2ec..411dd7b52ed6 100644
--- a/arch/riscv/include/uapi/asm/ucontext.h
+++ b/arch/riscv/include/uapi/asm/ucontext.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0-only */ 1/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
2/* 2/*
3 * Copyright (C) 2012 ARM Ltd. 3 * Copyright (C) 2012 ARM Ltd.
4 * Copyright (C) 2017 SiFive, Inc. 4 * Copyright (C) 2017 SiFive, Inc.
diff --git a/arch/riscv/include/uapi/asm/unistd.h b/arch/riscv/include/uapi/asm/unistd.h
index 0e2eeeb1fd27..13ce76cc5aff 100644
--- a/arch/riscv/include/uapi/asm/unistd.h
+++ b/arch/riscv/include/uapi/asm/unistd.h
@@ -18,6 +18,7 @@
18#ifdef __LP64__ 18#ifdef __LP64__
19#define __ARCH_WANT_NEW_STAT 19#define __ARCH_WANT_NEW_STAT
20#define __ARCH_WANT_SET_GET_RLIMIT 20#define __ARCH_WANT_SET_GET_RLIMIT
21#define __ARCH_WANT_SYS_CLONE3
21#endif /* __LP64__ */ 22#endif /* __LP64__ */
22 23
23#include <asm-generic/unistd.h> 24#include <asm-generic/unistd.h>
diff --git a/arch/s390/boot/Makefile b/arch/s390/boot/Makefile
index 7cba96e7587b..4cf0bddb7d92 100644
--- a/arch/s390/boot/Makefile
+++ b/arch/s390/boot/Makefile
@@ -36,7 +36,7 @@ CFLAGS_sclp_early_core.o += -I$(srctree)/drivers/s390/char
36 36
37obj-y := head.o als.o startup.o mem_detect.o ipl_parm.o ipl_report.o 37obj-y := head.o als.o startup.o mem_detect.o ipl_parm.o ipl_report.o
38obj-y += string.o ebcdic.o sclp_early_core.o mem.o ipl_vmparm.o cmdline.o 38obj-y += string.o ebcdic.o sclp_early_core.o mem.o ipl_vmparm.o cmdline.o
39obj-y += ctype.o text_dma.o 39obj-y += version.o ctype.o text_dma.o
40obj-$(CONFIG_PROTECTED_VIRTUALIZATION_GUEST) += uv.o 40obj-$(CONFIG_PROTECTED_VIRTUALIZATION_GUEST) += uv.o
41obj-$(CONFIG_RELOCATABLE) += machine_kexec_reloc.o 41obj-$(CONFIG_RELOCATABLE) += machine_kexec_reloc.o
42obj-$(CONFIG_RANDOMIZE_BASE) += kaslr.o 42obj-$(CONFIG_RANDOMIZE_BASE) += kaslr.o
diff --git a/arch/s390/boot/boot.h b/arch/s390/boot/boot.h
index ad57c2205a71..082905d97309 100644
--- a/arch/s390/boot/boot.h
+++ b/arch/s390/boot/boot.h
@@ -12,6 +12,7 @@ void print_missing_facilities(void);
12unsigned long get_random_base(unsigned long safe_addr); 12unsigned long get_random_base(unsigned long safe_addr);
13 13
14extern int kaslr_enabled; 14extern int kaslr_enabled;
15extern const char kernel_version[];
15 16
16unsigned long read_ipl_report(unsigned long safe_offset); 17unsigned long read_ipl_report(unsigned long safe_offset);
17 18
diff --git a/arch/s390/boot/head.S b/arch/s390/boot/head.S
index 028aab03a9e7..2087bed6e60f 100644
--- a/arch/s390/boot/head.S
+++ b/arch/s390/boot/head.S
@@ -361,6 +361,7 @@ ENTRY(startup_kdump)
361 .quad 0 # INITRD_SIZE 361 .quad 0 # INITRD_SIZE
362 .quad 0 # OLDMEM_BASE 362 .quad 0 # OLDMEM_BASE
363 .quad 0 # OLDMEM_SIZE 363 .quad 0 # OLDMEM_SIZE
364 .quad kernel_version # points to kernel version string
364 365
365 .org COMMAND_LINE 366 .org COMMAND_LINE
366 .byte "root=/dev/ram0 ro" 367 .byte "root=/dev/ram0 ro"
diff --git a/arch/s390/boot/version.c b/arch/s390/boot/version.c
new file mode 100644
index 000000000000..d32e58bdda6a
--- /dev/null
+++ b/arch/s390/boot/version.c
@@ -0,0 +1,7 @@
1// SPDX-License-Identifier: GPL-2.0
2#include <generated/utsrelease.h>
3#include <generated/compile.h>
4#include "boot.h"
5
6const char kernel_version[] = UTS_RELEASE
7 " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ") " UTS_VERSION;
diff --git a/arch/s390/hypfs/hypfs_vm.c b/arch/s390/hypfs/hypfs_vm.c
index 42f2375c203e..e1fcc03159ef 100644
--- a/arch/s390/hypfs/hypfs_vm.c
+++ b/arch/s390/hypfs/hypfs_vm.c
@@ -118,7 +118,7 @@ do { \
118 return PTR_ERR(rc); \ 118 return PTR_ERR(rc); \
119} while(0) 119} while(0)
120 120
121static int hpyfs_vm_create_guest(struct dentry *systems_dir, 121static int hypfs_vm_create_guest(struct dentry *systems_dir,
122 struct diag2fc_data *data) 122 struct diag2fc_data *data)
123{ 123{
124 char guest_name[NAME_LEN + 1] = {}; 124 char guest_name[NAME_LEN + 1] = {};
@@ -219,7 +219,7 @@ int hypfs_vm_create_files(struct dentry *root)
219 } 219 }
220 220
221 for (i = 0; i < count; i++) { 221 for (i = 0; i < count; i++) {
222 rc = hpyfs_vm_create_guest(dir, &(data[i])); 222 rc = hypfs_vm_create_guest(dir, &(data[i]));
223 if (rc) 223 if (rc)
224 goto failed; 224 goto failed;
225 } 225 }
diff --git a/arch/s390/include/asm/bitops.h b/arch/s390/include/asm/bitops.h
index 9900d655014c..b8833ac983fa 100644
--- a/arch/s390/include/asm/bitops.h
+++ b/arch/s390/include/asm/bitops.h
@@ -35,6 +35,7 @@
35 35
36#include <linux/typecheck.h> 36#include <linux/typecheck.h>
37#include <linux/compiler.h> 37#include <linux/compiler.h>
38#include <linux/types.h>
38#include <asm/atomic_ops.h> 39#include <asm/atomic_ops.h>
39#include <asm/barrier.h> 40#include <asm/barrier.h>
40 41
@@ -55,7 +56,7 @@ __bitops_byte(unsigned long nr, volatile unsigned long *ptr)
55 return ((unsigned char *)ptr) + ((nr ^ (BITS_PER_LONG - 8)) >> 3); 56 return ((unsigned char *)ptr) + ((nr ^ (BITS_PER_LONG - 8)) >> 3);
56} 57}
57 58
58static inline void set_bit(unsigned long nr, volatile unsigned long *ptr) 59static inline void arch_set_bit(unsigned long nr, volatile unsigned long *ptr)
59{ 60{
60 unsigned long *addr = __bitops_word(nr, ptr); 61 unsigned long *addr = __bitops_word(nr, ptr);
61 unsigned long mask; 62 unsigned long mask;
@@ -76,7 +77,7 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *ptr)
76 __atomic64_or(mask, (long *)addr); 77 __atomic64_or(mask, (long *)addr);
77} 78}
78 79
79static inline void clear_bit(unsigned long nr, volatile unsigned long *ptr) 80static inline void arch_clear_bit(unsigned long nr, volatile unsigned long *ptr)
80{ 81{
81 unsigned long *addr = __bitops_word(nr, ptr); 82 unsigned long *addr = __bitops_word(nr, ptr);
82 unsigned long mask; 83 unsigned long mask;
@@ -97,7 +98,8 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *ptr)
97 __atomic64_and(mask, (long *)addr); 98 __atomic64_and(mask, (long *)addr);
98} 99}
99 100
100static inline void change_bit(unsigned long nr, volatile unsigned long *ptr) 101static inline void arch_change_bit(unsigned long nr,
102 volatile unsigned long *ptr)
101{ 103{
102 unsigned long *addr = __bitops_word(nr, ptr); 104 unsigned long *addr = __bitops_word(nr, ptr);
103 unsigned long mask; 105 unsigned long mask;
@@ -118,8 +120,8 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *ptr)
118 __atomic64_xor(mask, (long *)addr); 120 __atomic64_xor(mask, (long *)addr);
119} 121}
120 122
121static inline int 123static inline bool arch_test_and_set_bit(unsigned long nr,
122test_and_set_bit(unsigned long nr, volatile unsigned long *ptr) 124 volatile unsigned long *ptr)
123{ 125{
124 unsigned long *addr = __bitops_word(nr, ptr); 126 unsigned long *addr = __bitops_word(nr, ptr);
125 unsigned long old, mask; 127 unsigned long old, mask;
@@ -129,8 +131,8 @@ test_and_set_bit(unsigned long nr, volatile unsigned long *ptr)
129 return (old & mask) != 0; 131 return (old & mask) != 0;
130} 132}
131 133
132static inline int 134static inline bool arch_test_and_clear_bit(unsigned long nr,
133test_and_clear_bit(unsigned long nr, volatile unsigned long *ptr) 135 volatile unsigned long *ptr)
134{ 136{
135 unsigned long *addr = __bitops_word(nr, ptr); 137 unsigned long *addr = __bitops_word(nr, ptr);
136 unsigned long old, mask; 138 unsigned long old, mask;
@@ -140,8 +142,8 @@ test_and_clear_bit(unsigned long nr, volatile unsigned long *ptr)
140 return (old & ~mask) != 0; 142 return (old & ~mask) != 0;
141} 143}
142 144
143static inline int 145static inline bool arch_test_and_change_bit(unsigned long nr,
144test_and_change_bit(unsigned long nr, volatile unsigned long *ptr) 146 volatile unsigned long *ptr)
145{ 147{
146 unsigned long *addr = __bitops_word(nr, ptr); 148 unsigned long *addr = __bitops_word(nr, ptr);
147 unsigned long old, mask; 149 unsigned long old, mask;
@@ -151,30 +153,31 @@ test_and_change_bit(unsigned long nr, volatile unsigned long *ptr)
151 return (old & mask) != 0; 153 return (old & mask) != 0;
152} 154}
153 155
154static inline void __set_bit(unsigned long nr, volatile unsigned long *ptr) 156static inline void arch___set_bit(unsigned long nr, volatile unsigned long *ptr)
155{ 157{
156 unsigned char *addr = __bitops_byte(nr, ptr); 158 unsigned char *addr = __bitops_byte(nr, ptr);
157 159
158 *addr |= 1 << (nr & 7); 160 *addr |= 1 << (nr & 7);
159} 161}
160 162
161static inline void 163static inline void arch___clear_bit(unsigned long nr,
162__clear_bit(unsigned long nr, volatile unsigned long *ptr) 164 volatile unsigned long *ptr)
163{ 165{
164 unsigned char *addr = __bitops_byte(nr, ptr); 166 unsigned char *addr = __bitops_byte(nr, ptr);
165 167
166 *addr &= ~(1 << (nr & 7)); 168 *addr &= ~(1 << (nr & 7));
167} 169}
168 170
169static inline void __change_bit(unsigned long nr, volatile unsigned long *ptr) 171static inline void arch___change_bit(unsigned long nr,
172 volatile unsigned long *ptr)
170{ 173{
171 unsigned char *addr = __bitops_byte(nr, ptr); 174 unsigned char *addr = __bitops_byte(nr, ptr);
172 175
173 *addr ^= 1 << (nr & 7); 176 *addr ^= 1 << (nr & 7);
174} 177}
175 178
176static inline int 179static inline bool arch___test_and_set_bit(unsigned long nr,
177__test_and_set_bit(unsigned long nr, volatile unsigned long *ptr) 180 volatile unsigned long *ptr)
178{ 181{
179 unsigned char *addr = __bitops_byte(nr, ptr); 182 unsigned char *addr = __bitops_byte(nr, ptr);
180 unsigned char ch; 183 unsigned char ch;
@@ -184,8 +187,8 @@ __test_and_set_bit(unsigned long nr, volatile unsigned long *ptr)
184 return (ch >> (nr & 7)) & 1; 187 return (ch >> (nr & 7)) & 1;
185} 188}
186 189
187static inline int 190static inline bool arch___test_and_clear_bit(unsigned long nr,
188__test_and_clear_bit(unsigned long nr, volatile unsigned long *ptr) 191 volatile unsigned long *ptr)
189{ 192{
190 unsigned char *addr = __bitops_byte(nr, ptr); 193 unsigned char *addr = __bitops_byte(nr, ptr);
191 unsigned char ch; 194 unsigned char ch;
@@ -195,8 +198,8 @@ __test_and_clear_bit(unsigned long nr, volatile unsigned long *ptr)
195 return (ch >> (nr & 7)) & 1; 198 return (ch >> (nr & 7)) & 1;
196} 199}
197 200
198static inline int 201static inline bool arch___test_and_change_bit(unsigned long nr,
199__test_and_change_bit(unsigned long nr, volatile unsigned long *ptr) 202 volatile unsigned long *ptr)
200{ 203{
201 unsigned char *addr = __bitops_byte(nr, ptr); 204 unsigned char *addr = __bitops_byte(nr, ptr);
202 unsigned char ch; 205 unsigned char ch;
@@ -206,7 +209,8 @@ __test_and_change_bit(unsigned long nr, volatile unsigned long *ptr)
206 return (ch >> (nr & 7)) & 1; 209 return (ch >> (nr & 7)) & 1;
207} 210}
208 211
209static inline int test_bit(unsigned long nr, const volatile unsigned long *ptr) 212static inline bool arch_test_bit(unsigned long nr,
213 const volatile unsigned long *ptr)
210{ 214{
211 const volatile unsigned char *addr; 215 const volatile unsigned char *addr;
212 216
@@ -215,28 +219,30 @@ static inline int test_bit(unsigned long nr, const volatile unsigned long *ptr)
215 return (*addr >> (nr & 7)) & 1; 219 return (*addr >> (nr & 7)) & 1;
216} 220}
217 221
218static inline int test_and_set_bit_lock(unsigned long nr, 222static inline bool arch_test_and_set_bit_lock(unsigned long nr,
219 volatile unsigned long *ptr) 223 volatile unsigned long *ptr)
220{ 224{
221 if (test_bit(nr, ptr)) 225 if (arch_test_bit(nr, ptr))
222 return 1; 226 return 1;
223 return test_and_set_bit(nr, ptr); 227 return arch_test_and_set_bit(nr, ptr);
224} 228}
225 229
226static inline void clear_bit_unlock(unsigned long nr, 230static inline void arch_clear_bit_unlock(unsigned long nr,
227 volatile unsigned long *ptr) 231 volatile unsigned long *ptr)
228{ 232{
229 smp_mb__before_atomic(); 233 smp_mb__before_atomic();
230 clear_bit(nr, ptr); 234 arch_clear_bit(nr, ptr);
231} 235}
232 236
233static inline void __clear_bit_unlock(unsigned long nr, 237static inline void arch___clear_bit_unlock(unsigned long nr,
234 volatile unsigned long *ptr) 238 volatile unsigned long *ptr)
235{ 239{
236 smp_mb(); 240 smp_mb();
237 __clear_bit(nr, ptr); 241 arch___clear_bit(nr, ptr);
238} 242}
239 243
244#include <asm-generic/bitops-instrumented.h>
245
240/* 246/*
241 * Functions which use MSB0 bit numbering. 247 * Functions which use MSB0 bit numbering.
242 * The bits are numbered: 248 * The bits are numbered:
@@ -261,7 +267,8 @@ static inline void clear_bit_inv(unsigned long nr, volatile unsigned long *ptr)
261 return clear_bit(nr ^ (BITS_PER_LONG - 1), ptr); 267 return clear_bit(nr ^ (BITS_PER_LONG - 1), ptr);
262} 268}
263 269
264static inline int test_and_clear_bit_inv(unsigned long nr, volatile unsigned long *ptr) 270static inline bool test_and_clear_bit_inv(unsigned long nr,
271 volatile unsigned long *ptr)
265{ 272{
266 return test_and_clear_bit(nr ^ (BITS_PER_LONG - 1), ptr); 273 return test_and_clear_bit(nr ^ (BITS_PER_LONG - 1), ptr);
267} 274}
@@ -276,8 +283,8 @@ static inline void __clear_bit_inv(unsigned long nr, volatile unsigned long *ptr
276 return __clear_bit(nr ^ (BITS_PER_LONG - 1), ptr); 283 return __clear_bit(nr ^ (BITS_PER_LONG - 1), ptr);
277} 284}
278 285
279static inline int test_bit_inv(unsigned long nr, 286static inline bool test_bit_inv(unsigned long nr,
280 const volatile unsigned long *ptr) 287 const volatile unsigned long *ptr)
281{ 288{
282 return test_bit(nr ^ (BITS_PER_LONG - 1), ptr); 289 return test_bit(nr ^ (BITS_PER_LONG - 1), ptr);
283} 290}
diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h
index a4d38092530a..823578c6b9e2 100644
--- a/arch/s390/include/asm/page.h
+++ b/arch/s390/include/asm/page.h
@@ -177,6 +177,8 @@ static inline int devmem_is_allowed(unsigned long pfn)
177#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \ 177#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \
178 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 178 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
179 179
180#define ARCH_ZONE_DMA_BITS 31
181
180#include <asm-generic/memory_model.h> 182#include <asm-generic/memory_model.h>
181#include <asm-generic/getorder.h> 183#include <asm-generic/getorder.h>
182 184
diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h
index 82deb8fc8319..c5cfff7b1f91 100644
--- a/arch/s390/include/asm/setup.h
+++ b/arch/s390/include/asm/setup.h
@@ -54,6 +54,7 @@
54#define INITRD_SIZE_OFFSET 0x10410 54#define INITRD_SIZE_OFFSET 0x10410
55#define OLDMEM_BASE_OFFSET 0x10418 55#define OLDMEM_BASE_OFFSET 0x10418
56#define OLDMEM_SIZE_OFFSET 0x10420 56#define OLDMEM_SIZE_OFFSET 0x10420
57#define KERNEL_VERSION_OFFSET 0x10428
57#define COMMAND_LINE_OFFSET 0x10480 58#define COMMAND_LINE_OFFSET 0x10480
58 59
59#ifndef __ASSEMBLY__ 60#ifndef __ASSEMBLY__
@@ -74,7 +75,8 @@ struct parmarea {
74 unsigned long initrd_size; /* 0x10410 */ 75 unsigned long initrd_size; /* 0x10410 */
75 unsigned long oldmem_base; /* 0x10418 */ 76 unsigned long oldmem_base; /* 0x10418 */
76 unsigned long oldmem_size; /* 0x10420 */ 77 unsigned long oldmem_size; /* 0x10420 */
77 char pad1[0x10480 - 0x10428]; /* 0x10428 - 0x10480 */ 78 unsigned long kernel_version; /* 0x10428 */
79 char pad1[0x10480 - 0x10430]; /* 0x10430 - 0x10480 */
78 char command_line[ARCH_COMMAND_LINE_SIZE]; /* 0x10480 */ 80 char command_line[ARCH_COMMAND_LINE_SIZE]; /* 0x10480 */
79}; 81};
80 82
diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h
index b6755685c7b8..9e9f75ef046a 100644
--- a/arch/s390/include/asm/unistd.h
+++ b/arch/s390/include/asm/unistd.h
@@ -34,5 +34,6 @@
34#define __ARCH_WANT_SYS_FORK 34#define __ARCH_WANT_SYS_FORK
35#define __ARCH_WANT_SYS_VFORK 35#define __ARCH_WANT_SYS_VFORK
36#define __ARCH_WANT_SYS_CLONE 36#define __ARCH_WANT_SYS_CLONE
37#define __ARCH_WANT_SYS_CLONE3
37 38
38#endif /* _ASM_S390_UNISTD_H_ */ 39#endif /* _ASM_S390_UNISTD_H_ */
diff --git a/arch/s390/include/uapi/asm/bpf_perf_event.h b/arch/s390/include/uapi/asm/bpf_perf_event.h
index cefe7c7cd4f6..3ed42ff6da94 100644
--- a/arch/s390/include/uapi/asm/bpf_perf_event.h
+++ b/arch/s390/include/uapi/asm/bpf_perf_event.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__ 2#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__
3#define _UAPI__ASM_BPF_PERF_EVENT_H__ 3#define _UAPI__ASM_BPF_PERF_EVENT_H__
4 4
diff --git a/arch/s390/include/uapi/asm/ipl.h b/arch/s390/include/uapi/asm/ipl.h
index fd32b1cd80d2..451ba7d08905 100644
--- a/arch/s390/include/uapi/asm/ipl.h
+++ b/arch/s390/include/uapi/asm/ipl.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _ASM_S390_UAPI_IPL_H 2#ifndef _ASM_S390_UAPI_IPL_H
3#define _ASM_S390_UAPI_IPL_H 3#define _ASM_S390_UAPI_IPL_H
4 4
diff --git a/arch/s390/include/uapi/asm/zcrypt.h b/arch/s390/include/uapi/asm/zcrypt.h
index 494c34c50716..8c5755f41dde 100644
--- a/arch/s390/include/uapi/asm/zcrypt.h
+++ b/arch/s390/include/uapi/asm/zcrypt.h
@@ -20,6 +20,7 @@
20 20
21#include <linux/ioctl.h> 21#include <linux/ioctl.h>
22#include <linux/compiler.h> 22#include <linux/compiler.h>
23#include <linux/types.h>
23 24
24/* Name of the zcrypt device driver. */ 25/* Name of the zcrypt device driver. */
25#define ZCRYPT_NAME "zcrypt" 26#define ZCRYPT_NAME "zcrypt"
@@ -160,17 +161,17 @@ struct ica_xcRB {
160 * @payload_len: Payload length 161 * @payload_len: Payload length
161 */ 162 */
162struct ep11_cprb { 163struct ep11_cprb {
163 uint16_t cprb_len; 164 __u16 cprb_len;
164 unsigned char cprb_ver_id; 165 unsigned char cprb_ver_id;
165 unsigned char pad_000[2]; 166 unsigned char pad_000[2];
166 unsigned char flags; 167 unsigned char flags;
167 unsigned char func_id[2]; 168 unsigned char func_id[2];
168 uint32_t source_id; 169 __u32 source_id;
169 uint32_t target_id; 170 __u32 target_id;
170 uint32_t ret_code; 171 __u32 ret_code;
171 uint32_t reserved1; 172 __u32 reserved1;
172 uint32_t reserved2; 173 __u32 reserved2;
173 uint32_t payload_len; 174 __u32 payload_len;
174} __attribute__((packed)); 175} __attribute__((packed));
175 176
176/** 177/**
@@ -179,8 +180,8 @@ struct ep11_cprb {
179 * @dom_id: Usage domain id 180 * @dom_id: Usage domain id
180 */ 181 */
181struct ep11_target_dev { 182struct ep11_target_dev {
182 uint16_t ap_id; 183 __u16 ap_id;
183 uint16_t dom_id; 184 __u16 dom_id;
184}; 185};
185 186
186/** 187/**
@@ -195,14 +196,14 @@ struct ep11_target_dev {
195 * @resp: Addr to response block 196 * @resp: Addr to response block
196 */ 197 */
197struct ep11_urb { 198struct ep11_urb {
198 uint16_t targets_num; 199 __u16 targets_num;
199 uint64_t targets; 200 __u64 targets;
200 uint64_t weight; 201 __u64 weight;
201 uint64_t req_no; 202 __u64 req_no;
202 uint64_t req_len; 203 __u64 req_len;
203 uint64_t req; 204 __u64 req;
204 uint64_t resp_len; 205 __u64 resp_len;
205 uint64_t resp; 206 __u64 resp;
206} __attribute__((packed)); 207} __attribute__((packed));
207 208
208/** 209/**
diff --git a/arch/s390/kernel/syscalls/syscall.tbl b/arch/s390/kernel/syscalls/syscall.tbl
index a90d3e945445..3054e9c035a3 100644
--- a/arch/s390/kernel/syscalls/syscall.tbl
+++ b/arch/s390/kernel/syscalls/syscall.tbl
@@ -437,4 +437,4 @@
437432 common fsmount sys_fsmount sys_fsmount 437432 common fsmount sys_fsmount sys_fsmount
438433 common fspick sys_fspick sys_fspick 438433 common fspick sys_fspick sys_fspick
439434 common pidfd_open sys_pidfd_open sys_pidfd_open 439434 common pidfd_open sys_pidfd_open sys_pidfd_open
440# 435 reserved for clone3 440435 common clone3 sys_clone3 sys_clone3
diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c
index 99e06213a22b..54fcdf66ae96 100644
--- a/arch/s390/mm/pgalloc.c
+++ b/arch/s390/mm/pgalloc.c
@@ -17,8 +17,6 @@
17 17
18#ifdef CONFIG_PGSTE 18#ifdef CONFIG_PGSTE
19 19
20static int page_table_allocate_pgste_min = 0;
21static int page_table_allocate_pgste_max = 1;
22int page_table_allocate_pgste = 0; 20int page_table_allocate_pgste = 0;
23EXPORT_SYMBOL(page_table_allocate_pgste); 21EXPORT_SYMBOL(page_table_allocate_pgste);
24 22
@@ -29,8 +27,8 @@ static struct ctl_table page_table_sysctl[] = {
29 .maxlen = sizeof(int), 27 .maxlen = sizeof(int),
30 .mode = S_IRUGO | S_IWUSR, 28 .mode = S_IRUGO | S_IWUSR,
31 .proc_handler = proc_dointvec_minmax, 29 .proc_handler = proc_dointvec_minmax,
32 .extra1 = &page_table_allocate_pgste_min, 30 .extra1 = SYSCTL_ZERO,
33 .extra2 = &page_table_allocate_pgste_max, 31 .extra2 = SYSCTL_ONE,
34 }, 32 },
35 { } 33 { }
36}; 34};
diff --git a/arch/sh/include/uapi/asm/setup.h b/arch/sh/include/uapi/asm/setup.h
index 1170dd2fb998..4bd19f80f9b0 100644
--- a/arch/sh/include/uapi/asm/setup.h
+++ b/arch/sh/include/uapi/asm/setup.h
@@ -1,2 +1,2 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#include <asm-generic/setup.h> 2#include <asm-generic/setup.h>
diff --git a/arch/sh/include/uapi/asm/types.h b/arch/sh/include/uapi/asm/types.h
index f83795fdc0da..68100e108ea6 100644
--- a/arch/sh/include/uapi/asm/types.h
+++ b/arch/sh/include/uapi/asm/types.h
@@ -1,2 +1,2 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#include <asm-generic/types.h> 2#include <asm-generic/types.h>
diff --git a/arch/sparc/include/uapi/asm/oradax.h b/arch/sparc/include/uapi/asm/oradax.h
index 64c67f2ea33f..0dace69058ab 100644
--- a/arch/sparc/include/uapi/asm/oradax.h
+++ b/arch/sparc/include/uapi/asm/oradax.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */ 1/* SPDX-License-Identifier: GPL-2.0-or-later WITH Linux-syscall-note */
2/* 2/*
3 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. 3 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
4 */ 4 */
diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S
index 2bb986f305ac..4f86928246e7 100644
--- a/arch/x86/entry/entry_32.S
+++ b/arch/x86/entry/entry_32.S
@@ -1443,8 +1443,12 @@ BUILD_INTERRUPT3(hv_stimer0_callback_vector, HYPERV_STIMER0_VECTOR,
1443 1443
1444ENTRY(page_fault) 1444ENTRY(page_fault)
1445 ASM_CLAC 1445 ASM_CLAC
1446 pushl $0; /* %gs's slot on the stack */ 1446 pushl $do_page_fault
1447 jmp common_exception_read_cr2
1448END(page_fault)
1447 1449
1450common_exception_read_cr2:
1451 /* the function address is in %gs's slot on the stack */
1448 SAVE_ALL switch_stacks=1 skip_gs=1 1452 SAVE_ALL switch_stacks=1 skip_gs=1
1449 1453
1450 ENCODE_FRAME_POINTER 1454 ENCODE_FRAME_POINTER
@@ -1452,6 +1456,7 @@ ENTRY(page_fault)
1452 1456
1453 /* fixup %gs */ 1457 /* fixup %gs */
1454 GS_TO_REG %ecx 1458 GS_TO_REG %ecx
1459 movl PT_GS(%esp), %edi
1455 REG_TO_PTGS %ecx 1460 REG_TO_PTGS %ecx
1456 SET_KERNEL_GS %ecx 1461 SET_KERNEL_GS %ecx
1457 1462
@@ -1463,9 +1468,9 @@ ENTRY(page_fault)
1463 1468
1464 TRACE_IRQS_OFF 1469 TRACE_IRQS_OFF
1465 movl %esp, %eax # pt_regs pointer 1470 movl %esp, %eax # pt_regs pointer
1466 call do_page_fault 1471 CALL_NOSPEC %edi
1467 jmp ret_from_exception 1472 jmp ret_from_exception
1468END(page_fault) 1473END(common_exception_read_cr2)
1469 1474
1470common_exception: 1475common_exception:
1471 /* the function address is in %gs's slot on the stack */ 1476 /* the function address is in %gs's slot on the stack */
@@ -1595,7 +1600,7 @@ END(general_protection)
1595ENTRY(async_page_fault) 1600ENTRY(async_page_fault)
1596 ASM_CLAC 1601 ASM_CLAC
1597 pushl $do_async_page_fault 1602 pushl $do_async_page_fault
1598 jmp common_exception 1603 jmp common_exception_read_cr2
1599END(async_page_fault) 1604END(async_page_fault)
1600#endif 1605#endif
1601 1606
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index 9e911a96972b..648260b5f367 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -20,7 +20,6 @@
20#include <asm/intel-family.h> 20#include <asm/intel-family.h>
21#include <asm/apic.h> 21#include <asm/apic.h>
22#include <asm/cpu_device_id.h> 22#include <asm/cpu_device_id.h>
23#include <asm/hypervisor.h>
24 23
25#include "../perf_event.h" 24#include "../perf_event.h"
26 25
@@ -263,8 +262,8 @@ static struct event_constraint intel_icl_event_constraints[] = {
263}; 262};
264 263
265static struct extra_reg intel_icl_extra_regs[] __read_mostly = { 264static struct extra_reg intel_icl_extra_regs[] __read_mostly = {
266 INTEL_UEVENT_EXTRA_REG(0x01b7, MSR_OFFCORE_RSP_0, 0x3fffff9fffull, RSP_0), 265 INTEL_UEVENT_EXTRA_REG(0x01b7, MSR_OFFCORE_RSP_0, 0x3fffffbfffull, RSP_0),
267 INTEL_UEVENT_EXTRA_REG(0x01bb, MSR_OFFCORE_RSP_1, 0x3fffff9fffull, RSP_1), 266 INTEL_UEVENT_EXTRA_REG(0x01bb, MSR_OFFCORE_RSP_1, 0x3fffffbfffull, RSP_1),
268 INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd), 267 INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd),
269 INTEL_UEVENT_EXTRA_REG(0x01c6, MSR_PEBS_FRONTEND, 0x7fff17, FE), 268 INTEL_UEVENT_EXTRA_REG(0x01c6, MSR_PEBS_FRONTEND, 0x7fff17, FE),
270 EVENT_EXTRA_END 269 EVENT_EXTRA_END
@@ -4053,7 +4052,7 @@ static bool check_msr(unsigned long msr, u64 mask)
4053 * Disable the check for real HW, so we don't 4052 * Disable the check for real HW, so we don't
4054 * mess with potentionaly enabled registers: 4053 * mess with potentionaly enabled registers:
4055 */ 4054 */
4056 if (hypervisor_is_type(X86_HYPER_NATIVE)) 4055 if (!boot_cpu_has(X86_FEATURE_HYPERVISOR))
4057 return true; 4056 return true;
4058 4057
4059 /* 4058 /*
@@ -4955,6 +4954,7 @@ __init int intel_pmu_init(void)
4955 4954
4956 case INTEL_FAM6_SKYLAKE_X: 4955 case INTEL_FAM6_SKYLAKE_X:
4957 pmem = true; 4956 pmem = true;
4957 /* fall through */
4958 case INTEL_FAM6_SKYLAKE_MOBILE: 4958 case INTEL_FAM6_SKYLAKE_MOBILE:
4959 case INTEL_FAM6_SKYLAKE_DESKTOP: 4959 case INTEL_FAM6_SKYLAKE_DESKTOP:
4960 case INTEL_FAM6_KABYLAKE_MOBILE: 4960 case INTEL_FAM6_KABYLAKE_MOBILE:
@@ -5004,6 +5004,7 @@ __init int intel_pmu_init(void)
5004 case INTEL_FAM6_ICELAKE_X: 5004 case INTEL_FAM6_ICELAKE_X:
5005 case INTEL_FAM6_ICELAKE_XEON_D: 5005 case INTEL_FAM6_ICELAKE_XEON_D:
5006 pmem = true; 5006 pmem = true;
5007 /* fall through */
5007 case INTEL_FAM6_ICELAKE_MOBILE: 5008 case INTEL_FAM6_ICELAKE_MOBILE:
5008 case INTEL_FAM6_ICELAKE_DESKTOP: 5009 case INTEL_FAM6_ICELAKE_DESKTOP:
5009 x86_pmu.late_ack = true; 5010 x86_pmu.late_ack = true;
diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c
index 2c8db2c19328..f1269e804e9b 100644
--- a/arch/x86/events/intel/ds.c
+++ b/arch/x86/events/intel/ds.c
@@ -851,7 +851,7 @@ struct event_constraint intel_skl_pebs_event_constraints[] = {
851 851
852struct event_constraint intel_icl_pebs_event_constraints[] = { 852struct event_constraint intel_icl_pebs_event_constraints[] = {
853 INTEL_FLAGS_UEVENT_CONSTRAINT(0x1c0, 0x100000000ULL), /* INST_RETIRED.PREC_DIST */ 853 INTEL_FLAGS_UEVENT_CONSTRAINT(0x1c0, 0x100000000ULL), /* INST_RETIRED.PREC_DIST */
854 INTEL_FLAGS_UEVENT_CONSTRAINT(0x0400, 0x400000000ULL), /* SLOTS */ 854 INTEL_FLAGS_UEVENT_CONSTRAINT(0x0400, 0x800000000ULL), /* SLOTS */
855 855
856 INTEL_PLD_CONSTRAINT(0x1cd, 0xff), /* MEM_TRANS_RETIRED.LOAD_LATENCY */ 856 INTEL_PLD_CONSTRAINT(0x1cd, 0xff), /* MEM_TRANS_RETIRED.LOAD_LATENCY */
857 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x1d0, 0xf), /* MEM_INST_RETIRED.LOAD */ 857 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x1d0, 0xf), /* MEM_INST_RETIRED.LOAD */
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 8282b8d41209..7b0a4ee77313 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -607,15 +607,16 @@ struct kvm_vcpu_arch {
607 607
608 /* 608 /*
609 * QEMU userspace and the guest each have their own FPU state. 609 * QEMU userspace and the guest each have their own FPU state.
610 * In vcpu_run, we switch between the user, maintained in the 610 * In vcpu_run, we switch between the user and guest FPU contexts.
611 * task_struct struct, and guest FPU contexts. While running a VCPU, 611 * While running a VCPU, the VCPU thread will have the guest FPU
612 * the VCPU thread will have the guest FPU context. 612 * context.
613 * 613 *
614 * Note that while the PKRU state lives inside the fpu registers, 614 * Note that while the PKRU state lives inside the fpu registers,
615 * it is switched out separately at VMENTER and VMEXIT time. The 615 * it is switched out separately at VMENTER and VMEXIT time. The
616 * "guest_fpu" state here contains the guest FPU context, with the 616 * "guest_fpu" state here contains the guest FPU context, with the
617 * host PRKU bits. 617 * host PRKU bits.
618 */ 618 */
619 struct fpu *user_fpu;
619 struct fpu *guest_fpu; 620 struct fpu *guest_fpu;
620 621
621 u64 xcr0; 622 u64 xcr0;
diff --git a/arch/x86/include/uapi/asm/byteorder.h b/arch/x86/include/uapi/asm/byteorder.h
index 484e3cfd7ef2..149143cab9ff 100644
--- a/arch/x86/include/uapi/asm/byteorder.h
+++ b/arch/x86/include/uapi/asm/byteorder.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _ASM_X86_BYTEORDER_H 2#ifndef _ASM_X86_BYTEORDER_H
3#define _ASM_X86_BYTEORDER_H 3#define _ASM_X86_BYTEORDER_H
4 4
diff --git a/arch/x86/include/uapi/asm/hwcap2.h b/arch/x86/include/uapi/asm/hwcap2.h
index 6ebaae90e207..8b2effe6efb8 100644
--- a/arch/x86/include/uapi/asm/hwcap2.h
+++ b/arch/x86/include/uapi/asm/hwcap2.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _ASM_X86_HWCAP2_H 2#ifndef _ASM_X86_HWCAP2_H
3#define _ASM_X86_HWCAP2_H 3#define _ASM_X86_HWCAP2_H
4 4
diff --git a/arch/x86/include/uapi/asm/sigcontext32.h b/arch/x86/include/uapi/asm/sigcontext32.h
index 6b18e88de8a6..7114801d0499 100644
--- a/arch/x86/include/uapi/asm/sigcontext32.h
+++ b/arch/x86/include/uapi/asm/sigcontext32.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _ASM_X86_SIGCONTEXT32_H 2#ifndef _ASM_X86_SIGCONTEXT32_H
3#define _ASM_X86_SIGCONTEXT32_H 3#define _ASM_X86_SIGCONTEXT32_H
4 4
diff --git a/arch/x86/include/uapi/asm/types.h b/arch/x86/include/uapi/asm/types.h
index df55e1ddb0c9..9d5c11a24279 100644
--- a/arch/x86/include/uapi/asm/types.h
+++ b/arch/x86/include/uapi/asm/types.h
@@ -1,4 +1,4 @@
1/* SPDX-License-Identifier: GPL-2.0 */ 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef _ASM_X86_TYPES_H 2#ifndef _ASM_X86_TYPES_H
3#define _ASM_X86_TYPES_H 3#define _ASM_X86_TYPES_H
4 4
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 66ca906aa790..801ecd1c3fd5 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -1226,7 +1226,7 @@ static ssize_t l1tf_show_state(char *buf)
1226 1226
1227static ssize_t mds_show_state(char *buf) 1227static ssize_t mds_show_state(char *buf)
1228{ 1228{
1229 if (!hypervisor_is_type(X86_HYPER_NATIVE)) { 1229 if (boot_cpu_has(X86_FEATURE_HYPERVISOR)) {
1230 return sprintf(buf, "%s; SMT Host state unknown\n", 1230 return sprintf(buf, "%s; SMT Host state unknown\n",
1231 mds_strings[mds_mitigation]); 1231 mds_strings[mds_mitigation]);
1232 } 1232 }
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index a6342c899be5..f3d3e9646a99 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -193,10 +193,10 @@ ENTRY(secondary_startup_64)
193 193
194 /* Set up %gs. 194 /* Set up %gs.
195 * 195 *
196 * The base of %gs always points to the bottom of the irqstack 196 * The base of %gs always points to fixed_percpu_data. If the
197 * union. If the stack protector canary is enabled, it is 197 * stack protector canary is enabled, it is located at %gs:40.
198 * located at %gs:40. Note that, on SMP, the boot cpu uses 198 * Note that, on SMP, the boot cpu uses init data section until
199 * init data section till per cpu areas are set up. 199 * the per cpu areas are set up.
200 */ 200 */
201 movl $MSR_GS_BASE,%ecx 201 movl $MSR_GS_BASE,%ecx
202 movl initial_gs(%rip),%eax 202 movl initial_gs(%rip),%eax
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index c43e96a938d0..c6f791bc481e 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -827,10 +827,6 @@ int __init hpet_enable(void)
827 if (!hpet_cfg_working()) 827 if (!hpet_cfg_working())
828 goto out_nohpet; 828 goto out_nohpet;
829 829
830 /* Validate that the counter is counting */
831 if (!hpet_counting())
832 goto out_nohpet;
833
834 /* 830 /*
835 * Read the period and check for a sane value: 831 * Read the period and check for a sane value:
836 */ 832 */
@@ -896,6 +892,14 @@ int __init hpet_enable(void)
896 } 892 }
897 hpet_print_config(); 893 hpet_print_config();
898 894
895 /*
896 * Validate that the counter is counting. This needs to be done
897 * after sanitizing the config registers to properly deal with
898 * force enabled HPETs.
899 */
900 if (!hpet_counting())
901 goto out_nohpet;
902
899 clocksource_register_hz(&clocksource_hpet, (u32)hpet_freq); 903 clocksource_register_hz(&clocksource_hpet, (u32)hpet_freq);
900 904
901 if (id & HPET_ID_LEGSUP) { 905 if (id & HPET_ID_LEGSUP) {
diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c
index 4f36d3241faf..2d6898c2cb64 100644
--- a/arch/x86/kernel/stacktrace.c
+++ b/arch/x86/kernel/stacktrace.c
@@ -100,7 +100,7 @@ copy_stack_frame(const void __user *fp, struct stack_frame_user *frame)
100{ 100{
101 int ret; 101 int ret;
102 102
103 if (!access_ok(fp, sizeof(*frame))) 103 if (__range_not_ok(fp, sizeof(*frame), TASK_SIZE))
104 return 0; 104 return 0;
105 105
106 ret = 1; 106 ret = 1;
diff --git a/arch/x86/kernel/sysfb_efi.c b/arch/x86/kernel/sysfb_efi.c
index 8eb67a670b10..653b7f617b61 100644
--- a/arch/x86/kernel/sysfb_efi.c
+++ b/arch/x86/kernel/sysfb_efi.c
@@ -230,9 +230,55 @@ static const struct dmi_system_id efifb_dmi_system_table[] __initconst = {
230 {}, 230 {},
231}; 231};
232 232
233/*
234 * Some devices have a portrait LCD but advertise a landscape resolution (and
235 * pitch). We simply swap width and height for these devices so that we can
236 * correctly deal with some of them coming with multiple resolutions.
237 */
238static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = {
239 {
240 /*
241 * Lenovo MIIX310-10ICR, only some batches have the troublesome
242 * 800x1280 portrait screen. Luckily the portrait version has
243 * its own BIOS version, so we match on that.
244 */
245 .matches = {
246 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
247 DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "MIIX 310-10ICR"),
248 DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1HCN44WW"),
249 },
250 },
251 {
252 /* Lenovo MIIX 320-10ICR with 800x1280 portrait screen */
253 .matches = {
254 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
255 DMI_EXACT_MATCH(DMI_PRODUCT_VERSION,
256 "Lenovo MIIX 320-10ICR"),
257 },
258 },
259 {
260 /* Lenovo D330 with 800x1280 or 1200x1920 portrait screen */
261 .matches = {
262 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
263 DMI_EXACT_MATCH(DMI_PRODUCT_VERSION,
264 "Lenovo ideapad D330-10IGM"),
265 },
266 },
267 {},
268};
269
233__init void sysfb_apply_efi_quirks(void) 270__init void sysfb_apply_efi_quirks(void)
234{ 271{
235 if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI || 272 if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI ||
236 !(screen_info.capabilities & VIDEO_CAPABILITY_SKIP_QUIRKS)) 273 !(screen_info.capabilities & VIDEO_CAPABILITY_SKIP_QUIRKS))
237 dmi_check_system(efifb_dmi_system_table); 274 dmi_check_system(efifb_dmi_system_table);
275
276 if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI &&
277 dmi_check_system(efifb_dmi_swap_width_height)) {
278 u16 temp = screen_info.lfb_width;
279
280 screen_info.lfb_width = screen_info.lfb_height;
281 screen_info.lfb_height = temp;
282 screen_info.lfb_linelength = 4 * screen_info.lfb_width;
283 }
238} 284}
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 8f72526e2f68..24843cf49579 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -3466,7 +3466,7 @@ static bool fast_page_fault(struct kvm_vcpu *vcpu, gva_t gva, int level,
3466 /* 3466 /*
3467 * Currently, fast page fault only works for direct mapping 3467 * Currently, fast page fault only works for direct mapping
3468 * since the gfn is not stable for indirect shadow page. See 3468 * since the gfn is not stable for indirect shadow page. See
3469 * Documentation/virtual/kvm/locking.txt to get more detail. 3469 * Documentation/virt/kvm/locking.txt to get more detail.
3470 */ 3470 */
3471 fault_handled = fast_pf_fix_direct_spte(vcpu, sp, 3471 fault_handled = fast_pf_fix_direct_spte(vcpu, sp,
3472 iterator.sptep, spte, 3472 iterator.sptep, spte,
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 19f69df96758..7eafc6907861 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -2143,12 +2143,20 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id)
2143 goto out; 2143 goto out;
2144 } 2144 }
2145 2145
2146 svm->vcpu.arch.user_fpu = kmem_cache_zalloc(x86_fpu_cache,
2147 GFP_KERNEL_ACCOUNT);
2148 if (!svm->vcpu.arch.user_fpu) {
2149 printk(KERN_ERR "kvm: failed to allocate kvm userspace's fpu\n");
2150 err = -ENOMEM;
2151 goto free_partial_svm;
2152 }
2153
2146 svm->vcpu.arch.guest_fpu = kmem_cache_zalloc(x86_fpu_cache, 2154 svm->vcpu.arch.guest_fpu = kmem_cache_zalloc(x86_fpu_cache,
2147 GFP_KERNEL_ACCOUNT); 2155 GFP_KERNEL_ACCOUNT);
2148 if (!svm->vcpu.arch.guest_fpu) { 2156 if (!svm->vcpu.arch.guest_fpu) {
2149 printk(KERN_ERR "kvm: failed to allocate vcpu's fpu\n"); 2157 printk(KERN_ERR "kvm: failed to allocate vcpu's fpu\n");
2150 err = -ENOMEM; 2158 err = -ENOMEM;
2151 goto free_partial_svm; 2159 goto free_user_fpu;
2152 } 2160 }
2153 2161
2154 err = kvm_vcpu_init(&svm->vcpu, kvm, id); 2162 err = kvm_vcpu_init(&svm->vcpu, kvm, id);
@@ -2211,6 +2219,8 @@ uninit:
2211 kvm_vcpu_uninit(&svm->vcpu); 2219 kvm_vcpu_uninit(&svm->vcpu);
2212free_svm: 2220free_svm:
2213 kmem_cache_free(x86_fpu_cache, svm->vcpu.arch.guest_fpu); 2221 kmem_cache_free(x86_fpu_cache, svm->vcpu.arch.guest_fpu);
2222free_user_fpu:
2223 kmem_cache_free(x86_fpu_cache, svm->vcpu.arch.user_fpu);
2214free_partial_svm: 2224free_partial_svm:
2215 kmem_cache_free(kvm_vcpu_cache, svm); 2225 kmem_cache_free(kvm_vcpu_cache, svm);
2216out: 2226out:
@@ -2241,6 +2251,7 @@ static void svm_free_vcpu(struct kvm_vcpu *vcpu)
2241 __free_page(virt_to_page(svm->nested.hsave)); 2251 __free_page(virt_to_page(svm->nested.hsave));
2242 __free_pages(virt_to_page(svm->nested.msrpm), MSRPM_ALLOC_ORDER); 2252 __free_pages(virt_to_page(svm->nested.msrpm), MSRPM_ALLOC_ORDER);
2243 kvm_vcpu_uninit(vcpu); 2253 kvm_vcpu_uninit(vcpu);
2254 kmem_cache_free(x86_fpu_cache, svm->vcpu.arch.user_fpu);
2244 kmem_cache_free(x86_fpu_cache, svm->vcpu.arch.guest_fpu); 2255 kmem_cache_free(x86_fpu_cache, svm->vcpu.arch.guest_fpu);
2245 kmem_cache_free(kvm_vcpu_cache, svm); 2256 kmem_cache_free(kvm_vcpu_cache, svm);
2246} 2257}
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 0f1378789bd0..ced9fba32598 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -220,6 +220,8 @@ static void free_nested(struct kvm_vcpu *vcpu)
220 if (!vmx->nested.vmxon && !vmx->nested.smm.vmxon) 220 if (!vmx->nested.vmxon && !vmx->nested.smm.vmxon)
221 return; 221 return;
222 222
223 kvm_clear_request(KVM_REQ_GET_VMCS12_PAGES, vcpu);
224
223 vmx->nested.vmxon = false; 225 vmx->nested.vmxon = false;
224 vmx->nested.smm.vmxon = false; 226 vmx->nested.smm.vmxon = false;
225 free_vpid(vmx->nested.vpid02); 227 free_vpid(vmx->nested.vpid02);
@@ -232,7 +234,9 @@ static void free_nested(struct kvm_vcpu *vcpu)
232 vmx->vmcs01.shadow_vmcs = NULL; 234 vmx->vmcs01.shadow_vmcs = NULL;
233 } 235 }
234 kfree(vmx->nested.cached_vmcs12); 236 kfree(vmx->nested.cached_vmcs12);
237 vmx->nested.cached_vmcs12 = NULL;
235 kfree(vmx->nested.cached_shadow_vmcs12); 238 kfree(vmx->nested.cached_shadow_vmcs12);
239 vmx->nested.cached_shadow_vmcs12 = NULL;
236 /* Unpin physical memory we referred to in the vmcs02 */ 240 /* Unpin physical memory we referred to in the vmcs02 */
237 if (vmx->nested.apic_access_page) { 241 if (vmx->nested.apic_access_page) {
238 kvm_release_page_dirty(vmx->nested.apic_access_page); 242 kvm_release_page_dirty(vmx->nested.apic_access_page);
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index a279447eb75b..074385c86c09 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -6598,6 +6598,7 @@ static void vmx_free_vcpu(struct kvm_vcpu *vcpu)
6598 free_loaded_vmcs(vmx->loaded_vmcs); 6598 free_loaded_vmcs(vmx->loaded_vmcs);
6599 kfree(vmx->guest_msrs); 6599 kfree(vmx->guest_msrs);
6600 kvm_vcpu_uninit(vcpu); 6600 kvm_vcpu_uninit(vcpu);
6601 kmem_cache_free(x86_fpu_cache, vmx->vcpu.arch.user_fpu);
6601 kmem_cache_free(x86_fpu_cache, vmx->vcpu.arch.guest_fpu); 6602 kmem_cache_free(x86_fpu_cache, vmx->vcpu.arch.guest_fpu);
6602 kmem_cache_free(kvm_vcpu_cache, vmx); 6603 kmem_cache_free(kvm_vcpu_cache, vmx);
6603} 6604}
@@ -6613,12 +6614,20 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
6613 if (!vmx) 6614 if (!vmx)
6614 return ERR_PTR(-ENOMEM); 6615 return ERR_PTR(-ENOMEM);
6615 6616
6617 vmx->vcpu.arch.user_fpu = kmem_cache_zalloc(x86_fpu_cache,
6618 GFP_KERNEL_ACCOUNT);
6619 if (!vmx->vcpu.arch.user_fpu) {
6620 printk(KERN_ERR "kvm: failed to allocate kvm userspace's fpu\n");
6621 err = -ENOMEM;
6622 goto free_partial_vcpu;
6623 }
6624
6616 vmx->vcpu.arch.guest_fpu = kmem_cache_zalloc(x86_fpu_cache, 6625 vmx->vcpu.arch.guest_fpu = kmem_cache_zalloc(x86_fpu_cache,
6617 GFP_KERNEL_ACCOUNT); 6626 GFP_KERNEL_ACCOUNT);
6618 if (!vmx->vcpu.arch.guest_fpu) { 6627 if (!vmx->vcpu.arch.guest_fpu) {
6619 printk(KERN_ERR "kvm: failed to allocate vcpu's fpu\n"); 6628 printk(KERN_ERR "kvm: failed to allocate vcpu's fpu\n");
6620 err = -ENOMEM; 6629 err = -ENOMEM;
6621 goto free_partial_vcpu; 6630 goto free_user_fpu;
6622 } 6631 }
6623 6632
6624 vmx->vpid = allocate_vpid(); 6633 vmx->vpid = allocate_vpid();
@@ -6721,6 +6730,8 @@ uninit_vcpu:
6721free_vcpu: 6730free_vcpu:
6722 free_vpid(vmx->vpid); 6731 free_vpid(vmx->vpid);
6723 kmem_cache_free(x86_fpu_cache, vmx->vcpu.arch.guest_fpu); 6732 kmem_cache_free(x86_fpu_cache, vmx->vcpu.arch.guest_fpu);
6733free_user_fpu:
6734 kmem_cache_free(x86_fpu_cache, vmx->vcpu.arch.user_fpu);
6724free_partial_vcpu: 6735free_partial_vcpu:
6725 kmem_cache_free(kvm_vcpu_cache, vmx); 6736 kmem_cache_free(kvm_vcpu_cache, vmx);
6726 return ERR_PTR(err); 6737 return ERR_PTR(err);
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 58305cf81182..c6d951cbd76c 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3306,6 +3306,10 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
3306 3306
3307 kvm_x86_ops->vcpu_load(vcpu, cpu); 3307 kvm_x86_ops->vcpu_load(vcpu, cpu);
3308 3308
3309 fpregs_assert_state_consistent();
3310 if (test_thread_flag(TIF_NEED_FPU_LOAD))
3311 switch_fpu_return();
3312
3309 /* Apply any externally detected TSC adjustments (due to suspend) */ 3313 /* Apply any externally detected TSC adjustments (due to suspend) */
3310 if (unlikely(vcpu->arch.tsc_offset_adjustment)) { 3314 if (unlikely(vcpu->arch.tsc_offset_adjustment)) {
3311 adjust_tsc_offset_host(vcpu, vcpu->arch.tsc_offset_adjustment); 3315 adjust_tsc_offset_host(vcpu, vcpu->arch.tsc_offset_adjustment);
@@ -7202,7 +7206,7 @@ static void kvm_sched_yield(struct kvm *kvm, unsigned long dest_id)
7202 7206
7203 rcu_read_unlock(); 7207 rcu_read_unlock();
7204 7208
7205 if (target) 7209 if (target && READ_ONCE(target->ready))
7206 kvm_vcpu_yield_to(target); 7210 kvm_vcpu_yield_to(target);
7207} 7211}
7208 7212
@@ -7242,6 +7246,7 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
7242 break; 7246 break;
7243 case KVM_HC_KICK_CPU: 7247 case KVM_HC_KICK_CPU:
7244 kvm_pv_kick_cpu_op(vcpu->kvm, a0, a1); 7248 kvm_pv_kick_cpu_op(vcpu->kvm, a0, a1);
7249 kvm_sched_yield(vcpu->kvm, a1);
7245 ret = 0; 7250 ret = 0;
7246 break; 7251 break;
7247#ifdef CONFIG_X86_64 7252#ifdef CONFIG_X86_64
@@ -7990,9 +7995,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
7990 trace_kvm_entry(vcpu->vcpu_id); 7995 trace_kvm_entry(vcpu->vcpu_id);
7991 guest_enter_irqoff(); 7996 guest_enter_irqoff();
7992 7997
7993 fpregs_assert_state_consistent(); 7998 /* The preempt notifier should have taken care of the FPU already. */
7994 if (test_thread_flag(TIF_NEED_FPU_LOAD)) 7999 WARN_ON_ONCE(test_thread_flag(TIF_NEED_FPU_LOAD));
7995 switch_fpu_return();
7996 8000
7997 if (unlikely(vcpu->arch.switch_db_regs)) { 8001 if (unlikely(vcpu->arch.switch_db_regs)) {
7998 set_debugreg(0, 7); 8002 set_debugreg(0, 7);
@@ -8270,7 +8274,7 @@ static void kvm_load_guest_fpu(struct kvm_vcpu *vcpu)
8270{ 8274{
8271 fpregs_lock(); 8275 fpregs_lock();
8272 8276
8273 copy_fpregs_to_fpstate(&current->thread.fpu); 8277 copy_fpregs_to_fpstate(vcpu->arch.user_fpu);
8274 /* PKRU is separately restored in kvm_x86_ops->run. */ 8278 /* PKRU is separately restored in kvm_x86_ops->run. */
8275 __copy_kernel_to_fpregs(&vcpu->arch.guest_fpu->state, 8279 __copy_kernel_to_fpregs(&vcpu->arch.guest_fpu->state,
8276 ~XFEATURE_MASK_PKRU); 8280 ~XFEATURE_MASK_PKRU);
@@ -8287,7 +8291,7 @@ static void kvm_put_guest_fpu(struct kvm_vcpu *vcpu)
8287 fpregs_lock(); 8291 fpregs_lock();
8288 8292
8289 copy_fpregs_to_fpstate(vcpu->arch.guest_fpu); 8293 copy_fpregs_to_fpstate(vcpu->arch.guest_fpu);
8290 copy_kernel_to_fpregs(&current->thread.fpu.state); 8294 copy_kernel_to_fpregs(&vcpu->arch.user_fpu->state);
8291 8295
8292 fpregs_mark_activate(); 8296 fpregs_mark_activate();
8293 fpregs_unlock(); 8297 fpregs_unlock();
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 6c46095cd0d9..9ceacd1156db 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -177,13 +177,14 @@ static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address)
177 177
178 pmd = pmd_offset(pud, address); 178 pmd = pmd_offset(pud, address);
179 pmd_k = pmd_offset(pud_k, address); 179 pmd_k = pmd_offset(pud_k, address);
180 if (!pmd_present(*pmd_k))
181 return NULL;
182 180
183 if (!pmd_present(*pmd)) 181 if (pmd_present(*pmd) != pmd_present(*pmd_k))
184 set_pmd(pmd, *pmd_k); 182 set_pmd(pmd, *pmd_k);
183
184 if (!pmd_present(*pmd_k))
185 return NULL;
185 else 186 else
186 BUG_ON(pmd_page(*pmd) != pmd_page(*pmd_k)); 187 BUG_ON(pmd_pfn(*pmd) != pmd_pfn(*pmd_k));
187 188
188 return pmd_k; 189 return pmd_k;
189} 190}
@@ -203,17 +204,13 @@ void vmalloc_sync_all(void)
203 spin_lock(&pgd_lock); 204 spin_lock(&pgd_lock);
204 list_for_each_entry(page, &pgd_list, lru) { 205 list_for_each_entry(page, &pgd_list, lru) {
205 spinlock_t *pgt_lock; 206 spinlock_t *pgt_lock;
206 pmd_t *ret;
207 207
208 /* the pgt_lock only for Xen */ 208 /* the pgt_lock only for Xen */
209 pgt_lock = &pgd_page_get_mm(page)->page_table_lock; 209 pgt_lock = &pgd_page_get_mm(page)->page_table_lock;
210 210
211 spin_lock(pgt_lock); 211 spin_lock(pgt_lock);
212 ret = vmalloc_sync_one(page_address(page), address); 212 vmalloc_sync_one(page_address(page), address);
213 spin_unlock(pgt_lock); 213 spin_unlock(pgt_lock);
214
215 if (!ret)
216 break;
217 } 214 }
218 spin_unlock(&pgd_lock); 215 spin_unlock(&pgd_lock);
219 } 216 }