]> git.ipfire.org Git - thirdparty/qemu.git/commit
vfio: fix sub-page bar after cpr
authorSteve Sistare <steven.sistare@oracle.com>
Mon, 14 Jul 2025 19:21:30 +0000 (12:21 -0700)
committerCédric Le Goater <clg@redhat.com>
Mon, 28 Jul 2025 15:52:34 +0000 (17:52 +0200)
commit9751377c3a9445f597c5d0bf134a79c8cb58e45d
tree45edb3c7467fa0b190f7cdd94d7e747141bfeaa6
parent1dc1220fbd30a200aea972fc3aa53d439aff466b
vfio: fix sub-page bar after cpr

Regions for sub-page BARs are normally mapped here, in response to the
guest writing to PCI config space:

  vfio_pci_write_config()
    pci_default_write_config()
      pci_update_mappings()
        memory_region_add_subregion()
    vfio_sub_page_bar_update_mapping()
      ... vfio_dma_map()

However, after CPR, the guest does not reconfigure the device and the
code path above is not taken.  To fix, in vfio_cpr_pci_post_load, call
vfio_sub_page_bar_update_mapping for each sub-page BAR with a valid
address.

Fixes: 7e9f21411302 ("vfio/container: restore DMA vaddr")
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Link: https://lore.kernel.org/qemu-devel/1752520890-223356-1-git-send-email-steven.sistare@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
hw/vfio/cpr.c
hw/vfio/pci.c
hw/vfio/pci.h