summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kvm/lib/guest_modes.c
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2021-10-05 18:09:56 +0530
committerAnup Patel <anup@brainfault.org>2022-01-06 15:17:50 +0530
commit3e06cdf10520e629e711b76b21070d6e67ae7d06 (patch)
tree10899ef656b600aa40833bcf241cb3470db9c47f /tools/testing/selftests/kvm/lib/guest_modes.c
parent788490e798a707cea75d80448f5c6c5f322ada6e (diff)
downloadlinux-stable-3e06cdf10520e629e711b76b21070d6e67ae7d06.tar.gz
linux-stable-3e06cdf10520e629e711b76b21070d6e67ae7d06.tar.bz2
linux-stable-3e06cdf10520e629e711b76b21070d6e67ae7d06.zip
KVM: selftests: Add initial support for RISC-V 64-bit
We add initial support for RISC-V 64-bit in KVM selftests using which we can cross-compile and run arch independent tests such as: demand_paging_test dirty_log_test kvm_create_max_vcpus, kvm_page_table_test set_memory_region_test kvm_binary_stats_test All VM guest modes defined in kvm_util.h require at least 48-bit guest virtual address so to use KVM RISC-V selftests hardware need to support at least Sv48 MMU for guest (i.e. VS-mode). Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-and-tested-by: Atish Patra <atishp@rivosinc.com>
Diffstat (limited to 'tools/testing/selftests/kvm/lib/guest_modes.c')
-rw-r--r--tools/testing/selftests/kvm/lib/guest_modes.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/lib/guest_modes.c b/tools/testing/selftests/kvm/lib/guest_modes.c
index c330f414ef96..57839a12e472 100644
--- a/tools/testing/selftests/kvm/lib/guest_modes.c
+++ b/tools/testing/selftests/kvm/lib/guest_modes.c
@@ -38,6 +38,16 @@ void guest_modes_append_default(void)
guest_mode_append(VM_MODE_P47V64_4K, true, true);
}
#endif
+#ifdef __riscv
+ {
+ unsigned int sz = kvm_check_cap(KVM_CAP_VM_GPA_BITS);
+
+ if (sz >= 52)
+ guest_mode_append(VM_MODE_P52V48_4K, true, true);
+ if (sz >= 48)
+ guest_mode_append(VM_MODE_P48V48_4K, true, true);
+ }
+#endif
}
void for_each_guest_mode(void (*func)(enum vm_guest_mode, void *), void *arg)