aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-10-13 00:38:46 -0400
committerDavid S. Miller <davem@davemloft.net>2018-10-13 00:38:46 -0400
commitd864991b220b7c62e81d21209e1fd978fd67352c (patch)
treeb570a1ad6fc1b959c5bcda6ceca0b321319c01e0 /arch
parenta688c53a0277d8ea21d86a5c56884892e3442c5e (diff)
parentbab5c80b211035739997ebd361a679fa85b39465 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts were easy to resolve using immediate context mostly, except the cls_u32.c one where I simply too the entire HEAD chunk. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r--arch/arc/Kconfig2
-rw-r--r--arch/arc/Makefile26
-rw-r--r--arch/arc/kernel/process.c20
-rw-r--r--arch/arm/boot/dts/imx53-qsb-common.dtsi11
-rw-r--r--arch/arm/kernel/vmlinux.lds.h2
-rw-r--r--arch/mips/include/asm/processor.h10
-rw-r--r--arch/mips/kernel/process.c25
-rw-r--r--arch/mips/kernel/setup.c48
-rw-r--r--arch/mips/kernel/vdso.c18
-rw-r--r--arch/mips/lib/memset.S4
-rw-r--r--arch/powerpc/kernel/process.c10
-rw-r--r--arch/powerpc/lib/code-patching.c20
-rw-r--r--arch/powerpc/mm/numa.c5
-rw-r--r--arch/s390/include/asm/sclp.h3
-rw-r--r--arch/s390/kernel/early_printk.c2
-rw-r--r--arch/s390/kernel/swsusp.S8
-rw-r--r--arch/sparc/kernel/auxio_64.c4
-rw-r--r--arch/sparc/kernel/kgdb_32.c2
-rw-r--r--arch/sparc/kernel/kgdb_64.c2
-rw-r--r--arch/sparc/kernel/power.c4
-rw-r--r--arch/sparc/kernel/prom_32.c26
-rw-r--r--arch/sparc/kernel/prom_64.c68
-rw-r--r--arch/sparc/kernel/viohs.c12
-rw-r--r--arch/sparc/vdso/Makefile8
-rw-r--r--arch/x86/kernel/cpu/intel_rdt.h6
-rw-r--r--arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c20
-rw-r--r--arch/x86/kernel/cpu/intel_rdt_rdtgroup.c36
-rw-r--r--arch/x86/mm/pgtable.c10
28 files changed, 255 insertions, 157 deletions
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index b4441b0764d7..a045f3086047 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -149,7 +149,7 @@ config ARC_CPU_770
149 Support for ARC770 core introduced with Rel 4.10 (Summer 2011) 149 Support for ARC770 core introduced with Rel 4.10 (Summer 2011)
150 This core has a bunch of cool new features: 150 This core has a bunch of cool new features:
151 -MMU-v3: Variable Page Sz (4k, 8k, 16k), bigger J-TLB (128x4) 151 -MMU-v3: Variable Page Sz (4k, 8k, 16k), bigger J-TLB (128x4)
152 Shared Address Spaces (for sharing TLB entires in MMU) 152 Shared Address Spaces (for sharing TLB entries in MMU)
153 -Caches: New Prog Model, Region Flush 153 -Caches: New Prog Model, Region Flush
154 -Insns: endian swap, load-locked/store-conditional, time-stamp-ctr 154 -Insns: endian swap, load-locked/store-conditional, time-stamp-ctr
155 155
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index 99cce77ab98f..644815c0516e 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -6,33 +6,11 @@
6# published by the Free Software Foundation. 6# published by the Free Software Foundation.
7# 7#
8 8
9ifeq ($(CROSS_COMPILE),)
10ifndef CONFIG_CPU_BIG_ENDIAN
11CROSS_COMPILE := arc-linux-
12else
13CROSS_COMPILE := arceb-linux-
14endif
15endif
16
17KBUILD_DEFCONFIG := nsim_700_defconfig 9KBUILD_DEFCONFIG := nsim_700_defconfig
18 10
19cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__ 11cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
20cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7 12cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7
21cflags-$(CONFIG_ISA_ARCV2) += -mcpu=archs 13cflags-$(CONFIG_ISA_ARCV2) += -mcpu=hs38
22
23is_700 = $(shell $(CC) -dM -E - < /dev/null | grep -q "ARC700" && echo 1 || echo 0)
24
25ifdef CONFIG_ISA_ARCOMPACT
26ifeq ($(is_700), 0)
27 $(error Toolchain not configured for ARCompact builds)
28endif
29endif
30
31ifdef CONFIG_ISA_ARCV2
32ifeq ($(is_700), 1)
33 $(error Toolchain not configured for ARCv2 builds)
34endif
35endif
36 14
37ifdef CONFIG_ARC_CURR_IN_REG 15ifdef CONFIG_ARC_CURR_IN_REG
38# For a global register defintion, make sure it gets passed to every file 16# For a global register defintion, make sure it gets passed to every file
@@ -79,7 +57,7 @@ cflags-$(disable_small_data) += -mno-sdata -fcall-used-gp
79cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian 57cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian
80ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB 58ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
81 59
82LIBGCC := $(shell $(CC) $(cflags-y) --print-libgcc-file-name) 60LIBGCC = $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
83 61
84# Modules with short calls might break for calls into builtin-kernel 62# Modules with short calls might break for calls into builtin-kernel
85KBUILD_CFLAGS_MODULE += -mlong-calls -mno-millicode 63KBUILD_CFLAGS_MODULE += -mlong-calls -mno-millicode
diff --git a/arch/arc/kernel/process.c b/arch/arc/kernel/process.c
index 4674541eba3f..8ce6e7235915 100644
--- a/arch/arc/kernel/process.c
+++ b/arch/arc/kernel/process.c
@@ -241,6 +241,26 @@ int copy_thread(unsigned long clone_flags,
241 task_thread_info(current)->thr_ptr; 241 task_thread_info(current)->thr_ptr;
242 } 242 }
243 243
244
245 /*
246 * setup usermode thread pointer #1:
247 * when child is picked by scheduler, __switch_to() uses @c_callee to
248 * populate usermode callee regs: this works (despite being in a kernel
249 * function) since special return path for child @ret_from_fork()
250 * ensures those regs are not clobbered all the way to RTIE to usermode
251 */
252 c_callee->r25 = task_thread_info(p)->thr_ptr;
253
254#ifdef CONFIG_ARC_CURR_IN_REG
255 /*
256 * setup usermode thread pointer #2:
257 * however for this special use of r25 in kernel, __switch_to() sets
258 * r25 for kernel needs and only in the final return path is usermode
259 * r25 setup, from pt_regs->user_r25. So set that up as well
260 */
261 c_regs->user_r25 = c_callee->r25;
262#endif
263
244 return 0; 264 return 0;
245} 265}
246 266
diff --git a/arch/arm/boot/dts/imx53-qsb-common.dtsi b/arch/arm/boot/dts/imx53-qsb-common.dtsi
index 7423d462d1e4..50dde84b72ed 100644
--- a/arch/arm/boot/dts/imx53-qsb-common.dtsi
+++ b/arch/arm/boot/dts/imx53-qsb-common.dtsi
@@ -123,6 +123,17 @@
123 }; 123 };
124}; 124};
125 125
126&cpu0 {
127 /* CPU rated to 1GHz, not 1.2GHz as per the default settings */
128 operating-points = <
129 /* kHz uV */
130 166666 850000
131 400000 900000
132 800000 1050000
133 1000000 1200000
134 >;
135};
136
126&esdhc1 { 137&esdhc1 {
127 pinctrl-names = "default"; 138 pinctrl-names = "default";
128 pinctrl-0 = <&pinctrl_esdhc1>; 139 pinctrl-0 = <&pinctrl_esdhc1>;
diff --git a/arch/arm/kernel/vmlinux.lds.h b/arch/arm/kernel/vmlinux.lds.h
index ae5fdff18406..8247bc15addc 100644
--- a/arch/arm/kernel/vmlinux.lds.h
+++ b/arch/arm/kernel/vmlinux.lds.h
@@ -49,6 +49,8 @@
49#define ARM_DISCARD \ 49#define ARM_DISCARD \
50 *(.ARM.exidx.exit.text) \ 50 *(.ARM.exidx.exit.text) \
51 *(.ARM.extab.exit.text) \ 51 *(.ARM.extab.exit.text) \
52 *(.ARM.exidx.text.exit) \
53 *(.ARM.extab.text.exit) \
52 ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text)) \ 54 ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text)) \
53 ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text)) \ 55 ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text)) \
54 ARM_EXIT_DISCARD(EXIT_TEXT) \ 56 ARM_EXIT_DISCARD(EXIT_TEXT) \
diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h
index b2fa62922d88..49d6046ca1d0 100644
--- a/arch/mips/include/asm/processor.h
+++ b/arch/mips/include/asm/processor.h
@@ -13,6 +13,7 @@
13 13
14#include <linux/atomic.h> 14#include <linux/atomic.h>
15#include <linux/cpumask.h> 15#include <linux/cpumask.h>
16#include <linux/sizes.h>
16#include <linux/threads.h> 17#include <linux/threads.h>
17 18
18#include <asm/cachectl.h> 19#include <asm/cachectl.h>
@@ -80,11 +81,10 @@ extern unsigned int vced_count, vcei_count;
80 81
81#endif 82#endif
82 83
83/* 84#define VDSO_RANDOMIZE_SIZE (TASK_IS_32BIT_ADDR ? SZ_1M : SZ_256M)
84 * One page above the stack is used for branch delay slot "emulation". 85
85 * See dsemul.c for details. 86extern unsigned long mips_stack_top(void);
86 */ 87#define STACK_TOP mips_stack_top()
87#define STACK_TOP ((TASK_SIZE & PAGE_MASK) - PAGE_SIZE)
88 88
89/* 89/*
90 * This decides where the kernel will search for a free chunk of vm 90 * This decides where the kernel will search for a free chunk of vm
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 8fc69891e117..d4f7fd4550e1 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -32,6 +32,7 @@
32#include <linux/nmi.h> 32#include <linux/nmi.h>
33#include <linux/cpu.h> 33#include <linux/cpu.h>
34 34
35#include <asm/abi.h>
35#include <asm/asm.h> 36#include <asm/asm.h>
36#include <asm/bootinfo.h> 37#include <asm/bootinfo.h>
37#include <asm/cpu.h> 38#include <asm/cpu.h>
@@ -39,6 +40,7 @@
39#include <asm/dsp.h> 40#include <asm/dsp.h>
40#include <asm/fpu.h> 41#include <asm/fpu.h>
41#include <asm/irq.h> 42#include <asm/irq.h>
43#include <asm/mips-cps.h>
42#include <asm/msa.h> 44#include <asm/msa.h>
43#include <asm/pgtable.h> 45#include <asm/pgtable.h>
44#include <asm/mipsregs.h> 46#include <asm/mipsregs.h>
@@ -645,6 +647,29 @@ out:
645 return pc; 647 return pc;
646} 648}
647 649
650unsigned long mips_stack_top(void)
651{
652 unsigned long top = TASK_SIZE & PAGE_MASK;
653
654 /* One page for branch delay slot "emulation" */
655 top -= PAGE_SIZE;
656
657 /* Space for the VDSO, data page & GIC user page */
658 top -= PAGE_ALIGN(current->thread.abi->vdso->size);
659 top -= PAGE_SIZE;
660 top -= mips_gic_present() ? PAGE_SIZE : 0;
661
662 /* Space for cache colour alignment */
663 if (cpu_has_dc_aliases)
664 top -= shm_align_mask + 1;
665
666 /* Space to randomize the VDSO base */
667 if (current->flags & PF_RANDOMIZE)
668 top -= VDSO_RANDOMIZE_SIZE;
669
670 return top;
671}
672
648/* 673/*
649 * Don't forget that the stack pointer must be aligned on a 8 bytes 674 * Don't forget that the stack pointer must be aligned on a 8 bytes
650 * boundary for 32-bits ABI and 16 bytes for 64-bits ABI. 675 * boundary for 32-bits ABI and 16 bytes for 64-bits ABI.
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index c71d1eb7da59..8aaaa42f91ed 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -846,6 +846,34 @@ static void __init arch_mem_init(char **cmdline_p)
846 struct memblock_region *reg; 846 struct memblock_region *reg;
847 extern void plat_mem_setup(void); 847 extern void plat_mem_setup(void);
848 848
849 /*
850 * Initialize boot_command_line to an innocuous but non-empty string in
851 * order to prevent early_init_dt_scan_chosen() from copying
852 * CONFIG_CMDLINE into it without our knowledge. We handle
853 * CONFIG_CMDLINE ourselves below & don't want to duplicate its
854 * content because repeating arguments can be problematic.
855 */
856 strlcpy(boot_command_line, " ", COMMAND_LINE_SIZE);
857
858 /* call board setup routine */
859 plat_mem_setup();
860
861 /*
862 * Make sure all kernel memory is in the maps. The "UP" and
863 * "DOWN" are opposite for initdata since if it crosses over
864 * into another memory section you don't want that to be
865 * freed when the initdata is freed.
866 */
867 arch_mem_addpart(PFN_DOWN(__pa_symbol(&_text)) << PAGE_SHIFT,
868 PFN_UP(__pa_symbol(&_edata)) << PAGE_SHIFT,
869 BOOT_MEM_RAM);
870 arch_mem_addpart(PFN_UP(__pa_symbol(&__init_begin)) << PAGE_SHIFT,
871 PFN_DOWN(__pa_symbol(&__init_end)) << PAGE_SHIFT,
872 BOOT_MEM_INIT_RAM);
873
874 pr_info("Determined physical RAM map:\n");
875 print_memory_map();
876
849#if defined(CONFIG_CMDLINE_BOOL) && defined(CONFIG_CMDLINE_OVERRIDE) 877#if defined(CONFIG_CMDLINE_BOOL) && defined(CONFIG_CMDLINE_OVERRIDE)
850 strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); 878 strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
851#else 879#else
@@ -873,26 +901,6 @@ static void __init arch_mem_init(char **cmdline_p)
873 } 901 }
874#endif 902#endif
875#endif 903#endif
876
877 /* call board setup routine */
878 plat_mem_setup();
879
880 /*
881 * Make sure all kernel memory is in the maps. The "UP" and
882 * "DOWN" are opposite for initdata since if it crosses over
883 * into another memory section you don't want that to be
884 * freed when the initdata is freed.
885 */
886 arch_mem_addpart(PFN_DOWN(__pa_symbol(&_text)) << PAGE_SHIFT,
887 PFN_UP(__pa_symbol(&_edata)) << PAGE_SHIFT,
888 BOOT_MEM_RAM);
889 arch_mem_addpart(PFN_UP(__pa_symbol(&__init_begin)) << PAGE_SHIFT,
890 PFN_DOWN(__pa_symbol(&__init_end)) << PAGE_SHIFT,
891 BOOT_MEM_INIT_RAM);
892
893 pr_info("Determined physical RAM map:\n");
894 print_memory_map();
895
896 strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); 904 strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
897 905
898 *cmdline_p = command_line; 906 *cmdline_p = command_line;
diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c
index 8f845f6e5f42..48a9c6b90e07 100644
--- a/arch/mips/kernel/vdso.c
+++ b/arch/mips/kernel/vdso.c
@@ -15,6 +15,7 @@
15#include <linux/ioport.h> 15#include <linux/ioport.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/random.h>
18#include <linux/sched.h> 19#include <linux/sched.h>
19#include <linux/slab.h> 20#include <linux/slab.h>
20#include <linux/timekeeper_internal.h> 21#include <linux/timekeeper_internal.h>
@@ -97,6 +98,21 @@ void update_vsyscall_tz(void)
97 } 98 }
98} 99}
99 100
101static unsigned long vdso_base(void)
102{
103 unsigned long base;
104
105 /* Skip the delay slot emulation page */
106 base = STACK_TOP + PAGE_SIZE;
107
108 if (current->flags & PF_RANDOMIZE) {
109 base += get_random_int() & (VDSO_RANDOMIZE_SIZE - 1);
110 base = PAGE_ALIGN(base);
111 }
112
113 return base;
114}
115
100int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) 116int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
101{ 117{
102 struct mips_vdso_image *image = current->thread.abi->vdso; 118 struct mips_vdso_image *image = current->thread.abi->vdso;
@@ -137,7 +153,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
137 if (cpu_has_dc_aliases) 153 if (cpu_has_dc_aliases)
138 size += shm_align_mask + 1; 154 size += shm_align_mask + 1;
139 155
140 base = get_unmapped_area(NULL, 0, size, 0, 0); 156 base = get_unmapped_area(NULL, vdso_base(), size, 0, 0);
141 if (IS_ERR_VALUE(base)) { 157 if (IS_ERR_VALUE(base)) {
142 ret = base; 158 ret = base;
143 goto out; 159 goto out;
diff --git a/arch/mips/lib/memset.S b/arch/mips/lib/memset.S
index 3a6f34ef5ffc..069acec3df9f 100644
--- a/arch/mips/lib/memset.S
+++ b/arch/mips/lib/memset.S
@@ -280,9 +280,11 @@
280 * unset_bytes = end_addr - current_addr + 1 280 * unset_bytes = end_addr - current_addr + 1
281 * a2 = t1 - a0 + 1 281 * a2 = t1 - a0 + 1
282 */ 282 */
283 .set reorder
283 PTR_SUBU a2, t1, a0 284 PTR_SUBU a2, t1, a0
285 PTR_ADDIU a2, 1
284 jr ra 286 jr ra
285 PTR_ADDIU a2, 1 287 .set noreorder
286 288
287 .endm 289 .endm
288 290
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 913c5725cdb2..bb6ac471a784 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1306,6 +1306,16 @@ void show_user_instructions(struct pt_regs *regs)
1306 1306
1307 pc = regs->nip - (instructions_to_print * 3 / 4 * sizeof(int)); 1307 pc = regs->nip - (instructions_to_print * 3 / 4 * sizeof(int));
1308 1308
1309 /*
1310 * Make sure the NIP points at userspace, not kernel text/data or
1311 * elsewhere.
1312 */
1313 if (!__access_ok(pc, instructions_to_print * sizeof(int), USER_DS)) {
1314 pr_info("%s[%d]: Bad NIP, not dumping instructions.\n",
1315 current->comm, current->pid);
1316 return;
1317 }
1318
1309 pr_info("%s[%d]: code: ", current->comm, current->pid); 1319 pr_info("%s[%d]: code: ", current->comm, current->pid);
1310 1320
1311 for (i = 0; i < instructions_to_print; i++) { 1321 for (i = 0; i < instructions_to_print; i++) {
diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c
index 6ae2777c220d..5ffee298745f 100644
--- a/arch/powerpc/lib/code-patching.c
+++ b/arch/powerpc/lib/code-patching.c
@@ -28,12 +28,6 @@ static int __patch_instruction(unsigned int *exec_addr, unsigned int instr,
28{ 28{
29 int err; 29 int err;
30 30
31 /* Make sure we aren't patching a freed init section */
32 if (init_mem_is_free && init_section_contains(exec_addr, 4)) {
33 pr_debug("Skipping init section patching addr: 0x%px\n", exec_addr);
34 return 0;
35 }
36
37 __put_user_size(instr, patch_addr, 4, err); 31 __put_user_size(instr, patch_addr, 4, err);
38 if (err) 32 if (err)
39 return err; 33 return err;
@@ -148,7 +142,7 @@ static inline int unmap_patch_area(unsigned long addr)
148 return 0; 142 return 0;
149} 143}
150 144
151int patch_instruction(unsigned int *addr, unsigned int instr) 145static int do_patch_instruction(unsigned int *addr, unsigned int instr)
152{ 146{
153 int err; 147 int err;
154 unsigned int *patch_addr = NULL; 148 unsigned int *patch_addr = NULL;
@@ -188,12 +182,22 @@ out:
188} 182}
189#else /* !CONFIG_STRICT_KERNEL_RWX */ 183#else /* !CONFIG_STRICT_KERNEL_RWX */
190 184
191int patch_instruction(unsigned int *addr, unsigned int instr) 185static int do_patch_instruction(unsigned int *addr, unsigned int instr)
192{ 186{
193 return raw_patch_instruction(addr, instr); 187 return raw_patch_instruction(addr, instr);
194} 188}
195 189
196#endif /* CONFIG_STRICT_KERNEL_RWX */ 190#endif /* CONFIG_STRICT_KERNEL_RWX */
191
192int patch_instruction(unsigned int *addr, unsigned int instr)
193{
194 /* Make sure we aren't patching a freed init section */
195 if (init_mem_is_free && init_section_contains(addr, 4)) {
196 pr_debug("Skipping init section patching addr: 0x%px\n", addr);
197 return 0;
198 }
199 return do_patch_instruction(addr, instr);
200}
197NOKPROBE_SYMBOL(patch_instruction); 201NOKPROBE_SYMBOL(patch_instruction);
198 202
199int patch_branch(unsigned int *addr, unsigned long target, int flags) 203int patch_branch(unsigned int *addr, unsigned long target, int flags)
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 59d07bd5374a..055b211b7126 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1217,9 +1217,10 @@ int find_and_online_cpu_nid(int cpu)
1217 * Need to ensure that NODE_DATA is initialized for a node from 1217 * Need to ensure that NODE_DATA is initialized for a node from
1218 * available memory (see memblock_alloc_try_nid). If unable to 1218 * available memory (see memblock_alloc_try_nid). If unable to
1219 * init the node, then default to nearest node that has memory 1219 * init the node, then default to nearest node that has memory
1220 * installed. 1220 * installed. Skip onlining a node if the subsystems are not
1221 * yet initialized.
1221 */ 1222 */
1222 if (try_online_node(new_nid)) 1223 if (!topology_inited || try_online_node(new_nid))
1223 new_nid = first_online_node; 1224 new_nid = first_online_node;
1224#else 1225#else
1225 /* 1226 /*
diff --git a/arch/s390/include/asm/sclp.h b/arch/s390/include/asm/sclp.h
index 3cae9168f63c..e44a8d7959f5 100644
--- a/arch/s390/include/asm/sclp.h
+++ b/arch/s390/include/asm/sclp.h
@@ -108,7 +108,8 @@ int sclp_early_get_core_info(struct sclp_core_info *info);
108void sclp_early_get_ipl_info(struct sclp_ipl_info *info); 108void sclp_early_get_ipl_info(struct sclp_ipl_info *info);
109void sclp_early_detect(void); 109void sclp_early_detect(void);
110void sclp_early_printk(const char *s); 110void sclp_early_printk(const char *s);
111void __sclp_early_printk(const char *s, unsigned int len); 111void sclp_early_printk_force(const char *s);
112void __sclp_early_printk(const char *s, unsigned int len, unsigned int force);
112 113
113int _sclp_get_core_info(struct sclp_core_info *info); 114int _sclp_get_core_info(struct sclp_core_info *info);
114int sclp_core_configure(u8 core); 115int sclp_core_configure(u8 core);
diff --git a/arch/s390/kernel/early_printk.c b/arch/s390/kernel/early_printk.c
index 9431784d7796..40c1dfec944e 100644
--- a/arch/s390/kernel/early_printk.c
+++ b/arch/s390/kernel/early_printk.c
@@ -10,7 +10,7 @@
10 10
11static void sclp_early_write(struct console *con, const char *s, unsigned int len) 11static void sclp_early_write(struct console *con, const char *s, unsigned int len)
12{ 12{
13 __sclp_early_printk(s, len); 13 __sclp_early_printk(s, len, 0);
14} 14}
15 15
16static struct console sclp_early_console = { 16static struct console sclp_early_console = {
diff --git a/arch/s390/kernel/swsusp.S b/arch/s390/kernel/swsusp.S
index a049a7b9d6e8..c1a080b11ae9 100644
--- a/arch/s390/kernel/swsusp.S
+++ b/arch/s390/kernel/swsusp.S
@@ -198,12 +198,10 @@ pgm_check_entry:
198 198
199 /* Suspend CPU not available -> panic */ 199 /* Suspend CPU not available -> panic */
200 larl %r15,init_thread_union 200 larl %r15,init_thread_union
201 ahi %r15,1<<(PAGE_SHIFT+THREAD_SIZE_ORDER) 201 aghi %r15,1<<(PAGE_SHIFT+THREAD_SIZE_ORDER)
202 aghi %r15,-STACK_FRAME_OVERHEAD
202 larl %r2,.Lpanic_string 203 larl %r2,.Lpanic_string
203 lghi %r1,0 204 brasl %r14,sclp_early_printk_force
204 sam31
205 sigp %r1,%r0,SIGP_SET_ARCHITECTURE
206 brasl %r14,sclp_early_printk
207 larl %r3,.Ldisabled_wait_31 205 larl %r3,.Ldisabled_wait_31
208 lpsw 0(%r3) 206 lpsw 0(%r3)
2094: 2074:
diff --git a/arch/sparc/kernel/auxio_64.c b/arch/sparc/kernel/auxio_64.c
index 4e8f56c3793c..cc42225c20f3 100644
--- a/arch/sparc/kernel/auxio_64.c
+++ b/arch/sparc/kernel/auxio_64.c
@@ -115,8 +115,8 @@ static int auxio_probe(struct platform_device *dev)
115 auxio_devtype = AUXIO_TYPE_SBUS; 115 auxio_devtype = AUXIO_TYPE_SBUS;
116 size = 1; 116 size = 1;
117 } else { 117 } else {
118 printk("auxio: Unknown parent bus type [%s]\n", 118 printk("auxio: Unknown parent bus type [%pOFn]\n",
119 dp->parent->name); 119 dp->parent);
120 return -ENODEV; 120 return -ENODEV;
121 } 121 }
122 auxio_register = of_ioremap(&dev->resource[0], 0, size, "auxio"); 122 auxio_register = of_ioremap(&dev->resource[0], 0, size, "auxio");
diff --git a/arch/sparc/kernel/kgdb_32.c b/arch/sparc/kernel/kgdb_32.c
index 5868fc333ea8..639c8e54530a 100644
--- a/arch/sparc/kernel/kgdb_32.c
+++ b/arch/sparc/kernel/kgdb_32.c
@@ -122,7 +122,7 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
122 linux_regs->pc = addr; 122 linux_regs->pc = addr;
123 linux_regs->npc = addr + 4; 123 linux_regs->npc = addr + 4;
124 } 124 }
125 /* fallthru */ 125 /* fall through */
126 126
127 case 'D': 127 case 'D':
128 case 'k': 128 case 'k':
diff --git a/arch/sparc/kernel/kgdb_64.c b/arch/sparc/kernel/kgdb_64.c
index d5f7dc6323d5..a68bbddbdba4 100644
--- a/arch/sparc/kernel/kgdb_64.c
+++ b/arch/sparc/kernel/kgdb_64.c
@@ -148,7 +148,7 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
148 linux_regs->tpc = addr; 148 linux_regs->tpc = addr;
149 linux_regs->tnpc = addr + 4; 149 linux_regs->tnpc = addr + 4;
150 } 150 }
151 /* fallthru */ 151 /* fall through */
152 152
153 case 'D': 153 case 'D':
154 case 'k': 154 case 'k':
diff --git a/arch/sparc/kernel/power.c b/arch/sparc/kernel/power.c
index 92627abce311..d941875dd718 100644
--- a/arch/sparc/kernel/power.c
+++ b/arch/sparc/kernel/power.c
@@ -41,8 +41,8 @@ static int power_probe(struct platform_device *op)
41 41
42 power_reg = of_ioremap(res, 0, 0x4, "power"); 42 power_reg = of_ioremap(res, 0, 0x4, "power");
43 43
44 printk(KERN_INFO "%s: Control reg at %llx\n", 44 printk(KERN_INFO "%pOFn: Control reg at %llx\n",
45 op->dev.of_node->name, res->start); 45 op->dev.of_node, res->start);
46 46
47 if (has_button_interrupt(irq, op->dev.of_node)) { 47 if (has_button_interrupt(irq, op->dev.of_node)) {
48 if (request_irq(irq, 48 if (request_irq(irq,
diff --git a/arch/sparc/kernel/prom_32.c b/arch/sparc/kernel/prom_32.c
index b51cbb9e87dc..17c87d29ff20 100644
--- a/arch/sparc/kernel/prom_32.c
+++ b/arch/sparc/kernel/prom_32.c
@@ -68,8 +68,8 @@ static void __init sparc32_path_component(struct device_node *dp, char *tmp_buf)
68 return; 68 return;
69 69
70 regs = rprop->value; 70 regs = rprop->value;
71 sprintf(tmp_buf, "%s@%x,%x", 71 sprintf(tmp_buf, "%pOFn@%x,%x",
72 dp->name, 72 dp,
73 regs->which_io, regs->phys_addr); 73 regs->which_io, regs->phys_addr);
74} 74}
75 75
@@ -84,8 +84,8 @@ static void __init sbus_path_component(struct device_node *dp, char *tmp_buf)
84 return; 84 return;
85 85
86 regs = prop->value; 86 regs = prop->value;
87 sprintf(tmp_buf, "%s@%x,%x", 87 sprintf(tmp_buf, "%pOFn@%x,%x",
88 dp->name, 88 dp,
89 regs->which_io, 89 regs->which_io,
90 regs->phys_addr); 90 regs->phys_addr);
91} 91}
@@ -104,13 +104,13 @@ static void __init pci_path_component(struct device_node *dp, char *tmp_buf)
104 regs = prop->value; 104 regs = prop->value;
105 devfn = (regs->phys_hi >> 8) & 0xff; 105 devfn = (regs->phys_hi >> 8) & 0xff;
106 if (devfn & 0x07) { 106 if (devfn & 0x07) {
107 sprintf(tmp_buf, "%s@%x,%x", 107 sprintf(tmp_buf, "%pOFn@%x,%x",
108 dp->name, 108 dp,
109 devfn >> 3, 109 devfn >> 3,
110 devfn & 0x07); 110 devfn & 0x07);
111 } else { 111 } else {
112 sprintf(tmp_buf, "%s@%x", 112 sprintf(tmp_buf, "%pOFn@%x",
113 dp->name, 113 dp,
114 devfn >> 3); 114 devfn >> 3);
115 } 115 }
116} 116}
@@ -127,8 +127,8 @@ static void __init ebus_path_component(struct device_node *dp, char *tmp_buf)
127 127
128 regs = prop->value; 128 regs = prop->value;
129 129
130 sprintf(tmp_buf, "%s@%x,%x", 130 sprintf(tmp_buf, "%pOFn@%x,%x",
131 dp->name, 131 dp,
132 regs->which_io, regs->phys_addr); 132 regs->which_io, regs->phys_addr);
133} 133}
134 134
@@ -167,8 +167,8 @@ static void __init ambapp_path_component(struct device_node *dp, char *tmp_buf)
167 return; 167 return;
168 device = prop->value; 168 device = prop->value;
169 169
170 sprintf(tmp_buf, "%s:%d:%d@%x,%x", 170 sprintf(tmp_buf, "%pOFn:%d:%d@%x,%x",
171 dp->name, *vendor, *device, 171 dp, *vendor, *device,
172 *intr, reg0); 172 *intr, reg0);
173} 173}
174 174
@@ -201,7 +201,7 @@ char * __init build_path_component(struct device_node *dp)
201 tmp_buf[0] = '\0'; 201 tmp_buf[0] = '\0';
202 __build_path_component(dp, tmp_buf); 202 __build_path_component(dp, tmp_buf);
203 if (tmp_buf[0] == '\0') 203 if (tmp_buf[0] == '\0')
204 strcpy(tmp_buf, dp->name); 204 snprintf(tmp_buf, sizeof(tmp_buf), "%pOFn", dp);
205 205
206 n = prom_early_alloc(strlen(tmp_buf) + 1); 206 n = prom_early_alloc(strlen(tmp_buf) + 1);
207 strcpy(n, tmp_buf); 207 strcpy(n, tmp_buf);
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c
index baeaeed64993..6220411ce8fc 100644
--- a/arch/sparc/kernel/prom_64.c
+++ b/arch/sparc/kernel/prom_64.c
@@ -82,8 +82,8 @@ static void __init sun4v_path_component(struct device_node *dp, char *tmp_buf)
82 82
83 regs = rprop->value; 83 regs = rprop->value;
84 if (!of_node_is_root(dp->parent)) { 84 if (!of_node_is_root(dp->parent)) {
85 sprintf(tmp_buf, "%s@%x,%x", 85 sprintf(tmp_buf, "%pOFn@%x,%x",
86 dp->name, 86 dp,
87 (unsigned int) (regs->phys_addr >> 32UL), 87 (unsigned int) (regs->phys_addr >> 32UL),
88 (unsigned int) (regs->phys_addr & 0xffffffffUL)); 88 (unsigned int) (regs->phys_addr & 0xffffffffUL));
89 return; 89 return;
@@ -97,17 +97,17 @@ static void __init sun4v_path_component(struct device_node *dp, char *tmp_buf)
97 const char *prefix = (type == 0) ? "m" : "i"; 97 const char *prefix = (type == 0) ? "m" : "i";
98 98
99 if (low_bits) 99 if (low_bits)
100 sprintf(tmp_buf, "%s@%s%x,%x", 100 sprintf(tmp_buf, "%pOFn@%s%x,%x",
101 dp->name, prefix, 101 dp, prefix,
102 high_bits, low_bits); 102 high_bits, low_bits);
103 else 103 else
104 sprintf(tmp_buf, "%s@%s%x", 104 sprintf(tmp_buf, "%pOFn@%s%x",
105 dp->name, 105 dp,
106 prefix, 106 prefix,
107 high_bits); 107 high_bits);
108 } else if (type == 12) { 108 } else if (type == 12) {
109 sprintf(tmp_buf, "%s@%x", 109 sprintf(tmp_buf, "%pOFn@%x",
110 dp->name, high_bits); 110 dp, high_bits);
111 } 111 }
112} 112}
113 113
@@ -122,8 +122,8 @@ static void __init sun4u_path_component(struct device_node *dp, char *tmp_buf)
122 122
123 regs = prop->value; 123 regs = prop->value;
124 if (!of_node_is_root(dp->parent)) { 124 if (!of_node_is_root(dp->parent)) {
125 sprintf(tmp_buf, "%s@%x,%x", 125 sprintf(tmp_buf, "%pOFn@%x,%x",
126 dp->name, 126 dp,
127 (unsigned int) (regs->phys_addr >> 32UL), 127 (unsigned int) (regs->phys_addr >> 32UL),
128 (unsigned int) (regs->phys_addr & 0xffffffffUL)); 128 (unsigned int) (regs->phys_addr & 0xffffffffUL));
129 return; 129 return;
@@ -138,8 +138,8 @@ static void __init sun4u_path_component(struct device_node *dp, char *tmp_buf)
138 if (tlb_type >= cheetah) 138 if (tlb_type >= cheetah)
139 mask = 0x7fffff; 139 mask = 0x7fffff;
140 140
141 sprintf(tmp_buf, "%s@%x,%x", 141 sprintf(tmp_buf, "%pOFn@%x,%x",
142 dp->name, 142 dp,
143 *(u32 *)prop->value, 143 *(u32 *)prop->value,
144 (unsigned int) (regs->phys_addr & mask)); 144 (unsigned int) (regs->phys_addr & mask));
145 } 145 }
@@ -156,8 +156,8 @@ static void __init sbus_path_component(struct device_node *dp, char *tmp_buf)
156 return; 156 return;
157 157
158 regs = prop->value; 158 regs = prop->value;
159 sprintf(tmp_buf, "%s@%x,%x", 159 sprintf(tmp_buf, "%pOFn@%x,%x",
160 dp->name, 160 dp,
161 regs->which_io, 161 regs->which_io,
162 regs->phys_addr); 162 regs->phys_addr);
163} 163}
@@ -176,13 +176,13 @@ static void __init pci_path_component(struct device_node *dp, char *tmp_buf)
176 regs = prop->value; 176 regs = prop->value;
177 devfn = (regs->phys_hi >> 8) & 0xff; 177 devfn = (regs->phys_hi >> 8) & 0xff;
178 if (devfn & 0x07) { 178 if (devfn & 0x07) {
179 sprintf(tmp_buf, "%s@%x,%x", 179 sprintf(tmp_buf, "%pOFn@%x,%x",
180 dp->name, 180 dp,
181 devfn >> 3, 181 devfn >> 3,
182 devfn & 0x07); 182 devfn & 0x07);
183 } else { 183 } else {
184 sprintf(tmp_buf, "%s@%x", 184 sprintf(tmp_buf, "%pOFn@%x",
185 dp->name, 185 dp,
186 devfn >> 3); 186 devfn >> 3);
187 } 187 }
188} 188}
@@ -203,8 +203,8 @@ static void __init upa_path_component(struct device_node *dp, char *tmp_buf)
203 if (!prop) 203 if (!prop)
204 return; 204 return;
205 205
206 sprintf(tmp_buf, "%s@%x,%x", 206 sprintf(tmp_buf, "%pOFn@%x,%x",
207 dp->name, 207 dp,
208 *(u32 *) prop->value, 208 *(u32 *) prop->value,
209 (unsigned int) (regs->phys_addr & 0xffffffffUL)); 209 (unsigned int) (regs->phys_addr & 0xffffffffUL));
210} 210}
@@ -221,7 +221,7 @@ static void __init vdev_path_component(struct device_node *dp, char *tmp_buf)
221 221
222 regs = prop->value; 222 regs = prop->value;
223 223
224 sprintf(tmp_buf, "%s@%x", dp->name, *regs); 224 sprintf(tmp_buf, "%pOFn@%x", dp, *regs);
225} 225}
226 226
227/* "name@addrhi,addrlo" */ 227/* "name@addrhi,addrlo" */
@@ -236,8 +236,8 @@ static void __init ebus_path_component(struct device_node *dp, char *tmp_buf)
236 236
237 regs = prop->value; 237 regs = prop->value;
238 238
239 sprintf(tmp_buf, "%s@%x,%x", 239 sprintf(tmp_buf, "%pOFn@%x,%x",
240 dp->name, 240 dp,
241 (unsigned int) (regs->phys_addr >> 32UL), 241 (unsigned int) (regs->phys_addr >> 32UL),
242 (unsigned int) (regs->phys_addr & 0xffffffffUL)); 242 (unsigned int) (regs->phys_addr & 0xffffffffUL));
243} 243}
@@ -257,8 +257,8 @@ static void __init i2c_path_component(struct device_node *dp, char *tmp_buf)
257 /* This actually isn't right... should look at the #address-cells 257 /* This actually isn't right... should look at the #address-cells
258 * property of the i2c bus node etc. etc. 258 * property of the i2c bus node etc. etc.
259 */ 259 */
260 sprintf(tmp_buf, "%s@%x,%x", 260 sprintf(tmp_buf, "%pOFn@%x,%x",
261 dp->name, regs[0], regs[1]); 261 dp, regs[0], regs[1]);
262} 262}
263 263
264/* "name@reg0[,reg1]" */ 264/* "name@reg0[,reg1]" */
@@ -274,11 +274,11 @@ static void __init usb_path_component(struct device_node *dp, char *tmp_buf)
274 regs = prop->value; 274 regs = prop->value;
275 275
276 if (prop->length == sizeof(u32) || regs[1] == 1) { 276 if (prop->length == sizeof(u32) || regs[1] == 1) {
277 sprintf(tmp_buf, "%s@%x", 277 sprintf(tmp_buf, "%pOFn@%x",
278 dp->name, regs[0]); 278 dp, regs[0]);
279 } else { 279 } else {
280 sprintf(tmp_buf, "%s@%x,%x", 280 sprintf(tmp_buf, "%pOFn@%x,%x",
281 dp->name, regs[0], regs[1]); 281 dp, regs[0], regs[1]);
282 } 282 }
283} 283}
284 284
@@ -295,11 +295,11 @@ static void __init ieee1394_path_component(struct device_node *dp, char *tmp_buf
295 regs = prop->value; 295 regs = prop->value;
296 296
297 if (regs[2] || regs[3]) { 297 if (regs[2] || regs[3]) {
298 sprintf(tmp_buf, "%s@%08x%08x,%04x%08x", 298 sprintf(tmp_buf, "%pOFn@%08x%08x,%04x%08x",
299 dp->name, regs[0], regs[1], regs[2], regs[3]); 299 dp, regs[0], regs[1], regs[2], regs[3]);
300 } else { 300 } else {
301 sprintf(tmp_buf, "%s@%08x%08x", 301 sprintf(tmp_buf, "%pOFn@%08x%08x",
302 dp->name, regs[0], regs[1]); 302 dp, regs[0], regs[1]);
303 } 303 }
304} 304}
305 305
@@ -361,7 +361,7 @@ char * __init build_path_component(struct device_node *dp)
361 tmp_buf[0] = '\0'; 361 tmp_buf[0] = '\0';
362 __build_path_component(dp, tmp_buf); 362 __build_path_component(dp, tmp_buf);
363 if (tmp_buf[0] == '\0') 363 if (tmp_buf[0] == '\0')
364 strcpy(tmp_buf, dp->name); 364 snprintf(tmp_buf, sizeof(tmp_buf), "%pOFn", dp);
365 365
366 n = prom_early_alloc(strlen(tmp_buf) + 1); 366 n = prom_early_alloc(strlen(tmp_buf) + 1);
367 strcpy(n, tmp_buf); 367 strcpy(n, tmp_buf);
diff --git a/arch/sparc/kernel/viohs.c b/arch/sparc/kernel/viohs.c
index 635d67ffc9a3..7db5aabe9708 100644
--- a/arch/sparc/kernel/viohs.c
+++ b/arch/sparc/kernel/viohs.c
@@ -180,11 +180,17 @@ static int send_dreg(struct vio_driver_state *vio)
180 struct vio_dring_register pkt; 180 struct vio_dring_register pkt;
181 char all[sizeof(struct vio_dring_register) + 181 char all[sizeof(struct vio_dring_register) +
182 (sizeof(struct ldc_trans_cookie) * 182 (sizeof(struct ldc_trans_cookie) *
183 dr->ncookies)]; 183 VIO_MAX_RING_COOKIES)];
184 } u; 184 } u;
185 size_t bytes = sizeof(struct vio_dring_register) +
186 (sizeof(struct ldc_trans_cookie) *
187 dr->ncookies);
185 int i; 188 int i;
186 189
187 memset(&u, 0, sizeof(u)); 190 if (WARN_ON(bytes > sizeof(u)))
191 return -EINVAL;
192
193 memset(&u, 0, bytes);
188 init_tag(&u.pkt.tag, VIO_TYPE_CTRL, VIO_SUBTYPE_INFO, VIO_DRING_REG); 194 init_tag(&u.pkt.tag, VIO_TYPE_CTRL, VIO_SUBTYPE_INFO, VIO_DRING_REG);
189 u.pkt.dring_ident = 0; 195 u.pkt.dring_ident = 0;
190 u.pkt.num_descr = dr->num_entries; 196 u.pkt.num_descr = dr->num_entries;
@@ -206,7 +212,7 @@ static int send_dreg(struct vio_driver_state *vio)
206 (unsigned long long) u.pkt.cookies[i].cookie_size); 212 (unsigned long long) u.pkt.cookies[i].cookie_size);
207 } 213 }
208 214
209 return send_ctrl(vio, &u.pkt.tag, sizeof(u)); 215 return send_ctrl(vio, &u.pkt.tag, bytes);
210} 216}
211 217
212static int send_rdx(struct vio_driver_state *vio) 218static int send_rdx(struct vio_driver_state *vio)
diff --git a/arch/sparc/vdso/Makefile b/arch/sparc/vdso/Makefile
index dd0b5a92ffd0..dc85570d8839 100644
--- a/arch/sparc/vdso/Makefile
+++ b/arch/sparc/vdso/Makefile
@@ -31,23 +31,21 @@ obj-y += $(vdso_img_objs)
31targets += $(vdso_img_cfiles) 31targets += $(vdso_img_cfiles)
32targets += $(vdso_img_sodbg) $(vdso_img-y:%=vdso%.so) 32targets += $(vdso_img_sodbg) $(vdso_img-y:%=vdso%.so)
33 33
34export CPPFLAGS_vdso.lds += -P -C 34CPPFLAGS_vdso.lds += -P -C
35 35
36VDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \ 36VDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \
37 -Wl,--no-undefined \ 37 -Wl,--no-undefined \
38 -Wl,-z,max-page-size=8192 -Wl,-z,common-page-size=8192 \ 38 -Wl,-z,max-page-size=8192 -Wl,-z,common-page-size=8192 \
39 $(DISABLE_LTO) 39 $(DISABLE_LTO)
40 40
41$(obj)/vdso64.so.dbg: $(src)/vdso.lds $(vobjs) FORCE 41$(obj)/vdso64.so.dbg: $(obj)/vdso.lds $(vobjs) FORCE
42 $(call if_changed,vdso) 42 $(call if_changed,vdso)
43 43
44HOST_EXTRACFLAGS += -I$(srctree)/tools/include 44HOST_EXTRACFLAGS += -I$(srctree)/tools/include
45hostprogs-y += vdso2c 45hostprogs-y += vdso2c
46 46
47quiet_cmd_vdso2c = VDSO2C $@ 47quiet_cmd_vdso2c = VDSO2C $@
48define cmd_vdso2c 48 cmd_vdso2c = $(obj)/vdso2c $< $(<:%.dbg=%) $@
49 $(obj)/vdso2c $< $(<:%.dbg=%) $@
50endef
51 49
52$(obj)/vdso-image-%.c: $(obj)/vdso%.so.dbg $(obj)/vdso%.so $(obj)/vdso2c FORCE 50$(obj)/vdso-image-%.c: $(obj)/vdso%.so.dbg $(obj)/vdso%.so $(obj)/vdso2c FORCE
53 $(call if_changed,vdso2c) 51 $(call if_changed,vdso2c)
diff --git a/arch/x86/kernel/cpu/intel_rdt.h b/arch/x86/kernel/cpu/intel_rdt.h
index 285eb3ec4200..3736f6dc9545 100644
--- a/arch/x86/kernel/cpu/intel_rdt.h
+++ b/arch/x86/kernel/cpu/intel_rdt.h
@@ -529,14 +529,14 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of,
529int rdtgroup_schemata_show(struct kernfs_open_file *of, 529int rdtgroup_schemata_show(struct kernfs_open_file *of,
530 struct seq_file *s, void *v); 530 struct seq_file *s, void *v);
531bool rdtgroup_cbm_overlaps(struct rdt_resource *r, struct rdt_domain *d, 531bool rdtgroup_cbm_overlaps(struct rdt_resource *r, struct rdt_domain *d,
532 u32 _cbm, int closid, bool exclusive); 532 unsigned long cbm, int closid, bool exclusive);
533unsigned int rdtgroup_cbm_to_size(struct rdt_resource *r, struct rdt_domain *d, 533unsigned int rdtgroup_cbm_to_size(struct rdt_resource *r, struct rdt_domain *d,
534 u32 cbm); 534 unsigned long cbm);
535enum rdtgrp_mode rdtgroup_mode_by_closid(int closid); 535enum rdtgrp_mode rdtgroup_mode_by_closid(int closid);
536int rdtgroup_tasks_assigned(struct rdtgroup *r); 536int rdtgroup_tasks_assigned(struct rdtgroup *r);
537int rdtgroup_locksetup_enter(struct rdtgroup *rdtgrp); 537int rdtgroup_locksetup_enter(struct rdtgroup *rdtgrp);
538int rdtgroup_locksetup_exit(struct rdtgroup *rdtgrp); 538int rdtgroup_locksetup_exit(struct rdtgroup *rdtgrp);
539bool rdtgroup_cbm_overlaps_pseudo_locked(struct rdt_domain *d, u32 _cbm); 539bool rdtgroup_cbm_overlaps_pseudo_locked(struct rdt_domain *d, unsigned long cbm);
540bool rdtgroup_pseudo_locked_in_hierarchy(struct rdt_domain *d); 540bool rdtgroup_pseudo_locked_in_hierarchy(struct rdt_domain *d);
541int rdt_pseudo_lock_init(void); 541int rdt_pseudo_lock_init(void);
542void rdt_pseudo_lock_release(void); 542void rdt_pseudo_lock_release(void);
diff --git a/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c b/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c
index 40f3903ae5d9..f8c260d522ca 100644
--- a/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c
+++ b/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c
@@ -797,25 +797,27 @@ int rdtgroup_locksetup_exit(struct rdtgroup *rdtgrp)
797/** 797/**
798 * rdtgroup_cbm_overlaps_pseudo_locked - Test if CBM or portion is pseudo-locked 798 * rdtgroup_cbm_overlaps_pseudo_locked - Test if CBM or portion is pseudo-locked
799 * @d: RDT domain 799 * @d: RDT domain
800 * @_cbm: CBM to test 800 * @cbm: CBM to test
801 * 801 *
802 * @d represents a cache instance and @_cbm a capacity bitmask that is 802 * @d represents a cache instance and @cbm a capacity bitmask that is
803 * considered for it. Determine if @_cbm overlaps with any existing 803 * considered for it. Determine if @cbm overlaps with any existing
804 * pseudo-locked region on @d. 804 * pseudo-locked region on @d.
805 * 805 *
806 * Return: true if @_cbm overlaps with pseudo-locked region on @d, false 806 * @cbm is unsigned long, even if only 32 bits are used, to make the
807 * bitmap functions work correctly.
808 *
809 * Return: true if @cbm overlaps with pseudo-locked region on @d, false
807 * otherwise. 810 * otherwise.
808 */ 811 */
809bool rdtgroup_cbm_overlaps_pseudo_locked(struct rdt_domain *d, u32 _cbm) 812bool rdtgroup_cbm_overlaps_pseudo_locked(struct rdt_domain *d, unsigned long cbm)
810{ 813{
811 unsigned long *cbm = (unsigned long *)&_cbm;
812 unsigned long *cbm_b;
813 unsigned int cbm_len; 814 unsigned int cbm_len;
815 unsigned long cbm_b;
814 816
815 if (d->plr) { 817 if (d->plr) {
816 cbm_len = d->plr->r->cache.cbm_len; 818 cbm_len = d->plr->r->cache.cbm_len;
817 cbm_b = (unsigned long *)&d->plr->cbm; 819 cbm_b = d->plr->cbm;
818 if (bitmap_intersects(cbm, cbm_b, cbm_len)) 820 if (bitmap_intersects(&cbm, &cbm_b, cbm_len))
819 return true; 821 return true;
820 } 822 }
821 return false; 823 return false;
diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
index 1b8e86a5d5e1..b140c68bc14b 100644
--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
@@ -975,33 +975,34 @@ static int rdtgroup_mode_show(struct kernfs_open_file *of,
975 * is false then overlaps with any resource group or hardware entities 975 * is false then overlaps with any resource group or hardware entities
976 * will be considered. 976 * will be considered.
977 * 977 *
978 * @cbm is unsigned long, even if only 32 bits are used, to make the
979 * bitmap functions work correctly.
980 *
978 * Return: false if CBM does not overlap, true if it does. 981 * Return: false if CBM does not overlap, true if it does.
979 */ 982 */
980bool rdtgroup_cbm_overlaps(struct rdt_resource *r, struct rdt_domain *d, 983bool rdtgroup_cbm_overlaps(struct rdt_resource *r, struct rdt_domain *d,
981 u32 _cbm, int closid, bool exclusive) 984 unsigned long cbm, int closid, bool exclusive)
982{ 985{
983 unsigned long *cbm = (unsigned long *)&_cbm;
984 unsigned long *ctrl_b;
985 enum rdtgrp_mode mode; 986 enum rdtgrp_mode mode;
987 unsigned long ctrl_b;
986 u32 *ctrl; 988 u32 *ctrl;
987 int i; 989 int i;
988 990
989 /* Check for any overlap with regions used by hardware directly */ 991 /* Check for any overlap with regions used by hardware directly */
990 if (!exclusive) { 992 if (!exclusive) {
991 if (bitmap_intersects(cbm, 993 ctrl_b = r->cache.shareable_bits;
992 (unsigned long *)&r->cache.shareable_bits, 994 if (bitmap_intersects(&cbm, &ctrl_b, r->cache.cbm_len))
993 r->cache.cbm_len))
994 return true; 995 return true;
995 } 996 }
996 997
997 /* Check for overlap with other resource groups */ 998 /* Check for overlap with other resource groups */
998 ctrl = d->ctrl_val; 999 ctrl = d->ctrl_val;
999 for (i = 0; i < closids_supported(); i++, ctrl++) { 1000 for (i = 0; i < closids_supported(); i++, ctrl++) {
1000 ctrl_b = (unsigned long *)ctrl; 1001 ctrl_b = *ctrl;
1001 mode = rdtgroup_mode_by_closid(i); 1002 mode = rdtgroup_mode_by_closid(i);
1002 if (closid_allocated(i) && i != closid && 1003 if (closid_allocated(i) && i != closid &&
1003 mode != RDT_MODE_PSEUDO_LOCKSETUP) { 1004 mode != RDT_MODE_PSEUDO_LOCKSETUP) {
1004 if (bitmap_intersects(cbm, ctrl_b, r->cache.cbm_len)) { 1005 if (bitmap_intersects(&cbm, &ctrl_b, r->cache.cbm_len)) {
1005 if (exclusive) { 1006 if (exclusive) {
1006 if (mode == RDT_MODE_EXCLUSIVE) 1007 if (mode == RDT_MODE_EXCLUSIVE)
1007 return true; 1008 return true;
@@ -1138,15 +1139,18 @@ out:
1138 * computed by first dividing the total cache size by the CBM length to 1139 * computed by first dividing the total cache size by the CBM length to
1139 * determine how many bytes each bit in the bitmask represents. The result 1140 * determine how many bytes each bit in the bitmask represents. The result
1140 * is multiplied with the number of bits set in the bitmask. 1141 * is multiplied with the number of bits set in the bitmask.
1142 *
1143 * @cbm is unsigned long, even if only 32 bits are used to make the
1144 * bitmap functions work correctly.
1141 */ 1145 */
1142unsigned int rdtgroup_cbm_to_size(struct rdt_resource *r, 1146unsigned int rdtgroup_cbm_to_size(struct rdt_resource *r,
1143 struct rdt_domain *d, u32 cbm) 1147 struct rdt_domain *d, unsigned long cbm)
1144{ 1148{
1145 struct cpu_cacheinfo *ci; 1149 struct cpu_cacheinfo *ci;
1146 unsigned int size = 0; 1150 unsigned int size = 0;
1147 int num_b, i; 1151 int num_b, i;
1148 1152
1149 num_b = bitmap_weight((unsigned long *)&cbm, r->cache.cbm_len); 1153 num_b = bitmap_weight(&cbm, r->cache.cbm_len);
1150 ci = get_cpu_cacheinfo(cpumask_any(&d->cpu_mask)); 1154 ci = get_cpu_cacheinfo(cpumask_any(&d->cpu_mask));
1151 for (i = 0; i < ci->num_leaves; i++) { 1155 for (i = 0; i < ci->num_leaves; i++) {
1152 if (ci->info_list[i].level == r->cache_level) { 1156 if (ci->info_list[i].level == r->cache_level) {
@@ -2353,6 +2357,7 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp)
2353 u32 used_b = 0, unused_b = 0; 2357 u32 used_b = 0, unused_b = 0;
2354 u32 closid = rdtgrp->closid; 2358 u32 closid = rdtgrp->closid;
2355 struct rdt_resource *r; 2359 struct rdt_resource *r;
2360 unsigned long tmp_cbm;
2356 enum rdtgrp_mode mode; 2361 enum rdtgrp_mode mode;
2357 struct rdt_domain *d; 2362 struct rdt_domain *d;
2358 int i, ret; 2363 int i, ret;
@@ -2390,9 +2395,14 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp)
2390 * modify the CBM based on system availability. 2395 * modify the CBM based on system availability.
2391 */ 2396 */
2392 cbm_ensure_valid(&d->new_ctrl, r); 2397 cbm_ensure_valid(&d->new_ctrl, r);
2393 if (bitmap_weight((unsigned long *) &d->new_ctrl, 2398 /*
2394 r->cache.cbm_len) < 2399 * Assign the u32 CBM to an unsigned long to ensure
2395 r->cache.min_cbm_bits) { 2400 * that bitmap_weight() does not access out-of-bound
2401 * memory.
2402 */
2403 tmp_cbm = d->new_ctrl;
2404 if (bitmap_weight(&tmp_cbm, r->cache.cbm_len) <
2405 r->cache.min_cbm_bits) {
2396 rdt_last_cmd_printf("no space on %s:%d\n", 2406 rdt_last_cmd_printf("no space on %s:%d\n",
2397 r->name, d->id); 2407 r->name, d->id);
2398 return -ENOSPC; 2408 return -ENOSPC;
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
index 089e78c4effd..59274e2c1ac4 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -115,6 +115,8 @@ static inline void pgd_list_del(pgd_t *pgd)
115 115
116#define UNSHARED_PTRS_PER_PGD \ 116#define UNSHARED_PTRS_PER_PGD \
117 (SHARED_KERNEL_PMD ? KERNEL_PGD_BOUNDARY : PTRS_PER_PGD) 117 (SHARED_KERNEL_PMD ? KERNEL_PGD_BOUNDARY : PTRS_PER_PGD)
118#define MAX_UNSHARED_PTRS_PER_PGD \
119 max_t(size_t, KERNEL_PGD_BOUNDARY, PTRS_PER_PGD)
118 120
119 121
120static void pgd_set_mm(pgd_t *pgd, struct mm_struct *mm) 122static void pgd_set_mm(pgd_t *pgd, struct mm_struct *mm)
@@ -181,6 +183,7 @@ static void pgd_dtor(pgd_t *pgd)
181 * and initialize the kernel pmds here. 183 * and initialize the kernel pmds here.
182 */ 184 */
183#define PREALLOCATED_PMDS UNSHARED_PTRS_PER_PGD 185#define PREALLOCATED_PMDS UNSHARED_PTRS_PER_PGD
186#define MAX_PREALLOCATED_PMDS MAX_UNSHARED_PTRS_PER_PGD
184 187
185/* 188/*
186 * We allocate separate PMDs for the kernel part of the user page-table 189 * We allocate separate PMDs for the kernel part of the user page-table
@@ -189,6 +192,7 @@ static void pgd_dtor(pgd_t *pgd)
189 */ 192 */
190#define PREALLOCATED_USER_PMDS (static_cpu_has(X86_FEATURE_PTI) ? \ 193#define PREALLOCATED_USER_PMDS (static_cpu_has(X86_FEATURE_PTI) ? \
191 KERNEL_PGD_PTRS : 0) 194 KERNEL_PGD_PTRS : 0)
195#define MAX_PREALLOCATED_USER_PMDS KERNEL_PGD_PTRS
192 196
193void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd) 197void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd)
194{ 198{
@@ -210,7 +214,9 @@ void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd)
210 214
211/* No need to prepopulate any pagetable entries in non-PAE modes. */ 215/* No need to prepopulate any pagetable entries in non-PAE modes. */
212#define PREALLOCATED_PMDS 0 216#define PREALLOCATED_PMDS 0
217#define MAX_PREALLOCATED_PMDS 0
213#define PREALLOCATED_USER_PMDS 0 218#define PREALLOCATED_USER_PMDS 0
219#define MAX_PREALLOCATED_USER_PMDS 0
214#endif /* CONFIG_X86_PAE */ 220#endif /* CONFIG_X86_PAE */
215 221
216static void free_pmds(struct mm_struct *mm, pmd_t *pmds[], int count) 222static void free_pmds(struct mm_struct *mm, pmd_t *pmds[], int count)
@@ -428,8 +434,8 @@ static inline void _pgd_free(pgd_t *pgd)
428pgd_t *pgd_alloc(struct mm_struct *mm) 434pgd_t *pgd_alloc(struct mm_struct *mm)
429{ 435{
430 pgd_t *pgd; 436 pgd_t *pgd;
431 pmd_t *u_pmds[PREALLOCATED_USER_PMDS]; 437 pmd_t *u_pmds[MAX_PREALLOCATED_USER_PMDS];
432 pmd_t *pmds[PREALLOCATED_PMDS]; 438 pmd_t *pmds[MAX_PREALLOCATED_PMDS];
433 439
434 pgd = _pgd_alloc(); 440 pgd = _pgd_alloc();
435 441