get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2217116,
    "url": "http://patchwork.ozlabs.org/api/patches/2217116/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260327160132.2946114-15-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-15-yilun.xu@linux.intel.com>",
    "list_archive_url": null,
    "date": "2026-03-27T16:01:15",
    "name": "[v2,14/31] PCI/TSM: Report active IDE streams per host bridge",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "812b10c35d62e9a7afda4a69ced122061bb65ba1",
    "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-15-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/2217116/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2217116/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linux-pci+bounces-51300-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=Y9u41UTu;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=linux-pci+bounces-51300-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=\"Y9u41UTu\"",
            "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\n [IPv6:2600:3c15:e001:75::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 4fj6Gn62V7z1y1x\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 28 Mar 2026 03:56:01 +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 1F00330F4FC1\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 16:26:38 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id DF476399352;\n\tFri, 27 Mar 2026 16:23:26 +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 8068035B645;\n\tFri, 27 Mar 2026 16:23:25 +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:24 -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:21 -0700"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774628606; cv=none;\n b=s/qK5pUoJNJ9WE3jnNM2yuwiybl2u6dvj6dMGhFuYF8N2p6qaDqzqLVJnl1EvmMn9qiDOFCNCvypw+sigmYzuL2weefi2ql6PxfXYYnLCy2vF1/IXTKi9VV3klzNUUZXNq4VfvRLSrlF9EOpHQpgdJX2bIXDzJqWx0nXp1B3HRU=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774628606; c=relaxed/simple;\n\tbh=NUtWTN+YsNz/G7G+LqClLzUTJJRtWG7YocdGIa0hACU=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=k78cSMuS/K1kAC/0Mq+4XVl0ROGLzbvUKyUYbQWOPAWiwYJuwqlYcKrhj27wuzaPKizsr2EcveUviMbiUOH3KQkNwS+U/En4cLdltOXbn3Dg2u6so95qQo9JEfmURFZn8syDqEIeso924zq7/E12j+v5TUKOqYTPultzLq86hKw=",
        "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=Y9u41UTu; 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=1774628605; x=1806164605;\n  h=from:to:cc:subject:date:message-id:in-reply-to:\n   references:mime-version:content-transfer-encoding;\n  bh=NUtWTN+YsNz/G7G+LqClLzUTJJRtWG7YocdGIa0hACU=;\n  b=Y9u41UTuVNNg2UhB1hFh8Cnlc8v4lYYYfEESXOeLCq6sian18rCLKk5j\n   MqwAaYvbvjpS9wbhK9gp+KssM7EyatntSL9o0u4mzofVv1zqcvX+tBxCi\n   1ntTijbyTXt28fooIFPNb8xn6e/DcStXvC6iSVNKHn/RQw8Z7TQsTWQxs\n   3xmx1Em34Q9mlA0BibVS0Atl20Oi2pZRGwHlK5kncXc3tK4Ossuh/FnIs\n   9D0ntMnbHH5NHoS/OP7oTaVsv0oHPkX/bhvluujMIUh+eIqg9RvCbBQWd\n   8xhRk/Hlp6tSgvG5YtXJXXpZQ1PSfq/itnT1bLwLI6HTYFynktn3fgFHV\n   g==;",
        "X-CSE-ConnectionGUID": [
            "kZD+/wvEQRKWC9dML8Ke9w==",
            "bd88HM/eRFevey5pYm38Xw=="
        ],
        "X-CSE-MsgGUID": [
            "dYSDFBk2SAS0n9bKzYu+yw==",
            "Mgpwnhy6Qc+U3vXdgdZwpg=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6800,10657,11741\"; a=\"79565584\"",
            "E=Sophos;i=\"6.23,144,1770624000\";\n   d=\"scan'208\";a=\"79565584\"",
            "E=Sophos;i=\"6.23,144,1770624000\";\n   d=\"scan'208\";a=\"220516236\""
        ],
        "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 14/31] PCI/TSM: Report active IDE streams per host bridge",
        "Date": "Sat, 28 Mar 2026 00:01:15 +0800",
        "Message-Id": "<20260327160132.2946114-15-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": "From: Dan Williams <dan.j.williams@intel.com>\n\nThe first attempt at an ABI for this failed to account for naming\ncollisions across host bridges:\n\nCommit a4438f06b1db (\"PCI/TSM: Report active IDE streams\")\n\nRevive this ABI with a per host bridge link that appears at first stream\ncreation for a given host bridge and disappears after the last stream is\nremoved.\n\nFor systems with many host bridge objects it allows:\n\n    ls /sys/class/tsm/tsmN/pci*/stream*\n\n...to find all the host bridges with active streams without first iterating\nover all host bridges. Yilun notes that is handy to have this short cut [1]\nand from an administrator perspective it helps with inventory for\nconstrained stream resources.\n\nLink: http://lore.kernel.org/aXLtILY85oMU5qlb@yilunxu-OptiPlex-7050 [1]\nSigned-off-by: Dan Williams <dan.j.williams@intel.com>\n---\n Documentation/ABI/testing/sysfs-class-tsm | 13 +++\n include/linux/pci-ide.h                   |  2 +\n include/linux/tsm.h                       |  3 +\n drivers/pci/ide.c                         |  4 +\n drivers/virt/coco/tsm-core.c              | 97 +++++++++++++++++++++++\n 5 files changed, 119 insertions(+)",
    "diff": "diff --git a/Documentation/ABI/testing/sysfs-class-tsm b/Documentation/ABI/testing/sysfs-class-tsm\nindex 2949468deaf7..1ddb8f357961 100644\n--- a/Documentation/ABI/testing/sysfs-class-tsm\n+++ b/Documentation/ABI/testing/sysfs-class-tsm\n@@ -7,3 +7,16 @@ Description:\n \t\tsignals when the PCI layer is able to support establishment of\n \t\tlink encryption and other device-security features coordinated\n \t\tthrough a platform tsm.\n+\n+What:\t\t/sys/class/tsm/tsmN/pciDDDD:BB\n+Contact:\tlinux-pci@vger.kernel.org\n+Description:\n+\t\t(RO) When a PCIe host bridge has established a secure connection\n+\t\tvia a TSM to an endpoint, this symlink appears. It facilitates a\n+\t\tTSM instance scoped view of PCIe Link Encryption and Secure\n+\t\tSession resource consumption across host bridges. The symlink\n+\t\tappears when a host bridge has 1 or more IDE streams established\n+\t\twith this TSM, and disappears when that number returns to 0. See\n+\t\tDocumentation/ABI/testing/sysfs-devices-pci-host-bridge for the\n+\t\tdescription of the pciDDDD:BB/streamH.R.E symlink and the\n+\t\tpciDDDD:BB/available_secure_streams attribute.\ndiff --git a/include/linux/pci-ide.h b/include/linux/pci-ide.h\nindex ae07d9f699c0..381a1bf22a95 100644\n--- a/include/linux/pci-ide.h\n+++ b/include/linux/pci-ide.h\n@@ -82,6 +82,7 @@ struct pci_ide_regs {\n  * @host_bridge_stream: allocated from host bridge @ide_stream_ida pool\n  * @stream_id: unique Stream ID (within Partner Port pairing)\n  * @name: name of the established Selective IDE Stream in sysfs\n+ * @tsm_dev: For TSM established IDE, the TSM device context\n  *\n  * Negative @stream_id values indicate \"uninitialized\" on the\n  * expectation that with TSM established IDE the TSM owns the stream_id\n@@ -93,6 +94,7 @@ struct pci_ide {\n \tu8 host_bridge_stream;\n \tint stream_id;\n \tconst char *name;\n+\tstruct tsm_dev *tsm_dev;\n };\n \n /*\ndiff --git a/include/linux/tsm.h b/include/linux/tsm.h\nindex 381c53244c83..7f72a154b6b2 100644\n--- a/include/linux/tsm.h\n+++ b/include/linux/tsm.h\n@@ -123,4 +123,7 @@ int tsm_report_unregister(const struct tsm_report_ops *ops);\n struct tsm_dev *tsm_register(struct device *parent, struct pci_tsm_ops *ops);\n void tsm_unregister(struct tsm_dev *tsm_dev);\n struct tsm_dev *find_tsm_dev(int id);\n+struct pci_ide;\n+int tsm_ide_stream_register(struct pci_ide *ide);\n+void tsm_ide_stream_unregister(struct pci_ide *ide);\n #endif /* __TSM_H */\ndiff --git a/drivers/pci/ide.c b/drivers/pci/ide.c\nindex be74e8f0ae21..b35e8aba7ecb 100644\n--- a/drivers/pci/ide.c\n+++ b/drivers/pci/ide.c\n@@ -11,6 +11,7 @@\n #include <linux/pci_regs.h>\n #include <linux/slab.h>\n #include <linux/sysfs.h>\n+#include <linux/tsm.h>\n \n #include \"pci.h\"\n \n@@ -372,6 +373,9 @@ void pci_ide_stream_release(struct pci_ide *ide)\n \tif (ide->partner[PCI_IDE_EP].enable)\n \t\tpci_ide_stream_disable(pdev, ide);\n \n+\tif (ide->tsm_dev)\n+\t\ttsm_ide_stream_unregister(ide);\n+\n \tif (ide->partner[PCI_IDE_RP].setup)\n \t\tpci_ide_stream_teardown(rp, ide);\n \ndiff --git a/drivers/virt/coco/tsm-core.c b/drivers/virt/coco/tsm-core.c\nindex 98dcf7d836df..ece7cd7ea9d8 100644\n--- a/drivers/virt/coco/tsm-core.c\n+++ b/drivers/virt/coco/tsm-core.c\n@@ -4,10 +4,12 @@\n #define pr_fmt(fmt) KBUILD_MODNAME \": \" fmt\n \n #include <linux/tsm.h>\n+#include <linux/pci.h>\n #include <linux/device.h>\n #include <linux/module.h>\n #include <linux/cleanup.h>\n #include <linux/pci-tsm.h>\n+#include <linux/pci-ide.h>\n \n static struct class *tsm_class;\n static DEFINE_IDA(tsm_ida);\n@@ -104,6 +106,100 @@ void tsm_unregister(struct tsm_dev *tsm_dev)\n }\n EXPORT_SYMBOL_GPL(tsm_unregister);\n \n+static DEFINE_XARRAY(tsm_ide_streams);\n+static DEFINE_MUTEX(tsm_ide_streams_lock);\n+\n+/* tracker for the bridge symlink when the bridge has any streams */\n+struct tsm_ide_stream {\n+\tstruct tsm_dev *tsm_dev;\n+\tstruct pci_host_bridge *bridge;\n+\tstruct kref kref;\n+};\n+\n+static struct tsm_ide_stream *create_streams(struct tsm_dev *tsm_dev,\n+\t\t\t\t\t    struct pci_host_bridge *bridge)\n+{\n+\tint rc;\n+\n+\tstruct tsm_ide_stream *streams __free(kfree) =\n+\t\tkzalloc(sizeof(*streams), GFP_KERNEL);\n+\tif (!streams)\n+\t\treturn NULL;\n+\n+\tstreams->tsm_dev = tsm_dev;\n+\tstreams->bridge = bridge;\n+\tkref_init(&streams->kref);\n+\trc = xa_insert(&tsm_ide_streams, (unsigned long)bridge, streams,\n+\t\t       GFP_KERNEL);\n+\tif (rc)\n+\t\treturn NULL;\n+\n+\trc = sysfs_create_link(&tsm_dev->dev.kobj, &bridge->dev.kobj,\n+\t\t\t       dev_name(&bridge->dev));\n+\tif (rc) {\n+\t\txa_erase(&tsm_ide_streams, (unsigned long)bridge);\n+\t\treturn NULL;\n+\t}\n+\n+\treturn no_free_ptr(streams);\n+}\n+\n+int tsm_ide_stream_register(struct pci_ide *ide)\n+{\n+\tstruct tsm_ide_stream *streams;\n+\tstruct pci_dev *pdev = ide->pdev;\n+\tstruct pci_tsm *tsm = pdev->tsm;\n+\tstruct tsm_dev *tsm_dev = tsm->tsm_dev;\n+\tstruct pci_host_bridge *bridge = pci_find_host_bridge(pdev->bus);\n+\n+\tguard(mutex)(&tsm_ide_streams_lock);\n+\tstreams = xa_load(&tsm_ide_streams, (unsigned long)bridge);\n+\tif (streams)\n+\t\tkref_get(&streams->kref);\n+\telse\n+\t\tstreams = create_streams(tsm_dev, bridge);\n+\n+\tif (!streams)\n+\t\treturn -ENOMEM;\n+\tide->tsm_dev = tsm_dev;\n+\n+\treturn 0;\n+}\n+EXPORT_SYMBOL_GPL(tsm_ide_stream_register);\n+\n+static void destroy_streams(struct kref *kref)\n+{\n+\tstruct tsm_ide_stream *streams =\n+\t\tcontainer_of(kref, struct tsm_ide_stream, kref);\n+\tstruct tsm_dev *tsm_dev = streams->tsm_dev;\n+\tstruct pci_host_bridge *bridge = streams->bridge;\n+\n+\tlockdep_assert_held(&tsm_ide_streams_lock);\n+\tsysfs_remove_link(&tsm_dev->dev.kobj, dev_name(&bridge->dev));\n+\txa_erase(&tsm_ide_streams, (unsigned long)bridge);\n+\tkfree(streams);\n+}\n+\n+void tsm_ide_stream_unregister(struct pci_ide *ide)\n+{\n+\tstruct tsm_ide_stream *streams;\n+\tstruct tsm_dev *tsm_dev = ide->tsm_dev;\n+\tstruct pci_dev *pdev = ide->pdev;\n+\tstruct pci_host_bridge *bridge = pci_find_host_bridge(pdev->bus);\n+\n+\tguard(mutex)(&tsm_ide_streams_lock);\n+\tstreams = xa_load(&tsm_ide_streams, (unsigned long)bridge);\n+\t/* catch API abuse */\n+\tif (dev_WARN_ONCE(&tsm_dev->dev,\n+\t\t\t  !streams || streams->tsm_dev != tsm_dev,\n+\t\t\t  \"no IDE streams associated with %s\\n\",\n+\t\t\t  dev_name(&bridge->dev)))\n+\t\treturn;\n+\tkref_put(&streams->kref, destroy_streams);\n+\tide->tsm_dev = NULL;\n+}\n+EXPORT_SYMBOL_GPL(tsm_ide_stream_unregister);\n+\n static void tsm_release(struct device *dev)\n {\n \tstruct tsm_dev *tsm_dev = container_of(dev, typeof(*tsm_dev), dev);\n@@ -126,6 +222,7 @@ module_init(tsm_init)\n static void __exit tsm_exit(void)\n {\n \tclass_destroy(tsm_class);\n+\txa_destroy(&tsm_ide_streams);\n }\n module_exit(tsm_exit)\n \n",
    "prefixes": [
        "v2",
        "14/31"
    ]
}