On Thu, Dec 26, 2024 at 08:04:55AM +0000, Hulang via SeaBIOS wrote:
Currently, pci region on busses[0] may be migrate to 64-bit mmio space. this will cause a mistake to read/write device config space
example: A modern virtio device map to 64-bit mmio space will set mode to VP_ACCESS_PCICFG, But the real device cap is VIRTIO_PCI_CAP_COMMON_CFG, we can not access the cap rightly.
the mmio bars (including virtio config space) of virtio-pci devices can be accessed via pci config space. See VIRTIO_PCI_CAP_PCI_CFG documentation in the virtio spec. So seabios can drive these devices even if they are mapped above 4G.
What is the host device implementation? Probably not qemu?
A simple solution is make device use the 32-bit address space as much as possible.
An easier way to do that is to skip the devices in question in pci_region_migrate_64bit_entries(). There already is one line for usb host adapters which makes sure xhci mmio bars are mapped below 4G. But as explained above this should not be needed for virtio-pci devices.
take care, Gerd