Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB2BCC6FA99 for ; Sun, 12 Mar 2023 18:01:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231551AbjCLSBu (ORCPT ); Sun, 12 Mar 2023 14:01:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230311AbjCLSBA (ORCPT ); Sun, 12 Mar 2023 14:01:00 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 681616581; Sun, 12 Mar 2023 10:58:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678643926; x=1710179926; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bAyBc4s3tiQ/01jXFwZRD2ovwWFrfG+pQJPt5k9h7e8=; b=bOCXdUqKwCZcbv7aDLHtivmNH1R5cs0yBzaPqvrWIAL9HrSdnDLnRncl iSibSqV0C6d5fDhbNHtLRiDRGEcBYa86YfImrap7iJnwlnKPcyQsyrR69 x8XRftyYohVczwAD0PwGKOLV/obD8b9w9Y2o3TLiD1TMci6WIFn3iIMMy /GNca70x5x3hqYgcEdoSSh0FxTr6o3iXNDqaUGFKoydwXJ9f9suO72cBo FhBfF4k/MxSS8xA7R8Nai3bl58iUDF0dxfRtbKpmP651SliWyP04H7OQa rgAND7/o5SJ7tHlIhVN5dA3hMY1uZBH9o4gJ+5kASBVp51RSMBO5etTPg Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10647"; a="316659891" X-IronPort-AV: E=Sophos;i="5.98,254,1673942400"; d="scan'208";a="316659891" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2023 10:58:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10647"; a="742596643" X-IronPort-AV: E=Sophos;i="5.98,254,1673942400"; d="scan'208";a="742596643" 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 Mar 2023 10:58:05 -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 , Yan Zhao , Yuan Yao Subject: [PATCH v13 049/113] KVM: x86/mmu: TDX: Do not enable page track for TD guest Date: Sun, 12 Mar 2023 10:56:13 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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..d738d318ce17 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_PROTECTED_VM) + return false; + return IS_ENABLED(CONFIG_KVM_EXTERNAL_WRITE_TRACKING) || !tdp_enabled || kvm_shadow_root_allocated(kvm); } -- 2.25.1