Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp4118456rwb; Sun, 7 Aug 2022 15:34:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR7WYc8TvtVQqJxEePcQHLRXD423ju5fi62g4DHhq86rq/Bs0ztQq0IrmWnDAKTz8BQPgZd4 X-Received: by 2002:a17:90a:c58e:b0:1f3:1ab5:22ae with SMTP id l14-20020a17090ac58e00b001f31ab522aemr26477831pjt.45.1659911677713; Sun, 07 Aug 2022 15:34:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659911677; cv=none; d=google.com; s=arc-20160816; b=gwBfsHGps0u0BIDKVKZDFduWgHxnkBplxedIVDZUg8gQ7U1AoD12UYdjzRA4LNmB4a qXuh4PhSBEOcIZi5XH2AR5WlJXSnsLpnWeJMRMzHZFfRlr+WuzgDLQnM7ynQ0gIDEef1 20WCPUub8+8VXuW4sPRFkMDQrYo9NqQk2rNR0M1ggFt0Ia/kxOl825zN5mz/ZIx7Z3Iy NoiTDsq3FB1D6ElfYanEfmzf4ooISZybuE/dMfOeKr+JzR4rTeflNVZt+LfWKxFtveV0 DjS8Zo5RX5IpSEDKxk+XLkFpLArKh957Y/hYk7WGFeuWqt56hfMeQgQjIN84EjjHObec owJQ== 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=q0vVnKUh9VP/iW6wEOUodq9NDHXfridCuNPW+3qYo3Y=; b=Wj1JKJhgbnvwvtwL40jSMBrpERq70aTmIUHMWZWVBNyBiCpP0v+OfKKLOusudjmE4h p+f3R/ui2a/EWLimZbHi1KForUP3cu8p8lJexQh7TgkTdQxX7AgL/en0dg+9lm28glOC wokwC3VSYn3dMVTKvknQIFJOufa9EgUld9OJNmTfidagg6i6UPXVM0zkcw4H2XjhaaO6 A6e2WvC1FMNzzkPJixRUkLSKEXEXV7zH+mN9QCAb+1ICVo3ZZQ8gjxM5e25NWZIQLuhy Y4yN9rwL7nGzgU9Kx9uPo9C76+CdaECll8f6VSvjS0iznKouYo+B7gT2npbMlXDIfffM dBGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="MiYcV/gU"; 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 d8-20020a17090a2a4800b001f72cb62bb8si4086536pjg.176.2022.08.07.15.34.24; Sun, 07 Aug 2022 15:34:37 -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="MiYcV/gU"; 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 S238407AbiHGWGQ (ORCPT + 99 others); Sun, 7 Aug 2022 18:06:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234670AbiHGWCv (ORCPT ); Sun, 7 Aug 2022 18:02:51 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B14309596; Sun, 7 Aug 2022 15:02:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659909760; x=1691445760; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lrdUUyGY5FAg5aF/ecsuvlLc8QeY6sIVMwfcSyZ3SOI=; b=MiYcV/gU5AQLzo/yKcYEF+qVZOSXc4hvNBlI85gj6JBtDppbZEhvwZJ6 uunAzxOQwUB5aSDTBub4DMlEMcT0k3mDz8v3q5Fg5lLh0ciQidqfSUDHr TkXVJUfavo/E2o99LYPU4wed7up8CMWLV8nPpn2qKGTJB85jskPjZdoyw CmTI7/AdsgV00IaXBCL6QcMsrBSzrqB2c/uomchM7tN4ceZC/DI/w7lJE j0LIyftvqvrUrMJvy6oHW0MM3Ls/9z7LNuvnWT/pLCcIecNU0XRIV628U RZ+iETDSZJrgL87ocBBq2hjc2IzU7SHGwM4vERfkC4wEQwYfBm2lGMK8u Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10432"; a="270240359" X-IronPort-AV: E=Sophos;i="5.93,220,1654585200"; d="scan'208";a="270240359" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Aug 2022 15:02:40 -0700 X-IronPort-AV: E=Sophos;i="5.93,220,1654585200"; d="scan'208";a="663682679" 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; 07 Aug 2022 15:02:40 -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 v8 071/103] KVM: TDX: restore debug store when TD exit Date: Sun, 7 Aug 2022 15:01:56 -0700 Message-Id: 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=-5.0 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_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 376cc3d66094..cdba4227ad3b 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -2256,3 +2256,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 2c5fda9e213e..2354889df571 100644 --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -650,6 +650,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