Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3471355rwb; Fri, 30 Sep 2022 04:12:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM68wTcWRi6qCGzXEpG694I2iJ0ELZi5sw4jNAup0oZj+B3pjHDjhlMaPWKiJOV7iQbCYOU5 X-Received: by 2002:a17:907:968d:b0:788:8b4:f294 with SMTP id hd13-20020a170907968d00b0078808b4f294mr1673120ejc.86.1664536378512; Fri, 30 Sep 2022 04:12:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664536378; cv=none; d=google.com; s=arc-20160816; b=dA9k0dsZOq0G57aHjMEQEwNT/QkZhKAijvOcHyjeebTln6Ld3stBWegQltCgNB/g4L wuQGeTRBNTaWZxYvU6Frvv5UD9OXun9EIdtFbUX/8pi6lS6bA7z3QemTL0h/gCSsED5k fjNyn06wqxPaFO5ZyJGkFbGubGV6sPlKKvNwUyh8o+5zQTx9Fz9hI4D0JiB2jjvViSwt LULWAlzz55hx4oUJJTg9qzVUDddykICFhV+qnLDpOsGxYp5uQNwZ0XG9wrZUjG8cYHeK 0XElUSSL+ZMR05eLXi/yu9Qb8Cn2wm01IJ1uz7uEX/qSrUubi2wR2/eB/bto7x7oF8L5 Mezg== 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=jjE60Gm5Y36mkPhPQruxckhIKmqwnw0B56Fz5GzXEpw=; b=uqLGVxzNjWLTXuHsfFrzEtoUMQIYPBhIMkrWYREdWmRPgrmKLxwvJRxcngNJkcpEc+ 4cRyFa2yktCM9WytDFKC4vF+Nw+wI2WoZCYq06ouY/IQqlkw+LdWhXA7Gdn+WVPHeNBG WURPdavigRZtHbVmx7xDrQWBR6990bRDY38+V6MpT5r3Oxasx1Wz2n+ephit3VbOyVRv DzdgSnoxjSWL2QMivpcL/wjbt4YLRq5FmEQRMrbovX0pJyTkxUVhNDegWYZtKKTxz+oY BFrCHP3iE8lWODunLR8h6YbRYmikDYrGEaznIvfOf5d4TedgFkQCp36HPwESzksdOgdh 8c3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="XmxUge/5"; 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 e3-20020a056402104300b00447d567a77dsi1797359edu.207.2022.09.30.04.12.32; Fri, 30 Sep 2022 04:12:58 -0700 (PDT) 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="XmxUge/5"; 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 S232370AbiI3KXk (ORCPT + 99 others); Fri, 30 Sep 2022 06:23:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231612AbiI3KTK (ORCPT ); Fri, 30 Sep 2022 06:19:10 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7726D166F24; Fri, 30 Sep 2022 03:19:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664533146; x=1696069146; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iwkpJTduFD9/3UH8yg9inNZXlE0NCoCcELRd9mHB0tc=; b=XmxUge/5q2F+bG1txYiJKl+VUVpZpnrFRTKbfgt1hr3wqkwjGDMXca7A Z/OeJ2JpyxiH+qqh05gO1SKeMKS1jmjNX0xVtU2/z1bkJVQh/cq0nKbKZ NNqGJkzc3TkxwFX1EDY4eb5Ro1XDGKafl4kiii91d4NJuObZrJSnXaC7B wZ6wCxxuD7Qgkg8Lci5ZaH6sDWC8NKGejssZl07C+BfBkJGTb/dpHYX2B psiawRNvS9iJxfrGKa9EnvVi+URSdhBT5cv4U4ddIuoG5wYly0aSBHsfp YBCc00Pmqz+wgNtmzz2EDKerxJr0Lp1a85bR+0ImRJunnlYrfzHGOtku6 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="289320476" X-IronPort-AV: E=Sophos;i="5.93,358,1654585200"; d="scan'208";a="289320476" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2022 03:19:03 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="726807737" X-IronPort-AV: E=Sophos;i="5.93,358,1654585200"; d="scan'208";a="726807737" 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; 30 Sep 2022 03:19:03 -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 Subject: [PATCH v9 072/105] KVM: TDX: restore debug store when TD exit Date: Fri, 30 Sep 2022 03:18:06 -0700 Message-Id: <2e377d0a655a08718b43d0064369b6d0532a5917.1664530908.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.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 de1f55d51784..e80d25ab4bcf 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -2308,3 +2308,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 44c8bdb5b1d0..407216512729 100644 --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -518,6 +518,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