Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2217063/?format=api
{ "id": 2217063, "url": "http://patchwork.ozlabs.org/api/patches/2217063/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260327160132.2946114-5-yilun.xu@linux.intel.com/", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/projects/28/?format=api", "name": "Linux PCI development", "link_name": "linux-pci", "list_id": "linux-pci.vger.kernel.org", "list_email": "linux-pci@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260327160132.2946114-5-yilun.xu@linux.intel.com>", "list_archive_url": null, "date": "2026-03-27T16:01:05", "name": "[v2,04/31] x86/virt/tdx: Support allocating contiguous pages for tdx_page_array", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "adc2910b902f5e1745949d196f8d1072c72266f5", "submitter": { "id": 87470, "url": "http://patchwork.ozlabs.org/api/people/87470/?format=api", "name": "Xu Yilun", "email": "yilun.xu@linux.intel.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260327160132.2946114-5-yilun.xu@linux.intel.com/mbox/", "series": [ { "id": 497793, "url": "http://patchwork.ozlabs.org/api/series/497793/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=497793", "date": "2026-03-27T16:01:02", "name": "PCI/TSM: PCIe Link Encryption Establishment via TDX platform services", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/497793/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2217063/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2217063/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-pci+bounces-51289-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-pci@vger.kernel.org" ], "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256\n header.s=Intel header.b=bL3xD+n+;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=104.64.211.4; helo=sin.lore.kernel.org;\n envelope-from=linux-pci+bounces-51289-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.b=\"bL3xD+n+\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=198.175.65.14", "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.intel.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linux.intel.com" ], "Received": [ "from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fj5qk6KVtz1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 28 Mar 2026 03:36:02 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sin.lore.kernel.org (Postfix) with ESMTP id 7B11330D3768\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 16:23:29 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id E45D435CB70;\n\tFri, 27 Mar 2026 16:22:49 +0000 (UTC)", "from mgamail.intel.com (mgamail.intel.com [198.175.65.14])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id A0BFE35B646;\n\tFri, 27 Mar 2026 16:22:48 +0000 (UTC)", "from fmviesa006.fm.intel.com ([10.60.135.146])\n by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 27 Mar 2026 09:22:48 -0700", "from yilunxu-optiplex-7050.sh.intel.com ([10.239.159.165])\n by fmviesa006.fm.intel.com with ESMTP; 27 Mar 2026 09:22:45 -0700" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774628569; cv=none;\n b=O8lJIW4Xn4rXKAYeuTqzkx2wG6tXNZVUynrK6KsQzB8npGsvR6WklcOmqKlJRl6MUZPxC2Rr7tLxnQG2T+pZrewIou2I++Z3S1/D9tNY9aGfc1R8ONUuKGeOxhqcX19TWOaIEMVbB4mhR+GqWO5a+B4XTEJEhNh4xBIkMyLbK44=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774628569; c=relaxed/simple;\n\tbh=tqGp7zAocPvqaSnOyu6xaRIKdzXyFBuBaIxg8X/6vco=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=uerQCRteG8meKf7JBlJf1VznszA438uwJLwsi880nD0Dizlk5m45+xxPgXytvTqwAbw+k2OGHWdRyWA63lbbdTbFOW4XJhyRj1J/Bd20VHPvdwfkiBySBrPFlZ4rfprp+AvwL9VHD0ud+hKiSv1MPHjpmw4Hi2VmfTTZh1mrUDM=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.intel.com;\n spf=pass smtp.mailfrom=linux.intel.com;\n dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.b=bL3xD+n+; arc=none smtp.client-ip=198.175.65.14", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1774628568; x=1806164568;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=tqGp7zAocPvqaSnOyu6xaRIKdzXyFBuBaIxg8X/6vco=;\n b=bL3xD+n+lS5XqCGF3ivpAzmFGU6HYvIljXhZkNCDZxYB7FqVPbo6q6ZC\n ACwIkbUoqEJZzDB6cu+UIKM7zpLvZh7xBc4zxHxH9Pk70jF0JE7TNUdAV\n i8VrLLzoEdqqcDNyBc+uSkWIjp78aEXbks8A9blSGuMcAx532N+ZBur16\n BEMts5bGMETpfZ45AHkKM+3FH6gtn7EDCyjOzqj7MYxQUBl92Sz6IYatR\n VsYQvfW2jIQqEoMPWCws3ilWknay7N//GksU+I/yKeyTkCeaIOovRPzIW\n C5m7ucmA4iJRaTamFOrx9MrTQbt/EgnYlGgqux6S8kFcokP1ydDZKpHfc\n g==;", "X-CSE-ConnectionGUID": [ "UYbuIjShQSiADJk1BOLAKA==", "gKXXZ7+RQuKLIE0qtKVoWw==" ], "X-CSE-MsgGUID": [ "G9ojT8vIRt2v6zoiu08SVw==", "XeYds5OAQ9+YkPiEWPamWQ==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6800,10657,11741\"; a=\"79565508\"", "E=Sophos;i=\"6.23,144,1770624000\";\n d=\"scan'208\";a=\"79565508\"", "E=Sophos;i=\"6.23,144,1770624000\";\n d=\"scan'208\";a=\"220516143\"" ], "X-ExtLoop1": "1", "From": "Xu Yilun <yilun.xu@linux.intel.com>", "To": "linux-coco@lists.linux.dev,\n\tlinux-pci@vger.kernel.org,\n\tdan.j.williams@intel.com,\n\tx86@kernel.org", "Cc": "chao.gao@intel.com,\n\tdave.jiang@intel.com,\n\tbaolu.lu@linux.intel.com,\n\tyilun.xu@linux.intel.com,\n\tyilun.xu@intel.com,\n\tzhenzhong.duan@intel.com,\n\tkvm@vger.kernel.org,\n\trick.p.edgecombe@intel.com,\n\tdave.hansen@linux.intel.com,\n\tkas@kernel.org,\n\txiaoyao.li@intel.com,\n\tvishal.l.verma@intel.com,\n\tlinux-kernel@vger.kernel.org", "Subject": "[PATCH v2 04/31] x86/virt/tdx: Support allocating contiguous pages\n for tdx_page_array", "Date": "Sat, 28 Mar 2026 00:01:05 +0800", "Message-Id": "<20260327160132.2946114-5-yilun.xu@linux.intel.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20260327160132.2946114-1-yilun.xu@linux.intel.com>", "References": "<20260327160132.2946114-1-yilun.xu@linux.intel.com>", "Precedence": "bulk", "X-Mailing-List": "linux-pci@vger.kernel.org", "List-Id": "<linux-pci.vger.kernel.org>", "List-Subscribe": "<mailto:linux-pci+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-pci+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit" }, "content": "The current tdx_page_array implementation allocates scattered order-0\npages. However, some TDX Module operations benefit from contiguous\nphysical memory. E.g. Enabling TDX Module Extensions (an optional TDX\nfeature) requires ~50MB memory and never returns. Such allocation\nwould at worst cause ~25GB permanently fragmented memory if each\nallocated page is from a different 2M region.\n\nSupport allocating contiguous pages for tdx_page_array by making the\nallocation method configurable. Change the tdx_page_array_alloc() to\naccept a custom allocation function pointer and a context parameter.\nWrap the specific allocation into a tdx_page_array_alloc_contig()\nhelper.\n\nThe foreseeable caller will allocate ~50MB memory with this helper,\nexceeding the maximum HPAs (512) a root page can hold, the typical usage\nwill be:\n\n - struct tdx_page_array *array = tdx_page_array_alloc_contig(nr_pages);\n - for each 512-page bulk\n - tdx_page_array_populate(array, offset);\n - seamcall(TDH_XXX_ADD, array, ...);\n\nThe configurable allocation method would also benefit more\ntdx_page_array usages. TDX Module may require more specific memory\nlayouts encoded in the root page. Will introduce them in following\npatches.\n\nSigned-off-by: Xu Yilun <yilun.xu@linux.intel.com>\n---\n arch/x86/virt/vmx/tdx/tdx.c | 42 +++++++++++++++++++++++++++++++++----\n 1 file changed, 38 insertions(+), 4 deletions(-)", "diff": "diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c\nindex a3021e7e2490..6c4ed80e8e5a 100644\n--- a/arch/x86/virt/vmx/tdx/tdx.c\n+++ b/arch/x86/virt/vmx/tdx/tdx.c\n@@ -289,7 +289,8 @@ static void tdx_free_pages_bulk(unsigned int nr_pages, struct page **pages)\n \t\t__free_page(pages[i]);\n }\n \n-static int tdx_alloc_pages_bulk(unsigned int nr_pages, struct page **pages)\n+static int tdx_alloc_pages_bulk(unsigned int nr_pages, struct page **pages,\n+\t\t\t\tvoid *data)\n {\n \tunsigned int filled, done = 0;\n \n@@ -326,7 +327,10 @@ void tdx_page_array_free(struct tdx_page_array *array)\n EXPORT_SYMBOL_GPL(tdx_page_array_free);\n \n static struct tdx_page_array *\n-tdx_page_array_alloc(unsigned int nr_pages)\n+tdx_page_array_alloc(unsigned int nr_pages,\n+\t\t int (*alloc_fn)(unsigned int nr_pages,\n+\t\t\t\t struct page **pages, void *data),\n+\t\t void *data)\n {\n \tstruct tdx_page_array *array = NULL;\n \tstruct page **pages = NULL;\n@@ -348,7 +352,7 @@ tdx_page_array_alloc(unsigned int nr_pages)\n \tif (!pages)\n \t\tgoto out_free;\n \n-\tret = tdx_alloc_pages_bulk(nr_pages, pages);\n+\tret = alloc_fn(nr_pages, pages, data);\n \tif (ret)\n \t\tgoto out_free;\n \n@@ -388,7 +392,7 @@ struct tdx_page_array *tdx_page_array_create(unsigned int nr_pages)\n \tif (nr_pages > TDX_PAGE_ARRAY_MAX_NENTS)\n \t\treturn NULL;\n \n-\tarray = tdx_page_array_alloc(nr_pages);\n+\tarray = tdx_page_array_alloc(nr_pages, tdx_alloc_pages_bulk, NULL);\n \tif (!array)\n \t\treturn NULL;\n \n@@ -521,6 +525,36 @@ int tdx_page_array_ctrl_release(struct tdx_page_array *array,\n }\n EXPORT_SYMBOL_GPL(tdx_page_array_ctrl_release);\n \n+static int tdx_alloc_pages_contig(unsigned int nr_pages, struct page **pages,\n+\t\t\t\t void *data)\n+{\n+\tstruct page *page;\n+\tint i;\n+\n+\tpage = alloc_contig_pages(nr_pages, GFP_KERNEL, numa_mem_id(),\n+\t\t\t\t &node_online_map);\n+\tif (!page)\n+\t\treturn -ENOMEM;\n+\n+\tfor (i = 0; i < nr_pages; i++)\n+\t\tpages[i] = page + i;\n+\n+\treturn 0;\n+}\n+\n+/*\n+ * For holding large number of contiguous pages, usually larger than\n+ * TDX_PAGE_ARRAY_MAX_NENTS (512).\n+ *\n+ * Similar to tdx_page_array_alloc(), after allocating with this\n+ * function, call tdx_page_array_populate() to populate the tdx_page_array.\n+ */\n+static __maybe_unused struct tdx_page_array *\n+tdx_page_array_alloc_contig(unsigned int nr_pages)\n+{\n+\treturn tdx_page_array_alloc(nr_pages, tdx_alloc_pages_contig, NULL);\n+}\n+\n #define HPA_LIST_INFO_FIRST_ENTRY\tGENMASK_U64(11, 3)\n #define HPA_LIST_INFO_PFN\t\tGENMASK_U64(51, 12)\n #define HPA_LIST_INFO_LAST_ENTRY\tGENMASK_U64(63, 55)\n", "prefixes": [ "v2", "04/31" ] }