{"id":2231986,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2231986/?format=json","web_url":"http://patchwork.ozlabs.org/project/opensbi/patch/20260501211627.3293126-3-evvoevod@tenstorrent.com/","project":{"id":67,"url":"http://patchwork.ozlabs.org/api/1.2/projects/67/?format=json","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":"<20260501211627.3293126-3-evvoevod@tenstorrent.com>","list_archive_url":null,"date":"2026-05-01T21:16:24","name":"[v2,2/5] lib: sbi: Add Smrnmi extension macros for registers and bits","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"ca606c7c0e4c1784dd1994b392b27501d18f3415","submitter":{"id":92832,"url":"http://patchwork.ozlabs.org/api/1.2/people/92832/?format=json","name":"Evgeny Voevodin","email":"evvoevod@tenstorrent.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/opensbi/patch/20260501211627.3293126-3-evvoevod@tenstorrent.com/mbox/","series":[{"id":502498,"url":"http://patchwork.ozlabs.org/api/1.2/series/502498/?format=json","web_url":"http://patchwork.ozlabs.org/project/opensbi/list/?series=502498","date":"2026-05-01T21:16:26","name":"Add RISC-V Smrnmi extension support","version":2,"mbox":"http://patchwork.ozlabs.org/series/502498/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2231986/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2231986/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=OWJJTwzF;\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=h2sayeL/;\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 4g6kPf6sn5z1yHZ\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 02 May 2026 07:16:52 +1000 (AEST)","from localhost ([::1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1wIvE6-00000007gps-2TB7;\n\tFri, 01 May 2026 21:16:46 +0000","from mail-dl1-x1233.google.com ([2607:f8b0:4864:20::1233])\n\tby bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1wIvE4-00000007goN-1aPs\n\tfor opensbi@lists.infradead.org;\n\tFri, 01 May 2026 21:16:45 +0000","by mail-dl1-x1233.google.com with SMTP id\n a92af1059eb24-12c7288cfb9so153473c88.2\n        for <opensbi@lists.infradead.org>;\n Fri, 01 May 2026 14:16:44 -0700 (PDT)","from ausc-rvsw-c-02.tenstorrent.com ([38.104.49.66])\n        by smtp.gmail.com with ESMTPSA id\n 5a478bee46e88-2ee3b29b2casm5879308eec.14.2026.05.01.14.16.42\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Fri, 01 May 2026 14:16:42 -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=4+hCkdphGhH4d24/QONrTMeuFInxdGeUXuXf9lu25vM=; b=OWJJTwzFbC9A7j\n\taPNiu71KR+J3ZG/8/22PI3CHAbX1jAsGAIvRrGUAy2ADVLh7psEwIL2QE7NMxaT8UYEa0kCKq/5nA\n\tRl9j/zqNaZbORYdXZXcb41Yxt6y9PvSGuyxhdmuG/c9HE0nD/pW+Ju/X5JOdYjUhwiX+FFvg4GCxl\n\tNvp35G78FUH70nUHTLw+sqZI7LaEeEIn7//p+STO5c/GW8IX67jK2MPp/TFhZz1axEBdlEbyCtaWL\n\tYF/RRsZFo1NhwwEiEyyrDKkIx9j3nuPgeHciFpFuGqNUUgWUDkED4NRiJ2H6JB9t6VBtJh7w58TG9\n\tWmsXxncFbb0kXyt44f9Q==;","v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=tenstorrent.com; s=google; t=1777670203; x=1778275003;\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=OSZhBQItjwmyUYAL8I7VshwlWGe3+bTqFitH9tH6nUI=;\n        b=h2sayeL/X7//sWtmjEniVptrGzeS8NnxRa3gpfgfABjuKAIex8PHbqz40ynWC2ehlZ\n         GoHxe4jOKtg/etz4SMDrEQRAkgtdnUAEfmSp28ysYEJJqKtrMCUsP3cbxfmUkBxzAyOc\n         tMg1g+FhK6+0p2HbTWA8yBFgn5M/mYxHq8tuXraG3dH1o+PvN3vcLsJAyvawVbxlSn17\n         WQrEgDItPg42S8xA96PIAGYxvNXEMQynIDvYKUiICyg+A0hYttLMjKN1q1b+fisvUg+z\n         sDvjZeVP2+h4KRmAm5vCQ6v2VmG6AmjtAFQEjElNXMoxmiWYugEiJRUeW/FBUqUatuRz\n         yqQg=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1777670203; x=1778275003;\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=OSZhBQItjwmyUYAL8I7VshwlWGe3+bTqFitH9tH6nUI=;\n        b=CphbHjrWafazIEuLFWbqb8uSh7sw4PyKA5KR29qbWndK/v7LGsCKZg1unWxEOYjgM0\n         BjX/DOFpXEKIMldN8m/2o7Fz8aVyFRjvDyxgj3kVRWP/ZcezohEd4OyMD3lePlZskDm6\n         Tb84yTAUuwMmsNrFe+NG7iFXjJSj3SssTwMwbMWksblpMVBmgfwZxSZft/UFDPg49WUo\n         xit74zpdJqqH7UFPr5RxdSDykRsVDtKV4EEffC9+QLDx/8zJu/K8srisfegyiRU65d+K\n         rNYw8wXcmDu7HeVEYeFSc2dmMfr7rXCCBrnLpknssnnDgsQsTLRlG3YVwa5YVov3PJNb\n         owjA==","X-Gm-Message-State":"AOJu0Yw6Ww9ZavpiMBmaHnWf7YVT9IxSLdmrK4itsxVyubEIUw9DY92V\n\tGmFajdtZ6HxyzfyEw92MKfperXw+8hyGQwwOIXCsQffRIE8+JRNTDUyyzw8XGHuPGFYz823mK+s\n\t9ARbp","X-Gm-Gg":"AeBDieuS7jZft7K8mI855m1dwgavmShb126F9BPVNF6dHdPBYQURi8gXmK5i56lJWdt\n\tOlmN0+HlzF5itkgXcPQhy1hc/YHcmq606fLrmbaCpbIWytWKcMGbT15HgkeWBNF8BDmMgaWiFAH\n\tkarRgmWLazoHoCnPq6w9uFRu/fT0e/a4g7/ZcEXP+dtzjReZC5z6NGtpBbbaOPuNVmrjJXrFMEI\n\tb7VVg4/R33wZnDfLX9kYatj8LSZaYdnblPnTsbMvPd2ufOGNBuAPXrPXdSyl0Dna6Mone12YiHW\n\trOlh2zNW3TLBYaOw49wWaUpPTKacoUsTrGNJKRTeYFTeUy0NCh7/1BfFzURgSPJIXnjxgCpLi7z\n\tWnJl3lhWRJt9jLQNh6KZb3zYlm9t6etLwyuxFEgcG89/vJ7ffLpm8dW9fWtd8f6WM4SUL1zMuJD\n\tCINVbVS8DZ61EnLMX2wp3RdWQ1yEVd7KCvFpFogBI+lGuMsg1PvP1DeNRMHJH8","X-Received":"by 2002:a05:693c:2c11:b0:2cb:de38:c76f with SMTP id\n 5a478bee46e88-2efba27a488mr189882eec.6.1777670203282;\n        Fri, 01 May 2026 14:16:43 -0700 (PDT)","From":"Evgeny Voevodin <evvoevod@tenstorrent.com>","To":"opensbi@lists.infradead.org","Cc":"Anup Patel <anup@brainfault.org>,\n\tNylon Chen <nylon.chen@sifive.com>,\n\tevvoevod@tenstorrent.com","Subject":"[PATCH v2 2/5] lib: sbi: Add Smrnmi extension macros for registers\n and bits","Date":"Fri,  1 May 2026 21:16:24 +0000","Message-ID":"<20260501211627.3293126-3-evvoevod@tenstorrent.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20260501211627.3293126-1-evvoevod@tenstorrent.com>","References":"<20260501211627.3293126-1-evvoevod@tenstorrent.com>","MIME-Version":"1.0","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20260501_141644_414411_00BD42B1 ","X-CRM114-Status":"UNSURE (   8.97  )","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:  Add CSR definitions (MNSCRATCH, MNSTATUS, MNEPC, MNCAUSE)\n   and bit definitions (MNSTATUS_NMIE, MNSTATUS_MNPV, MNSTATUS_MNPP). Also add\n    SBI_HART_EXT_SMRNMI to the hart extension enumeration. Signed-off-by:\n Evgeny\n    Voevodin <evvoevod@tenstorrent.com> Reviewed-by: Anup Patel\n <anup@brainfault.org>\n    --- include/sbi/riscv_encoding.h | 10 ++++++++++ include/sbi/sbi_hart.h |\n    2 ++ lib/sbi/sbi_hart. [...]\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:1233 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_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 -0.1 DKIM_VALID             Message has at least one valid DKIM or DK\n signature\n -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n                             [score: 0.0000]","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":"Add CSR definitions (MNSCRATCH, MNSTATUS, MNEPC, MNCAUSE) and bit definitions\n(MNSTATUS_NMIE, MNSTATUS_MNPV, MNSTATUS_MNPP). Also add SBI_HART_EXT_SMRNMI to\nthe hart extension enumeration.\n\nSigned-off-by: Evgeny Voevodin <evvoevod@tenstorrent.com>\nReviewed-by: Anup Patel <anup@brainfault.org>\n---\n include/sbi/riscv_encoding.h | 10 ++++++++++\n include/sbi/sbi_hart.h       |  2 ++\n lib/sbi/sbi_hart.c           |  1 +\n 3 files changed, 13 insertions(+)","diff":"diff --git a/include/sbi/riscv_encoding.h b/include/sbi/riscv_encoding.h\nindex 3c1d5256..18f7b4a7 100644\n--- a/include/sbi/riscv_encoding.h\n+++ b/include/sbi/riscv_encoding.h\n@@ -215,6 +215,10 @@\n \n #endif\n \n+#define MNSTATUS_NMIE\t\t\t(_UL(0x8))\n+#define MNSTATUS_MNPV\t\t\t(_UL(0x80))\n+#define MNSTATUS_MNPP\t\t\t(_UL(0x1800))\n+\n #define MHPMEVENT_SSCOF_MASK\t\t_ULL(0xFF00000000000000)\n \n #define ENVCFG_STCE\t\t\t(_ULL(1) << 63)\n@@ -830,6 +834,12 @@\n #define CSR_CUSTOM10_M_RO_BASE\t\t0xFC0\n #define CSR_CUSTOM10_M_RO_COUNT\t\t0x040\n \n+/* Smrnmi extension registers */\n+#define CSR_MNSCRATCH\t\t\t\t0x740\n+#define CSR_MNEPC\t\t\t\t\t0x741\n+#define CSR_MNCAUSE\t\t\t\t\t0x742\n+#define CSR_MNSTATUS\t\t\t\t0x744\n+\n /* ===== Trap/Exception Causes ===== */\n \n #define CAUSE_MISALIGNED_FETCH\t\t0x0\ndiff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h\nindex a788b34c..937cdf29 100644\n--- a/include/sbi/sbi_hart.h\n+++ b/include/sbi/sbi_hart.h\n@@ -87,6 +87,8 @@ enum sbi_hart_extensions {\n \tSBI_HART_EXT_XSIFIVE_CFLUSH_D_L1,\n \t/** Hart has Xsfcease extension */\n \tSBI_HART_EXT_XSIFIVE_CEASE,\n+\t/** Hart has Smrnmi extension */\n+\tSBI_HART_EXT_SMRNMI,\n \n \t/** Maximum index of Hart extension */\n \tSBI_HART_EXT_MAX,\ndiff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c\nindex 99e13990..4aefb759 100644\n--- a/lib/sbi/sbi_hart.c\n+++ b/lib/sbi/sbi_hart.c\n@@ -396,6 +396,7 @@ const struct sbi_hart_ext_data sbi_hart_ext[] = {\n \t__SBI_HART_EXT_DATA(ssstateen, SBI_HART_EXT_SSSTATEEN),\n \t__SBI_HART_EXT_DATA(xsfcflushdlone, SBI_HART_EXT_XSIFIVE_CFLUSH_D_L1),\n \t__SBI_HART_EXT_DATA(xsfcease, SBI_HART_EXT_XSIFIVE_CEASE),\n+\t__SBI_HART_EXT_DATA(smrnmi, SBI_HART_EXT_SMRNMI),\n };\n \n _Static_assert(SBI_HART_EXT_MAX == array_size(sbi_hart_ext),\n","prefixes":["v2","2/5"]}