Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp20576rdb; Thu, 21 Dec 2023 01:18:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IEEdw4AbGL7QVqbyDOA+IwetkD+m57fLG6DuhVGZcGZGwK09JqJ6+b3mkEuqMMT30rUUxZQ X-Received: by 2002:a05:6512:124a:b0:50e:3f2e:c737 with SMTP id fb10-20020a056512124a00b0050e3f2ec737mr2989370lfb.1.1703150338892; Thu, 21 Dec 2023 01:18:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703150338; cv=none; d=google.com; s=arc-20160816; b=SVGn7CgfJAWc8OgydachaI+HfNzooqTQknWcqgnulgTQJYJiLFZyAoNppuLPOkPkG9 NfoFnG/bzz2W23piLVn2YLkxcVZfm2wlSkRZKkePMB9Og6NNfi6xTX3xE53E7qNw2Kmn t0aZKBwBJ00IuHNZOrnsNnvnA7y2vnxdKnRKY3BAmukh+QeMwL4hUG1iZMOiRT25SgcW A0h+NkfQ08dKTWnBZMvaFVKAOJpDGC5JTbF1xTDZtIzJjPf1cs9vpEuI9dhxjM/y8aqp wkzw/bKqNhdPuZmVH9lySiTzfLotEtg0hzpWswqgyBFOKxhG5AhGPJjj86RGLT+iJZWR hYXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=dJFJSLlnaQA4+7DAio3F4Xa3gj03ms0ZUCKyWoq2Jlo=; fh=uy0EBGgYIm8+MgsxUvKHUXUo3s9z4H9hdLwRv8YoeJU=; b=q6+nWpy+zRGAQ4qJWLNTApza+nVR6YwIEnp798QEorG2npJcpYjFgmeayim1QvOXG7 AC4PlKQzPOG3uh9iaAFykNPmVFubl8JaLxBnUmOLmtodS33NJWQX/Jcd1nkmJUyW/+le 7O5uMl+9hOcYIi9WxKv3z3NQWUPkFDbpqObbkltiTso6MCOSZwGDbMpncDA4Gh0IQy3a 6NnvVzaYU3OVVBCXi3Fv5Z2EWvH5L8e+egQEfB1PMc/3c0h8hDMuQSOKqCVxT3sCz6ye Rr10PEX7CcdQ8Uzf1bdUcyAXMb4jemvFfsHIiWPq7MD/2QWKrAEjkGRzkRu7cNisK7KT 00GA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DTPXkwad; spf=pass (google.com: domain of linux-kernel+bounces-8081-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8081-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l21-20020a170906231500b00a26a9593a6asi241195eja.154.2023.12.21.01.18.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 01:18:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8081-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DTPXkwad; spf=pass (google.com: domain of linux-kernel+bounces-8081-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8081-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9E0711F2380D for ; Thu, 21 Dec 2023 09:18:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 64AC859164; Thu, 21 Dec 2023 09:03:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="DTPXkwad" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29DDC57892; Thu, 21 Dec 2023 09:03:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703149436; x=1734685436; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=T3X3fq7AuhPHM7WBbIb8WSrvU0kDaKc1Pze+7ySZgmo=; b=DTPXkwadQomHmYUAJApWB3QTmecm6hxN6LGwSdA20O33cfl/db3+FdBI nnEzAeBEECjCFkl/Rp3gfukdboPuQru3gq3ZKIXrE7R2A/LjrOtPlpLlG Qk63IpbRujHhi7jYPjy8KDNX9/dcwsqArK7zgIw1ibmfnYqIyOnAAyEQR a4tbHKF8dhuLCF2CdkEnLfGUIYNEKTci8/p2X48SPZST92IQgEXqbjwyk tVoyoGEUm0MJOo28L6fZAcDW9wpici/JLachYJH3cz01K5T+6mTtHXPPI TaJei2Pd4bQGfNmLUVOydcxPPcp8h3vUmLHJaRL1fr9ETvHJ6T7BYW/On A==; X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="398729721" X-IronPort-AV: E=Sophos;i="6.04,293,1695711600"; d="scan'208";a="398729721" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Dec 2023 01:03:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="900028597" X-IronPort-AV: E=Sophos;i="6.04,293,1695711600"; d="scan'208";a="900028597" Received: from 984fee00a5ca.jf.intel.com (HELO embargo.jf.intel.com) ([10.165.9.183]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Dec 2023 01:03:11 -0800 From: Yang Weijiang To: seanjc@google.com, pbonzini@redhat.com, dave.hansen@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: peterz@infradead.org, chao.gao@intel.com, rick.p.edgecombe@intel.com, mlevitsk@redhat.com, john.allen@amd.com, weijiang.yang@intel.com Subject: [PATCH v8 12/26] KVM: x86: Report XSS as to-be-saved if there are supported features Date: Thu, 21 Dec 2023 09:02:25 -0500 Message-Id: <20231221140239.4349-13-weijiang.yang@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231221140239.4349-1-weijiang.yang@intel.com> References: <20231221140239.4349-1-weijiang.yang@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Sean Christopherson Add MSR_IA32_XSS to list of MSRs reported to userspace if supported_xss is non-zero, i.e. KVM supports at least one XSS based feature. Before enabling CET virtualization series, guest IA32_MSR_XSS is guaranteed to be 0, i.e., XSAVES/XRSTORS is executed in non-root mode with XSS == 0, which equals to the effect of XSAVE/XRSTOR. Signed-off-by: Sean Christopherson Signed-off-by: Yang Weijiang Reviewed-by: Maxim Levitsky --- arch/x86/kvm/x86.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 594c9e025f95..b3a39886e418 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1464,6 +1464,7 @@ static const u32 msrs_to_save_base[] = { MSR_IA32_UMWAIT_CONTROL, MSR_IA32_XFD, MSR_IA32_XFD_ERR, + MSR_IA32_XSS, }; static const u32 msrs_to_save_pmu[] = { @@ -7374,6 +7375,10 @@ static void kvm_probe_msr_to_save(u32 msr_index) if (!(kvm_get_arch_capabilities() & ARCH_CAP_TSX_CTRL_MSR)) return; break; + case MSR_IA32_XSS: + if (!kvm_caps.supported_xss) + return; + break; default: break; } -- 2.39.3