[PATCH v5 00/14] xen/riscv: introduce vtimer related things

Oleksii Kurochko posted 14 patches 1 week, 3 days ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/cover.1771590794.git.oleksii.kurochko@gmail.com
There is a newer version of this series
xen/arch/arm/include/asm/time.h             |   3 -
xen/arch/arm/time.c                         |  11 -
xen/arch/arm/vtimer.c                       |   2 +-
xen/arch/riscv/Makefile                     |   1 +
xen/arch/riscv/domain.c                     | 231 +++++++++++++++++++-
xen/arch/riscv/include/asm/Makefile         |   1 -
xen/arch/riscv/include/asm/current.h        |   2 +
xen/arch/riscv/include/asm/domain.h         |  33 +++
xen/arch/riscv/include/asm/perfc_defn.h     |   3 +
xen/arch/riscv/include/asm/riscv_encoding.h |   2 +
xen/arch/riscv/include/asm/sbi.h            |  22 ++
xen/arch/riscv/include/asm/setup.h          |   2 +
xen/arch/riscv/include/asm/time.h           |   5 -
xen/arch/riscv/include/asm/vtimer.h         |  20 ++
xen/arch/riscv/sbi.c                        |  40 +++-
xen/arch/riscv/setup.c                      |   5 +
xen/arch/riscv/stubs.c                      |  20 --
xen/arch/riscv/time.c                       |  44 ++++
xen/arch/riscv/traps.c                      |  20 ++
xen/arch/riscv/vsbi/legacy-extension.c      |   6 +
xen/arch/riscv/vtimer.c                     |  86 ++++++++
xen/include/xen/time.h                      |  11 +
22 files changed, 526 insertions(+), 44 deletions(-)
create mode 100644 xen/arch/riscv/include/asm/perfc_defn.h
create mode 100644 xen/arch/riscv/include/asm/vtimer.h
create mode 100644 xen/arch/riscv/vtimer.c
[PATCH v5 00/14] xen/riscv: introduce vtimer related things
Posted by Oleksii Kurochko 1 week, 3 days ago
This patch series introduces the components necessary to implement a virtual
timer (vtimer).

Since the SSTC extension is not supported by Xen, an emulated (SBI-based)
timer is required. To address this, a virtual timer built on Xen’s timer
infrastructure is introduced, with save/restore support and SBI-based
programming.

To provide full guest software–based timer support, the following components
are also introduced:
- arch_vcpu_{create,destroy}() to initialize the virtual timer and other
  vCPU-related state not directly tied to timer functionality. As part of this
  work, struct arch_vcpu is introduced to describe the internal state of a
  virtual CPU, along with vcpu_csr_init() to initialize the relevant CSR state.
- Support functions required by the virtual timer, including:
  - vcpu_kick(), and a stub implementation of smp_send_event_check_mask()
    (since SMP is not yet supported in Xen), which is used by vcpu_kick().
  - Support for guest timer programming via interception of the SBI legacy
    SET_TIMER call from guest.
  - Implement reprogram_timer() using introduced sbi_set_timer().
  - Initial lockless tracking of pending vCPU interrupts using atomic bitmaps.
- Handling of hypervisor timer interrupts and dispatch into Xen’s generic timer
  softirq.

CI tests: https://gitlab.com/xen-project/people/olkur/xen/-/pipelines/2339388491
---
Changes in v5:
 - Merged to upstream/staging:
     xen/riscv: implement arch_vcpu_{create,destroy}()
     xen/riscv: build setup code as .init
 - Rebase this patch series on top of:
     https://lore.kernel.org/xen-devel/5756356294dc066d835269334d0f3347fe24cec4.1771504676.git.oleksii.kurochko@gmail.com/T/#u
   There is no logical dependency, only the potential merge conflict question.
 - Address comments from ML.
---
Changes in v4:
 - Merged to upstream/staging:
     xen/riscv: avoid reading hstateen0 when Smstateen is not implemented
 - Address other comments from ML.
---
Changes in v3:
 - Squash patch "xen/riscv: introduce struct arch_vcpu" into other
   patches of the patch series.
 - Merged to staging:
   - xen/riscv: implement stub for smp_send_event_check_mask()
 - Address other comments from ML.
---
Changes in v2:
 - Add consumer part of tracking of pending vCPU interrupts.
 - Split patch "xen/riscv: init tasklet subsystem" to two.
 - Patches were acked:
   - xen/riscv: introduce vcpu_kick() implementation
   - xen/riscv: implement SBI legacy SET_TIMER support for guests
 - All other changes are patch-specific. Please check them.
---

Oleksii Kurochko (14):
  xen/riscv: detect and store supported hypervisor CSR bits at boot
  xen/riscv: implement vcpu_csr_init()
  xen/riscv: introduce tracking of pending vCPU interrupts, part 1
  xen/riscv: introduce tracking of pending vCPU interrupts, part 2
  xen/time: move ticks<->ns helpers to common code
  xen/riscv: introduce basic vtimer infrastructure for guests
  xen/riscv: introduce vcpu_kick() implementation
  xen/riscv: add vtimer context switch helpers
  xen/riscv: implement SBI legacy SET_TIMER support for guests
  xen/riscv: introduce sbi_set_timer()
  xen/riscv: implement reprogram_timer() via SBI
  xen/riscv: handle hypervisor timer interrupts
  xen/riscv: init tasklet subsystem
  xen/riscv: implement sync_vcpu_execstate()

 xen/arch/arm/include/asm/time.h             |   3 -
 xen/arch/arm/time.c                         |  11 -
 xen/arch/arm/vtimer.c                       |   2 +-
 xen/arch/riscv/Makefile                     |   1 +
 xen/arch/riscv/domain.c                     | 231 +++++++++++++++++++-
 xen/arch/riscv/include/asm/Makefile         |   1 -
 xen/arch/riscv/include/asm/current.h        |   2 +
 xen/arch/riscv/include/asm/domain.h         |  33 +++
 xen/arch/riscv/include/asm/perfc_defn.h     |   3 +
 xen/arch/riscv/include/asm/riscv_encoding.h |   2 +
 xen/arch/riscv/include/asm/sbi.h            |  22 ++
 xen/arch/riscv/include/asm/setup.h          |   2 +
 xen/arch/riscv/include/asm/time.h           |   5 -
 xen/arch/riscv/include/asm/vtimer.h         |  20 ++
 xen/arch/riscv/sbi.c                        |  40 +++-
 xen/arch/riscv/setup.c                      |   5 +
 xen/arch/riscv/stubs.c                      |  20 --
 xen/arch/riscv/time.c                       |  44 ++++
 xen/arch/riscv/traps.c                      |  20 ++
 xen/arch/riscv/vsbi/legacy-extension.c      |   6 +
 xen/arch/riscv/vtimer.c                     |  86 ++++++++
 xen/include/xen/time.h                      |  11 +
 22 files changed, 526 insertions(+), 44 deletions(-)
 create mode 100644 xen/arch/riscv/include/asm/perfc_defn.h
 create mode 100644 xen/arch/riscv/include/asm/vtimer.h
 create mode 100644 xen/arch/riscv/vtimer.c

-- 
2.53.0