Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3416838iog; Mon, 27 Jun 2022 15:56:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tZn9xtVx8mR0Nn+JAENw2USwzjqtU+MzDHRkOdsOJs5cGo8xLrzgDCmu1FDl0WafHi/h/M X-Received: by 2002:a05:6402:2497:b0:437:a341:9286 with SMTP id q23-20020a056402249700b00437a3419286mr4836004eda.156.1656370580606; Mon, 27 Jun 2022 15:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656370580; cv=none; d=google.com; s=arc-20160816; b=XptmdMSmQoKFFdlWqFW1ubQrlrC15JZUH502D0VmzBqqY6beoyMtxClz3t0ICnTCzH X90B1y3nxSxpTCEslCbrdqrzaVD3vP6MlyXRwtQjToZPTKMo1kqBd0IN98lUVQ9H18Iy JdTU3K5VwV5AShRlR0T93ux6WZo6b4gB54saTW7ZJl2DZ+m/6SZzCFA58Cmyz76QYM+a oAq9fUGAFOsgU7LRyQHm58NeB3RWP08tyCKPIgyK+ucJ8EB9lTdqcZ3qDcZNyCdVsfb1 hu5zrr0OQM22k+WanuyeJuzQyCfOP3CP8n70+WxntUzM2kYvULCGor28chKRHabpbgDh kTow== 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=N7L/QaOqqUDOb1VB6n0Dj9J8U7z6X/KUENxCuR5vfOI=; b=f6V0IKWOojGIJ68Qii7B4xPueagbzOHQyCCvOPWO3t4/CwzhGeqXAgPm6xnLQ+gqw2 DrOJN8sWJ/4MlZXL/lhyfgPo/4GRvJn4RcGLwXEGq+R+mvYTeuIlMqkOABd+VrqDD0wy Q6sfjpxNcY1NT/V91UWRrVx1MdMloYQwv0D0XrTfWYFOu0yQrX0y2RUfkf5nidSM/M2I qDOcDzrvP8TQKUBE3NyVPhGXBYqsICpESlZHNB6VJDGexSazbe6vzyPEb12yOuzHWrIR V5Y0NRTv74mfLpRamnKdQ2EF3RxY3A4+P9a7uC/kbLo7IX5Soy4LQxg/RvnS+un83q6h uHVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LPXa6aXL; 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 hr20-20020a1709073f9400b00726a5db994bsi5352122ejc.477.2022.06.27.15.55.54; Mon, 27 Jun 2022 15:56:20 -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=LPXa6aXL; 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 S242229AbiF0V7k (ORCPT + 99 others); Mon, 27 Jun 2022 17:59:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241519AbiF0Vzb (ORCPT ); Mon, 27 Jun 2022 17:55:31 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B316BDECF; Mon, 27 Jun 2022 14:55:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656366902; x=1687902902; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YTRyMTy4Cbklvo2axfnNj1XLWBlbWaoRN/EJpr2hGEo=; b=LPXa6aXLJNVkVV1mv0qcuePg+wIzndrbc168IwJhJfKNCjeK1BjCGLFm 77VdiQwTnt5j+lU/sC0PjP99epgBtuOLdiPa9rqcWNxHZKCy/9pbBKFb4 zBXIOfENj7PZ22ONhhVuBeJjIdTl1nSm2tRT69ppOeKQ9BrTZPJrjeYKQ sw/5LKSWSF8GY50OQxajNO/Py+i8DyYjMCMdd/M9TJsVr5bjCLaLoz2i5 16UCZLszhpKxy68qKUDauZtrrfA2Rh1d/whBl0lsGuFl3YYAv3OTkOKDu uQ8PEvhg74zm+bKEu0qIENPTmEMyfAARHBPbA1DAB5MlOdp+iGEFj6J6X Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10391"; a="279116113" X-IronPort-AV: E=Sophos;i="5.92,227,1650956400"; d="scan'208";a="279116113" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 14:54:58 -0700 X-IronPort-AV: E=Sophos;i="5.92,227,1650956400"; d="scan'208";a="657863667" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 14:54:58 -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 Subject: [PATCH v7 071/102] KVM: TDX: restore debug store when TD exit Date: Mon, 27 Jun 2022 14:54:03 -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=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 376cc3d66094..cdba4227ad3b 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -2256,3 +2256,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 c9cb9670f7cf..0de113a643e4 100644 --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -663,6 +663,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