From nobody Wed Sep 10 01:54:49 2025 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (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 3F46E34164F; Thu, 21 Aug 2025 13:32:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755783126; cv=none; b=HjhizQtdi4j3xvJ8Pnig57tgnVmspmBUrmhHl152nVSaHkeKOm1qmUnuwmlvzc6K+21n3znLj68FN4bJiEQzJwVjAVkhKEJgjQ5sxyMxrvdGiocouR1njD3rDbq0ViSelN16V2uUKjnRxTOWtb8ChdtsLOz+n9XXTvgDFU+CbfQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755783126; c=relaxed/simple; bh=kwQW6i/j4xyRspGOqin5NqZ6IRC/uqUSqQQpvyNFHyQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GF3Ct2okhCe1DU7IZxdcUPbH0Se9Ujdtx4/2v9yzVInRLO9caDJbYTshioa13ULQeMAzCrDGTKFpxszcaTulupygIUSDvoEbnccWgI/8klA3GaTs/nsRkTn52K7isD66zy2ReIKVB7J98hy7uoHvLNHZRC134VyE3BUdDYsvbgE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=R9XA8VEn; arc=none smtp.client-ip=192.198.163.10 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="R9XA8VEn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1755783125; x=1787319125; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kwQW6i/j4xyRspGOqin5NqZ6IRC/uqUSqQQpvyNFHyQ=; b=R9XA8VEnRgsJmGdaxUSdezG1ERwrhzsDYFdirTA+R9W5tIK7qpRydkl6 maMiXQUrULtC0IOd5Z2SzEBQ5oE09B67b9EkKz0Q6QFL5uz0ijvtsW9sh y8ViJxdYJftg4mMy99JWVA7+80/qk43lSIsiQhZlk0y11Op1ewOwXQ+5W Xki/J0tf8XQ6lVUONdXRQ9Hjiuj73iHXq6e4NQgA2PWitI3ikc285UQxt kxkC9/s8tkj6UJ6qIsKKnqJDbnoXpF446TTEl3H87z5fRdyCek+iPMVkv kdKxcGT0+CexBoXEn8guer/HFz7jGLr9Fo/1xxdhPifJtWq2nRoBNmSVA Q==; X-CSE-ConnectionGUID: HVdcSOKmSHyYLFltH8MdJQ== X-CSE-MsgGUID: FPclAIC3QemyRcCvfDKErg== X-IronPort-AV: E=McAfee;i="6800,10657,11529"; a="69446131" X-IronPort-AV: E=Sophos;i="6.17,306,1747724400"; d="scan'208";a="69446131" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Aug 2025 06:32:01 -0700 X-CSE-ConnectionGUID: ZbGYO45YRPWXTLq7cMRCMQ== X-CSE-MsgGUID: CD9VWWMjQaygu8cXZpqmCQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.17,306,1747724400"; d="scan'208";a="199285390" Received: from 984fee019967.jf.intel.com ([10.165.54.94]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Aug 2025 06:31:39 -0700 From: Chao Gao To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: chao.gao@intel.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, john.allen@amd.com, mingo@redhat.com, minipli@grsecurity.net, mlevitsk@redhat.com, pbonzini@redhat.com, rick.p.edgecombe@intel.com, seanjc@google.com, tglx@linutronix.de, weijiang.yang@intel.com, x86@kernel.org, xin@zytor.com Subject: [PATCH v13 02/21] KVM: x86: Report XSS as to-be-saved if there are supported features Date: Thu, 21 Aug 2025 06:30:36 -0700 Message-ID: <20250821133132.72322-3-chao.gao@intel.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20250821133132.72322-1-chao.gao@intel.com> References: <20250821133132.72322-1-chao.gao@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: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =3D=3D 0, which equals to the effect of XSAVE/XRSTOR. Signed-off-by: Sean Christopherson Signed-off-by: Yang Weijiang Reviewed-by: Maxim Levitsky Reviewed-by: Chao Gao Tested-by: Mathias Krause Tested-by: John Allen Tested-by: Rick Edgecombe Signed-off-by: Chao Gao Reviewed-by: Xiaoyao Li --- arch/x86/kvm/x86.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 31a7e7ad310a..569583943779 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -335,7 +335,7 @@ static const u32 msrs_to_save_base[] =3D { MSR_IA32_RTIT_ADDR3_A, MSR_IA32_RTIT_ADDR3_B, MSR_IA32_UMWAIT_CONTROL, =20 - MSR_IA32_XFD, MSR_IA32_XFD_ERR, + MSR_IA32_XFD, MSR_IA32_XFD_ERR, MSR_IA32_XSS, }; =20 static const u32 msrs_to_save_pmu[] =3D { @@ -7474,6 +7474,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.47.3