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 8189BC6FD19 for ; Sun, 12 Mar 2023 18:04:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231890AbjCLSEe (ORCPT ); Sun, 12 Mar 2023 14:04:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231585AbjCLSDQ (ORCPT ); Sun, 12 Mar 2023 14:03:16 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B9734E5F1; Sun, 12 Mar 2023 10:59:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678643985; x=1710179985; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vrYmyA8Cl9bRQ1HKny1zdd5fr26+g7Sa0RGNdptGitI=; b=fKjP+zaoognsWLZgaBWsw0qn4kzLX7J796FGldLfo3ePEyi2p+dp0ZQ9 PGFkZoEhDYAKxUwAXDRZp9TZmFnTe8VcFb/A5X9qoMAihzBv+csIERNWd IFglty8UBZ707umLJnAKQPyYVKUACZ4O5wK+kbWsV37fjTp/oy1yQNmgc oxu6PXq20zl8n1RgVSK8qY5YUI7tlgGTbvKjAjw+r8Xu74Mt7LP1kBf/M pWB3nreZugSXyHG5v/3C2KakKDPpTv9h0SZpehF6BqokKX34GqC6Mfd1E C7jMj2nmb4huRUetImK1ldODoZAeaQi0tHPdrY64rP/sapY3kMpffxViM w==; X-IronPort-AV: E=McAfee;i="6500,9779,10647"; a="316659982" X-IronPort-AV: E=Sophos;i="5.98,254,1673942400"; d="scan'208";a="316659982" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2023 10:58:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10647"; a="742596726" X-IronPort-AV: E=Sophos;i="5.98,254,1673942400"; d="scan'208";a="742596726" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2023 10:58:10 -0700 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 v13 071/113] KVM: TDX: restore debug store when TD exit Date: Sun, 12 Mar 2023 10:56:35 -0700 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 a2e566e53076..d454ed9b1556 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -2415,3 +2415,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 e1d159ca3e4b..99d700bb1baa 100644 --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -552,6 +552,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