From: "Denis V. Lunev" <[email protected]> pci_update_mappings() deletes and re-adds a subregion for each BAR whose address changed, and both of those commit their own transaction, so one BAR move costs two full flatview rebuilds.
Nothing between the delete and the add touches an address space, so the walk can run inside a single transaction. pci_bridge_update_mappings() already does this for the bridge windows. CC: Michael S. Tsirkin <[email protected]> Signed-off-by: Denis V. Lunev <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Message-ID: <[email protected]> --- hw/pci/pci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index c15f2b9f08..14c78e3c62 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1742,6 +1742,8 @@ static void pci_update_mappings(PCIDevice *d) int i; pcibus_t new_addr; + memory_region_transaction_begin(); + for(i = 0; i < PCI_NUM_REGIONS; i++) { r = &d->io_regions[i]; @@ -1778,6 +1780,8 @@ static void pci_update_mappings(PCIDevice *d) } pci_update_vga(d); + + memory_region_transaction_commit(); } int pci_irq_disabled(PCIDevice *d) -- MST
