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 B9E1CC7EE2D for ; Mon, 27 Feb 2023 08:28:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231652AbjB0I2q (ORCPT ); Mon, 27 Feb 2023 03:28:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231570AbjB0I2M (ORCPT ); Mon, 27 Feb 2023 03:28:12 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACDBF1EBED; Mon, 27 Feb 2023 00:25:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677486322; x=1709022322; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wQRsBjUiBMYTpgEwJyYgRZtvi4+wq6LFWeS2Z3xRVmY=; b=C1sTnLac6mNQkfujHWOQA7UINP7ODCu9M/QQtL5gyD6iGOpd2JQ9/ZIs huXlWQWp9y7+EO2JKBP4xLvLDbeWz7qCHA5QWVyqKO1ipqaOzuuaBkMpW yabTpHAhmW8AOAzYDAeqBw7IMmwnHZdJtvb9Nb4LLBBRMip7ojEMCV37d XYeAfNRvtJoibsOE5h5z0g5JWHv11aaadO5DYfyplIa6jqB8KcIQU5H23 GQAN6NYJ9me8l00LWW/lNFQe6kRaW7HjhHZpfxscQslKzHLTRuDuoiBU8 u2kGO9cQ7yzm361ATgUuyBsqmmRgWnAQGK67G+fpa+rZlQf1o9StLTQ7W Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10633"; a="317608954" X-IronPort-AV: E=Sophos;i="5.97,331,1669104000"; d="scan'208";a="317608954" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2023 00:24:15 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10633"; a="783242299" X-IronPort-AV: E=Sophos;i="5.97,331,1669104000"; d="scan'208";a="783242299" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2023 00:24:14 -0800 From: isaku.yamahata@intel.com To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar , David Matlack , Kai Huang , Zhi Wang Subject: [PATCH v12 064/106] KVM: TDX: restore debug store when TD exit Date: Mon, 27 Feb 2023 00:23:03 -0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Isaku Yamahata Because debug store is clobbered, restore it on TD exit. Signed-off-by: Isaku Yamahata Reviewed-by: Paolo Bonzini --- arch/x86/events/intel/ds.c | 1 + arch/x86/kvm/vmx/tdx.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c index 88e58b6ee73c..4989b35161b6 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -2350,3 +2350,4 @@ void perf_restore_debug_store(void) wrmsrl(MSR_IA32_DS_AREA, (unsigned long)ds); } +EXPORT_SYMBOL_GPL(perf_restore_debug_store); diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c index 0e07fd13ec66..30eae42b071d 100644 --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -576,6 +576,7 @@ fastpath_t tdx_vcpu_run(struct kvm_vcpu *vcpu) tdx_vcpu_enter_exit(vcpu, tdx); tdx_user_return_update_cache(); + perf_restore_debug_store(); tdx_restore_host_xsave_state(vcpu); tdx->host_state_need_restore = true; -- 2.25.1