lkml.org 
[lkml]   [2023]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC 35/48] RISC-V: KVM: Add TVM init/destroy calls
Date
A TVM can only be created upon explicit request from the VMM via
the vm type if CoVE SBI extensions must supported by the TSM.

Signed-off-by: Atish Patra <atishp@rivosinc.com>
---
arch/riscv/kvm/vm.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/arch/riscv/kvm/vm.c b/arch/riscv/kvm/vm.c
index 1b59a8f..8a1460d 100644
--- a/arch/riscv/kvm/vm.c
+++ b/arch/riscv/kvm/vm.c
@@ -42,6 +42,19 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
return r;
}

+ if (unlikely(type == KVM_VM_TYPE_RISCV_COVE)) {
+ if (!kvm_riscv_cove_enabled()) {
+ kvm_err("Unable to init CoVE VM because cove is not enabled\n");
+ return -EPERM;
+ }
+
+ r = kvm_riscv_cove_vm_init(kvm);
+ if (r)
+ return r;
+ kvm->arch.vm_type = type;
+ kvm_info("Trusted VM instance init successful\n");
+ }
+
kvm_riscv_aia_init_vm(kvm);

kvm_riscv_guest_timer_init(kvm);
@@ -54,6 +67,9 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
kvm_destroy_vcpus(kvm);

kvm_riscv_aia_destroy_vm(kvm);
+
+ if (unlikely(is_cove_vm(kvm)))
+ kvm_riscv_cove_vm_destroy(kvm);
}

int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irql,
--
2.25.1
\
 
 \ /
  Last update: 2023-04-20 00:22    [W:0.329 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site