get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2194950,
    "url": "http://patchwork.ozlabs.org/api/patches/2194950/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/opensbi/patch/20260210094044.72591-3-ganboing@gmail.com/",
    "project": {
        "id": 67,
        "url": "http://patchwork.ozlabs.org/api/projects/67/?format=api",
        "name": "OpenSBI development",
        "link_name": "opensbi",
        "list_id": "opensbi.lists.infradead.org",
        "list_email": "opensbi@lists.infradead.org",
        "web_url": "https://github.com/riscv/opensbi",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": "https://github.com/riscv/opensbi/commit/{}"
    },
    "msgid": "<20260210094044.72591-3-ganboing@gmail.com>",
    "list_archive_url": null,
    "date": "2026-02-10T09:40:39",
    "name": "[2/7] include: sbi: Add sbi_regs_prev_xlen",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "838fc254b1dd4248a0e9a5b648ae3fba92875428",
    "submitter": {
        "id": 86401,
        "url": "http://patchwork.ozlabs.org/api/people/86401/?format=api",
        "name": "Bo Gan",
        "email": "ganboing@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/opensbi/patch/20260210094044.72591-3-ganboing@gmail.com/mbox/",
    "series": [
        {
            "id": 491635,
            "url": "http://patchwork.ozlabs.org/api/series/491635/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/opensbi/list/?series=491635",
            "date": "2026-02-10T09:40:41",
            "name": "Fixes for load/store misaligned and access faults",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/491635/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2194950/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2194950/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=lists.infradead.org header.i=@lists.infradead.org\n header.a=rsa-sha256 header.s=bombadil.20210309 header.b=xjhWXeAW;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20230601 header.b=mxQnYaRD;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=none (no SPF record) smtp.mailfrom=lists.infradead.org\n (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;\n envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from bombadil.infradead.org (bombadil.infradead.org\n [IPv6:2607:7c80:54:3::133])\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 4f9Gp24FCWz1yBL\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 10 Feb 2026 20:43:02 +1100 (AEDT)",
            "from localhost ([::1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1vpkGh-0000000GlXM-39EC;\n\tTue, 10 Feb 2026 09:42:51 +0000",
            "from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635])\n\tby bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1vpkGg-0000000GlWV-0vVA\n\tfor opensbi@lists.infradead.org;\n\tTue, 10 Feb 2026 09:42:51 +0000",
            "by mail-pl1-x635.google.com with SMTP id\n d9443c01a7336-2a8fba3f769so23899225ad.2\n        for <opensbi@lists.infradead.org>;\n Tue, 10 Feb 2026 01:42:49 -0800 (PST)",
            "from m91p.airy.home ([172.92.174.155])\n        by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2a9521b8d79sm133219215ad.61.2026.02.10.01.42.47\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Tue, 10 Feb 2026 01:42:47 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20210309; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:\n\tMessage-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=MGrY3oKk+8ES6Md7sQMNS0SVIzSbCBLR1Zxv1u+Hb38=; b=xjhWXeAWGASleg\n\tHt9VoltbSnQLb3O2cchht0BYYEpZZm8M8LuLvyucxmTi5CnxUykA5CArs0OoAcfEpDTMEL7W3PfMd\n\tLjSNWtZ73NtTIBd+eYvTshpdEimx9qc+5MUbplEqrI2BME5/Rrte6eCsPSHKjRLdslvDTTi2g7A72\n\tFKaoH84VOQEH6PvIlkkkzLgPbxHbQ8InC5CDIZmpYjnWFOcw/CU2uRHRpwhCFEiUwfuXlOOGzSh4E\n\tsLZ5BLB95nY/fRlfEkiRRuGdGx+oNhlj1+y/Ia71bpLa7QtUvyLMbJlo0w+sFWYrLz9Yye2KI50l6\n\tpdwa58Gdv/ems8CSX+lQ==;",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20230601; t=1770716569; x=1771321369;\n darn=lists.infradead.org;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=n3R9vgO/x9b8W3dSnPHmMCrB3IuD4mg8nPaHgFUwEoQ=;\n        b=mxQnYaRDwnqwloGq7WtMBTXvE77pMskF+LWppP84I4a+Mi5dJ3zd54yim4XVrFEWbS\n         xa/z+sr1IYCnb1Ja7HZ6AMfNFLrOOrrsEazN1dInxuF2Ev/3uWCa995qsaxvj7/pIvZG\n         hSNfeo7wFd/RJTnJEAIVuBA3d4UvwOIOWuBAZxTy4QowkTLiYj/VKa8wP/zskRdNAVTN\n         wBgMep9mno2wi6kkBAZHmBmkdiZBQ9/hCyfFfW5sInQg0q5AqYwPwNMbjgGIj8h+izfe\n         CzG6rsN/Wl5c4fswsktR3uSFq+7DxeHuWdtig2gXIeyswWsf2yP5hTGKLFy+m1PELHG4\n         /X3Q=="
        ],
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20230601; t=1770716569; x=1771321369;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n         :to:cc:subject:date:message-id:reply-to;\n        bh=n3R9vgO/x9b8W3dSnPHmMCrB3IuD4mg8nPaHgFUwEoQ=;\n        b=bXbIYSXinQa7VnClIO7d8ZPFNWDFhfBoECYWPKqo/CGoyisEKKfZSBFBUwSvxsvpAG\n         ym3qOEkx0CMyWDf3AuM+f8JPApyxgGTdNQ0biUhcDAu3LXfSJPi6mAdFG00q2hZsxP8q\n         z4R2UP8QlYoylqRspJEuq8ccJz1wRnNm1YTtlfeopNEyOzIiXBJkfUlm0+VkfcV3HwNL\n         33axC45YiE98+6r4FpntGLj5sJc9Ow60CcGo67q3F/1PCT4CV5OzvC0misWaWniH+pT6\n         UgXKfXghYWEx4xGvUTpkScD1Oo/JrleWYw2vUPR7QCtcZBAcYfG+tPI29buZf+XP4kgX\n         wekQ==",
        "X-Gm-Message-State": "AOJu0YzqSdE53NB9/bM0rFCrKEKwNtDLM42GOG2LRfYV686R6ZtVgVM8\n\tgcC0H7pSQ7ksHnBaMNbZp6srIq7rUaHYxHW/f8EN/bf9Lefc+FkFCcBuQdPuGQ==",
        "X-Gm-Gg": "AZuq6aI/gNUjlcwhdDFawGlm+svvxp/kXTd9fsq9oRFjd1xiNoqz5dtKi727LhEuWtl\n\tYPQiJwwN1xQFf6mfZSlVVz08wOiwvEt3AFekrfXZu64hNLd1BO6oDE5LbCwsTRyPdWOto+uI45d\n\tffhvIFFA5duSeEinl+AhVxhAFquZdMY7e/37QsA0uJUtsRaHSELpzMk2VWyLsNYELGhaznGkB/O\n\t1sf4kl6WiH9ajAoTnUSm6gpdi9onpd/UgtAtIMYT/eQs6/odvL9gI3T8Hez9K2994teNwtgTEKo\n\tYm2qPxS+ImDYmiyv7Kbq6dZSkj/paJPn/yO5h4PBO7OD7KFqvg5lfTkw+gh0mOJOxU5vgAOC7ii\n\twzmxbD1RDvZS9V7mzlbkfcB3wMXQZqekAt6hwc5PRXS9rR81FmymEwgVVAorJThVbE6wbKBfPup\n\t4ogfjFDtTlBZdZhqO+npl7/Qmn",
        "X-Received": "by 2002:a17:903:124d:b0:29d:9755:9bd8 with SMTP id\n d9443c01a7336-2ab10344b46mr16257805ad.22.1770716568803;\n        Tue, 10 Feb 2026 01:42:48 -0800 (PST)",
        "From": "Bo Gan <ganboing@gmail.com>",
        "To": "opensbi@lists.infradead.org,\n\tdramforever@live.com,\n\tanup.patel@oss.qualcomm.com",
        "Cc": "anup@brainfault.org,\n\tcleger@rivosinc.com,\n\tsamuel.holland@sifive.com",
        "Subject": "[PATCH 2/7] include: sbi: Add sbi_regs_prev_xlen",
        "Date": "Tue, 10 Feb 2026 01:40:39 -0800",
        "Message-Id": "<20260210094044.72591-3-ganboing@gmail.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20260210094044.72591-1-ganboing@gmail.com>",
        "References": "<20260210094044.72591-1-ganboing@gmail.com>",
        "MIME-Version": "1.0",
        "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ",
        "X-CRM114-CacheID": "sfid-20260210_014250_278891_4703DE9B ",
        "X-CRM114-Status": "UNSURE (   9.76  )",
        "X-CRM114-Notice": "Please train this message.",
        "X-Spam-Score": "-2.1 (--)",
        "X-Spam-Report": "Spam detection software,\n running on the system \"bombadil.infradead.org\",\n has NOT identified this incoming email as spam.  The original\n message has been attached to this so you can view it or label\n similar future email.  If you have any questions, see\n the administrator of that system for details.\n Content preview:  sbi_regs_prev_xlen reports the xlen of previous mode by\n decoding\n    from multiple CSRs including mstatus/hstatus/vsstatus Signed-off-by: Bo\n Gan\n    --- include/sbi/sbi_trap.h | 58 ++++++++++++++++++++++++++++++++++++++++++\n    1 file changed, 58 insertions(+)\n Content analysis details:   (-2.1 points, 5.0 required)\n  pts rule name              description\n ---- ----------------------\n --------------------------------------------------\n -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/, no\n                             trust\n                             [2607:f8b0:4864:20:0:0:0:635 listed in]\n                             [list.dnswl.org]\n  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record\n -0.0 SPF_PASS               SPF: sender matches SPF record\n -0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from\n author's\n                             domain\n -0.1 DKIM_VALID             Message has at least one valid DKIM or DK\n signature\n  0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n not necessarily valid\n -0.1 DKIM_VALID_EF          Message has a valid DKIM or DK signature from\n                             envelope-from domain\n -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n                             [score: 0.0000]\n  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail\n provider\n                             [ganboing(at)gmail.com]",
        "X-BeenThere": "opensbi@lists.infradead.org",
        "X-Mailman-Version": "2.1.34",
        "Precedence": "list",
        "List-Id": "<opensbi.lists.infradead.org>",
        "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/opensbi>,\n <mailto:opensbi-request@lists.infradead.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.infradead.org/pipermail/opensbi/>",
        "List-Post": "<mailto:opensbi@lists.infradead.org>",
        "List-Help": "<mailto:opensbi-request@lists.infradead.org?subject=help>",
        "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/opensbi>,\n <mailto:opensbi-request@lists.infradead.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "\"opensbi\" <opensbi-bounces@lists.infradead.org>",
        "Errors-To": "opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"
    },
    "content": "sbi_regs_prev_xlen reports the xlen of previous mode by decoding\nfrom multiple CSRs including mstatus/hstatus/vsstatus\n\nSigned-off-by: Bo Gan <ganboing@gmail.com>\n---\n include/sbi/sbi_trap.h | 58 ++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 58 insertions(+)",
    "diff": "diff --git a/include/sbi/sbi_trap.h b/include/sbi/sbi_trap.h\nindex 731a0c98..4ef672f4 100644\n--- a/include/sbi/sbi_trap.h\n+++ b/include/sbi/sbi_trap.h\n@@ -273,6 +273,64 @@ static inline int sbi_mstatus_prev_mode(unsigned long mstatus)\n \treturn (mstatus & MSTATUS_MPP) >> MSTATUS_MPP_SHIFT;\n }\n \n+#if __riscv_xlen == 32\n+static inline int sbi_regs_prev_xlen(const struct sbi_trap_regs *regs)\n+{\n+\treturn __riscv_xlen;\n+}\n+#else\n+static inline int sbi_mstatus_sxl(unsigned long mstatus)\n+{\n+\treturn (mstatus & MSTATUS_SXL) >> MSTATUS_SXL_SHIFT;\n+}\n+\n+static inline int sbi_mstatus_uxl(unsigned long mstatus)\n+{\n+\treturn (mstatus & MSTATUS_UXL) >> MSTATUS_UXL_SHIFT;\n+}\n+\n+static inline int sbi_hstatus_vsxl(unsigned long hstatus)\n+{\n+\treturn (hstatus & HSTATUS_VSXL) >> HSTATUS_VSXL_SHIFT;\n+}\n+\n+static inline int sbi_regs_prev_xlen(const struct sbi_trap_regs *regs)\n+{\n+\tunsigned long hstatus, vsstatus;\n+\n+\tif (!sbi_regs_from_virt(regs)) {\n+\t\tswitch (sbi_mstatus_prev_mode(regs->mstatus)) {\n+\t\tcase PRV_M:\n+\t\t\treturn __riscv_xlen;\n+\t\tcase PRV_S:\n+\t\t\treturn MXL_TO_XLEN(sbi_mstatus_sxl(regs->mstatus));\n+\t\tcase PRV_U:\n+\t\t\treturn MXL_TO_XLEN(sbi_mstatus_uxl(regs->mstatus));\n+\t\tdefault:\n+\t\t\t__builtin_unreachable();\n+\t\t}\n+\t}\n+\n+\t/* V=1, Check HSXLEN first */\n+\tif (sbi_mstatus_sxl(regs->mstatus) < MXL_XLEN_64)\n+\t\treturn 32;\n+\n+\thstatus = csr_read(CSR_HSTATUS);\n+\t/* Check VSXLEN */\n+\tif (sbi_hstatus_vsxl(hstatus) < MXL_XLEN_64)\n+\t\treturn 32;\n+\n+\tvsstatus = csr_read(CSR_VSSTATUS);\n+\tswitch (sbi_mstatus_prev_mode(regs->mstatus)) {\n+\t\tcase PRV_S:\n+\t\t\treturn MXL_TO_XLEN(sbi_hstatus_vsxl(hstatus));\n+\t\tcase PRV_U:\n+\t\t\treturn MXL_TO_XLEN(sbi_mstatus_uxl(vsstatus));\n+\t}\n+\t__builtin_unreachable();\n+}\n+#endif\n+\n int sbi_trap_redirect(struct sbi_trap_regs *regs,\n \t\t      const struct sbi_trap_info *trap);\n \n",
    "prefixes": [
        "2/7"
    ]
}