Skip to content
  • Alexey Kardashevskiy's avatar
    vfio/pci: Relax DMA map errors for MMIO regions · 567b5b30
    Alexey Kardashevskiy authored
    
    
    At the moment if vfio_memory_listener is registered in the system memory
    address space, it maps/unmaps every RAM memory region for DMA.
    It expects system page size aligned memory sections so vfio_dma_map
    would not fail and so far this has been the case. A mapping failure
    would be fatal. A side effect of such behavior is that some MMIO pages
    would not be mapped silently.
    
    However we are going to change MSIX BAR handling so we will end having
    non-aligned sections in vfio_memory_listener (more details is in
    the next patch) and vfio_dma_map will exit QEMU.
    
    In order to avoid fatal failures on what previously was not a failure and
    was just silently ignored, this checks the section alignment to
    the smallest supported IOMMU page size and prints an error if not aligned;
    it also prints an error if vfio_dma_map failed despite the page size check.
    Both errors are not fatal; only MMIO RAM regions are checked
    (aka "RAM device" regions).
    
    If the amount of errors printed is overwhelming, the MSIX relocation
    could be used to avoid excessive error output.
    
    This is unlikely to cause any behavioral change.
    
    Signed-off-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
    [aw: Fix Int128 bit ops]
    Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
    567b5b30