render / rpms / qemu

Forked from rpms/qemu 10 months ago
Clone
Blob Blame History Raw
From 9f7bc0be9a5c353d076bb42b3bfdf77d8709063f Mon Sep 17 00:00:00 2001
From: Alon Levy <alevy@redhat.com>
Date: Wed, 14 Mar 2012 20:33:37 +0200
Subject: [PATCH 428/434] spice: fix broken initialization

Commit 1b71f7c14fab6f00c2680d4489fbee7baf796e4f moved MODULE_INIT_QOM to
way before MODULE_INIT_MACHINE, thereby breaking assumptions made in
spice-core.c which registered both a type initializer and a machine
intializer.

This fix removes the type registration, and replaces it with calling
qemu_spice_init in vl.c after command line parsing (second pass) is
done, and after timers are armed, required by spice server.

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Conflicts:

	ui/spice-core.c
---
 ui/spice-core.c |    8 +-------
 vl.c            |    5 +++++
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/ui/spice-core.c b/ui/spice-core.c
index 4ad0a67..a468524 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -554,7 +554,7 @@ void qemu_spice_init(void)
 
     qemu_thread_get_self(&me);
 
-   if (!opts) {
+    if (!opts) {
         return;
     }
     port = qemu_opt_get_number(opts, "port", 0);
@@ -787,9 +787,3 @@ static void spice_register_config(void)
     qemu_add_opts(&qemu_spice_opts);
 }
 machine_init(spice_register_config);
-
-static void spice_initialize(void)
-{
-    qemu_spice_init();
-}
-device_init(spice_initialize);
diff --git a/vl.c b/vl.c
index fdefa86..d33eb03 100644
--- a/vl.c
+++ b/vl.c
@@ -3271,6 +3271,11 @@ int main(int argc, char **argv, char **envp)
         exit(1);
     }
 
+#ifdef CONFIG_SPICE
+    /* spice needs the timers to be initialized by this point */
+    qemu_spice_init();
+#endif
+
     if (icount_option && (kvm_enabled() || xen_enabled())) {
         fprintf(stderr, "-icount is not allowed with kvm or xen\n");
         exit(1);
-- 
1.7.10