[PATCH 12/16] qemu-kvm: Fold kvm_set_boot_vcpu_id into kvm_set_boot_cpu_id

Jan Kiszka
2011-05-13T12:14:15Z

qemu-kvm.c | 23 ++++++++---------------
qemu-kvm.h | 2 +-
target-i386/kvm.c | 2 +-
3 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/qemu-kvm.c b/qemu-kvm.c
index 9406fcf..b1405fd 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -197,19 +197,6 @@ static void kvm_finalize(KVMState *s)
free(s);
}

-static int kvm_set_boot_vcpu_id(kvm_context_t kvm, uint32_t id)
-{
-#ifdef KVM_CAP_SET_BOOT_CPU_ID
- int r = kvm_ioctl(kvm_state, KVM_CHECK_EXTENSION, KVM_CAP_SET_BOOT_CPU_ID);
- if (r > 0) {
- return kvm_vm_ioctl(kvm_state, KVM_SET_BOOT_CPU_ID, id);
- }
- return -ENOSYS;
-#else
- return -ENOSYS;
-#endif
-}
-
static int kvm_init_irq_routing(KVMState *s)
{
#ifdef KVM_CAP_IRQ_ROUTING
@@ -1497,8 +1484,14 @@ void kvm_ioperm(CPUState *env, void *data)

#endif

-int kvm_set_boot_cpu_id(uint32_t id)
+int kvm_set_boot_cpu_id(KVMState *s, uint32_t id)
{
- return kvm_set_boot_vcpu_id(&kvm_state->kvm_context, id);
+#ifdef KVM_CAP_SET_BOOT_CPU_ID
+ int r = kvm_ioctl(s, KVM_CHECK_EXTENSION, KVM_CAP_SET_BOOT_CPU_ID);
+ if (r > 0) {
+ return kvm_vm_ioctl(s, KVM_SET_BOOT_CPU_ID, id);
+ }
+#endif
+ return -ENOSYS;
}

diff --git a/qemu-kvm.h b/qemu-kvm.h
index 2c67a28..a55ef46 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -358,7 +358,7 @@ int kvm_arch_has_work(CPUState *env);
void kvm_arch_process_irqchip_events(CPUState *env);
int kvm_arch_try_push_interrupts(void *opaque);
void kvm_arch_push_nmi(void);
-int kvm_set_boot_cpu_id(uint32_t id);
+int kvm_set_boot_cpu_id(KVMState *s, uint32_t id);

void kvm_tpr_access_report(CPUState *env, uint64_t rip, int is_write);

diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 33239bf..9b8c460 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -665,7 +665,7 @@ int kvm_arch_init(KVMState *s)
}
}

- ret = kvm_set_boot_cpu_id(0);
+ ret = kvm_set_boot_cpu_id(s, 0);
if (ret < 0 && ret != -ENOSYS) {
return ret;
}
--
1.7.1