aboutsummaryrefslogtreecommitdiff
path: root/accel
diff options
context:
space:
mode:
authorFabiano Rosas <farosas@linux.ibm.com>2021-07-22 11:13:40 -0300
committerDavid Gibson <david@gibson.dropbear.id.au>2021-07-29 10:59:49 +1000
commit380e49297c302fdcf8e5d56abdbe07868d3af8d8 (patch)
tree78de3cbbf0cc4f744c501929e13e53f43222ca66 /accel
parent14c7e06e722af6f5459ab92bae3023bb336fa497 (diff)
downloadqemu-380e49297c302fdcf8e5d56abdbe07868d3af8d8.zip
qemu-380e49297c302fdcf8e5d56abdbe07868d3af8d8.tar.gz
qemu-380e49297c302fdcf8e5d56abdbe07868d3af8d8.tar.bz2
kvm: ppc: Print meaningful message on KVM_CREATE_VM failure
PowerPC has two KVM types (HV, PR) that translate into three kernel modules: kvm.ko - common kvm code kvm_hv.ko - kvm running with MSR_HV=1 or MSR_HV|PR=0 in a nested guest. kvm_pr.ko - kvm running in usermode MSR_PR=1. Since the two KVM types can both be running at the same time, this creates a situation in which it is possible for one or both of the modules to fail to initialize, leaving the generic one behind. This leads QEMU to think it can create a guest, but KVM will fail when calling the type-specific code: ioctl(KVM_CREATE_VM) failed: 22 Invalid argument qemu-kvm: failed to initialize KVM: Invalid argument Ideally this would be solved kernel-side, but it might be a while until we can get rid of one of the modules. So in the meantime this patch tries to make this less confusing for the end user by adding a more elucidative message: ioctl(KVM_CREATE_VM) failed: 22 Invalid argument PPC KVM module is not loaded. Try 'modprobe kvm_hv'. [dwg: Fixed error in #elif which failed compile on !ppc hosts] Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com> Message-Id: <20210722141340.2367905-1-farosas@linux.ibm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'accel')
-rw-r--r--accel/kvm/kvm-all.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index e5b10dd..0125c17 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -2397,6 +2397,12 @@ static int kvm_init(MachineState *ms)
"- for kernels supporting the vm.allocate_pgste sysctl, "
"whether it is enabled\n");
}
+#elif defined(TARGET_PPC)
+ if (ret == -EINVAL) {
+ fprintf(stderr,
+ "PPC KVM module is not loaded. Try modprobe kvm_%s.\n",
+ (type == 2) ? "pr" : "hv");
+ }
#endif
goto err;
}