Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2689875rwd; Sun, 28 May 2023 22:17:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6b9+ruvOLlSetdvsQLqAQ5L6f4ATh+tCbmNrnIn1IhdOdYDbJ41cNPlOgFSKL/4n8Lk+WI X-Received: by 2002:a17:903:230b:b0:1b0:3a03:50d0 with SMTP id d11-20020a170903230b00b001b03a0350d0mr4097423plh.26.1685337432287; Sun, 28 May 2023 22:17:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685337432; cv=none; d=google.com; s=arc-20160816; b=gLD2VydnoJll6PQGPvCo4qbf8zN1pyhzOsM22F6PCvRgeYs7X3zyNfuN8DPMwnqA5w 6WfMiPPGySHedE2ZaTPkpUQbfI978hwLVByCz+SddWTwGmFOB52XijGlpjT32+zaIvhg 4N4CG7LuhVu2Y10KRrSirws/E++gFYcxtNU7H+qRbVReyWFYN64jkLK7//ZTC43kmUR2 2dKXN17eL3PwB4CLCpn2eYkBrciPKAmhxkBbqkRj/fotjeEiMBQoF3sc3zh4E7YN1RBD MiCxZqkq8/VnxvpgDG1J6uGalYGJaxmSItWQOkNlXLgAKyqP4yiJM6xXe4iN2ROFjz/S L8dg== 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=368JRMjKVzpb2qNHrIfs4CoG1mMR6aUJLXEyW8h5GB4=; b=mU7xVhDfNdI3J9QhksAsJD9uN1VeoH4R2bOImSKslH4WeVV/Uufec1i6vX2QBwtIRm USZSi5hzNj1OeseKx430+kiazz1cBFu6d7+6n+Jh+jNNg+U+PXzI7+JxpPdqjQo+y2Qh rsuqH6oKfjHom5bvYix3jeBqgs8WDJsyJAIhR1k6I2hyl8ZhApb5NXCTAM1UpwE7iTKK /kBUuNGBN3UsSb0F6F4jNzUvRlf3ikL0WWkcGwVHtbisDOeHm/o9klhooUO6V254rXsm i4PEQh3tb3wiZcDZG7KM8L/kwIttzKaWqbvHBWsStzDp5b813wnC+CMVOgDO8CXS/Lpm J7MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hhEptweC; 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 z4-20020a170902834400b001ac9ab8539csi6656371pln.77.2023.05.28.22.17.00; Sun, 28 May 2023 22:17:12 -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=hhEptweC; 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 S232212AbjE2E3P (ORCPT + 99 others); Mon, 29 May 2023 00:29:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232119AbjE2E2Y (ORCPT ); Mon, 29 May 2023 00:28:24 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30F0B115; Sun, 28 May 2023 21:25:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685334301; x=1716870301; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GAaxy0ul3F15FaxDa/X6ya0I67REoqhkaBgBuvSmG6c=; b=hhEptweChnQMM2cHfKEYSZ/ooe3FrAcm2cdKG7RCcNCNiiiIIPz4l2uh O1rasBPoJAX/vVRf4JsCZIY+YsKN9V4Q2d8HRJNLk4DuVUhzajp6nPQY2 99nGL407kPayPlsNj4QLtJW7iVJi6MPdxXtn66to9JmE0u7ZbvW0+wDhp q7PwBX2tFACvlClcX8pHtJ4OQau7E1o0vDD/YUv7uWTs41jEPYZ5Bf6lS eme/QTAptN9HtcrjwBV/Z+lKsAl7BHOdXf01sgvszRvvC06XBjhl2q1uK 9zM+jjoXaalmjDHXdPJiQ6ZvmteXM0gK4bY+91zOIFfLDBGGUd9RGa1tW w==; X-IronPort-AV: E=McAfee;i="6600,9927,10724"; a="334966165" X-IronPort-AV: E=Sophos;i="6.00,200,1681196400"; d="scan'208";a="334966165" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2023 21:21:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10724"; a="775784446" X-IronPort-AV: E=Sophos;i="6.00,200,1681196400"; d="scan'208";a="775784446" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2023 21:21:28 -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 Subject: [PATCH v14 071/113] KVM: TDX: restore debug store when TD exit Date: Sun, 28 May 2023 21:19:53 -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.6 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 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 3ca866d671df..cb29d9c946ce 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