get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2217061/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2217061,
    "url": "http://patchwork.ozlabs.org/api/patches/2217061/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260327160132.2946114-11-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-11-yilun.xu@linux.intel.com>",
    "list_archive_url": null,
    "date": "2026-03-27T16:01:11",
    "name": "[v2,10/31] x86/virt/tdx: Add extra memory to TDX Module for Extensions",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "0cf393327fc73b4b5e75e7eb868d8b1b305817f6",
    "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-11-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/2217061/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2217061/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linux-pci+bounces-51296-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=H3gNA4jx;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-pci+bounces-51296-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=\"H3gNA4jx\"",
            "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 tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fj5qG02B2z1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 28 Mar 2026 03:35:38 +1100 (AEDT)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 90FF630FCFDD\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 16:25:23 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 2021E36897C;\n\tFri, 27 Mar 2026 16:23:12 +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 92D2C369974;\n\tFri, 27 Mar 2026 16:23:10 +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:23:10 -0700",
            "from yilunxu-optiplex-7050.sh.intel.com ([10.239.159.165])\n  by fmviesa006.fm.intel.com with ESMTP; 27 Mar 2026 09:23:06 -0700"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774628592; cv=none;\n b=OC4FWVrqMJVBTXPk6uTHfnIE7cpySkvlGg7JowH89OHtR9sokq5SPw3aGPeDwl5yT4zsztPyrKMgbS07HdJsaIgp3kyN2IezeBv2GYJAsLRqNStuwZelK0IE4kNHt6ITvyCvTSS3c5Hn4ZMY30xzXi3CRYNQP9TQtuSVrONowMo=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774628592; c=relaxed/simple;\n\tbh=DFu7IpMW3OWHV01lKFnhvTeC+NplEcS0CgOhg0CuuzQ=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=DrnVCMEylG0TIxCvc5Hhz20Gx21yuydnEQQW5UHO60heDLImA1RG/SNnMOMLb/3tLGcNC92CjWhUMGYcnNFIim0zcmGiIDvIqjjN56vhRDik10HLPefK3kxLzEmrhHljQcCIqHyHRqDrizyDaPFY3nyRwK7Z4zgFVlyqcZbkrh4=",
        "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=H3gNA4jx; 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=1774628590; x=1806164590;\n  h=from:to:cc:subject:date:message-id:in-reply-to:\n   references:mime-version:content-transfer-encoding;\n  bh=DFu7IpMW3OWHV01lKFnhvTeC+NplEcS0CgOhg0CuuzQ=;\n  b=H3gNA4jx5DJsKg9jftEccdV1IrDwqB8UuKXSG+NGBqEEvsII7AFTLXJB\n   qqTCWUu8OfXdKyinmcBPgLnB/ZgbUh2QCbkVvLpSE0/PJqY8+dYVtqISf\n   bq940jT9ftnUynUl30mfjFs8+17IJmgirCj+q0K7jJZmxrdXbKT8rn9g6\n   NSxh9MU2mhXLAQ894Db314m1Z9Ny0E/5fLn+jHXf45+JV8sCIiZTA6h4H\n   sHSJZqZ84Kg6pJCRP5o9qDsGLjww175vhuLDfo1yE24j0+TH74sDTvY+O\n   gaAtSmNU8bWT3f1u6dwCxfUZwjRMUz5jqvOHNOVdLU6DrPyl9kzKlX8dR\n   g==;",
        "X-CSE-ConnectionGUID": [
            "OxwI/7/QQbOem4CVfEvbPg==",
            "78QD7ClFQlOkfsj+yeSW4g=="
        ],
        "X-CSE-MsgGUID": [
            "MDZPgzB8QVaMunKyawzXrA==",
            "8/iKa9MpQxOohP7dpzqWIg=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6800,10657,11741\"; a=\"79565545\"",
            "E=Sophos;i=\"6.23,144,1770624000\";\n   d=\"scan'208\";a=\"79565545\"",
            "E=Sophos;i=\"6.23,144,1770624000\";\n   d=\"scan'208\";a=\"220516181\""
        ],
        "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 10/31] x86/virt/tdx: Add extra memory to TDX Module for\n Extensions",
        "Date": "Sat, 28 Mar 2026 00:01:11 +0800",
        "Message-Id": "<20260327160132.2946114-11-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": "Adding more memory to TDX Module is the first step to enable Extensions.\n\nCurrently, TDX Module memory use is relatively static. But, some new\nfeatures (called \"TDX Module Extensions\") need to use memory more\ndynamically. While 'static' here means the kernel provides necessary\namount of memory to TDX Module for its basic functionalities, 'dynamic'\nmeans extra memory is needed only if new optional features are to be\nenabled. So add a new memory feeding process backed by a new SEAMCALL\nTDH.EXT.MEM.ADD.\n\nThe process is mostly the same as adding PAMT. The kernel queries TDX\nModule how much memory needed, allocates it, hands it over, and never\ngets it back.\n\nTDH.EXT.MEM.ADD uses tdx_page_array to provide control (private) pages\nto TDX Module. Introduce a tdx_clflush_page_array() helper to flush\nshared cache before SEAMCALL, to avoid shared cache write back damages\nthese private pages.\n\nFor now, TDX Module Extensions consume relatively large amount of\nmemory (~50MB). Use contiguous page allocation to avoid permanently\nfragment too much memory. Print this readout value on TDX Module\nExtensions initialization for visibility.\n\nCo-developed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>\nSigned-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>\nSigned-off-by: Xu Yilun <yilun.xu@linux.intel.com>\n---\n arch/x86/virt/vmx/tdx/tdx.h |  1 +\n arch/x86/virt/vmx/tdx/tdx.c | 92 ++++++++++++++++++++++++++++++++++++-\n 2 files changed, 91 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/arch/x86/virt/vmx/tdx/tdx.h b/arch/x86/virt/vmx/tdx/tdx.h\nindex 870bb75da3ba..31ccdfcf518c 100644\n--- a/arch/x86/virt/vmx/tdx/tdx.h\n+++ b/arch/x86/virt/vmx/tdx/tdx.h\n@@ -60,6 +60,7 @@\n #define TDH_VP_WR\t\t\t43\n #define TDH_SYS_CONFIG_V0\t\t45\n #define TDH_SYS_CONFIG\t\t\tSEAMCALL_LEAF_VER(TDH_SYS_CONFIG_V0, 1)\n+#define TDH_EXT_MEM_ADD\t\t\t61\n \n /* TDX page types */\n #define\tPT_NDA\t\t0x0\ndiff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c\nindex 4fb56bb442f0..5fae17c13191 100644\n--- a/arch/x86/virt/vmx/tdx/tdx.c\n+++ b/arch/x86/virt/vmx/tdx/tdx.c\n@@ -560,7 +560,7 @@ static int tdx_alloc_pages_contig(unsigned int nr_pages, struct page **pages,\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+static 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@@ -643,7 +643,7 @@ EXPORT_SYMBOL_GPL(tdx_page_array_create_iommu_mt);\n #define HPA_LIST_INFO_PFN\t\tGENMASK_U64(51, 12)\n #define HPA_LIST_INFO_LAST_ENTRY\tGENMASK_U64(63, 55)\n \n-static u64 __maybe_unused hpa_list_info_assign_raw(struct tdx_page_array *array)\n+static u64 hpa_list_info_assign_raw(struct tdx_page_array *array)\n {\n \treturn FIELD_PREP(HPA_LIST_INFO_FIRST_ENTRY, 0) |\n \t       FIELD_PREP(HPA_LIST_INFO_PFN,\n@@ -1513,6 +1513,94 @@ static void tdx_clflush_page(struct page *page)\n \tclflush_cache_range(page_to_virt(page), PAGE_SIZE);\n }\n \n+static void tdx_clflush_page_array(struct tdx_page_array *array)\n+{\n+\tfor (int i = 0; i < array->nents; i++)\n+\t\ttdx_clflush_page(array->pages[array->offset + i]);\n+}\n+\n+static int tdx_ext_mem_add(struct tdx_page_array *ext_mem)\n+{\n+\tstruct tdx_module_args args = {\n+\t\t.rcx = hpa_list_info_assign_raw(ext_mem),\n+\t};\n+\tu64 r;\n+\n+\ttdx_clflush_page_array(ext_mem);\n+\n+\tdo {\n+\t\tr = seamcall_ret(TDH_EXT_MEM_ADD, &args);\n+\t\tcond_resched();\n+\t} while (r == TDX_INTERRUPTED_RESUMABLE);\n+\n+\tif (r != TDX_SUCCESS)\n+\t\treturn -EFAULT;\n+\n+\treturn 0;\n+}\n+\n+static int tdx_ext_mem_setup(struct tdx_page_array *ext_mem)\n+{\n+\tunsigned int populated, offset = 0;\n+\tint ret;\n+\n+\t/*\n+\t * tdx_page_array's root page can hold 512 HPAs at most. We have ~50MB\n+\t * memory to add, re-populate the array and add pages bulk by bulk.\n+\t */\n+\twhile (1) {\n+\t\tpopulated = tdx_page_array_populate(ext_mem, offset);\n+\t\tif (!populated)\n+\t\t\tbreak;\n+\n+\t\tret = tdx_ext_mem_add(ext_mem);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\n+\t\toffset += populated;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int __maybe_unused init_tdx_ext(void)\n+{\n+\tstruct tdx_page_array *ext_mem = NULL;\n+\tunsigned int nr_pages;\n+\tint ret;\n+\n+\tif (!(tdx_sysinfo.features.tdx_features0 & TDX_FEATURES0_EXT))\n+\t\treturn 0;\n+\n+\tnr_pages = tdx_sysinfo.ext.memory_pool_required_pages;\n+\t/*\n+\t * memory_pool_required_pages == 0 means no need to add more pages,\n+\t * skip the memory setup.\n+\t */\n+\tif (nr_pages) {\n+\t\text_mem = tdx_page_array_alloc_contig(nr_pages);\n+\t\tif (!ext_mem)\n+\t\t\treturn -ENOMEM;\n+\n+\t\tret = tdx_ext_mem_setup(ext_mem);\n+\t\tif (ret)\n+\t\t\tgoto out_ext_mem;\n+\t}\n+\n+\t/* Extension memory is never reclaimed once assigned */\n+\ttdx_page_array_ctrl_leak(ext_mem);\n+\n+\tpr_info(\"%lu KB allocated for TDX Module Extensions\\n\",\n+\t\tnr_pages * PAGE_SIZE / 1024);\n+\n+\treturn 0;\n+\n+out_ext_mem:\n+\ttdx_page_array_free(ext_mem);\n+\n+\treturn ret;\n+}\n+\n static int init_tdx_module(void)\n {\n \tint ret;\n",
    "prefixes": [
        "v2",
        "10/31"
    ]
}