diff mbox

[v3.1,10/31] pc: pass QEMUMachineInitArgs to pc_memory_init

Message ID 95dc708bc4fccd5d0d38e4d82edd65fcbcef4b72.1399365798.git.hutao@cn.fujitsu.com
State New
Headers show

Commit Message

Hu Tao May 6, 2014, 9:27 a.m. UTC
From: Paolo Bonzini <pbonzini@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
---
 hw/i386/pc.c         | 11 +++++------
 hw/i386/pc_piix.c    |  8 +++-----
 hw/i386/pc_q35.c     |  4 +---
 include/hw/i386/pc.h |  7 +++----
 4 files changed, 12 insertions(+), 18 deletions(-)

Comments

Michael S. Tsirkin May 7, 2014, 2:50 p.m. UTC | #1
On Tue, May 06, 2014 at 05:27:31PM +0800, Hu Tao wrote:
> From: Paolo Bonzini <pbonzini@redhat.com>
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  hw/i386/pc.c         | 11 +++++------
>  hw/i386/pc_piix.c    |  8 +++-----
>  hw/i386/pc_q35.c     |  4 +---
>  include/hw/i386/pc.h |  7 +++----
>  4 files changed, 12 insertions(+), 18 deletions(-)
> 
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 249e504..d5fb884 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1161,10 +1161,8 @@ void pc_acpi_init(const char *default_dsdt)
>      }
>  }
>  
> -FWCfgState *pc_memory_init(MemoryRegion *system_memory,
> -                           const char *kernel_filename,
> -                           const char *kernel_cmdline,
> -                           const char *initrd_filename,
> +FWCfgState *pc_memory_init(QEMUMachineInitArgs *args,
> +                           MemoryRegion *system_memory,
>                             ram_addr_t below_4g_mem_size,
>                             ram_addr_t above_4g_mem_size,
>                             MemoryRegion *rom_memory,
> @@ -1176,7 +1174,7 @@ FWCfgState *pc_memory_init(MemoryRegion *system_memory,
>      MemoryRegion *ram_below_4g, *ram_above_4g;
>      FWCfgState *fw_cfg;
>  
> -    linux_boot = (kernel_filename != NULL);
> +    linux_boot = (args->kernel_filename != NULL);
>  
>      /* Allocate RAM.  We allocate it as a single memory region and use
>       * aliases to address portions of it, mostly for backwards compatibility
> @@ -1217,7 +1215,8 @@ FWCfgState *pc_memory_init(MemoryRegion *system_memory,
>      rom_set_fw(fw_cfg);
>  
>      if (linux_boot) {
> -        load_linux(fw_cfg, kernel_filename, initrd_filename, kernel_cmdline, below_4g_mem_size);
> +        load_linux(fw_cfg, args->kernel_filename, args->initrd_filename,
> +                   args->kernel_cmdline, below_4g_mem_size);
>      }
>  
>      for (i = 0; i < nb_option_roms; i++) {
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 7930a26..3bd8821 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -151,11 +151,9 @@ static void pc_init1(QEMUMachineInitArgs *args,
>  
>      /* allocate ram and load rom/bios */
>      if (!xen_enabled()) {
> -        fw_cfg = pc_memory_init(system_memory,
> -                       args->kernel_filename, args->kernel_cmdline,
> -                       args->initrd_filename,
> -                       below_4g_mem_size, above_4g_mem_size,
> -                       rom_memory, &ram_memory, guest_info);
> +        fw_cfg = pc_memory_init(args, system_memory,
> +                                below_4g_mem_size, above_4g_mem_size,
> +                                rom_memory, &ram_memory, guest_info);
>      }
>  
>      gsi_state = g_malloc0(sizeof(*gsi_state));
> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> index c844dc2..01794fc 100644
> --- a/hw/i386/pc_q35.c
> +++ b/hw/i386/pc_q35.c
> @@ -138,9 +138,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
>  
>      /* allocate ram and load rom/bios */
>      if (!xen_enabled()) {
> -        pc_memory_init(get_system_memory(),
> -                       args->kernel_filename, args->kernel_cmdline,
> -                       args->initrd_filename,
> +        pc_memory_init(args, get_system_memory(),
>                         below_4g_mem_size, above_4g_mem_size,
>                         rom_memory, &ram_memory, guest_info);
>      }
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 9010246..8fc0527 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -3,6 +3,7 @@
>  
>  #include "qemu-common.h"
>  #include "exec/memory.h"
> +#include "hw/boards.h"
>  #include "hw/isa/isa.h"
>  #include "hw/block/fdc.h"
>  #include "net/net.h"
> @@ -134,10 +135,8 @@ PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size,
>  void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory,
>                              MemoryRegion *pci_address_space);
>  
> -FWCfgState *pc_memory_init(MemoryRegion *system_memory,
> -                           const char *kernel_filename,
> -                           const char *kernel_cmdline,
> -                           const char *initrd_filename,
> +FWCfgState *pc_memory_init(QEMUMachineInitArgs *args,
> +                           MemoryRegion *system_memory,
>                             ram_addr_t below_4g_mem_size,
>                             ram_addr_t above_4g_mem_size,
>                             MemoryRegion *rom_memory,
> -- 
> 1.8.5.2.229.g4448466
>
diff mbox

Patch

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 249e504..d5fb884 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1161,10 +1161,8 @@  void pc_acpi_init(const char *default_dsdt)
     }
 }
 
-FWCfgState *pc_memory_init(MemoryRegion *system_memory,
-                           const char *kernel_filename,
-                           const char *kernel_cmdline,
-                           const char *initrd_filename,
+FWCfgState *pc_memory_init(QEMUMachineInitArgs *args,
+                           MemoryRegion *system_memory,
                            ram_addr_t below_4g_mem_size,
                            ram_addr_t above_4g_mem_size,
                            MemoryRegion *rom_memory,
@@ -1176,7 +1174,7 @@  FWCfgState *pc_memory_init(MemoryRegion *system_memory,
     MemoryRegion *ram_below_4g, *ram_above_4g;
     FWCfgState *fw_cfg;
 
-    linux_boot = (kernel_filename != NULL);
+    linux_boot = (args->kernel_filename != NULL);
 
     /* Allocate RAM.  We allocate it as a single memory region and use
      * aliases to address portions of it, mostly for backwards compatibility
@@ -1217,7 +1215,8 @@  FWCfgState *pc_memory_init(MemoryRegion *system_memory,
     rom_set_fw(fw_cfg);
 
     if (linux_boot) {
-        load_linux(fw_cfg, kernel_filename, initrd_filename, kernel_cmdline, below_4g_mem_size);
+        load_linux(fw_cfg, args->kernel_filename, args->initrd_filename,
+                   args->kernel_cmdline, below_4g_mem_size);
     }
 
     for (i = 0; i < nb_option_roms; i++) {
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 7930a26..3bd8821 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -151,11 +151,9 @@  static void pc_init1(QEMUMachineInitArgs *args,
 
     /* allocate ram and load rom/bios */
     if (!xen_enabled()) {
-        fw_cfg = pc_memory_init(system_memory,
-                       args->kernel_filename, args->kernel_cmdline,
-                       args->initrd_filename,
-                       below_4g_mem_size, above_4g_mem_size,
-                       rom_memory, &ram_memory, guest_info);
+        fw_cfg = pc_memory_init(args, system_memory,
+                                below_4g_mem_size, above_4g_mem_size,
+                                rom_memory, &ram_memory, guest_info);
     }
 
     gsi_state = g_malloc0(sizeof(*gsi_state));
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index c844dc2..01794fc 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -138,9 +138,7 @@  static void pc_q35_init(QEMUMachineInitArgs *args)
 
     /* allocate ram and load rom/bios */
     if (!xen_enabled()) {
-        pc_memory_init(get_system_memory(),
-                       args->kernel_filename, args->kernel_cmdline,
-                       args->initrd_filename,
+        pc_memory_init(args, get_system_memory(),
                        below_4g_mem_size, above_4g_mem_size,
                        rom_memory, &ram_memory, guest_info);
     }
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 9010246..8fc0527 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -3,6 +3,7 @@ 
 
 #include "qemu-common.h"
 #include "exec/memory.h"
+#include "hw/boards.h"
 #include "hw/isa/isa.h"
 #include "hw/block/fdc.h"
 #include "net/net.h"
@@ -134,10 +135,8 @@  PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size,
 void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory,
                             MemoryRegion *pci_address_space);
 
-FWCfgState *pc_memory_init(MemoryRegion *system_memory,
-                           const char *kernel_filename,
-                           const char *kernel_cmdline,
-                           const char *initrd_filename,
+FWCfgState *pc_memory_init(QEMUMachineInitArgs *args,
+                           MemoryRegion *system_memory,
                            ram_addr_t below_4g_mem_size,
                            ram_addr_t above_4g_mem_size,
                            MemoryRegion *rom_memory,