Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
7350df6
x86/selftests: Skip the tests if prerequisites aren't fulfilled
Mar 27, 2024
49a945d
selftests/x86: remove (or use) unused variables and functions
johnhubbard Jul 4, 2024
7a11f03
selftests/x86: fix Makefile dependencies to work with clang
johnhubbard Jul 4, 2024
0f89993
x86/pkeys: Add helper functions to update PKRU on the sigframe
arunar Aug 2, 2024
8071503
x86/pkeys: Update PKRU to enable all pkeys before XSAVE
arunar Aug 2, 2024
2b80d42
x86/pkeys: Change caller of update_pkru_in_sigframe()
arunar Nov 19, 2024
452381c
x86/pkeys: Ensure updated PKRU value is XRSTOR'd
arunar Nov 19, 2024
896171c
selftests/x86: Consolidate redundant signal helper functions
ChangSeokBae Feb 26, 2025
ecaef5a
selftests/x86/xstate: Refactor XSAVE helpers for general use
ChangSeokBae Feb 26, 2025
f076b86
selftests/x86/xstate: Enumerate and name xstate components
ChangSeokBae Feb 26, 2025
4e87c9a
selftests/x86/xstate: Refactor context switching test
ChangSeokBae Feb 26, 2025
268b085
selftests/x86/xstate: Refactor ptrace ABI test
ChangSeokBae Feb 26, 2025
c14667a
selftests/x86/xstate: Introduce signal ABI test
ChangSeokBae Feb 26, 2025
e4a665e
selftests/x86/xstate: Consolidate test invocations into a single entry
ChangSeokBae Feb 26, 2025
b7d0789
selftests/x86/xstate: Clarify supported xstates
ChangSeokBae Feb 26, 2025
907c7ed
selftests/x86/avx: Add AVX tests
ChangSeokBae Feb 26, 2025
8c709ba
x86/fpu/xstate: Simplify print_xstate_features()
ChangSeokBae Feb 27, 2025
dda9dd4
x86/fpu/xstate: Remove xstate offset check
ChangSeokBae Mar 20, 2025
19e104d
x86/fpu/xstate: Introduce xfeature order table and accessor macro
ChangSeokBae Mar 20, 2025
c0677a8
x86/fpu/xstate: Adjust XSAVE buffer size calculation
ChangSeokBae Mar 20, 2025
c3b0f63
x86/fpu/xstate: Adjust xstate copying logic for user ABI
ChangSeokBae Mar 20, 2025
9a6abea
x86/cpufeatures: Add X86_FEATURE_APX
ChangSeokBae Apr 16, 2025
f6812b5
x86/fpu/apx: Define APX state component
ChangSeokBae Apr 16, 2025
384f0a8
x86/fpu/apx: Disallow conflicting MPX presence
ChangSeokBae Apr 16, 2025
c15ae1c
x86/fpu/apx: Enable APX state support
ChangSeokBae Apr 16, 2025
39531ed
selftests/x86/apx: Add APX test
ChangSeokBae Apr 16, 2025
c1c1458
x86/fpu: Log XSAVE disablement consistently
ChangSeokBae Apr 16, 2025
69627b0
x86/fpu: Refactor xfeature bitmask update code for sigframe XSAVE
ChangSeokBae Apr 16, 2025
e666d41
x86/pkeys: Simplify PKRU update in signal frame
ChangSeokBae Apr 16, 2025
be25f43
x86/fpu: Remove export of mxcsr_feature_mask
ChangSeokBae Apr 16, 2025
dc6a884
x86/fpu: Rename fpu_reset_fpregs() to fpu_reset_fpstate_regs()
ChangSeokBae Apr 16, 2025
9c7eb63
tools headers x86 cpufeatures: Sync with the kernel sources
acmel Jun 16, 2025
24a857f
KVM: x86: Advertise AVX10.1 CPUID to userspace
taosu-linux Aug 19, 2024
ef071f1
KVM: x86: Replace guts of "governed" features with comprehensive cpu_…
sean-jc Nov 28, 2024
6ad702a
KVM: x86: Advertise MOVRS CPUID to userspace
trueptolemy Nov 20, 2025
46b36de
KVM: x86: Advertise AMX CPUIDs in subleaf 0x1E.0x1 to userspace
trueptolemy Nov 20, 2025
1bc323b
KVM: x86: Advertise AVX10.2 CPUID to userspace
trueptolemy Nov 20, 2025
69bdd58
KVM: x86: Advertise AVX10_VNNI_INT CPUID to userspace
trueptolemy Nov 20, 2025
01d7817
tools headers x86 cpufeatures: Sync with the kernel sources
acmel Mar 4, 2026
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
2 changes: 2 additions & 0 deletions arch/x86/include/asm/cpufeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@
#define X86_FEATURE_AMX_FP16 (12*32+21) /* AMX fp16 Support */
#define X86_FEATURE_AVX_IFMA (12*32+23) /* Support for VPMADD52[H,L]UQ */
#define X86_FEATURE_LAM (12*32+26) /* "lam" Linear Address Masking */
#define X86_FEATURE_MOVRS (12*32+31) /* MOVRS instructions */

/* AMD-defined CPU features, CPUID level 0x80000008 (EBX), word 13 */
#define X86_FEATURE_AMD_IBPB_RET (13*32+30) /* "" IBPB clears return address predictor */
Expand Down Expand Up @@ -476,6 +477,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 */

#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 */
Expand Down
1 change: 1 addition & 0 deletions arch/x86/include/asm/cpuid.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ static __always_inline bool cpuid_function_is_indexed(u32 function)
case 0x1d:
case 0x1e:
case 0x1f:
case 0x24:
case 0x8000001d:
return true;
}
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
20 changes: 20 additions & 0 deletions arch/x86/include/asm/kvm_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,26 @@ struct kvm_queued_exception {
bool has_payload;
};

/*
* Hardware-defined CPUID leafs that are either scattered by the kernel or are
* unknown to the kernel, but need to be directly used by KVM. Note, these
* word values conflict with the kernel's "bug" caps, but KVM doesn't use those.
*/
enum kvm_only_cpuid_leafs {
CPUID_12_EAX = NCAPINTS,
CPUID_7_1_EDX,
CPUID_8000_0007_EDX,
CPUID_8000_0022_EAX,
CPUID_7_2_EDX,
CPUID_8000_0021_ECX,
CPUID_24_0_EBX,
CPUID_1E_1_EAX,
CPUID_24_1_ECX,
NR_KVM_CPU_CAPS,

NKVMCAPINTS = NR_KVM_CPU_CAPS - NCAPINTS,
};

struct kvm_vcpu_arch {
/*
* rip and regs accesses must go through
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