On 13.02.2026 17:28, Oleksii Kurochko wrote:
> Lay the groundwork for guest timer support by introducing a per-vCPU
> virtual timer backed by Xen’s common timer infrastructure.
> 
> The virtual timer is programmed in response to the guest SBI
> sbi_set_timer() call and injects a virtual supervisor timer interrupt
> into the vCPU when it expires.
> 
> While a dedicated struct vtimer is not strictly required at present,
> it is expected to become necessary once SSTC support is introduced.
> In particular, it will need to carry additional state such as whether
> SSTC is enabled, the next compare value (e.g. for the VSTIMECMP CSR)
> to be saved and restored across context switches, and time delta state
> (e.g. HTIMEDELTA) required for use cases such as migration. Introducing
> struct vtimer now avoids a later refactoring.
> 
> Signed-off-by: Oleksii Kurochko <[email protected]>

Acked-by: Jan Beulich <[email protected]>
with a question and a remark.

> @@ -126,6 +130,8 @@ int arch_vcpu_create(struct vcpu *v)
>  
>  void arch_vcpu_destroy(struct vcpu *v)
>  {
> +    vcpu_timer_destroy(v);

It feels pretty late to do this, yet I notice vcpu_teardown() doesn't invoke
any per-arch function (yet). There's arch_domain_teardown(), though, which
technically could do this for all vCPU-s in a domain.

> --- /dev/null
> +++ b/xen/arch/riscv/include/asm/vtimer.h
> @@ -0,0 +1,20 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * (c) 2023-2024 Vates
> + */

Is this correct? Is this needed here?

Jan

Reply via email to