Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.19 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796187337; b=NTJXzyTKqntWFAdBzYuSCMDc7V9N4qjv6vfA+2J2lDs3ejwuVoux6xy0EHx04Q5to9uc xA0cxy9+9g0IkCMA9CnK4DDbz1r7RF2A6b0MBgqDYU6bflxglgH5GTZofFPipH0XW3Mcu 7m715522hlfjLfb5xukY5iEe41L3CKGnStg2oKcy0t9vkT0u/tAatH+BWBClcEVco/eQ9 Bfo+/DOU/ClwB4O8JkytCHuECAWiIAE9DNnd6jRj8sbG84e+yQBds3/MxEp7oWM7e8a5S zS0qQMDKbX8+M5Dtzb48sbf6Js6a+ajoIwr3S7uzhxwriRaTUh9pqpehwgs3c9yascw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796187337; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:From:Date:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id: References:In-Reply-To:To:Cc:X-Mailer:X-Developer-Signature: X-Developer-Key; bh=QtXbh3TfxGRdkmE2PFPqaumvvJeIrP8bE5N+RXW2STk=; b=h+AS4GfNursX74Hzu6NkIaJ1w6uVKmwHI3KUd90pQ5+y+RS1epOPQYzhWESu3H0UoHfM mZZ4iOv2TXd/ah246zerQ/U0iljO8X9TLtSYIgUz2bZ9YoDEl0DFWZSmdn2151Xk9G+tw eY34Krndi7XvMzWzD8tlnQxKqsLYMNiOvXThVcwkXpekskGWpwJaLFI74bbpyZ8SH/U0f ots62MkgnZUwALxKC+W4i76Pmo/a+yMgANprmDzEKgRbs7RbUMB7D9lq/aogd9zSmCkoj gn7I/gk5cVclLS2OeejdMJTmKjJPk2Nw2LL4D7U4hIYNNDWEl/PwcpARKUAdZ6FaU8A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=NEL9Nov7; arc=none smtp.remote-ip=192.198.163.19 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55A91606A336; Wed, 2 Dec 2026 04:55:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 55A91606A336 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=NEL9Nov7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796187336; x=1827723336; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=QtXbh3TfxGRdkmE2PFPqaumvvJeIrP8bE5N+RXW2STk=; b=NEL9Nov7t/ig7Tarc0NDq6GwjGM+gvNsYEqzvcEx2a+F++N5DR4AQLF2 s0i4t9H4ee4/OY4+FG0cUBr+UFRfryREwWu0GDK7HTDeX/f9MfPaabvPu Nj1g4tq7Hkw/BAJUzOYNNHbm3i50HYKni9urFbbIlCcgcPXBuUYgT7XFA 0iVGBIWKO+JIe8m9wSicKtQM+/ew/WGanSVwrf3yvdrvlucsh85CNUrt4 7rdhrmN9TGWePu8JWi6tr8VCG8baFbyQJ/j4x1yKrQG7/XOnW7rDTwWQZ 84zU/XDUlE9ETJt+ewLXt5J1bhRBXbaY9TDHMriMPQjj10Wl579R8IUAw A==; X-CSE-ConnectionGUID: T5GLZaR9S3OPZcQ/gCcWMQ== X-CSE-MsgGUID: auqojL/4TluBvmzvi5zZWA== X-IronPort-AV: E=McAfee;i="6800,10657,11983"; a="5108498" X-IronPort-AV: E=Sophos;i="6.27,246,1787036400"; d="scan'208";a="5108498" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 20:55:36 -0800 X-CSE-ConnectionGUID: IJaZoE6RReim90jOv83pqg== X-CSE-MsgGUID: 09N3ahWzR+iiKL7XJBynAg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,246,1787036400"; d="scan'208";a="13411211" Received: from yilunxu-optiplex-7050.sh.intel.com (HELO [127.0.1.1]) ([10.239.47.46]) by orviesa002.jf.intel.com with ESMTP; 01 Dec 2026 20:55:32 -0800 From: Xu Yilun Date: Wed, 02 Dec 2026 12:43:28 +0800 Subject: [PATCH v6 4/6] x86/virt/tdx: Don't enable any add-on feature when DPAMT is on X-Mailing-List: kvm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261202-tdx-module-ext-v6-4-f6d8510fe498@linux.intel.com> References: <20261202-tdx-module-ext-v6-0-f6d8510fe498@linux.intel.com> In-Reply-To: <20261202-tdx-module-ext-v6-0-f6d8510fe498@linux.intel.com> To: x86@kernel.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Kiryl Shutsemau , Rick Edgecombe , Dave Hansen , dave.hansen@intel.com, kvm@vger.kernel.org, yilun.xu@intel.com, yilun.xu@linux.intel.com, xiaoyao.li@intel.com, sohil.mehta@intel.com, adrian.hunter@intel.com, kishen.maloor@intel.com, tony.lindgren@linux.intel.com, peter.fang@intel.com, baolu.lu@linux.intel.com, zhenzhong.duan@intel.com, chao.gao@intel.com, artem.bityutskiy@linux.intel.com, nik.borisov@suse.com X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2392; i=yilun.xu@linux.intel.com; h=from:subject:message-id; bh=5kztNzLNKFr86i4Imd+0/+QEnT+lFzjYXIY3qMe+Crc=; b=owGbwMvMwCH2Zztz45IFPbcYT6slMWTzL1KZ8q54jmbK7PgehlcO5wryWMxic/wnquRs5mVc1 W+i8PxiRycLgxgHg6GYIssCj1lOU9pnMW39tPMazBxWJpAhwjKVmTmleXoVpQ6ZeSWpOXrJ+bkM XJwCMFWOugz/ne7mCkyofid/pXb/F5MOffsDEre3v7nyjnt9BfdG4Uu6UxgZHtTO5fW971Y4sSE r077z+DVumU/J82ZWy5/i2eUmvVqNAwA= X-Developer-Key: i=yilun.xu@linux.intel.com; a=openpgp; fpr=A612D44FA98BA699FECC642BE2C8D72186AC3949 The TDX module uses PAMT to track some state for private pages. The memory for the extensions needs PAMT backing because the TDX module transitions it to private pages when accepting it. The Dynamic PAMT (DPAMT) feature allows saving memory by allocating 4KB-level PAMT dynamically. The kernel must install DPAMT before adding any 4KB pages to the TDX module when DPAMT is enabled. Although the memory for the extensions is tens of megabytes and the kernel allocates it in a large chunk, the TDX module accepts it in the form of an HPA array, which specifies each page at 4KB granularity. Thus, the memory is subject to this requirement. However, TDX continues to struggle with large patchsets to enable new features. Doing DPAMT maintenance for this new type of memory further complicates the initial patchset. A parallel kernel change [1] gives users the option to switch DPAMT on/off, which simplifies the initial support for TDX module extensions (and other upcoming TDX features) by starting without DPAMT. Don't enable any add-on features when DPAMT is on. In this case, the extensions are inactive and the memory-adding process remains unreachable, which avoids DPAMT-missing errors. That said, don't worry about bisectability because the extensions can't be enabled yet until some subsequent kernel change enables a feature that uses them. Signed-off-by: Xu Yilun Link: https://lore.kernel.org/all/20261126005417.976523-1-rick.p.edgecombe@intel.com/ # [1] --- v6: - A new patch that replaces the DPAMT support one (Rick) --- arch/x86/virt/vmx/tdx/tdx.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c index ffb4af3147b3..ac88948966c7 100644 --- a/arch/x86/virt/vmx/tdx/tdx.c +++ b/arch/x86/virt/vmx/tdx/tdx.c @@ -1038,6 +1038,14 @@ static __init int construct_tdmrs(struct list_head *tmb_list, static __init u64 get_tdx_usable_addon_features0(void) { + /* + * The kernel doesn't yet support TDX module extensions with DPAMT. + * Since most add-on features depend on the extensions, for + * simplicity, don't enable any of them when DPAMT is on. + */ + if (tdx_supports_dynamic_pamt(&tdx_sysinfo)) + return 0; + return tdx_sysinfo.features.tdx_features0 & TDX_KERNEL_SUPPORTED_ADDON_FEATURES0; } -- 2.25.1