get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2222471,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2222471/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/f257db26a7123c201917bf657d1d147e7cc63965.1775959096.git.chao.liu.zevorn@gmail.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<f257db26a7123c201917bf657d1d147e7cc63965.1775959096.git.chao.liu.zevorn@gmail.com>",
    "list_archive_url": null,
    "date": "2026-04-12T02:20:22",
    "name": "[v6,5/7] target/riscv: add sdext enter Debug Mode on ebreak",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "4af35932f0a1c4ece87c3baf3874b1fa892aa12c",
    "submitter": {
        "id": 92265,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/92265/?format=api",
        "name": "Chao Liu",
        "email": "chao.liu.zevorn@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/f257db26a7123c201917bf657d1d147e7cc63965.1775959096.git.chao.liu.zevorn@gmail.com/mbox/",
    "series": [
        {
            "id": 499584,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/499584/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=499584",
            "date": "2026-04-12T02:20:20",
            "name": "riscv: add initial sdext support",
            "version": 6,
            "mbox": "http://patchwork.ozlabs.org/series/499584/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2222471/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2222471/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.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 unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=AcVIGl+C;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4ftZ7R2Xzjz1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 12 Apr 2026 12:22:27 +1000 (AEST)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wBkS7-0004FP-PN; Sat, 11 Apr 2026 22:21:35 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <chao.liu.zevorn@gmail.com>)\n id 1wBkS6-0004F7-NC\n for qemu-devel@nongnu.org; Sat, 11 Apr 2026 22:21:34 -0400",
            "from mail-qv1-xf43.google.com ([2607:f8b0:4864:20::f43])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <chao.liu.zevorn@gmail.com>)\n id 1wBkS3-00006i-8q\n for qemu-devel@nongnu.org; Sat, 11 Apr 2026 22:21:34 -0400",
            "by mail-qv1-xf43.google.com with SMTP id\n 6a1803df08f44-8a05c388b27so52959136d6.3\n for <qemu-devel@nongnu.org>; Sat, 11 Apr 2026 19:21:30 -0700 (PDT)",
            "from ZEVORN-PC.bbrouter ([162.244.208.119])\n by smtp.gmail.com with ESMTPSA id\n 6a1803df08f44-8aca05592ecsm15455576d6.29.2026.04.11.19.21.25\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sat, 11 Apr 2026 19:21:30 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775960490; x=1776565290; darn=nongnu.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=FdBL5bIRSTgxNZUleWGlM4V/8XxdsxNqxbGWbaqEPcw=;\n b=AcVIGl+C5T39M+GJ7hHVAfQ9yLufeOgOfTEjSXIfkYieoEKITpu/LETPBDK5Bu1BWp\n O625shArxw1wQGH0EyiAJ+l9SPG/z4CEOkgyMwGzUL515DMbvtpo7b0+/oP0+5dmp44s\n lvYTTj9XmmJnILFj2fFxT07oSTOCS9v5DQdSIPDwccnJ4lsNj9QV6wzPdgEhCtRfk/MN\n f5Ig3On3klk8hGqvwNUBdUlwaN5ngMPo7T9Cq4JXJbUYtc3Odus6j5mXKz2SfjFUKI3r\n 7vOI93WyOsGLru/rp5SrhtQv+Fn1oaL4ZzuP1230SoxgpXP8RWoOuFKV/fo3AG4nXkKd\n 0wBQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775960490; x=1776565290;\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=FdBL5bIRSTgxNZUleWGlM4V/8XxdsxNqxbGWbaqEPcw=;\n b=P4OHCE1dw2BteuFzr1DjDP8HeTCZnaU9m/6LIFtIsomt7CyXfDupqiHx3ksbvHNpCF\n kiwLzvmQBq+Mqbz5owKGkrG6s1YM/Rb14xo5qDx4hQvZsuCNTIJtMP60o7tYJTP+tjKJ\n R0W8lFhhuNUKQshKbxX4+uCstFbAdzdsGvN5y3EguIylIMzL0Ci7goLHIHABoe4X4BlR\n 9gQN45UDUbilbpqD+VFxCOpbOSRzWzoMUp9jYWyQeEJMFKqQimzCK3e34CjxbPCruht0\n n/449OQsd8hdtSTzkE9nLmcEF4h76tgshaocVzNhAT9W2nIPiC5XmxdbKRQh9HTt63p6\n vc3w==",
        "X-Gm-Message-State": "AOJu0Yyr3pbjABHr94L2JpCgtQ7XjT4qBq50sTH9f66LnMokUoxbxmMC\n q+XLRmr3gEy/3isKSWjGPerxiMsv9NnJ1rBIz6fWq1XCrZOGyb2lsXpU",
        "X-Gm-Gg": "AeBDiev0podVrd/i8SSeGiiCjZWeiNWzxSgZY0OElpbSizwgho5QzIk0XN/+5D5c3La\n qICR2mkU9It0mH6pfFrsOgcrlOvfWHBYI0bcM2gB9lhdc8OwO9b6JLbkXJU1h5dRfjmnGXLXfjb\n aPs7IizaxGddei9+nWrLkGRLUlEgbLqr+kfTXldlBlaqgRNMti6g8abq/lItY7VI9NcTxNcFUrZ\n TCvPddIlpP9mcBVgDI/DncaRvi4IpYZD3oTVSbIJS1UbV+3tyZBI0XRcy/RJC1/BPxCZ0AmOqyg\n xZS+S2yh61tZNK9pUyjvrMn/2791x3MsuHBXhfBBbEke0Aw7g2ZNVjCd2KdNg5SPoBJDdS5Nh4q\n yHoZwqADx31RaTTQYXhohz267sW6EMLNmbGIpjdcG5qzkkVPPDmMTiDW6atCTjGegB2xn9wHSvc\n EE9p+TocjFlnn+Z5dZC8naVTRc54yBVEtXILXxgHnYWhFAhsS9GrN3GBJUduohqQKi81XnQXJ7l\n /AF2Jc=",
        "X-Received": "by 2002:a05:6214:cc8:b0:8a1:fb3:5a37 with SMTP id\n 6a1803df08f44-8ac86160012mr143676646d6.9.1775960490342;\n Sat, 11 Apr 2026 19:21:30 -0700 (PDT)",
        "From": "Chao Liu <chao.liu.zevorn@gmail.com>",
        "To": "Pierrick Bouvier <pierrick.bouvier@linaro.org>,\n Palmer Dabbelt <palmer@dabbelt.com>,\n Alistair Francis <alistair.francis@wdc.com>,\n Weiwei Li <liwei1518@gmail.com>,\n Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>,\n Liu Zhiwei <zhiwei_liu@linux.alibaba.com>,\n Chao Liu <chao.liu.zevorn@gmail.com>",
        "Cc": "qemu-devel@nongnu.org, tangtao1634@phytium.com.cn,\n devel@lists.libvirt.org,\n qemu-riscv@nongnu.org",
        "Subject": "[PATCH v6 5/7] target/riscv: add sdext enter Debug Mode on ebreak",
        "Date": "Sun, 12 Apr 2026 10:20:22 +0800",
        "Message-ID": "\n <f257db26a7123c201917bf657d1d147e7cc63965.1775959096.git.chao.liu.zevorn@gmail.com>",
        "X-Mailer": "git-send-email 2.53.0",
        "In-Reply-To": "<cover.1775959096.git.chao.liu.zevorn@gmail.com>",
        "References": "<cover.1775959096.git.chao.liu.zevorn@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Received-SPF": "pass client-ip=2607:f8b0:4864:20::f43;\n envelope-from=chao.liu.zevorn@gmail.com; helo=mail-qv1-xf43.google.com",
        "X-Spam_score_int": "-20",
        "X-Spam_score": "-2.1",
        "X-Spam_bar": "--",
        "X-Spam_report": "(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no",
        "X-Spam_action": "no action",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "qemu development <qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"
    },
    "content": "RISC-V Debug Specification:\nhttps://github.com/riscv/riscv-debug-spec/releases/tag/1.0\n\nRoute EBREAK via helper_sdext_ebreak. If Sdext is enabled and the\nmatching dcsr.ebreak* bit is set, enter Debug Mode with cause=ebreak\nand stop with EXCP_DEBUG. Otherwise keep the normal breakpoint trap.\n\nSigned-off-by: Chao Liu <chao.liu.zevorn@gmail.com>\nReviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>\nTested-by: Tao Tang <tangtao1634@phytium.com.cn>\n---\n target/riscv/helper.h                         |  1 +\n .../riscv/insn_trans/trans_privileged.c.inc   |  6 ++++\n target/riscv/op_helper.c                      | 34 +++++++++++++++++++\n 3 files changed, 41 insertions(+)",
    "diff": "diff --git a/target/riscv/helper.h b/target/riscv/helper.h\nindex c8e76eb116..9538e816f0 100644\n--- a/target/riscv/helper.h\n+++ b/target/riscv/helper.h\n@@ -143,6 +143,7 @@ DEF_HELPER_1(tlb_flush_all, void, env)\n DEF_HELPER_4(ctr_add_entry, void, env, tl, tl, tl)\n /* Native Debug */\n DEF_HELPER_1(itrigger_match, void, env)\n+DEF_HELPER_2(sdext_ebreak, void, env, tl)\n #endif\n \n /* Hypervisor functions */\ndiff --git a/target/riscv/insn_trans/trans_privileged.c.inc b/target/riscv/insn_trans/trans_privileged.c.inc\nindex f8641b1977..84f0c77513 100644\n--- a/target/riscv/insn_trans/trans_privileged.c.inc\n+++ b/target/riscv/insn_trans/trans_privileged.c.inc\n@@ -68,9 +68,15 @@ static bool trans_ebreak(DisasContext *ctx, arg_ebreak *a)\n     if (pre == 0x01f01013 && ebreak == 0x00100073 && post == 0x40705013) {\n         generate_exception(ctx, RISCV_EXCP_SEMIHOST);\n     } else {\n+#ifndef CONFIG_USER_ONLY\n+        gen_update_pc(ctx, 0);\n+        gen_helper_sdext_ebreak(tcg_env, tcg_constant_tl(ebreak_addr));\n+        ctx->base.is_jmp = DISAS_NORETURN;\n+#else\n         tcg_gen_st_tl(tcg_constant_tl(ebreak_addr), tcg_env,\n                       offsetof(CPURISCVState, badaddr));\n         generate_exception(ctx, RISCV_EXCP_BREAKPOINT);\n+#endif\n     }\n     return true;\n }\ndiff --git a/target/riscv/op_helper.c b/target/riscv/op_helper.c\nindex ce68ee5959..58d47b88c1 100644\n--- a/target/riscv/op_helper.c\n+++ b/target/riscv/op_helper.c\n@@ -456,6 +456,40 @@ target_ulong helper_dret(CPURISCVState *env)\n #endif\n }\n \n+void helper_sdext_ebreak(CPURISCVState *env, target_ulong pc)\n+{\n+    CPUState *cs = env_cpu(env);\n+    bool enter_debug = false;\n+\n+    if (riscv_cpu_cfg(env)->ext_sdext && !env->debug_mode) {\n+        if (env->virt_enabled) {\n+            if (env->priv == PRV_S) {\n+                enter_debug = env->dcsr & DCSR_EBREAKVS;\n+            } else if (env->priv == PRV_U) {\n+                enter_debug = env->dcsr & DCSR_EBREAKVU;\n+            }\n+        } else {\n+            if (env->priv == PRV_M) {\n+                enter_debug = env->dcsr & DCSR_EBREAKM;\n+            } else if (env->priv == PRV_S) {\n+                enter_debug = env->dcsr & DCSR_EBREAKS;\n+            } else if (env->priv == PRV_U) {\n+                enter_debug = env->dcsr & DCSR_EBREAKU;\n+            }\n+        }\n+    }\n+\n+    env->badaddr = pc;\n+\n+    if (enter_debug) {\n+        riscv_cpu_enter_debug_mode(env, pc, DCSR_CAUSE_EBREAK);\n+        cs->exception_index = EXCP_DEBUG;\n+        cpu_loop_exit_restore(cs, GETPC());\n+    }\n+\n+    riscv_raise_exception(env, RISCV_EXCP_BREAKPOINT, GETPC());\n+}\n+\n target_ulong helper_mnret(CPURISCVState *env)\n {\n     target_ulong retpc = env->mnepc;\n",
    "prefixes": [
        "v6",
        "5/7"
    ]
}