diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2021-11-02 07:25:59 -0400 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2021-11-02 07:25:59 -0400 |
commit | 844d6dfc3e48a8d404b03ea815868fd01c6f7317 (patch) | |
tree | 8e7713aff5f57b1f4a095a578e5aa12e8870165f /hw | |
parent | 8cb41fda78c7ebde0dd248c6afe1d336efb0de50 (diff) | |
parent | e4b34708388b20f1ceb55f1d563d8da925a32424 (diff) | |
download | qemu-844d6dfc3e48a8d404b03ea815868fd01c6f7317.zip qemu-844d6dfc3e48a8d404b03ea815868fd01c6f7317.tar.gz qemu-844d6dfc3e48a8d404b03ea815868fd01c6f7317.tar.bz2 |
Merge remote-tracking branch 'remotes/alex.williamson/tags/vfio-update-20211101.0' into staging
VFIO update 2021-11-01
* Re-enable expanded sub-page BAR mappings after migration (Kunkun Jiang)
* Trace dropped listener sections due to page alignment (Kunkun Jiang)
# gpg: Signature made Mon 01 Nov 2021 03:48:28 PM EDT
# gpg: using RSA key 42F6C04E540BD1A99E7B8A90239B9B6E3BB08B22
# gpg: issuer "alex.williamson@redhat.com"
# gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>" [full]
# gpg: aka "Alex Williamson <alex@shazbot.org>" [full]
# gpg: aka "Alex Williamson <alwillia@redhat.com>" [full]
# gpg: aka "Alex Williamson <alex.l.williamson@gmail.com>" [full]
* remotes/alex.williamson/tags/vfio-update-20211101.0:
vfio/common: Add a trace point when a MMIO RAM section cannot be mapped
vfio/pci: Add support for mmapping sub-page MMIO BARs after live migration
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/vfio/common.c | 7 | ||||
-rw-r--r-- | hw/vfio/pci.c | 19 |
2 files changed, 25 insertions, 1 deletions
diff --git a/hw/vfio/common.c b/hw/vfio/common.c index a784b21..dd387b0 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -893,6 +893,13 @@ static void vfio_listener_region_add(MemoryListener *listener, llend = int128_and(llend, int128_exts64(qemu_real_host_page_mask)); if (int128_ge(int128_make64(iova), llend)) { + if (memory_region_is_ram_device(section->mr)) { + trace_vfio_listener_region_add_no_dma_map( + memory_region_name(section->mr), + section->offset_within_address_space, + int128_getlo(section->size), + qemu_real_host_page_size); + } return; } end = int128_get64(int128_sub(llend, int128_one())); diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 5cdf1d4..7b45353 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -2453,7 +2453,12 @@ static int vfio_pci_load_config(VFIODevice *vbasedev, QEMUFile *f) { VFIOPCIDevice *vdev = container_of(vbasedev, VFIOPCIDevice, vbasedev); PCIDevice *pdev = &vdev->pdev; - int ret; + pcibus_t old_addr[PCI_NUM_REGIONS - 1]; + int bar, ret; + + for (bar = 0; bar < PCI_ROM_SLOT; bar++) { + old_addr[bar] = pdev->io_regions[bar].addr; + } ret = vmstate_load_state(f, &vmstate_vfio_pci_config, vdev, 1); if (ret) { @@ -2463,6 +2468,18 @@ static int vfio_pci_load_config(VFIODevice *vbasedev, QEMUFile *f) vfio_pci_write_config(pdev, PCI_COMMAND, pci_get_word(pdev->config + PCI_COMMAND), 2); + for (bar = 0; bar < PCI_ROM_SLOT; bar++) { + /* + * The address may not be changed in some scenarios + * (e.g. the VF driver isn't loaded in VM). + */ + if (old_addr[bar] != pdev->io_regions[bar].addr && + vdev->bars[bar].region.size > 0 && + vdev->bars[bar].region.size < qemu_real_host_page_size) { + vfio_sub_page_bar_update_mapping(pdev, bar); + } + } + if (msi_enabled(pdev)) { vfio_msi_enable(vdev); } else if (msix_enabled(pdev)) { |