[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251028-foam-hypocrite-f37fe270115d@spud>
Date: Tue, 28 Oct 2025 10:53:40 +0000
From: Conor Dooley <conor@...nel.org>
To: Yunhui Cui <cuiyunhui@...edance.com>
Cc: paul.walmsley@...ive.com, palmer@...belt.com, aou@...s.berkeley.edu,
alex@...ti.fr, luxu.kernel@...edance.com, atishp@...osinc.com,
cleger@...osinc.com, ajones@...tanamicro.com,
apatel@...tanamicro.com, linux-kernel@...r.kernel.org,
linux-riscv@...ts.infradead.org, songshuaishuai@...ylab.org,
bjorn@...osinc.com, charlie@...osinc.com, masahiroy@...nel.org,
valentina.fernandezalanis@...rochip.com, jassisinghbrar@...il.com,
conor.dooley@...rochip.com
Subject: Re: [PATCH 1/3] drivers: firmware: riscv: add SSE NMI support
On Mon, Oct 27, 2025 at 09:34:29PM +0800, Yunhui Cui wrote:
> Add support for handling Non-Maskable Interrupts (NMIs) through the
> RISC-V Supervisor Software Events (SSE) framework. Since each NMI
> type(e.g., unknown NMI, etc.) requires a distinct SSE event, a newfile
> sse_nmi.c is introduced to manage their registration and enabling.
>
> Signed-off-by: Yunhui Cui <cuiyunhui@...edance.com>
> ---
> MAINTAINERS | 7 +++
> arch/riscv/include/asm/sbi.h | 1 +
> drivers/firmware/riscv/Kconfig | 10 ++++
> drivers/firmware/riscv/Makefile | 1 +
> drivers/firmware/riscv/sse_nmi.c | 81 ++++++++++++++++++++++++++++++++
> 5 files changed, 100 insertions(+)
> create mode 100644 drivers/firmware/riscv/sse_nmi.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 8bf5416953f45..6df6cbec4d85d 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -22057,6 +22057,13 @@ S: Maintained
> F: drivers/firmware/riscv/riscv_sse.c
> F: include/linux/riscv_sse.h
>
> +RISC-V SSE NMI SUPPORT
> +M: Yunhui Cui <cuiyunhui@...edance.com>
> +R: Xu Lu <luxu.kernel@...edance.com>
> +L: linux-riscv@...ts.infradead.org
> +S: Maintained
> +F: drivers/firmware/riscv/sse_nmi.c
Does actually this need a separate entry?
> RISC-V THEAD SoC SUPPORT
> M: Drew Fustini <fustini@...nel.org>
> M: Guo Ren <guoren@...nel.org>
> diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
> index 874cc1d7603a5..52d3fdf2d4cc1 100644
> --- a/arch/riscv/include/asm/sbi.h
> +++ b/arch/riscv/include/asm/sbi.h
> @@ -486,6 +486,7 @@ enum sbi_sse_attr_id {
> #define SBI_SSE_EVENT_LOCAL_LOW_PRIO_RAS 0x00100000
> #define SBI_SSE_EVENT_GLOBAL_LOW_PRIO_RAS 0x00108000
> #define SBI_SSE_EVENT_LOCAL_SOFTWARE_INJECTED 0xffff0000
> +#define SBI_SSE_EVENT_LOCAL_UNKNOWN_NMI 0xffff0001
Where is this canonically defined?
I looked at the v3 SBI spec and it says:
0xffff0001 - 0xffff3fff Local events reserved for future use
This needs to be marked RFC until this event is in a frozen version of
the SBI spec.
> #define SBI_SSE_EVENT_GLOBAL_SOFTWARE_INJECTED 0xffff8000
>
> #define SBI_SSE_EVENT_PLATFORM BIT(14)
> diff --git a/drivers/firmware/riscv/Kconfig b/drivers/firmware/riscv/Kconfig
> index ed5b663ac5f91..fd16b4c43cf01 100644
> --- a/drivers/firmware/riscv/Kconfig
> +++ b/drivers/firmware/riscv/Kconfig
> @@ -12,4 +12,14 @@ config RISCV_SBI_SSE
> this option provides support to register callbacks on specific SSE
> events.
>
> +config RISCV_SSE_NMI
I think I'd like to see both the filename and Kconfig option match the
established naming for the base sse support.
> + bool "Enable SBI Supervisor Software Events NMI support"
> + depends on RISCV_SBI_SSE
> + default y
> + help
> + This option enables support for delivering Non-Maskable Interrupt
> + (NMI) notifications through the Supervisor Software Events (SSE)
> + framework.
> When enabled, the system supports some common NMI features
> + such as unknown NMI handling.
No, when enabled the _kernel_ supports these things. The code in this
patch seems to fail gracefully when there's no SSE support in the
underlying system, but you should make the option description match
reality.
Cheers,
Conor.
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists