thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-main-set-current_machine-before-calling-machine-init.patch

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