thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From aec2ed0972eec0b7d251de1ae27de00b2bf29936 Mon Sep 17 00:00:00 2001
9ae3a8
From: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Date: Tue, 27 Jan 2015 17:48:10 +0100
9ae3a8
Subject: [PATCH 07/16] main(): set current_machine before calling
9ae3a8
 machine->init()
9ae3a8
9ae3a8
Message-id: <1422380891-11054-2-git-send-email-lersek@redhat.com>
9ae3a8
Patchwork-id: 63584
9ae3a8
O-Subject: [RHEL-7.2 qemu-kvm PATCH 1/2] main(): set current_machine before calling machine->init()
9ae3a8
Bugzilla: 1176283
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
9ae3a8
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
9ae3a8
9ae3a8
Performing the assignment earlier allows machine->init() and its children
9ae3a8
to access current_machine->name.
9ae3a8
9ae3a8
The alternative would be to pass QEMUMachineInitArgs down to
9ae3a8
pc_memory_init() and even deeper, which I deem to cause more annoyance for
9ae3a8
future backports than this patch.
9ae3a8
9ae3a8
Note that upstream commit 0056ae24bc36798fdd96d0b31e217e9f73896736 moved
9ae3a8
the assignment similarly (but it is not backportable to RHEL-7).
9ae3a8
9ae3a8
This patch could only regress code that depends on the nullity of
9ae3a8
"current_machine". I only found one such site, qemu_system_reset().
9ae3a8
qemu_system_reset() is called from the following places:
9ae3a8
- load_vmstate(), which is not called in the code straddled by the
9ae3a8
  assignment movement,
9ae3a8
- main_loop_should_exit(), ditto,
9ae3a8
- later in main(),
9ae3a8
- "xen-all.c", irrelevant.
9ae3a8
9ae3a8
Downstream only.
9ae3a8
9ae3a8
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 vl.c | 5 +++--
9ae3a8
 1 file changed, 3 insertions(+), 2 deletions(-)
9ae3a8
9ae3a8
diff --git a/vl.c b/vl.c
9ae3a8
index 2b3dc88..35b927e 100644
9ae3a8
--- a/vl.c
9ae3a8
+++ b/vl.c
9ae3a8
@@ -4252,6 +4252,9 @@ int main(int argc, char **argv, char **envp)
9ae3a8
                                  .kernel_cmdline = kernel_cmdline,
9ae3a8
                                  .initrd_filename = initrd_filename,
9ae3a8
                                  .cpu_model = cpu_model };
9ae3a8
+
9ae3a8
+    current_machine = machine;
9ae3a8
+
9ae3a8
     machine->init(&args);
9ae3a8
 
9ae3a8
     audio_init();
9ae3a8
@@ -4260,8 +4263,6 @@ int main(int argc, char **argv, char **envp)
9ae3a8
 
9ae3a8
     set_numa_modes();
9ae3a8
 
9ae3a8
-    current_machine = machine;
9ae3a8
-
9ae3a8
     /* init USB devices */
9ae3a8
     if (usb_enabled(false)) {
9ae3a8
         if (foreach_device_config(DEV_USB, usb_parse) < 0)
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8