Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp251810img; Mon, 25 Feb 2019 22:34:24 -0800 (PST) X-Google-Smtp-Source: AHgI3IYRHS8/xdwhg9ySFZExKYfATr0ZnoypBrzqteHRayo4reqCTkvqhxOqgSe/P0UDQSkbPLaU X-Received: by 2002:a62:68c5:: with SMTP id d188mr24948315pfc.194.1551162864819; Mon, 25 Feb 2019 22:34:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551162864; cv=none; d=google.com; s=arc-20160816; b=qWwNn6+YcV1PW8fzx4XpwYoWqpADpNaFiG9PqczG7Y4UVJo6ZobZy9HQYAyMJyLS/w l18gHVC9mH08etNAUQ77ehCJpyQ1P7POiUqrn+sw6lNLcQSvC6sZCK2r+WVRbSZgyu1Q YP/Vr1fX+mptW4wv/cFOjkQn6hTB6FvUN3dDtt4u9e5EeBwJFf+HQV3TlQbGpeQYaWFn lq4n4f2ZPP+1RRAYdR86anRMk9y1AO0ejfxXZ10HqPpVV00SYJ9Afc/l4QNs0pEqS+yD sbbPF3z7s011TCRsXnNA+P02q09FQe+6QrlqHgRQvYSw6H/Ge2jaUyuTCnsKvlnbL27p 5/VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=OSbce3RzvAJeAkCQ2HJZ3a5Zq13GF95WlaRX8QZkt6A=; b=sQwSn0Hgq3hJ+G9kvXXx3sssr9EqZ4+rTFWL/i0DMLtPD4jvM35yFFqxb7uBLiBfKb pwwbspN7UKdq2bGeBj15a8zMV2inNgCnuF7sIor20YEBJt6EVSYicevFT/uB1qONaBeC eVYuv4yWpZM2vA7wsWnozFUAGB4VfcWoITiIW/oz5+vDzc0uoFyoAy0a1suVVZ/zFgsq VPtDpv9p8bPiJW7clnS88NhR5umRAjL1vj3MRhW0fE6RtnRF4BpVdHJ1IT+Snt1akAhu Qxg8Qeibk2Cf9IO+6KI4CUCu9XcyZ5Dxi58MUhKRvVt8JBlgSmf4Ilk4usqZC8ZJtpPp pmzg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c132si11449373pga.597.2019.02.25.22.34.10; Mon, 25 Feb 2019 22:34:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726718AbfBZGcz (ORCPT + 99 others); Tue, 26 Feb 2019 01:32:55 -0500 Received: from mga17.intel.com ([192.55.52.151]:18115 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726552AbfBZGcx (ORCPT ); Tue, 26 Feb 2019 01:32:53 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Feb 2019 22:32:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,414,1544515200"; d="scan'208";a="141666127" Received: from local-michael-cet-test.sh.intel.com ([10.239.159.128]) by orsmga001.jf.intel.com with ESMTP; 25 Feb 2019 22:32:50 -0800 From: Yang Weijiang To: pbonzini@redhat.com, rkrcmar@redhat.com, sean.j.christopherson@intel.com, jmattson@google.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, mst@redhat.com, yu-cheng.yu@intel.com Cc: Yang Weijiang , Zhang Yi Z Subject: [PATCH v3 4/8] KVM:CPUID: Fix xsaves area size calculation for CPUID.(EAX=0xD,ECX=1). Date: Mon, 25 Feb 2019 21:27:12 +0800 Message-Id: <20190225132716.6982-5-weijiang.yang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190225132716.6982-1-weijiang.yang@intel.com> References: <20190225132716.6982-1-weijiang.yang@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org According to latest Software Development Manual vol.2/3.2, for CPUID.(EAX=0xD,ECX=1), it should report xsaves area size containing all states enabled by XCR0|IA32_MSR_XSS. Signed-off-by: Zhang Yi Z Signed-off-by: Yang Weijiang --- arch/x86/kvm/cpuid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 5e05756cc6db..f71c3d8d6ec3 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -131,7 +131,8 @@ int kvm_update_cpuid(struct kvm_vcpu *vcpu) best = kvm_find_cpuid_entry(vcpu, 0xD, 1); if (best && (best->eax & (F(XSAVES) | F(XSAVEC)))) - best->ebx = xstate_required_size(vcpu->arch.xcr0, true); + best->ebx = xstate_required_size(vcpu->arch.xcr0 | + kvm_supported_xss(), true); /* * The existing code assumes virtual address is 48-bit or 57-bit in the -- 2.17.1