[patch 2/7] kvm-tpr-opt: use device_init

Marcelo Tosatti
2010-03-09T00:49:33Z

[-- Attachment #1: kvm-tpr-device-init --]
[-- Type: text/plain, Size: 1377 bytes --]

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Index: qemu-kvm-tpr/kvm-tpr-opt.c
===================================================================
--- qemu-kvm-tpr.orig/kvm-tpr-opt.c
+++ qemu-kvm-tpr/kvm-tpr-opt.c
@@ -401,10 +401,12 @@ static void vtpr_ioport_write(void *opaq
kvm_tpr_enable_vapic(env);
}

-void kvm_tpr_opt_setup(void)
+static void kvm_tpr_opt_setup(void)
{
register_savevm("kvm-tpr-opt", 0, 1, tpr_save, tpr_load, NULL);
register_ioport_write(0x7e, 1, 1, vtpr_ioport_write, NULL);
register_ioport_write(0x7e, 2, 2, vtpr_ioport_write16, NULL);
}

+device_init(kvm_tpr_opt_setup);
+
Index: qemu-kvm-tpr/qemu-kvm-x86.c
===================================================================
--- qemu-kvm-tpr.orig/qemu-kvm-x86.c
+++ qemu-kvm-tpr/qemu-kvm-x86.c
@@ -157,10 +157,6 @@ int kvm_arch_create(kvm_context_t kvm, u
if (r < 0)
return r;

-#ifdef KVM_EXIT_TPR_ACCESS
- kvm_tpr_opt_setup();
-#endif
-
return 0;
}

Index: qemu-kvm-tpr/qemu-kvm.h
===================================================================
--- qemu-kvm-tpr.orig/qemu-kvm.h
+++ qemu-kvm-tpr/qemu-kvm.h
@@ -894,7 +894,6 @@ void qemu_kvm_aio_wait_end(void);

void qemu_kvm_notify_work(void);

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