From: Radim Krčmář Date: Wed, 1 Feb 2017 13:19:53 +0000 (+0100) Subject: KVM: x86: do not save guest-unsupported XSAVE state X-Git-Tag: v4.14-rc1~1584^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=00c87e9a70a17b355b81c36adedf05e84f54e10d;p=platform%2Fkernel%2Flinux-rpi3.git 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 Signed-off-by: Radim Krčmář --- diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index d153be8..e52c908 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3182,6 +3182,7 @@ static void fill_xsave(u8 *dest, struct kvm_vcpu *vcpu) memcpy(dest, xsave, XSAVE_HDR_OFFSET); /* Set XSTATE_BV */ + xstate_bv &= vcpu->arch.guest_supported_xcr0 | XFEATURE_MASK_FPSSE; *(u64 *)(dest + XSAVE_HDR_OFFSET) = xstate_bv; /*