From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjbsM-00035X-Cl for qemu-devel@nongnu.org; Mon, 03 Jun 2013 17:01:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjbsH-0006Em-1x for qemu-devel@nongnu.org; Mon, 03 Jun 2013 17:01:10 -0400 Received: from mail-wi0-x22b.google.com ([2a00:1450:400c:c05::22b]:54921) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjbsG-0006E4-Pl for qemu-devel@nongnu.org; Mon, 03 Jun 2013 17:01:04 -0400 Received: by mail-wi0-f171.google.com with SMTP id hm9so122596wib.10 for ; Mon, 03 Jun 2013 14:01:04 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <51AD0401.2010000@redhat.com> Date: Mon, 03 Jun 2013 23:00:49 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1370272748-10629-1-git-send-email-pbonzini@redhat.com> <1370272748-10629-4-git-send-email-pbonzini@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/3] pc_sysfw: do not make it a device anymore List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jordan Justen Cc: Jordan Justen , qemu-devel , Markus Armbruster Il 03/06/2013 22:46, Jordan Justen ha scritto: > Could you separate out the isapc_ram_fw part? It seems like a viable > separate change, and a better way to handle that situation. I don't think this change is useful enough without the rest. The real cleanup comes from differentiating BIOS vs. flash purely based on the command line. Paolo > -Jordan > > On Mon, Jun 3, 2013 at 8:19 AM, Paolo Bonzini wrote: >> Move the code to hw/i386, the sole remaining property is available >> as !pci_enabled. >> >> Signed-off-by: Paolo Bonzini >> --- >> default-configs/i386-softmmu.mak | 1 - >> default-configs/x86_64-softmmu.mak | 1 - >> hw/block/Makefile.objs | 1 - >> hw/i386/Makefile.objs | 1 + >> hw/i386/pc.c | 5 ++-- >> hw/i386/pc_piix.c | 7 +----- >> hw/i386/pc_q35.c | 2 +- >> hw/{block => i386}/pc_sysfw.c | 51 +++----------------------------------- >> include/hw/i386/pc.h | 6 +++-- >> 9 files changed, 13 insertions(+), 62 deletions(-) >> rename hw/{block => i386}/pc_sysfw.c (82%) >> >> diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak >> index 03deca2..fb84f80 100644 >> --- a/default-configs/i386-softmmu.mak >> +++ b/default-configs/i386-softmmu.mak >> @@ -34,7 +34,6 @@ CONFIG_PAM=y >> CONFIG_PCI_PIIX=y >> CONFIG_PCI_HOTPLUG=y >> CONFIG_WDT_IB700=y >> -CONFIG_PC_SYSFW=y >> CONFIG_XEN_I386=$(CONFIG_XEN) >> CONFIG_ISA_DEBUG=y >> CONFIG_ISA_TESTDEV=y >> diff --git a/default-configs/x86_64-softmmu.mak b/default-configs/x86_64-softmmu.mak >> index 599b630..794d986 100644 >> --- a/default-configs/x86_64-softmmu.mak >> +++ b/default-configs/x86_64-softmmu.mak >> @@ -34,7 +34,6 @@ CONFIG_PAM=y >> CONFIG_PCI_PIIX=y >> CONFIG_PCI_HOTPLUG=y >> CONFIG_WDT_IB700=y >> -CONFIG_PC_SYSFW=y >> CONFIG_XEN_I386=$(CONFIG_XEN) >> CONFIG_ISA_DEBUG=y >> CONFIG_ISA_TESTDEV=y >> diff --git a/hw/block/Makefile.objs b/hw/block/Makefile.objs >> index e4329a0..94491bf 100644 >> --- a/hw/block/Makefile.objs >> +++ b/hw/block/Makefile.objs >> @@ -7,7 +7,6 @@ common-obj-$(CONFIG_PFLASH_CFI02) += pflash_cfi02.o >> common-obj-$(CONFIG_XEN_BACKEND) += xen_disk.o >> common-obj-$(CONFIG_ECC) += ecc.o >> common-obj-$(CONFIG_ONENAND) += onenand.o >> -common-obj-$(CONFIG_PC_SYSFW) += pc_sysfw.o >> >> obj-$(CONFIG_SH4) += tc58128.o >> >> diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs >> index 205d22e..45e6165 100644 >> --- a/hw/i386/Makefile.objs >> +++ b/hw/i386/Makefile.objs >> @@ -1,6 +1,7 @@ >> obj-$(CONFIG_KVM) += kvm/ >> obj-y += multiboot.o smbios.o >> obj-y += pc.o pc_piix.o pc_q35.o >> +obj-y += pc_sysfw.o >> obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o >> >> obj-y += kvmvapic.o >> diff --git a/hw/i386/pc.c b/hw/i386/pc.c >> index 197d218..db5bc26 100644 >> --- a/hw/i386/pc.c >> +++ b/hw/i386/pc.c >> @@ -1019,7 +1019,8 @@ void *pc_memory_init(MemoryRegion *system_memory, >> ram_addr_t below_4g_mem_size, >> ram_addr_t above_4g_mem_size, >> MemoryRegion *rom_memory, >> - MemoryRegion **ram_memory) >> + MemoryRegion **ram_memory, >> + bool isapc_ram_fw) >> { >> int linux_boot, i; >> MemoryRegion *ram, *option_rom_mr; >> @@ -1051,7 +1052,7 @@ void *pc_memory_init(MemoryRegion *system_memory, >> >> >> /* Initialize PC system firmware */ >> - pc_system_firmware_init(rom_memory); >> + pc_system_firmware_init(rom_memory, isapc_ram_fw); >> >> option_rom_mr = g_malloc(sizeof(*option_rom_mr)); >> memory_region_init_ram(option_rom_mr, "pc.rom", PC_ROM_SIZE); >> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c >> index 00a729a..4bf5adf 100644 >> --- a/hw/i386/pc_piix.c >> +++ b/hw/i386/pc_piix.c >> @@ -124,7 +124,7 @@ static void pc_init1(MemoryRegion *system_memory, >> fw_cfg = pc_memory_init(system_memory, >> kernel_filename, kernel_cmdline, initrd_filename, >> below_4g_mem_size, above_4g_mem_size, >> - rom_memory, &ram_memory); >> + rom_memory, &ram_memory, !pci_enabled); >> } >> >> gsi_state = g_malloc0(sizeof(*gsi_state)); >> @@ -704,11 +704,6 @@ static QEMUMachine isapc_machine = { >> .init = pc_init_isa, >> .max_cpus = 1, >> .compat_props = (GlobalProperty[]) { >> - { >> - .driver = "pc-sysfw", >> - .property = "isapc_ram_fw", >> - .value = stringify(1), >> - }, >> { /* end of list */ } >> }, >> DEFAULT_MACHINE_OPTIONS, >> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c >> index 7888dfe..eb7bf30 100644 >> --- a/hw/i386/pc_q35.c >> +++ b/hw/i386/pc_q35.c >> @@ -109,7 +109,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args) >> if (!xen_enabled()) { >> pc_memory_init(get_system_memory(), kernel_filename, kernel_cmdline, >> initrd_filename, below_4g_mem_size, above_4g_mem_size, >> - rom_memory, &ram_memory); >> + rom_memory, &ram_memory, false); >> } >> >> /* irq lines */ >> diff --git a/hw/block/pc_sysfw.c b/hw/i386/pc_sysfw.c >> similarity index 82% >> rename from hw/block/pc_sysfw.c >> rename to hw/i386/pc_sysfw.c >> index 651dda8..b007be0 100644 >> --- a/hw/block/pc_sysfw.c >> +++ b/hw/i386/pc_sysfw.c >> @@ -165,26 +165,15 @@ static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw) >> bios); >> } >> >> -void pc_system_firmware_init(MemoryRegion *rom_memory) >> +void pc_system_firmware_init(MemoryRegion *rom_memory, bool isapc_ram_fw) >> { >> DriveInfo *pflash_drv; >> - PcSysFwDevice *sysfw_dev; >> - >> - /* >> - * TODO This device exists only so that users can switch between >> - * use of flash and ROM for the BIOS. The ability to switch was >> - * created because flash doesn't work with KVM. Once it does, we >> - * should drop this device. >> - */ >> - sysfw_dev = (PcSysFwDevice*) qdev_create(NULL, "pc-sysfw"); >> - >> - qdev_init_nofail(DEVICE(sysfw_dev)); >> >> pflash_drv = drive_get(IF_PFLASH, 0, 0); >> >> - if (sysfw_dev->isapc_ram_fw || pflash_drv == NULL) { >> + if (isapc_ram_fw || pflash_drv == NULL) { >> /* When a pflash drive is not found, use rom-mode */ >> - old_pc_system_rom_init(rom_memory, sysfw_dev->isapc_ram_fw); >> + old_pc_system_rom_init(rom_memory, isapc_ram_fw); >> return; >> } >> >> @@ -197,37 +186,3 @@ void pc_system_firmware_init(MemoryRegion *rom_memory) >> >> pc_system_flash_init(rom_memory, pflash_drv); >> } >> - >> -static Property pcsysfw_properties[] = { >> - DEFINE_PROP_UINT8("isapc_ram_fw", PcSysFwDevice, isapc_ram_fw, 0), >> - DEFINE_PROP_END_OF_LIST(), >> -}; >> - >> -static int pcsysfw_init(DeviceState *dev) >> -{ >> - return 0; >> -} >> - >> -static void pcsysfw_class_init (ObjectClass *klass, void *data) >> -{ >> - DeviceClass *dc = DEVICE_CLASS (klass); >> - >> - dc->desc = "PC System Firmware"; >> - dc->init = pcsysfw_init; >> - dc->props = pcsysfw_properties; >> -} >> - >> -static const TypeInfo pcsysfw_info = { >> - .name = "pc-sysfw", >> - .parent = TYPE_SYS_BUS_DEVICE, >> - .instance_size = sizeof (PcSysFwDevice), >> - .class_init = pcsysfw_class_init, >> -}; >> - >> -static void pcsysfw_register (void) >> -{ >> - type_register_static (&pcsysfw_info); >> -} >> - >> -type_init (pcsysfw_register); >> - >> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h >> index 663426c..983a5b5 100644 >> --- a/include/hw/i386/pc.h >> +++ b/include/hw/i386/pc.h >> @@ -87,7 +87,8 @@ void *pc_memory_init(MemoryRegion *system_memory, >> ram_addr_t below_4g_mem_size, >> ram_addr_t above_4g_mem_size, >> MemoryRegion *rom_memory, >> - MemoryRegion **ram_memory); >> + MemoryRegion **ram_memory, >> + bool isapc_ram_fw); >> qemu_irq *pc_allocate_cpu_irq(void); >> DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); >> void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, >> @@ -168,7 +169,8 @@ static inline bool isa_ne2000_init(ISABus *bus, int base, int irq, NICInfo *nd) >> } >> >> /* pc_sysfw.c */ >> -void pc_system_firmware_init(MemoryRegion *rom_memory); >> +void pc_system_firmware_init(MemoryRegion *rom_memory, >> + bool isapc_ram_fw); >> >> /* pvpanic.c */ >> int pvpanic_init(ISABus *bus); >> -- >> 1.8.1.4 >> >> > >