Re: [External] [PATCH v7 2/5] riscv: add support for SBI Supervisor Software Events extension
From: Clément Léger <hidden>
Date: 2025-10-27 13:29:41
Also in:
linux-riscv, lkml
On 10/27/25 13:00, Xu Lu wrote:
quoted
+void do_sse(struct sse_event_arch_data *arch_evt, struct pt_regs *regs) +{ + nmi_enter(); + + /* Retrieve missing GPRs from SBI */ + sbi_ecall(SBI_EXT_SSE, SBI_SSE_EVENT_ATTR_READ, arch_evt->evt_id, + SBI_SSE_ATTR_INTERRUPTED_A6, + (SBI_SSE_ATTR_INTERRUPTED_A7 - SBI_SSE_ATTR_INTERRUPTED_A6) + 1, + arch_evt->interrupted_phys, 0, 0); + + memcpy(®s->a6, &arch_evt->interrupted, sizeof(arch_evt->interrupted)); + + sse_handle_event(arch_evt, regs); + + /* + * The SSE delivery path does not uses the "standard" exception path + * (see sse_entry.S) and does not process any pending signal/softirqs + * due to being similar to a NMI. + * Some drivers (PMU, RAS) enqueue pending work that needs to be handled + * as soon as possible by bottom halves. For that purpose, set the SIP + * software interrupt pending bit which will force a software interrupt + * to be serviced once interrupts are reenabled in the interrupted + * context if they were masked or directly if unmasked. + */ + csr_set(CSR_IP, IE_SIE);IE_SIE may not always be enabled in CSR_IE(for example when we disable CONFIG_ACLINT_SSWI and use imsic for ipi). Maybe we should send ipi to the current cpu here.
Hi Xu, Indeed, that's a good catch. Sending an IPI will be more generic. Thanks, Clément
Best regards, Xu Lu