Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp167177rdb; Mon, 22 Jan 2024 16:07:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IF5CLJZOcucqisoTWxDyBLVaG+SbAokhDmPGPeaQQV6IVcpJOC8ST6/uItD3q2Z1PTZUacV X-Received: by 2002:a05:6a20:160a:b0:19a:68b1:e974 with SMTP id l10-20020a056a20160a00b0019a68b1e974mr2565095pzj.86.1705968422800; Mon, 22 Jan 2024 16:07:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705968422; cv=pass; d=google.com; s=arc-20160816; b=axacVdjnYSu8qIvqsae7IxXG664OJenxaRgFDi9mOyxt558algXg4I9HJIHDHiwVg8 qrELjXaM7Gm0Mypvgnootr+93pBTaOpOzUNdQpguLQlrOCQVTZIVfurn4gpoF7KDZduX TtySCSDSnLqmrCucmU4fFhJq6ir4x2Tn05+f7I7sWoXcabUET85bM6jgoGaFV2mmBJt4 ajFmQOaW+xm2/pQwGCkZFhgw83TQqdm5f7iNtuzoeXcYSLK0pQj3+5NBpqqJVWtVm7Rx pYSze4BS5rgobYho/gPaCDUWCbcTTSCdgUCKdG25dewmgH+h3TwDhmqc8TajoxDpEhIy ZYSg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=PaDQYTs+ACvWyRYWZPq3fF3qQ1ognNAchqSKtN58Qws=; fh=Itbyk7CEvizIrzGEESCqq3I2tZgG1kc/GkVOa3S7Hsg=; b=V7B6ad/7gA8PBw/5c5C+twomu0zeRzE/yMoXPW9Q44OcVODaUVMuesmk4PXbJzrEHV m1E/f7dz5FF8+lv2TJtA157C+GMGFvXIMjaigUtvpnb6YnDwkFhnYi3UgDm7osWICFQE THqNvIb7Hr2diKFUlbnxgIQkvizX20BUx6f5TSkvzTAUQWjkoNu/SipdTfZQuT2WyTwp mcaUtE7UOuxphcWfqwcuUodmlR9prVtOXsYR5erJOrHXs0PbT6H/9f4PVCLSpCfGwWPq JTqgZGY8Oid2GReYAkI5751rQOo7HLeMSllU1FBDV+5akLY7nyrexFtyTdxJLIvXOlWq bIWA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=h7B9E1tj; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-34369-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34369-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id t8-20020a63dd08000000b005ced390a1a6si8568470pgg.624.2024.01.22.16.07.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 16:07:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34369-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=h7B9E1tj; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-34369-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34369-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4BD58B24A98 for ; Tue, 23 Jan 2024 00:04:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 82E6E629EE; Mon, 22 Jan 2024 23:55:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="h7B9E1tj" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4965F60ECA; Mon, 22 Jan 2024 23:55:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.55.52.120 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705967746; cv=none; b=qQmrQdKRWcS4xIg3FfypucnlvBqZQZTTOFU5Iiw1VsqVAr21qB/LPV8hAS6u2W5Vynkadgxyxpd+s1U0zb9x73kt3zbzEGLSiQeV2JsAOVksz4PwpZ1aV8OUM6naY3oWrloFO6kfsdrBA8K8dPwlUlYw82GUUIK3hyY9GVUZwCc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705967746; c=relaxed/simple; bh=T3zzp82ffDW6xJPkTdQ5XEAQN5qO3N9Dr5YafHIr2ho=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=aGbxqyIRR8zRhRwA/eoJb83m9qksIOoarvFDsQ34P4xV/X1aMX0IQaQrdx2dak3TXRJPAcHoHLoasSTREwnLD5KroR0TDk913CVsb6febDmCHocur3IYBQGXGbbTC/NTPoq4v8IVlVwCPJ9PEhwkWPwyOFplWCuWTnKMDVQOJiI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=h7B9E1tj; arc=none smtp.client-ip=192.55.52.120 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705967744; x=1737503744; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=T3zzp82ffDW6xJPkTdQ5XEAQN5qO3N9Dr5YafHIr2ho=; b=h7B9E1tjO8XWBs0IYyD/uDC4PGsQhovEkGlZx6wJEuhCcwsn9+xaeFfe LgjWVY+A7mOaC7ASxUipcJtsXzP0FG0y9YSF0N+i3E5PS23eYaUQIwntm 9Pw7MSjniHOaClmIcwrQ6pmra16u425fcRLDNEhzItMiT1Siqyou82sFH YLe3zMUlt3dxBe/RslB45Gq57+8NIMCv+Gyb86nu8IpBM5T/QuIDuK2Zv y2dECCsdZYYGSgV7AF7vAxPj1sPT2NipBdx0kO9gPawnscOfK3FxQ/rBY nzaAgmaMZWLqNI8MBo7p9wha2P8cmHi4mXqJ0PPAxMovS1f4hT+vXUKhE w==; X-IronPort-AV: E=McAfee;i="6600,9927,10961"; a="400217760" X-IronPort-AV: E=Sophos;i="6.05,212,1701158400"; d="scan'208";a="400217760" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2024 15:55:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,212,1701158400"; d="scan'208";a="27817904" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2024 15:55:41 -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 , Kai Huang , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com Subject: [PATCH v18 075/121] KVM: TDX: restore debug store when TD exit Date: Mon, 22 Jan 2024 15:53:51 -0800 Message-Id: <7eaf9c55acb56cb6d3d74cac34fdf1436fa2465b.1705965635.git.isaku.yamahata@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 d49d661ec0a7..25670d8a485b 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -2428,3 +2428,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 3b2ba9f974be..68a8d01c03bd 100644 --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -715,6 +715,7 @@ fastpath_t tdx_vcpu_run(struct kvm_vcpu *vcpu) tdx_vcpu_enter_exit(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