Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp392954rwb; Tue, 25 Jul 2023 18:02:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlHhnB7tuGXvCAmxMUTfTgv3SsNy5skLSjjBsSR82qerwvy8mp0AyjRlWr+8GXGeIkJ3R6pc X-Received: by 2002:a05:6358:991e:b0:132:d42f:8e19 with SMTP id w30-20020a056358991e00b00132d42f8e19mr431617rwa.31.1690333333886; Tue, 25 Jul 2023 18:02:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690333333; cv=none; d=google.com; s=arc-20160816; b=wdWcvLaqvfJb0Sn0eX6O6XM0+KEAeakVJj0Ps9lOAtnvcKVqtK99XEo4UIgHxZ3KZM sP9o/DxBU7YWilLyUglWj8r4eNJecC1sfcpPl4kw98j0/YJpIH0L9SsmrdMMeoj7J70I 1atWLi6eDlzh52G+LPWNtUUyuKvyrxA1mp1i7iOYvm05KYsx6enRIDJWlCSHO0yk499O Jvt+0EimXjw41tOVjZ8mMqNSHcDH485DPK1VaZVEzJfcj3ubkrKJMHJEuu8hHdRTMY7N +i+vJbmxGumcMTw2+zLI0PkGGgCMsoLnVA6thsTSpEuH+Ru1W5rWD+JEH0bL/xOaytx0 X45w== 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=ULvDD09wc8RHWSZllXc5tEWZDxEU18tNJPvbvWMs4w0=; fh=juxwNcA6iKwLISFgUCNwdoIYC0NKLUseq3xZdq25RR4=; b=FzqYrzbDC3CuaDvtk+12M3jaNAMig01OJo6/BdWze9mB0icawmicroG+3AocZHLntQ MIlkoR6muutZzkmKstk4q4U25Oy2MIVg2oVoodL5L6rSGcUaTAPGGCdq0z8IRJOj9qyW Tj/adTxM6unP/XvPhQ9kPX/WXHT3hkPErfaEB0ByRaI0XkpUjvIvlK4gVNxc79GinEYI VKrHmuveM+Z5sfC0fQxMsJQTj8N2A2VgiFJqrdbyMNd5Vc8zkEuyBgntT6Ud6krHDQg9 GO6zarPvDlrlSd7z4CoqLE2qw+WXVG2Nt/SndJvPIUdmLEATZmQgkwGGwF84ZhcB4Igy H5XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ghL23Os5; 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 u6-20020a63df06000000b0054ff717395dsi12251437pgg.691.2023.07.25.18.02.00; Tue, 25 Jul 2023 18:02:13 -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=ghL23Os5; 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 S232086AbjGYWV2 (ORCPT + 99 others); Tue, 25 Jul 2023 18:21:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232467AbjGYWT6 (ORCPT ); Tue, 25 Jul 2023 18:19:58 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BD6E49CF; Tue, 25 Jul 2023 15:17:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690323420; x=1721859420; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hN9pn4xLjC0uRDj1rBgILXa96lY/y2sl8BLB+qTChQs=; b=ghL23Os5EAbzmZBjRJcaf7lyJ955buYaNCNcvjvTPs++MOVeQysGaj8R TcQ9QGgnX/QaAYmBmlwNMY5kf0SAwQDSxHdWg0b3JWvvVJgctV1CH8Ztq s6u3vT4NO7a7aLQsqa5/v7rsfq/L+NiPVfJMhzecnCl9iDtuFphbT+lXx nqhI+Mgkg9GtLvy1b6YwX8HUGuOyjFu2hXfnjZqCZ8i115Pzby9BzDssx DPM+3H7EfO1TbjbGQX/wayQIW/GLaCeeQPBKkotzXm6kXU2wRFhU2yl2K kGNZL9x8UVGCsWU3sD5POo6Od+kLfyNkLA7dvhWu/m1nzBALl4Qtd7HW+ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10782"; a="367882579" X-IronPort-AV: E=Sophos;i="6.01,231,1684825200"; d="scan'208";a="367882579" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2023 15:15:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10782"; a="840001814" X-IronPort-AV: E=Sophos;i="6.01,231,1684825200"; d="scan'208";a="840001814" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2023 15:15:54 -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 , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com Subject: [PATCH v15 071/115] KVM: TDX: restore debug store when TD exit Date: Tue, 25 Jul 2023 15:14:22 -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=-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,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 df88576d6b2a..71d0b95b80dc 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -2423,3 +2423,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 6e08d4ec132e..b46bd963349c 100644 --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -563,6 +563,7 @@ fastpath_t tdx_vcpu_run(struct kvm_vcpu *vcpu) tdx_vcpu_enter_exit(vcpu, tdx); tdx_user_return_update_cache(vcpu); + perf_restore_debug_store(); tdx_restore_host_xsave_state(vcpu); tdx->host_state_need_restore = true; -- 2.25.1