From nobody Sun Oct 5 00:09:22 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (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 B387F2E4247; Tue, 12 Aug 2025 02:56:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754967393; cv=none; b=sKp36JU+6tt98Z/87ybCbnPMX8bfS5uSyXDWEmrlbzEecVWTXAgvK1GRPfIPbiIW3n7XjNIKakVl81KI+ePkwvFaayqQutljlVCBID7a7RXf4JEF7vyNRobUR6VXiB10Q9WVYLLSJa8UJu7qbZm1ZmLBC2s3tZY/I1Ll/tDNfjs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754967393; c=relaxed/simple; bh=F+QAkh5cv8nzilO4NetL4dW3egNXWHBjD8Zuf/btujg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qc/sFrpmVHl+RIovZFGEHsQ1MB3hRq3vn0V+swtDn/3FH5f6BnTMzPOgL/SnkEMVfFA44+90yMIIGPkSJx/0a3iBDj2+3TvCDNOxzW088RCEyiPLHJ8s0f6VYaKzNu9ZOsnAeD7x1dBp+QGbrZ3/yU/KbueDKMVXiUIriR/NATg= 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=AiAnXZo0; arc=none smtp.client-ip=198.175.65.19 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="AiAnXZo0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1754967391; x=1786503391; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=F+QAkh5cv8nzilO4NetL4dW3egNXWHBjD8Zuf/btujg=; b=AiAnXZo0OJxeb2t7MGW+74S8cclaHXFhW9/fqqb3WYWMzRs8RiV+WCEr h9WQ7Xg4KT/OLtTvPDCpR4Bs+yL91Npfv5XLIcSYurpMTThxZz7kFxJkS 3tQ8y4n8ZAHXbzo5iAXu91ShtknK8hUIlWn32OlyR86/Twzk4RfEAmwtb TPIr/6lirhaxxQs3TB48JTy8oC3MgESf9xBjNJdlpneijcEOOkn9mrAmK dY388daZT9rbT7D/864u5AqVlDJslGSPPGw5jOo8Q91Zdy6BhuMbidy1m EH7Dy/JVnNlIEQ5DxLaIeuMT+ZTz3OuUQS6ddyKgwB81mBE+sEcROJBEG A==; X-CSE-ConnectionGUID: k99xw3JBRF+n3oJJOF+yWQ== X-CSE-MsgGUID: xIevt7qZQLG+luofkeF8JQ== X-IronPort-AV: E=McAfee;i="6800,10657,11518"; a="57100492" X-IronPort-AV: E=Sophos;i="6.17,284,1747724400"; d="scan'208";a="57100492" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2025 19:56:27 -0700 X-CSE-ConnectionGUID: KQtY5XFKQamazscsALEI7Q== X-CSE-MsgGUID: fUn3JX0TRl67dtzAP3EKXg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.17,284,1747724400"; d="scan'208";a="171321250" Received: from 984fee019967.jf.intel.com ([10.165.54.94]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2025 19:56:27 -0700 From: Chao Gao To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: mlevitsk@redhat.com, rick.p.edgecombe@intel.com, weijiang.yang@intel.com, xin@zytor.com, Sean Christopherson , Chao Gao , Mathias Krause , John Allen , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" Subject: [PATCH v12 07/24] KVM: x86: Report XSS as to-be-saved if there are supported features Date: Mon, 11 Aug 2025 19:55:15 -0700 Message-ID: <20250812025606.74625-8-chao.gao@intel.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250812025606.74625-1-chao.gao@intel.com> References: <20250812025606.74625-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 Signed-off-by: Chao Gao --- 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 f77949c3e9dd..e0e440607e02 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 { @@ -7444,6 +7444,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.1