Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp285104rwb; Tue, 25 Jul 2023 16:05:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlHxw+6STPpcBkCBXi8Y9Th15sV/eGD4v8H8uAxeGxrxGH4aOgY9Zg9LSqctA7LjNDrTAAS3 X-Received: by 2002:a05:6402:1816:b0:522:5957:44e0 with SMTP id g22-20020a056402181600b00522595744e0mr202273edy.28.1690326314503; Tue, 25 Jul 2023 16:05:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690326314; cv=none; d=google.com; s=arc-20160816; b=SbGmfh9PVyYG7Gz0aYdmbZOJ4Y2+ifANREXbJdTBbfNdLaj15cJa3u/S00WYtagwZi yWjG8nimx28cLuRuWs8vIFYQ13KGCGggtE8Mrxe2p6bIrf8ps7Dv+IRO1UPFdQN4jX5K UGpscvnPa/2RV6PojEechwwSYJMLBRaIKF1eU9HXnii0pUAsMofy0uATIWMe1dro/ciH LYkPSaxACMv5SgK3Rw4Fkncy6tsqgbVgYm2AeLV3zDLKL5k/goajU9Uc3nCIpmab/bK8 +cB3eZ1vkH2fSKLgsDqCNIkqrIpu+HSRKYM0Ga8FqfWP7fD3HrLlxcjHbmpAyqBV3E4O qChA== 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=ht2HjY7RvnE/b/RdasFF1zwhYu8jjMMCZAYAkn+ajSw=; fh=Q6QK99UwDPY9paukI72GbBkpRPem3ptJxLsOKEc0fnA=; b=q77f+9lYVlzQcHbLXWvQhJ7Uo+1HuRrQWfQ16UpIeKiWW8p2hrMf9uq3VaUAc6z7Hf NpY31NlVeCH0j2qqttPnD/jpu9pNpsPuW2RN8e1panMwjUsgzasSUdY54WgekeeNY65M CYehQCoqJd1XEqVg49hIBL5/Rqhto6Tr3RzydLPNyd/ADOPXnwB7ZL0cORqibPU548eG RHzP1TNMgC/YxxPJQas0lMesaKwK/BA0s1TvvlqtnfB/MGyD9Z3hLeilh886+QbD0L9k syo+SvTu38dI1LwtRvSMeoUdb2lEWXG2ylAMNzuAJzVga6xFSpk3vpdjGTwo83eRZKnf IkSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QdM6EST1; 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 c16-20020aa7d610000000b0051e0f234b41si9059017edr.130.2023.07.25.16.04.28; Tue, 25 Jul 2023 16:05:14 -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=QdM6EST1; 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 S232556AbjGYWVG (ORCPT + 99 others); Tue, 25 Jul 2023 18:21:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232336AbjGYWT4 (ORCPT ); Tue, 25 Jul 2023 18:19:56 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8050A49C2; Tue, 25 Jul 2023 15:16:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690323416; x=1721859416; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fDJTlB5bV3N6Gz25H1kwqBta18u/BfAiuqVVM3y2CYw=; b=QdM6EST1W/fHG47pnIcCSQKzD5tL/6Vanr/2RnvrMo/aEYSOPVizVVjQ pj4DmctmGSv6rRZ4eay7m37HyjGU9Es2zZ42Lx+YQjJzAIkFykM50A9rB MbtR2sxr/K1G8DwMWEX2FuRMOqXT38zG4vYP3QTfcfMnMD+PcCyo66PWI XAjqerJyQXGGm+CTbMUt1cx6zRcWABVHJ+G3i/KlNfTkHqQQH9eA9JZhb kHkg37vvATpD+Tb6qC9I2mOPVc6rKKxyA8F3UBp4egnmI7s3eFItK0xJQ 0GTTz1ALDLAhjg6QIXcEYqhYaHfsHmn/rErmD4jMfXSWNVtSX+q7pS9FN w==; X-IronPort-AV: E=McAfee;i="6600,9927,10782"; a="357863290" X-IronPort-AV: E=Sophos;i="6.01,231,1684825200"; d="scan'208";a="357863290" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2023 15:15:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10782"; a="1056938944" X-IronPort-AV: E=Sophos;i="6.01,231,1684825200"; d="scan'208";a="1056938944" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2023 15:15:39 -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, hang.yuan@intel.com, tina.zhang@intel.com, Yan Zhao , Yuan Yao Subject: [PATCH v15 048/115] KVM: x86/mmu: TDX: Do not enable page track for TD guest Date: Tue, 25 Jul 2023 15:13:59 -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.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: Yan Zhao TDX does not support write protection and hence page track. Though !tdp_enabled and kvm_shadow_root_allocated(kvm) are always false for TD guest, should also return false when external write tracking is enabled. Cc: Yuan Yao Signed-off-by: Yan Zhao Signed-off-by: Isaku Yamahata --- arch/x86/kvm/mmu/page_track.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/mmu/page_track.c b/arch/x86/kvm/mmu/page_track.c index 0a2ac438d647..571c2c40004a 100644 --- a/arch/x86/kvm/mmu/page_track.c +++ b/arch/x86/kvm/mmu/page_track.c @@ -22,6 +22,9 @@ bool kvm_page_track_write_tracking_enabled(struct kvm *kvm) { + if (kvm->arch.vm_type == KVM_X86_TDX_VM) + return false; + return IS_ENABLED(CONFIG_KVM_EXTERNAL_WRITE_TRACKING) || !tdp_enabled || kvm_shadow_root_allocated(kvm); } -- 2.25.1