xen/riscv: handle hypervisor timer interrupts

Introduce timer_interrupt() to process IRQ_S_TIMER interrupts.
The handler disables further timer interrupts by clearing
SIE.STIE and raises TIMER_SOFTIRQ so the generic timer subsystem
can perform its processing.

Update do_trap() to dispatch IRQ_S_TIMER to this new handler.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Oleksii Kurochko authored and Jan Beulich committed 2026-03-10 09:27:22 +01:00
1 parent f3f7359b61
commit cfef4ba939
1 file changed
+14
+14
View File
@@ -10,6 +10,7 @@
#include <xen/lib.h>
#include <xen/nospec.h>
#include <xen/sched.h>
#include <xen/softirq.h>
#include <asm/cpufeature.h>
#include <asm/intc.h>
@@ -180,6 +181,15 @@ static void check_for_pcpu_work(void)
p2m_handle_vmenter();
}
static void timer_interrupt(void)
{
/* Disable the timer to avoid more interrupts */
csr_clear(CSR_SIE, BIT(IRQ_S_TIMER, UL));
/* Signal the generic timer code to do its work */
raise_softirq(TIMER_SOFTIRQ);
}
void do_trap(struct cpu_user_regs *cpu_regs)
{
register_t pc = cpu_regs->sepc;
@@ -221,6 +231,10 @@ void do_trap(struct cpu_user_regs *cpu_regs)
intc_handle_external_irqs(cpu_regs);
break;
case IRQ_S_TIMER:
timer_interrupt();
break;
default:
intr_handled = false;
break;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.