get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2221949,
    "url": "http://patchwork.ozlabs.org/api/patches/2221949/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260410-sdxi-base-v1-15-1d184cb5c60a@amd.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": "<20260410-sdxi-base-v1-15-1d184cb5c60a@amd.com>",
    "list_archive_url": null,
    "date": "2026-04-10T13:07:25",
    "name": "[15/23] dmaengine: sdxi: Per-context access key (AKey) table entry allocator",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "344599da962a8b9d96428363d3e347b9141e23c1",
    "submitter": {
        "id": 91626,
        "url": "http://patchwork.ozlabs.org/api/people/91626/?format=api",
        "name": "Nathan Lynch via B4 Relay",
        "email": "devnull+nathan.lynch.amd.com@kernel.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260410-sdxi-base-v1-15-1d184cb5c60a@amd.com/mbox/",
    "series": [
        {
            "id": 499458,
            "url": "http://patchwork.ozlabs.org/api/series/499458/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=499458",
            "date": "2026-04-10T13:07:10",
            "name": "dmaengine: Smart Data Accelerator Interface (SDXI) basic support",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/499458/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2221949/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2221949/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linux-pci+bounces-52325-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=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=n2484PuZ;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-52325-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)",
            "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"n2484PuZ\"",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"
        ],
        "Received": [
            "from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::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 4fsccz71ghz1yGS\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 23:11:15 +1000 (AEST)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id E6E483064CC3\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 13:08:00 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id CFCFC3BD625;\n\tFri, 10 Apr 2026 13:07:50 +0000 (UTC)",
            "from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\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 A14D93AB298;\n\tFri, 10 Apr 2026 13:07:50 +0000 (UTC)",
            "by smtp.kernel.org (Postfix) with ESMTPS id 7968DC2BCB2;\n\tFri, 10 Apr 2026 13:07:50 +0000 (UTC)",
            "from aws-us-west-2-korg-lkml-1.web.codeaurora.org\n (localhost.localdomain [127.0.0.1])\n\tby smtp.lore.kernel.org (Postfix) with ESMTP id 72951F4485F;\n\tFri, 10 Apr 2026 13:07:50 +0000 (UTC)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775826470; cv=none;\n b=pFRmKvaDVZ/O6pz1rW58wnPEY+w4u2ZW2ysosdTrxUMmeDn6sqjaJ53NncMMbazfUCVFkBaSL6B+wQKNc5le+yqvM34CKWw20OGINqXDdVWNFloLBCoR7zqFnA1JJWHVj0JANGDWLAqz5jCUTgwZEVRlGBN/XlCnj4PaPzIjfm4=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775826470; c=relaxed/simple;\n\tbh=WruEaqmfkr32yZ9KLgn+0NEjTWpg2U9pf7twuJ0ae8Q=;\n\th=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:\n\t In-Reply-To:To:Cc;\n b=LYXnk0u1lVyehBTk6Kcew1L4ZGPVTI96Xpy0awS/sh5K+X869fbU1nKVf5HHucmLDOuCDKrjmZzQRVNzeLUwa4v69kGY99l5JHo7pVZaUkI2c82knTOn3A8xEIbecpTdoMiznJz6DUhuuXxOxjNNboIE2ytBRMs8hhbGwQEoUyw=",
        "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=n2484PuZ; arc=none smtp.client-ip=10.30.226.201",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1775826470;\n\tbh=WruEaqmfkr32yZ9KLgn+0NEjTWpg2U9pf7twuJ0ae8Q=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From;\n\tb=n2484PuZyfQkY0JmcvKIqLkj3AJw15T76fJcubztzySbZnbG0pBAWhUuO1dsjZSGo\n\t YrtS/IbVRHKpoxuSCNKT8eRJVyb9AW3HHGkLSt5u9s/OSB3+tryoNHM6dn09tcm77a\n\t 7gMsfu/+JQQy2BCuRdWoi+74PdvWZcPV3nlCcSeJeQbdrugk6gFQk754p0U2M5xxhq\n\t 0RuWg99vVfmnyKCzAtfYCrtlGp1bf03sHnif8Uln3A7+BaCsTwafrZysBCbO6xnYOr\n\t EB36ysvymLUQqBwKOd9/PVrBDyXtsV9r/xoUCq6WAp9nYJfQVxKLbbds1Xfw9WQVvp\n\t RxbWJgh5p77fw==",
        "From": "Nathan Lynch via B4 Relay <devnull+nathan.lynch.amd.com@kernel.org>",
        "Date": "Fri, 10 Apr 2026 08:07:25 -0500",
        "Subject": "[PATCH 15/23] dmaengine: sdxi: Per-context access key (AKey) table\n entry allocator",
        "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-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "7bit",
        "Message-Id": "<20260410-sdxi-base-v1-15-1d184cb5c60a@amd.com>",
        "References": "<20260410-sdxi-base-v1-0-1d184cb5c60a@amd.com>",
        "In-Reply-To": "<20260410-sdxi-base-v1-0-1d184cb5c60a@amd.com>",
        "To": "Vinod Koul <vkoul@kernel.org>",
        "Cc": "Wei Huang <wei.huang2@amd.com>,\n Mario Limonciello <mario.limonciello@amd.com>,\n Bjorn Helgaas <bhelgaas@google.com>,\n Jonathan Cameron <jonathan.cameron@huawei.com>,\n Stephen Bates <Stephen.Bates@amd.com>, PradeepVineshReddy.Kodamati@amd.com,\n John.Kariuki@amd.com, linux-pci@vger.kernel.org,\n linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org,\n Nathan Lynch <nathan.lynch@amd.com>",
        "X-Mailer": "b4 0.15.2",
        "X-Developer-Signature": "v=1; a=ed25519-sha256; t=1775826467; l=3996;\n i=nathan.lynch@amd.com; s=20260410; h=from:subject:message-id;\n bh=xM2FGHLq6TQB7ArRAf3V9Xhjrb67k3x/AkY1HQPO5Q4=;\n b=rTIQiw+zTFxDWBJcNZ1EhzZHuGqJ/VcHG0jcXFMHnx9gZ0q7el1Y4xTktMb48O5pJLc0z6jWz\n mxATmGFkhIWBSOQU4z+Y2mBWMmA1NhqSQFaNRipagID+VrPDfEAFsh3",
        "X-Developer-Key": "i=nathan.lynch@amd.com; a=ed25519;\n pk=PK4ozhq+/z9/2Jl5rgDmvHa9raVomv79qM8p1RAFpEw=",
        "X-Endpoint-Received": "by B4 Relay for nathan.lynch@amd.com/20260410 with\n auth_id=728",
        "X-Original-From": "Nathan Lynch <nathan.lynch@amd.com>",
        "Reply-To": "nathan.lynch@amd.com"
    },
    "content": "From: Nathan Lynch <nathan.lynch@amd.com>\n\nEach SDXI context has a table of access keys (AKeys). SDXI descriptors\nsubmitted to a context may refer to an AKey associated with that\ncontext by its index in the table. AKeys describe properties of the\naccess that the descriptor is to perform, such as PASID or a target\nSDXI function, or an interrupt to trigger.\n\nUse a per-context IDA to keep track of used entries in the table.\nProvide sdxi_alloc_akey(), which claims an AKey table entry for the\ncaller to program directly; sdxi_akey_index(), which returns the\nentry's index for programming into descriptors the caller intends to\nsubmit; and sdxi_free_akey(), which clears the entry and makes it\navailable again.\n\nThe DMA engine provider is currently the only user and allocates a\nsingle entry that encodes the access properties for copy operations\nand a completion interrupt. More complex use patterns are possible\nwhen user space gains access to SDXI contexts (not in this series).\n\nCo-developed-by: Wei Huang <wei.huang2@amd.com>\nSigned-off-by: Wei Huang <wei.huang2@amd.com>\nSigned-off-by: Nathan Lynch <nathan.lynch@amd.com>\n---\n drivers/dma/sdxi/context.c |  5 +++++\n drivers/dma/sdxi/context.h | 24 ++++++++++++++++++++++++\n 2 files changed, 29 insertions(+)",
    "diff": "diff --git a/drivers/dma/sdxi/context.c b/drivers/dma/sdxi/context.c\nindex 792b5032203b..04e0d3e6a337 100644\n--- a/drivers/dma/sdxi/context.c\n+++ b/drivers/dma/sdxi/context.c\n@@ -15,6 +15,7 @@\n #include <linux/dma-mapping.h>\n #include <linux/dmapool.h>\n #include <linux/errno.h>\n+#include <linux/idr.h>\n #include <linux/iommu.h>\n #include <linux/io-64-nonatomic-lo-hi.h>\n #include <linux/slab.h>\n@@ -61,6 +62,7 @@ static void sdxi_free_cxt(struct sdxi_cxt *cxt)\n \t\tdma_free_coherent(sdxi_to_dev(sdxi), sq->ring_size,\n \t\t\t\t  sq->desc_ring, sq->ring_dma);\n \tkfree(cxt->sq);\n+\tida_destroy(&cxt->akey_ida);\n \tkfree(cxt->ring_state);\n \tkfree(cxt);\n }\n@@ -381,6 +383,7 @@ int sdxi_admin_cxt_init(struct sdxi_dev *sdxi)\n \tcxt->db = sdxi->dbs + cxt->id * sdxi->db_stride;\n \tsdxi_ring_state_init(cxt->ring_state, &sq->cxt_sts->read_index,\n \t\t\t     sq->write_index, sq->ring_entries, sq->desc_ring);\n+\tida_init(&cxt->akey_ida);\n \n \terr = sdxi_publish_cxt(cxt);\n \tif (err)\n@@ -406,6 +409,8 @@ struct sdxi_cxt *sdxi_cxt_new(struct sdxi_dev *sdxi)\n \tsq = cxt->sq;\n \tsdxi_ring_state_init(cxt->ring_state, &sq->cxt_sts->read_index,\n \t\t\t     sq->write_index, sq->ring_entries, sq->desc_ring);\n+\tida_init(&cxt->akey_ida);\n+\n \tif (register_cxt(sdxi, cxt))\n \t\treturn NULL;\n \ndiff --git a/drivers/dma/sdxi/context.h b/drivers/dma/sdxi/context.h\nindex 9779b9aa4f86..5310e51a668c 100644\n--- a/drivers/dma/sdxi/context.h\n+++ b/drivers/dma/sdxi/context.h\n@@ -6,7 +6,10 @@\n #ifndef DMA_SDXI_CONTEXT_H\n #define DMA_SDXI_CONTEXT_H\n \n+#include <linux/array_size.h>\n #include <linux/dma-mapping.h>\n+#include <linux/idr.h>\n+#include <linux/string.h>\n #include <linux/types.h>\n \n #include \"hw.h\"\n@@ -50,6 +53,7 @@ struct sdxi_cxt {\n \tstruct sdxi_cxt_ctl *cxt_ctl;\n \tdma_addr_t cxt_ctl_dma;\n \n+\tstruct ida akey_ida;\n \tstruct sdxi_akey_table *akey_table;\n \tdma_addr_t akey_table_dma;\n \n@@ -75,4 +79,24 @@ static inline bool sdxi_cxt_is_admin(const struct sdxi_cxt *cxt)\n \n void sdxi_cxt_push_doorbell(struct sdxi_cxt *cxt, u64 index);\n \n+static inline struct sdxi_akey_ent *sdxi_alloc_akey(struct sdxi_cxt *cxt)\n+{\n+\tunsigned int max = ARRAY_SIZE(cxt->akey_table->entry) - 1;\n+\tint idx = ida_alloc_max(&cxt->akey_ida, max, GFP_KERNEL);\n+\n+\treturn idx < 0 ? NULL : &cxt->akey_table->entry[idx];\n+}\n+\n+static inline unsigned int sdxi_akey_index(const struct sdxi_cxt *cxt,\n+\t\t\t\t\t   const struct sdxi_akey_ent *akey)\n+{\n+\treturn akey - &cxt->akey_table->entry[0];\n+}\n+\n+static inline void sdxi_free_akey(struct sdxi_cxt *cxt, struct sdxi_akey_ent *akey)\n+{\n+\tmemset(akey, 0, sizeof(*akey));\n+\tida_free(&cxt->akey_ida, sdxi_akey_index(cxt, akey));\n+}\n+\n #endif /* DMA_SDXI_CONTEXT_H */\n",
    "prefixes": [
        "15/23"
    ]
}