KVM: x86: do not save guest-unsupported XSAVE state

Saving unsupported state prevents migration when the new host does not
support a XSAVE feature of the original host, even if the feature is not
exposed to the guest.

We've masked host features with guest-visible features before, with
4344ee981e21 ("KVM: x86: only copy XSAVE state for the supported
features") and dropped it when implementing XSAVES. Do it again.

Fixes: df1daba7d1cb ("KVM: x86: support XSAVES usage in the host")
Cc: stable@vger.kernel.org
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>

Changed files
+1
arch
x86
kvm
+1
arch/x86/kvm/x86.c
··· 3182 3182 memcpy(dest, xsave, XSAVE_HDR_OFFSET); 3183 3183 3184 3184 /* Set XSTATE_BV */ 3185 + xstate_bv &= vcpu->arch.guest_supported_xcr0 | XFEATURE_MASK_FPSSE; 3185 3186 *(u64 *)(dest + XSAVE_HDR_OFFSET) = xstate_bv; 3186 3187 3187 3188 /*