Commit 317d4f45 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'x86_misc_for_v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 misc updates from Borislav Petkov:

 - Complete the MSR write filtering by applying it to the MSR ioctl
   interface too.

 - Other misc small fixups.

* tag 'x86_misc_for_v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/MSR: Filter MSR writes through X86_IOC_WRMSR_REGS ioctl too
  selftests/fpu: Fix debugfs_simple_attr.cocci warning
  selftests/x86: Use __builtin_ia32_read/writeeflags
  x86/reboot: Add Zotac ZBOX CI327 nano PCI reboot quirk
parents ae821d21 02a16aa1
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -182,6 +182,13 @@ static long msr_ioctl(struct file *file, unsigned int ioc, unsigned long arg)
		err = security_locked_down(LOCKDOWN_MSR);
		if (err)
			break;

		err = filter_write(regs[1]);
		if (err)
			return err;

		add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK);

		err = wrmsr_safe_regs_on_cpu(cpu, regs);
		if (err)
			break;
+9 −0
Original line number Diff line number Diff line
@@ -477,6 +477,15 @@ static const struct dmi_system_id reboot_dmi_table[] __initconst = {
		},
	},

	{	/* PCIe Wifi card isn't detected after reboot otherwise */
		.callback = set_pci_reboot,
		.ident = "Zotac ZBOX CI327 nano",
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "NA"),
			DMI_MATCH(DMI_PRODUCT_NAME, "ZBOX-CI327NANO-GS-01"),
		},
	},

	/* Sony */
	{	/* Handle problems with rebooting on Sony VGN-Z540N */
		.callback = set_bios_reboot,
+3 −3
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ static int test_fpu_get(void *data, u64 *val)
	return status;
}

DEFINE_SIMPLE_ATTRIBUTE(test_fpu_fops, test_fpu_get, NULL, "%lld\n");
DEFINE_DEBUGFS_ATTRIBUTE(test_fpu_fops, test_fpu_get, NULL, "%lld\n");
static struct dentry *selftest_dir;

static int __init test_fpu_init(void)
@@ -72,7 +72,7 @@ static int __init test_fpu_init(void)
	if (!selftest_dir)
		return -ENOMEM;

	debugfs_create_file("test_fpu", 0444, selftest_dir, NULL,
	debugfs_create_file_unsafe("test_fpu", 0444, selftest_dir, NULL,
				   &test_fpu_fops);

	return 0;
+4 −20
Original line number Diff line number Diff line
@@ -6,36 +6,20 @@

static inline unsigned long get_eflags(void)
{
	unsigned long eflags;

	asm volatile (
#ifdef __x86_64__
		"subq $128, %%rsp\n\t"
		"pushfq\n\t"
		"popq %0\n\t"
		"addq $128, %%rsp"
	return __builtin_ia32_readeflags_u64();
#else
		"pushfl\n\t"
		"popl %0"
	return __builtin_ia32_readeflags_u32();
#endif
		: "=r" (eflags) :: "memory");

	return eflags;
}

static inline void set_eflags(unsigned long eflags)
{
	asm volatile (
#ifdef __x86_64__
		"subq $128, %%rsp\n\t"
		"pushq %0\n\t"
		"popfq\n\t"
		"addq $128, %%rsp"
	__builtin_ia32_writeeflags_u64(eflags);
#else
		"pushl %0\n\t"
		"popfl"
	__builtin_ia32_writeeflags_u32(eflags);
#endif
		:: "r" (eflags) : "flags", "memory");
}

#endif /* __SELFTESTS_X86_HELPERS_H */