The recent attempts to support the new AMX feature just tried to bolt it into the exisiting FPU code: https://lore.kernel.org/r/20211001223728.9309-1-chang.seok.bae@xxxxxxxxx As demonstrated with the supervisor bits, that's not really sensible and leads to similar issues. I've worked with Chang and Dave in the past few days on sorting this out. Many thanks for their effort and support! This series is a renewed effort to make this more palatable. It's the first part of a 4 part submission which work towards a clean AMX integration into the FPU code: 1) Cleans up existing mess. Historical leftovers, shortcomings and especially the universal kitchen sink asm/fpu/internal.h which is included all over the place for the wrong reasons. This series has a value independent of AMX, but allows to make the integration and conversion to the new world order of dynamically enabled feature bits simpler. 2) Introduces a container for the actual register storage which carries information about the kernel and user space features and sizes supported by it to easy the integration of dynamically enabled feature and the resulting different buffer sizes. 3) Replaces a ton of state variables by introducing structures which carry that information 4) The actual AMX and dynamic feature enable bits which have been significantly reworked on top of #1 - #3 and to address shortcomings of the previous submissions. The current series (#1) is based on: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/fpu and also available from git: git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git x86/fpu-1 The full series which has #1-#4 included can be found at: git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git x86/fpu Thanks, tglx --- arch/x86/events/perf_event.h | 1 arch/x86/ia32/ia32_signal.c | 1 arch/x86/include/asm/fpu/api.h | 31 ++ arch/x86/include/asm/fpu/internal.h | 530 ------------------------------------ arch/x86/include/asm/fpu/signal.h | 13 arch/x86/include/asm/fpu/xcr.h | 11 arch/x86/include/asm/fpu/xstate.h | 6 arch/x86/include/asm/pkru.h | 2 arch/x86/kernel/cpu/bugs.c | 2 arch/x86/kernel/cpu/common.c | 2 arch/x86/kernel/fpu/bugs.c | 2 arch/x86/kernel/fpu/core.c | 163 ++++++++--- arch/x86/kernel/fpu/init.c | 29 - arch/x86/kernel/fpu/regset.c | 6 arch/x86/kernel/fpu/signal.c | 21 - arch/x86/kernel/fpu/xstate.c | 164 ++++++----- arch/x86/kernel/process.c | 6 arch/x86/kernel/process_32.c | 5 arch/x86/kernel/process_64.c | 5 arch/x86/kernel/ptrace.c | 1 arch/x86/kernel/sev.c | 2 arch/x86/kernel/signal.c | 1 arch/x86/kernel/smpboot.c | 2 arch/x86/kernel/traps.c | 2 arch/x86/kvm/svm/sev.c | 2 arch/x86/kvm/vmx/vmx.c | 2 arch/x86/kvm/x86.c | 192 +------------ arch/x86/math-emu/fpu_entry.c | 2 arch/x86/mm/extable.c | 4 arch/x86/power/cpu.c | 2 b/arch/x86/include/asm/fpu/sched.h | 68 ++++ b/arch/x86/kernel/fpu/context.h | 85 +++++ b/arch/x86/kernel/fpu/internal.h | 30 ++ b/arch/x86/kernel/fpu/legacy.h | 115 +++++++ b/arch/x86/kernel/fpu/xstate.h | 198 +++++++++++++ 35 files changed, 822 insertions(+), 886 deletions(-)