* [PATCH v5 1/9] riscv: Define ioremap_cache for RISC-V
2026-09-24 7:37 [PATCH v5 0/9] Add RAS support for RISC-V architecture Himanshu Chauhan
@ 2026-09-24 7:37 ` Himanshu Chauhan
2026-09-24 7:37 ` [PATCH v5 2/9] riscv: Define arch_apei_get_mem_attribute " Himanshu Chauhan
` (7 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Himanshu Chauhan @ 2026-09-24 7:37 UTC (permalink / raw)
To: linux-riscv, linux-kernel, linux-acpi, linux-efi
Cc: acpica-devel, anup.patel, ardb, conor, james.morse, lenb, palmer,
paul.walmsley, robert.moore, sunilvl, tony.luck,
zhangzhanpeng.jasper, Himanshu Chauhan
bert and einj drivers use ioremap_cache for mapping entries
but ioremap_cache is not defined for RISC-V.
Signed-off-by: Himanshu Chauhan <himanshu.chauhan@oss.qualcomm.com>
---
arch/riscv/include/asm/io.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/riscv/include/asm/io.h b/arch/riscv/include/asm/io.h
index 92d5f831f349..a51904a6c79b 100644
--- a/arch/riscv/include/asm/io.h
+++ b/arch/riscv/include/asm/io.h
@@ -150,6 +150,9 @@ __io_writes_outs(outs, u64, q, __io_pbr(), __io_paw())
#ifdef CONFIG_MMU
#define arch_memremap_wb(addr, size, flags) \
((__force void *)ioremap_prot((addr), (size), __pgprot(_PAGE_KERNEL)))
+
+#define ioremap_cache(addr, size) \
+ ((__force void *)ioremap_prot((addr), (size), PAGE_KERNEL))
#endif
#endif /* _ASM_RISCV_IO_H */
--
2.43.0
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH v5 2/9] riscv: Define arch_apei_get_mem_attribute for RISC-V
2026-09-24 7:37 [PATCH v5 0/9] Add RAS support for RISC-V architecture Himanshu Chauhan
2026-09-24 7:37 ` [PATCH v5 1/9] riscv: Define ioremap_cache for RISC-V Himanshu Chauhan
@ 2026-09-24 7:37 ` Himanshu Chauhan
2026-10-21 9:33 ` Rui Qi
2026-09-24 7:37 ` [PATCH v5 3/9] Introduce a new HEST notification type for RISC-V SSE events Himanshu Chauhan
` (6 subsequent siblings)
8 siblings, 1 reply; 13+ messages in thread
From: Himanshu Chauhan @ 2026-09-24 7:37 UTC (permalink / raw)
To: linux-riscv, linux-kernel, linux-acpi, linux-efi
Cc: acpica-devel, anup.patel, ardb, conor, james.morse, lenb, palmer,
paul.walmsley, robert.moore, sunilvl, tony.luck,
zhangzhanpeng.jasper, Himanshu Chauhan
ghes_map function uses arch_apei_get_mem_attribute to get the
protection bits for a given physical address. These protection
bits are then used to map the physical address.
Reviewed-by: Sunil V L <sunilvl@oss.qualcomm.com>
Signed-off-by: Himanshu Chauhan <himanshu.chauhan@oss.qualcomm.com>
---
arch/riscv/include/asm/acpi.h | 16 ++++++++++++++++
arch/riscv/kernel/acpi.c | 12 ++++++++++++
2 files changed, 28 insertions(+)
diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h
index cdefa1f2d67d..c7dee956cdb1 100644
--- a/arch/riscv/include/asm/acpi.h
+++ b/arch/riscv/include/asm/acpi.h
@@ -16,6 +16,7 @@
/* Basic configuration for ACPI */
#ifdef CONFIG_ACPI
+pgprot_t __acpi_get_mem_attribute(phys_addr_t addr);
typedef u64 phys_cpuid_t;
#define PHYS_CPUID_INVALID INVALID_HARTID
@@ -29,6 +30,21 @@ extern int acpi_disabled;
extern int acpi_noirq;
extern int acpi_pci_disabled;
+#ifdef CONFIG_ACPI_APEI
+/*
+ * acpi_disable_cmcff to disable IA-32 Corrected Machine Check (CMC)
+ * Firmware-First mode. It is not required in RISC-V architecture
+ * and is present for compatibility
+ */
+#define acpi_disable_cmcff 1
+static inline pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr)
+{
+ return __acpi_get_mem_attribute(addr);
+}
+#else /* CONFIG_ACPI_APEI */
+#define acpi_disable_cmcff 0
+#endif /* !CONFIG_ACPI_APEI */
+
static inline void disable_acpi(void)
{
acpi_disabled = 1;
diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c
index efd52a5d05b5..d1e472ce0878 100644
--- a/arch/riscv/kernel/acpi.c
+++ b/arch/riscv/kernel/acpi.c
@@ -204,6 +204,18 @@ struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu)
return &cpu_madt_rintc[cpu];
}
+pgprot_t __acpi_get_mem_attribute(phys_addr_t addr)
+{
+ u64 attr;
+
+ attr = efi_mem_attributes(addr);
+ if (attr & EFI_MEMORY_WB)
+ return PAGE_KERNEL;
+ if ((attr & EFI_MEMORY_WC) || (attr & EFI_MEMORY_WT))
+ return pgprot_writecombine(PAGE_KERNEL);
+ return PAGE_KERNEL;
+}
+
/*
* __acpi_map_table() will be called before paging_init(), so early_ioremap()
* or early_memremap() should be called here to for ACPI table mapping.
--
2.43.0
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v5 2/9] riscv: Define arch_apei_get_mem_attribute for RISC-V
2026-09-24 7:37 ` [PATCH v5 2/9] riscv: Define arch_apei_get_mem_attribute " Himanshu Chauhan
@ 2026-10-21 9:33 ` Rui Qi
0 siblings, 0 replies; 13+ messages in thread
From: Rui Qi @ 2026-10-21 9:33 UTC (permalink / raw)
To: Himanshu Chauhan, linux-riscv, linux-kernel, linux-acpi, linux-efi
Cc: acpica-devel, anup.patel, ardb, conor, james.morse, lenb, palmer,
paul.walmsley, robert.moore, sunilvl, tony.luck,
zhangzhanpeng.jasper
On 9/24/26 3:37 PM, Himanshu Chauhan wrote:
> ghes_map function uses arch_apei_get_mem_attribute to get the
> protection bits for a given physical address. These protection
> bits are then used to map the physical address.
>
> Reviewed-by: Sunil V L <sunilvl@oss.qualcomm.com>
> Signed-off-by: Himanshu Chauhan <himanshu.chauhan@oss.qualcomm.com>
> ---
> arch/riscv/include/asm/acpi.h | 16 ++++++++++++++++
> arch/riscv/kernel/acpi.c | 12 ++++++++++++
> 2 files changed, 28 insertions(+)
>
> diff --git a/arch/riscv/include/asm/acpi.h b/arch/riscv/include/asm/acpi.h
> index cdefa1f2d67d..c7dee956cdb1 100644
> --- a/arch/riscv/include/asm/acpi.h
> +++ b/arch/riscv/include/asm/acpi.h
> @@ -16,6 +16,7 @@
>
> /* Basic configuration for ACPI */
> #ifdef CONFIG_ACPI
> +pgprot_t __acpi_get_mem_attribute(phys_addr_t addr);
>
> typedef u64 phys_cpuid_t;
> #define PHYS_CPUID_INVALID INVALID_HARTID
> @@ -29,6 +30,21 @@ extern int acpi_disabled;
> extern int acpi_noirq;
> extern int acpi_pci_disabled;
>
> +#ifdef CONFIG_ACPI_APEI
> +/*
> + * acpi_disable_cmcff to disable IA-32 Corrected Machine Check (CMC)
> + * Firmware-First mode. It is not required in RISC-V architecture
> + * and is present for compatibility
> + */
> +#define acpi_disable_cmcff 1
> +static inline pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr)
> +{
> + return __acpi_get_mem_attribute(addr);
> +}
> +#else /* CONFIG_ACPI_APEI */
> +#define acpi_disable_cmcff 0
> +#endif /* !CONFIG_ACPI_APEI */
> +
> static inline void disable_acpi(void)
> {
> acpi_disabled = 1;
> diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c
> index efd52a5d05b5..d1e472ce0878 100644
> --- a/arch/riscv/kernel/acpi.c
> +++ b/arch/riscv/kernel/acpi.c
> @@ -204,6 +204,18 @@ struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu)
> return &cpu_madt_rintc[cpu];
> }
>
> +pgprot_t __acpi_get_mem_attribute(phys_addr_t addr)
> +{
> + u64 attr;
> +
> + attr = efi_mem_attributes(addr);
> + if (attr & EFI_MEMORY_WB)
> + return PAGE_KERNEL;
> + if ((attr & EFI_MEMORY_WC) || (attr & EFI_MEMORY_WT))
> + return pgprot_writecombine(PAGE_KERNEL);
> + return PAGE_KERNEL;
> +}
Hi Himanshu,
Could you clarify why PAGE_KERNEL is used as the fallback here?
When none of EFI_MEMORY_WB, EFI_MEMORY_WC or EFI_MEMORY_WT is
present, including the case where only EFI_MEMORY_UC is advertised,
this returns PAGE_KERNEL.
With standard Svpbmt, PAGE_KERNEL leaves PBMT at zero and therefore
relies on the underlying PMA. In comparison, the existing RISC-V
acpi_os_ioremap() starts with PAGE_KERNEL_IO and retains it when none
of WB/WC/WT is present.
Is relying on the platform PMA intentional for the GHES error status
block mapped by ghes_map()? If so, is there a platform guarantee that
the PMA provides the appropriate memory type for every address reaching
this path?
Otherwise, would PAGE_KERNEL_IO be a more appropriate fallback here,
consistent with acpi_os_ioremap()? A comment documenting the intended
PMA dependency would also help clarify the difference between the two
mapping paths.
Thanks,
Qirui
> +
> /*
> * __acpi_map_table() will be called before paging_init(), so early_ioremap()
> * or early_memremap() should be called here to for ACPI table mapping.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v5 3/9] Introduce a new HEST notification type for RISC-V SSE events.
2026-09-24 7:37 [PATCH v5 0/9] Add RAS support for RISC-V architecture Himanshu Chauhan
2026-09-24 7:37 ` [PATCH v5 1/9] riscv: Define ioremap_cache for RISC-V Himanshu Chauhan
2026-09-24 7:37 ` [PATCH v5 2/9] riscv: Define arch_apei_get_mem_attribute " Himanshu Chauhan
@ 2026-09-24 7:37 ` Himanshu Chauhan
2026-10-27 5:32 ` Himanshu Chauhan
2026-09-24 7:37 ` [PATCH v5 4/9] riscv: Add fixmap indices for GHES IRQ and SSE contexts Himanshu Chauhan
` (5 subsequent siblings)
8 siblings, 1 reply; 13+ messages in thread
From: Himanshu Chauhan @ 2026-09-24 7:37 UTC (permalink / raw)
To: linux-riscv, linux-kernel, linux-acpi, linux-efi
Cc: acpica-devel, anup.patel, ardb, conor, james.morse, lenb, palmer,
paul.walmsley, robert.moore, sunilvl, tony.luck,
zhangzhanpeng.jasper, Himanshu Chauhan
The GHES entry's notification structure contains the notification
to be used for a given error source. For error sources delivering
events over SSE, it should contain the new SSE notification type.
acpi: Introduce SSE in HEST notification types
ACPICA commit f73f39352c1170464afe812cc96b20cc9db1d822
Link: https://github.com/open-acpica/acpica/commit/f73f3935
Signed-off-by: Himanshu Chauhan <himanshu.chauhan@oss.qualcomm.com>
---
include/acpi/actbl1.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index d824838cb7af..105fd51f83ec 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -1798,7 +1798,8 @@ enum acpi_hest_notify_types {
ACPI_HEST_NOTIFY_SEI = 9, /* ACPI 6.1 */
ACPI_HEST_NOTIFY_GSIV = 10, /* ACPI 6.1 */
ACPI_HEST_NOTIFY_SOFTWARE_DELEGATED = 11, /* ACPI 6.2 */
- ACPI_HEST_NOTIFY_RESERVED = 12 /* 12 and greater are reserved */
+ ACPI_HEST_NOTIFY_SSE = 12, /* RISCV SSE */
+ ACPI_HEST_NOTIFY_RESERVED = 13 /* 13 and greater are reserved */
};
/* Values for config_write_enable bitfield above */
--
2.43.0
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v5 3/9] Introduce a new HEST notification type for RISC-V SSE events.
2026-09-24 7:37 ` [PATCH v5 3/9] Introduce a new HEST notification type for RISC-V SSE events Himanshu Chauhan
@ 2026-10-27 5:32 ` Himanshu Chauhan
0 siblings, 0 replies; 13+ messages in thread
From: Himanshu Chauhan @ 2026-10-27 5:32 UTC (permalink / raw)
To: linux-riscv, linux-kernel, linux-acpi, linux-efi, rafael
Cc: acpica-devel, anup.patel, ardb, conor, james.morse, lenb, palmer,
paul.walmsley, robert.moore, sunilvl, tony.luck,
zhangzhanpeng.jasper
On Thu, Sep 24, 2026 at 01:07:08PM +0530, Himanshu Chauhan wrote:
> The GHES entry's notification structure contains the notification
> to be used for a given error source. For error sources delivering
> events over SSE, it should contain the new SSE notification type.
> acpi: Introduce SSE in HEST notification types
>
> ACPICA commit f73f39352c1170464afe812cc96b20cc9db1d822
Hi Rafael,
This is merged in ACPICA. Could you please pick it up for Linux kernel?
Once you do that I will drop this patch from here.
Regards
Himanshu
>
> Link: https://github.com/open-acpica/acpica/commit/f73f3935
> Signed-off-by: Himanshu Chauhan <himanshu.chauhan@oss.qualcomm.com>
> ---
> include/acpi/actbl1.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
> index d824838cb7af..105fd51f83ec 100644
> --- a/include/acpi/actbl1.h
> +++ b/include/acpi/actbl1.h
> @@ -1798,7 +1798,8 @@ enum acpi_hest_notify_types {
> ACPI_HEST_NOTIFY_SEI = 9, /* ACPI 6.1 */
> ACPI_HEST_NOTIFY_GSIV = 10, /* ACPI 6.1 */
> ACPI_HEST_NOTIFY_SOFTWARE_DELEGATED = 11, /* ACPI 6.2 */
> - ACPI_HEST_NOTIFY_RESERVED = 12 /* 12 and greater are reserved */
> + ACPI_HEST_NOTIFY_SSE = 12, /* RISCV SSE */
> + ACPI_HEST_NOTIFY_RESERVED = 13 /* 13 and greater are reserved */
> };
>
> /* Values for config_write_enable bitfield above */
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v5 4/9] riscv: Add fixmap indices for GHES IRQ and SSE contexts
2026-09-24 7:37 [PATCH v5 0/9] Add RAS support for RISC-V architecture Himanshu Chauhan
` (2 preceding siblings ...)
2026-09-24 7:37 ` [PATCH v5 3/9] Introduce a new HEST notification type for RISC-V SSE events Himanshu Chauhan
@ 2026-09-24 7:37 ` Himanshu Chauhan
2026-09-24 7:37 ` [PATCH v5 5/9] riscv: Add functions to register ghes having SSE notification Himanshu Chauhan
` (4 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Himanshu Chauhan @ 2026-09-24 7:37 UTC (permalink / raw)
To: linux-riscv, linux-kernel, linux-acpi, linux-efi
Cc: acpica-devel, anup.patel, ardb, conor, james.morse, lenb, palmer,
paul.walmsley, robert.moore, sunilvl, tony.luck,
zhangzhanpeng.jasper, Himanshu Chauhan, Clément Léger
GHES error handling requires fixmap entries for IRQ notifications.
Add fixmap indices for IRQ, SSE Low and High priority notifications.
Reviewed-by: Clément Léger <cleger@rivosinc.com>
Signed-off-by: Himanshu Chauhan <himanshu.chauhan@oss.qualcomm.com>
---
arch/riscv/include/asm/fixmap.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/riscv/include/asm/fixmap.h b/arch/riscv/include/asm/fixmap.h
index a81823c5ee4a..3a775b8d0cdd 100644
--- a/arch/riscv/include/asm/fixmap.h
+++ b/arch/riscv/include/asm/fixmap.h
@@ -38,6 +38,14 @@ enum fixed_addresses {
FIX_TEXT_POKE0,
FIX_EARLYCON_MEM_BASE,
+#ifdef CONFIG_ACPI_APEI_GHES
+ /* Used for GHES mapping from assorted contexts */
+ FIX_APEI_GHES_IRQ,
+#ifdef CONFIG_RISCV_SBI_SSE
+ FIX_APEI_GHES_SSE_LOW_PRIORITY,
+ FIX_APEI_GHES_SSE_HIGH_PRIORITY,
+#endif /* CONFIG_RISCV_SBI_SSE */
+#endif /* CONFIG_ACPI_APEI_GHES */
__end_of_permanent_fixed_addresses,
/*
* Temporary boot-time mappings, used by early_ioremap(),
--
2.43.0
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH v5 5/9] riscv: Add functions to register ghes having SSE notification
2026-09-24 7:37 [PATCH v5 0/9] Add RAS support for RISC-V architecture Himanshu Chauhan
` (3 preceding siblings ...)
2026-09-24 7:37 ` [PATCH v5 4/9] riscv: Add fixmap indices for GHES IRQ and SSE contexts Himanshu Chauhan
@ 2026-09-24 7:37 ` Himanshu Chauhan
2026-10-29 23:27 ` Conor Dooley
2026-09-24 7:37 ` [PATCH v5 6/9] riscv: Add RISC-V entries in processor type and ISA strings Himanshu Chauhan
` (3 subsequent siblings)
8 siblings, 1 reply; 13+ messages in thread
From: Himanshu Chauhan @ 2026-09-24 7:37 UTC (permalink / raw)
To: linux-riscv, linux-kernel, linux-acpi, linux-efi
Cc: acpica-devel, anup.patel, ardb, conor, james.morse, lenb, palmer,
paul.walmsley, robert.moore, sunilvl, tony.luck,
zhangzhanpeng.jasper, Himanshu Chauhan
Add functions to register the ghes entries which have SSE as
notification type. The vector inside the ghes is the SSE event
ID that should be registered.
Signed-off-by: Himanshu Chauhan <himanshu.chauhan@oss.qualcomm.com>
---
drivers/firmware/riscv/riscv_sbi_sse.c | 146 +++++++++++++++++++++++++
include/linux/riscv_sbi_sse.h | 16 +++
2 files changed, 162 insertions(+)
diff --git a/drivers/firmware/riscv/riscv_sbi_sse.c b/drivers/firmware/riscv/riscv_sbi_sse.c
index 69ce98380331..d4a8691fdf8f 100644
--- a/drivers/firmware/riscv/riscv_sbi_sse.c
+++ b/drivers/firmware/riscv/riscv_sbi_sse.c
@@ -6,6 +6,8 @@
#define pr_fmt(fmt) "sse: " fmt
#include <linux/atomic.h>
+#include <acpi/ghes.h>
+#include <linux/acpi.h>
#include <linux/cpu.h>
#include <linux/cpuhotplug.h>
#include <linux/cpu_pm.h>
@@ -1226,3 +1228,147 @@ static int __init sse_init(void)
return ret;
}
arch_initcall(sse_init);
+
+struct sse_ghes_callback {
+ struct list_head head;
+ struct ghes *ghes;
+ sse_event_handler_fn *callback;
+};
+
+struct sse_ghes_event_data {
+ struct list_head head;
+ u32 event_num;
+ struct list_head callback_list;
+ struct sse_event *event;
+};
+
+static DEFINE_SPINLOCK(sse_ghes_event_list_lock);
+static LIST_HEAD(sse_ghes_event_list);
+
+static int sse_ghes_handler(u32 event_num, void *arg, struct pt_regs *regs)
+{
+ struct sse_ghes_event_data *ev_data = arg;
+ struct sse_ghes_callback *cb = NULL;
+
+ list_for_each_entry(cb, &ev_data->callback_list, head) {
+ if (cb && cb->ghes && cb->callback)
+ cb->callback(ev_data->event_num, cb->ghes, regs);
+ }
+
+ return 0;
+}
+
+int sse_register_ghes(struct ghes *ghes, sse_event_handler_fn *lo_cb,
+ sse_event_handler_fn *hi_cb)
+{
+ struct sse_ghes_event_data *ev_data, *evd;
+ struct sse_ghes_callback *cb;
+ u32 ev_num;
+ int err;
+
+ if (!sse_available)
+ return -EOPNOTSUPP;
+ if (!ghes || !lo_cb || !hi_cb)
+ return -EINVAL;
+
+ ev_num = ghes->generic->notify.vector;
+
+ ev_data = NULL;
+ spin_lock(&sse_ghes_event_list_lock);
+ list_for_each_entry(evd, &sse_ghes_event_list, head) {
+ if (evd->event_num == ev_num) {
+ ev_data = evd;
+ break;
+ }
+ }
+ spin_unlock(&sse_ghes_event_list_lock);
+
+ if (!ev_data) {
+ ev_data = kzalloc_obj(*ev_data, GFP_KERNEL);
+ if (!ev_data)
+ return -ENOMEM;
+
+ INIT_LIST_HEAD(&ev_data->head);
+ ev_data->event_num = ev_num;
+
+ INIT_LIST_HEAD(&ev_data->callback_list);
+
+ ev_data->event = sse_event_register(ev_num, ev_num,
+ sse_ghes_handler, ev_data);
+ if (IS_ERR(ev_data->event)) {
+ pr_err("%s: Couldn't register event 0x%x\n", __func__, ev_num);
+ kfree(ev_data);
+ return -ENOMEM;
+ }
+
+ err = sse_event_enable(ev_data->event);
+ if (err) {
+ pr_err("%s: Couldn't enable event 0x%x\n", __func__, ev_num);
+ sse_event_unregister(ev_data->event);
+ kfree(ev_data);
+ return err;
+ }
+
+ spin_lock(&sse_ghes_event_list_lock);
+ list_add_tail(&ev_data->head, &sse_ghes_event_list);
+ spin_unlock(&sse_ghes_event_list_lock);
+ }
+
+ list_for_each_entry(cb, &ev_data->callback_list, head) {
+ if (cb->ghes == ghes)
+ return -EALREADY;
+ }
+
+ cb = kzalloc_obj(*cb, GFP_KERNEL);
+ if (!cb)
+ return -ENOMEM;
+ INIT_LIST_HEAD(&cb->head);
+ cb->ghes = ghes;
+ cb->callback = lo_cb;
+ list_add_tail(&cb->head, &ev_data->callback_list);
+
+ return 0;
+}
+
+int sse_unregister_ghes(struct ghes *ghes)
+{
+ struct sse_ghes_event_data *ev_data, *tmp;
+ struct sse_ghes_callback *cb;
+ int free_ev_data = 0;
+
+ if (!ghes)
+ return -EINVAL;
+
+ spin_lock(&sse_ghes_event_list_lock);
+
+ list_for_each_entry_safe(ev_data, tmp, &sse_ghes_event_list, head) {
+ list_for_each_entry(cb, &ev_data->callback_list, head) {
+ if (cb->ghes != ghes)
+ continue;
+
+ list_del(&cb->head);
+ kfree(cb);
+ break;
+ }
+
+ if (list_empty(&ev_data->callback_list))
+ free_ev_data = 1;
+
+ if (free_ev_data) {
+ spin_unlock(&sse_ghes_event_list_lock);
+
+ sse_event_disable(ev_data->event);
+ sse_event_unregister(ev_data->event);
+ ev_data->event = NULL;
+
+ spin_lock(&sse_ghes_event_list_lock);
+
+ list_del(&ev_data->head);
+ kfree(ev_data);
+ }
+ }
+
+ spin_unlock(&sse_ghes_event_list_lock);
+
+ return 0;
+}
diff --git a/include/linux/riscv_sbi_sse.h b/include/linux/riscv_sbi_sse.h
index f6b3881c8884..b470abd61b92 100644
--- a/include/linux/riscv_sbi_sse.h
+++ b/include/linux/riscv_sbi_sse.h
@@ -13,6 +13,7 @@
struct sse_event;
struct pt_regs;
+struct ghes;
typedef int (sse_event_handler_fn)(u32 event_num, void *arg,
struct pt_regs *regs);
@@ -37,6 +38,10 @@ void sse_event_cleanup(struct sse_event *evt);
int sse_event_set_target_cpu(struct sse_event *sse_evt, unsigned int cpu);
+int sse_register_ghes(struct ghes *ghes, sse_event_handler_fn *lo_cb,
+ sse_event_handler_fn *hi_cb);
+int sse_unregister_ghes(struct ghes *ghes);
+
int sse_event_enable(struct sse_event *sse_evt);
int sse_event_disable(struct sse_event *sse_evt);
@@ -67,6 +72,17 @@ static inline int sse_event_set_target_cpu(struct sse_event *sse_evt,
return -EOPNOTSUPP;
}
+static inline int sse_register_ghes(struct ghes *ghes, sse_event_handler_fn *lo_cb,
+ sse_event_handler_fn *hi_cb)
+{
+ return -EOPNOTSUPP;
+}
+
+static inline int sse_unregister_ghes(struct ghes *ghes)
+{
+ return -EOPNOTSUPP;
+}
+
static inline int sse_event_enable(struct sse_event *sse_evt)
{
return -EOPNOTSUPP;
--
2.43.0
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v5 5/9] riscv: Add functions to register ghes having SSE notification
2026-09-24 7:37 ` [PATCH v5 5/9] riscv: Add functions to register ghes having SSE notification Himanshu Chauhan
@ 2026-10-29 23:27 ` Conor Dooley
0 siblings, 0 replies; 13+ messages in thread
From: Conor Dooley @ 2026-10-29 23:27 UTC (permalink / raw)
To: Himanshu Chauhan
Cc: linux-riscv, linux-kernel, linux-acpi, linux-efi, acpica-devel,
anup.patel, ardb, james.morse, lenb, palmer, paul.walmsley,
robert.moore, sunilvl, tony.luck, zhangzhanpeng.jasper
[-- Attachment #1: Type: text/plain, Size: 53 bytes --]
Acked-by: Conor Dooley <conor.dooley@microchip.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v5 6/9] riscv: Add RISC-V entries in processor type and ISA strings
2026-09-24 7:37 [PATCH v5 0/9] Add RAS support for RISC-V architecture Himanshu Chauhan
` (4 preceding siblings ...)
2026-09-24 7:37 ` [PATCH v5 5/9] riscv: Add functions to register ghes having SSE notification Himanshu Chauhan
@ 2026-09-24 7:37 ` Himanshu Chauhan
2026-09-24 7:37 ` [PATCH v5 7/9] riscv: Introduce HEST SSE notification handlers Himanshu Chauhan
` (2 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Himanshu Chauhan @ 2026-09-24 7:37 UTC (permalink / raw)
To: linux-riscv, linux-kernel, linux-acpi, linux-efi
Cc: acpica-devel, anup.patel, ardb, conor, james.morse, lenb, palmer,
paul.walmsley, robert.moore, sunilvl, tony.luck,
zhangzhanpeng.jasper, Himanshu Chauhan
Add RISCV and RISCV32/64 strings in the in processor type and ISA strings
respectively. These are defined for cper records.
Reviewed-by: Sunil V L <sunilvl@oss.qualcomm.com>
Signed-off-by: Himanshu Chauhan <himanshu.chauhan@oss.qualcomm.com>
---
drivers/firmware/efi/cper.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c
index 06b4fdb59917..1b1ab2f1355b 100644
--- a/drivers/firmware/efi/cper.c
+++ b/drivers/firmware/efi/cper.c
@@ -170,6 +170,7 @@ static const char * const proc_type_strs[] = {
"IA32/X64",
"IA64",
"ARM",
+ "RISC-V",
};
static const char * const proc_isa_strs[] = {
@@ -178,6 +179,8 @@ static const char * const proc_isa_strs[] = {
"X64",
"ARM A32/T32",
"ARM A64",
+ "RV32/RV32E",
+ "RV64",
};
const char * const cper_proc_error_type_strs[] = {
--
2.43.0
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH v5 7/9] riscv: Introduce HEST SSE notification handlers
2026-09-24 7:37 [PATCH v5 0/9] Add RAS support for RISC-V architecture Himanshu Chauhan
` (5 preceding siblings ...)
2026-09-24 7:37 ` [PATCH v5 6/9] riscv: Add RISC-V entries in processor type and ISA strings Himanshu Chauhan
@ 2026-09-24 7:37 ` Himanshu Chauhan
2026-09-24 7:37 ` [PATCH v5 8/9] riscv: Select HAVE_ACPI_APEI required for RAS Himanshu Chauhan
2026-09-24 7:37 ` [PATCH v5 9/9] riscv: Enable APEI GHES driver in defconfig Himanshu Chauhan
8 siblings, 0 replies; 13+ messages in thread
From: Himanshu Chauhan @ 2026-09-24 7:37 UTC (permalink / raw)
To: linux-riscv, linux-kernel, linux-acpi, linux-efi
Cc: acpica-devel, anup.patel, ardb, conor, james.morse, lenb, palmer,
paul.walmsley, robert.moore, sunilvl, tony.luck,
zhangzhanpeng.jasper, Himanshu Chauhan
Add config option to enable SSE in APEI. When it is enabled, functions
to register/unregister a ghes entry with SSE are avilable along with
low and high priority event handers. If a SSE notification type is
determined, a ghes common handler to handle an error event is registered.
Signed-off-by: Himanshu Chauhan <himanshu.chauhan@oss.qualcomm.com>
---
drivers/acpi/apei/Kconfig | 5 ++
drivers/acpi/apei/ghes.c | 99 ++++++++++++++++++++++++++++++++++-----
2 files changed, 93 insertions(+), 11 deletions(-)
diff --git a/drivers/acpi/apei/Kconfig b/drivers/acpi/apei/Kconfig
index 428458c623f0..895a843d0e36 100644
--- a/drivers/acpi/apei/Kconfig
+++ b/drivers/acpi/apei/Kconfig
@@ -46,6 +46,11 @@ config ACPI_APEI_SEA
depends on ARM64 && ACPI_APEI_GHES
default y
+config ACPI_APEI_SSE
+ bool
+ depends on RISCV && RISCV_SBI_SSE && ACPI_APEI_GHES
+ default y
+
config ACPI_APEI_MEMORY_FAILURE
bool "APEI memory error recovering support"
depends on ACPI_APEI && MEMORY_FAILURE
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index fe10ab0e02f6..1a6d21f7992b 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -17,6 +17,8 @@
* Author: Huang Ying <ying.huang@intel.com>
*/
+#include <linux/err.h>
+#include <linux/riscv_sbi_sse.h>
#include <linux/arm_sdei.h>
#include <linux/kernel.h>
#include <linux/moduleparam.h>
@@ -100,6 +102,11 @@
#define FIX_APEI_GHES_SDEI_CRITICAL __end_of_fixed_addresses
#endif
+#ifndef CONFIG_RISCV_SBI_SSE
+#define FIX_APEI_GHES_SSE_LOW_PRIORITY __end_of_fixed_addresses
+#define FIX_APEI_GHES_SSE_HIGH_PRIORITY __end_of_fixed_addresses
+#endif
+
static ATOMIC_NOTIFIER_HEAD(ghes_report_chain);
static inline bool is_hest_type_generic_v2(struct ghes *ghes)
@@ -1682,6 +1689,63 @@ static int apei_sdei_unregister_ghes(struct ghes *ghes)
return sdei_unregister_ghes(ghes);
}
+#if defined(CONFIG_ACPI_APEI_SSE)
+/* SSE Handlers */
+static int __ghes_sse_callback(struct ghes *ghes,
+ enum fixed_addresses fixmap_idx)
+{
+ if (!ghes_in_nmi_queue_one_entry(ghes, fixmap_idx)) {
+ irq_work_queue(&ghes_proc_irq_work);
+
+ return 0;
+ }
+
+ return -ENOENT;
+}
+
+/* Low priority */
+static int ghes_sse_lo_callback(u32 event_num, void *arg, struct pt_regs *regs)
+{
+ static DEFINE_RAW_SPINLOCK(ghes_notify_lock_sse_lo);
+ struct ghes *ghes = arg;
+ int err;
+
+ raw_spin_lock(&ghes_notify_lock_sse_lo);
+ err = __ghes_sse_callback(ghes, FIX_APEI_GHES_SSE_LOW_PRIORITY);
+ raw_spin_unlock(&ghes_notify_lock_sse_lo);
+
+ return err;
+}
+
+/* High priority */
+static int ghes_sse_hi_callback(u32 event_num, void *arg, struct pt_regs *regs)
+{
+ static DEFINE_RAW_SPINLOCK(ghes_notify_lock_sse_hi);
+ struct ghes *ghes = arg;
+ int err;
+
+ raw_spin_lock(&ghes_notify_lock_sse_hi);
+ err = __ghes_sse_callback(ghes, FIX_APEI_GHES_SSE_HIGH_PRIORITY);
+ raw_spin_unlock(&ghes_notify_lock_sse_hi);
+
+ return err;
+}
+
+static int apei_sse_register_ghes(struct ghes *ghes)
+{
+ return sse_register_ghes(ghes, ghes_sse_lo_callback,
+ ghes_sse_hi_callback);
+}
+
+static int apei_sse_unregister_ghes(struct ghes *ghes)
+{
+ return sse_unregister_ghes(ghes);
+}
+#else /* CONFIG_ACPI_APEI_SSE */
+static int apei_sse_register_ghes(struct ghes *ghes) { return -EOPNOTSUPP; }
+static int apei_sse_unregister_ghes(struct ghes *ghes) { return -EOPNOTSUPP; }
+#endif
+
static int ghes_probe(struct platform_device *ghes_dev)
{
struct acpi_hest_generic *generic;
@@ -1728,6 +1792,14 @@ static int ghes_probe(struct platform_device *ghes_dev)
pr_warn(GHES_PFX "Generic hardware error source: %d notified via local interrupt is not supported!\n",
generic->header.source_id);
goto err;
+ case ACPI_HEST_NOTIFY_SSE:
+ if (!IS_ENABLED(CONFIG_ACPI_APEI_SSE)) {
+ pr_warn(GHES_PFX "Generic hardware error source: %d notified via SSE is not supported\n",
+ generic->header.source_id);
+ rc = -EOPNOTSUPP;
+ goto err;
+ }
+ break;
default:
pr_warn(FW_WARN GHES_PFX "Unknown notification type: %u for generic hardware error source: %d\n",
generic->notify.type, generic->header.source_id);
@@ -1795,6 +1867,17 @@ static int ghes_probe(struct platform_device *ghes_dev)
if (rc)
goto err;
break;
+
+ case ACPI_HEST_NOTIFY_SSE:
+ rc = apei_sse_register_ghes(ghes);
+ if (rc) {
+ pr_err(GHES_PFX "Failed to register for SSE notification on vector %d\n",
+ generic->notify.vector);
+ goto err;
+ }
+ pr_err(GHES_PFX "Registered SSE notification on vector %d\n",
+ generic->notify.vector);
+ break;
default:
BUG();
}
@@ -1824,7 +1907,6 @@ static int ghes_probe(struct platform_device *ghes_dev)
static void ghes_remove(struct platform_device *ghes_dev)
{
- int rc;
struct ghes *ghes;
struct acpi_hest_generic *generic;
@@ -1858,16 +1940,11 @@ static void ghes_remove(struct platform_device *ghes_dev)
ghes_nmi_remove(ghes);
break;
case ACPI_HEST_NOTIFY_SOFTWARE_DELEGATED:
- rc = apei_sdei_unregister_ghes(ghes);
- if (rc) {
- /*
- * Returning early results in a resource leak, but we're
- * only here if stopping the hardware failed.
- */
- dev_err(&ghes_dev->dev, "Failed to unregister ghes (%pe)\n",
- ERR_PTR(rc));
- return;
- }
+ apei_sdei_unregister_ghes(ghes);
+ break;
+
+ case ACPI_HEST_NOTIFY_SSE:
+ apei_sse_unregister_ghes(ghes);
break;
default:
BUG();
--
2.43.0
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH v5 8/9] riscv: Select HAVE_ACPI_APEI required for RAS
2026-09-24 7:37 [PATCH v5 0/9] Add RAS support for RISC-V architecture Himanshu Chauhan
` (6 preceding siblings ...)
2026-09-24 7:37 ` [PATCH v5 7/9] riscv: Introduce HEST SSE notification handlers Himanshu Chauhan
@ 2026-09-24 7:37 ` Himanshu Chauhan
2026-09-24 7:37 ` [PATCH v5 9/9] riscv: Enable APEI GHES driver in defconfig Himanshu Chauhan
8 siblings, 0 replies; 13+ messages in thread
From: Himanshu Chauhan @ 2026-09-24 7:37 UTC (permalink / raw)
To: linux-riscv, linux-kernel, linux-acpi, linux-efi
Cc: acpica-devel, anup.patel, ardb, conor, james.morse, lenb, palmer,
paul.walmsley, robert.moore, sunilvl, tony.luck,
zhangzhanpeng.jasper, Himanshu Chauhan
Select the HAVE_ACPI_APEI option so that APEI GHES config options
are visible.
Reviewed-by: Sunil V L <sunilvl@oss.qualcomm.com>
Signed-off-by: Himanshu Chauhan <himanshu.chauhan@oss.qualcomm.com>
---
arch/riscv/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index d6c2dbf8455c..9608abe126a0 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -191,6 +191,7 @@ config RISCV
select HAVE_MOVE_PUD
select HAVE_PAGE_SIZE_4KB
select HAVE_PCI
+ select HAVE_ACPI_APEI if ACPI
select HAVE_PERF_EVENTS
select HAVE_PERF_REGS
select HAVE_PERF_USER_STACK_DUMP
--
2.43.0
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH v5 9/9] riscv: Enable APEI GHES driver in defconfig
2026-09-24 7:37 [PATCH v5 0/9] Add RAS support for RISC-V architecture Himanshu Chauhan
` (7 preceding siblings ...)
2026-09-24 7:37 ` [PATCH v5 8/9] riscv: Select HAVE_ACPI_APEI required for RAS Himanshu Chauhan
@ 2026-09-24 7:37 ` Himanshu Chauhan
8 siblings, 0 replies; 13+ messages in thread
From: Himanshu Chauhan @ 2026-09-24 7:37 UTC (permalink / raw)
To: linux-riscv, linux-kernel, linux-acpi, linux-efi
Cc: acpica-devel, anup.patel, ardb, conor, james.morse, lenb, palmer,
paul.walmsley, robert.moore, sunilvl, tony.luck,
zhangzhanpeng.jasper, Himanshu Chauhan
The APEI GHES driver is very important for error handling on ACPI
based platforms so enable it in defconfig.
Signed-off-by: Himanshu Chauhan <himanshu.chauhan@oss.qualcomm.com>
---
arch/riscv/configs/defconfig | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig
index 04ae305d5511..66353b22298f 100644
--- a/arch/riscv/configs/defconfig
+++ b/arch/riscv/configs/defconfig
@@ -48,6 +48,9 @@ CONFIG_ACPI_CPPC_CPUFREQ=m
CONFIG_VIRTUALIZATION=y
CONFIG_KVM=m
CONFIG_ACPI=y
+CONFIG_ACPI_APEI=y
+CONFIG_ACPI_APEI_GHES=y
+CONFIG_ACPI_APEI_ERST_DEBUG=y
CONFIG_JUMP_LABEL=y
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
--
2.43.0
^ permalink raw reply [flat|nested] 13+ messages in thread