Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp558269rwb; Thu, 12 Jan 2023 09:17:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXsDCtx85TcyJHqihfs0DHdpL+23JtKSlBL2Jg+pzwQ6u2HT+o3ef4tH1kKKPSD2nxRU5qsR X-Received: by 2002:a17:907:a4c5:b0:84c:f9b0:b54a with SMTP id vq5-20020a170907a4c500b0084cf9b0b54amr28723015ejc.58.1673543868765; Thu, 12 Jan 2023 09:17:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673543868; cv=none; d=google.com; s=arc-20160816; b=acKcKVX3J7ZK4RfyPv/Nl/uQMdtidiZxI0hOk2m9Ff/9Fo9+vLfNcs138BQ3v9h6iu GeEvt7dMnJOQtxUnzJxQH9eCOV+foiTZBtX0OPJi6VkoFXw1JjXm4eEqlizCxRhgXZSD DNz2WOzOZB/VXLkPIlBSfrs64DpcroTQwdvtncne9Ef1jFgL/mdwkEuANkCKBOiHOp/6 HBxD8VZy3boBsiJ41DKTJabwrjC6hTUwEIkKiX/JRPGNW1xw/V2yNgKlUJcgKyB7Zw4a i86dU7R1G38pIz4xM//XtHXXhs1AreiXwUPA9LDUSzvXctfBR2ls50iKIpOZ0ZqTgjds n1oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CC+wUXq1F2ZzJ+Qm9f6wovL97q1uBlvHTmcDbzYVN2E=; b=QICLGU/aOKCDAHA907eUCiHJW70J1JusshWQcV/GTIf35nWTx4cId38CzkzYuqveYT EzuA8o2BeXJxYZt+0dQMhndZ2ZDf1RjLtR0V9EuosNT+ACADyAK6iAO4yDtcUjC7l7W4 tO3bZriL7E/skQk+ApKkRe5D1N9KQRdycDSHlIIKfpyhnuIM+1NWqzZjpo4k/cSKhmcL EfT375R7rbCyFhHOxSlEZZgIe5kWPdqyNZ76+sPNC0Nd2AqnNpF0cdGiNCNx5TzHTOT1 wI8MUTVtkFRvTDHg46hFny4f4wtSuyUnBHZV4MJhiZNBfMqVGTFD/xmVsaoVU7XCtiQe BVvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BXELdDCl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g14-20020a056402090e00b00468eee7250csi9463940edz.510.2023.01.12.09.17.37; Thu, 12 Jan 2023 09:17:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BXELdDCl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234178AbjALQhg (ORCPT + 50 others); Thu, 12 Jan 2023 11:37:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236950AbjALQhL (ORCPT ); Thu, 12 Jan 2023 11:37:11 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 145FDB6E; Thu, 12 Jan 2023 08:33:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673541215; x=1705077215; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8/V4BgpLzSgkWZJUgjDmvpjhBQV16Mu1qbJcvXOz8bg=; b=BXELdDClOLwklXZboRX5SSlIh+HDKhrwnA8Vei4dmR5NIa8xALD05Z6P C5kMW3Gvx2k0avJj5CixUR0u/u6AXnpQCE709xJNVBF7q7Vzyg05HSPCT oqCtB2/+XXXsyWSy1PdbnX05RmnOjt22EXUL8oo8hQhLJr+FdaPHXAhK+ 0WjHKexacnm/ccSvOzA/Jqh/DRT2SegzsPneJ8teZLvLBhVglTz/rE3TB ZeOM6vHSmdMy+H49aaGz0fee8uV3hiPG/d1XFVorOEGrUZ+7gpV95XLr+ 0swy45tsxHrDmwQ2B2lRu5cLbNVx00Vp2D2FrFd1ZMLzPsCHPYMJ3yF+D Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="386089620" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="386089620" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 08:33:33 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="726372473" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="726372473" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 08:33:32 -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 Subject: [PATCH v11 072/113] KVM: TDX: restore debug store when TD exit Date: Thu, 12 Jan 2023 08:32:20 -0800 Message-Id: <78eae567df2fc21be2fd9e93b79367c31c583ad7.1673539699.git.isaku.yamahata@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 40546e692222..f2b92c8bc081 100644 --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -531,6 +531,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