Received: by 2002:a05:6358:795:b0:dc:4c66:fc3e with SMTP id n21csp1441564rwj; Sun, 30 Oct 2022 00:24:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4y0yabnCpggDM87SxSdAo9yI1HuDK4kHlu7xZY6RfCwEs6ltuq6iY4cncmcQdGRSOsuFUD X-Received: by 2002:a17:90b:118a:b0:213:bbbc:8f09 with SMTP id gk10-20020a17090b118a00b00213bbbc8f09mr4621880pjb.64.1667114640204; Sun, 30 Oct 2022 00:24:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667114640; cv=none; d=google.com; s=arc-20160816; b=x61yrHYAMJ8PqWRGmkGwGMjWuHSxfd0nCcRo3s2miOAtNJQA6GIx3hTkwYfgxAfx4H 19u1Raz9SAiADFXTMtPuDX/vAaWOWCJgSqeuomdkKiA/3GV3DDsa8Cy0DMB9nFOGvKmw mvTYTAFhX/Gdn1AfuFDUmRGuy3mYIYqF5KtOii82qlI87G8EXPvY21ppaV1oUA9NK79J HKQJHIa/yG5WtcslL8Ez2Xe5HvcdbaiCRgxAi+Q0k1UQYSmkpMcKvlUZWnH0adAJ7oTb vMarfr99UlmYz2kpnspJAuv/OMij+NnUkDP/5PJ2W2WAzmsUI4Wl/S8c4lE8oSj+J8ba TScQ== 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=0063pmI4F92CwXB0ynWQVFCNIWIWDc3gQ+WOPhjT3ew=; b=Of0YQbwhrNqwOFy9RWrZSglfW5azUx0rdYwvp7eXA1C8VvOAod9mhej5GdicdM1rlN wIw2lYqWaNzgRgFjQ7kmrGUsAKuuesK6htqr2IKZBJsJR6T2NO/7YKMmUVlROG817Hb+ yCbCMIminIUU3IrfAvmBYuoAxq2MjOFxXS0N30B5YxkvciKTJfrRwh4tJFTmGsAKN6YO eWuj9WyyTjk5NOL78G0WlgbaLZHlKLx8CwB2ZzjcRc2hQCnGQrb5ofcWxY08zg6Cn2k7 7OhEEjlSPhI14qSRd/U4zE/Ecy5JG72LkWk3IFdfeROsB/OD2MM/zQfVlEWVmgWwis7y U77A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hcXsxHar; 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 j4-20020a170902c3c400b0018668e41784si4164703plj.13.2022.10.30.00.23.49; Sun, 30 Oct 2022 00:24:00 -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=hcXsxHar; 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 S230156AbiJ3Ga2 (ORCPT + 99 others); Sun, 30 Oct 2022 02:30:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230312AbiJ3G2X (ORCPT ); Sun, 30 Oct 2022 02:28:23 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DB462C7; Sat, 29 Oct 2022 23:24:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667111078; x=1698647078; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CH8X9PQ1WntEbptpMuYy9mmJ5w7JHl1yNfjV5rQQPzI=; b=hcXsxHarcNvdltYyWkaBAfAHAcxRbMQFAIgQD2awQLZ1k2hENr26t1VE 2UbKTqPKtwVyZVV50hvGnwA3WPi2f1Xv8p4HZgP5R4MMu8MNLgXHXMvDY Si+CEY9RqPT8Dz0dTqsLXP0NQOdqyE/H4Vvl4VUkPI2EcrqMoMT/PzGb5 JKVydd70uapscre3c+Ey9+vLWkASsbEahVf6Kiy+SfZ6GJBN5a/t7z/6y JbXOt5/2eVkGQJ4PfRpE794I6WXOZqdH2gV1SafRP6Ch/+UUQeH5yw47V Xf2JwvS/gtURev2KxEHmYJR7K9ZmGyDHCcwH1nsevY3w5W2Z5n8YbmWbz Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10515"; a="395037188" X-IronPort-AV: E=Sophos;i="5.95,225,1661842800"; d="scan'208";a="395037188" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2022 23:24:10 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10515"; a="878393086" X-IronPort-AV: E=Sophos;i="5.95,225,1661842800"; d="scan'208";a="878393086" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2022 23:24:09 -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 Subject: [PATCH v10 075/108] KVM: TDX: restore debug store when TD exit Date: Sat, 29 Oct 2022 23:23:16 -0700 Message-Id: <82a23837a7d35c4144c5eeea6327a8443f0d1be5.1667110240.git.isaku.yamahata@intel.com> 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.9 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 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 7839507b3844..5c310a951a0b 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -2340,3 +2340,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 af13c19af339..5807a2f564af 100644 --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -526,6 +526,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