From nobody Tue Sep 9 00:59:35 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82AEAEB64DC for ; Fri, 21 Jul 2023 06:10:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230462AbjGUGKE (ORCPT ); Fri, 21 Jul 2023 02:10:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230071AbjGUGJB (ORCPT ); Fri, 21 Jul 2023 02:09:01 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89B55271F; Thu, 20 Jul 2023 23:08:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689919739; x=1721455739; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MwfzTOMWRaXCBbumrvW/EaiFBOP8yUV8uNuQHa+JVoI=; b=XScH0s3Z2hifcqsZ1zDsHj8pBPmIVooVbRETZiurG1f7cqXdurczyYGi GX/JjPNwfi2HlJs5ODK0gyqyWKIxucyQFbmCb48EbfbYNvt/6IaV4MQ5L 7epS8nM3+xHT8MsiGbCUMkqqf2D1dS6lrVDWeR9hr3eq+agXei5srhnUy Cv2xcNFD6nR4exHAUuJrMaRvpR39aQYAdUk3c7+ioVQSxdd0IUE+YZ2dG L/z2pm3fcpcUOHAo04C4lbpxl+ueE1q+ct9JXZ+60JzfDZJFxcK7Xne3a lsV2hsC1U9t789YMszCacRuWsGEQjenq8HcOnKWx08/dL8G/4OOUE5v0r w==; X-IronPort-AV: E=McAfee;i="6600,9927,10777"; a="370547592" X-IronPort-AV: E=Sophos;i="6.01,220,1684825200"; d="scan'208";a="370547592" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2023 23:08:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10777"; a="848721883" X-IronPort-AV: E=Sophos;i="6.01,220,1684825200"; d="scan'208";a="848721883" Received: from embargo.jf.intel.com ([10.165.9.183]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2023 23:08:40 -0700 From: Yang Weijiang To: seanjc@google.com, pbonzini@redhat.com, peterz@infradead.org, john.allen@amd.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: rick.p.edgecombe@intel.com, chao.gao@intel.com, binbin.wu@linux.intel.com, weijiang.yang@intel.com, Sean Christopherson Subject: [PATCH v4 03/20] KVM:x86: Report XSS as to-be-saved if there are supported features Date: Thu, 20 Jul 2023 23:03:35 -0400 Message-Id: <20230721030352.72414-4-weijiang.yang@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230721030352.72414-1-weijiang.yang@intel.com> References: <20230721030352.72414-1-weijiang.yang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson Add MSR_IA32_XSS to the list of MSRs reported to userspace if supported_xss is non-zero, i.e. KVM supports at least one XSS based feature. Signed-off-by: Sean Christopherson Signed-off-by: Yang Weijiang --- 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 439312e04384..4597ab3c811c 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1451,6 +1451,7 @@ static const u32 msrs_to_save_base[] =3D { MSR_IA32_UMWAIT_CONTROL, =20 MSR_IA32_XFD, MSR_IA32_XFD_ERR, + MSR_IA32_XSS, }; =20 static const u32 msrs_to_save_pmu[] =3D { @@ -7173,6 +7174,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; } --=20 2.27.0