From patchwork Fri Apr 22 07:54:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yang, Weijiang" X-Patchwork-Id: 12823006 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 4D486C433FE for ; Fri, 22 Apr 2022 07:55:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1445236AbiDVH6a (ORCPT ); Fri, 22 Apr 2022 03:58:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445149AbiDVH6Y (ORCPT ); Fri, 22 Apr 2022 03:58:24 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2ACE35859; Fri, 22 Apr 2022 00:55:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650614132; x=1682150132; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dx4ZAjBNTlUSN4ah2Wv2fxm0zPpof1EcL/WfLobUgzc=; b=GmKuB1mJpYBsugXQfbYUoOMBa2jkPXVNvyTP5UgTYKyQYCTnT4eeZZjX rOYoJEE7lgUAa5llLtILgRDC8mWJURc188sPub5UvNSibLnZM7aGIetV+ AFQgvkn3Wz4q+/Uq51XWtpH0b6412BsEKN4WQ4kZuEMMA54UAENUGc96z O70QGPmbzHBvS4l7hTC0z4mHEBwoseegy871fCYjStPvNIrHh6LIK2t76 ynCbBCD00fME8cdLWLA0bcntSgQFcnSL/HmhZ0DNYRI3K3MsxhZeOuxTR y1FB1t9fzcK18l2IRptBqxqSjFH2hzkLrhry4Z4W5PdcFxpTenlV9IXK4 Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10324"; a="264384824" X-IronPort-AV: E=Sophos;i="5.90,281,1643702400"; d="scan'208";a="264384824" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2022 00:55:30 -0700 X-IronPort-AV: E=Sophos;i="5.90,281,1643702400"; d="scan'208";a="577741315" Received: from embargo.jf.intel.com ([10.165.9.183]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2022 00:55:30 -0700 From: Yang Weijiang To: pbonzini@redhat.com, jmattson@google.com, seanjc@google.com, like.xu.linux@gmail.com, vkuznets@redhat.com, wei.w.wang@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sean Christopherson , Yang Weijiang Subject: [PATCH v10 01/16] KVM: x86: Report XSS as an MSR to be saved if there are supported features Date: Fri, 22 Apr 2022 03:54:54 -0400 Message-Id: <20220422075509.353942-2-weijiang.yang@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220422075509.353942-1-weijiang.yang@intel.com> References: <20220422075509.353942-1-weijiang.yang@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 0c0ca599a353..20d94e7dbbfe 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1428,6 +1428,7 @@ static const u32 msrs_to_save_all[] = { MSR_F15H_PERF_CTR0, MSR_F15H_PERF_CTR1, MSR_F15H_PERF_CTR2, MSR_F15H_PERF_CTR3, MSR_F15H_PERF_CTR4, MSR_F15H_PERF_CTR5, MSR_IA32_XFD, MSR_IA32_XFD_ERR, + MSR_IA32_XSS, }; static u32 msrs_to_save[ARRAY_SIZE(msrs_to_save_all)]; @@ -6654,6 +6655,10 @@ static void kvm_init_msr_list(void) if (!kvm_cpu_cap_has(X86_FEATURE_XFD)) continue; break; + case MSR_IA32_XSS: + if (!supported_xss) + continue; + break; default: break; }