[PW_SID:963680] riscv: add support for SBI Supervisor Software Events#422
[PW_SID:963680] riscv: add support for SBI Supervisor Software Events#422linux-riscv-bot wants to merge 4 commits into
Conversation
Add needed definitions for SBI Supervisor Software Events extension [1]. This extension enables the SBI to inject events into supervisor software much like ARM SDEI. [1] https://lists.riscv.org/g/tech-prs/message/515 Signed-off-by: Clément Léger <cleger@rivosinc.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The SBI SSE extension allows the supervisor software to be notified by the SBI of specific events that are not maskable. The context switch is handled partially by the firmware which will save registers a6 and a7. When entering kernel we can rely on these 2 registers to setup the stack and save all the registers. Since SSE events can be delivered at any time to the kernel (including during exception handling, we need a way to locate the current_task for context tracking. On RISC-V, it is sotred in scratch when in user space or tp when in kernel space (in which case SSCRATCH is zero). But at a at the beginning of exception handling, SSCRATCH is used to swap tp and check the origin of the exception. If interrupted at that point, then, there is no way to reliably know were is located the current task_struct. Even checking the interruption location won't work as SSE event can be nested on top of each other so the original interruption site might be lost at some point. In order to retrieve it reliably, store the current task in an additionnal __sse_entry_task per_cpu array. This array is then used to retrieve the current task based on the hart ID that is passed to the SSE event handler in a6. That being said, the way the current task struct is stored should probably be reworked to find a better reliable alternative. Since each events (and each CPU for local events) have their own context and can preempt each other, allocate a stack (and a shadow stack if needed for each of them (and for each cpu for local events). When completing the event, if we were coming from kernel with interrupts disabled, simply return there. If coming from userspace or kernel with interrupts enabled, simulate an interrupt exception by setting IE_SIE in CSR_IP to allow delivery of signals to user task. For instance this can happen, when a RAS event has been generated by a user application and a SIGBUS has been sent to a task. Signed-off-by: Clément Léger <cleger@rivosinc.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add driver level interface to use RISC-V SSE arch support. This interface allows registering SSE handlers, and receive them. This will be used by PMU and GHES driver. Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Co-developed-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Signed-off-by: Clément Léger <cleger@rivosinc.com> Acked-by: Conor Dooley <conor.dooley@microchip.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
In order to use SSE within PMU drivers, register a SSE handler for the local PMU event. Reuse the existing overflow IRQ handler and pass appropriate pt_regs. Add a config option RISCV_PMU_SSE to select event delivery via SSE events. Signed-off-by: Clément Léger <cleger@rivosinc.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[v4,1/4] riscv: add SBI SSE extension definitions" |
|
Patch 1: "[v4,1/4] riscv: add SBI SSE extension definitions" |
|
Patch 1: "[v4,1/4] riscv: add SBI SSE extension definitions" |
|
Patch 1: "[v4,1/4] riscv: add SBI SSE extension definitions" |
|
Patch 1: "[v4,1/4] riscv: add SBI SSE extension definitions" |
|
Patch 1: "[v4,1/4] riscv: add SBI SSE extension definitions" |
|
Patch 1: "[v4,1/4] riscv: add SBI SSE extension definitions" |
|
Patch 1: "[v4,1/4] riscv: add SBI SSE extension definitions" |
|
Patch 1: "[v4,1/4] riscv: add SBI SSE extension definitions" |
|
Patch 1: "[v4,1/4] riscv: add SBI SSE extension definitions" |
|
Patch 1: "[v4,1/4] riscv: add SBI SSE extension definitions" |
|
Patch 1: "[v4,1/4] riscv: add SBI SSE extension definitions" |
|
Patch 2: "[v4,2/4] riscv: add support for SBI Supervisor Software Events extension" |
|
Patch 2: "[v4,2/4] riscv: add support for SBI Supervisor Software Events extension" |
|
Patch 2: "[v4,2/4] riscv: add support for SBI Supervisor Software Events extension" |
|
Patch 2: "[v4,2/4] riscv: add support for SBI Supervisor Software Events extension" |
|
Patch 2: "[v4,2/4] riscv: add support for SBI Supervisor Software Events extension" |
|
Patch 2: "[v4,2/4] riscv: add support for SBI Supervisor Software Events extension" |
|
Patch 2: "[v4,2/4] riscv: add support for SBI Supervisor Software Events extension" |
|
Patch 2: "[v4,2/4] riscv: add support for SBI Supervisor Software Events extension" |
|
Patch 2: "[v4,2/4] riscv: add support for SBI Supervisor Software Events extension" |
|
Patch 2: "[v4,2/4] riscv: add support for SBI Supervisor Software Events extension" |
|
Patch 2: "[v4,2/4] riscv: add support for SBI Supervisor Software Events extension" |
|
Patch 2: "[v4,2/4] riscv: add support for SBI Supervisor Software Events extension" |
|
Patch 3: "[v4,3/4] drivers: firmware: add riscv SSE support" |
|
Patch 3: "[v4,3/4] drivers: firmware: add riscv SSE support" |
|
Patch 3: "[v4,3/4] drivers: firmware: add riscv SSE support" |
|
Patch 3: "[v4,3/4] drivers: firmware: add riscv SSE support" |
|
Patch 3: "[v4,3/4] drivers: firmware: add riscv SSE support" |
|
Patch 3: "[v4,3/4] drivers: firmware: add riscv SSE support" |
|
Patch 3: "[v4,3/4] drivers: firmware: add riscv SSE support" |
|
Patch 3: "[v4,3/4] drivers: firmware: add riscv SSE support" |
|
Patch 3: "[v4,3/4] drivers: firmware: add riscv SSE support" |
|
Patch 3: "[v4,3/4] drivers: firmware: add riscv SSE support" |
|
Patch 3: "[v4,3/4] drivers: firmware: add riscv SSE support" |
|
Patch 3: "[v4,3/4] drivers: firmware: add riscv SSE support" |
|
Patch 4: "[v4,4/4] perf: RISC-V: add support for SSE event" |
|
Patch 4: "[v4,4/4] perf: RISC-V: add support for SSE event" |
|
Patch 4: "[v4,4/4] perf: RISC-V: add support for SSE event" |
|
Patch 4: "[v4,4/4] perf: RISC-V: add support for SSE event" |
|
Patch 4: "[v4,4/4] perf: RISC-V: add support for SSE event" |
|
Patch 4: "[v4,4/4] perf: RISC-V: add support for SSE event" |
|
Patch 4: "[v4,4/4] perf: RISC-V: add support for SSE event" |
|
Patch 4: "[v4,4/4] perf: RISC-V: add support for SSE event" |
|
Patch 4: "[v4,4/4] perf: RISC-V: add support for SSE event" |
|
Patch 4: "[v4,4/4] perf: RISC-V: add support for SSE event" |
|
Patch 4: "[v4,4/4] perf: RISC-V: add support for SSE event" |
|
Patch 4: "[v4,4/4] perf: RISC-V: add support for SSE event" |
PR for series 963680 applied to workflow__riscv__fixes
Name: riscv: add support for SBI Supervisor Software Events
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=963680
Version: 4