From: Anup Patel <apatel@ventanamicro.com>
To: Palmer Dabbelt <palmer@dabbelt.com>,
Paul Walmsley <paul.walmsley@sifive.com>
Cc: Atish Patra <atishp@atishpatra.org>,
Andrew Jones <ajones@ventanamicro.com>,
Anup Patel <anup@brainfault.org>,
kvm@vger.kernel.org, kvm-riscv@lists.infradead.org,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
Anup Patel <apatel@ventanamicro.com>
Subject: [PATCH 00/13] Accelerate KVM RISC-V when running as a guest
Date: Fri, 19 Jul 2024 21:39:00 +0530 [thread overview]
Message-ID: <20240719160913.342027-1-apatel@ventanamicro.com> (raw)
The KVM RISC-V hypervisor might be running as a guest under some other
host hypervisor in which case the complete H-extension functionality will
be trap-n-emulated by the host hypervisor. In this case, the KVM RISC-V
performance can be accelerated using the SBI nested acceleration (NACL)
extension if the host hypervisor provides it.
These series extends KVM RISC-V to use SBI NACL extension whenever
underlying SBI implementation (aka host hypervisor) provides it.
These patches can also be found in the riscv_sbi_nested_v1 branch at:
https://github.com/avpatel/linux.git
To test these patches, run KVM RISC-V as Guest under latest Xvisor
found at: https://github.com/xvisor/xvisor.git
For the steps to test on Xvisor, refer the Xvisor documentation
<xvisor_source>/docs/riscv/riscv64-qemu.txt with two small changes:
1) In step#11, make sure compressed kvm.ko, guest kernel image, and
kvmtool are present in the rootfs.img
2) In step#14, make sure AIA is available to Xvisor by using
"virt,aia=aplic-imsic" as the QEMU machine name.
Anup Patel (13):
RISC-V: KVM: Order the object files alphabetically
RISC-V: KVM: Save/restore HSTATUS in C source
RISC-V: KVM: Save/restore SCOUNTEREN in C source
RISC-V: KVM: Break down the __kvm_riscv_switch_to() into macros
RISC-V: KVM: Replace aia_set_hvictl() with aia_hvictl_value()
RISC-V: KVM: Don't setup SGEI for zero guest external interrupts
RISC-V: Add defines for the SBI nested acceleration extension
RISC-V: KVM: Add common nested acceleration support
RISC-V: KVM: Use nacl_csr_xyz() for accessing H-extension CSRs
RISC-V: KVM: Use nacl_csr_xyz() for accessing AIA CSRs
RISC-V: KVM: Use SBI sync SRET call when available
RISC-V: KVM: Save trap CSRs in kvm_riscv_vcpu_enter_exit()
RISC-V: KVM: Use NACL HFENCEs for KVM request based HFENCEs
arch/riscv/include/asm/kvm_nacl.h | 237 ++++++++++++++++++++++++++++++
arch/riscv/include/asm/sbi.h | 120 +++++++++++++++
arch/riscv/kvm/Makefile | 27 ++--
arch/riscv/kvm/aia.c | 114 +++++++++-----
arch/riscv/kvm/main.c | 53 ++++++-
arch/riscv/kvm/mmu.c | 4 +-
arch/riscv/kvm/nacl.c | 152 +++++++++++++++++++
arch/riscv/kvm/tlb.c | 57 ++++---
arch/riscv/kvm/vcpu.c | 184 +++++++++++++++++------
arch/riscv/kvm/vcpu_switch.S | 137 ++++++++++-------
arch/riscv/kvm/vcpu_timer.c | 28 ++--
11 files changed, 935 insertions(+), 178 deletions(-)
create mode 100644 arch/riscv/include/asm/kvm_nacl.h
create mode 100644 arch/riscv/kvm/nacl.c
--
2.34.1
next reply other threads:[~2024-07-19 16:09 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-19 16:09 Anup Patel [this message]
2024-07-19 16:09 ` [PATCH 01/13] RISC-V: KVM: Order the object files alphabetically Anup Patel
2024-10-16 19:03 ` [01/13] " Atish Patra
2024-07-19 16:09 ` [PATCH 02/13] RISC-V: KVM: Save/restore HSTATUS in C source Anup Patel
2024-10-16 19:27 ` [02/13] " Atish Patra
2024-07-19 16:09 ` [PATCH 03/13] RISC-V: KVM: Save/restore SCOUNTEREN " Anup Patel
2024-10-16 21:36 ` Atish Patra
2024-07-19 16:09 ` [PATCH 04/13] RISC-V: KVM: Break down the __kvm_riscv_switch_to() into macros Anup Patel
2024-10-16 21:37 ` Atish Patra
2024-07-19 16:09 ` [PATCH 05/13] RISC-V: KVM: Replace aia_set_hvictl() with aia_hvictl_value() Anup Patel
2024-10-16 21:39 ` Atish Patra
2024-07-19 16:09 ` [PATCH 06/13] RISC-V: KVM: Don't setup SGEI for zero guest external interrupts Anup Patel
2024-10-16 21:40 ` Atish Patra
2024-07-19 16:09 ` [PATCH 07/13] RISC-V: Add defines for the SBI nested acceleration extension Anup Patel
2024-10-17 23:55 ` Atish Patra
2024-07-19 16:09 ` [PATCH 08/13] RISC-V: KVM: Add common nested acceleration support Anup Patel
2024-10-18 18:19 ` Atish Patra
2024-10-20 18:19 ` Anup Patel
2024-07-19 16:09 ` [PATCH 09/13] RISC-V: KVM: Use nacl_csr_xyz() for accessing H-extension CSRs Anup Patel
2024-10-18 19:31 ` Atish Patra
2024-10-20 18:43 ` Anup Patel
2024-07-19 16:09 ` [PATCH 10/13] RISC-V: KVM: Use nacl_csr_xyz() for accessing AIA CSRs Anup Patel
2024-10-18 19:34 ` Atish Patra
2024-07-19 16:09 ` [PATCH 11/13] RISC-V: KVM: Use SBI sync SRET call when available Anup Patel
2024-10-18 20:03 ` Atish Patra
2024-10-20 19:28 ` Anup Patel
2024-07-19 16:09 ` [PATCH 12/13] RISC-V: KVM: Save trap CSRs in kvm_riscv_vcpu_enter_exit() Anup Patel
2024-10-18 20:11 ` Atish Patra
2024-07-19 16:09 ` [PATCH 13/13] RISC-V: KVM: Use NACL HFENCEs for KVM request based HFENCEs Anup Patel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240719160913.342027-1-apatel@ventanamicro.com \
--to=apatel@ventanamicro.com \
--cc=ajones@ventanamicro.com \
--cc=anup@brainfault.org \
--cc=atishp@atishpatra.org \
--cc=kvm-riscv@lists.infradead.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox