From: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> This reorders kvm_create_irqchip and the content of kvm_arch_qemu_create_context, but this should not cause any problems. Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> --- qemu-kvm-x86.c | 48 ++++++++++++++++++++---------------------------- qemu-kvm.c | 7 +------ qemu-kvm.h | 5 +---- 3 files changed, 22 insertions(+), 38 deletions(-) diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c index a88f8be..6b816bc 100644 --- a/qemu-kvm-x86.c +++ b/qemu-kvm-x86.c @@ -116,9 +116,9 @@ static int kvm_create_pit(kvm_context_t kvm) return 0; } -int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes, - void **vm_mem) +int kvm_arch_create(kvm_context_t kvm) { + struct utsname utsname; int r = 0; r = kvm_init_tss(kvm); @@ -149,6 +149,24 @@ int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes, return r; } + uname(&utsname); + lm_capable_kernel = strcmp(utsname.machine, "x86_64") == 0; + + if (kvm_shadow_memory) { + kvm_set_shadow_pages(kvm_context, kvm_shadow_memory); + } + + /* initialize has_msr_star/has_msr_hsave_pa */ + r = kvm_get_supported_msrs(kvm_state); + if (r < 0) { + return r; + } + + r = kvm_set_boot_cpu_id(0); + if (r < 0 && r != -ENOSYS) { + return r; + } + return 0; } @@ -426,32 +444,6 @@ static int kvm_enable_tpr_access_reporting(CPUState *env) } #endif -int kvm_arch_qemu_create_context(void) -{ - int r; - struct utsname utsname; - - uname(&utsname); - lm_capable_kernel = strcmp(utsname.machine, "x86_64") == 0; - - if (kvm_shadow_memory) { - kvm_set_shadow_pages(kvm_context, kvm_shadow_memory); - } - - /* initialize has_msr_star/has_msr_hsave_pa */ - r = kvm_get_supported_msrs(kvm_state); - if (r < 0) { - return r; - } - - r = kvm_set_boot_cpu_id(0); - if (r < 0 && r != -ENOSYS) { - return r; - } - - return 0; -} - static int _kvm_arch_init_vcpu(CPUState *env) { kvm_arch_reset_vcpu(env); diff --git a/qemu-kvm.c b/qemu-kvm.c index 359bec7..ecee3dc 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -1397,7 +1397,7 @@ static int kvm_create_context(void) return -1; } - r = kvm_arch_create(kvm_context, 0, NULL); + r = kvm_arch_create(kvm_context); if (r < 0) { kvm_finalize(kvm_state); return r; @@ -1405,11 +1405,6 @@ static int kvm_create_context(void) kvm_create_irqchip(kvm_context); - r = kvm_arch_qemu_create_context(); - 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"); diff --git a/qemu-kvm.h b/qemu-kvm.h index a4f1816..0814883 100644 --- a/qemu-kvm.h +++ b/qemu-kvm.h @@ -64,8 +64,7 @@ typedef struct kvm_context *kvm_context_t; #include "kvm.h" -int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes, - void **vm_mem); +int kvm_arch_create(kvm_context_t kvm); int kvm_arch_run(CPUState *env); @@ -449,8 +448,6 @@ void on_vcpu(CPUState *env, void (*func)(void *data), void *data); void kvm_inject_interrupt(CPUState *env, int mask); void kvm_update_interrupt_request(CPUState *env); -int kvm_arch_qemu_create_context(void); - int kvm_arch_has_work(CPUState *env); void kvm_arch_process_irqchip_events(CPUState *env); int kvm_arch_try_push_interrupts(void *opaque); -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html