Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp251436img; Mon, 25 Feb 2019 22:33:53 -0800 (PST) X-Google-Smtp-Source: AHgI3IYjy/yDkOG0TzdGS18b/ab8agP4l1VmKSO6WwzPt5MCCd2bbQa3X/0oltsNZg7sBQMA17w3 X-Received: by 2002:a63:4f61:: with SMTP id p33mr3095715pgl.303.1551162833269; Mon, 25 Feb 2019 22:33:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551162833; cv=none; d=google.com; s=arc-20160816; b=MW81Pdg9jJCmjBTOxgt/MVfK00nLKJo8XImorL3mlpW/6NUfXZy3ukUL+7CvAQ/Pq+ N2riiXxi3/n5DXejah9zNcJ/1xscVSCxmsai1tOCGgKRNxmm3WA0jkmBujkSZX1mttdj 6c+jp8lFpQwhX2GY1bsV3sTuplr08SRBl6xIz4++zLRXiHid1cHDzWvNgTfXRTCrzOUG 2JAM0DzQMEYInaYTX7ukpfAkwJv/rJ8aQevhndKSED0+Y9OEs7uogqzRqtDy1mddTv13 yqXet6hfWfHbBPwyArFU+qp+wjO39ES1KqEy6jjgiBb/fS1FvguWL6Uf2k00i/Az63iX 1Qxw== 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=xttJyGW9qz/6qCvUwCpwoZmgoUAeuy8rDnoDUVIvU9U=; b=Fc7Dhv+SD46jaznZ9TuAhnZB0cy5/9NBiLYBC4xz6y7+ISyoNbYIsrhvVq3HgqGbf3 yZwunUV83HmhtYJENORu0K/XhJz9jNSnW7vAcxmDPzgee9qyn6vJAY0X/SQif4mdsTFy YKg5Ib91hiiOZpaqH3lmHKO1AqHMV+k+l/hZq8yNUNFvWHUfM4qI7BWxtxgGAjwnmDWm XDswUR5ecmn53PDzAteU6qk4kbRanLmZbPLfscCygzp8fd+r6zmTq+VFjY1+PmUgrpSk ADE2KCkQW6+zSJJyS6pfoYg9MqTqByLgbKp0mdBxqZDv9fIOhh8SkNGJAIGmfyM7rkh9 KOtg== 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 j71si11327051pgd.431.2019.02.25.22.33.38; Mon, 25 Feb 2019 22:33:53 -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 S1726899AbfBZGdF (ORCPT + 99 others); Tue, 26 Feb 2019 01:33:05 -0500 Received: from mga17.intel.com ([192.55.52.151]:18116 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726808AbfBZGc7 (ORCPT ); Tue, 26 Feb 2019 01:32:59 -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:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,414,1544515200"; d="scan'208";a="141666199" 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:57 -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 7/8] KVM:X86: Add XSS bit 11 and 12 support for CET xsaves/xrstors. Date: Mon, 25 Feb 2019 21:27:15 +0800 Message-Id: <20190225132716.6982-8-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 For Guest XSS, right now, only bit 11(user states) and bit 12 (supervisor states) are supported, if other bits are being set, need to modify KVM_SUPPORTED_XSS macro to have support. Signed-off-by: Zhang Yi Z Signed-off-by: Yang Weijiang --- arch/x86/kvm/vmx.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index d32cee9ee079..68908ed7b151 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -4336,12 +4337,13 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) case MSR_IA32_XSS: if (!vmx_xsaves_supported()) return 1; + /* - * The only supported bit as of Skylake is bit 8, but - * it is not supported on KVM. + * Check bits being set are supported in KVM. */ - if (data != 0) + if (data & ~kvm_supported_xss()) return 1; + vcpu->arch.ia32_xss = data; if (vcpu->arch.ia32_xss != host_xss) add_atomic_switch_msr(vmx, MSR_IA32_XSS, -- 2.17.1