Re: [PATCH v4 06/21] x86/fpu: Ignore APX when copying from/to guest FPU

From: Dave Hansen

Date: Wed May 13 2026 - 15:17:53 EST


On 5/11/26 18:14, Chang S. Bae wrote:
> From: Paolo Bonzini <pbonzini@xxxxxxxxxx>
>
> KVM will store APX extended GPRs directly in the regs[] field of struct
> kvm_vcpu. This is done to make accessors more uniform between GPRs and
> EGPRs, and partly because x86 maintainers expressed the desire to compile
> Linux with APX enabled sooner or later; accessing guest EGPRs from KVM's
> C code would get in the way.
>
> Therefore, let KVM handle the APX feature on its own when executing
> ioctls to get and set the virtual machine's XSAVE state.

I'm sure this works.

But it does look a bit hacky to me. I just despise adding new special
cases to the XSAVE code when we don't _have_ to.

Couldn't we, for instance, just let the APX registers use the "fpu"
ABIs? PKRU is weird too, but it still gets to use those ABIs.

Having space for the eGPRs in one more place seems like additional
confusion.