Patchwork [12/27] pc: add PCInitArgs parameter to pc_cpus_init()

login
register
mail settings
Submitter Eduardo Habkost
Date Oct. 24, 2012, 5:49 p.m.
Message ID <1351101001-14589-13-git-send-email-ehabkost@redhat.com>
Download mbox | patch
Permalink /patch/193918/
State New
Headers show

Comments

Eduardo Habkost - Oct. 24, 2012, 5:49 p.m.
This will make the code simpler when the CPU initialization code start using
additional initialization parameters.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/pc.c      | 8 ++++----
 hw/pc.h      | 2 +-
 hw/pc_piix.c | 3 +--
 3 files changed, 6 insertions(+), 7 deletions(-)

Patch

diff --git a/hw/pc.c b/hw/pc.c
index 67fdbe2..f92c19f 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -859,17 +859,17 @@  void pc_acpi_smi_interrupt(void *opaque, int irq, int level)
     }
 }
 
-void pc_cpus_init(const char *cpu_model)
+void pc_cpus_init(PCInitArgs *args)
 {
     int i;
 
     /* init CPUs */
-    if (cpu_model == NULL) {
-        cpu_model = PC_DEFAULT_CPU_MODEL;
+    if (args->qemu_args->cpu_model == NULL) {
+        args->qemu_args->cpu_model = PC_DEFAULT_CPU_MODEL;
     }
 
     for (i = 0; i < smp_cpus; i++) {
-        if (!cpu_x86_init(cpu_model)) {
+        if (!cpu_x86_init(args->qemu_args->cpu_model)) {
             fprintf(stderr, "Unable to find x86 CPU definition\n");
             exit(1);
         }
diff --git a/hw/pc.h b/hw/pc.h
index 04051ca..26388ba 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -86,7 +86,7 @@  typedef struct PCInitArgs {
 void pc_register_ferr_irq(qemu_irq irq);
 void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
 
-void pc_cpus_init(const char *cpu_model);
+void pc_cpus_init(PCInitArgs *args);
 void *pc_memory_init(MemoryRegion *system_memory,
                     const char *kernel_filename,
                     const char *kernel_cmdline,
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index 058fd43..57d0c3b 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -143,14 +143,13 @@  static void pc_init1(PCInitArgs *pc_args)
     void *fw_cfg = NULL;
     QEMUMachineInitArgs *qemu_args = pc_args->qemu_args;
     ram_addr_t ram_size = qemu_args->ram_size;
-    const char *cpu_model = qemu_args->cpu_model;
     const char *kernel_filename = qemu_args->kernel_filename;
     const char *kernel_cmdline = qemu_args->kernel_cmdline;
     const char *initrd_filename = qemu_args->initrd_filename;
     const char *boot_device = qemu_args->boot_device;
     bool pci_enabled = pc_args->pci_enabled;
 
-    pc_cpus_init(cpu_model);
+    pc_cpus_init(pc_args);
 
     if (pc_args->kvmclock_enabled) {
         kvmclock_create();