Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0df3930
x86/selftests: Skip the tests if prerequisites aren't fulfilled
Mar 27, 2024
a1616bb
selftests/x86: remove (or use) unused variables and functions
johnhubbard Jul 4, 2024
f2cff02
selftests/x86: fix Makefile dependencies to work with clang
johnhubbard Jul 4, 2024
a8c7e1a
x86/pkeys: Add helper functions to update PKRU on the sigframe
arunar Aug 2, 2024
e03735b
x86/pkeys: Update PKRU to enable all pkeys before XSAVE
arunar Aug 2, 2024
ca8a73d
x86/pkeys: Change caller of update_pkru_in_sigframe()
arunar Nov 19, 2024
be17cbf
x86/pkeys: Ensure updated PKRU value is XRSTOR'd
arunar Nov 19, 2024
2ecc558
selftests/x86: Consolidate redundant signal helper functions
ChangSeokBae Feb 26, 2025
edf778c
selftests/x86/xstate: Refactor XSAVE helpers for general use
ChangSeokBae Feb 26, 2025
74673e3
selftests/x86/xstate: Enumerate and name xstate components
ChangSeokBae Feb 26, 2025
b8248a8
selftests/x86/xstate: Refactor context switching test
ChangSeokBae Feb 26, 2025
6df0ea8
selftests/x86/xstate: Refactor ptrace ABI test
ChangSeokBae Feb 26, 2025
89b6199
selftests/x86/xstate: Introduce signal ABI test
ChangSeokBae Feb 26, 2025
70b802e
selftests/x86/xstate: Consolidate test invocations into a single entry
ChangSeokBae Feb 26, 2025
91582de
selftests/x86/xstate: Clarify supported xstates
ChangSeokBae Feb 26, 2025
df3c48a
selftests/x86/avx: Add AVX tests
ChangSeokBae Feb 26, 2025
da1a80e
x86/fpu/xstate: Simplify print_xstate_features()
ChangSeokBae Feb 27, 2025
c00a169
x86/fpu/xstate: Remove xstate offset check
ChangSeokBae Mar 20, 2025
35e67c1
x86/fpu/xstate: Introduce xfeature order table and accessor macro
ChangSeokBae Mar 20, 2025
499b8d9
x86/fpu/xstate: Adjust XSAVE buffer size calculation
ChangSeokBae Mar 20, 2025
2de5bbf
x86/fpu/xstate: Adjust xstate copying logic for user ABI
ChangSeokBae Mar 20, 2025
c1c24de
x86/cpufeatures: Add X86_FEATURE_APX
ChangSeokBae Apr 16, 2025
c25e118
x86/fpu/apx: Define APX state component
ChangSeokBae Apr 16, 2025
ded1ed1
x86/fpu/apx: Disallow conflicting MPX presence
ChangSeokBae Apr 16, 2025
c0854a0
x86/fpu/apx: Enable APX state support
ChangSeokBae Apr 16, 2025
1aee35a
selftests/x86/apx: Add APX test
ChangSeokBae Apr 16, 2025
315ae7f
x86/fpu: Log XSAVE disablement consistently
ChangSeokBae Apr 16, 2025
b8211f6
x86/fpu: Refactor xfeature bitmask update code for sigframe XSAVE
ChangSeokBae Apr 16, 2025
996cd61
x86/pkeys: Simplify PKRU update in signal frame
ChangSeokBae Apr 16, 2025
f256387
x86/fpu: Remove export of mxcsr_feature_mask
ChangSeokBae Apr 16, 2025
cf58f6c
x86/fpu: Rename fpu_reset_fpregs() to fpu_reset_fpstate_regs()
ChangSeokBae Apr 16, 2025
3f08e1e
tools headers x86 cpufeatures: Sync with the kernel sources
acmel Jun 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions arch/x86/include/asm/cpufeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,8 @@
#define X86_FEATURE_CLEAR_BHB_HW (21*32+ 3) /* BHI_DIS_S HW control enabled */
#define X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT (21*32+ 4) /* Clear branch history at vmexit using SW loop */
#define X86_FEATURE_AMD_WORKLOAD_CLASS (21*32 + 7) /* Workload Classification */
#define X86_FEATURE_INDIRECT_THUNK_ITS (21*32 + 9) /* "" Use thunk for indirect branches in lower half of cacheline */

#define X86_FEATURE_APX (21*32 + 9) /* Advanced Performance Extensions */
#define X86_FEATURE_INDIRECT_THUNK_ITS (21*32 + 10) /* "" Use thunk for indirect branches in lower half of cacheline */
#define X86_FEATURE_TSA_SQ_NO (21*32+11) /* "" AMD CPU not vulnerable to TSA-SQ */
#define X86_FEATURE_TSA_L1_NO (21*32+12) /* "" AMD CPU not vulnerable to TSA-L1 */
#define X86_FEATURE_CLEAR_CPU_BUF_VM (21*32+13) /* "" Clear CPU buffers using VERW before VMRUN */
Expand Down
9 changes: 9 additions & 0 deletions arch/x86/include/asm/fpu/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ enum xfeature {
XFEATURE_RSRVD_COMP_16,
XFEATURE_XTILE_CFG,
XFEATURE_XTILE_DATA,
XFEATURE_APX,

XFEATURE_MAX,
};
Expand All @@ -143,6 +144,7 @@ enum xfeature {
#define XFEATURE_MASK_LBR (1 << XFEATURE_LBR)
#define XFEATURE_MASK_XTILE_CFG (1 << XFEATURE_XTILE_CFG)
#define XFEATURE_MASK_XTILE_DATA (1 << XFEATURE_XTILE_DATA)
#define XFEATURE_MASK_APX (1 << XFEATURE_APX)

#define XFEATURE_MASK_FPSSE (XFEATURE_MASK_FP | XFEATURE_MASK_SSE)
#define XFEATURE_MASK_AVX512 (XFEATURE_MASK_OPMASK \
Expand Down Expand Up @@ -301,6 +303,13 @@ struct xtile_data {
struct reg_1024_byte tmm;
} __packed;

/*
* State component 19: 8B extended general purpose register.
*/
struct apx_state {
u64 egpr[16];
} __packed;

/*
* State component 10 is supervisor state used for context-switching the
* PASID state.
Expand Down
3 changes: 2 additions & 1 deletion arch/x86/include/asm/fpu/xstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
XFEATURE_MASK_PKRU | \
XFEATURE_MASK_BNDREGS | \
XFEATURE_MASK_BNDCSR | \
XFEATURE_MASK_XTILE)
XFEATURE_MASK_XTILE | \
XFEATURE_MASK_APX)

/*
* Features which are restored when returning to user space.
Expand Down
1 change: 1 addition & 0 deletions arch/x86/kernel/cpu/cpuid-deps.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ static const struct cpuid_dep cpuid_deps[] = {
{ X86_FEATURE_PKU, X86_FEATURE_XSAVE },
{ X86_FEATURE_MPX, X86_FEATURE_XSAVE },
{ X86_FEATURE_XGETBV1, X86_FEATURE_XSAVE },
{ X86_FEATURE_APX, X86_FEATURE_XSAVE },
{ X86_FEATURE_CMOV, X86_FEATURE_FXSR },
{ X86_FEATURE_MMX, X86_FEATURE_FXSR },
{ X86_FEATURE_MMXEXT, X86_FEATURE_MMX },
Expand Down
1 change: 1 addition & 0 deletions arch/x86/kernel/cpu/scattered.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ static const struct cpuid_bit cpuid_bits[] = {
{ X86_FEATURE_APERFMPERF, CPUID_ECX, 0, 0x00000006, 0 },
{ X86_FEATURE_EPB, CPUID_ECX, 3, 0x00000006, 0 },
{ X86_FEATURE_INTEL_PPIN, CPUID_EBX, 0, 0x00000007, 1 },
{ X86_FEATURE_APX, CPUID_EDX, 21, 0x00000007, 1 },
{ X86_FEATURE_RRSBA_CTRL, CPUID_EDX, 2, 0x00000007, 2 },
{ X86_FEATURE_BHI_CTRL, CPUID_EDX, 4, 0x00000007, 2 },
{ X86_FEATURE_CQM_LLC, CPUID_EDX, 1, 0x0000000f, 0 },
Expand Down
6 changes: 3 additions & 3 deletions arch/x86/kernel/fpu/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ static inline void restore_fpregs_from_init_fpstate(u64 features_mask)
/*
* Reset current->fpu memory state to the init values.
*/
static void fpu_reset_fpregs(void)
static void fpu_reset_fpstate_regs(void)
{
struct fpu *fpu = &current->thread.fpu;

Expand Down Expand Up @@ -770,7 +770,7 @@ void fpu__clear_user_states(struct fpu *fpu)

fpregs_lock();
if (!cpu_feature_enabled(X86_FEATURE_FPU)) {
fpu_reset_fpregs();
fpu_reset_fpstate_regs();
fpregs_unlock();
return;
}
Expand Down Expand Up @@ -803,7 +803,7 @@ void fpu__clear_user_states(struct fpu *fpu)
void fpu_flush_thread(void)
{
fpstate_reset(&current->thread.fpu);
fpu_reset_fpregs();
fpu_reset_fpstate_regs();
}
/*
* Load FPU context before returning to userspace.
Expand Down
1 change: 0 additions & 1 deletion arch/x86/kernel/fpu/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ static void __init fpu__init_system_early_generic(void)
* Boot time FPU feature detection code:
*/
unsigned int mxcsr_feature_mask __ro_after_init = 0xffffffffu;
EXPORT_SYMBOL_GPL(mxcsr_feature_mask);

static void __init fpu__init_system_mxcsr(void)
{
Expand Down
14 changes: 3 additions & 11 deletions arch/x86/kernel/fpu/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ static inline bool save_xstate_epilog(void __user *buf, int ia32_frame,
{
struct xregs_state __user *x = buf;
struct _fpx_sw_bytes sw_bytes = {};
u32 xfeatures;
int err;

/* Setup the bytes not touched by the [f]xsave and reserved for SW. */
Expand All @@ -132,12 +131,6 @@ static inline bool save_xstate_epilog(void __user *buf, int ia32_frame,
err |= __put_user(FP_XSTATE_MAGIC2,
(__u32 __user *)(buf + fpstate->user_size));

/*
* Read the xfeatures which we copied (directly from the cpu or
* from the state in task struct) to the user buffers.
*/
err |= __get_user(xfeatures, (__u32 __user *)&x->header.xfeatures);

/*
* For legacy compatible, we always set FP/SSE bits in the bit
* vector while saving the state to the user context. This will
Expand All @@ -149,17 +142,16 @@ static inline bool save_xstate_epilog(void __user *buf, int ia32_frame,
* header as well as change any contents in the memory layout.
* xrestore as part of sigreturn will capture all the changes.
*/
xfeatures |= XFEATURE_MASK_FPSSE;

err |= __put_user(xfeatures, (__u32 __user *)&x->header.xfeatures);
err |= set_xfeature_in_sigframe(x, XFEATURE_MASK_FPSSE);

return !err;
}

static inline int copy_fpregs_to_sigframe(struct xregs_state __user *buf, u32 pkru)
{
if (use_xsave())
return xsave_to_user_sigframe(buf);
return xsave_to_user_sigframe(buf, pkru);

if (use_fxsr())
return fxsave_to_user_sigframe((struct fxregs_state __user *) buf);
else
Expand Down
Loading