From mboxrd@z Thu Jan 1 00:00:00 1970 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=1796187336; b=WLaaSKm+BGAlj/hHKmGfE/m2hP7YEvRN1xfy8YB/E41p2iSNY1MpDjWSPL+uk0CvtlQ3 1XyKChIg8HWktTmIZdx70PUcyvU7YNsxIcVov/082iT7a3d9ZYndFD1sxr1JEbZpvnl7F CA6ao2n7nQEaD5n/DeQSTLdJPHqlcoTEdicZeIe87W3JKYC2vGDSetgKGvrCUb2muTRZ3 zhORhPVJ9oiIOF+99Aox40T/NrFbeny/ZS82KKiG0dCjmfRa4DNB7+ox7AkZ9F2+um9gx MBWsVrY6/3K8EJzophuEqvYqAIKeQoSwcQXCQktxeOrizrc7u8cBIQHgj1TgxDx3kxA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796187336; 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=XG1CYuJbdY6JFSCDJRmcSuMkPvfOrOizsQXMvKy2ptOmAYJdqmuz7JDvvLgXQq6JwI+Q /JJsPtkEnWr2K3pWgaf9CaHrDeEn2YyABxnq0jtjHT9I2D290rIAVDkfQ9ldajRFpeI6z KM9xyBakruhQ9B+7tOpmcdF10n/AqZSOxovajzDk53+4L+drYEsxmsPBrNCuMm02XAi6v hWb7d2Hv6Rgn9yU57poYHHqdPv5Rq8CoOxgnkClAob6qGZNyOOuzh7hpJYl2ZH+wPpyJU tKZSLsu4dbt4ynJ36FmDMeEd7MPWP6DGc//9SYRl24IwEmq1c9uxNK6MVEA0N9fq8Sw== 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 58582606A33C for ; Wed, 2 Dec 2026 04:55:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 58582606A33C 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: gEDlxmb8RpSnYek/EE+nZw== X-CSE-MsgGUID: Sjr6vw9PTFG9p0t8e9pPNw== X-IronPort-AV: E=McAfee;i="6800,10657,11983"; a="5108500" X-IronPort-AV: E=Sophos;i="6.27,246,1787036400"; d="scan'208";a="5108500" 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: linux-coco@lists.linux.dev 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