Skip to content

Commit 601a880

Browse files
committed
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar: "A number of fixes and some late updates: - make in_compat_syscall() behavior on x86-32 similar to other platforms, this touches a number of generic files but is not intended to impact non-x86 platforms. - objtool fixes - PAT preemption fix - paravirt fixes/cleanups - cpufeatures updates for new instructions - earlyprintk quirk - make microcode version in sysfs world-readable (it is already world-readable in procfs) - minor cleanups and fixes" * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: compat: Cleanup in_compat_syscall() callers x86/compat: Adjust in_compat_syscall() to generic code under !COMPAT objtool: Support GCC 9 cold subfunction naming scheme x86/numa_emulation: Fix uniform-split numa emulation x86/paravirt: Remove unused _paravirt_ident_32 x86/mm/pat: Disable preemption around __flush_tlb_all() x86/paravirt: Remove GPL from pv_ops export x86/traps: Use format string with panic() call x86: Clean up 'sizeof x' => 'sizeof(x)' x86/cpufeatures: Enumerate MOVDIR64B instruction x86/cpufeatures: Enumerate MOVDIRI instruction x86/earlyprintk: Add a force option for pciserial device objtool: Support per-function rodata sections x86/microcode: Make revision and processor flags world-readable
2 parents 01897f3 + 23a12dd commit 601a880

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+198
-171
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@
10681068
earlyprintk=serial[,0x...[,baudrate]]
10691069
earlyprintk=ttySn[,baudrate]
10701070
earlyprintk=dbgp[debugController#]
1071-
earlyprintk=pciserial,bus:device.function[,baudrate]
1071+
earlyprintk=pciserial[,force],bus:device.function[,baudrate]
10721072
earlyprintk=xdbc[xhciController#]
10731073

10741074
earlyprintk is useful when the kernel crashes before
@@ -1100,6 +1100,10 @@
11001100

11011101
The sclp output can only be used on s390.
11021102

1103+
The optional "force" to "pciserial" enables use of a
1104+
PCI device even when its classcode is not of the
1105+
UART class.
1106+
11031107
edac_report= [HW,EDAC] Control how to report EDAC event
11041108
Format: {"on" | "off" | "force"}
11051109
on: enable EDAC to report H/W event. May be overridden

arch/x86/boot/cpucheck.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr)
113113
{
114114
int err;
115115

116-
memset(&cpu.flags, 0, sizeof cpu.flags);
116+
memset(&cpu.flags, 0, sizeof(cpu.flags));
117117
cpu.level = 3;
118118

119119
if (has_eflag(X86_EFLAGS_AC))

arch/x86/boot/early_serial_console.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static void parse_earlyprintk(void)
5050
int pos = 0;
5151
int port = 0;
5252

53-
if (cmdline_find_option("earlyprintk", arg, sizeof arg) > 0) {
53+
if (cmdline_find_option("earlyprintk", arg, sizeof(arg)) > 0) {
5454
char *e;
5555

5656
if (!strncmp(arg, "serial", 6)) {
@@ -124,7 +124,7 @@ static void parse_console_uart8250(void)
124124
* console=uart8250,io,0x3f8,115200n8
125125
* need to make sure it is last one console !
126126
*/
127-
if (cmdline_find_option("console", optstr, sizeof optstr) <= 0)
127+
if (cmdline_find_option("console", optstr, sizeof(optstr)) <= 0)
128128
return;
129129

130130
options = optstr;

arch/x86/boot/edd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static int get_edd_info(u8 devno, struct edd_info *ei)
7676
{
7777
struct biosregs ireg, oreg;
7878

79-
memset(ei, 0, sizeof *ei);
79+
memset(ei, 0, sizeof(*ei));
8080

8181
/* Check Extensions Present */
8282

@@ -133,7 +133,7 @@ void query_edd(void)
133133
struct edd_info ei, *edp;
134134
u32 *mbrptr;
135135

136-
if (cmdline_find_option("edd", eddarg, sizeof eddarg) > 0) {
136+
if (cmdline_find_option("edd", eddarg, sizeof(eddarg)) > 0) {
137137
if (!strcmp(eddarg, "skipmbr") || !strcmp(eddarg, "skip")) {
138138
do_edd = 1;
139139
do_mbr = 0;
@@ -166,7 +166,7 @@ void query_edd(void)
166166
*/
167167
if (!get_edd_info(devno, &ei)
168168
&& boot_params.eddbuf_entries < EDDMAXNR) {
169-
memcpy(edp, &ei, sizeof ei);
169+
memcpy(edp, &ei, sizeof(ei));
170170
edp++;
171171
boot_params.eddbuf_entries++;
172172
}

arch/x86/boot/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ static void copy_boot_params(void)
3636
const struct old_cmdline * const oldcmd =
3737
(const struct old_cmdline *)OLD_CL_ADDRESS;
3838

39-
BUILD_BUG_ON(sizeof boot_params != 4096);
40-
memcpy(&boot_params.hdr, &hdr, sizeof hdr);
39+
BUILD_BUG_ON(sizeof(boot_params) != 4096);
40+
memcpy(&boot_params.hdr, &hdr, sizeof(hdr));
4141

4242
if (!boot_params.hdr.cmd_line_ptr &&
4343
oldcmd->cl_magic == OLD_CL_MAGIC) {

arch/x86/boot/memory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static int detect_memory_e820(void)
2626

2727
initregs(&ireg);
2828
ireg.ax = 0xe820;
29-
ireg.cx = sizeof buf;
29+
ireg.cx = sizeof(buf);
3030
ireg.edx = SMAP;
3131
ireg.di = (size_t)&buf;
3232

arch/x86/boot/regs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
void initregs(struct biosregs *reg)
2323
{
24-
memset(reg, 0, sizeof *reg);
24+
memset(reg, 0, sizeof(*reg));
2525
reg->eflags |= X86_EFLAGS_CF;
2626
reg->ds = ds();
2727
reg->es = ds();

arch/x86/boot/video-vesa.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static int vesa_probe(void)
6262
if (mode & ~0x1ff)
6363
continue;
6464

65-
memset(&vminfo, 0, sizeof vminfo); /* Just in case... */
65+
memset(&vminfo, 0, sizeof(vminfo)); /* Just in case... */
6666

6767
ireg.ax = 0x4f01;
6868
ireg.cx = mode;
@@ -109,7 +109,7 @@ static int vesa_set_mode(struct mode_info *mode)
109109
int is_graphic;
110110
u16 vesa_mode = mode->mode - VIDEO_FIRST_VESA;
111111

112-
memset(&vminfo, 0, sizeof vminfo); /* Just in case... */
112+
memset(&vminfo, 0, sizeof(vminfo)); /* Just in case... */
113113

114114
initregs(&ireg);
115115
ireg.ax = 0x4f01;
@@ -241,7 +241,7 @@ void vesa_store_edid(void)
241241
struct biosregs ireg, oreg;
242242

243243
/* Apparently used as a nonsense token... */
244-
memset(&boot_params.edid_info, 0x13, sizeof boot_params.edid_info);
244+
memset(&boot_params.edid_info, 0x13, sizeof(boot_params.edid_info));
245245

246246
if (vginfo.version < 0x0200)
247247
return; /* EDID requires VBE 2.0+ */

arch/x86/boot/video.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static unsigned int get_entry(void)
115115
} else if ((key >= '0' && key <= '9') ||
116116
(key >= 'A' && key <= 'Z') ||
117117
(key >= 'a' && key <= 'z')) {
118-
if (len < sizeof entry_buf) {
118+
if (len < sizeof(entry_buf)) {
119119
entry_buf[len++] = key;
120120
putchar(key);
121121
}

arch/x86/events/intel/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4535,7 +4535,7 @@ __init int intel_pmu_init(void)
45354535
}
45364536
}
45374537

4538-
snprintf(pmu_name_str, sizeof pmu_name_str, "%s", name);
4538+
snprintf(pmu_name_str, sizeof(pmu_name_str), "%s", name);
45394539

45404540
if (version >= 2 && extra_attr) {
45414541
x86_pmu.format_attrs = merge_attr(intel_arch3_formats_attr,

arch/x86/include/asm/compat.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,18 @@ static inline bool in_x32_syscall(void)
217217
return false;
218218
}
219219

220-
static inline bool in_compat_syscall(void)
220+
static inline bool in_32bit_syscall(void)
221221
{
222222
return in_ia32_syscall() || in_x32_syscall();
223223
}
224+
225+
#ifdef CONFIG_COMPAT
226+
static inline bool in_compat_syscall(void)
227+
{
228+
return in_32bit_syscall();
229+
}
224230
#define in_compat_syscall in_compat_syscall /* override the generic impl */
231+
#endif
225232

226233
struct compat_siginfo;
227234
int __copy_siginfo_to_user32(struct compat_siginfo __user *to,

arch/x86/include/asm/cpufeatures.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@
331331
#define X86_FEATURE_LA57 (16*32+16) /* 5-level page tables */
332332
#define X86_FEATURE_RDPID (16*32+22) /* RDPID instruction */
333333
#define X86_FEATURE_CLDEMOTE (16*32+25) /* CLDEMOTE instruction */
334+
#define X86_FEATURE_MOVDIRI (16*32+27) /* MOVDIRI instruction */
335+
#define X86_FEATURE_MOVDIR64B (16*32+28) /* MOVDIR64B instruction */
334336

335337
/* AMD-defined CPU features, CPUID level 0x80000007 (EBX), word 17 */
336338
#define X86_FEATURE_OVERFLOW_RECOV (17*32+ 0) /* MCA overflow recovery support */

arch/x86/include/asm/ftrace.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ static inline bool arch_syscall_match_sym_name(const char *sym, const char *name
7676
#define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS 1
7777
static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs)
7878
{
79-
if (in_compat_syscall())
80-
return true;
81-
return false;
79+
return in_32bit_syscall();
8280
}
8381
#endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_IA32_EMULATION */
8482
#endif /* !COMPILE_OFFSETS */

arch/x86/include/asm/paravirt_types.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,6 @@ extern struct paravirt_patch_template pv_ops;
361361
__visible extern const char start_##ops##_##name[], end_##ops##_##name[]; \
362362
asm(NATIVE_LABEL("start_", ops, name) code NATIVE_LABEL("end_", ops, name))
363363

364-
unsigned paravirt_patch_ident_32(void *insnbuf, unsigned len);
365364
unsigned paravirt_patch_ident_64(void *insnbuf, unsigned len);
366365
unsigned paravirt_patch_default(u8 type, void *insnbuf,
367366
unsigned long addr, unsigned len);
@@ -651,7 +650,6 @@ void paravirt_leave_lazy_mmu(void);
651650
void paravirt_flush_lazy_mmu(void);
652651

653652
void _paravirt_nop(void);
654-
u32 _paravirt_ident_32(u32);
655653
u64 _paravirt_ident_64(u64);
656654

657655
#define paravirt_nop ((void *)_paravirt_nop)

arch/x86/include/asm/tlbflush.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,12 @@ static inline void __native_flush_tlb_one_user(unsigned long addr)
453453
*/
454454
static inline void __flush_tlb_all(void)
455455
{
456+
/*
457+
* This is to catch users with enabled preemption and the PGE feature
458+
* and don't trigger the warning in __native_flush_tlb().
459+
*/
460+
VM_WARN_ON_ONCE(preemptible());
461+
456462
if (boot_cpu_has(X86_FEATURE_PGE)) {
457463
__flush_tlb_global();
458464
} else {

arch/x86/kernel/cpu/common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
10741074
#endif
10751075
c->x86_cache_alignment = c->x86_clflush_size;
10761076

1077-
memset(&c->x86_capability, 0, sizeof c->x86_capability);
1077+
memset(&c->x86_capability, 0, sizeof(c->x86_capability));
10781078
c->extended_cpuid_level = 0;
10791079

10801080
if (!have_cpuid_p())
@@ -1317,7 +1317,7 @@ static void identify_cpu(struct cpuinfo_x86 *c)
13171317
c->x86_virt_bits = 32;
13181318
#endif
13191319
c->x86_cache_alignment = c->x86_clflush_size;
1320-
memset(&c->x86_capability, 0, sizeof c->x86_capability);
1320+
memset(&c->x86_capability, 0, sizeof(c->x86_capability));
13211321

13221322
generic_identify(c);
13231323

arch/x86/kernel/cpu/mcheck/mce.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2215,7 +2215,7 @@ static int mce_device_create(unsigned int cpu)
22152215
if (dev)
22162216
return 0;
22172217

2218-
dev = kzalloc(sizeof *dev, GFP_KERNEL);
2218+
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
22192219
if (!dev)
22202220
return -ENOMEM;
22212221
dev->id = cpu;

arch/x86/kernel/cpu/microcode/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,8 +666,8 @@ static ssize_t pf_show(struct device *dev,
666666
}
667667

668668
static DEVICE_ATTR_WO(reload);
669-
static DEVICE_ATTR(version, 0400, version_show, NULL);
670-
static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL);
669+
static DEVICE_ATTR(version, 0444, version_show, NULL);
670+
static DEVICE_ATTR(processor_flags, 0444, pf_show, NULL);
671671

672672
static struct attribute *mc_default_attrs[] = {
673673
&dev_attr_version.attr,

arch/x86/kernel/cpu/mtrr/generic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ static void generic_set_all(void)
798798
local_irq_restore(flags);
799799

800800
/* Use the atomic bitops to update the global mask */
801-
for (count = 0; count < sizeof mask * 8; ++count) {
801+
for (count = 0; count < sizeof(mask) * 8; ++count) {
802802
if (mask & 0x01)
803803
set_bit(count, &smp_changes_mask);
804804
mask >>= 1;

arch/x86/kernel/cpu/mtrr/if.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,12 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg)
174174
case MTRRIOC_SET_PAGE_ENTRY:
175175
case MTRRIOC_DEL_PAGE_ENTRY:
176176
case MTRRIOC_KILL_PAGE_ENTRY:
177-
if (copy_from_user(&sentry, arg, sizeof sentry))
177+
if (copy_from_user(&sentry, arg, sizeof(sentry)))
178178
return -EFAULT;
179179
break;
180180
case MTRRIOC_GET_ENTRY:
181181
case MTRRIOC_GET_PAGE_ENTRY:
182-
if (copy_from_user(&gentry, arg, sizeof gentry))
182+
if (copy_from_user(&gentry, arg, sizeof(gentry)))
183183
return -EFAULT;
184184
break;
185185
#ifdef CONFIG_COMPAT
@@ -332,7 +332,7 @@ mtrr_ioctl(struct file *file, unsigned int cmd, unsigned long __arg)
332332
switch (cmd) {
333333
case MTRRIOC_GET_ENTRY:
334334
case MTRRIOC_GET_PAGE_ENTRY:
335-
if (copy_to_user(arg, &gentry, sizeof gentry))
335+
if (copy_to_user(arg, &gentry, sizeof(gentry)))
336336
err = -EFAULT;
337337
break;
338338
#ifdef CONFIG_COMPAT

arch/x86/kernel/early_printk.c

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,9 @@ static unsigned int mem32_serial_in(unsigned long addr, int offset)
213213
* early_pci_serial_init()
214214
*
215215
* This function is invoked when the early_printk param starts with "pciserial"
216-
* The rest of the param should be ",B:D.F,baud" where B, D & F describe the
217-
* location of a PCI device that must be a UART device.
216+
* The rest of the param should be "[force],B:D.F,baud", where B, D & F describe
217+
* the location of a PCI device that must be a UART device. "force" is optional
218+
* and overrides the use of an UART device with a wrong PCI class code.
218219
*/
219220
static __init void early_pci_serial_init(char *s)
220221
{
@@ -224,17 +225,23 @@ static __init void early_pci_serial_init(char *s)
224225
u32 classcode, bar0;
225226
u16 cmdreg;
226227
char *e;
228+
int force = 0;
227229

228-
229-
/*
230-
* First, part the param to get the BDF values
231-
*/
232230
if (*s == ',')
233231
++s;
234232

235233
if (*s == 0)
236234
return;
237235

236+
/* Force the use of an UART device with wrong class code */
237+
if (!strncmp(s, "force,", 6)) {
238+
force = 1;
239+
s += 6;
240+
}
241+
242+
/*
243+
* Part the param to get the BDF values
244+
*/
238245
bus = (u8)simple_strtoul(s, &e, 16);
239246
s = e;
240247
if (*s != ':')
@@ -253,7 +260,7 @@ static __init void early_pci_serial_init(char *s)
253260
s++;
254261

255262
/*
256-
* Second, find the device from the BDF
263+
* Find the device from the BDF
257264
*/
258265
cmdreg = read_pci_config(bus, slot, func, PCI_COMMAND);
259266
classcode = read_pci_config(bus, slot, func, PCI_CLASS_REVISION);
@@ -264,8 +271,10 @@ static __init void early_pci_serial_init(char *s)
264271
*/
265272
if (((classcode >> 16 != PCI_CLASS_COMMUNICATION_MODEM) &&
266273
(classcode >> 16 != PCI_CLASS_COMMUNICATION_SERIAL)) ||
267-
(((classcode >> 8) & 0xff) != 0x02)) /* 16550 I/F at BAR0 */
268-
return;
274+
(((classcode >> 8) & 0xff) != 0x02)) /* 16550 I/F at BAR0 */ {
275+
if (!force)
276+
return;
277+
}
269278

270279
/*
271280
* Determine if it is IO or memory mapped
@@ -289,7 +298,7 @@ static __init void early_pci_serial_init(char *s)
289298
}
290299

291300
/*
292-
* Lastly, initialize the hardware
301+
* Initialize the hardware
293302
*/
294303
if (*s) {
295304
if (strcmp(s, "nocfg") == 0)

arch/x86/kernel/head64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ static void __init copy_bootdata(char *real_mode_data)
385385
*/
386386
sme_map_bootdata(real_mode_data);
387387

388-
memcpy(&boot_params, real_mode_data, sizeof boot_params);
388+
memcpy(&boot_params, real_mode_data, sizeof(boot_params));
389389
sanitize_boot_params(&boot_params);
390390
cmd_line_ptr = get_cmd_line_ptr();
391391
if (cmd_line_ptr) {

0 commit comments

Comments
 (0)