qemu-kvm: Fix boot CPU setup for the case it is unsupported
PATCH 1/1 qemu-kvm: Fix boot CPU setup for the case it is unsupported
Commit 52b03dd702 incorrectly failed KVM initialization in case the kernel did not support KVM_CAP_SET_BOOT_CPU_ID. Fix this, and also improve error propagation of kvm_create_context at this chance.
Signed-off-by Jan Kiszka <[email protected]>
---
OK, it really was me. :)
qemu-kvm-x86.c | 9 +++++++-- qemu-kvm.c | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-)
qemu-kvm-x86.c +7 -2
@@ -672,7 +672,7 @@ static const VMStateDescription vmstate_kvmclock= {int kvm_arch_qemu_create_context (void ) { -int i; +int i, r;struct utsname utsname;uname (&utsname);
@@ -696,7 +696,12 @@ int kvm_arch_qemu_create_context(void)vmstate_register (0 , &vmstate_kvmclock, &kvmclock_data);#endif -return kvm_set_boot_cpu_id (0 ); + r =kvm_set_boot_cpu_id (0 ); +if (r <0 && r != -ENOSYS ) { +return r; + } + +return 0 ; } static void set_msr_entry(struct kvm_msr_entry *entry, uint32_t index,
qemu-kvm.c +3 -1
@@ -2091,8 +2091,10 @@ static int kvm_create_context(void)return -1 ; } r =kvm_arch_qemu_create_context (); -if (r <0 ) +if (r <0 ) {kvm_finalize (kvm_state); +return -1 ; + }if (kvm_pit && !kvm_pit_reinject) {if (kvm_reinject_control (kvm_context,0 )) {fprintf (stderr,"failure to disable in-kernel PIT reinjection\n" );
Quoted 47 lines · Jan Kiszka
Commit
52b03dd702incorrectly failed KVM initialization in case the kernel did not supportKVM_CAP_SET_BOOT_CPU_ID. Fix this, and also improve error propagation ofkvm_create_contextat this chance.Signed-off-by Jan Kiszka <[email protected]>---
OK, it really was me. :)
qemu-kvm-x86.c | 9 +++++++-- qemu-kvm.c | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-)qemu-kvm-x86.c +7
-2@@ -672,7 +672,7 @@ static const VMStateDescription vmstate_kvmclock= {int kvm_arch_qemu_create_context (void ) { -int i; +int i, r;struct utsname utsname;uname (&utsname);@@ -696,7 +696,12 @@ int kvm_arch_qemu_create_context(void)vmstate_register (0 , &vmstate_kvmclock, &kvmclock_data);#endif -return kvm_set_boot_cpu_id (0 ); + r =kvm_set_boot_cpu_id (0 ); +if (r <0 && r != -ENOSYS ) { +return r; + } + +return 0 ; } static void set_msr_entry(struct kvm_msr_entry *entry, uint32_t index,qemu-kvm.c +0
-0@@ -2091,8 +2091,10 @@ static int kvm_create_context(void)return -1 ;
qemu-kvm.c static int kvm_create_context(void) · line 2100
Quoted 10 lines
qemu-kvm.c +3
-1} r =kvm_arch_qemu_create_context (); -if (r <0 ) +if (r <0 ) {kvm_finalize (kvm_state); +return -1 ; + }if (kvm_pit && !kvm_pit_reinject) {if (kvm_reinject_control (kvm_context,0 )) {fprintf (stderr,"failure to disable in-kernel PIT reinjection\n" );
Works for me: FC12 host, FC12 guest.
David