On 22.01.2026 17:47, Oleksii Kurochko wrote:
> Introduce vtimer_ctx_switch_from() and vtimer_ctx_switch_to() to handle
> virtual timer state across vCPU context switches.
> 
> At present, vtimer_ctx_switch_from() is a no-op because the RISC-V SSTC
> extension, which provides a virtualization-aware timer, is not yet
> supported. Xen therefore relies the virtual (SBI-based) timer.
> 
> The virtual timer uses Xen's internal timer infrastructure and must be
> associated with the pCPU on which the vCPU is currently running so that
> timer events can be delivered efficiently. As a result, vtimer_ctx_switch_to()
> migrates the timer to the target pCPU when a vCPU is scheduled in.
> 
> Signed-off-by: Oleksii Kurochko <[email protected]>

Acked-by: Jan Beulich <[email protected]>

However, ...

> --- a/xen/arch/riscv/include/asm/vtimer.h
> +++ b/xen/arch/riscv/include/asm/vtimer.h
> @@ -17,4 +17,7 @@ void vcpu_timer_destroy(struct vcpu *v);
>  
>  void vtimer_set_timer(struct vtimer *t, uint64_t ticks);
>  
> +void vtimer_ctx_switch_from(struct vcpu *p);
> +void vtimer_ctx_switch_to(struct vcpu *n);

... may I ask that you reconsider naming here? Both Arm and x86 have functions
where the prefix / infix is "ctxt", not just "ctx". Being able to find all by
grep-ing for e.g. ctxt_switch_from might be quite nice.

Jan

Reply via email to