aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2010-04-19 18:59:30 +0000
committerBlue Swirl <blauwirbel@gmail.com>2010-04-19 18:59:30 +0000
commit98c8573eb37bf5d7bb0c07225985a78537c73101 (patch)
treec709ea4646f51f34804bbf8de7dc1245254334b2 /vl.c
parentc66b5c2cb6bf5ab9869bf0739ff3cdf143ab778c (diff)
provide a stub version of kvm-all.c if !CONFIG_KVM
This allows limited use of kvm functions (which will return ENOSYS) even in once-compiled modules. The patch also improves a bit the error messages for KVM initialization. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> [blauwirbel@gmail.com: fixed Win32 build] Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/vl.c b/vl.c
index 2f6c167253..e58441b8a1 100644
--- a/vl.c
+++ b/vl.c
@@ -3157,10 +3157,6 @@ int main(int argc, char **argv, char **envp)
do_smbios_option(optarg);
break;
case QEMU_OPTION_enable_kvm:
- if (!(kvm_available())) {
- printf("Option %s not supported for this target\n", popt->name);
- exit(1);
- }
kvm_allowed = 1;
break;
case QEMU_OPTION_usb:
@@ -3506,12 +3502,14 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
- if (kvm_enabled()) {
- int ret;
-
- ret = kvm_init(smp_cpus);
+ if (kvm_allowed) {
+ int ret = kvm_init(smp_cpus);
if (ret < 0) {
- fprintf(stderr, "failed to initialize KVM\n");
+ if (!kvm_available()) {
+ printf("KVM not supported for this target\n");
+ } else {
+ fprintf(stderr, "failed to initialize KVM: %s\n", strerror(-ret));
+ }
exit(1);
}
}