From 7af8b6f879b60be82491b77f8a34212c2a3d192c Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Thu, 26 Aug 2021 15:10:43 +0100 Subject: [PATCH] kvm: Explicitly provide an argument to KVM_CREATE_VM On all architectures, KVM_CREATE_VM takes an argument known as the 'machine type identifier'. This machine type is architecture dependent, and the documentation helpfully says: You probably want to use 0 as machine type. So let's do that. Change-Id: I8a8a0f7b78e32012c5ab841097c05a02fe0532ff Signed-off-by: Marc Zyngier Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3124676 Tested-by: kokoro Reviewed-by: Andrew Walbran Reviewed-by: Chirantan Ekbote Reviewed-by: Keiichi Watanabe Reviewed-by: Dennis Kempin --- hypervisor/src/kvm/mod.rs | 2 +- kvm/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hypervisor/src/kvm/mod.rs b/hypervisor/src/kvm/mod.rs index 86e247712d..d6a6e0c726 100644 --- a/hypervisor/src/kvm/mod.rs +++ b/hypervisor/src/kvm/mod.rs @@ -166,7 +166,7 @@ impl KvmVm { pub fn new(kvm: &Kvm, guest_mem: GuestMemory) -> Result { // Safe because we know kvm is a real kvm fd as this module is the only one that can make // Kvm objects. - let ret = unsafe { ioctl(kvm, KVM_CREATE_VM()) }; + let ret = unsafe { ioctl_with_val(kvm, KVM_CREATE_VM(), 0) }; if ret < 0 { return errno_result(); } diff --git a/kvm/src/lib.rs b/kvm/src/lib.rs index 4b75c1cdc8..d571ec4885 100644 --- a/kvm/src/lib.rs +++ b/kvm/src/lib.rs @@ -274,7 +274,7 @@ impl Vm { pub fn new(kvm: &Kvm, guest_mem: GuestMemory) -> Result { // Safe because we know kvm is a real kvm fd as this module is the only one that can make // Kvm objects. - let ret = unsafe { ioctl(kvm, KVM_CREATE_VM()) }; + let ret = unsafe { ioctl_with_val(kvm, KVM_CREATE_VM(), 0) }; if ret >= 0 { // Safe because we verify the value of ret and we are the owners of the fd. let vm_file = unsafe { File::from_raw_descriptor(ret) };