Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1180573rbb; Mon, 26 Feb 2024 00:56:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUk78rreEKqanRgSFrxYA7ou21HwTv6f41a+rJZCKdxDnvKWQUp1XAWNwySO0dONInY4v3Y5OLkw7VoMIi5KZCtNi2K6gnSs06hUPdeJg== X-Google-Smtp-Source: AGHT+IGL8REMqSzMdfAn75a7AflQ+XjkRzKYs8h/8agOGMZXZKtXpYkDZ0JcUVRY6bqSDgQe6ubv X-Received: by 2002:a05:620a:4d11:b0:787:a5fe:9d82 with SMTP id wa17-20020a05620a4d1100b00787a5fe9d82mr7612963qkn.17.1708937780076; Mon, 26 Feb 2024 00:56:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708937780; cv=pass; d=google.com; s=arc-20160816; b=UjdnHP61Zh3L+tnplXOSOSMK2js4OM83/FSToP0cHkeafXh5f0ri90gHH5Nw/HW+ev 5O6TgCNRt5er5advNTQBq8O6d0e6UW327Hk9ZHS47zdGZaKVCvRWH/9ER0XS1CI1/vSI X3UUFQJJi+5cKzLyal33ZrqmluRUKs1MqCw362f5HO+mcsigHxfgp+2wOfhiJX8nOBt0 JMiCKensmU71wD5NXlh8zKgauTL6eedgXe/qBGPAS5YyK9VNZ8OvHDfAVZnNV3GqKShM nJOAxKuURDbbAnEthm3w0QYArnWn8P1I04YbBop0okwIBdx0CKu1I7SnXtDi6kFqvcAT mwnw== 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=8NK5Mx+N83uD6Xg4cTRYfZj5G/IZyeqf+V/UXFHmO90=; fh=Itbyk7CEvizIrzGEESCqq3I2tZgG1kc/GkVOa3S7Hsg=; b=EO5CNo3xW6NcgouAVG6J6ZGRU43UFS0zKSMYe8GFb3gO6rmM3xME9GmYWas1necM3B QlrA10QWJTAUN7YCt31m+2vLfwDWaYPEEmnjBsMr/sv6Ris66dGv8nBLz+nMcfhMm98e v9coJApnueFJnZdhfDMaNtHaZhg5X108GtCYPkzmdKrzXhFVW9y5yIKguyFIxFvwQyEH MsjAI+uDT7PVNm6D9ho6l6tmqZ9QcnmKVgYwIy/bA6ZxsVBpEmqhtqc/y3rJBEPTWCIz TpJMKyZ1wFejSUjszl7EvuqAEmjiFPMr+mC3YvjDMguy87Wpw+8e5arjeDN0O8tLZ1Ef E1GQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fjBvjtBD; 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-80849-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80849-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c42-20020a05620a26aa00b00787c6ff2d1dsi4476481qkp.212.2024.02.26.00.56.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 00:56:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80849-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fjBvjtBD; 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-80849-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80849-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D0CD61C2161C for ; Mon, 26 Feb 2024 08:56:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A0D467995E; Mon, 26 Feb 2024 08:28:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fjBvjtBD" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (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 B41C877F1E; Mon, 26 Feb 2024 08:28:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708936125; cv=none; b=o8Tfle4jvtAjxltikrT+OgvbYciQtvAkjvjW4JaGeCbtbAOqTRGyO4mPmfbd6TV1c2IiNtnenHfSVfJwN2oPsPeCR2dwGcNU1HnP1458FTO0jQ0SD2aTICfN0x7N4oT6KGP/ETpRlJbhK4xSbM/6hR74A4uVar4CJVaZopUbQPc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708936125; c=relaxed/simple; bh=myKJ2+UbusG4kdK0f0eyTWXSAekqS+lLcnY6mljYNTQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AYuirMiUVGXd+84OsTRSub90edb96Gwtdjod4GOsYkcyQZeVl6Pd6H/UCJ+ZKWD8G5yg4ZZLw9pWo4L1KnuIYWXdMCmHBe5P5bR1RmBO0aYXqVZnODSO5H2RSg0EZSAKUq4apYRNOrnNXWnyRr+/0K0DNza2gUPz1phOYl8kJBQ= 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=fjBvjtBD; arc=none smtp.client-ip=198.175.65.19 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=1708936124; x=1740472124; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=myKJ2+UbusG4kdK0f0eyTWXSAekqS+lLcnY6mljYNTQ=; b=fjBvjtBD7SV3uB3T6tDxVmrDweBu1mkNEccDin1Ru2NIzBqVZK9pN8tl UnKYKjZ/fDVFkd7WXeqZ4R5H8kRON7A/4bnbvuNHBVbYyGCUQ6skjtvbO bKksCrc7MgM9ijLFOgPVLGwEzoVchZc/Okmy5WzqY5vVGgiq6OuBN+bye kvija0MnXYurYGKrBN4KwlgSiQTRMsGs8FW2qQrfkxawCKOd/FN6+L08d tU7K8DZdKv/2djfYXDC/pOt9hCYTMLTGAEnk4F2lzWY749cgd9sdJAvwZ nVKHEhoR1opUPMnlA7tgXxhbVpHEkPjXuWwXNvPbVb7Zh5DZYVuSQoH4l w==; X-IronPort-AV: E=McAfee;i="6600,9927,10995"; a="3069534" X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="3069534" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 00:28:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="11272593" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 00:28:43 -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 v19 086/130] KVM: TDX: restore debug store when TD exit Date: Mon, 26 Feb 2024 00:26:28 -0800 Message-Id: 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 b8b168f74dfe..ad4d3d4eaf6c 100644 --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -665,6 +665,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