Sorry I made some mistakes concerning ROM BAR. Although pci_default_write_config supports ROM BAR write emulation, assigned_dev_pci_write_config does not invoke that function. The little patch below shows where and when the function will be invoked.
Also initial mapping for ROM BAR is not setup in init_assigned_device. However, I do not why they are not there. diff --git a/qemu/hw/device-assignment.c b/qemu/hw/device-assignment.c index 7a66665..129d350 100644 --- a/qemu/hw/device-assignment.c +++ b/qemu/hw/device-assignment.c @@ -237,7 +237,7 @@ static void assigned_dev_pci_write_config(PCIDevice *d, uint /* Continue to program the card */ } - if ((address >= 0x10 && address <= 0x24) || address == 0x34 || + if ((address >= 0x10 && address <= 0x24) || address == 0x30 || address == 0x3c || address == 0x3d) { /* used for update-mappings (BAR emulation) */ pci_default_write_config(d, address, val, len); Best Regards Haitao Shan Avi Kivity wrote: > Shan, Haitao wrote: >> Hi, Avi, >> >> Option ROM already has its own BAR at 0x30h. I think the devices >> assignment code now already handles this register. >> > > Okay good. > >> Can I summary your proposals like the following: In guest BIOS, scan >> all the pci devices (virtual) for existance of Option ROMs. Copy >> them to available BIOS space in 0xC0000 - 0xDFFFF. Execute the ROM >> code at copied location. >> > > Yes. > >> I don't understand why this makes differences compared to scanning >> and copying Option ROMs in QEMU, > > If the ROM BAR is already handled (including registering the memory > when the BAR is programmed -- I don't see that in the code), then > there is no big advantage. It's closer to how real hardware works, > but that's about it. > >> especially given that the VGA BIOS and etherboot ROM are also copied >> to BIOS space in QEMU before they execute in rom_scan loop in guest >> BIOS. >> > > The VGA BIOS is typically present on the motherboard itself, at least > on some configurations. You're right about etherboot. > > I'll apply the patch. Can you take a look at the ROM BAR?-- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html