From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59476) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJk2h-00085I-FI for qemu-devel@nongnu.org; Thu, 04 Oct 2012 07:56:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJk2e-0001aD-QJ for qemu-devel@nongnu.org; Thu, 04 Oct 2012 07:56:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42220) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJk2e-0001a3-Hm for qemu-devel@nongnu.org; Thu, 04 Oct 2012 07:56:36 -0400 Date: Thu, 4 Oct 2012 13:56:33 +0200 From: Igor Mammedov Message-ID: <20121004135633.10d57d0f@nial.usersys.redhat.com> In-Reply-To: <1349270954-4657-4-git-send-email-ehabkost@redhat.com> References: <1349270954-4657-1-git-send-email-ehabkost@redhat.com> <1349270954-4657-4-git-send-email-ehabkost@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC 03/18] pc: add PC object argument to some init functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: Paolo Bonzini , qemu-devel@nongnu.org, Gleb Natapov , Andreas =?ISO-8859-1?B?RuRyYmVy?= On Wed, 3 Oct 2012 10:28:59 -0300 Eduardo Habkost wrote: > Add an extra argument to: > - pc_memory_init() > - bochs_bios_init() > - pc_cpus_init() > - pc_new_cpu() > > Signed-off-by: Eduardo Habkost > --- > hw/pc.c | 13 +++++++------ > hw/pc.h | 5 +++-- > hw/pc_piix.c | 4 ++-- > 3 files changed, 12 insertions(+), 10 deletions(-) > > diff --git a/hw/pc.c b/hw/pc.c > index 9b68282..3cf56de 100644 > --- a/hw/pc.c > +++ b/hw/pc.c > @@ -585,7 +585,7 @@ int e820_add_entry(uint64_t address, uint64_t length, > uint32_t type) return index; > } > > -static void *bochs_bios_init(void) > +static void *bochs_bios_init(PC *pc) > { > void *fw_cfg; > uint8_t *smbios_table; > @@ -903,7 +903,7 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int > level) } > } > > -static X86CPU *pc_new_cpu(const char *cpu_model) > +static X86CPU *pc_new_cpu(PC *pc, const char *cpu_model) this function probably will go away. https://github.com/imammedo/qemu/commit/ebdd53b8519d1071131855f5408a96f96c7df75a I'll post latest version of that patch today. > { > X86CPU *cpu; > CPUX86State *env; > @@ -921,7 +921,7 @@ static X86CPU *pc_new_cpu(const char *cpu_model) > return cpu; > }> > -void pc_cpus_init(const char *cpu_model) > +void pc_cpus_init(PC *pc, const char *cpu_model) > { > int i; > > @@ -935,11 +935,12 @@ void pc_cpus_init(const char *cpu_model) > } > > for(i = 0; i < smp_cpus; i++) { > - pc_new_cpu(cpu_model); > + pc_new_cpu(pc, cpu_model); > } > } > > -void *pc_memory_init(MemoryRegion *system_memory, > +void *pc_memory_init(PC *pc, > + MemoryRegion *system_memory, > const char *kernel_filename, > const char *kernel_cmdline, > const char *initrd_filename, > @@ -988,7 +989,7 @@ void *pc_memory_init(MemoryRegion *system_memory, > option_rom_mr, > 1); > > - fw_cfg = bochs_bios_init(); > + fw_cfg = bochs_bios_init(pc); > rom_set_fw(fw_cfg); > > if (linux_boot) { > diff --git a/hw/pc.h b/hw/pc.h > index 77e898f..f1ca54e 100644 > --- a/hw/pc.h > +++ b/hw/pc.h > @@ -111,8 +111,9 @@ typedef struct PC PC; > 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_memory_init(MemoryRegion *system_memory, > +void pc_cpus_init(PC *pc, const char *cpu_model); > +void *pc_memory_init(PC *pc, > + MemoryRegion *system_memory, > const char *kernel_filename, > const char *kernel_cmdline, > const char *initrd_filename, > diff --git a/hw/pc_piix.c b/hw/pc_piix.c > index 28b5f8a..f861907 100644 > --- a/hw/pc_piix.c > +++ b/hw/pc_piix.c > @@ -150,7 +150,7 @@ static void pc_init1(MemoryRegion *system_memory, > void *fw_cfg = NULL; > PC *pc = PC(object_new(TYPE_PC_MACHINE)); > > - pc_cpus_init(cpu_model); > + pc_cpus_init(pc, cpu_model); > > if (kvmclock_enabled) { > kvmclock_create(); > @@ -175,7 +175,7 @@ static void pc_init1(MemoryRegion *system_memory, > > /* allocate ram and load rom/bios */ > if (!xen_enabled()) { > - fw_cfg = pc_memory_init(system_memory, > + fw_cfg = pc_memory_init(pc, system_memory, > kernel_filename, kernel_cmdline, initrd_filename, > below_4g_mem_size, above_4g_mem_size, > pci_enabled ? rom_memory : system_memory, > &ram_memory);