Most architectures pass a fixed value for their VM type. However, arm64 uses it as a parameter describing the size of the guest's physical address space. In order to support this, introduce a kvm__get_vm_type() helper that only returns KVM_VM_TYPE for now. Reviewed-by: Andre Przywara <andre.przywara@xxxxxxx> Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx> --- include/kvm/kvm.h | 1 + kvm.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/kvm/kvm.h b/include/kvm/kvm.h index 56e9c8e3..ad732e56 100644 --- a/include/kvm/kvm.h +++ b/include/kvm/kvm.h @@ -114,6 +114,7 @@ int kvm__init(struct kvm *kvm); struct kvm *kvm__new(void); int kvm__recommended_cpus(struct kvm *kvm); int kvm__max_cpus(struct kvm *kvm); +int kvm__get_vm_type(struct kvm *kvm); void kvm__init_ram(struct kvm *kvm); int kvm__exit(struct kvm *kvm); bool kvm__load_firmware(struct kvm *kvm, const char *firmware_filename); diff --git a/kvm.c b/kvm.c index e327541d..5bc66c8b 100644 --- a/kvm.c +++ b/kvm.c @@ -428,6 +428,11 @@ int kvm__max_cpus(struct kvm *kvm) return ret; } +int __attribute__((weak)) kvm__get_vm_type(struct kvm *kvm) +{ + return KVM_VM_TYPE; +} + int kvm__init(struct kvm *kvm) { int ret; @@ -461,7 +466,7 @@ int kvm__init(struct kvm *kvm) goto err_sys_fd; } - kvm->vm_fd = ioctl(kvm->sys_fd, KVM_CREATE_VM, KVM_VM_TYPE); + kvm->vm_fd = ioctl(kvm->sys_fd, KVM_CREATE_VM, kvm__get_vm_type(kvm)); if (kvm->vm_fd < 0) { pr_err("KVM_CREATE_VM ioctl"); ret = kvm->vm_fd; -- 2.30.2 _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm