Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp893791rdh; Thu, 23 Nov 2023 23:59:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/z66ZatsIioNt4Me3vZe06+2IfRvCTNp0kBpZaLqBTFP7Z/03+Tcf4PX6yOJahWGm17bG X-Received: by 2002:a17:902:ea10:b0:1ca:29f:4b06 with SMTP id s16-20020a170902ea1000b001ca029f4b06mr2511032plg.2.1700812792785; Thu, 23 Nov 2023 23:59:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700812792; cv=none; d=google.com; s=arc-20160816; b=RZsH23wvEic/KFEzUZEcjiG8XAY/6OgXuY3PbJ9WpHNp/uOpLXehh23e9dIHn2b81+ /b6iZJn5yk0w/REbhj/ULvP75b5DGpQ2qTjVvjbq3YitRJ4FcEBREWIz5SmOQqLgFEOl CUHyylTd5W5flRsKEVUGnzZmxADY6SrAbvgUaaTlDlh8bYgoOkgdDmhM1JjUdYFR2tLc nn/Skv5q6TslOyhHSWJXGzaDQ0/jX1kyR9nR/cbSLwZtDQJ8xgoE1BHnA+HdK6TLl8Cd rMoCgc5+Y0RQ3MeW0JtGSD1xvOxXLnnCIWeKVljwmFdkrn5tRpxYNzfb6PaSX9hxmwsz q0TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pMTjECMh8fr+g7bhxi2VAadyjoT2T1sc/tGViCHcWnA=; fh=uy0EBGgYIm8+MgsxUvKHUXUo3s9z4H9hdLwRv8YoeJU=; b=gt42pAONdaZzOJByTBuObcAbbrcFL3kJF3LabS77/WCgEzm3GIogQwkMCtMTpw+dMp i12FOKJkPvpMtUEeMuOozX5IHE0lX0pPIk+Wkuv7HdyWf6o324F//XGDlc5aTrg+v38B zPBkNGxWfhPzkiHbRQ0nROpOqsUl5qORwlxa6FRqEQxAesEaLfGOS4yx3/yd8mHNMvkB MxwvFOcU9ycaYwZV7UuETHv7L3dXtSpywICEUQi0ozN7skTpZUd0JUz8z5qedgHwyPxz MI6e7TQfrF3sCJpFr2ty0zTFpU1MdE+U3bH6kC/uKu/K4AZ3OWjki06oreEMEI4FDRRJ dYTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BvfzpAqK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l4-20020a170902ec0400b001ae40e07fb0si2841810pld.216.2023.11.23.23.59.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 23:59:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BvfzpAqK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 13B5682164CA; Thu, 23 Nov 2023 23:59:51 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345195AbjKXH7k (ORCPT + 99 others); Fri, 24 Nov 2023 02:59:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232631AbjKXH6j (ORCPT ); Fri, 24 Nov 2023 02:58:39 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFB4A10F6; Thu, 23 Nov 2023 23:58:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700812725; x=1732348725; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5NwdFWB8PYqE9sGf4NOEiLQEKXylN+xEDDw+kzJt/SQ=; b=BvfzpAqKXlFPm/yaTspJK3HzWJgd/tkCjhIx3LP7Lkq0OOyuA6vyB1yi ybavQSg41I+2osqGuwqIdVcuG88lvkhZkRgJtQEE4Td7sOl9YuHMqeIeS Jp/cwAsw6Uf8vW9eusCL7srgTe45dI3rjp+HEuJD2+ANtN9UrTNYJLsVQ ZZOwODip4CVINxXIwStSQhte1NPlabuP9Suw3FwisvpRFc3W/Mwb0BPDg l6TaWyqUOTUr/WIkX1kmNUNo3Y3QqpkkXGEp2+6Uji26n93ztRmwimU6Q OaF6ZxX+o3nfPK+bP8jcl6m33YTv6ezw76qMMqOc+a7ehDRPET/yBBING Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="458872334" X-IronPort-AV: E=Sophos;i="6.04,223,1695711600"; d="scan'208";a="458872334" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2023 23:58:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="833629826" X-IronPort-AV: E=Sophos;i="6.04,223,1695711600"; d="scan'208";a="833629826" Received: from unknown (HELO embargo.jf.intel.com) ([10.165.9.183]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2023 23:58:39 -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 v7 12/26] KVM: x86: Report XSS as to-be-saved if there are supported features Date: Fri, 24 Nov 2023 00:53:16 -0500 Message-Id: <20231124055330.138870-13-weijiang.yang@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231124055330.138870-1-weijiang.yang@intel.com> References: <20231124055330.138870-1-weijiang.yang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 23 Nov 2023 23:59:51 -0800 (PST) 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 360f4b8a4944..f7d4cc61bc55 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[] = { @@ -7317,6 +7318,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.27.0