Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1178074rbb; Mon, 26 Feb 2024 00:48:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXakbLOzkb8k/bkXJus50Nnk7zBn0RooT8T4zOdZZfvd3HesmmriQ+rV09+JoBQV0dgXHzvt5isTi37sNt4YdDFFJIf+j5/eTx9vx+WYQ== X-Google-Smtp-Source: AGHT+IFzujN5DaOUTKMG+liPkuftlTB5DFmJ7DEnQYZ0svl21Mdwu/IS7IYD7ybE6dBZ3QM0XbiA X-Received: by 2002:a05:620a:13eb:b0:785:9c70:c7fa with SMTP id h11-20020a05620a13eb00b007859c70c7famr8031275qkl.1.1708937326065; Mon, 26 Feb 2024 00:48:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708937326; cv=pass; d=google.com; s=arc-20160816; b=kUAw7OIZHkaH9WQEdwA3IcTOvFmQp5pNYfzc6K+f8jUKEFIcC8lZhhJW9tVdiHRcWl 1TfnWLZGAm0v68BGQg1Bgd2dNarakr4UgBtf3njaoA2ZdPthxDWotDf29fayoFdoDUaN B3ED0LCkX46fK7o5mEIcZO1w1vCqZPkgEQMjzdsOLrlc1iiFLzNscAeL8jVgyvaP2vVB bvW6HIIATOs5hZmiuthUy9cOOebOPJNiEwFg4+8DsI4eIvla0Foy7AwPte5h9NuZUXLW e6k8Yl4g7sJso7O0Ewtcsn2zeh+bgks/zSUzTvV5MvBh977d13ly0pNGaZFt2gu1gZMg ixNQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=zJoBG+BruydwgxONsR+juVL/cESbkNzdPgzPrrzMl2w=; fh=xZotvRNxMe2x4CH9zH/JwWgGfMrBY+UMUM1BbxIsq7o=; b=vz7fNxfELZJoKxJzxKS6v29K6BDVk7YTXXBEW9e3OIc1JXcwV4/lmmZzke7DDoG1g8 0tUkBwZ2uRqQ13KAY3UUrDWTnPRIciIDrAQuqgO/i3vAd2JizrKIKNsta+oXkFqEchbz iOXVMEq9KN/Ks81kZwyfMmvkwCJTxCAeXhavukNDt0fGA9U8tzK/x0Fj3GUUYvl9mkXC CRt8NqnKwpm8xKgKMd7u2L/hWzAa749JIBxx/n0xat4eUXrbzbyDVb5P9fyT42C+Ip7e qJeFmhbMnCjWdTsQKo8yZcavlqFAjcnHCasHHdpxE8bLr1bVC2bMBDIrpTKMGRtanuYr 2uDg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HiBKXFRO; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-80828-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80828-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c11-20020ae9e20b000000b00787da114620si344734qkc.374.2024.02.26.00.48.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 00:48:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80828-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HiBKXFRO; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-80828-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80828-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CCA581C2171A for ; Mon, 26 Feb 2024 08:48:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D17A6311A; Mon, 26 Feb 2024 08:28:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="HiBKXFRO" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E89B161677; Mon, 26 Feb 2024 08:28:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708936108; cv=none; b=CCQFa7pr+PdW5NyjdNtOAKzwbi0F8/ojCwrPsCFrbxliPoDtJfnr6he6WxNrbvTSPvL+xRwyUaDap4C6fBRMLB1oigJwArXm8Fj1ioKM3xqOBJ686l/b0QmA7cfOncn5gyPZ6sHR7cI5cGq44xPw23z4hv3jMTpg4+4dMNJeUrw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708936108; c=relaxed/simple; bh=BKyLEUsx8ByDpiKr07UAt4uH6XYvHHe1y8EuoJK+8NM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GW0R9FfeSbe2BodRw0gl9SI+bBJV5H052zXy+x1I5W7gE1sgBKZ4kS6ydYnr3mr5dw8SvRnYV2lpWy/rxLAyEhNUuF6drcdknRi71uenkDSTx8G5pf5JbfQTiIS8zBAQW1QqAKMj98wtuOaa6Bxxgb48rhPdUPHt033mmXfZYyc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=HiBKXFRO; arc=none smtp.client-ip=192.198.163.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708936106; x=1740472106; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BKyLEUsx8ByDpiKr07UAt4uH6XYvHHe1y8EuoJK+8NM=; b=HiBKXFRO/hqTtSXK3xYmu8jqaGlmz3Mah5Yx28xC7TOekyLjLGwQPCCX +qMkvDijsYCZjLGNjwjSDU1HPkOUDttwb2u3yHR0WtGkrLLG7INWnFO0m +hcyRlVBOd7phYs/9PqqzVEVGo8htb53JAay/Yf8lnB8hFC4sG2VB1xmS 1ZuoSVz5ZQy6mPop/ttM5gFSQ9uxXJyaf6Jsbo+yX1uVIQSGNiTDTay72 lHkIehQLn9J3ic5iqGC9jLa4ReGsBSvK1JMzXFeouarX2HmgXDecFERvD YSVI27pbLLJSGNHMaKpwtV5E0C6SVCRIsAsldToqSlTw9Qng3NXBUFDkh w==; X-IronPort-AV: E=McAfee;i="6600,9927,10995"; a="6155476" X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="6155476" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 00:28:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="6615946" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 00:28:21 -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 , Kai Huang , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com, Yan Zhao , Yuan Yao , Binbin Wu Subject: [PATCH v19 064/130] KVM: x86/mmu: Do not enable page track for TD guest Date: Mon, 26 Feb 2024 00:26:06 -0800 Message-Id: <066ce30f61d65f3a5e701f0cf1c2f71fa3df2a0d.1708933498.git.isaku.yamahata@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Binbin Wu --- v19: - drop TDX: from the short log - Added reviewed-by: BinBin 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 c87da11f3a04..ce698ab213c1 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