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
b71c8af
x86/selftests: Skip the tests if prerequisites aren't fulfilled
Mar 27, 2024
1bbca19
selftests/x86: remove (or use) unused variables and functions
johnhubbard Jul 4, 2024
1dc5b05
selftests/x86: fix Makefile dependencies to work with clang
johnhubbard Jul 4, 2024
584a63e
x86/pkeys: Add helper functions to update PKRU on the sigframe
arunar Aug 2, 2024
5f61819
x86/pkeys: Update PKRU to enable all pkeys before XSAVE
arunar Aug 2, 2024
34f66b3
x86/pkeys: Change caller of update_pkru_in_sigframe()
arunar Nov 19, 2024
3890a99
x86/pkeys: Ensure updated PKRU value is XRSTOR'd
arunar Nov 19, 2024
7569fa6
selftests/x86: Consolidate redundant signal helper functions
ChangSeokBae Feb 26, 2025
9f5aa34
selftests/x86/xstate: Refactor XSAVE helpers for general use
ChangSeokBae Feb 26, 2025
b6f114d
selftests/x86/xstate: Enumerate and name xstate components
ChangSeokBae Feb 26, 2025
7c7a212
selftests/x86/xstate: Refactor context switching test
ChangSeokBae Feb 26, 2025
e85fc79
selftests/x86/xstate: Refactor ptrace ABI test
ChangSeokBae Feb 26, 2025
7b6bc80
selftests/x86/xstate: Introduce signal ABI test
ChangSeokBae Feb 26, 2025
9eceaa5
selftests/x86/xstate: Consolidate test invocations into a single entry
ChangSeokBae Feb 26, 2025
d445511
selftests/x86/xstate: Clarify supported xstates
ChangSeokBae Feb 26, 2025
c512e33
selftests/x86/avx: Add AVX tests
ChangSeokBae Feb 26, 2025
dbb53e1
x86/fpu/xstate: Simplify print_xstate_features()
ChangSeokBae Feb 27, 2025
6be94c8
x86/fpu/xstate: Remove xstate offset check
ChangSeokBae Mar 20, 2025
a0b2ee4
x86/fpu/xstate: Introduce xfeature order table and accessor macro
ChangSeokBae Mar 20, 2025
a109d8e
x86/fpu/xstate: Adjust XSAVE buffer size calculation
ChangSeokBae Mar 20, 2025
4ef3bc7
x86/fpu/xstate: Adjust xstate copying logic for user ABI
ChangSeokBae Mar 20, 2025
4f478ef
x86/cpufeatures: Add X86_FEATURE_APX
ChangSeokBae Apr 16, 2025
33e18d7
x86/fpu/apx: Define APX state component
ChangSeokBae Apr 16, 2025
dba44c4
x86/fpu/apx: Disallow conflicting MPX presence
ChangSeokBae Apr 16, 2025
2bdb161
x86/fpu/apx: Enable APX state support
ChangSeokBae Apr 16, 2025
e6690a2
selftests/x86/apx: Add APX test
ChangSeokBae Apr 16, 2025
eb21872
x86/fpu: Log XSAVE disablement consistently
ChangSeokBae Apr 16, 2025
27e9c3d
x86/fpu: Refactor xfeature bitmask update code for sigframe XSAVE
ChangSeokBae Apr 16, 2025
8a37a89
x86/pkeys: Simplify PKRU update in signal frame
ChangSeokBae Apr 16, 2025
eaf09af
x86/fpu: Remove export of mxcsr_feature_mask
ChangSeokBae Apr 16, 2025
8569037
x86/fpu: Rename fpu_reset_fpregs() to fpu_reset_fpstate_regs()
ChangSeokBae Apr 16, 2025
556c5dc
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
1 change: 1 addition & 0 deletions arch/x86/include/asm/cpufeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@
#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_INDIRECT_THUNK_ITS (21*32 + 5) /* "" Use thunk for indirect branches in lower half of cacheline */
#define X86_FEATURE_APX (21*32 + 9) /* Advanced Performance Extensions */

/*
* BUG word(s)
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 @@ -709,7 +709,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 @@ -744,7 +744,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 @@ -774,7 +774,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