Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp555854rwb; Thu, 12 Jan 2023 09:16:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXvoXsrktSYXAQsfticJGBVXFu8/GJNSKYIBzYoWhmEWFNaLtVubYSH2tbjMD6E9hheBiG0W X-Received: by 2002:aa7:c796:0:b0:46c:aec4:606f with SMTP id n22-20020aa7c796000000b0046caec4606fmr63628532eds.23.1673543776086; Thu, 12 Jan 2023 09:16:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673543776; cv=none; d=google.com; s=arc-20160816; b=kqHK4BYhZEQTzJTb7kE51L8ac0mRsl9CnupKERS4z2ZFLsxK25DpbR2gVIfl/jd+K+ vgwjK3UqsoPg4rhrWFNqAjZk+GIf5/jdxVfZgviO7Z1BhcupVKsOe0fYrz3siI4Y/Y8h PZcvbTtbhcNRKsEkgkuo/6q3XX0ln7t2fPIbWy0jOF9wz9YbhHcBpyJ5/vUxwqUlaLjM zvAMZiWeNRpYGnWdMsOOan2J+q02bWoW5Hvb+QlG5hHIL8edmFYWDlb1+ejPzGV73pqX 2cglpGGLATeHg9EJ81qZzQLBwLhCa6qfSrpqMJPvbLmKJg9M6j7PmNWISNy4K8429f62 HTyQ== 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=; b=jHYxTUzpFFr5IutsZHhU+HtcP2+GXX8UN69suSL8dOvu9NQCGVtEofDNVImtPlNXhu 0y6Uc5Ca8S+Xe/EgpjP0xfPXhJWlufmiUZVo5lStCwnSMsIzv3oR7vBD2v3jRDVLW5so uPThHg+LFGpNX8U2sSlhsbcV9yyG05ZAoXhW3xDK3Hp9fJWjjEIMN2F2kLa79dHv/JJm jw8De+wAT8RTZkKt08hO6FS2F5NgfrMLmvrqB20D0802bbKcquNfR72TDwlh65hXQDrM Lq3lliKTVyvpgoiVjGiGjqrijpU28zCpM/sz7WWzDfzoLP8LmxxNTCs+zn9KvhiLwo4i vxbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bj2IpaQ0; 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 ee38-20020a056402292600b004591f959c3bsi15902519edb.427.2023.01.12.09.16.04; Thu, 12 Jan 2023 09:16:16 -0800 (PST) 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=bj2IpaQ0; 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 S240922AbjALQrf (ORCPT + 50 others); Thu, 12 Jan 2023 11:47:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240222AbjALQie (ORCPT ); Thu, 12 Jan 2023 11:38:34 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A5DF1C905; Thu, 12 Jan 2023 08:34:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673541245; x=1705077245; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fDJTlB5bV3N6Gz25H1kwqBta18u/BfAiuqVVM3y2CYw=; b=bj2IpaQ03BIShEhZdfEQttW4dc95+5oJTEHkIKGFAoM2Cxh4jLGlXnBU gN1TGEdLvTIbcGwCQO+qa+xQ/UH9mf70lvIgTbLdQ+v2sI9o72YC4654L h9lwHHVhPfyJHFwSzcRdH9E297QE1zrSTr/Pvxf0aidk8FWHT6a/jpeIJ CKiVJ8jwR+IMaaXlwZMZik+gZYeVO17OKHwRQmC7WMXnYAounZwysgmPp DUHD6ixcWAdUr8X6dZmRATE10xr4EMZHWiPeUYBXQAmFlX9RO+4gZ6Iu0 jxXJh8DGp3x+CSvCZZ4ai7+9mRGfvwFjU4Qp9Do37YgiCbDbr8KPzcWuu Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="323811890" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="323811890" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 08:33:28 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="721151805" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="721151805" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 08:33:28 -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 , David Matlack , Yan Zhao , Yuan Yao Subject: [PATCH v11 049/113] KVM: x86/mmu: TDX: Do not enable page track for TD guest Date: Thu, 12 Jan 2023 08:31:57 -0800 Message-Id: <9fd3d613e0e83a8828b3529fe3954bcb4cb9f400.1673539699.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.4 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: 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