Message ID | 1442566729-5133-6-git-send-email-markmb@redhat.com |
---|---|
State | New |
Headers | show |
Hi, > - fw_cfg = fw_cfg_init_io(BIOS_CFG_IOPORT); > + fw_cfg = fw_cfg_init_io_dma(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 4, as); > + as = g_malloc(sizeof(*as)); > + address_space_init(as, ram_below_4g, "pc.as"); > + fw_cfg = bochs_bios_init(as); I think we can use address_space_memory on x86 too (and can remove the AddressSpace argument to fw_cfg_init_io_dma). Otherwise the series looks fine to me (and thanks for picking it up). cheers, Gerd
On 18 September 2015 at 11:58, Gerd Hoffmann <kraxel@redhat.com> wrote: > Hi, > >> - fw_cfg = fw_cfg_init_io(BIOS_CFG_IOPORT); >> + fw_cfg = fw_cfg_init_io_dma(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 4, as); > >> + as = g_malloc(sizeof(*as)); >> + address_space_init(as, ram_below_4g, "pc.as"); >> + fw_cfg = bochs_bios_init(as); > > I think we can use address_space_memory on x86 too (and can remove the > AddressSpace argument to fw_cfg_init_io_dma). I would prefer to keep the AS argument to fw_cfg_init_io_dma(). Random devices shouldn't have their own ideas about what buses they're plugged into to do DMA (which is effectively what this is doing) -- the board should be responsible for wiring them up appropriately. thanks -- PMM
diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 56aecce..6e02061 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -753,14 +753,15 @@ static void pc_build_smbios(FWCfgState *fw_cfg) } } -static FWCfgState *bochs_bios_init(void) +static FWCfgState *bochs_bios_init(AddressSpace *as) { FWCfgState *fw_cfg; uint64_t *numa_fw_cfg; int i, j; unsigned int apic_id_limit = pc_apic_id_limit(max_cpus); - fw_cfg = fw_cfg_init_io(BIOS_CFG_IOPORT); + fw_cfg = fw_cfg_init_io_dma(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 4, as); + /* FW_CFG_MAX_CPUS is a bit confusing/problematic on x86: * * SeaBIOS needs FW_CFG_MAX_CPUS for CPU hotplug, but the CPU hotplug @@ -1316,6 +1317,7 @@ FWCfgState *pc_memory_init(PCMachineState *pcms, MemoryRegion *ram_below_4g, *ram_above_4g; FWCfgState *fw_cfg; MachineState *machine = MACHINE(pcms); + AddressSpace *as; assert(machine->ram_size == pcms->below_4g_mem_size + pcms->above_4g_mem_size); @@ -1407,7 +1409,10 @@ FWCfgState *pc_memory_init(PCMachineState *pcms, option_rom_mr, 1); - fw_cfg = bochs_bios_init(); + as = g_malloc(sizeof(*as)); + address_space_init(as, ram_below_4g, "pc.as"); + fw_cfg = bochs_bios_init(as); + rom_set_fw(fw_cfg); if (guest_info->has_reserved_memory && pcms->hotplug_memory.base) {
Enable the fw_cfg DMA interface for all the x86 platforms. Based on Gerd Hoffman's initial implementation. Signed-off-by: Marc MarĂ <markmb@redhat.com> --- hw/i386/pc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)