Skip to content

RISC-V KVM virtualize AIA CSRs

Anup Patel kvm kvm-riscv linux-riscv lkml 4 versions – Applied

Status from this message: I have queued PATCH1 to PATCH8 for Linux-6.4

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest9 patches 8 repliesApplied 2/9
  2. v38 patches 21 repliesSuperseded
  3. v27 patches 29 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v17 patches10 repliesSuperseded

Changes in v4 from the cover letter

- Split PATCH7 into two patches
- Addressed comments in PATCH7, PATCH8 and PATCH9

Patches in v4 Applied · 2/9

#Subject and filesSizeRepliesApplied
1/9RISC-V: Add AIA related CSR definesarch/riscv/include/asm/csr.h+94 -10 repliesApplied
2/9RISC-V: Detect AIA CSRs from ISA stringarch/riscv/include/asm/hwcap.h arch/riscv/kernel/cpu.c arch/riscv/kernel/cpufeature.c+6 -03 repliesApplied
3/9RISC-V: KVM: Drop the _MASK suffix from hgatp.VMID mask definesarch/riscv/include/asm/csr.h arch/riscv/kvm/mmu.c arch/riscv/kvm/vmid.c+9 -100 replies
4/9RISC-V: KVM: Initial skeletal support for AIAarch/riscv/include/asm/hwcap.h arch/riscv/include/asm/kvm_aia.h arch/riscv/include/asm/kvm_host.h +6 more+255 -60 replies
5/9RISC-V: KVM: Implement subtype for CSR ONE_REG interfacearch/riscv/include/uapi/asm/kvm.h arch/riscv/kvm/vcpu.c+69 -220 replies
6/9RISC-V: KVM: Add ONE_REG interface for AIA CSRsarch/riscv/include/uapi/asm/kvm.h arch/riscv/kvm/vcpu.c+16 -00 replies
7/9RISC-V: KVM: Use bitmap for irqs_pending and irqs_pending_maskarch/riscv/include/asm/kvm_host.h arch/riscv/kvm/vcpu.c+38 -221 reply
8/9RISC-V: KVM: Virtualize per-HART AIA CSRsarch/riscv/include/asm/kvm_aia.h arch/riscv/include/uapi/asm/kvm.h arch/riscv/kvm/aia.c+382 -351 reply
9/9RISC-V: KVM: Implement guest external interrupt line managementarch/riscv/include/asm/kvm_aia.h arch/riscv/kvm/aia.c arch/riscv/kvm/main.c +1 more+253 -11 reply

Reviews trailers per patch

All 9 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchConor DooleyAndrew JonesAtish PatraPalmer Dabbelt
SeriesA-b
1/9R-b R-b R-b A-b
2/9R-b R-b R-b
3/9R-b R-b
4/9R-b R-b
5/9R-b R-b
6/9R-b R-b
7/9R-b
8/9R-b
9/9R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v4 thread

Cover letter [PATCH v4 0/9] RISC-V KVM virtualize AIA CSRs

The RISC-V AIA specification is now frozen as-per the RISC-V international process. The latest frozen specifcation can be found at:
https://github.com/riscv/riscv-aia/releases/download/1.0-RC3/riscv-interrupts-1.0-RC3.pdf

This series implements first phase of AIA virtualization which targets virtualizing AIA CSRs. This also provides a foundation for the second phase of AIA virtualization which will target in-kernel AIA irqchip (including both IMSIC and APLIC).

The first two patches are shared with the "Linux RISC-V AIA Support" series which adds AIA driver support.

To test this series, use AIA drivers from the "Linux RISC-V AIA Support" series and use KVMTOOL from the riscv_aia_v1 branch at:
https://github.com/avpatel/kvmtool.git

These patches can also be found in the riscv_kvm_aia_csr_v4 branch at:
https://github.com/avpatel/linux.git

Based-on: 20230401112730.2105240-1-apatel at ventanamicro.com
(https://lore.kernel.org/lkml/20230401112730.2105240-1-apatel at ventanamicro.com/)

Based-on: 20230403121527.2286489-1-apatel at ventanamicro.com
(https://lore.kernel.org/lkml/20230403121527.2286489-1-apatel at ventanamicro.com/)

Changes since v3:
- Split PATCH7 into two patches
- Addressed comments in PATCH7, PATCH8 and PATCH9

Changes since v2:
- Rebased on Linux-6.3-rc5
- Split PATCH5 into two separate patches as suggested by Atish.

Changes since v1:
- Addressed from Drew and Conor in PATCH1
- Use alphabetical ordering for SMAIA and SSAIA enum in PATCH2
- Use GENMASK() in PATCH3

Anup Patel (9):
RISC-V: Add AIA related CSR defines
RISC-V: Detect AIA CSRs from ISA string
RISC-V: KVM: Drop the _MASK suffix from hgatp.VMID mask defines
RISC-V: KVM: Initial skeletal support for AIA
RISC-V: KVM: Implement subtype for CSR ONE_REG interface
RISC-V: KVM: Add ONE_REG interface for AIA CSRs
RISC-V: KVM: Use bitmap for irqs_pending and irqs_pending_mask
RISC-V: KVM: Virtualize per-HART AIA CSRs
RISC-V: KVM: Implement guest external interrupt line management

 arch/riscv/include/asm/csr.h      | 107 ++++-
 arch/riscv/include/asm/hwcap.h    |   8 +
 arch/riscv/include/asm/kvm_aia.h  | 137 +++++++
 arch/riscv/include/asm/kvm_host.h |  14 +-
 arch/riscv/include/uapi/asm/kvm.h |  18 +-
 arch/riscv/kernel/cpu.c           |   2 +
 arch/riscv/kernel/cpufeature.c    |   2 +
 arch/riscv/kvm/Makefile           |   1 +
 arch/riscv/kvm/aia.c              | 627 ++++++++++++++++++++++++++++++
 arch/riscv/kvm/main.c             |  23 +-
 arch/riscv/kvm/mmu.c              |   3 +-
 arch/riscv/kvm/vcpu.c             | 190 +++++++--
 arch/riscv/kvm/vcpu_insn.c        |   1 +
 arch/riscv/kvm/vm.c               |   4 +
 arch/riscv/kvm/vmid.c             |   4 +-
 15 files changed, 1083 insertions(+), 58 deletions(-)
 create mode 100644 arch/riscv/include/asm/kvm_aia.h
 create mode 100644 arch/riscv/kvm/aia.c
Signature · 1 line
2.34.1