aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/include/asm/termios.h8
-rw-r--r--arch/alpha/include/uapi/asm/ioctls.h5
-rw-r--r--arch/alpha/include/uapi/asm/termbits.h17
-rw-r--r--arch/arm/boot/dts/imx53-ppd.dts2
-rw-r--r--arch/arm/boot/dts/imx6sll.dtsi2
-rw-r--r--arch/arm/boot/dts/imx6sx-sdb.dtsi7
-rw-r--r--arch/arm/boot/dts/vf610m4-colibri.dts4
-rw-r--r--arch/arm/configs/multi_v7_defconfig1
-rw-r--r--arch/arm/include/asm/cputype.h1
-rw-r--r--arch/arm/include/asm/pgtable-2level.h2
-rw-r--r--arch/arm/include/asm/proc-fns.h61
-rw-r--r--arch/arm/kernel/bugs.c4
-rw-r--r--arch/arm/kernel/head-common.S6
-rw-r--r--arch/arm/kernel/setup.c40
-rw-r--r--arch/arm/kernel/smp.c31
-rw-r--r--arch/arm/mach-omap2/display.c111
-rw-r--r--arch/arm/mm/proc-v7-bugs.c17
-rw-r--r--arch/arm/mm/proc-v7.S2
-rw-r--r--arch/arm/vfp/vfpmodule.c2
-rw-r--r--arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi3
-rw-r--r--arch/arm64/boot/dts/renesas/r8a7795.dtsi2
-rw-r--r--arch/arm64/boot/dts/renesas/r8a77980-condor.dts47
-rw-r--r--arch/arm64/include/asm/processor.h8
-rw-r--r--arch/arm64/kernel/setup.c1
-rw-r--r--arch/arm64/mm/init.c2
-rw-r--r--arch/arm64/mm/mmu.c2
-rw-r--r--arch/m68k/include/asm/pgtable_mm.h4
-rw-r--r--arch/microblaze/include/asm/pgtable.h2
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-helper.c2
-rw-r--r--arch/mips/mm/dma-noncoherent.c2
-rw-r--r--arch/nds32/include/asm/pgtable.h2
-rw-r--r--arch/parisc/include/asm/pgtable.h2
-rw-r--r--arch/parisc/include/asm/spinlock.h4
-rw-r--r--arch/parisc/kernel/syscall.S12
-rw-r--r--arch/powerpc/include/asm/io.h20
-rw-r--r--arch/powerpc/include/asm/ppc-opcode.h2
-rw-r--r--arch/powerpc/include/asm/ptrace.h1
-rw-r--r--arch/powerpc/kernel/setup_64.c2
-rw-r--r--arch/powerpc/kvm/trace.h8
-rw-r--r--arch/powerpc/kvm/trace_booke.h9
-rw-r--r--arch/powerpc/kvm/trace_hv.h9
-rw-r--r--arch/powerpc/kvm/trace_pr.h9
-rw-r--r--arch/powerpc/mm/numa.c2
-rw-r--r--arch/powerpc/mm/slb.c35
-rw-r--r--arch/powerpc/platforms/powernv/npu-dma.c64
-rw-r--r--arch/riscv/Makefile4
-rw-r--r--arch/riscv/configs/defconfig1
-rw-r--r--arch/riscv/include/asm/ptrace.h4
-rw-r--r--arch/riscv/kernel/module.c12
-rw-r--r--arch/riscv/lib/Makefile2
-rw-r--r--arch/s390/Makefile2
-rw-r--r--arch/s390/boot/compressed/Makefile16
-rw-r--r--arch/s390/configs/debug_defconfig14
-rw-r--r--arch/s390/configs/performance_defconfig13
-rw-r--r--arch/s390/defconfig79
-rw-r--r--arch/s390/include/asm/mmu_context.h5
-rw-r--r--arch/s390/include/asm/pgalloc.h6
-rw-r--r--arch/s390/include/asm/pgtable.h18
-rw-r--r--arch/s390/include/asm/processor.h4
-rw-r--r--arch/s390/include/asm/thread_info.h2
-rw-r--r--arch/s390/include/asm/tlb.h6
-rw-r--r--arch/s390/kernel/entry.S6
-rw-r--r--arch/s390/kernel/perf_cpum_cf.c2
-rw-r--r--arch/s390/kernel/perf_cpum_sf.c33
-rw-r--r--arch/s390/kernel/vdso32/Makefile6
-rw-r--r--arch/s390/kernel/vdso64/Makefile6
-rw-r--r--arch/s390/kernel/vmlinux.lds.S4
-rw-r--r--arch/s390/mm/pgalloc.c1
-rw-r--r--arch/s390/numa/numa.c1
-rw-r--r--arch/um/drivers/ubd_kern.c12
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--arch/x86/Makefile4
-rw-r--r--arch/x86/events/intel/uncore.h33
-rw-r--r--arch/x86/events/intel/uncore_snb.c121
-rw-r--r--arch/x86/include/asm/mce.h2
-rw-r--r--arch/x86/include/asm/mshyperv.h2
-rw-r--r--arch/x86/include/asm/page_64_types.h12
-rw-r--r--arch/x86/include/asm/pgtable_64_types.h4
-rw-r--r--arch/x86/include/asm/qspinlock.h13
-rw-r--r--arch/x86/include/asm/xen/page.h35
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c6
-rw-r--r--arch/x86/kernel/cpu/mshyperv.c11
-rw-r--r--arch/x86/kernel/cpu/vmware.c2
-rw-r--r--arch/x86/kernel/ldt.c59
-rw-r--r--arch/x86/kernel/vsmp_64.c84
-rw-r--r--arch/x86/xen/mmu_pv.c6
-rw-r--r--arch/x86/xen/p2m.c3
-rw-r--r--arch/x86/xen/spinlock.c14
-rw-r--r--arch/xtensa/include/asm/processor.h6
-rw-r--r--arch/xtensa/kernel/head.S7
90 files changed, 763 insertions, 500 deletions
diff --git a/arch/alpha/include/asm/termios.h b/arch/alpha/include/asm/termios.h
index 6a8c53dec57e..b7c77bb1bfd2 100644
--- a/arch/alpha/include/asm/termios.h
+++ b/arch/alpha/include/asm/termios.h
@@ -73,9 +73,15 @@
73}) 73})
74 74
75#define user_termios_to_kernel_termios(k, u) \ 75#define user_termios_to_kernel_termios(k, u) \
76 copy_from_user(k, u, sizeof(struct termios)) 76 copy_from_user(k, u, sizeof(struct termios2))
77 77
78#define kernel_termios_to_user_termios(u, k) \ 78#define kernel_termios_to_user_termios(u, k) \
79 copy_to_user(u, k, sizeof(struct termios2))
80
81#define user_termios_to_kernel_termios_1(k, u) \
82 copy_from_user(k, u, sizeof(struct termios))
83
84#define kernel_termios_to_user_termios_1(u, k) \
79 copy_to_user(u, k, sizeof(struct termios)) 85 copy_to_user(u, k, sizeof(struct termios))
80 86
81#endif /* _ALPHA_TERMIOS_H */ 87#endif /* _ALPHA_TERMIOS_H */
diff --git a/arch/alpha/include/uapi/asm/ioctls.h b/arch/alpha/include/uapi/asm/ioctls.h
index 1e9121c9b3c7..971311605288 100644
--- a/arch/alpha/include/uapi/asm/ioctls.h
+++ b/arch/alpha/include/uapi/asm/ioctls.h
@@ -32,6 +32,11 @@
32#define TCXONC _IO('t', 30) 32#define TCXONC _IO('t', 30)
33#define TCFLSH _IO('t', 31) 33#define TCFLSH _IO('t', 31)
34 34
35#define TCGETS2 _IOR('T', 42, struct termios2)
36#define TCSETS2 _IOW('T', 43, struct termios2)
37#define TCSETSW2 _IOW('T', 44, struct termios2)
38#define TCSETSF2 _IOW('T', 45, struct termios2)
39
35#define TIOCSWINSZ _IOW('t', 103, struct winsize) 40#define TIOCSWINSZ _IOW('t', 103, struct winsize)
36#define TIOCGWINSZ _IOR('t', 104, struct winsize) 41#define TIOCGWINSZ _IOR('t', 104, struct winsize)
37#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ 42#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
diff --git a/arch/alpha/include/uapi/asm/termbits.h b/arch/alpha/include/uapi/asm/termbits.h
index de6c8360fbe3..4575ba34a0ea 100644
--- a/arch/alpha/include/uapi/asm/termbits.h
+++ b/arch/alpha/include/uapi/asm/termbits.h
@@ -26,6 +26,19 @@ struct termios {
26 speed_t c_ospeed; /* output speed */ 26 speed_t c_ospeed; /* output speed */
27}; 27};
28 28
29/* Alpha has identical termios and termios2 */
30
31struct termios2 {
32 tcflag_t c_iflag; /* input mode flags */
33 tcflag_t c_oflag; /* output mode flags */
34 tcflag_t c_cflag; /* control mode flags */
35 tcflag_t c_lflag; /* local mode flags */
36 cc_t c_cc[NCCS]; /* control characters */
37 cc_t c_line; /* line discipline (== c_cc[19]) */
38 speed_t c_ispeed; /* input speed */
39 speed_t c_ospeed; /* output speed */
40};
41
29/* Alpha has matching termios and ktermios */ 42/* Alpha has matching termios and ktermios */
30 43
31struct ktermios { 44struct ktermios {
@@ -152,6 +165,7 @@ struct ktermios {
152#define B3000000 00034 165#define B3000000 00034
153#define B3500000 00035 166#define B3500000 00035
154#define B4000000 00036 167#define B4000000 00036
168#define BOTHER 00037
155 169
156#define CSIZE 00001400 170#define CSIZE 00001400
157#define CS5 00000000 171#define CS5 00000000
@@ -169,6 +183,9 @@ struct ktermios {
169#define CMSPAR 010000000000 /* mark or space (stick) parity */ 183#define CMSPAR 010000000000 /* mark or space (stick) parity */
170#define CRTSCTS 020000000000 /* flow control */ 184#define CRTSCTS 020000000000 /* flow control */
171 185
186#define CIBAUD 07600000
187#define IBSHIFT 16
188
172/* c_lflag bits */ 189/* c_lflag bits */
173#define ISIG 0x00000080 190#define ISIG 0x00000080
174#define ICANON 0x00000100 191#define ICANON 0x00000100
diff --git a/arch/arm/boot/dts/imx53-ppd.dts b/arch/arm/boot/dts/imx53-ppd.dts
index b560ff88459b..5ff9a179c83c 100644
--- a/arch/arm/boot/dts/imx53-ppd.dts
+++ b/arch/arm/boot/dts/imx53-ppd.dts
@@ -55,7 +55,7 @@
55 }; 55 };
56 56
57 chosen { 57 chosen {
58 stdout-path = "&uart1:115200n8"; 58 stdout-path = "serial0:115200n8";
59 }; 59 };
60 60
61 memory@70000000 { 61 memory@70000000 {
diff --git a/arch/arm/boot/dts/imx6sll.dtsi b/arch/arm/boot/dts/imx6sll.dtsi
index ed9a980bce85..beefa1b2049d 100644
--- a/arch/arm/boot/dts/imx6sll.dtsi
+++ b/arch/arm/boot/dts/imx6sll.dtsi
@@ -740,7 +740,7 @@
740 i2c1: i2c@21a0000 { 740 i2c1: i2c@21a0000 {
741 #address-cells = <1>; 741 #address-cells = <1>;
742 #size-cells = <0>; 742 #size-cells = <0>;
743 compatible = "fs,imx6sll-i2c", "fsl,imx21-i2c"; 743 compatible = "fsl,imx6sll-i2c", "fsl,imx21-i2c";
744 reg = <0x021a0000 0x4000>; 744 reg = <0x021a0000 0x4000>;
745 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>; 745 interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
746 clocks = <&clks IMX6SLL_CLK_I2C1>; 746 clocks = <&clks IMX6SLL_CLK_I2C1>;
diff --git a/arch/arm/boot/dts/imx6sx-sdb.dtsi b/arch/arm/boot/dts/imx6sx-sdb.dtsi
index 53b3408b5fab..7d7d679945d2 100644
--- a/arch/arm/boot/dts/imx6sx-sdb.dtsi
+++ b/arch/arm/boot/dts/imx6sx-sdb.dtsi
@@ -117,7 +117,9 @@
117 regulator-name = "enet_3v3"; 117 regulator-name = "enet_3v3";
118 regulator-min-microvolt = <3300000>; 118 regulator-min-microvolt = <3300000>;
119 regulator-max-microvolt = <3300000>; 119 regulator-max-microvolt = <3300000>;
120 gpios = <&gpio2 6 GPIO_ACTIVE_LOW>; 120 gpio = <&gpio2 6 GPIO_ACTIVE_LOW>;
121 regulator-boot-on;
122 regulator-always-on;
121 }; 123 };
122 124
123 reg_pcie_gpio: regulator-pcie-gpio { 125 reg_pcie_gpio: regulator-pcie-gpio {
@@ -180,6 +182,7 @@
180 phy-supply = <&reg_enet_3v3>; 182 phy-supply = <&reg_enet_3v3>;
181 phy-mode = "rgmii"; 183 phy-mode = "rgmii";
182 phy-handle = <&ethphy1>; 184 phy-handle = <&ethphy1>;
185 phy-reset-gpios = <&gpio2 7 GPIO_ACTIVE_LOW>;
183 status = "okay"; 186 status = "okay";
184 187
185 mdio { 188 mdio {
@@ -373,6 +376,8 @@
373 MX6SX_PAD_RGMII1_RD3__ENET1_RX_DATA_3 0x3081 376 MX6SX_PAD_RGMII1_RD3__ENET1_RX_DATA_3 0x3081
374 MX6SX_PAD_RGMII1_RX_CTL__ENET1_RX_EN 0x3081 377 MX6SX_PAD_RGMII1_RX_CTL__ENET1_RX_EN 0x3081
375 MX6SX_PAD_ENET2_RX_CLK__ENET2_REF_CLK_25M 0x91 378 MX6SX_PAD_ENET2_RX_CLK__ENET2_REF_CLK_25M 0x91
379 /* phy reset */
380 MX6SX_PAD_ENET2_CRS__GPIO2_IO_7 0x10b0
376 >; 381 >;
377 }; 382 };
378 383
diff --git a/arch/arm/boot/dts/vf610m4-colibri.dts b/arch/arm/boot/dts/vf610m4-colibri.dts
index 41ec66a96990..ca6249558760 100644
--- a/arch/arm/boot/dts/vf610m4-colibri.dts
+++ b/arch/arm/boot/dts/vf610m4-colibri.dts
@@ -50,8 +50,8 @@
50 compatible = "fsl,vf610m4"; 50 compatible = "fsl,vf610m4";
51 51
52 chosen { 52 chosen {
53 bootargs = "console=ttyLP2,115200 clk_ignore_unused init=/linuxrc rw"; 53 bootargs = "clk_ignore_unused init=/linuxrc rw";
54 stdout-path = "&uart2"; 54 stdout-path = "serial2:115200";
55 }; 55 };
56 56
57 memory@8c000000 { 57 memory@8c000000 {
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 1c7616815a86..63af6234c1b6 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -1,7 +1,6 @@
1CONFIG_SYSVIPC=y 1CONFIG_SYSVIPC=y
2CONFIG_NO_HZ=y 2CONFIG_NO_HZ=y
3CONFIG_HIGH_RES_TIMERS=y 3CONFIG_HIGH_RES_TIMERS=y
4CONFIG_PREEMPT=y
5CONFIG_CGROUPS=y 4CONFIG_CGROUPS=y
6CONFIG_BLK_DEV_INITRD=y 5CONFIG_BLK_DEV_INITRD=y
7CONFIG_EMBEDDED=y 6CONFIG_EMBEDDED=y
diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h
index 0d289240b6ca..775cac3c02bb 100644
--- a/arch/arm/include/asm/cputype.h
+++ b/arch/arm/include/asm/cputype.h
@@ -111,6 +111,7 @@
111#include <linux/kernel.h> 111#include <linux/kernel.h>
112 112
113extern unsigned int processor_id; 113extern unsigned int processor_id;
114struct proc_info_list *lookup_processor(u32 midr);
114 115
115#ifdef CONFIG_CPU_CP15 116#ifdef CONFIG_CPU_CP15
116#define read_cpuid(reg) \ 117#define read_cpuid(reg) \
diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h
index 92fd2c8a9af0..12659ce5c1f3 100644
--- a/arch/arm/include/asm/pgtable-2level.h
+++ b/arch/arm/include/asm/pgtable-2level.h
@@ -10,7 +10,7 @@
10#ifndef _ASM_PGTABLE_2LEVEL_H 10#ifndef _ASM_PGTABLE_2LEVEL_H
11#define _ASM_PGTABLE_2LEVEL_H 11#define _ASM_PGTABLE_2LEVEL_H
12 12
13#define __PAGETABLE_PMD_FOLDED 13#define __PAGETABLE_PMD_FOLDED 1
14 14
15/* 15/*
16 * Hardware-wise, we have a two level page table structure, where the first 16 * Hardware-wise, we have a two level page table structure, where the first
diff --git a/arch/arm/include/asm/proc-fns.h b/arch/arm/include/asm/proc-fns.h
index e25f4392e1b2..e1b6f280ab08 100644
--- a/arch/arm/include/asm/proc-fns.h
+++ b/arch/arm/include/asm/proc-fns.h
@@ -23,7 +23,7 @@ struct mm_struct;
23/* 23/*
24 * Don't change this structure - ASM code relies on it. 24 * Don't change this structure - ASM code relies on it.
25 */ 25 */
26extern struct processor { 26struct processor {
27 /* MISC 27 /* MISC
28 * get data abort address/flags 28 * get data abort address/flags
29 */ 29 */
@@ -79,9 +79,13 @@ extern struct processor {
79 unsigned int suspend_size; 79 unsigned int suspend_size;
80 void (*do_suspend)(void *); 80 void (*do_suspend)(void *);
81 void (*do_resume)(void *); 81 void (*do_resume)(void *);
82} processor; 82};
83 83
84#ifndef MULTI_CPU 84#ifndef MULTI_CPU
85static inline void init_proc_vtable(const struct processor *p)
86{
87}
88
85extern void cpu_proc_init(void); 89extern void cpu_proc_init(void);
86extern void cpu_proc_fin(void); 90extern void cpu_proc_fin(void);
87extern int cpu_do_idle(void); 91extern int cpu_do_idle(void);
@@ -98,17 +102,50 @@ extern void cpu_reset(unsigned long addr, bool hvc) __attribute__((noreturn));
98extern void cpu_do_suspend(void *); 102extern void cpu_do_suspend(void *);
99extern void cpu_do_resume(void *); 103extern void cpu_do_resume(void *);
100#else 104#else
101#define cpu_proc_init processor._proc_init
102#define cpu_proc_fin processor._proc_fin
103#define cpu_reset processor.reset
104#define cpu_do_idle processor._do_idle
105#define cpu_dcache_clean_area processor.dcache_clean_area
106#define cpu_set_pte_ext processor.set_pte_ext
107#define cpu_do_switch_mm processor.switch_mm
108 105
109/* These three are private to arch/arm/kernel/suspend.c */ 106extern struct processor processor;
110#define cpu_do_suspend processor.do_suspend 107#if defined(CONFIG_BIG_LITTLE) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR)
111#define cpu_do_resume processor.do_resume 108#include <linux/smp.h>
109/*
110 * This can't be a per-cpu variable because we need to access it before
111 * per-cpu has been initialised. We have a couple of functions that are
112 * called in a pre-emptible context, and so can't use smp_processor_id()
113 * there, hence PROC_TABLE(). We insist in init_proc_vtable() that the
114 * function pointers for these are identical across all CPUs.
115 */
116extern struct processor *cpu_vtable[];
117#define PROC_VTABLE(f) cpu_vtable[smp_processor_id()]->f
118#define PROC_TABLE(f) cpu_vtable[0]->f
119static inline void init_proc_vtable(const struct processor *p)
120{
121 unsigned int cpu = smp_processor_id();
122 *cpu_vtable[cpu] = *p;
123 WARN_ON_ONCE(cpu_vtable[cpu]->dcache_clean_area !=
124 cpu_vtable[0]->dcache_clean_area);
125 WARN_ON_ONCE(cpu_vtable[cpu]->set_pte_ext !=
126 cpu_vtable[0]->set_pte_ext);
127}
128#else
129#define PROC_VTABLE(f) processor.f
130#define PROC_TABLE(f) processor.f
131static inline void init_proc_vtable(const struct processor *p)
132{
133 processor = *p;
134}
135#endif
136
137#define cpu_proc_init PROC_VTABLE(_proc_init)
138#define cpu_check_bugs PROC_VTABLE(check_bugs)
139#define cpu_proc_fin PROC_VTABLE(_proc_fin)
140#define cpu_reset PROC_VTABLE(reset)
141#define cpu_do_idle PROC_VTABLE(_do_idle)
142#define cpu_dcache_clean_area PROC_TABLE(dcache_clean_area)
143#define cpu_set_pte_ext PROC_TABLE(set_pte_ext)
144#define cpu_do_switch_mm PROC_VTABLE(switch_mm)
145
146/* These two are private to arch/arm/kernel/suspend.c */
147#define cpu_do_suspend PROC_VTABLE(do_suspend)
148#define cpu_do_resume PROC_VTABLE(do_resume)
112#endif 149#endif
113 150
114extern void cpu_resume(void); 151extern void cpu_resume(void);
diff --git a/arch/arm/kernel/bugs.c b/arch/arm/kernel/bugs.c
index 7be511310191..d41d3598e5e5 100644
--- a/arch/arm/kernel/bugs.c
+++ b/arch/arm/kernel/bugs.c
@@ -6,8 +6,8 @@
6void check_other_bugs(void) 6void check_other_bugs(void)
7{ 7{
8#ifdef MULTI_CPU 8#ifdef MULTI_CPU
9 if (processor.check_bugs) 9 if (cpu_check_bugs)
10 processor.check_bugs(); 10 cpu_check_bugs();
11#endif 11#endif
12} 12}
13 13
diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S
index 6e0375e7db05..997b02302c31 100644
--- a/arch/arm/kernel/head-common.S
+++ b/arch/arm/kernel/head-common.S
@@ -145,6 +145,9 @@ __mmap_switched_data:
145#endif 145#endif
146 .size __mmap_switched_data, . - __mmap_switched_data 146 .size __mmap_switched_data, . - __mmap_switched_data
147 147
148 __FINIT
149 .text
150
148/* 151/*
149 * This provides a C-API version of __lookup_processor_type 152 * This provides a C-API version of __lookup_processor_type
150 */ 153 */
@@ -156,9 +159,6 @@ ENTRY(lookup_processor_type)
156 ldmfd sp!, {r4 - r6, r9, pc} 159 ldmfd sp!, {r4 - r6, r9, pc}
157ENDPROC(lookup_processor_type) 160ENDPROC(lookup_processor_type)
158 161
159 __FINIT
160 .text
161
162/* 162/*
163 * Read processor ID register (CP#15, CR0), and look up in the linker-built 163 * Read processor ID register (CP#15, CR0), and look up in the linker-built
164 * supported processor list. Note that we can't use the absolute addresses 164 * supported processor list. Note that we can't use the absolute addresses
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index ac7e08886863..375b13f7e780 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -114,6 +114,11 @@ EXPORT_SYMBOL(elf_hwcap2);
114 114
115#ifdef MULTI_CPU 115#ifdef MULTI_CPU
116struct processor processor __ro_after_init; 116struct processor processor __ro_after_init;
117#if defined(CONFIG_BIG_LITTLE) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR)
118struct processor *cpu_vtable[NR_CPUS] = {
119 [0] = &processor,
120};
121#endif
117#endif 122#endif
118#ifdef MULTI_TLB 123#ifdef MULTI_TLB
119struct cpu_tlb_fns cpu_tlb __ro_after_init; 124struct cpu_tlb_fns cpu_tlb __ro_after_init;
@@ -666,28 +671,33 @@ static void __init smp_build_mpidr_hash(void)
666} 671}
667#endif 672#endif
668 673
669static void __init setup_processor(void) 674/*
675 * locate processor in the list of supported processor types. The linker
676 * builds this table for us from the entries in arch/arm/mm/proc-*.S
677 */
678struct proc_info_list *lookup_processor(u32 midr)
670{ 679{
671 struct proc_info_list *list; 680 struct proc_info_list *list = lookup_processor_type(midr);
672 681
673 /*
674 * locate processor in the list of supported processor
675 * types. The linker builds this table for us from the
676 * entries in arch/arm/mm/proc-*.S
677 */
678 list = lookup_processor_type(read_cpuid_id());
679 if (!list) { 682 if (!list) {
680 pr_err("CPU configuration botched (ID %08x), unable to continue.\n", 683 pr_err("CPU%u: configuration botched (ID %08x), CPU halted\n",
681 read_cpuid_id()); 684 smp_processor_id(), midr);
682 while (1); 685 while (1)
686 /* can't use cpu_relax() here as it may require MMU setup */;
683 } 687 }
684 688
689 return list;
690}
691
692static void __init setup_processor(void)
693{
694 unsigned int midr = read_cpuid_id();
695 struct proc_info_list *list = lookup_processor(midr);
696
685 cpu_name = list->cpu_name; 697 cpu_name = list->cpu_name;
686 __cpu_architecture = __get_cpu_architecture(); 698 __cpu_architecture = __get_cpu_architecture();
687 699
688#ifdef MULTI_CPU 700 init_proc_vtable(list->proc);
689 processor = *list->proc;
690#endif
691#ifdef MULTI_TLB 701#ifdef MULTI_TLB
692 cpu_tlb = *list->tlb; 702 cpu_tlb = *list->tlb;
693#endif 703#endif
@@ -699,7 +709,7 @@ static void __init setup_processor(void)
699#endif 709#endif
700 710
701 pr_info("CPU: %s [%08x] revision %d (ARMv%s), cr=%08lx\n", 711 pr_info("CPU: %s [%08x] revision %d (ARMv%s), cr=%08lx\n",
702 cpu_name, read_cpuid_id(), read_cpuid_id() & 15, 712 list->cpu_name, midr, midr & 15,
703 proc_arch[cpu_architecture()], get_cr()); 713 proc_arch[cpu_architecture()], get_cr());
704 714
705 snprintf(init_utsname()->machine, __NEW_UTS_LEN + 1, "%s%c", 715 snprintf(init_utsname()->machine, __NEW_UTS_LEN + 1, "%s%c",
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 0978282d5fc2..12a6172263c0 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -42,6 +42,7 @@
42#include <asm/mmu_context.h> 42#include <asm/mmu_context.h>
43#include <asm/pgtable.h> 43#include <asm/pgtable.h>
44#include <asm/pgalloc.h> 44#include <asm/pgalloc.h>
45#include <asm/procinfo.h>
45#include <asm/processor.h> 46#include <asm/processor.h>
46#include <asm/sections.h> 47#include <asm/sections.h>
47#include <asm/tlbflush.h> 48#include <asm/tlbflush.h>
@@ -102,6 +103,30 @@ static unsigned long get_arch_pgd(pgd_t *pgd)
102#endif 103#endif
103} 104}
104 105
106#if defined(CONFIG_BIG_LITTLE) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR)
107static int secondary_biglittle_prepare(unsigned int cpu)
108{
109 if (!cpu_vtable[cpu])
110 cpu_vtable[cpu] = kzalloc(sizeof(*cpu_vtable[cpu]), GFP_KERNEL);
111
112 return cpu_vtable[cpu] ? 0 : -ENOMEM;
113}
114
115static void secondary_biglittle_init(void)
116{
117 init_proc_vtable(lookup_processor(read_cpuid_id())->proc);
118}
119#else
120static int secondary_biglittle_prepare(unsigned int cpu)
121{
122 return 0;
123}
124
125static void secondary_biglittle_init(void)
126{
127}
128#endif
129
105int __cpu_up(unsigned int cpu, struct task_struct *idle) 130int __cpu_up(unsigned int cpu, struct task_struct *idle)
106{ 131{
107 int ret; 132 int ret;
@@ -109,6 +134,10 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle)
109 if (!smp_ops.smp_boot_secondary) 134 if (!smp_ops.smp_boot_secondary)
110 return -ENOSYS; 135 return -ENOSYS;
111 136
137 ret = secondary_biglittle_prepare(cpu);
138 if (ret)
139 return ret;
140
112 /* 141 /*
113 * We need to tell the secondary core where to find 142 * We need to tell the secondary core where to find
114 * its stack and the page tables. 143 * its stack and the page tables.
@@ -359,6 +388,8 @@ asmlinkage void secondary_start_kernel(void)
359 struct mm_struct *mm = &init_mm; 388 struct mm_struct *mm = &init_mm;
360 unsigned int cpu; 389 unsigned int cpu;
361 390
391 secondary_biglittle_init();
392
362 /* 393 /*
363 * The identity mapping is uncached (strongly ordered), so 394 * The identity mapping is uncached (strongly ordered), so
364 * switch away from it before attempting any exclusive accesses. 395 * switch away from it before attempting any exclusive accesses.
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 9500b6e27380..f86b72d1d59e 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -209,11 +209,61 @@ static int __init omapdss_init_fbdev(void)
209 209
210 return 0; 210 return 0;
211} 211}
212#else 212
213static inline int omapdss_init_fbdev(void) 213static const char * const omapdss_compat_names[] __initconst = {
214 "ti,omap2-dss",
215 "ti,omap3-dss",
216 "ti,omap4-dss",
217 "ti,omap5-dss",
218 "ti,dra7-dss",
219};
220
221static struct device_node * __init omapdss_find_dss_of_node(void)
214{ 222{
215 return 0; 223 struct device_node *node;
224 int i;
225
226 for (i = 0; i < ARRAY_SIZE(omapdss_compat_names); ++i) {
227 node = of_find_compatible_node(NULL, NULL,
228 omapdss_compat_names[i]);
229 if (node)
230 return node;
231 }
232
233 return NULL;
216} 234}
235
236static int __init omapdss_init_of(void)
237{
238 int r;
239 struct device_node *node;
240 struct platform_device *pdev;
241
242 /* only create dss helper devices if dss is enabled in the .dts */
243
244 node = omapdss_find_dss_of_node();
245 if (!node)
246 return 0;
247
248 if (!of_device_is_available(node))
249 return 0;
250
251 pdev = of_find_device_by_node(node);
252
253 if (!pdev) {
254 pr_err("Unable to find DSS platform device\n");
255 return -ENODEV;
256 }
257
258 r = of_platform_populate(node, NULL, NULL, &pdev->dev);
259 if (r) {
260 pr_err("Unable to populate DSS submodule devices\n");
261 return r;
262 }
263
264 return omapdss_init_fbdev();
265}
266omap_device_initcall(omapdss_init_of);
217#endif /* CONFIG_FB_OMAP2 */ 267#endif /* CONFIG_FB_OMAP2 */
218 268
219static void dispc_disable_outputs(void) 269static void dispc_disable_outputs(void)
@@ -361,58 +411,3 @@ int omap_dss_reset(struct omap_hwmod *oh)
361 411
362 return r; 412 return r;
363} 413}
364
365static const char * const omapdss_compat_names[] __initconst = {
366 "ti,omap2-dss",
367 "ti,omap3-dss",
368 "ti,omap4-dss",
369 "ti,omap5-dss",
370 "ti,dra7-dss",
371};
372
373static struct device_node * __init omapdss_find_dss_of_node(void)
374{
375 struct device_node *node;
376 int i;
377
378 for (i = 0; i < ARRAY_SIZE(omapdss_compat_names); ++i) {
379 node = of_find_compatible_node(NULL, NULL,
380 omapdss_compat_names[i]);
381 if (node)
382 return node;
383 }
384
385 return NULL;
386}
387
388static int __init omapdss_init_of(void)
389{
390 int r;
391 struct device_node *node;
392 struct platform_device *pdev;
393
394 /* only create dss helper devices if dss is enabled in the .dts */
395
396 node = omapdss_find_dss_of_node();
397 if (!node)
398 return 0;
399
400 if (!of_device_is_available(node))
401 return 0;
402
403 pdev = of_find_device_by_node(node);
404
405 if (!pdev) {
406 pr_err("Unable to find DSS platform device\n");
407 return -ENODEV;
408 }
409
410 r = of_platform_populate(node, NULL, NULL, &pdev->dev);
411 if (r) {
412 pr_err("Unable to populate DSS submodule devices\n");
413 return r;
414 }
415
416 return omapdss_init_fbdev();
417}
418omap_device_initcall(omapdss_init_of);
diff --git a/arch/arm/mm/proc-v7-bugs.c b/arch/arm/mm/proc-v7-bugs.c
index 5544b82a2e7a..9a07916af8dd 100644
--- a/arch/arm/mm/proc-v7-bugs.c
+++ b/arch/arm/mm/proc-v7-bugs.c
@@ -52,8 +52,6 @@ static void cpu_v7_spectre_init(void)
52 case ARM_CPU_PART_CORTEX_A17: 52 case ARM_CPU_PART_CORTEX_A17:
53 case ARM_CPU_PART_CORTEX_A73: 53 case ARM_CPU_PART_CORTEX_A73:
54 case ARM_CPU_PART_CORTEX_A75: 54 case ARM_CPU_PART_CORTEX_A75:
55 if (processor.switch_mm != cpu_v7_bpiall_switch_mm)
56 goto bl_error;
57 per_cpu(harden_branch_predictor_fn, cpu) = 55 per_cpu(harden_branch_predictor_fn, cpu) =
58 harden_branch_predictor_bpiall; 56 harden_branch_predictor_bpiall;
59 spectre_v2_method = "BPIALL"; 57 spectre_v2_method = "BPIALL";
@@ -61,8 +59,6 @@ static void cpu_v7_spectre_init(void)
61 59
62 case ARM_CPU_PART_CORTEX_A15: 60 case ARM_CPU_PART_CORTEX_A15:
63 case ARM_CPU_PART_BRAHMA_B15: 61 case ARM_CPU_PART_BRAHMA_B15:
64 if (processor.switch_mm != cpu_v7_iciallu_switch_mm)
65 goto bl_error;
66 per_cpu(harden_branch_predictor_fn, cpu) = 62 per_cpu(harden_branch_predictor_fn, cpu) =
67 harden_branch_predictor_iciallu; 63 harden_branch_predictor_iciallu;
68 spectre_v2_method = "ICIALLU"; 64 spectre_v2_method = "ICIALLU";
@@ -88,11 +84,9 @@ static void cpu_v7_spectre_init(void)
88 ARM_SMCCC_ARCH_WORKAROUND_1, &res); 84 ARM_SMCCC_ARCH_WORKAROUND_1, &res);
89 if ((int)res.a0 != 0) 85 if ((int)res.a0 != 0)
90 break; 86 break;
91 if (processor.switch_mm != cpu_v7_hvc_switch_mm && cpu)
92 goto bl_error;
93 per_cpu(harden_branch_predictor_fn, cpu) = 87 per_cpu(harden_branch_predictor_fn, cpu) =
94 call_hvc_arch_workaround_1; 88 call_hvc_arch_workaround_1;
95 processor.switch_mm = cpu_v7_hvc_switch_mm; 89 cpu_do_switch_mm = cpu_v7_hvc_switch_mm;
96 spectre_v2_method = "hypervisor"; 90 spectre_v2_method = "hypervisor";
97 break; 91 break;
98 92
@@ -101,11 +95,9 @@ static void cpu_v7_spectre_init(void)
101 ARM_SMCCC_ARCH_WORKAROUND_1, &res); 95 ARM_SMCCC_ARCH_WORKAROUND_1, &res);
102 if ((int)res.a0 != 0) 96 if ((int)res.a0 != 0)
103 break; 97 break;
104 if (processor.switch_mm != cpu_v7_smc_switch_mm && cpu)
105 goto bl_error;
106 per_cpu(harden_branch_predictor_fn, cpu) = 98 per_cpu(harden_branch_predictor_fn, cpu) =
107 call_smc_arch_workaround_1; 99 call_smc_arch_workaround_1;
108 processor.switch_mm = cpu_v7_smc_switch_mm; 100 cpu_do_switch_mm = cpu_v7_smc_switch_mm;
109 spectre_v2_method = "firmware"; 101 spectre_v2_method = "firmware";
110 break; 102 break;
111 103
@@ -119,11 +111,6 @@ static void cpu_v7_spectre_init(void)
119 if (spectre_v2_method) 111 if (spectre_v2_method)
120 pr_info("CPU%u: Spectre v2: using %s workaround\n", 112 pr_info("CPU%u: Spectre v2: using %s workaround\n",
121 smp_processor_id(), spectre_v2_method); 113 smp_processor_id(), spectre_v2_method);
122 return;
123
124bl_error:
125 pr_err("CPU%u: Spectre v2: incorrect context switching function, system vulnerable\n",
126 cpu);
127} 114}
128#else 115#else
129static void cpu_v7_spectre_init(void) 116static void cpu_v7_spectre_init(void)
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 6fe52819e014..339eb17c9808 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -112,7 +112,7 @@ ENTRY(cpu_v7_hvc_switch_mm)
112 hvc #0 112 hvc #0
113 ldmfd sp!, {r0 - r3} 113 ldmfd sp!, {r0 - r3}
114 b cpu_v7_switch_mm 114 b cpu_v7_switch_mm
115ENDPROC(cpu_v7_smc_switch_mm) 115ENDPROC(cpu_v7_hvc_switch_mm)
116#endif 116#endif
117ENTRY(cpu_v7_iciallu_switch_mm) 117ENTRY(cpu_v7_iciallu_switch_mm)
118 mov r3, #0 118 mov r3, #0
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index aff6e6eadc70..ee7b07938dd5 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -573,7 +573,7 @@ int vfp_preserve_user_clear_hwstate(struct user_vfp *ufp,
573 */ 573 */
574 ufp_exc->fpexc = hwstate->fpexc; 574 ufp_exc->fpexc = hwstate->fpexc;
575 ufp_exc->fpinst = hwstate->fpinst; 575 ufp_exc->fpinst = hwstate->fpinst;
576 ufp_exc->fpinst2 = ufp_exc->fpinst2; 576 ufp_exc->fpinst2 = hwstate->fpinst2;
577 577
578 /* Ensure that VFP is disabled. */ 578 /* Ensure that VFP is disabled. */
579 vfp_flush_hwstate(thread); 579 vfp_flush_hwstate(thread);
diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi
index 8253a1a9e985..fef7351e9f67 100644
--- a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi
+++ b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi
@@ -139,6 +139,7 @@
139 clock-names = "stmmaceth"; 139 clock-names = "stmmaceth";
140 tx-fifo-depth = <16384>; 140 tx-fifo-depth = <16384>;
141 rx-fifo-depth = <16384>; 141 rx-fifo-depth = <16384>;
142 snps,multicast-filter-bins = <256>;
142 status = "disabled"; 143 status = "disabled";
143 }; 144 };
144 145
@@ -154,6 +155,7 @@
154 clock-names = "stmmaceth"; 155 clock-names = "stmmaceth";
155 tx-fifo-depth = <16384>; 156 tx-fifo-depth = <16384>;
156 rx-fifo-depth = <16384>; 157 rx-fifo-depth = <16384>;
158 snps,multicast-filter-bins = <256>;
157 status = "disabled"; 159 status = "disabled";
158 }; 160 };
159 161
@@ -169,6 +171,7 @@
169 clock-names = "stmmaceth"; 171 clock-names = "stmmaceth";
170 tx-fifo-depth = <16384>; 172 tx-fifo-depth = <16384>;
171 rx-fifo-depth = <16384>; 173 rx-fifo-depth = <16384>;
174 snps,multicast-filter-bins = <256>;
172 status = "disabled"; 175 status = "disabled";
173 }; 176 };
174 177
diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
index b5f2273caca4..a79c8d369e0b 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
@@ -652,7 +652,7 @@
652 clock-names = "fck", "brg_int", "scif_clk"; 652 clock-names = "fck", "brg_int", "scif_clk";
653 dmas = <&dmac1 0x35>, <&dmac1 0x34>, 653 dmas = <&dmac1 0x35>, <&dmac1 0x34>,
654 <&dmac2 0x35>, <&dmac2 0x34>; 654 <&dmac2 0x35>, <&dmac2 0x34>;
655 dma-names = "tx", "rx"; 655 dma-names = "tx", "rx", "tx", "rx";
656 power-domains = <&sysc R8A7795_PD_ALWAYS_ON>; 656 power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
657 resets = <&cpg 518>; 657 resets = <&cpg 518>;
658 status = "disabled"; 658 status = "disabled";
diff --git a/arch/arm64/boot/dts/renesas/r8a77980-condor.dts b/arch/arm64/boot/dts/renesas/r8a77980-condor.dts
index fe2e2c051cc9..5a7012be0d6a 100644
--- a/arch/arm64/boot/dts/renesas/r8a77980-condor.dts
+++ b/arch/arm64/boot/dts/renesas/r8a77980-condor.dts
@@ -15,7 +15,7 @@
15 15
16 aliases { 16 aliases {
17 serial0 = &scif0; 17 serial0 = &scif0;
18 ethernet0 = &avb; 18 ethernet0 = &gether;
19 }; 19 };
20 20
21 chosen { 21 chosen {
@@ -97,23 +97,6 @@
97 }; 97 };
98}; 98};
99 99
100&avb {
101 pinctrl-0 = <&avb_pins>;
102 pinctrl-names = "default";
103
104 phy-mode = "rgmii-id";
105 phy-handle = <&phy0>;
106 renesas,no-ether-link;
107 status = "okay";
108
109 phy0: ethernet-phy@0 {
110 rxc-skew-ps = <1500>;
111 reg = <0>;
112 interrupt-parent = <&gpio1>;
113 interrupts = <17 IRQ_TYPE_LEVEL_LOW>;
114 };
115};
116
117&canfd { 100&canfd {
118 pinctrl-0 = <&canfd0_pins>; 101 pinctrl-0 = <&canfd0_pins>;
119 pinctrl-names = "default"; 102 pinctrl-names = "default";
@@ -139,6 +122,23 @@
139 clock-frequency = <32768>; 122 clock-frequency = <32768>;
140}; 123};
141 124
125&gether {
126 pinctrl-0 = <&gether_pins>;
127 pinctrl-names = "default";
128
129 phy-mode = "rgmii-id";
130 phy-handle = <&phy0>;
131 renesas,no-ether-link;
132 status = "okay";
133
134 phy0: ethernet-phy@0 {
135 rxc-skew-ps = <1500>;
136 reg = <0>;
137 interrupt-parent = <&gpio4>;
138 interrupts = <23 IRQ_TYPE_LEVEL_LOW>;
139 };
140};
141
142&i2c0 { 142&i2c0 {
143 pinctrl-0 = <&i2c0_pins>; 143 pinctrl-0 = <&i2c0_pins>;
144 pinctrl-names = "default"; 144 pinctrl-names = "default";
@@ -236,16 +236,17 @@
236}; 236};
237 237
238&pfc { 238&pfc {
239 avb_pins: avb {
240 groups = "avb_mdio", "avb_rgmii";
241 function = "avb";
242 };
243
244 canfd0_pins: canfd0 { 239 canfd0_pins: canfd0 {
245 groups = "canfd0_data_a"; 240 groups = "canfd0_data_a";
246 function = "canfd0"; 241 function = "canfd0";
247 }; 242 };
248 243
244 gether_pins: gether {
245 groups = "gether_mdio_a", "gether_rgmii",
246 "gether_txcrefclk", "gether_txcrefclk_mega";
247 function = "gether";
248 };
249
249 i2c0_pins: i2c0 { 250 i2c0_pins: i2c0 {
250 groups = "i2c0"; 251 groups = "i2c0";
251 function = "i2c0"; 252 function = "i2c0";
diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h
index 3e2091708b8e..6b0d4dff5012 100644
--- a/arch/arm64/include/asm/processor.h
+++ b/arch/arm64/include/asm/processor.h
@@ -24,6 +24,14 @@
24#define KERNEL_DS UL(-1) 24#define KERNEL_DS UL(-1)
25#define USER_DS (TASK_SIZE_64 - 1) 25#define USER_DS (TASK_SIZE_64 - 1)
26 26
27/*
28 * On arm64 systems, unaligned accesses by the CPU are cheap, and so there is
29 * no point in shifting all network buffers by 2 bytes just to make some IP
30 * header fields appear aligned in memory, potentially sacrificing some DMA
31 * performance on some platforms.
32 */
33#define NET_IP_ALIGN 0
34
27#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
28#ifdef __KERNEL__ 36#ifdef __KERNEL__
29 37
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 953e316521fc..f4fc1e0544b7 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -313,6 +313,7 @@ void __init setup_arch(char **cmdline_p)
313 arm64_memblock_init(); 313 arm64_memblock_init();
314 314
315 paging_init(); 315 paging_init();
316 efi_apply_persistent_mem_reservations();
316 317
317 acpi_table_upgrade(); 318 acpi_table_upgrade();
318 319
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 9d9582cac6c4..9b432d9fcada 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -483,8 +483,6 @@ void __init arm64_memblock_init(void)
483 high_memory = __va(memblock_end_of_DRAM() - 1) + 1; 483 high_memory = __va(memblock_end_of_DRAM() - 1) + 1;
484 484
485 dma_contiguous_reserve(arm64_dma_phys_limit); 485 dma_contiguous_reserve(arm64_dma_phys_limit);
486
487 memblock_allow_resize();
488} 486}
489 487
490void __init bootmem_init(void) 488void __init bootmem_init(void)
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 394b8d554def..d1d6601b385d 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -659,6 +659,8 @@ void __init paging_init(void)
659 659
660 memblock_free(__pa_symbol(init_pg_dir), 660 memblock_free(__pa_symbol(init_pg_dir),
661 __pa_symbol(init_pg_end) - __pa_symbol(init_pg_dir)); 661 __pa_symbol(init_pg_end) - __pa_symbol(init_pg_dir));
662
663 memblock_allow_resize();
662} 664}
663 665
664/* 666/*
diff --git a/arch/m68k/include/asm/pgtable_mm.h b/arch/m68k/include/asm/pgtable_mm.h
index 6181e4134483..fe3ddd73a0cc 100644
--- a/arch/m68k/include/asm/pgtable_mm.h
+++ b/arch/m68k/include/asm/pgtable_mm.h
@@ -55,12 +55,12 @@
55 */ 55 */
56#ifdef CONFIG_SUN3 56#ifdef CONFIG_SUN3
57#define PTRS_PER_PTE 16 57#define PTRS_PER_PTE 16
58#define __PAGETABLE_PMD_FOLDED 58#define __PAGETABLE_PMD_FOLDED 1
59#define PTRS_PER_PMD 1 59#define PTRS_PER_PMD 1
60#define PTRS_PER_PGD 2048 60#define PTRS_PER_PGD 2048
61#elif defined(CONFIG_COLDFIRE) 61#elif defined(CONFIG_COLDFIRE)
62#define PTRS_PER_PTE 512 62#define PTRS_PER_PTE 512
63#define __PAGETABLE_PMD_FOLDED 63#define __PAGETABLE_PMD_FOLDED 1
64#define PTRS_PER_PMD 1 64#define PTRS_PER_PMD 1
65#define PTRS_PER_PGD 1024 65#define PTRS_PER_PGD 1024
66#else 66#else
diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index f64ebb9c9a41..e14b6621c933 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -63,7 +63,7 @@ extern int mem_init_done;
63 63
64#include <asm-generic/4level-fixup.h> 64#include <asm-generic/4level-fixup.h>
65 65
66#define __PAGETABLE_PMD_FOLDED 66#define __PAGETABLE_PMD_FOLDED 1
67 67
68#ifdef __KERNEL__ 68#ifdef __KERNEL__
69#ifndef __ASSEMBLY__ 69#ifndef __ASSEMBLY__
diff --git a/arch/mips/cavium-octeon/executive/cvmx-helper.c b/arch/mips/cavium-octeon/executive/cvmx-helper.c
index 75108ec669eb..6c79e8a16a26 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-helper.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-helper.c
@@ -67,7 +67,7 @@ void (*cvmx_override_pko_queue_priority) (int pko_port,
67void (*cvmx_override_ipd_port_setup) (int ipd_port); 67void (*cvmx_override_ipd_port_setup) (int ipd_port);
68 68
69/* Port count per interface */ 69/* Port count per interface */
70static int interface_port_count[5]; 70static int interface_port_count[9];
71 71
72/** 72/**
73 * Return the number of interfaces the chip has. Each interface 73 * Return the number of interfaces the chip has. Each interface
diff --git a/arch/mips/mm/dma-noncoherent.c b/arch/mips/mm/dma-noncoherent.c
index e6c9485cadcf..cb38461391cb 100644
--- a/arch/mips/mm/dma-noncoherent.c
+++ b/arch/mips/mm/dma-noncoherent.c
@@ -50,7 +50,7 @@ void *arch_dma_alloc(struct device *dev, size_t size,
50 void *ret; 50 void *ret;
51 51
52 ret = dma_direct_alloc_pages(dev, size, dma_handle, gfp, attrs); 52 ret = dma_direct_alloc_pages(dev, size, dma_handle, gfp, attrs);
53 if (!ret && !(attrs & DMA_ATTR_NON_CONSISTENT)) { 53 if (ret && !(attrs & DMA_ATTR_NON_CONSISTENT)) {
54 dma_cache_wback_inv((unsigned long) ret, size); 54 dma_cache_wback_inv((unsigned long) ret, size);
55 ret = (void *)UNCAC_ADDR(ret); 55 ret = (void *)UNCAC_ADDR(ret);
56 } 56 }
diff --git a/arch/nds32/include/asm/pgtable.h b/arch/nds32/include/asm/pgtable.h
index d3e19a55cf53..9f52db930c00 100644
--- a/arch/nds32/include/asm/pgtable.h
+++ b/arch/nds32/include/asm/pgtable.h
@@ -4,7 +4,7 @@
4#ifndef _ASMNDS32_PGTABLE_H 4#ifndef _ASMNDS32_PGTABLE_H
5#define _ASMNDS32_PGTABLE_H 5#define _ASMNDS32_PGTABLE_H
6 6
7#define __PAGETABLE_PMD_FOLDED 7#define __PAGETABLE_PMD_FOLDED 1
8#include <asm-generic/4level-fixup.h> 8#include <asm-generic/4level-fixup.h>
9#include <asm-generic/sizes.h> 9#include <asm-generic/sizes.h>
10 10
diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h
index b941ac7d4e70..c7bb74e22436 100644
--- a/arch/parisc/include/asm/pgtable.h
+++ b/arch/parisc/include/asm/pgtable.h
@@ -111,7 +111,7 @@ static inline void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
111#if CONFIG_PGTABLE_LEVELS == 3 111#if CONFIG_PGTABLE_LEVELS == 3
112#define BITS_PER_PMD (PAGE_SHIFT + PMD_ORDER - BITS_PER_PMD_ENTRY) 112#define BITS_PER_PMD (PAGE_SHIFT + PMD_ORDER - BITS_PER_PMD_ENTRY)
113#else 113#else
114#define __PAGETABLE_PMD_FOLDED 114#define __PAGETABLE_PMD_FOLDED 1
115#define BITS_PER_PMD 0 115#define BITS_PER_PMD 0
116#endif 116#endif
117#define PTRS_PER_PMD (1UL << BITS_PER_PMD) 117#define PTRS_PER_PMD (1UL << BITS_PER_PMD)
diff --git a/arch/parisc/include/asm/spinlock.h b/arch/parisc/include/asm/spinlock.h
index 16aec9ba2580..8a63515f03bf 100644
--- a/arch/parisc/include/asm/spinlock.h
+++ b/arch/parisc/include/asm/spinlock.h
@@ -37,8 +37,8 @@ static inline void arch_spin_unlock(arch_spinlock_t *x)
37 volatile unsigned int *a; 37 volatile unsigned int *a;
38 38
39 a = __ldcw_align(x); 39 a = __ldcw_align(x);
40 /* Release with ordered store. */ 40 mb();
41 __asm__ __volatile__("stw,ma %0,0(%1)" : : "r"(1), "r"(a) : "memory"); 41 *a = 1;
42} 42}
43 43
44static inline int arch_spin_trylock(arch_spinlock_t *x) 44static inline int arch_spin_trylock(arch_spinlock_t *x)
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
index 9505c317818d..a9bc90dc4ae7 100644
--- a/arch/parisc/kernel/syscall.S
+++ b/arch/parisc/kernel/syscall.S
@@ -640,7 +640,8 @@ cas_action:
640 sub,<> %r28, %r25, %r0 640 sub,<> %r28, %r25, %r0
6412: stw %r24, 0(%r26) 6412: stw %r24, 0(%r26)
642 /* Free lock */ 642 /* Free lock */
643 stw,ma %r20, 0(%sr2,%r20) 643 sync
644 stw %r20, 0(%sr2,%r20)
644#if ENABLE_LWS_DEBUG 645#if ENABLE_LWS_DEBUG
645 /* Clear thread register indicator */ 646 /* Clear thread register indicator */
646 stw %r0, 4(%sr2,%r20) 647 stw %r0, 4(%sr2,%r20)
@@ -654,7 +655,8 @@ cas_action:
6543: 6553:
655 /* Error occurred on load or store */ 656 /* Error occurred on load or store */
656 /* Free lock */ 657 /* Free lock */
657 stw,ma %r20, 0(%sr2,%r20) 658 sync
659 stw %r20, 0(%sr2,%r20)
658#if ENABLE_LWS_DEBUG 660#if ENABLE_LWS_DEBUG
659 stw %r0, 4(%sr2,%r20) 661 stw %r0, 4(%sr2,%r20)
660#endif 662#endif
@@ -855,7 +857,8 @@ cas2_action:
855 857
856cas2_end: 858cas2_end:
857 /* Free lock */ 859 /* Free lock */
858 stw,ma %r20, 0(%sr2,%r20) 860 sync
861 stw %r20, 0(%sr2,%r20)
859 /* Enable interrupts */ 862 /* Enable interrupts */
860 ssm PSW_SM_I, %r0 863 ssm PSW_SM_I, %r0
861 /* Return to userspace, set no error */ 864 /* Return to userspace, set no error */
@@ -865,7 +868,8 @@ cas2_end:
86522: 86822:
866 /* Error occurred on load or store */ 869 /* Error occurred on load or store */
867 /* Free lock */ 870 /* Free lock */
868 stw,ma %r20, 0(%sr2,%r20) 871 sync
872 stw %r20, 0(%sr2,%r20)
869 ssm PSW_SM_I, %r0 873 ssm PSW_SM_I, %r0
870 ldo 1(%r0),%r28 874 ldo 1(%r0),%r28
871 b lws_exit 875 b lws_exit
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index 3ef40b703c4a..e746becd9d6f 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -268,19 +268,13 @@ extern void _memcpy_toio(volatile void __iomem *dest, const void *src,
268 * their hooks, a bitfield is reserved for use by the platform near the 268 * their hooks, a bitfield is reserved for use by the platform near the
269 * top of MMIO addresses (not PIO, those have to cope the hard way). 269 * top of MMIO addresses (not PIO, those have to cope the hard way).
270 * 270 *
271 * This bit field is 12 bits and is at the top of the IO virtual 271 * The highest address in the kernel virtual space are:
272 * addresses PCI_IO_INDIRECT_TOKEN_MASK.
273 * 272 *
274 * The kernel virtual space is thus: 273 * d0003fffffffffff # with Hash MMU
274 * c00fffffffffffff # with Radix MMU
275 * 275 *
276 * 0xD000000000000000 : vmalloc 276 * The top 4 bits are reserved as the region ID on hash, leaving us 8 bits
277 * 0xD000080000000000 : PCI PHB IO space 277 * that can be used for the field.
278 * 0xD000080080000000 : ioremap
279 * 0xD0000fffffffffff : end of ioremap region
280 *
281 * Since the top 4 bits are reserved as the region ID, we use thus
282 * the next 12 bits and keep 4 bits available for the future if the
283 * virtual address space is ever to be extended.
284 * 278 *
285 * The direct IO mapping operations will then mask off those bits 279 * The direct IO mapping operations will then mask off those bits
286 * before doing the actual access, though that only happen when 280 * before doing the actual access, though that only happen when
@@ -292,8 +286,8 @@ extern void _memcpy_toio(volatile void __iomem *dest, const void *src,
292 */ 286 */
293 287
294#ifdef CONFIG_PPC_INDIRECT_MMIO 288#ifdef CONFIG_PPC_INDIRECT_MMIO
295#define PCI_IO_IND_TOKEN_MASK 0x0fff000000000000ul 289#define PCI_IO_IND_TOKEN_SHIFT 52
296#define PCI_IO_IND_TOKEN_SHIFT 48 290#define PCI_IO_IND_TOKEN_MASK (0xfful << PCI_IO_IND_TOKEN_SHIFT)
297#define PCI_FIX_ADDR(addr) \ 291#define PCI_FIX_ADDR(addr) \
298 ((PCI_IO_ADDR)(((unsigned long)(addr)) & ~PCI_IO_IND_TOKEN_MASK)) 292 ((PCI_IO_ADDR)(((unsigned long)(addr)) & ~PCI_IO_IND_TOKEN_MASK))
299#define PCI_GET_ADDR_TOKEN(addr) \ 293#define PCI_GET_ADDR_TOKEN(addr) \
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index 6093bc8f74e5..a6e9e314c707 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -493,6 +493,8 @@
493 __PPC_RS(t) | __PPC_RA0(a) | __PPC_RB(b)) 493 __PPC_RS(t) | __PPC_RA0(a) | __PPC_RB(b))
494#define PPC_SLBFEE_DOT(t, b) stringify_in_c(.long PPC_INST_SLBFEE | \ 494#define PPC_SLBFEE_DOT(t, b) stringify_in_c(.long PPC_INST_SLBFEE | \
495 __PPC_RT(t) | __PPC_RB(b)) 495 __PPC_RT(t) | __PPC_RB(b))
496#define __PPC_SLBFEE_DOT(t, b) stringify_in_c(.long PPC_INST_SLBFEE | \
497 ___PPC_RT(t) | ___PPC_RB(b))
496#define PPC_ICBT(c,a,b) stringify_in_c(.long PPC_INST_ICBT | \ 498#define PPC_ICBT(c,a,b) stringify_in_c(.long PPC_INST_ICBT | \
497 __PPC_CT(c) | __PPC_RA0(a) | __PPC_RB(b)) 499 __PPC_CT(c) | __PPC_RA0(a) | __PPC_RB(b))
498/* PASemi instructions */ 500/* PASemi instructions */
diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
index f73886a1a7f5..0b8a735b6d85 100644
--- a/arch/powerpc/include/asm/ptrace.h
+++ b/arch/powerpc/include/asm/ptrace.h
@@ -54,6 +54,7 @@ struct pt_regs
54 54
55#ifdef CONFIG_PPC64 55#ifdef CONFIG_PPC64
56 unsigned long ppr; 56 unsigned long ppr;
57 unsigned long __pad; /* Maintain 16 byte interrupt stack alignment */
57#endif 58#endif
58}; 59};
59#endif 60#endif
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 2a51e4cc8246..236c1151a3a7 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -636,6 +636,8 @@ static void *__init alloc_stack(unsigned long limit, int cpu)
636{ 636{
637 unsigned long pa; 637 unsigned long pa;
638 638
639 BUILD_BUG_ON(STACK_INT_FRAME_SIZE % 16);
640
639 pa = memblock_alloc_base_nid(THREAD_SIZE, THREAD_SIZE, limit, 641 pa = memblock_alloc_base_nid(THREAD_SIZE, THREAD_SIZE, limit,
640 early_cpu_to_node(cpu), MEMBLOCK_NONE); 642 early_cpu_to_node(cpu), MEMBLOCK_NONE);
641 if (!pa) { 643 if (!pa) {
diff --git a/arch/powerpc/kvm/trace.h b/arch/powerpc/kvm/trace.h
index 491b0f715d6b..ea1d7c808319 100644
--- a/arch/powerpc/kvm/trace.h
+++ b/arch/powerpc/kvm/trace.h
@@ -6,8 +6,6 @@
6 6
7#undef TRACE_SYSTEM 7#undef TRACE_SYSTEM
8#define TRACE_SYSTEM kvm 8#define TRACE_SYSTEM kvm
9#define TRACE_INCLUDE_PATH .
10#define TRACE_INCLUDE_FILE trace
11 9
12/* 10/*
13 * Tracepoint for guest mode entry. 11 * Tracepoint for guest mode entry.
@@ -120,4 +118,10 @@ TRACE_EVENT(kvm_check_requests,
120#endif /* _TRACE_KVM_H */ 118#endif /* _TRACE_KVM_H */
121 119
122/* This part must be outside protection */ 120/* This part must be outside protection */
121#undef TRACE_INCLUDE_PATH
122#undef TRACE_INCLUDE_FILE
123
124#define TRACE_INCLUDE_PATH .
125#define TRACE_INCLUDE_FILE trace
126
123#include <trace/define_trace.h> 127#include <trace/define_trace.h>
diff --git a/arch/powerpc/kvm/trace_booke.h b/arch/powerpc/kvm/trace_booke.h
index ac640e81fdc5..3837842986aa 100644
--- a/arch/powerpc/kvm/trace_booke.h
+++ b/arch/powerpc/kvm/trace_booke.h
@@ -6,8 +6,6 @@
6 6
7#undef TRACE_SYSTEM 7#undef TRACE_SYSTEM
8#define TRACE_SYSTEM kvm_booke 8#define TRACE_SYSTEM kvm_booke
9#define TRACE_INCLUDE_PATH .
10#define TRACE_INCLUDE_FILE trace_booke
11 9
12#define kvm_trace_symbol_exit \ 10#define kvm_trace_symbol_exit \
13 {0, "CRITICAL"}, \ 11 {0, "CRITICAL"}, \
@@ -218,4 +216,11 @@ TRACE_EVENT(kvm_booke_queue_irqprio,
218#endif 216#endif
219 217
220/* This part must be outside protection */ 218/* This part must be outside protection */
219
220#undef TRACE_INCLUDE_PATH
221#undef TRACE_INCLUDE_FILE
222
223#define TRACE_INCLUDE_PATH .
224#define TRACE_INCLUDE_FILE trace_booke
225
221#include <trace/define_trace.h> 226#include <trace/define_trace.h>
diff --git a/arch/powerpc/kvm/trace_hv.h b/arch/powerpc/kvm/trace_hv.h
index bcfe8a987f6a..8a1e3b0047f1 100644
--- a/arch/powerpc/kvm/trace_hv.h
+++ b/arch/powerpc/kvm/trace_hv.h
@@ -9,8 +9,6 @@
9 9
10#undef TRACE_SYSTEM 10#undef TRACE_SYSTEM
11#define TRACE_SYSTEM kvm_hv 11#define TRACE_SYSTEM kvm_hv
12#define TRACE_INCLUDE_PATH .
13#define TRACE_INCLUDE_FILE trace_hv
14 12
15#define kvm_trace_symbol_hcall \ 13#define kvm_trace_symbol_hcall \
16 {H_REMOVE, "H_REMOVE"}, \ 14 {H_REMOVE, "H_REMOVE"}, \
@@ -497,4 +495,11 @@ TRACE_EVENT(kvmppc_run_vcpu_exit,
497#endif /* _TRACE_KVM_HV_H */ 495#endif /* _TRACE_KVM_HV_H */
498 496
499/* This part must be outside protection */ 497/* This part must be outside protection */
498
499#undef TRACE_INCLUDE_PATH
500#undef TRACE_INCLUDE_FILE
501
502#define TRACE_INCLUDE_PATH .
503#define TRACE_INCLUDE_FILE trace_hv
504
500#include <trace/define_trace.h> 505#include <trace/define_trace.h>
diff --git a/arch/powerpc/kvm/trace_pr.h b/arch/powerpc/kvm/trace_pr.h
index 2f9a8829552b..46a46d328fbf 100644
--- a/arch/powerpc/kvm/trace_pr.h
+++ b/arch/powerpc/kvm/trace_pr.h
@@ -8,8 +8,6 @@
8 8
9#undef TRACE_SYSTEM 9#undef TRACE_SYSTEM
10#define TRACE_SYSTEM kvm_pr 10#define TRACE_SYSTEM kvm_pr
11#define TRACE_INCLUDE_PATH .
12#define TRACE_INCLUDE_FILE trace_pr
13 11
14TRACE_EVENT(kvm_book3s_reenter, 12TRACE_EVENT(kvm_book3s_reenter,
15 TP_PROTO(int r, struct kvm_vcpu *vcpu), 13 TP_PROTO(int r, struct kvm_vcpu *vcpu),
@@ -257,4 +255,11 @@ TRACE_EVENT(kvm_exit,
257#endif /* _TRACE_KVM_H */ 255#endif /* _TRACE_KVM_H */
258 256
259/* This part must be outside protection */ 257/* This part must be outside protection */
258
259#undef TRACE_INCLUDE_PATH
260#undef TRACE_INCLUDE_FILE
261
262#define TRACE_INCLUDE_PATH .
263#define TRACE_INCLUDE_FILE trace_pr
264
260#include <trace/define_trace.h> 265#include <trace/define_trace.h>
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 3a048e98a132..ce28ae5ca080 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1178,7 +1178,7 @@ static long vphn_get_associativity(unsigned long cpu,
1178 1178
1179 switch (rc) { 1179 switch (rc) {
1180 case H_FUNCTION: 1180 case H_FUNCTION:
1181 printk(KERN_INFO 1181 printk_once(KERN_INFO
1182 "VPHN is not supported. Disabling polling...\n"); 1182 "VPHN is not supported. Disabling polling...\n");
1183 stop_topology_update(); 1183 stop_topology_update();
1184 break; 1184 break;
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index c3fdf2969d9f..bc3914d54e26 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -19,6 +19,7 @@
19#include <asm/mmu.h> 19#include <asm/mmu.h>
20#include <asm/mmu_context.h> 20#include <asm/mmu_context.h>
21#include <asm/paca.h> 21#include <asm/paca.h>
22#include <asm/ppc-opcode.h>
22#include <asm/cputable.h> 23#include <asm/cputable.h>
23#include <asm/cacheflush.h> 24#include <asm/cacheflush.h>
24#include <asm/smp.h> 25#include <asm/smp.h>
@@ -58,27 +59,19 @@ static inline unsigned long mk_vsid_data(unsigned long ea, int ssize,
58 return __mk_vsid_data(get_kernel_vsid(ea, ssize), ssize, flags); 59 return __mk_vsid_data(get_kernel_vsid(ea, ssize), ssize, flags);
59} 60}
60 61
61static void assert_slb_exists(unsigned long ea) 62static void assert_slb_presence(bool present, unsigned long ea)
62{ 63{
63#ifdef CONFIG_DEBUG_VM 64#ifdef CONFIG_DEBUG_VM
64 unsigned long tmp; 65 unsigned long tmp;
65 66
66 WARN_ON_ONCE(mfmsr() & MSR_EE); 67 WARN_ON_ONCE(mfmsr() & MSR_EE);
67 68
68 asm volatile("slbfee. %0, %1" : "=r"(tmp) : "r"(ea) : "cr0"); 69 if (!cpu_has_feature(CPU_FTR_ARCH_206))
69 WARN_ON(tmp == 0); 70 return;
70#endif
71}
72
73static void assert_slb_notexists(unsigned long ea)
74{
75#ifdef CONFIG_DEBUG_VM
76 unsigned long tmp;
77 71
78 WARN_ON_ONCE(mfmsr() & MSR_EE); 72 asm volatile(__PPC_SLBFEE_DOT(%0, %1) : "=r"(tmp) : "r"(ea) : "cr0");
79 73
80 asm volatile("slbfee. %0, %1" : "=r"(tmp) : "r"(ea) : "cr0"); 74 WARN_ON(present == (tmp == 0));
81 WARN_ON(tmp != 0);
82#endif 75#endif
83} 76}
84 77
@@ -114,7 +107,7 @@ static inline void create_shadowed_slbe(unsigned long ea, int ssize,
114 */ 107 */
115 slb_shadow_update(ea, ssize, flags, index); 108 slb_shadow_update(ea, ssize, flags, index);
116 109
117 assert_slb_notexists(ea); 110 assert_slb_presence(false, ea);
118 asm volatile("slbmte %0,%1" : 111 asm volatile("slbmte %0,%1" :
119 : "r" (mk_vsid_data(ea, ssize, flags)), 112 : "r" (mk_vsid_data(ea, ssize, flags)),
120 "r" (mk_esid_data(ea, ssize, index)) 113 "r" (mk_esid_data(ea, ssize, index))
@@ -137,7 +130,7 @@ void __slb_restore_bolted_realmode(void)
137 "r" (be64_to_cpu(p->save_area[index].esid))); 130 "r" (be64_to_cpu(p->save_area[index].esid)));
138 } 131 }
139 132
140 assert_slb_exists(local_paca->kstack); 133 assert_slb_presence(true, local_paca->kstack);
141} 134}
142 135
143/* 136/*
@@ -185,7 +178,7 @@ void slb_flush_and_restore_bolted(void)
185 :: "r" (be64_to_cpu(p->save_area[KSTACK_INDEX].vsid)), 178 :: "r" (be64_to_cpu(p->save_area[KSTACK_INDEX].vsid)),
186 "r" (be64_to_cpu(p->save_area[KSTACK_INDEX].esid)) 179 "r" (be64_to_cpu(p->save_area[KSTACK_INDEX].esid))
187 : "memory"); 180 : "memory");
188 assert_slb_exists(get_paca()->kstack); 181 assert_slb_presence(true, get_paca()->kstack);
189 182
190 get_paca()->slb_cache_ptr = 0; 183 get_paca()->slb_cache_ptr = 0;
191 184
@@ -443,9 +436,9 @@ void switch_slb(struct task_struct *tsk, struct mm_struct *mm)
443 ea = (unsigned long) 436 ea = (unsigned long)
444 get_paca()->slb_cache[i] << SID_SHIFT; 437 get_paca()->slb_cache[i] << SID_SHIFT;
445 /* 438 /*
446 * Could assert_slb_exists here, but hypervisor 439 * Could assert_slb_presence(true) here, but
447 * or machine check could have come in and 440 * hypervisor or machine check could have come
448 * removed the entry at this point. 441 * in and removed the entry at this point.
449 */ 442 */
450 443
451 slbie_data = ea; 444 slbie_data = ea;
@@ -676,7 +669,7 @@ static long slb_insert_entry(unsigned long ea, unsigned long context,
676 * User preloads should add isync afterwards in case the kernel 669 * User preloads should add isync afterwards in case the kernel
677 * accesses user memory before it returns to userspace with rfid. 670 * accesses user memory before it returns to userspace with rfid.
678 */ 671 */
679 assert_slb_notexists(ea); 672 assert_slb_presence(false, ea);
680 asm volatile("slbmte %0, %1" : : "r" (vsid_data), "r" (esid_data)); 673 asm volatile("slbmte %0, %1" : : "r" (vsid_data), "r" (esid_data));
681 674
682 barrier(); 675 barrier();
@@ -715,7 +708,7 @@ static long slb_allocate_kernel(unsigned long ea, unsigned long id)
715 return -EFAULT; 708 return -EFAULT;
716 709
717 if (ea < H_VMALLOC_END) 710 if (ea < H_VMALLOC_END)
718 flags = get_paca()->vmalloc_sllp; 711 flags = local_paca->vmalloc_sllp;
719 else 712 else
720 flags = SLB_VSID_KERNEL | mmu_psize_defs[mmu_io_psize].sllp; 713 flags = SLB_VSID_KERNEL | mmu_psize_defs[mmu_io_psize].sllp;
721 } else { 714 } else {
diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c
index 6f60e0931922..75b935252981 100644
--- a/arch/powerpc/platforms/powernv/npu-dma.c
+++ b/arch/powerpc/platforms/powernv/npu-dma.c
@@ -102,63 +102,6 @@ struct pci_dev *pnv_pci_get_npu_dev(struct pci_dev *gpdev, int index)
102} 102}
103EXPORT_SYMBOL(pnv_pci_get_npu_dev); 103EXPORT_SYMBOL(pnv_pci_get_npu_dev);
104 104
105#define NPU_DMA_OP_UNSUPPORTED() \
106 dev_err_once(dev, "%s operation unsupported for NVLink devices\n", \
107 __func__)
108
109static void *dma_npu_alloc(struct device *dev, size_t size,
110 dma_addr_t *dma_handle, gfp_t flag,
111 unsigned long attrs)
112{
113 NPU_DMA_OP_UNSUPPORTED();
114 return NULL;
115}
116
117static void dma_npu_free(struct device *dev, size_t size,
118 void *vaddr, dma_addr_t dma_handle,
119 unsigned long attrs)
120{
121 NPU_DMA_OP_UNSUPPORTED();
122}
123
124static dma_addr_t dma_npu_map_page(struct device *dev, struct page *page,
125 unsigned long offset, size_t size,
126 enum dma_data_direction direction,
127 unsigned long attrs)
128{
129 NPU_DMA_OP_UNSUPPORTED();
130 return 0;
131}
132
133static int dma_npu_map_sg(struct device *dev, struct scatterlist *sglist,
134 int nelems, enum dma_data_direction direction,
135 unsigned long attrs)
136{
137 NPU_DMA_OP_UNSUPPORTED();
138 return 0;
139}
140
141static int dma_npu_dma_supported(struct device *dev, u64 mask)
142{
143 NPU_DMA_OP_UNSUPPORTED();
144 return 0;
145}
146
147static u64 dma_npu_get_required_mask(struct device *dev)
148{
149 NPU_DMA_OP_UNSUPPORTED();
150 return 0;
151}
152
153static const struct dma_map_ops dma_npu_ops = {
154 .map_page = dma_npu_map_page,
155 .map_sg = dma_npu_map_sg,
156 .alloc = dma_npu_alloc,
157 .free = dma_npu_free,
158 .dma_supported = dma_npu_dma_supported,
159 .get_required_mask = dma_npu_get_required_mask,
160};
161
162/* 105/*
163 * Returns the PE assoicated with the PCI device of the given 106 * Returns the PE assoicated with the PCI device of the given
164 * NPU. Returns the linked pci device if pci_dev != NULL. 107 * NPU. Returns the linked pci device if pci_dev != NULL.
@@ -270,10 +213,11 @@ static void pnv_npu_dma_set_32(struct pnv_ioda_pe *npe)
270 rc = pnv_npu_set_window(npe, 0, gpe->table_group.tables[0]); 213 rc = pnv_npu_set_window(npe, 0, gpe->table_group.tables[0]);
271 214
272 /* 215 /*
273 * We don't initialise npu_pe->tce32_table as we always use 216 * NVLink devices use the same TCE table configuration as
274 * dma_npu_ops which are nops. 217 * their parent device so drivers shouldn't be doing DMA
218 * operations directly on these devices.
275 */ 219 */
276 set_dma_ops(&npe->pdev->dev, &dma_npu_ops); 220 set_dma_ops(&npe->pdev->dev, NULL);
277} 221}
278 222
279/* 223/*
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index d10146197533..4af153a182b0 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -77,4 +77,8 @@ core-y += arch/riscv/kernel/ arch/riscv/mm/
77 77
78libs-y += arch/riscv/lib/ 78libs-y += arch/riscv/lib/
79 79
80PHONY += vdso_install
81vdso_install:
82 $(Q)$(MAKE) $(build)=arch/riscv/kernel/vdso $@
83
80all: vmlinux 84all: vmlinux
diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig
index 07fa9ea75fea..ef4f15df9adf 100644
--- a/arch/riscv/configs/defconfig
+++ b/arch/riscv/configs/defconfig
@@ -76,4 +76,5 @@ CONFIG_NFS_V4_1=y
76CONFIG_NFS_V4_2=y 76CONFIG_NFS_V4_2=y
77CONFIG_ROOT_NFS=y 77CONFIG_ROOT_NFS=y
78CONFIG_CRYPTO_USER_API_HASH=y 78CONFIG_CRYPTO_USER_API_HASH=y
79CONFIG_PRINTK_TIME=y
79# CONFIG_RCU_TRACE is not set 80# CONFIG_RCU_TRACE is not set
diff --git a/arch/riscv/include/asm/ptrace.h b/arch/riscv/include/asm/ptrace.h
index 2c5df945d43c..bbe1862e8f80 100644
--- a/arch/riscv/include/asm/ptrace.h
+++ b/arch/riscv/include/asm/ptrace.h
@@ -56,8 +56,8 @@ struct pt_regs {
56 unsigned long sstatus; 56 unsigned long sstatus;
57 unsigned long sbadaddr; 57 unsigned long sbadaddr;
58 unsigned long scause; 58 unsigned long scause;
59 /* a0 value before the syscall */ 59 /* a0 value before the syscall */
60 unsigned long orig_a0; 60 unsigned long orig_a0;
61}; 61};
62 62
63#ifdef CONFIG_64BIT 63#ifdef CONFIG_64BIT
diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c
index 3303ed2cd419..7dd308129b40 100644
--- a/arch/riscv/kernel/module.c
+++ b/arch/riscv/kernel/module.c
@@ -21,7 +21,7 @@ static int apply_r_riscv_32_rela(struct module *me, u32 *location, Elf_Addr v)
21{ 21{
22 if (v != (u32)v) { 22 if (v != (u32)v) {
23 pr_err("%s: value %016llx out of range for 32-bit field\n", 23 pr_err("%s: value %016llx out of range for 32-bit field\n",
24 me->name, v); 24 me->name, (long long)v);
25 return -EINVAL; 25 return -EINVAL;
26 } 26 }
27 *location = v; 27 *location = v;
@@ -102,7 +102,7 @@ static int apply_r_riscv_pcrel_hi20_rela(struct module *me, u32 *location,
102 if (offset != (s32)offset) { 102 if (offset != (s32)offset) {
103 pr_err( 103 pr_err(
104 "%s: target %016llx can not be addressed by the 32-bit offset from PC = %p\n", 104 "%s: target %016llx can not be addressed by the 32-bit offset from PC = %p\n",
105 me->name, v, location); 105 me->name, (long long)v, location);
106 return -EINVAL; 106 return -EINVAL;
107 } 107 }
108 108
@@ -144,7 +144,7 @@ static int apply_r_riscv_hi20_rela(struct module *me, u32 *location,
144 if (IS_ENABLED(CMODEL_MEDLOW)) { 144 if (IS_ENABLED(CMODEL_MEDLOW)) {
145 pr_err( 145 pr_err(
146 "%s: target %016llx can not be addressed by the 32-bit offset from PC = %p\n", 146 "%s: target %016llx can not be addressed by the 32-bit offset from PC = %p\n",
147 me->name, v, location); 147 me->name, (long long)v, location);
148 return -EINVAL; 148 return -EINVAL;
149 } 149 }
150 150
@@ -188,7 +188,7 @@ static int apply_r_riscv_got_hi20_rela(struct module *me, u32 *location,
188 } else { 188 } else {
189 pr_err( 189 pr_err(
190 "%s: can not generate the GOT entry for symbol = %016llx from PC = %p\n", 190 "%s: can not generate the GOT entry for symbol = %016llx from PC = %p\n",
191 me->name, v, location); 191 me->name, (long long)v, location);
192 return -EINVAL; 192 return -EINVAL;
193 } 193 }
194 194
@@ -212,7 +212,7 @@ static int apply_r_riscv_call_plt_rela(struct module *me, u32 *location,
212 } else { 212 } else {
213 pr_err( 213 pr_err(
214 "%s: target %016llx can not be addressed by the 32-bit offset from PC = %p\n", 214 "%s: target %016llx can not be addressed by the 32-bit offset from PC = %p\n",
215 me->name, v, location); 215 me->name, (long long)v, location);
216 return -EINVAL; 216 return -EINVAL;
217 } 217 }
218 } 218 }
@@ -234,7 +234,7 @@ static int apply_r_riscv_call_rela(struct module *me, u32 *location,
234 if (offset != fill_v) { 234 if (offset != fill_v) {
235 pr_err( 235 pr_err(
236 "%s: target %016llx can not be addressed by the 32-bit offset from PC = %p\n", 236 "%s: target %016llx can not be addressed by the 32-bit offset from PC = %p\n",
237 me->name, v, location); 237 me->name, (long long)v, location);
238 return -EINVAL; 238 return -EINVAL;
239 } 239 }
240 240
diff --git a/arch/riscv/lib/Makefile b/arch/riscv/lib/Makefile
index 5739bd05d289..4e2e600f7d53 100644
--- a/arch/riscv/lib/Makefile
+++ b/arch/riscv/lib/Makefile
@@ -3,6 +3,6 @@ lib-y += memcpy.o
3lib-y += memset.o 3lib-y += memset.o
4lib-y += uaccess.o 4lib-y += uaccess.o
5 5
6lib-(CONFIG_64BIT) += tishift.o 6lib-$(CONFIG_64BIT) += tishift.o
7 7
8lib-$(CONFIG_32BIT) += udivdi3.o 8lib-$(CONFIG_32BIT) += udivdi3.o
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index 0b33577932c3..e21053e5e0da 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -27,7 +27,7 @@ KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-option,-ffreestanding)
27KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g) 27KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g)
28KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,)) 28KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,))
29UTS_MACHINE := s390x 29UTS_MACHINE := s390x
30STACK_SIZE := $(if $(CONFIG_KASAN),32768,16384) 30STACK_SIZE := $(if $(CONFIG_KASAN),65536,16384)
31CHECKFLAGS += -D__s390__ -D__s390x__ 31CHECKFLAGS += -D__s390__ -D__s390x__
32 32
33export LD_BFD 33export LD_BFD
diff --git a/arch/s390/boot/compressed/Makefile b/arch/s390/boot/compressed/Makefile
index 593039620487..b1bdd15e3429 100644
--- a/arch/s390/boot/compressed/Makefile
+++ b/arch/s390/boot/compressed/Makefile
@@ -22,10 +22,10 @@ OBJCOPYFLAGS :=
22OBJECTS := $(addprefix $(obj)/,$(obj-y)) 22OBJECTS := $(addprefix $(obj)/,$(obj-y))
23 23
24LDFLAGS_vmlinux := --oformat $(LD_BFD) -e startup -T 24LDFLAGS_vmlinux := --oformat $(LD_BFD) -e startup -T
25$(obj)/vmlinux: $(obj)/vmlinux.lds $(objtree)/arch/s390/boot/startup.a $(OBJECTS) 25$(obj)/vmlinux: $(obj)/vmlinux.lds $(objtree)/arch/s390/boot/startup.a $(OBJECTS) FORCE
26 $(call if_changed,ld) 26 $(call if_changed,ld)
27 27
28OBJCOPYFLAGS_info.bin := -O binary --only-section=.vmlinux.info 28OBJCOPYFLAGS_info.bin := -O binary --only-section=.vmlinux.info --set-section-flags .vmlinux.info=load
29$(obj)/info.bin: vmlinux FORCE 29$(obj)/info.bin: vmlinux FORCE
30 $(call if_changed,objcopy) 30 $(call if_changed,objcopy)
31 31
@@ -46,17 +46,17 @@ suffix-$(CONFIG_KERNEL_LZMA) := .lzma
46suffix-$(CONFIG_KERNEL_LZO) := .lzo 46suffix-$(CONFIG_KERNEL_LZO) := .lzo
47suffix-$(CONFIG_KERNEL_XZ) := .xz 47suffix-$(CONFIG_KERNEL_XZ) := .xz
48 48
49$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) 49$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
50 $(call if_changed,gzip) 50 $(call if_changed,gzip)
51$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) 51$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
52 $(call if_changed,bzip2) 52 $(call if_changed,bzip2)
53$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) 53$(obj)/vmlinux.bin.lz4: $(vmlinux.bin.all-y) FORCE
54 $(call if_changed,lz4) 54 $(call if_changed,lz4)
55$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) 55$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
56 $(call if_changed,lzma) 56 $(call if_changed,lzma)
57$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) 57$(obj)/vmlinux.bin.lzo: $(vmlinux.bin.all-y) FORCE
58 $(call if_changed,lzo) 58 $(call if_changed,lzo)
59$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) 59$(obj)/vmlinux.bin.xz: $(vmlinux.bin.all-y) FORCE
60 $(call if_changed,xzkern) 60 $(call if_changed,xzkern)
61 61
62OBJCOPYFLAGS_piggy.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .data=.vmlinux.bin.compressed 62OBJCOPYFLAGS_piggy.o := -I binary -O elf64-s390 -B s390:64-bit --rename-section .data=.vmlinux.bin.compressed
diff --git a/arch/s390/configs/debug_defconfig b/arch/s390/configs/debug_defconfig
index 259d1698ac50..c69cb04b7a59 100644
--- a/arch/s390/configs/debug_defconfig
+++ b/arch/s390/configs/debug_defconfig
@@ -64,6 +64,8 @@ CONFIG_NUMA=y
64CONFIG_PREEMPT=y 64CONFIG_PREEMPT=y
65CONFIG_HZ_100=y 65CONFIG_HZ_100=y
66CONFIG_KEXEC_FILE=y 66CONFIG_KEXEC_FILE=y
67CONFIG_EXPOLINE=y
68CONFIG_EXPOLINE_AUTO=y
67CONFIG_MEMORY_HOTPLUG=y 69CONFIG_MEMORY_HOTPLUG=y
68CONFIG_MEMORY_HOTREMOVE=y 70CONFIG_MEMORY_HOTREMOVE=y
69CONFIG_KSM=y 71CONFIG_KSM=y
@@ -84,9 +86,11 @@ CONFIG_PCI_DEBUG=y
84CONFIG_HOTPLUG_PCI=y 86CONFIG_HOTPLUG_PCI=y
85CONFIG_HOTPLUG_PCI_S390=y 87CONFIG_HOTPLUG_PCI_S390=y
86CONFIG_CHSC_SCH=y 88CONFIG_CHSC_SCH=y
89CONFIG_VFIO_AP=m
87CONFIG_CRASH_DUMP=y 90CONFIG_CRASH_DUMP=y
88CONFIG_BINFMT_MISC=m 91CONFIG_BINFMT_MISC=m
89CONFIG_HIBERNATION=y 92CONFIG_HIBERNATION=y
93CONFIG_PM_DEBUG=y
90CONFIG_NET=y 94CONFIG_NET=y
91CONFIG_PACKET=y 95CONFIG_PACKET=y
92CONFIG_PACKET_DIAG=m 96CONFIG_PACKET_DIAG=m
@@ -161,8 +165,6 @@ CONFIG_NF_CONNTRACK_TFTP=m
161CONFIG_NF_CT_NETLINK=m 165CONFIG_NF_CT_NETLINK=m
162CONFIG_NF_CT_NETLINK_TIMEOUT=m 166CONFIG_NF_CT_NETLINK_TIMEOUT=m
163CONFIG_NF_TABLES=m 167CONFIG_NF_TABLES=m
164CONFIG_NFT_EXTHDR=m
165CONFIG_NFT_META=m
166CONFIG_NFT_CT=m 168CONFIG_NFT_CT=m
167CONFIG_NFT_COUNTER=m 169CONFIG_NFT_COUNTER=m
168CONFIG_NFT_LOG=m 170CONFIG_NFT_LOG=m
@@ -365,6 +367,8 @@ CONFIG_NET_ACT_SKBEDIT=m
365CONFIG_NET_ACT_CSUM=m 367CONFIG_NET_ACT_CSUM=m
366CONFIG_DNS_RESOLVER=y 368CONFIG_DNS_RESOLVER=y
367CONFIG_OPENVSWITCH=m 369CONFIG_OPENVSWITCH=m
370CONFIG_VSOCKETS=m
371CONFIG_VIRTIO_VSOCKETS=m
368CONFIG_NETLINK_DIAG=m 372CONFIG_NETLINK_DIAG=m
369CONFIG_CGROUP_NET_PRIO=y 373CONFIG_CGROUP_NET_PRIO=y
370CONFIG_BPF_JIT=y 374CONFIG_BPF_JIT=y
@@ -461,6 +465,7 @@ CONFIG_PPTP=m
461CONFIG_PPPOL2TP=m 465CONFIG_PPPOL2TP=m
462CONFIG_PPP_ASYNC=m 466CONFIG_PPP_ASYNC=m
463CONFIG_PPP_SYNC_TTY=m 467CONFIG_PPP_SYNC_TTY=m
468CONFIG_ISM=m
464CONFIG_INPUT_EVDEV=y 469CONFIG_INPUT_EVDEV=y
465# CONFIG_INPUT_KEYBOARD is not set 470# CONFIG_INPUT_KEYBOARD is not set
466# CONFIG_INPUT_MOUSE is not set 471# CONFIG_INPUT_MOUSE is not set
@@ -486,9 +491,12 @@ CONFIG_MLX4_INFINIBAND=m
486CONFIG_MLX5_INFINIBAND=m 491CONFIG_MLX5_INFINIBAND=m
487CONFIG_VFIO=m 492CONFIG_VFIO=m
488CONFIG_VFIO_PCI=m 493CONFIG_VFIO_PCI=m
494CONFIG_VFIO_MDEV=m
495CONFIG_VFIO_MDEV_DEVICE=m
489CONFIG_VIRTIO_PCI=m 496CONFIG_VIRTIO_PCI=m
490CONFIG_VIRTIO_BALLOON=m 497CONFIG_VIRTIO_BALLOON=m
491CONFIG_VIRTIO_INPUT=y 498CONFIG_VIRTIO_INPUT=y
499CONFIG_S390_AP_IOMMU=y
492CONFIG_EXT4_FS=y 500CONFIG_EXT4_FS=y
493CONFIG_EXT4_FS_POSIX_ACL=y 501CONFIG_EXT4_FS_POSIX_ACL=y
494CONFIG_EXT4_FS_SECURITY=y 502CONFIG_EXT4_FS_SECURITY=y
@@ -615,7 +623,6 @@ CONFIG_DEBUG_CREDENTIALS=y
615CONFIG_RCU_TORTURE_TEST=m 623CONFIG_RCU_TORTURE_TEST=m
616CONFIG_RCU_CPU_STALL_TIMEOUT=300 624CONFIG_RCU_CPU_STALL_TIMEOUT=300
617CONFIG_NOTIFIER_ERROR_INJECTION=m 625CONFIG_NOTIFIER_ERROR_INJECTION=m
618CONFIG_PM_NOTIFIER_ERROR_INJECT=m
619CONFIG_NETDEV_NOTIFIER_ERROR_INJECT=m 626CONFIG_NETDEV_NOTIFIER_ERROR_INJECT=m
620CONFIG_FAULT_INJECTION=y 627CONFIG_FAULT_INJECTION=y
621CONFIG_FAILSLAB=y 628CONFIG_FAILSLAB=y
@@ -727,3 +734,4 @@ CONFIG_APPLDATA_BASE=y
727CONFIG_KVM=m 734CONFIG_KVM=m
728CONFIG_KVM_S390_UCONTROL=y 735CONFIG_KVM_S390_UCONTROL=y
729CONFIG_VHOST_NET=m 736CONFIG_VHOST_NET=m
737CONFIG_VHOST_VSOCK=m
diff --git a/arch/s390/configs/performance_defconfig b/arch/s390/configs/performance_defconfig
index 37fd60c20e22..32f539dc9c19 100644
--- a/arch/s390/configs/performance_defconfig
+++ b/arch/s390/configs/performance_defconfig
@@ -65,6 +65,8 @@ CONFIG_NR_CPUS=512
65CONFIG_NUMA=y 65CONFIG_NUMA=y
66CONFIG_HZ_100=y 66CONFIG_HZ_100=y
67CONFIG_KEXEC_FILE=y 67CONFIG_KEXEC_FILE=y
68CONFIG_EXPOLINE=y
69CONFIG_EXPOLINE_AUTO=y
68CONFIG_MEMORY_HOTPLUG=y 70CONFIG_MEMORY_HOTPLUG=y
69CONFIG_MEMORY_HOTREMOVE=y 71CONFIG_MEMORY_HOTREMOVE=y
70CONFIG_KSM=y 72CONFIG_KSM=y
@@ -82,9 +84,11 @@ CONFIG_PCI=y
82CONFIG_HOTPLUG_PCI=y 84CONFIG_HOTPLUG_PCI=y
83CONFIG_HOTPLUG_PCI_S390=y 85CONFIG_HOTPLUG_PCI_S390=y
84CONFIG_CHSC_SCH=y 86CONFIG_CHSC_SCH=y
87CONFIG_VFIO_AP=m
85CONFIG_CRASH_DUMP=y 88CONFIG_CRASH_DUMP=y
86CONFIG_BINFMT_MISC=m 89CONFIG_BINFMT_MISC=m
87CONFIG_HIBERNATION=y 90CONFIG_HIBERNATION=y
91CONFIG_PM_DEBUG=y
88CONFIG_NET=y 92CONFIG_NET=y
89CONFIG_PACKET=y 93CONFIG_PACKET=y
90CONFIG_PACKET_DIAG=m 94CONFIG_PACKET_DIAG=m
@@ -159,8 +163,6 @@ CONFIG_NF_CONNTRACK_TFTP=m
159CONFIG_NF_CT_NETLINK=m 163CONFIG_NF_CT_NETLINK=m
160CONFIG_NF_CT_NETLINK_TIMEOUT=m 164CONFIG_NF_CT_NETLINK_TIMEOUT=m
161CONFIG_NF_TABLES=m 165CONFIG_NF_TABLES=m
162CONFIG_NFT_EXTHDR=m
163CONFIG_NFT_META=m
164CONFIG_NFT_CT=m 166CONFIG_NFT_CT=m
165CONFIG_NFT_COUNTER=m 167CONFIG_NFT_COUNTER=m
166CONFIG_NFT_LOG=m 168CONFIG_NFT_LOG=m
@@ -362,6 +364,8 @@ CONFIG_NET_ACT_SKBEDIT=m
362CONFIG_NET_ACT_CSUM=m 364CONFIG_NET_ACT_CSUM=m
363CONFIG_DNS_RESOLVER=y 365CONFIG_DNS_RESOLVER=y
364CONFIG_OPENVSWITCH=m 366CONFIG_OPENVSWITCH=m
367CONFIG_VSOCKETS=m
368CONFIG_VIRTIO_VSOCKETS=m
365CONFIG_NETLINK_DIAG=m 369CONFIG_NETLINK_DIAG=m
366CONFIG_CGROUP_NET_PRIO=y 370CONFIG_CGROUP_NET_PRIO=y
367CONFIG_BPF_JIT=y 371CONFIG_BPF_JIT=y
@@ -458,6 +462,7 @@ CONFIG_PPTP=m
458CONFIG_PPPOL2TP=m 462CONFIG_PPPOL2TP=m
459CONFIG_PPP_ASYNC=m 463CONFIG_PPP_ASYNC=m
460CONFIG_PPP_SYNC_TTY=m 464CONFIG_PPP_SYNC_TTY=m
465CONFIG_ISM=m
461CONFIG_INPUT_EVDEV=y 466CONFIG_INPUT_EVDEV=y
462# CONFIG_INPUT_KEYBOARD is not set 467# CONFIG_INPUT_KEYBOARD is not set
463# CONFIG_INPUT_MOUSE is not set 468# CONFIG_INPUT_MOUSE is not set
@@ -483,9 +488,12 @@ CONFIG_MLX4_INFINIBAND=m
483CONFIG_MLX5_INFINIBAND=m 488CONFIG_MLX5_INFINIBAND=m
484CONFIG_VFIO=m 489CONFIG_VFIO=m
485CONFIG_VFIO_PCI=m 490CONFIG_VFIO_PCI=m
491CONFIG_VFIO_MDEV=m
492CONFIG_VFIO_MDEV_DEVICE=m
486CONFIG_VIRTIO_PCI=m 493CONFIG_VIRTIO_PCI=m
487CONFIG_VIRTIO_BALLOON=m 494CONFIG_VIRTIO_BALLOON=m
488CONFIG_VIRTIO_INPUT=y 495CONFIG_VIRTIO_INPUT=y
496CONFIG_S390_AP_IOMMU=y
489CONFIG_EXT4_FS=y 497CONFIG_EXT4_FS=y
490CONFIG_EXT4_FS_POSIX_ACL=y 498CONFIG_EXT4_FS_POSIX_ACL=y
491CONFIG_EXT4_FS_SECURITY=y 499CONFIG_EXT4_FS_SECURITY=y
@@ -666,3 +674,4 @@ CONFIG_APPLDATA_BASE=y
666CONFIG_KVM=m 674CONFIG_KVM=m
667CONFIG_KVM_S390_UCONTROL=y 675CONFIG_KVM_S390_UCONTROL=y
668CONFIG_VHOST_NET=m 676CONFIG_VHOST_NET=m
677CONFIG_VHOST_VSOCK=m
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index 7cb6a52f727d..4d58a92b5d97 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -26,14 +26,23 @@ CONFIG_CGROUP_CPUACCT=y
26CONFIG_CGROUP_PERF=y 26CONFIG_CGROUP_PERF=y
27CONFIG_NAMESPACES=y 27CONFIG_NAMESPACES=y
28CONFIG_USER_NS=y 28CONFIG_USER_NS=y
29CONFIG_CHECKPOINT_RESTORE=y
29CONFIG_BLK_DEV_INITRD=y 30CONFIG_BLK_DEV_INITRD=y
30CONFIG_EXPERT=y 31CONFIG_EXPERT=y
31# CONFIG_SYSFS_SYSCALL is not set 32# CONFIG_SYSFS_SYSCALL is not set
32CONFIG_CHECKPOINT_RESTORE=y
33CONFIG_BPF_SYSCALL=y 33CONFIG_BPF_SYSCALL=y
34CONFIG_USERFAULTFD=y 34CONFIG_USERFAULTFD=y
35# CONFIG_COMPAT_BRK is not set 35# CONFIG_COMPAT_BRK is not set
36CONFIG_PROFILING=y 36CONFIG_PROFILING=y
37CONFIG_LIVEPATCH=y
38CONFIG_NR_CPUS=256
39CONFIG_NUMA=y
40CONFIG_HZ_100=y
41CONFIG_KEXEC_FILE=y
42CONFIG_CRASH_DUMP=y
43CONFIG_HIBERNATION=y
44CONFIG_PM_DEBUG=y
45CONFIG_CMM=m
37CONFIG_OPROFILE=y 46CONFIG_OPROFILE=y
38CONFIG_KPROBES=y 47CONFIG_KPROBES=y
39CONFIG_JUMP_LABEL=y 48CONFIG_JUMP_LABEL=y
@@ -44,11 +53,7 @@ CONFIG_BLK_DEV_INTEGRITY=y
44CONFIG_PARTITION_ADVANCED=y 53CONFIG_PARTITION_ADVANCED=y
45CONFIG_IBM_PARTITION=y 54CONFIG_IBM_PARTITION=y
46CONFIG_DEFAULT_DEADLINE=y 55CONFIG_DEFAULT_DEADLINE=y
47CONFIG_LIVEPATCH=y 56CONFIG_BINFMT_MISC=m
48CONFIG_NR_CPUS=256
49CONFIG_NUMA=y
50CONFIG_HZ_100=y
51CONFIG_KEXEC_FILE=y
52CONFIG_MEMORY_HOTPLUG=y 57CONFIG_MEMORY_HOTPLUG=y
53CONFIG_MEMORY_HOTREMOVE=y 58CONFIG_MEMORY_HOTREMOVE=y
54CONFIG_KSM=y 59CONFIG_KSM=y
@@ -60,9 +65,6 @@ CONFIG_ZBUD=m
60CONFIG_ZSMALLOC=m 65CONFIG_ZSMALLOC=m
61CONFIG_ZSMALLOC_STAT=y 66CONFIG_ZSMALLOC_STAT=y
62CONFIG_IDLE_PAGE_TRACKING=y 67CONFIG_IDLE_PAGE_TRACKING=y
63CONFIG_CRASH_DUMP=y
64CONFIG_BINFMT_MISC=m
65CONFIG_HIBERNATION=y
66CONFIG_NET=y 68CONFIG_NET=y
67CONFIG_PACKET=y 69CONFIG_PACKET=y
68CONFIG_UNIX=y 70CONFIG_UNIX=y
@@ -98,6 +100,7 @@ CONFIG_BLK_DEV_NBD=m
98CONFIG_BLK_DEV_RAM=y 100CONFIG_BLK_DEV_RAM=y
99CONFIG_VIRTIO_BLK=y 101CONFIG_VIRTIO_BLK=y
100CONFIG_SCSI=y 102CONFIG_SCSI=y
103# CONFIG_SCSI_MQ_DEFAULT is not set
101CONFIG_BLK_DEV_SD=y 104CONFIG_BLK_DEV_SD=y
102CONFIG_CHR_DEV_ST=y 105CONFIG_CHR_DEV_ST=y
103CONFIG_BLK_DEV_SR=y 106CONFIG_BLK_DEV_SR=y
@@ -131,6 +134,7 @@ CONFIG_EQUALIZER=m
131CONFIG_TUN=m 134CONFIG_TUN=m
132CONFIG_VIRTIO_NET=y 135CONFIG_VIRTIO_NET=y
133# CONFIG_NET_VENDOR_ALACRITECH is not set 136# CONFIG_NET_VENDOR_ALACRITECH is not set
137# CONFIG_NET_VENDOR_AURORA is not set
134# CONFIG_NET_VENDOR_CORTINA is not set 138# CONFIG_NET_VENDOR_CORTINA is not set
135# CONFIG_NET_VENDOR_SOLARFLARE is not set 139# CONFIG_NET_VENDOR_SOLARFLARE is not set
136# CONFIG_NET_VENDOR_SOCIONEXT is not set 140# CONFIG_NET_VENDOR_SOCIONEXT is not set
@@ -157,33 +161,6 @@ CONFIG_TMPFS=y
157CONFIG_TMPFS_POSIX_ACL=y 161CONFIG_TMPFS_POSIX_ACL=y
158CONFIG_HUGETLBFS=y 162CONFIG_HUGETLBFS=y
159# CONFIG_NETWORK_FILESYSTEMS is not set 163# CONFIG_NETWORK_FILESYSTEMS is not set
160CONFIG_DEBUG_INFO=y
161CONFIG_DEBUG_INFO_DWARF4=y
162CONFIG_GDB_SCRIPTS=y
163CONFIG_UNUSED_SYMBOLS=y
164CONFIG_DEBUG_SECTION_MISMATCH=y
165CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y
166CONFIG_MAGIC_SYSRQ=y
167CONFIG_DEBUG_PAGEALLOC=y
168CONFIG_DETECT_HUNG_TASK=y
169CONFIG_PANIC_ON_OOPS=y
170CONFIG_PROVE_LOCKING=y
171CONFIG_LOCK_STAT=y
172CONFIG_DEBUG_LOCKDEP=y
173CONFIG_DEBUG_ATOMIC_SLEEP=y
174CONFIG_DEBUG_LIST=y
175CONFIG_DEBUG_SG=y
176CONFIG_DEBUG_NOTIFIERS=y
177CONFIG_RCU_CPU_STALL_TIMEOUT=60
178CONFIG_LATENCYTOP=y
179CONFIG_SCHED_TRACER=y
180CONFIG_FTRACE_SYSCALLS=y
181CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP=y
182CONFIG_STACK_TRACER=y
183CONFIG_BLK_DEV_IO_TRACE=y
184CONFIG_FUNCTION_PROFILER=y
185# CONFIG_RUNTIME_TESTING_MENU is not set
186CONFIG_S390_PTDUMP=y
187CONFIG_CRYPTO_CRYPTD=m 164CONFIG_CRYPTO_CRYPTD=m
188CONFIG_CRYPTO_AUTHENC=m 165CONFIG_CRYPTO_AUTHENC=m
189CONFIG_CRYPTO_TEST=m 166CONFIG_CRYPTO_TEST=m
@@ -193,6 +170,7 @@ CONFIG_CRYPTO_CBC=y
193CONFIG_CRYPTO_CFB=m 170CONFIG_CRYPTO_CFB=m
194CONFIG_CRYPTO_CTS=m 171CONFIG_CRYPTO_CTS=m
195CONFIG_CRYPTO_LRW=m 172CONFIG_CRYPTO_LRW=m
173CONFIG_CRYPTO_OFB=m
196CONFIG_CRYPTO_PCBC=m 174CONFIG_CRYPTO_PCBC=m
197CONFIG_CRYPTO_XTS=m 175CONFIG_CRYPTO_XTS=m
198CONFIG_CRYPTO_CMAC=m 176CONFIG_CRYPTO_CMAC=m
@@ -231,7 +209,6 @@ CONFIG_CRYPTO_USER_API_HASH=m
231CONFIG_CRYPTO_USER_API_SKCIPHER=m 209CONFIG_CRYPTO_USER_API_SKCIPHER=m
232CONFIG_CRYPTO_USER_API_RNG=m 210CONFIG_CRYPTO_USER_API_RNG=m
233CONFIG_ZCRYPT=m 211CONFIG_ZCRYPT=m
234CONFIG_ZCRYPT_MULTIDEVNODES=y
235CONFIG_PKEY=m 212CONFIG_PKEY=m
236CONFIG_CRYPTO_PAES_S390=m 213CONFIG_CRYPTO_PAES_S390=m
237CONFIG_CRYPTO_SHA1_S390=m 214CONFIG_CRYPTO_SHA1_S390=m
@@ -247,4 +224,30 @@ CONFIG_CRC7=m
247# CONFIG_XZ_DEC_ARM is not set 224# CONFIG_XZ_DEC_ARM is not set
248# CONFIG_XZ_DEC_ARMTHUMB is not set 225# CONFIG_XZ_DEC_ARMTHUMB is not set
249# CONFIG_XZ_DEC_SPARC is not set 226# CONFIG_XZ_DEC_SPARC is not set
250CONFIG_CMM=m 227CONFIG_DEBUG_INFO=y
228CONFIG_DEBUG_INFO_DWARF4=y
229CONFIG_GDB_SCRIPTS=y
230CONFIG_UNUSED_SYMBOLS=y
231CONFIG_DEBUG_SECTION_MISMATCH=y
232CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y
233CONFIG_MAGIC_SYSRQ=y
234CONFIG_DEBUG_PAGEALLOC=y
235CONFIG_DETECT_HUNG_TASK=y
236CONFIG_PANIC_ON_OOPS=y
237CONFIG_PROVE_LOCKING=y
238CONFIG_LOCK_STAT=y
239CONFIG_DEBUG_LOCKDEP=y
240CONFIG_DEBUG_ATOMIC_SLEEP=y
241CONFIG_DEBUG_LIST=y
242CONFIG_DEBUG_SG=y
243CONFIG_DEBUG_NOTIFIERS=y
244CONFIG_RCU_CPU_STALL_TIMEOUT=60
245CONFIG_LATENCYTOP=y
246CONFIG_SCHED_TRACER=y
247CONFIG_FTRACE_SYSCALLS=y
248CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP=y
249CONFIG_STACK_TRACER=y
250CONFIG_BLK_DEV_IO_TRACE=y
251CONFIG_FUNCTION_PROFILER=y
252# CONFIG_RUNTIME_TESTING_MENU is not set
253CONFIG_S390_PTDUMP=y
diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h
index dbd689d556ce..ccbb53e22024 100644
--- a/arch/s390/include/asm/mmu_context.h
+++ b/arch/s390/include/asm/mmu_context.h
@@ -46,8 +46,6 @@ static inline int init_new_context(struct task_struct *tsk,
46 mm->context.asce_limit = STACK_TOP_MAX; 46 mm->context.asce_limit = STACK_TOP_MAX;
47 mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH | 47 mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH |
48 _ASCE_USER_BITS | _ASCE_TYPE_REGION3; 48 _ASCE_USER_BITS | _ASCE_TYPE_REGION3;
49 /* pgd_alloc() did not account this pud */
50 mm_inc_nr_puds(mm);
51 break; 49 break;
52 case -PAGE_SIZE: 50 case -PAGE_SIZE:
53 /* forked 5-level task, set new asce with new_mm->pgd */ 51 /* forked 5-level task, set new asce with new_mm->pgd */
@@ -63,9 +61,6 @@ static inline int init_new_context(struct task_struct *tsk,
63 /* forked 2-level compat task, set new asce with new mm->pgd */ 61 /* forked 2-level compat task, set new asce with new mm->pgd */
64 mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH | 62 mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH |
65 _ASCE_USER_BITS | _ASCE_TYPE_SEGMENT; 63 _ASCE_USER_BITS | _ASCE_TYPE_SEGMENT;
66 /* pgd_alloc() did not account this pmd */
67 mm_inc_nr_pmds(mm);
68 mm_inc_nr_puds(mm);
69 } 64 }
70 crst_table_init((unsigned long *) mm->pgd, pgd_entry_type(mm)); 65 crst_table_init((unsigned long *) mm->pgd, pgd_entry_type(mm));
71 return 0; 66 return 0;
diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h
index f0f9bcf94c03..5ee733720a57 100644
--- a/arch/s390/include/asm/pgalloc.h
+++ b/arch/s390/include/asm/pgalloc.h
@@ -36,11 +36,11 @@ static inline void crst_table_init(unsigned long *crst, unsigned long entry)
36 36
37static inline unsigned long pgd_entry_type(struct mm_struct *mm) 37static inline unsigned long pgd_entry_type(struct mm_struct *mm)
38{ 38{
39 if (mm->context.asce_limit <= _REGION3_SIZE) 39 if (mm_pmd_folded(mm))
40 return _SEGMENT_ENTRY_EMPTY; 40 return _SEGMENT_ENTRY_EMPTY;
41 if (mm->context.asce_limit <= _REGION2_SIZE) 41 if (mm_pud_folded(mm))
42 return _REGION3_ENTRY_EMPTY; 42 return _REGION3_ENTRY_EMPTY;
43 if (mm->context.asce_limit <= _REGION1_SIZE) 43 if (mm_p4d_folded(mm))
44 return _REGION2_ENTRY_EMPTY; 44 return _REGION2_ENTRY_EMPTY;
45 return _REGION1_ENTRY_EMPTY; 45 return _REGION1_ENTRY_EMPTY;
46} 46}
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 411d435e7a7d..063732414dfb 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -493,6 +493,24 @@ static inline int is_module_addr(void *addr)
493 _REGION_ENTRY_PROTECT | \ 493 _REGION_ENTRY_PROTECT | \
494 _REGION_ENTRY_NOEXEC) 494 _REGION_ENTRY_NOEXEC)
495 495
496static inline bool mm_p4d_folded(struct mm_struct *mm)
497{
498 return mm->context.asce_limit <= _REGION1_SIZE;
499}
500#define mm_p4d_folded(mm) mm_p4d_folded(mm)
501
502static inline bool mm_pud_folded(struct mm_struct *mm)
503{
504 return mm->context.asce_limit <= _REGION2_SIZE;
505}
506#define mm_pud_folded(mm) mm_pud_folded(mm)
507
508static inline bool mm_pmd_folded(struct mm_struct *mm)
509{
510 return mm->context.asce_limit <= _REGION3_SIZE;
511}
512#define mm_pmd_folded(mm) mm_pmd_folded(mm)
513
496static inline int mm_has_pgste(struct mm_struct *mm) 514static inline int mm_has_pgste(struct mm_struct *mm)
497{ 515{
498#ifdef CONFIG_PGSTE 516#ifdef CONFIG_PGSTE
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
index 302795c47c06..81038ab357ce 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -236,7 +236,7 @@ static inline unsigned long current_stack_pointer(void)
236 return sp; 236 return sp;
237} 237}
238 238
239static __no_sanitize_address_or_inline unsigned short stap(void) 239static __no_kasan_or_inline unsigned short stap(void)
240{ 240{
241 unsigned short cpu_address; 241 unsigned short cpu_address;
242 242
@@ -330,7 +330,7 @@ static inline void __load_psw(psw_t psw)
330 * Set PSW mask to specified value, while leaving the 330 * Set PSW mask to specified value, while leaving the
331 * PSW addr pointing to the next instruction. 331 * PSW addr pointing to the next instruction.
332 */ 332 */
333static __no_sanitize_address_or_inline void __load_psw_mask(unsigned long mask) 333static __no_kasan_or_inline void __load_psw_mask(unsigned long mask)
334{ 334{
335 unsigned long addr; 335 unsigned long addr;
336 psw_t psw; 336 psw_t psw;
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h
index 27248f42a03c..ce4e17c9aad6 100644
--- a/arch/s390/include/asm/thread_info.h
+++ b/arch/s390/include/asm/thread_info.h
@@ -14,7 +14,7 @@
14 * General size of kernel stacks 14 * General size of kernel stacks
15 */ 15 */
16#ifdef CONFIG_KASAN 16#ifdef CONFIG_KASAN
17#define THREAD_SIZE_ORDER 3 17#define THREAD_SIZE_ORDER 4
18#else 18#else
19#define THREAD_SIZE_ORDER 2 19#define THREAD_SIZE_ORDER 2
20#endif 20#endif
diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h
index 457b7ba0fbb6..b31c779cf581 100644
--- a/arch/s390/include/asm/tlb.h
+++ b/arch/s390/include/asm/tlb.h
@@ -136,7 +136,7 @@ static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
136static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd, 136static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd,
137 unsigned long address) 137 unsigned long address)
138{ 138{
139 if (tlb->mm->context.asce_limit <= _REGION3_SIZE) 139 if (mm_pmd_folded(tlb->mm))
140 return; 140 return;
141 pgtable_pmd_page_dtor(virt_to_page(pmd)); 141 pgtable_pmd_page_dtor(virt_to_page(pmd));
142 tlb_remove_table(tlb, pmd); 142 tlb_remove_table(tlb, pmd);
@@ -152,7 +152,7 @@ static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd,
152static inline void p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d, 152static inline void p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d,
153 unsigned long address) 153 unsigned long address)
154{ 154{
155 if (tlb->mm->context.asce_limit <= _REGION1_SIZE) 155 if (mm_p4d_folded(tlb->mm))
156 return; 156 return;
157 tlb_remove_table(tlb, p4d); 157 tlb_remove_table(tlb, p4d);
158} 158}
@@ -167,7 +167,7 @@ static inline void p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d,
167static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud, 167static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud,
168 unsigned long address) 168 unsigned long address)
169{ 169{
170 if (tlb->mm->context.asce_limit <= _REGION2_SIZE) 170 if (mm_pud_folded(tlb->mm))
171 return; 171 return;
172 tlb_remove_table(tlb, pud); 172 tlb_remove_table(tlb, pud);
173} 173}
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 724fba4d09d2..39191a0feed1 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -236,10 +236,10 @@ ENTRY(__switch_to)
236 stmg %r6,%r15,__SF_GPRS(%r15) # store gprs of prev task 236 stmg %r6,%r15,__SF_GPRS(%r15) # store gprs of prev task
237 lghi %r4,__TASK_stack 237 lghi %r4,__TASK_stack
238 lghi %r1,__TASK_thread 238 lghi %r1,__TASK_thread
239 lg %r5,0(%r4,%r3) # start of kernel stack of next 239 llill %r5,STACK_INIT
240 stg %r15,__THREAD_ksp(%r1,%r2) # store kernel stack of prev 240 stg %r15,__THREAD_ksp(%r1,%r2) # store kernel stack of prev
241 lgr %r15,%r5 241 lg %r15,0(%r4,%r3) # start of kernel stack of next
242 aghi %r15,STACK_INIT # end of kernel stack of next 242 agr %r15,%r5 # end of kernel stack of next
243 stg %r3,__LC_CURRENT # store task struct of next 243 stg %r3,__LC_CURRENT # store task struct of next
244 stg %r15,__LC_KERNEL_STACK # store end of kernel stack 244 stg %r15,__LC_KERNEL_STACK # store end of kernel stack
245 lg %r15,__THREAD_ksp(%r1,%r3) # load kernel stack of next 245 lg %r15,__THREAD_ksp(%r1,%r3) # load kernel stack of next
diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c
index cc085e2d2ce9..74091fd3101e 100644
--- a/arch/s390/kernel/perf_cpum_cf.c
+++ b/arch/s390/kernel/perf_cpum_cf.c
@@ -373,7 +373,7 @@ static int __hw_perf_event_init(struct perf_event *event)
373 return -ENOENT; 373 return -ENOENT;
374 374
375 if (ev > PERF_CPUM_CF_MAX_CTR) 375 if (ev > PERF_CPUM_CF_MAX_CTR)
376 return -EINVAL; 376 return -ENOENT;
377 377
378 /* Obtain the counter set to which the specified counter belongs */ 378 /* Obtain the counter set to which the specified counter belongs */
379 set = get_counter_set(ev); 379 set = get_counter_set(ev);
diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c
index 7bf604ff50a1..bfabeb1889cc 100644
--- a/arch/s390/kernel/perf_cpum_sf.c
+++ b/arch/s390/kernel/perf_cpum_sf.c
@@ -1842,10 +1842,30 @@ static void cpumsf_pmu_del(struct perf_event *event, int flags)
1842CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC, PERF_EVENT_CPUM_SF); 1842CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC, PERF_EVENT_CPUM_SF);
1843CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC_DIAG, PERF_EVENT_CPUM_SF_DIAG); 1843CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC_DIAG, PERF_EVENT_CPUM_SF_DIAG);
1844 1844
1845static struct attribute *cpumsf_pmu_events_attr[] = { 1845/* Attribute list for CPU_SF.
1846 CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC), 1846 *
1847 NULL, 1847 * The availablitiy depends on the CPU_MF sampling facility authorization
1848 NULL, 1848 * for basic + diagnositic samples. This is determined at initialization
1849 * time by the sampling facility device driver.
1850 * If the authorization for basic samples is turned off, it should be
1851 * also turned off for diagnostic sampling.
1852 *
1853 * During initialization of the device driver, check the authorization
1854 * level for diagnostic sampling and installs the attribute
1855 * file for diagnostic sampling if necessary.
1856 *
1857 * For now install a placeholder to reference all possible attributes:
1858 * SF_CYCLES_BASIC and SF_CYCLES_BASIC_DIAG.
1859 * Add another entry for the final NULL pointer.
1860 */
1861enum {
1862 SF_CYCLES_BASIC_ATTR_IDX = 0,
1863 SF_CYCLES_BASIC_DIAG_ATTR_IDX,
1864 SF_CYCLES_ATTR_MAX
1865};
1866
1867static struct attribute *cpumsf_pmu_events_attr[SF_CYCLES_ATTR_MAX + 1] = {
1868 [SF_CYCLES_BASIC_ATTR_IDX] = CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC)
1849}; 1869};
1850 1870
1851PMU_FORMAT_ATTR(event, "config:0-63"); 1871PMU_FORMAT_ATTR(event, "config:0-63");
@@ -2040,7 +2060,10 @@ static int __init init_cpum_sampling_pmu(void)
2040 2060
2041 if (si.ad) { 2061 if (si.ad) {
2042 sfb_set_limits(CPUM_SF_MIN_SDB, CPUM_SF_MAX_SDB); 2062 sfb_set_limits(CPUM_SF_MIN_SDB, CPUM_SF_MAX_SDB);
2043 cpumsf_pmu_events_attr[1] = 2063 /* Sampling of diagnostic data authorized,
2064 * install event into attribute list of PMU device.
2065 */
2066 cpumsf_pmu_events_attr[SF_CYCLES_BASIC_DIAG_ATTR_IDX] =
2044 CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC_DIAG); 2067 CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC_DIAG);
2045 } 2068 }
2046 2069
diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile
index eb8aebea3ea7..e76309fbbcb3 100644
--- a/arch/s390/kernel/vdso32/Makefile
+++ b/arch/s390/kernel/vdso32/Makefile
@@ -37,7 +37,7 @@ KASAN_SANITIZE := n
37$(obj)/vdso32_wrapper.o : $(obj)/vdso32.so 37$(obj)/vdso32_wrapper.o : $(obj)/vdso32.so
38 38
39# link rule for the .so file, .lds has to be first 39# link rule for the .so file, .lds has to be first
40$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) 40$(obj)/vdso32.so.dbg: $(src)/vdso32.lds $(obj-vdso32) FORCE
41 $(call if_changed,vdso32ld) 41 $(call if_changed,vdso32ld)
42 42
43# strip rule for the .so file 43# strip rule for the .so file
@@ -46,12 +46,12 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE
46 $(call if_changed,objcopy) 46 $(call if_changed,objcopy)
47 47
48# assembly rules for the .S files 48# assembly rules for the .S files
49$(obj-vdso32): %.o: %.S 49$(obj-vdso32): %.o: %.S FORCE
50 $(call if_changed_dep,vdso32as) 50 $(call if_changed_dep,vdso32as)
51 51
52# actual build commands 52# actual build commands
53quiet_cmd_vdso32ld = VDSO32L $@ 53quiet_cmd_vdso32ld = VDSO32L $@
54 cmd_vdso32ld = $(CC) $(c_flags) -Wl,-T $^ -o $@ 54 cmd_vdso32ld = $(CC) $(c_flags) -Wl,-T $(filter %.lds %.o,$^) -o $@
55quiet_cmd_vdso32as = VDSO32A $@ 55quiet_cmd_vdso32as = VDSO32A $@
56 cmd_vdso32as = $(CC) $(a_flags) -c -o $@ $< 56 cmd_vdso32as = $(CC) $(a_flags) -c -o $@ $<
57 57
diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile
index a22b2cf86eec..f849ac61c5da 100644
--- a/arch/s390/kernel/vdso64/Makefile
+++ b/arch/s390/kernel/vdso64/Makefile
@@ -37,7 +37,7 @@ KASAN_SANITIZE := n
37$(obj)/vdso64_wrapper.o : $(obj)/vdso64.so 37$(obj)/vdso64_wrapper.o : $(obj)/vdso64.so
38 38
39# link rule for the .so file, .lds has to be first 39# link rule for the .so file, .lds has to be first
40$(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) 40$(obj)/vdso64.so.dbg: $(src)/vdso64.lds $(obj-vdso64) FORCE
41 $(call if_changed,vdso64ld) 41 $(call if_changed,vdso64ld)
42 42
43# strip rule for the .so file 43# strip rule for the .so file
@@ -46,12 +46,12 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE
46 $(call if_changed,objcopy) 46 $(call if_changed,objcopy)
47 47
48# assembly rules for the .S files 48# assembly rules for the .S files
49$(obj-vdso64): %.o: %.S 49$(obj-vdso64): %.o: %.S FORCE
50 $(call if_changed_dep,vdso64as) 50 $(call if_changed_dep,vdso64as)
51 51
52# actual build commands 52# actual build commands
53quiet_cmd_vdso64ld = VDSO64L $@ 53quiet_cmd_vdso64ld = VDSO64L $@
54 cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $^ -o $@ 54 cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $(filter %.lds %.o,$^) -o $@
55quiet_cmd_vdso64as = VDSO64A $@ 55quiet_cmd_vdso64as = VDSO64A $@
56 cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $< 56 cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $<
57 57
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index 21eb7407d51b..8429ab079715 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -154,14 +154,14 @@ SECTIONS
154 * uncompressed image info used by the decompressor 154 * uncompressed image info used by the decompressor
155 * it should match struct vmlinux_info 155 * it should match struct vmlinux_info
156 */ 156 */
157 .vmlinux.info 0 : { 157 .vmlinux.info 0 (INFO) : {
158 QUAD(_stext) /* default_lma */ 158 QUAD(_stext) /* default_lma */
159 QUAD(startup_continue) /* entry */ 159 QUAD(startup_continue) /* entry */
160 QUAD(__bss_start - _stext) /* image_size */ 160 QUAD(__bss_start - _stext) /* image_size */
161 QUAD(__bss_stop - __bss_start) /* bss_size */ 161 QUAD(__bss_stop - __bss_start) /* bss_size */
162 QUAD(__boot_data_start) /* bootdata_off */ 162 QUAD(__boot_data_start) /* bootdata_off */
163 QUAD(__boot_data_end - __boot_data_start) /* bootdata_size */ 163 QUAD(__boot_data_end - __boot_data_start) /* bootdata_size */
164 } 164 } :NONE
165 165
166 /* Debugging sections. */ 166 /* Debugging sections. */
167 STABS_DEBUG 167 STABS_DEBUG
diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c
index 76d89ee8b428..814f26520aa2 100644
--- a/arch/s390/mm/pgalloc.c
+++ b/arch/s390/mm/pgalloc.c
@@ -101,6 +101,7 @@ int crst_table_upgrade(struct mm_struct *mm, unsigned long end)
101 mm->context.asce_limit = _REGION1_SIZE; 101 mm->context.asce_limit = _REGION1_SIZE;
102 mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH | 102 mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH |
103 _ASCE_USER_BITS | _ASCE_TYPE_REGION2; 103 _ASCE_USER_BITS | _ASCE_TYPE_REGION2;
104 mm_inc_nr_puds(mm);
104 } else { 105 } else {
105 crst_table_init(table, _REGION1_ENTRY_EMPTY); 106 crst_table_init(table, _REGION1_ENTRY_EMPTY);
106 pgd_populate(mm, (pgd_t *) table, (p4d_t *) pgd); 107 pgd_populate(mm, (pgd_t *) table, (p4d_t *) pgd);
diff --git a/arch/s390/numa/numa.c b/arch/s390/numa/numa.c
index ae0d9e889534..d31bde0870d8 100644
--- a/arch/s390/numa/numa.c
+++ b/arch/s390/numa/numa.c
@@ -53,6 +53,7 @@ int __node_distance(int a, int b)
53{ 53{
54 return mode->distance ? mode->distance(a, b) : 0; 54 return mode->distance ? mode->distance(a, b) : 0;
55} 55}
56EXPORT_SYMBOL(__node_distance);
56 57
57int numa_debug_enabled; 58int numa_debug_enabled;
58 59
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 74c002ddc0ce..28c40624bcb6 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -1305,6 +1305,7 @@ static int ubd_queue_one_vec(struct blk_mq_hw_ctx *hctx, struct request *req,
1305 io_req->fds[0] = dev->cow.fd; 1305 io_req->fds[0] = dev->cow.fd;
1306 else 1306 else
1307 io_req->fds[0] = dev->fd; 1307 io_req->fds[0] = dev->fd;
1308 io_req->error = 0;
1308 1309
1309 if (req_op(req) == REQ_OP_FLUSH) { 1310 if (req_op(req) == REQ_OP_FLUSH) {
1310 io_req->op = UBD_FLUSH; 1311 io_req->op = UBD_FLUSH;
@@ -1313,9 +1314,7 @@ static int ubd_queue_one_vec(struct blk_mq_hw_ctx *hctx, struct request *req,
1313 io_req->cow_offset = -1; 1314 io_req->cow_offset = -1;
1314 io_req->offset = off; 1315 io_req->offset = off;
1315 io_req->length = bvec->bv_len; 1316 io_req->length = bvec->bv_len;
1316 io_req->error = 0;
1317 io_req->sector_mask = 0; 1317 io_req->sector_mask = 0;
1318
1319 io_req->op = rq_data_dir(req) == READ ? UBD_READ : UBD_WRITE; 1318 io_req->op = rq_data_dir(req) == READ ? UBD_READ : UBD_WRITE;
1320 io_req->offsets[0] = 0; 1319 io_req->offsets[0] = 0;
1321 io_req->offsets[1] = dev->cow.data_offset; 1320 io_req->offsets[1] = dev->cow.data_offset;
@@ -1341,11 +1340,14 @@ static int ubd_queue_one_vec(struct blk_mq_hw_ctx *hctx, struct request *req,
1341static blk_status_t ubd_queue_rq(struct blk_mq_hw_ctx *hctx, 1340static blk_status_t ubd_queue_rq(struct blk_mq_hw_ctx *hctx,
1342 const struct blk_mq_queue_data *bd) 1341 const struct blk_mq_queue_data *bd)
1343{ 1342{
1343 struct ubd *ubd_dev = hctx->queue->queuedata;
1344 struct request *req = bd->rq; 1344 struct request *req = bd->rq;
1345 int ret = 0; 1345 int ret = 0;
1346 1346
1347 blk_mq_start_request(req); 1347 blk_mq_start_request(req);
1348 1348
1349 spin_lock_irq(&ubd_dev->lock);
1350
1349 if (req_op(req) == REQ_OP_FLUSH) { 1351 if (req_op(req) == REQ_OP_FLUSH) {
1350 ret = ubd_queue_one_vec(hctx, req, 0, NULL); 1352 ret = ubd_queue_one_vec(hctx, req, 0, NULL);
1351 } else { 1353 } else {
@@ -1361,9 +1363,11 @@ static blk_status_t ubd_queue_rq(struct blk_mq_hw_ctx *hctx,
1361 } 1363 }
1362 } 1364 }
1363out: 1365out:
1364 if (ret < 0) { 1366 spin_unlock_irq(&ubd_dev->lock);
1367
1368 if (ret < 0)
1365 blk_mq_requeue_request(req, true); 1369 blk_mq_requeue_request(req, true);
1366 } 1370
1367 return BLK_STS_OK; 1371 return BLK_STS_OK;
1368} 1372}
1369 1373
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index ba7e3464ee92..9d734f3c8234 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -525,7 +525,6 @@ config X86_VSMP
525 bool "ScaleMP vSMP" 525 bool "ScaleMP vSMP"
526 select HYPERVISOR_GUEST 526 select HYPERVISOR_GUEST
527 select PARAVIRT 527 select PARAVIRT
528 select PARAVIRT_XXL
529 depends on X86_64 && PCI 528 depends on X86_64 && PCI
530 depends on X86_EXTENDED_PLATFORM 529 depends on X86_EXTENDED_PLATFORM
531 depends on SMP 530 depends on SMP
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 5b562e464009..88398fdf8129 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -213,8 +213,6 @@ ifdef CONFIG_X86_64
213KBUILD_LDFLAGS += $(call ld-option, -z max-page-size=0x200000) 213KBUILD_LDFLAGS += $(call ld-option, -z max-page-size=0x200000)
214endif 214endif
215 215
216# Speed up the build
217KBUILD_CFLAGS += -pipe
218# Workaround for a gcc prelease that unfortunately was shipped in a suse release 216# Workaround for a gcc prelease that unfortunately was shipped in a suse release
219KBUILD_CFLAGS += -Wno-sign-compare 217KBUILD_CFLAGS += -Wno-sign-compare
220# 218#
@@ -239,7 +237,7 @@ archheaders:
239archmacros: 237archmacros:
240 $(Q)$(MAKE) $(build)=arch/x86/kernel arch/x86/kernel/macros.s 238 $(Q)$(MAKE) $(build)=arch/x86/kernel arch/x86/kernel/macros.s
241 239
242ASM_MACRO_FLAGS = -Wa,arch/x86/kernel/macros.s -Wa,- 240ASM_MACRO_FLAGS = -Wa,arch/x86/kernel/macros.s
243export ASM_MACRO_FLAGS 241export ASM_MACRO_FLAGS
244KBUILD_CFLAGS += $(ASM_MACRO_FLAGS) 242KBUILD_CFLAGS += $(ASM_MACRO_FLAGS)
245 243
diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h
index e17ab885b1e9..cb46d602a6b8 100644
--- a/arch/x86/events/intel/uncore.h
+++ b/arch/x86/events/intel/uncore.h
@@ -129,8 +129,15 @@ struct intel_uncore_box {
129 struct intel_uncore_extra_reg shared_regs[0]; 129 struct intel_uncore_extra_reg shared_regs[0];
130}; 130};
131 131
132#define UNCORE_BOX_FLAG_INITIATED 0 132/* CFL uncore 8th cbox MSRs */
133#define UNCORE_BOX_FLAG_CTL_OFFS8 1 /* event config registers are 8-byte apart */ 133#define CFL_UNC_CBO_7_PERFEVTSEL0 0xf70
134#define CFL_UNC_CBO_7_PER_CTR0 0xf76
135
136#define UNCORE_BOX_FLAG_INITIATED 0
137/* event config registers are 8-byte apart */
138#define UNCORE_BOX_FLAG_CTL_OFFS8 1
139/* CFL 8th CBOX has different MSR space */
140#define UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS 2
134 141
135struct uncore_event_desc { 142struct uncore_event_desc {
136 struct kobj_attribute attr; 143 struct kobj_attribute attr;
@@ -297,17 +304,27 @@ unsigned int uncore_freerunning_counter(struct intel_uncore_box *box,
297static inline 304static inline
298unsigned uncore_msr_event_ctl(struct intel_uncore_box *box, int idx) 305unsigned uncore_msr_event_ctl(struct intel_uncore_box *box, int idx)
299{ 306{
300 return box->pmu->type->event_ctl + 307 if (test_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, &box->flags)) {
301 (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) + 308 return CFL_UNC_CBO_7_PERFEVTSEL0 +
302 uncore_msr_box_offset(box); 309 (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx);
310 } else {
311 return box->pmu->type->event_ctl +
312 (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) +
313 uncore_msr_box_offset(box);
314 }
303} 315}
304 316
305static inline 317static inline
306unsigned uncore_msr_perf_ctr(struct intel_uncore_box *box, int idx) 318unsigned uncore_msr_perf_ctr(struct intel_uncore_box *box, int idx)
307{ 319{
308 return box->pmu->type->perf_ctr + 320 if (test_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, &box->flags)) {
309 (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) + 321 return CFL_UNC_CBO_7_PER_CTR0 +
310 uncore_msr_box_offset(box); 322 (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx);
323 } else {
324 return box->pmu->type->perf_ctr +
325 (box->pmu->type->pair_ctr_ctl ? 2 * idx : idx) +
326 uncore_msr_box_offset(box);
327 }
311} 328}
312 329
313static inline 330static inline
diff --git a/arch/x86/events/intel/uncore_snb.c b/arch/x86/events/intel/uncore_snb.c
index 8527c3e1038b..2593b0d7aeee 100644
--- a/arch/x86/events/intel/uncore_snb.c
+++ b/arch/x86/events/intel/uncore_snb.c
@@ -15,6 +15,25 @@
15#define PCI_DEVICE_ID_INTEL_SKL_HQ_IMC 0x1910 15#define PCI_DEVICE_ID_INTEL_SKL_HQ_IMC 0x1910
16#define PCI_DEVICE_ID_INTEL_SKL_SD_IMC 0x190f 16#define PCI_DEVICE_ID_INTEL_SKL_SD_IMC 0x190f
17#define PCI_DEVICE_ID_INTEL_SKL_SQ_IMC 0x191f 17#define PCI_DEVICE_ID_INTEL_SKL_SQ_IMC 0x191f
18#define PCI_DEVICE_ID_INTEL_KBL_Y_IMC 0x590c
19#define PCI_DEVICE_ID_INTEL_KBL_U_IMC 0x5904
20#define PCI_DEVICE_ID_INTEL_KBL_UQ_IMC 0x5914
21#define PCI_DEVICE_ID_INTEL_KBL_SD_IMC 0x590f
22#define PCI_DEVICE_ID_INTEL_KBL_SQ_IMC 0x591f
23#define PCI_DEVICE_ID_INTEL_CFL_2U_IMC 0x3ecc
24#define PCI_DEVICE_ID_INTEL_CFL_4U_IMC 0x3ed0
25#define PCI_DEVICE_ID_INTEL_CFL_4H_IMC 0x3e10
26#define PCI_DEVICE_ID_INTEL_CFL_6H_IMC 0x3ec4
27#define PCI_DEVICE_ID_INTEL_CFL_2S_D_IMC 0x3e0f
28#define PCI_DEVICE_ID_INTEL_CFL_4S_D_IMC 0x3e1f
29#define PCI_DEVICE_ID_INTEL_CFL_6S_D_IMC 0x3ec2
30#define PCI_DEVICE_ID_INTEL_CFL_8S_D_IMC 0x3e30
31#define PCI_DEVICE_ID_INTEL_CFL_4S_W_IMC 0x3e18
32#define PCI_DEVICE_ID_INTEL_CFL_6S_W_IMC 0x3ec6
33#define PCI_DEVICE_ID_INTEL_CFL_8S_W_IMC 0x3e31
34#define PCI_DEVICE_ID_INTEL_CFL_4S_S_IMC 0x3e33
35#define PCI_DEVICE_ID_INTEL_CFL_6S_S_IMC 0x3eca
36#define PCI_DEVICE_ID_INTEL_CFL_8S_S_IMC 0x3e32
18 37
19/* SNB event control */ 38/* SNB event control */
20#define SNB_UNC_CTL_EV_SEL_MASK 0x000000ff 39#define SNB_UNC_CTL_EV_SEL_MASK 0x000000ff
@@ -202,6 +221,10 @@ static void skl_uncore_msr_init_box(struct intel_uncore_box *box)
202 wrmsrl(SKL_UNC_PERF_GLOBAL_CTL, 221 wrmsrl(SKL_UNC_PERF_GLOBAL_CTL,
203 SNB_UNC_GLOBAL_CTL_EN | SKL_UNC_GLOBAL_CTL_CORE_ALL); 222 SNB_UNC_GLOBAL_CTL_EN | SKL_UNC_GLOBAL_CTL_CORE_ALL);
204 } 223 }
224
225 /* The 8th CBOX has different MSR space */
226 if (box->pmu->pmu_idx == 7)
227 __set_bit(UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS, &box->flags);
205} 228}
206 229
207static void skl_uncore_msr_enable_box(struct intel_uncore_box *box) 230static void skl_uncore_msr_enable_box(struct intel_uncore_box *box)
@@ -228,7 +251,7 @@ static struct intel_uncore_ops skl_uncore_msr_ops = {
228static struct intel_uncore_type skl_uncore_cbox = { 251static struct intel_uncore_type skl_uncore_cbox = {
229 .name = "cbox", 252 .name = "cbox",
230 .num_counters = 4, 253 .num_counters = 4,
231 .num_boxes = 5, 254 .num_boxes = 8,
232 .perf_ctr_bits = 44, 255 .perf_ctr_bits = 44,
233 .fixed_ctr_bits = 48, 256 .fixed_ctr_bits = 48,
234 .perf_ctr = SNB_UNC_CBO_0_PER_CTR0, 257 .perf_ctr = SNB_UNC_CBO_0_PER_CTR0,
@@ -569,7 +592,82 @@ static const struct pci_device_id skl_uncore_pci_ids[] = {
569 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SKL_SQ_IMC), 592 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SKL_SQ_IMC),
570 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0), 593 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
571 }, 594 },
572 595 { /* IMC */
596 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_Y_IMC),
597 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
598 },
599 { /* IMC */
600 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_U_IMC),
601 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
602 },
603 { /* IMC */
604 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_UQ_IMC),
605 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
606 },
607 { /* IMC */
608 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_SD_IMC),
609 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
610 },
611 { /* IMC */
612 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBL_SQ_IMC),
613 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
614 },
615 { /* IMC */
616 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_2U_IMC),
617 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
618 },
619 { /* IMC */
620 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_4U_IMC),
621 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
622 },
623 { /* IMC */
624 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_4H_IMC),
625 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
626 },
627 { /* IMC */
628 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_6H_IMC),
629 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
630 },
631 { /* IMC */
632 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_2S_D_IMC),
633 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
634 },
635 { /* IMC */
636 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_4S_D_IMC),
637 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
638 },
639 { /* IMC */
640 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_6S_D_IMC),
641 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
642 },
643 { /* IMC */
644 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_8S_D_IMC),
645 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
646 },
647 { /* IMC */
648 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_4S_W_IMC),
649 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
650 },
651 { /* IMC */
652 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_6S_W_IMC),
653 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
654 },
655 { /* IMC */
656 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_8S_W_IMC),
657 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
658 },
659 { /* IMC */
660 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_4S_S_IMC),
661 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
662 },
663 { /* IMC */
664 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_6S_S_IMC),
665 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
666 },
667 { /* IMC */
668 PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_CFL_8S_S_IMC),
669 .driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
670 },
573 { /* end: all zeroes */ }, 671 { /* end: all zeroes */ },
574}; 672};
575 673
@@ -618,6 +716,25 @@ static const struct imc_uncore_pci_dev desktop_imc_pci_ids[] = {
618 IMC_DEV(SKL_HQ_IMC, &skl_uncore_pci_driver), /* 6th Gen Core H Quad Core */ 716 IMC_DEV(SKL_HQ_IMC, &skl_uncore_pci_driver), /* 6th Gen Core H Quad Core */
619 IMC_DEV(SKL_SD_IMC, &skl_uncore_pci_driver), /* 6th Gen Core S Dual Core */ 717 IMC_DEV(SKL_SD_IMC, &skl_uncore_pci_driver), /* 6th Gen Core S Dual Core */
620 IMC_DEV(SKL_SQ_IMC, &skl_uncore_pci_driver), /* 6th Gen Core S Quad Core */ 718 IMC_DEV(SKL_SQ_IMC, &skl_uncore_pci_driver), /* 6th Gen Core S Quad Core */
719 IMC_DEV(KBL_Y_IMC, &skl_uncore_pci_driver), /* 7th Gen Core Y */
720 IMC_DEV(KBL_U_IMC, &skl_uncore_pci_driver), /* 7th Gen Core U */
721 IMC_DEV(KBL_UQ_IMC, &skl_uncore_pci_driver), /* 7th Gen Core U Quad Core */
722 IMC_DEV(KBL_SD_IMC, &skl_uncore_pci_driver), /* 7th Gen Core S Dual Core */
723 IMC_DEV(KBL_SQ_IMC, &skl_uncore_pci_driver), /* 7th Gen Core S Quad Core */
724 IMC_DEV(CFL_2U_IMC, &skl_uncore_pci_driver), /* 8th Gen Core U 2 Cores */
725 IMC_DEV(CFL_4U_IMC, &skl_uncore_pci_driver), /* 8th Gen Core U 4 Cores */
726 IMC_DEV(CFL_4H_IMC, &skl_uncore_pci_driver), /* 8th Gen Core H 4 Cores */
727 IMC_DEV(CFL_6H_IMC, &skl_uncore_pci_driver), /* 8th Gen Core H 6 Cores */
728 IMC_DEV(CFL_2S_D_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 2 Cores Desktop */
729 IMC_DEV(CFL_4S_D_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 4 Cores Desktop */
730 IMC_DEV(CFL_6S_D_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 6 Cores Desktop */
731 IMC_DEV(CFL_8S_D_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 8 Cores Desktop */
732 IMC_DEV(CFL_4S_W_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 4 Cores Work Station */
733 IMC_DEV(CFL_6S_W_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 6 Cores Work Station */
734 IMC_DEV(CFL_8S_W_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 8 Cores Work Station */
735 IMC_DEV(CFL_4S_S_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 4 Cores Server */
736 IMC_DEV(CFL_6S_S_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 6 Cores Server */
737 IMC_DEV(CFL_8S_S_IMC, &skl_uncore_pci_driver), /* 8th Gen Core S 8 Cores Server */
621 { /* end marker */ } 738 { /* end marker */ }
622}; 739};
623 740
diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index 4da9b1c58d28..c1a812bd5a27 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -221,6 +221,8 @@ static inline void mce_hygon_feature_init(struct cpuinfo_x86 *c) { return mce_am
221 221
222int mce_available(struct cpuinfo_x86 *c); 222int mce_available(struct cpuinfo_x86 *c);
223bool mce_is_memory_error(struct mce *m); 223bool mce_is_memory_error(struct mce *m);
224bool mce_is_correctable(struct mce *m);
225int mce_usable_address(struct mce *m);
224 226
225DECLARE_PER_CPU(unsigned, mce_exception_count); 227DECLARE_PER_CPU(unsigned, mce_exception_count);
226DECLARE_PER_CPU(unsigned, mce_poll_count); 228DECLARE_PER_CPU(unsigned, mce_poll_count);
diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index 0d6271cce198..1d0a7778e163 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -232,7 +232,7 @@ static inline u64 hv_do_fast_hypercall16(u16 code, u64 input1, u64 input2)
232 : "cc"); 232 : "cc");
233 } 233 }
234#endif 234#endif
235 return hv_status; 235 return hv_status;
236} 236}
237 237
238/* 238/*
diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h
index cd0cf1c568b4..8f657286d599 100644
--- a/arch/x86/include/asm/page_64_types.h
+++ b/arch/x86/include/asm/page_64_types.h
@@ -33,12 +33,14 @@
33 33
34/* 34/*
35 * Set __PAGE_OFFSET to the most negative possible address + 35 * Set __PAGE_OFFSET to the most negative possible address +
36 * PGDIR_SIZE*16 (pgd slot 272). The gap is to allow a space for a 36 * PGDIR_SIZE*17 (pgd slot 273).
37 * hypervisor to fit. Choosing 16 slots here is arbitrary, but it's 37 *
38 * what Xen requires. 38 * The gap is to allow a space for LDT remap for PTI (1 pgd slot) and space for
39 * a hypervisor (16 slots). Choosing 16 slots for a hypervisor is arbitrary,
40 * but it's what Xen requires.
39 */ 41 */
40#define __PAGE_OFFSET_BASE_L5 _AC(0xff10000000000000, UL) 42#define __PAGE_OFFSET_BASE_L5 _AC(0xff11000000000000, UL)
41#define __PAGE_OFFSET_BASE_L4 _AC(0xffff880000000000, UL) 43#define __PAGE_OFFSET_BASE_L4 _AC(0xffff888000000000, UL)
42 44
43#ifdef CONFIG_DYNAMIC_MEMORY_LAYOUT 45#ifdef CONFIG_DYNAMIC_MEMORY_LAYOUT
44#define __PAGE_OFFSET page_offset_base 46#define __PAGE_OFFSET page_offset_base
diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h
index 04edd2d58211..84bd9bdc1987 100644
--- a/arch/x86/include/asm/pgtable_64_types.h
+++ b/arch/x86/include/asm/pgtable_64_types.h
@@ -111,9 +111,7 @@ extern unsigned int ptrs_per_p4d;
111 */ 111 */
112#define MAXMEM (1UL << MAX_PHYSMEM_BITS) 112#define MAXMEM (1UL << MAX_PHYSMEM_BITS)
113 113
114#define LDT_PGD_ENTRY_L4 -3UL 114#define LDT_PGD_ENTRY -240UL
115#define LDT_PGD_ENTRY_L5 -112UL
116#define LDT_PGD_ENTRY (pgtable_l5_enabled() ? LDT_PGD_ENTRY_L5 : LDT_PGD_ENTRY_L4)
117#define LDT_BASE_ADDR (LDT_PGD_ENTRY << PGDIR_SHIFT) 115#define LDT_BASE_ADDR (LDT_PGD_ENTRY << PGDIR_SHIFT)
118#define LDT_END_ADDR (LDT_BASE_ADDR + PGDIR_SIZE) 116#define LDT_END_ADDR (LDT_BASE_ADDR + PGDIR_SIZE)
119 117
diff --git a/arch/x86/include/asm/qspinlock.h b/arch/x86/include/asm/qspinlock.h
index 87623c6b13db..bd5ac6cc37db 100644
--- a/arch/x86/include/asm/qspinlock.h
+++ b/arch/x86/include/asm/qspinlock.h
@@ -13,12 +13,15 @@
13#define queued_fetch_set_pending_acquire queued_fetch_set_pending_acquire 13#define queued_fetch_set_pending_acquire queued_fetch_set_pending_acquire
14static __always_inline u32 queued_fetch_set_pending_acquire(struct qspinlock *lock) 14static __always_inline u32 queued_fetch_set_pending_acquire(struct qspinlock *lock)
15{ 15{
16 u32 val = 0; 16 u32 val;
17
18 if (GEN_BINARY_RMWcc(LOCK_PREFIX "btsl", lock->val.counter, c,
19 "I", _Q_PENDING_OFFSET))
20 val |= _Q_PENDING_VAL;
21 17
18 /*
19 * We can't use GEN_BINARY_RMWcc() inside an if() stmt because asm goto
20 * and CONFIG_PROFILE_ALL_BRANCHES=y results in a label inside a
21 * statement expression, which GCC doesn't like.
22 */
23 val = GEN_BINARY_RMWcc(LOCK_PREFIX "btsl", lock->val.counter, c,
24 "I", _Q_PENDING_OFFSET) * _Q_PENDING_VAL;
22 val |= atomic_read(&lock->val) & ~_Q_PENDING_MASK; 25 val |= atomic_read(&lock->val) & ~_Q_PENDING_MASK;
23 26
24 return val; 27 return val;
diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h
index 123e669bf363..790ce08e41f2 100644
--- a/arch/x86/include/asm/xen/page.h
+++ b/arch/x86/include/asm/xen/page.h
@@ -9,7 +9,7 @@
9#include <linux/mm.h> 9#include <linux/mm.h>
10#include <linux/device.h> 10#include <linux/device.h>
11 11
12#include <linux/uaccess.h> 12#include <asm/extable.h>
13#include <asm/page.h> 13#include <asm/page.h>
14#include <asm/pgtable.h> 14#include <asm/pgtable.h>
15 15
@@ -93,12 +93,39 @@ clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,
93 */ 93 */
94static inline int xen_safe_write_ulong(unsigned long *addr, unsigned long val) 94static inline int xen_safe_write_ulong(unsigned long *addr, unsigned long val)
95{ 95{
96 return __put_user(val, (unsigned long __user *)addr); 96 int ret = 0;
97
98 asm volatile("1: mov %[val], %[ptr]\n"
99 "2:\n"
100 ".section .fixup, \"ax\"\n"
101 "3: sub $1, %[ret]\n"
102 " jmp 2b\n"
103 ".previous\n"
104 _ASM_EXTABLE(1b, 3b)
105 : [ret] "+r" (ret), [ptr] "=m" (*addr)
106 : [val] "r" (val));
107
108 return ret;
97} 109}
98 110
99static inline int xen_safe_read_ulong(unsigned long *addr, unsigned long *val) 111static inline int xen_safe_read_ulong(const unsigned long *addr,
112 unsigned long *val)
100{ 113{
101 return __get_user(*val, (unsigned long __user *)addr); 114 int ret = 0;
115 unsigned long rval = ~0ul;
116
117 asm volatile("1: mov %[ptr], %[rval]\n"
118 "2:\n"
119 ".section .fixup, \"ax\"\n"
120 "3: sub $1, %[ret]\n"
121 " jmp 2b\n"
122 ".previous\n"
123 _ASM_EXTABLE(1b, 3b)
124 : [ret] "+r" (ret), [rval] "+r" (rval)
125 : [ptr] "m" (*addr));
126 *val = rval;
127
128 return ret;
102} 129}
103 130
104#ifdef CONFIG_XEN_PV 131#ifdef CONFIG_XEN_PV
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 8c66d2fc8f81..36d2696c9563 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -485,7 +485,7 @@ static void mce_report_event(struct pt_regs *regs)
485 * be somewhat complicated (e.g. segment offset would require an instruction 485 * be somewhat complicated (e.g. segment offset would require an instruction
486 * parser). So only support physical addresses up to page granuality for now. 486 * parser). So only support physical addresses up to page granuality for now.
487 */ 487 */
488static int mce_usable_address(struct mce *m) 488int mce_usable_address(struct mce *m)
489{ 489{
490 if (!(m->status & MCI_STATUS_ADDRV)) 490 if (!(m->status & MCI_STATUS_ADDRV))
491 return 0; 491 return 0;
@@ -505,6 +505,7 @@ static int mce_usable_address(struct mce *m)
505 505
506 return 1; 506 return 1;
507} 507}
508EXPORT_SYMBOL_GPL(mce_usable_address);
508 509
509bool mce_is_memory_error(struct mce *m) 510bool mce_is_memory_error(struct mce *m)
510{ 511{
@@ -534,7 +535,7 @@ bool mce_is_memory_error(struct mce *m)
534} 535}
535EXPORT_SYMBOL_GPL(mce_is_memory_error); 536EXPORT_SYMBOL_GPL(mce_is_memory_error);
536 537
537static bool mce_is_correctable(struct mce *m) 538bool mce_is_correctable(struct mce *m)
538{ 539{
539 if (m->cpuvendor == X86_VENDOR_AMD && m->status & MCI_STATUS_DEFERRED) 540 if (m->cpuvendor == X86_VENDOR_AMD && m->status & MCI_STATUS_DEFERRED)
540 return false; 541 return false;
@@ -547,6 +548,7 @@ static bool mce_is_correctable(struct mce *m)
547 548
548 return true; 549 return true;
549} 550}
551EXPORT_SYMBOL_GPL(mce_is_correctable);
550 552
551static bool cec_add_mce(struct mce *m) 553static bool cec_add_mce(struct mce *m)
552{ 554{
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 1c72f3819eb1..e81a2db42df7 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -20,6 +20,7 @@
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/irq.h> 21#include <linux/irq.h>
22#include <linux/kexec.h> 22#include <linux/kexec.h>
23#include <linux/i8253.h>
23#include <asm/processor.h> 24#include <asm/processor.h>
24#include <asm/hypervisor.h> 25#include <asm/hypervisor.h>
25#include <asm/hyperv-tlfs.h> 26#include <asm/hyperv-tlfs.h>
@@ -295,6 +296,16 @@ static void __init ms_hyperv_init_platform(void)
295 if (efi_enabled(EFI_BOOT)) 296 if (efi_enabled(EFI_BOOT))
296 x86_platform.get_nmi_reason = hv_get_nmi_reason; 297 x86_platform.get_nmi_reason = hv_get_nmi_reason;
297 298
299 /*
300 * Hyper-V VMs have a PIT emulation quirk such that zeroing the
301 * counter register during PIT shutdown restarts the PIT. So it
302 * continues to interrupt @18.2 HZ. Setting i8253_clear_counter
303 * to false tells pit_shutdown() not to zero the counter so that
304 * the PIT really is shutdown. Generation 2 VMs don't have a PIT,
305 * and setting this value has no effect.
306 */
307 i8253_clear_counter_on_shutdown = false;
308
298#if IS_ENABLED(CONFIG_HYPERV) 309#if IS_ENABLED(CONFIG_HYPERV)
299 /* 310 /*
300 * Setup the hook to get control post apic initialization. 311 * Setup the hook to get control post apic initialization.
diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c
index d9ab49bed8af..0eda91f8eeac 100644
--- a/arch/x86/kernel/cpu/vmware.c
+++ b/arch/x86/kernel/cpu/vmware.c
@@ -77,7 +77,7 @@ static __init int setup_vmw_sched_clock(char *s)
77} 77}
78early_param("no-vmw-sched-clock", setup_vmw_sched_clock); 78early_param("no-vmw-sched-clock", setup_vmw_sched_clock);
79 79
80static unsigned long long vmware_sched_clock(void) 80static unsigned long long notrace vmware_sched_clock(void)
81{ 81{
82 unsigned long long ns; 82 unsigned long long ns;
83 83
diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c
index ab18e0884dc6..6135ae8ce036 100644
--- a/arch/x86/kernel/ldt.c
+++ b/arch/x86/kernel/ldt.c
@@ -199,14 +199,6 @@ static void sanity_check_ldt_mapping(struct mm_struct *mm)
199/* 199/*
200 * If PTI is enabled, this maps the LDT into the kernelmode and 200 * If PTI is enabled, this maps the LDT into the kernelmode and
201 * usermode tables for the given mm. 201 * usermode tables for the given mm.
202 *
203 * There is no corresponding unmap function. Even if the LDT is freed, we
204 * leave the PTEs around until the slot is reused or the mm is destroyed.
205 * This is harmless: the LDT is always in ordinary memory, and no one will
206 * access the freed slot.
207 *
208 * If we wanted to unmap freed LDTs, we'd also need to do a flush to make
209 * it useful, and the flush would slow down modify_ldt().
210 */ 202 */
211static int 203static int
212map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot) 204map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot)
@@ -214,8 +206,7 @@ map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot)
214 unsigned long va; 206 unsigned long va;
215 bool is_vmalloc; 207 bool is_vmalloc;
216 spinlock_t *ptl; 208 spinlock_t *ptl;
217 pgd_t *pgd; 209 int i, nr_pages;
218 int i;
219 210
220 if (!static_cpu_has(X86_FEATURE_PTI)) 211 if (!static_cpu_has(X86_FEATURE_PTI))
221 return 0; 212 return 0;
@@ -229,16 +220,11 @@ map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot)
229 /* Check if the current mappings are sane */ 220 /* Check if the current mappings are sane */
230 sanity_check_ldt_mapping(mm); 221 sanity_check_ldt_mapping(mm);
231 222
232 /*
233 * Did we already have the top level entry allocated? We can't
234 * use pgd_none() for this because it doens't do anything on
235 * 4-level page table kernels.
236 */
237 pgd = pgd_offset(mm, LDT_BASE_ADDR);
238
239 is_vmalloc = is_vmalloc_addr(ldt->entries); 223 is_vmalloc = is_vmalloc_addr(ldt->entries);
240 224
241 for (i = 0; i * PAGE_SIZE < ldt->nr_entries * LDT_ENTRY_SIZE; i++) { 225 nr_pages = DIV_ROUND_UP(ldt->nr_entries * LDT_ENTRY_SIZE, PAGE_SIZE);
226
227 for (i = 0; i < nr_pages; i++) {
242 unsigned long offset = i << PAGE_SHIFT; 228 unsigned long offset = i << PAGE_SHIFT;
243 const void *src = (char *)ldt->entries + offset; 229 const void *src = (char *)ldt->entries + offset;
244 unsigned long pfn; 230 unsigned long pfn;
@@ -272,13 +258,39 @@ map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot)
272 /* Propagate LDT mapping to the user page-table */ 258 /* Propagate LDT mapping to the user page-table */
273 map_ldt_struct_to_user(mm); 259 map_ldt_struct_to_user(mm);
274 260
275 va = (unsigned long)ldt_slot_va(slot);
276 flush_tlb_mm_range(mm, va, va + LDT_SLOT_STRIDE, PAGE_SHIFT, false);
277
278 ldt->slot = slot; 261 ldt->slot = slot;
279 return 0; 262 return 0;
280} 263}
281 264
265static void unmap_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt)
266{
267 unsigned long va;
268 int i, nr_pages;
269
270 if (!ldt)
271 return;
272
273 /* LDT map/unmap is only required for PTI */
274 if (!static_cpu_has(X86_FEATURE_PTI))
275 return;
276
277 nr_pages = DIV_ROUND_UP(ldt->nr_entries * LDT_ENTRY_SIZE, PAGE_SIZE);
278
279 for (i = 0; i < nr_pages; i++) {
280 unsigned long offset = i << PAGE_SHIFT;
281 spinlock_t *ptl;
282 pte_t *ptep;
283
284 va = (unsigned long)ldt_slot_va(ldt->slot) + offset;
285 ptep = get_locked_pte(mm, va, &ptl);
286 pte_clear(mm, va, ptep);
287 pte_unmap_unlock(ptep, ptl);
288 }
289
290 va = (unsigned long)ldt_slot_va(ldt->slot);
291 flush_tlb_mm_range(mm, va, va + nr_pages * PAGE_SIZE, PAGE_SHIFT, false);
292}
293
282#else /* !CONFIG_PAGE_TABLE_ISOLATION */ 294#else /* !CONFIG_PAGE_TABLE_ISOLATION */
283 295
284static int 296static int
@@ -286,6 +298,10 @@ map_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt, int slot)
286{ 298{
287 return 0; 299 return 0;
288} 300}
301
302static void unmap_ldt_struct(struct mm_struct *mm, struct ldt_struct *ldt)
303{
304}
289#endif /* CONFIG_PAGE_TABLE_ISOLATION */ 305#endif /* CONFIG_PAGE_TABLE_ISOLATION */
290 306
291static void free_ldt_pgtables(struct mm_struct *mm) 307static void free_ldt_pgtables(struct mm_struct *mm)
@@ -524,6 +540,7 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
524 } 540 }
525 541
526 install_ldt(mm, new_ldt); 542 install_ldt(mm, new_ldt);
543 unmap_ldt_struct(mm, old_ldt);
527 free_ldt_struct(old_ldt); 544 free_ldt_struct(old_ldt);
528 error = 0; 545 error = 0;
529 546
diff --git a/arch/x86/kernel/vsmp_64.c b/arch/x86/kernel/vsmp_64.c
index 1eae5af491c2..891a75dbc131 100644
--- a/arch/x86/kernel/vsmp_64.c
+++ b/arch/x86/kernel/vsmp_64.c
@@ -26,65 +26,8 @@
26 26
27#define TOPOLOGY_REGISTER_OFFSET 0x10 27#define TOPOLOGY_REGISTER_OFFSET 0x10
28 28
29#if defined CONFIG_PCI && defined CONFIG_PARAVIRT_XXL 29#ifdef CONFIG_PCI
30/* 30static void __init set_vsmp_ctl(void)
31 * Interrupt control on vSMPowered systems:
32 * ~AC is a shadow of IF. If IF is 'on' AC should be 'off'
33 * and vice versa.
34 */
35
36asmlinkage __visible unsigned long vsmp_save_fl(void)
37{
38 unsigned long flags = native_save_fl();
39
40 if (!(flags & X86_EFLAGS_IF) || (flags & X86_EFLAGS_AC))
41 flags &= ~X86_EFLAGS_IF;
42 return flags;
43}
44PV_CALLEE_SAVE_REGS_THUNK(vsmp_save_fl);
45
46__visible void vsmp_restore_fl(unsigned long flags)
47{
48 if (flags & X86_EFLAGS_IF)
49 flags &= ~X86_EFLAGS_AC;
50 else
51 flags |= X86_EFLAGS_AC;
52 native_restore_fl(flags);
53}
54PV_CALLEE_SAVE_REGS_THUNK(vsmp_restore_fl);
55
56asmlinkage __visible void vsmp_irq_disable(void)
57{
58 unsigned long flags = native_save_fl();
59
60 native_restore_fl((flags & ~X86_EFLAGS_IF) | X86_EFLAGS_AC);
61}
62PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_disable);
63
64asmlinkage __visible void vsmp_irq_enable(void)
65{
66 unsigned long flags = native_save_fl();
67
68 native_restore_fl((flags | X86_EFLAGS_IF) & (~X86_EFLAGS_AC));
69}
70PV_CALLEE_SAVE_REGS_THUNK(vsmp_irq_enable);
71
72static unsigned __init vsmp_patch(u8 type, void *ibuf,
73 unsigned long addr, unsigned len)
74{
75 switch (type) {
76 case PARAVIRT_PATCH(irq.irq_enable):
77 case PARAVIRT_PATCH(irq.irq_disable):
78 case PARAVIRT_PATCH(irq.save_fl):
79 case PARAVIRT_PATCH(irq.restore_fl):
80 return paravirt_patch_default(type, ibuf, addr, len);
81 default:
82 return native_patch(type, ibuf, addr, len);
83 }
84
85}
86
87static void __init set_vsmp_pv_ops(void)
88{ 31{
89 void __iomem *address; 32 void __iomem *address;
90 unsigned int cap, ctl, cfg; 33 unsigned int cap, ctl, cfg;
@@ -109,28 +52,12 @@ static void __init set_vsmp_pv_ops(void)
109 } 52 }
110#endif 53#endif
111 54
112 if (cap & ctl & (1 << 4)) {
113 /* Setup irq ops and turn on vSMP IRQ fastpath handling */
114 pv_ops.irq.irq_disable = PV_CALLEE_SAVE(vsmp_irq_disable);
115 pv_ops.irq.irq_enable = PV_CALLEE_SAVE(vsmp_irq_enable);
116 pv_ops.irq.save_fl = PV_CALLEE_SAVE(vsmp_save_fl);
117 pv_ops.irq.restore_fl = PV_CALLEE_SAVE(vsmp_restore_fl);
118 pv_ops.init.patch = vsmp_patch;
119 ctl &= ~(1 << 4);
120 }
121 writel(ctl, address + 4); 55 writel(ctl, address + 4);
122 ctl = readl(address + 4); 56 ctl = readl(address + 4);
123 pr_info("vSMP CTL: control set to:0x%08x\n", ctl); 57 pr_info("vSMP CTL: control set to:0x%08x\n", ctl);
124 58
125 early_iounmap(address, 8); 59 early_iounmap(address, 8);
126} 60}
127#else
128static void __init set_vsmp_pv_ops(void)
129{
130}
131#endif
132
133#ifdef CONFIG_PCI
134static int is_vsmp = -1; 61static int is_vsmp = -1;
135 62
136static void __init detect_vsmp_box(void) 63static void __init detect_vsmp_box(void)
@@ -164,11 +91,14 @@ static int is_vsmp_box(void)
164{ 91{
165 return 0; 92 return 0;
166} 93}
94static void __init set_vsmp_ctl(void)
95{
96}
167#endif 97#endif
168 98
169static void __init vsmp_cap_cpus(void) 99static void __init vsmp_cap_cpus(void)
170{ 100{
171#if !defined(CONFIG_X86_VSMP) && defined(CONFIG_SMP) 101#if !defined(CONFIG_X86_VSMP) && defined(CONFIG_SMP) && defined(CONFIG_PCI)
172 void __iomem *address; 102 void __iomem *address;
173 unsigned int cfg, topology, node_shift, maxcpus; 103 unsigned int cfg, topology, node_shift, maxcpus;
174 104
@@ -221,6 +151,6 @@ void __init vsmp_init(void)
221 151
222 vsmp_cap_cpus(); 152 vsmp_cap_cpus();
223 153
224 set_vsmp_pv_ops(); 154 set_vsmp_ctl();
225 return; 155 return;
226} 156}
diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c
index 0d7b3ae4960b..a5d7ed125337 100644
--- a/arch/x86/xen/mmu_pv.c
+++ b/arch/x86/xen/mmu_pv.c
@@ -1905,7 +1905,7 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
1905 init_top_pgt[0] = __pgd(0); 1905 init_top_pgt[0] = __pgd(0);
1906 1906
1907 /* Pre-constructed entries are in pfn, so convert to mfn */ 1907 /* Pre-constructed entries are in pfn, so convert to mfn */
1908 /* L4[272] -> level3_ident_pgt */ 1908 /* L4[273] -> level3_ident_pgt */
1909 /* L4[511] -> level3_kernel_pgt */ 1909 /* L4[511] -> level3_kernel_pgt */
1910 convert_pfn_mfn(init_top_pgt); 1910 convert_pfn_mfn(init_top_pgt);
1911 1911
@@ -1925,8 +1925,8 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
1925 addr[0] = (unsigned long)pgd; 1925 addr[0] = (unsigned long)pgd;
1926 addr[1] = (unsigned long)l3; 1926 addr[1] = (unsigned long)l3;
1927 addr[2] = (unsigned long)l2; 1927 addr[2] = (unsigned long)l2;
1928 /* Graft it onto L4[272][0]. Note that we creating an aliasing problem: 1928 /* Graft it onto L4[273][0]. Note that we creating an aliasing problem:
1929 * Both L4[272][0] and L4[511][510] have entries that point to the same 1929 * Both L4[273][0] and L4[511][510] have entries that point to the same
1930 * L2 (PMD) tables. Meaning that if you modify it in __va space 1930 * L2 (PMD) tables. Meaning that if you modify it in __va space
1931 * it will be also modified in the __ka space! (But if you just 1931 * it will be also modified in the __ka space! (But if you just
1932 * modify the PMD table to point to other PTE's or none, then you 1932 * modify the PMD table to point to other PTE's or none, then you
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index b06731705529..055e37e43541 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -656,8 +656,7 @@ bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn)
656 656
657 /* 657 /*
658 * The interface requires atomic updates on p2m elements. 658 * The interface requires atomic updates on p2m elements.
659 * xen_safe_write_ulong() is using __put_user which does an atomic 659 * xen_safe_write_ulong() is using an atomic store via asm().
660 * store via asm().
661 */ 660 */
662 if (likely(!xen_safe_write_ulong(xen_p2m_addr + pfn, mfn))) 661 if (likely(!xen_safe_write_ulong(xen_p2m_addr + pfn, mfn)))
663 return true; 662 return true;
diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
index 441c88262169..1c8a8816a402 100644
--- a/arch/x86/xen/spinlock.c
+++ b/arch/x86/xen/spinlock.c
@@ -9,6 +9,7 @@
9#include <linux/log2.h> 9#include <linux/log2.h>
10#include <linux/gfp.h> 10#include <linux/gfp.h>
11#include <linux/slab.h> 11#include <linux/slab.h>
12#include <linux/atomic.h>
12 13
13#include <asm/paravirt.h> 14#include <asm/paravirt.h>
14#include <asm/qspinlock.h> 15#include <asm/qspinlock.h>
@@ -21,6 +22,7 @@
21 22
22static DEFINE_PER_CPU(int, lock_kicker_irq) = -1; 23static DEFINE_PER_CPU(int, lock_kicker_irq) = -1;
23static DEFINE_PER_CPU(char *, irq_name); 24static DEFINE_PER_CPU(char *, irq_name);
25static DEFINE_PER_CPU(atomic_t, xen_qlock_wait_nest);
24static bool xen_pvspin = true; 26static bool xen_pvspin = true;
25 27
26static void xen_qlock_kick(int cpu) 28static void xen_qlock_kick(int cpu)
@@ -39,25 +41,25 @@ static void xen_qlock_kick(int cpu)
39 */ 41 */
40static void xen_qlock_wait(u8 *byte, u8 val) 42static void xen_qlock_wait(u8 *byte, u8 val)
41{ 43{
42 unsigned long flags;
43 int irq = __this_cpu_read(lock_kicker_irq); 44 int irq = __this_cpu_read(lock_kicker_irq);
45 atomic_t *nest_cnt = this_cpu_ptr(&xen_qlock_wait_nest);
44 46
45 /* If kicker interrupts not initialized yet, just spin */ 47 /* If kicker interrupts not initialized yet, just spin */
46 if (irq == -1 || in_nmi()) 48 if (irq == -1 || in_nmi())
47 return; 49 return;
48 50
49 /* Guard against reentry. */ 51 /* Detect reentry. */
50 local_irq_save(flags); 52 atomic_inc(nest_cnt);
51 53
52 /* If irq pending already clear it. */ 54 /* If irq pending already and no nested call clear it. */
53 if (xen_test_irq_pending(irq)) { 55 if (atomic_read(nest_cnt) == 1 && xen_test_irq_pending(irq)) {
54 xen_clear_irq_pending(irq); 56 xen_clear_irq_pending(irq);
55 } else if (READ_ONCE(*byte) == val) { 57 } else if (READ_ONCE(*byte) == val) {
56 /* Block until irq becomes pending (or a spurious wakeup) */ 58 /* Block until irq becomes pending (or a spurious wakeup) */
57 xen_poll_irq(irq); 59 xen_poll_irq(irq);
58 } 60 }
59 61
60 local_irq_restore(flags); 62 atomic_dec(nest_cnt);
61} 63}
62 64
63static irqreturn_t dummy_handler(int irq, void *dev_id) 65static irqreturn_t dummy_handler(int irq, void *dev_id)
diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h
index be9bfd9aa865..34a23016dd14 100644
--- a/arch/xtensa/include/asm/processor.h
+++ b/arch/xtensa/include/asm/processor.h
@@ -23,7 +23,11 @@
23# error Linux requires the Xtensa Windowed Registers Option. 23# error Linux requires the Xtensa Windowed Registers Option.
24#endif 24#endif
25 25
26#define ARCH_SLAB_MINALIGN XCHAL_DATA_WIDTH 26/* Xtensa ABI requires stack alignment to be at least 16 */
27
28#define STACK_ALIGN (XCHAL_DATA_WIDTH > 16 ? XCHAL_DATA_WIDTH : 16)
29
30#define ARCH_SLAB_MINALIGN STACK_ALIGN
27 31
28/* 32/*
29 * User space process size: 1 GB. 33 * User space process size: 1 GB.
diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S
index 2f76118ecf62..9053a5622d2c 100644
--- a/arch/xtensa/kernel/head.S
+++ b/arch/xtensa/kernel/head.S
@@ -88,9 +88,12 @@ _SetupMMU:
88 initialize_mmu 88 initialize_mmu
89#if defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY 89#if defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY
90 rsr a2, excsave1 90 rsr a2, excsave1
91 movi a3, 0x08000000 91 movi a3, XCHAL_KSEG_PADDR
92 bltu a2, a3, 1f
93 sub a2, a2, a3
94 movi a3, XCHAL_KSEG_SIZE
92 bgeu a2, a3, 1f 95 bgeu a2, a3, 1f
93 movi a3, 0xd0000000 96 movi a3, XCHAL_KSEG_CACHED_VADDR
94 add a2, a2, a3 97 add a2, a2, a3
95 wsr a2, excsave1 98 wsr a2, excsave1
961: 991: