Commit fe8ec69b authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge branch 'x86/urgent' into x86/boot, to pick up dependent fixes



Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents faf0ed48 07fa619f
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -36,10 +36,12 @@
#define _PAGE_BIT_DEVMAP	_PAGE_BIT_SOFTW4

#ifdef CONFIG_X86_64
#define _PAGE_BIT_SAVED_DIRTY	_PAGE_BIT_SOFTW5 /* Saved Dirty bit */
#define _PAGE_BIT_SAVED_DIRTY	_PAGE_BIT_SOFTW5 /* Saved Dirty bit (leaf) */
#define _PAGE_BIT_NOPTISHADOW	_PAGE_BIT_SOFTW5 /* No PTI shadow (root PGD) */
#else
/* Shared with _PAGE_BIT_UFFD_WP which is not supported on 32 bit */
#define _PAGE_BIT_SAVED_DIRTY	_PAGE_BIT_SOFTW2 /* Saved Dirty bit */
#define _PAGE_BIT_SAVED_DIRTY	_PAGE_BIT_SOFTW2 /* Saved Dirty bit (leaf) */
#define _PAGE_BIT_NOPTISHADOW	_PAGE_BIT_SOFTW2 /* No PTI shadow (root PGD) */
#endif

/* If _PAGE_BIT_PRESENT is clear, we use these: */
@@ -139,6 +141,8 @@

#define _PAGE_PROTNONE	(_AT(pteval_t, 1) << _PAGE_BIT_PROTNONE)

#define _PAGE_NOPTISHADOW (_AT(pteval_t, 1) << _PAGE_BIT_NOPTISHADOW)

/*
 * Set of bits not changed in pte_modify.  The pte's
 * protection key is treated like _PAGE_RW, for
+3 −1
Original line number Diff line number Diff line
@@ -555,7 +555,9 @@ static void init_intel(struct cpuinfo_x86 *c)
	     c->x86_vfm == INTEL_WESTMERE_EX))
		set_cpu_bug(c, X86_BUG_CLFLUSH_MONITOR);

	if (boot_cpu_has(X86_FEATURE_MWAIT) && c->x86_vfm == INTEL_ATOM_GOLDMONT)
	if (boot_cpu_has(X86_FEATURE_MWAIT) &&
	    (c->x86_vfm == INTEL_ATOM_GOLDMONT ||
	     c->x86_vfm == INTEL_LUNARLAKE_M))
		set_cpu_bug(c, X86_BUG_MONITOR);

#ifdef CONFIG_X86_64
+3 −3
Original line number Diff line number Diff line
@@ -428,8 +428,8 @@ void __init topology_apply_cmdline_limits_early(void)
{
	unsigned int possible = nr_cpu_ids;

	/* 'maxcpus=0' 'nosmp' 'nolapic' 'disableapic' 'noapic' */
	if (!setup_max_cpus || ioapic_is_disabled || apic_is_disabled)
	/* 'maxcpus=0' 'nosmp' 'nolapic' 'disableapic' */
	if (!setup_max_cpus || apic_is_disabled)
		possible = 1;

	/* 'possible_cpus=N' */
@@ -443,7 +443,7 @@ void __init topology_apply_cmdline_limits_early(void)

static __init bool restrict_to_up(void)
{
	if (!smp_found_config || ioapic_is_disabled)
	if (!smp_found_config)
		return true;
	/*
	 * XEN PV is special as it does not advertise the local APIC
+2 −18
Original line number Diff line number Diff line
@@ -63,16 +63,6 @@ static inline bool check_xstate_in_sigframe(struct fxregs_state __user *fxbuf,
	return true;
}

/*
 * Update the value of PKRU register that was already pushed onto the signal frame.
 */
static inline int update_pkru_in_sigframe(struct xregs_state __user *buf, u32 pkru)
{
	if (unlikely(!cpu_feature_enabled(X86_FEATURE_OSPKE)))
		return 0;
	return __put_user(pkru, (unsigned int __user *)get_xsave_addr_user(buf, XFEATURE_PKRU));
}

/*
 * Signal frame handlers.
 */
@@ -168,14 +158,8 @@ static inline bool save_xstate_epilog(void __user *buf, int ia32_frame,

static inline int copy_fpregs_to_sigframe(struct xregs_state __user *buf, u32 pkru)
{
	int err = 0;

	if (use_xsave()) {
		err = xsave_to_user_sigframe(buf);
		if (!err)
			err = update_pkru_in_sigframe(buf, pkru);
		return err;
	}
	if (use_xsave())
		return xsave_to_user_sigframe(buf, pkru);

	if (use_fxsr())
		return fxsave_to_user_sigframe((struct fxregs_state __user *) buf);
+26 −1
Original line number Diff line number Diff line
@@ -69,6 +69,28 @@ static inline u64 xfeatures_mask_independent(void)
	return fpu_kernel_cfg.independent_features;
}

/*
 * Update the value of PKRU register that was already pushed onto the signal frame.
 */
static inline int update_pkru_in_sigframe(struct xregs_state __user *buf, u64 mask, u32 pkru)
{
	u64 xstate_bv;
	int err;

	if (unlikely(!cpu_feature_enabled(X86_FEATURE_OSPKE)))
		return 0;

	/* Mark PKRU as in-use so that it is restored correctly. */
	xstate_bv = (mask & xfeatures_in_use()) | XFEATURE_MASK_PKRU;

	err =  __put_user(xstate_bv, &buf->header.xfeatures);
	if (err)
		return err;

	/* Update PKRU value in the userspace xsave buffer. */
	return __put_user(pkru, (unsigned int __user *)get_xsave_addr_user(buf, XFEATURE_PKRU));
}

/* XSAVE/XRSTOR wrapper functions */

#ifdef CONFIG_X86_64
@@ -256,7 +278,7 @@ static inline u64 xfeatures_need_sigframe_write(void)
 * The caller has to zero buf::header before calling this because XSAVE*
 * does not touch the reserved fields in the header.
 */
static inline int xsave_to_user_sigframe(struct xregs_state __user *buf)
static inline int xsave_to_user_sigframe(struct xregs_state __user *buf, u32 pkru)
{
	/*
	 * Include the features which are not xsaved/rstored by the kernel
@@ -281,6 +303,9 @@ static inline int xsave_to_user_sigframe(struct xregs_state __user *buf)
	XSTATE_OP(XSAVE, buf, lmask, hmask, err);
	clac();

	if (!err)
		err = update_pkru_in_sigframe(buf, mask, pkru);

	return err;
}

Loading