218e99
From 5c9aa8edab3724f6a361c98247949d5588f18620 Mon Sep 17 00:00:00 2001
218e99
From: Markus Armbruster <armbru@redhat.com>
218e99
Date: Sat, 2 Nov 2013 10:01:19 +0100
218e99
Subject: [PATCH 19/29] pc: Don't explode QEMUMachineInitArgs into local variables needlessly
218e99
218e99
RH-Author: Markus Armbruster <armbru@redhat.com>
218e99
Message-id: <1383386488-29789-3-git-send-email-armbru@redhat.com>
218e99
Patchwork-id: 55238
218e99
O-Subject: [PATCH 7.0 qemu-kvm 02/11] pc: Don't explode QEMUMachineInitArgs into local variables needlessly
218e99
Bugzilla: 994490
218e99
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
218e99
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
218e99
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
218e99
From: Markus Armbruster <armbru@redhat.com>
218e99
218e99
Don't explode when the variable is used just a few times, and never
218e99
changed.
218e99
218e99
Signed-off-by: Markus Armbruster <armbru@redhat.com>
218e99
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
218e99
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
218e99
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
218e99
(cherry picked from commit 3b6fb9cab2e64804cdab5a61d1298ffd8b8dff85)
218e99
218e99
Conflicts:
218e99
	hw/i386/pc_q35.c
218e99
---
218e99
 hw/i386/pc_q35.c | 22 +++++++++-------------
218e99
 1 file changed, 9 insertions(+), 13 deletions(-)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 hw/i386/pc_q35.c |   22 +++++++++-------------
218e99
 1 files changed, 9 insertions(+), 13 deletions(-)
218e99
218e99
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
218e99
index 1c4c8a4..99d3a10 100644
218e99
--- a/hw/i386/pc_q35.c
218e99
+++ b/hw/i386/pc_q35.c
218e99
@@ -51,12 +51,6 @@ static bool has_pvpanic = true;
218e99
 /* PC hardware initialisation */
218e99
 static void pc_q35_init(QEMUMachineInitArgs *args)
218e99
 {
218e99
-    ram_addr_t ram_size = args->ram_size;
218e99
-    const char *cpu_model = args->cpu_model;
218e99
-    const char *kernel_filename = args->kernel_filename;
218e99
-    const char *kernel_cmdline = args->kernel_cmdline;
218e99
-    const char *initrd_filename = args->initrd_filename;
218e99
-    const char *boot_device = args->boot_device;
218e99
     ram_addr_t below_4g_mem_size, above_4g_mem_size;
218e99
     Q35PCIHost *q35_host;
218e99
     PCIBus *host_bus;
218e99
@@ -82,17 +76,17 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
218e99
     object_property_add_child(qdev_get_machine(), "icc-bridge",
218e99
                               OBJECT(icc_bridge), NULL);
218e99
 
218e99
-    pc_cpus_init(cpu_model, icc_bridge);
218e99
+    pc_cpus_init(args->cpu_model, icc_bridge);
218e99
     pc_acpi_init("q35-acpi-dsdt.aml");
218e99
 
218e99
     kvmclock_create();
218e99
 
218e99
-    if (ram_size >= 0xb0000000) {
218e99
-        above_4g_mem_size = ram_size - 0xb0000000;
218e99
+    if (args->ram_size >= 0xb0000000) {
218e99
+        above_4g_mem_size = args->ram_size - 0xb0000000;
218e99
         below_4g_mem_size = 0xb0000000;
218e99
     } else {
218e99
         above_4g_mem_size = 0;
218e99
-        below_4g_mem_size = ram_size;
218e99
+        below_4g_mem_size = args->ram_size;
218e99
     }
218e99
 
218e99
     /* pci enabled */
218e99
@@ -107,8 +101,10 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
218e99
 
218e99
     /* allocate ram and load rom/bios */
218e99
     if (!xen_enabled()) {
218e99
-        pc_memory_init(get_system_memory(), kernel_filename, kernel_cmdline,
218e99
-                       initrd_filename, below_4g_mem_size, above_4g_mem_size,
218e99
+        pc_memory_init(get_system_memory(),
218e99
+                       args->kernel_filename, args->kernel_cmdline,
218e99
+                       args->initrd_filename,
218e99
+                       below_4g_mem_size, above_4g_mem_size,
218e99
                        rom_memory, &ram_memory);
218e99
     }
218e99
 
218e99
@@ -193,7 +189,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
218e99
                                     0xb100),
218e99
                       8, NULL, 0);
218e99
 
218e99
-    pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
218e99
+    pc_cmos_init(below_4g_mem_size, above_4g_mem_size, args->boot_device,
218e99
                  floppy, idebus[0], idebus[1], rtc_state);
218e99
 
218e99
     /* the rest devices to which pci devfn is automatically assigned */
218e99
-- 
218e99
1.7.1
218e99