Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5321924imu; Wed, 26 Dec 2018 00:14:25 -0800 (PST) X-Google-Smtp-Source: ALg8bN4cnx6duX66wgBBR1ChMR8xznxa8KtzTr76Ka4MzztxfxRCADP3FPRa/vCb5AaxFn4krLjG X-Received: by 2002:a17:902:6e0f:: with SMTP id u15mr18610864plk.175.1545812065194; Wed, 26 Dec 2018 00:14:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545812065; cv=none; d=google.com; s=arc-20160816; b=xVAUCZRJofu0hjlmPUlz1gJWZ3pQkXG6djSA3Qj8NqbP5dHl2IOAxnCW3h8AVJpUkI x9Hxn8czVneH5itOdnnznJdrxE01ECJd29hlPzuqwyGcRIS/JquRwnyS/ybfZ/x88kSw SrZXe9L+Dk5GllrOms7tbXmYa9ljftoqptMhbmM2FW3DMztHJsh5s1wwWgc4icCMeF2y 2qxoqOoq4c0td/c2ypyOaklOpuGLoaTiN2dl+TJHvjsBm0b7k6EIMiMrnZZz9fCd1r8s ja6xDFdlAIkssHjOc6HGCroVKk2dViYXLUBpRbq9aTvyLH8HuONgy6bzqhYsoRj2Mc9e qbqg== 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=fimnj7bKv0AnGD9n+CYAnOgFMlj7n7794qn8d5WbROY=; b=C4CSz7ODuq4k+wnVSwFXmxopiBMl5GnEGuOgLFUnf3JAte29qOslaxo2Oyw7zuwtSu agVQk0vgoywXfeuKWbWNIGFSzz+RHNhSHnQiAvY/Hw3nXfBCVKTutBlEuUPa7+YjmhIQ Lk/Qj+aMll5kfw7TRR70R7vbL10SECiPgBMKHIkGNg67jfvBFZTQNHbmm/EXpWHi/l7K 2e9LKjIB08q/FAuSyDXfwvJHVqOo3ZHN/s7/Kw9lm29++u5Zi1DvBdWggBLnJbOFfaxw 9OINd66MS5cfeiR6BBSa8t+SaciXL+HmiFuhrnfCJTc3C1aGp8FutnT5xiDTgOO7O0i/ ZpNg== 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 s27si31665445pgm.501.2018.12.26.00.14.00; Wed, 26 Dec 2018 00:14:25 -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 S1726592AbeLZIMu (ORCPT + 99 others); Wed, 26 Dec 2018 03:12:50 -0500 Received: from mga11.intel.com ([192.55.52.93]:64132 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726432AbeLZIMr (ORCPT ); Wed, 26 Dec 2018 03:12:47 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Dec 2018 00:12:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,400,1539673200"; d="scan'208";a="104759687" Received: from unknown (HELO localhost.localdomain.sh.intel.com) ([10.239.13.104]) by orsmga008.jf.intel.com with ESMTP; 26 Dec 2018 00:12:45 -0800 From: Yang Weijiang To: pbonzini@redhat.com, rkrcmar@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, mst@redhat.com, yu-cheng.yu@intel.com, yi.z.zhang@intel.com, hjl.tools@gmail.com Cc: Yang Weijiang , Zhang Yi Z Subject: [PATCH v1 5/8] kvm:x86 Enable MSR_IA32_XSS bit 11 and 12 for CET xsaves/xrstors. Date: Wed, 26 Dec 2018 16:15:29 +0800 Message-Id: <20181226081532.30698-6-weijiang.yang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181226081532.30698-1-weijiang.yang@intel.com> References: <20181226081532.30698-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 kvm Guest OS, right now, only bit 11(user mode CET) and bit 12 (supervisor CET) are supported in XSS MSR, if other bits are being set, the write to XSS will be skipped. Signed-off-by: Zhang Yi Z Signed-off-by: Yang Weijiang --- arch/x86/kvm/vmx.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index fa2db6248404..5739ab393b90 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -4323,12 +4324,16 @@ 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. + * Right now, only support XSS_CET_U[bit 11] and + * XSS_CET_S[bit 12] in MSR_IA32_XSS. */ - if (data != 0) + + if (data & ~(XFEATURE_MASK_SHSTK_USER + | XFEATURE_MASK_SHSTK_KERNEL)) 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