File S390-0002-S390-Tell-user-why-VM-creation-failed.patch of Package kvm
From 862acd6bf086fecfffd5ebc808697405b2ff9739 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 24 Mar 2010 18:16:01 +0100
Subject: [PATCH 2/6] S390: Tell user why VM creation failed
The KVM kernel module on S390 refuses to create a VM when the switch_amode
kernel parameter is not used.
Since that is not exactly obvious, let's give the user a nice warning.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
kvm-all.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
Index: qemu-kvm-0.12.3/kvm-all.c
===================================================================
--- qemu-kvm-0.12.3.orig/kvm-all.c
+++ qemu-kvm-0.12.3/kvm-all.c
@@ -443,8 +443,13 @@ int kvm_init(int smp_cpus)
}
s->vmfd = kvm_ioctl(s, KVM_CREATE_VM, 0);
- if (s->vmfd < 0)
+ if (s->vmfd < 0) {
+#ifdef TARGET_S390X
+ fprintf(stderr, "Please add the 'switch_amode' kernel parameter to "
+ "your host kernel command line\n");
+#endif
goto err;
+ }
/* initially, KVM allocated its own memory and we had to jump through
* hooks to make phys_ram_base point to this. Modern versions of KVM
Index: qemu-kvm-0.12.3/qemu-kvm.c
===================================================================
--- qemu-kvm-0.12.3.orig/qemu-kvm.c
+++ qemu-kvm-0.12.3/qemu-kvm.c
@@ -507,6 +507,11 @@ int kvm_create_vm(kvm_context_t kvm)
fd = kvm_ioctl(kvm_state, KVM_CREATE_VM, 0);
if (fd < 0) {
+#ifdef TARGET_S390X
+ fprintf(stderr, "Please add the 'switch_amode' kernel parameter to "
+ "your host kernel command line\n");
+ exit(1);
+#endif
fprintf(stderr, "kvm_create_vm: %m\n");
return -1;
}