-
Alexandru Elisei authored
kvmtool assumes that the BAR that holds the address for the MSIX table and PBA structure has a size which is equal to the total size of the table and the PBA structure and it allocates memory from MMIO space accordingly. However, when initializing the BARs, the BAR size is set according to the region size reported by VFIO. When the physical BAR size is greater than what kvmtool allocated, we can have a situation where the BAR overlaps with another BAR, in which case kvmtool will fail to map the memory. This was found when trying to do PCI passthrough on a PCIe Realtek r8168 NIC. Let's fix this by allocating an amount of MMIO memory equal to table + PBA size or BAR size, whichever is greater.
667ac704