get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2234515,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2234515/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/opensbi/patch/acd52b0f3468758bc5f09e6a45662341b31d4d87.1778176768.git.evvoevod@tenstorrent.com/",
    "project": {
        "id": 67,
        "url": "http://patchwork.ozlabs.org/api/1.2/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": "<acd52b0f3468758bc5f09e6a45662341b31d4d87.1778176768.git.evvoevod@tenstorrent.com>",
    "list_archive_url": null,
    "date": "2026-05-07T18:08:06",
    "name": "[v3,5/6] lib: sbi: Move Zkr entropy initialization from fw_base.S to init_coldboot",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "64a11c78a7f299f26ef7fe3c7495d730f80b9a89",
    "submitter": {
        "id": 92832,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/92832/?format=api",
        "name": "Evgeny Voevodin",
        "email": "evvoevod@tenstorrent.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/opensbi/patch/acd52b0f3468758bc5f09e6a45662341b31d4d87.1778176768.git.evvoevod@tenstorrent.com/mbox/",
    "series": [
        {
            "id": 503241,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/503241/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/opensbi/list/?series=503241",
            "date": "2026-05-07T18:08:05",
            "name": "Add RNMI handler infrastructure for Smrnmi extension",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/503241/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2234515/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2234515/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=F2+7pUJ6;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=tenstorrent.com header.i=@tenstorrent.com\n header.a=rsa-sha256 header.s=google header.b=RsAfB+PC;\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 4gBKxs6c7yz23mF\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 04:08:49 +1000 (AEST)",
            "from localhost ([::1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux))\n\tid 1wL39P-00000004YTs-1hMl;\n\tThu, 07 May 2026 18:08:43 +0000",
            "from mail-dl1-x122e.google.com ([2607:f8b0:4864:20::122e])\n\tby bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux))\n\tid 1wL39J-00000004YQN-2VpN\n\tfor opensbi@lists.infradead.org;\n\tThu, 07 May 2026 18:08:42 +0000",
            "by mail-dl1-x122e.google.com with SMTP id\n a92af1059eb24-1324053d600so72721c88.0\n        for <opensbi@lists.infradead.org>;\n Thu, 07 May 2026 11:08:37 -0700 (PDT)",
            "from ausc-rvsw-c-02.tenstorrent.com ([38.104.49.66])\n        by smtp.gmail.com with ESMTPSA id\n 5a478bee46e88-2f82b5636besm78285eec.2.2026.05.07.11.08.35\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Thu, 07 May 2026 11:08:36 -0700 (PDT)"
        ],
        "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=4D3bSH6Q/QsQG4LiHLpnwKdwLiJgEW9rkwG/khWzu7I=; b=F2+7pUJ6+PmoZe\n\tlMWz/NQJpujqshGCtyxwGFkdXhxQGZqgWFW4Al4xrdl2f4xsARH8FOKpM8YG+3KfOOPpsTDKMqjvu\n\tE9v+USgLppaJGsQsHF3IwLli4UVtvBr/GvC/06XWlvf51zullUHqQpVU6GuNh2o9AJqs0UL/JrrxK\n\t1tJy0WS9EUtYUTXVi6KQ8M1KyFF7/xGViBgqsy+Zy3Vg1EEBFSuvl8O+LHjVcM5DLuSHLz4mFmqf0\n\teHfnZ402bKpxkPKo3aHpWgOPzCvIlSOt/HMKAz4CMEfhKVsCO6Ldt7ViHnwiBs2pR0G0/e+7V5MuV\n\tjr2IkWKPlc5eyFVzH3GQ==;",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=tenstorrent.com; s=google; t=1778177317; x=1778782117;\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=1g1xEIwxBANHcBUcF/nE8ldZCr6OzqBld1tp1S5iJXo=;\n        b=RsAfB+PC54mw6FOIKG9iJEm+41/BEx6oVG8J3DfBmPbk5ACS2elrWKUC1ovSMrAyoz\n         P447EGoJROMdE2HL3pb/lO2twL11ma9sMoCFf6klgA7NC3wMmM/aX/MfPRwbmhgM6+m+\n         SdqqL2HDyIa3GCMXeIo7+3J14pvrJzavfo1nMaTNqvj4Qup9snJsGNSAkBA1szDtQ1F9\n         xQ6HWG1GcgL0xlDWGvR8nbTucrDyS0bze4kNRChXnYvA7wIZ+bepp4OVC69dZuGaMQUq\n         h+0yWl59fW9ep7cQayIJdguzqBKLzpkRUOCufFU8y511w/PpsWPslnhNHaav+RkXOG01\n         fkEg=="
        ],
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1778177317; x=1778782117;\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=1g1xEIwxBANHcBUcF/nE8ldZCr6OzqBld1tp1S5iJXo=;\n        b=Uwq34wA0ek4C/15v8goqz+j31jkdDbwNcaLPYIzIHwqwvowyAjL0gyOm7idsh0eb0r\n         HXawoYchsmUC7AJD6UBHmimQyvaTHSQ3k0iKrQuGc6XhTnsdP6TEmkaJMtNAvhTjJ986\n         NCfwNNtPkz+y1X6llVBHBtlkkv+oelHM/zV2h75PS2KvCWJ56LFxh15mJX7K2kMXPnQ8\n         p1S4fZihcdmLZwqotpo5SMOAE2x//V6hlU6bJZV8CA5e9Rbjj0/GtkVuGe7ZZfatOOZP\n         2TD6eZG0q/oa2wBsiV3TSOsLjqpa6Ho7uHgJHs8G1Sd2Fce+WESCIT9JJkpn4CAi9Muf\n         bepQ==",
        "X-Gm-Message-State": "AOJu0Yy42Jmj5rqTCNIWhky3mxP7Mynf45n3Yrij9wWixEdFx9qRoxbg\n\t4wHByw6y/+FRqzVIm9ORoF2cSXRdw+X0kDGGgPfAJgq1i2qx5cBMdAvniajfmY1TRa5lN1MoVBK\n\tnWqbZ",
        "X-Gm-Gg": "Acq92OF++wIIBE0/0I0GrQrVz+Yo3PbI+O/VP91s1px1I1haxL3YWBW1wd0YKB9AuHO\n\ttQr1LcxO+U2t7cnyXgTXgXLUubQBtNXe8bU1oJe5YvEEycLOhJhBPTR19yo2vI4ctO9EnXyQdu5\n\twS99mKn85Wer14RgUytgRMpii6HfN/Y5DLzwHC7+XH2nHBUg2ABvKD7YfYgq/GkBPTKijEoLoXR\n\txn8vatmCx4RHVrVyvr3ROlbnbIlJkWgGDTrDFbskG0rvGbQD+H4a94dI0s/i3SX95Fa2HxmBgpR\n\toT2lY8vkteXIgR6F5bMIhp+2aFQzMM+aYDJ2YDD8ijh58lo2Pm5OGa5IYOOjxAeQVCIwOayZE8o\n\tQlZVcIB/79pyJpk7uu2viwl8So/TzN0q8WRG7X4aXABS2Or+/Lym8RxFTvKIZF5jd9Wxebgz9kn\n\tnqYv17vmCrxexHEohmJC+2aODeeO60809Qjm+wt6gSQrJfp+P7eA==",
        "X-Received": "by 2002:a05:693c:3015:b0:2d9:2896:2794 with SMTP id\n 5a478bee46e88-2f54c77cb34mr1962600eec.7.1778177316519;\n        Thu, 07 May 2026 11:08:36 -0700 (PDT)",
        "From": "Evgeny Voevodin <evvoevod@tenstorrent.com>",
        "To": "Anup Patel <anup@brainfault.org>",
        "Cc": "opensbi@lists.infradead.org,\n\tNylon Chen <nylon.chen@sifive.com>,\n\tevvoevod@tenstorrent.com",
        "Subject": "[PATCH v3 5/6] lib: sbi: Move Zkr entropy initialization from\n fw_base.S to init_coldboot",
        "Date": "Thu,  7 May 2026 18:08:06 +0000",
        "Message-ID": "\n <acd52b0f3468758bc5f09e6a45662341b31d4d87.1778176768.git.evvoevod@tenstorrent.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<cover.1778176768.git.evvoevod@tenstorrent.com>",
        "References": "<cover.1778176768.git.evvoevod@tenstorrent.com>",
        "MIME-Version": "1.0",
        "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 ",
        "X-CRM114-CacheID": "sfid-20260507_110838_969390_4D4BBBCD ",
        "X-CRM114-Status": "GOOD (  13.73  )",
        "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:  Current placement of entropy initialization via Zkr\n extension\n    requires a trap-based mechanism to handle absent Zkr extension case. In\n presence\n    of Smrnmi extension no trap-based mechanisms should be us [...]\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:122e listed in]\n                             [list.dnswl.org]\n -0.0 SPF_PASS               SPF: sender matches SPF record\n  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record\n -0.1 DKIM_VALID_EF          Message has a valid DKIM or DK signature from\n                             envelope-from domain\n -0.1 DKIM_VALID             Message has at least one valid DKIM or DK\n signature\n -0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from\n author's\n                             domain\n  0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n not necessarily valid\n -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n                             [score: 0.0000]\n -0.0 DMARC_PASS             DMARC pass policy",
        "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": "Current placement of entropy initialization via Zkr extension requires a\ntrap-based mechanism to handle absent Zkr extension case. In presence of\nSmrnmi extension no trap-based mechanisms should be used before Smrnmi is\ndetected and enabled otherwise trap will jump to undefined location.\nMove stack guard initialization into init_coldboot function body after\ndevice tree has been parsed so we know if Zkr extension is implemented by\nthe platform which helps to avoid trap-based discovery.\ninit_coldboot() is a safe place to initialize entropy because it doesn't\nreturn so no check of __stack_chk_guard against value on entry\nwill be done.\n\nSigned-off-by: Evgeny Voevodin <evvoevod@tenstorrent.com>\n---\n firmware/fw_base.S | 32 --------------------------------\n lib/sbi/sbi_init.c | 31 +++++++++++++++++++++++++++++++\n 2 files changed, 31 insertions(+), 32 deletions(-)",
    "diff": "diff --git a/firmware/fw_base.S b/firmware/fw_base.S\nindex 043de7d7..5d6540d7 100644\n--- a/firmware/fw_base.S\n+++ b/firmware/fw_base.S\n@@ -107,30 +107,6 @@ _bss_zero:\n \tadd\ts4, s4, __SIZEOF_POINTER__\n \tblt\ts4, s5, _bss_zero\n \n-\t/* Trying to initialize the stack guard via the Zkr extension */\n-\tlla\tt0, __stack_chk_guard_done\n-\tcsrw\tCSR_MTVEC, t0\n-\tli\tt0, 0\n-\tli\tt3, SEED_OPTS_ES16\n-\tli\tt4, SEED_ENTROPY_MASK\n-\tli\tt5, __SIZEOF_POINTER__\n-__stack_chk_guard_loop:\n-\tcsrrw\tt1, CSR_SEED, x0\n-\tli\tt2, SEED_OPTS_MASK\n-\tand\tt2, t2, t1\n-\tbgtu\tt2, t3, __stack_chk_guard_done\n-\tbltu\tt2, t3, __stack_chk_guard_loop\n-\tand\tt1, t1, t4\n-\tslli\tt0, t0, 16\n-\tor\tt0, t0, t1\n-\taddi\tt5, t5, -2\n-\tbgtz\tt5, __stack_chk_guard_loop\n-\tlla\tt1, __stack_chk_guard\n-\tREG_S\tt0, 0(t1)\n-\tj\t__stack_chk_guard_done\n-\t.align 3\n-__stack_chk_guard_done:\n-\n \t/* Setup temporary trap handler */\n \tlla\ts4, _start_hang\n \tcsrw\tCSR_MTVEC, s4\n@@ -895,14 +871,6 @@ __stack_chk_fail:\n \tla\ta0, .Lstack_corrupt_msg\n \tcall\tsbi_panic\n \n-\t/* Initial value of the stack guard variable */\n-\t.section .data\n-\t.align 3\n-\t.globl __stack_chk_guard\n-\t.type __stack_chk_guard, %object\n-__stack_chk_guard:\n-\tRISCV_PTR\t0x95B5FF5A\n-\n #ifdef FW_FDT_PATH\n \t.section .rodata\n \t.align 4\ndiff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c\nindex aae035e1..b248e73f 100644\n--- a/lib/sbi/sbi_init.c\n+++ b/lib/sbi/sbi_init.c\n@@ -218,6 +218,8 @@ static void wake_coldboot_harts(struct sbi_scratch *scratch)\n \t__smp_store_release(&coldboot_done, 1);\n }\n \n+unsigned long __stack_chk_guard = 0x95B5FF5A;\n+\n static unsigned long entry_count_offset;\n static unsigned long init_count_offset;\n \n@@ -269,6 +271,35 @@ static void __noreturn init_coldboot(struct sbi_scratch *scratch, u32 hartid)\n \tif (rc)\n \t\tsbi_hart_hang();\n \n+\t/*\n+\t * Initialize stack guard via Zkr entropy source if Zkr is\n+\t * implemented according to device tree. Writing new seed value\n+\t * to __stack_chk_guard is safe here because function doesn't\n+\t * return and no check against value on entry will be done.\n+\t */\n+\tif (sbi_hart_has_extension(scratch, SBI_HART_EXT_ZKR)) {\n+\t\tunsigned long guard_val = 0;\n+\t\tint chunks = sizeof(unsigned long) / sizeof(uint16_t);\n+\t\tbool res = true;\n+\n+\t\twhile (chunks) {\n+\t\t\tunsigned long seed = csr_swap(CSR_SEED, 0);\n+\t\t\tunsigned long opst = seed & SEED_OPTS_MASK;\n+\n+\t\t\tif (opst == SEED_OPTS_DEAD) {\n+\t\t\t\tres = false;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t\tif (opst == SEED_OPTS_ES16) {\n+\t\t\t\tguard_val = (guard_val << 16) | (seed & SEED_ENTROPY_MASK);\n+\t\t\t\tchunks--;\n+\t\t\t}\n+\t\t\tcontinue;\n+\t\t}\n+\t\tif (res)\n+\t\t\t__stack_chk_guard = guard_val;\n+\t}\n+\n \trc = sbi_timer_init(scratch, true);\n \tif (rc)\n \t\tsbi_hart_hang();\n",
    "prefixes": [
        "v3",
        "5/6"
    ]
}