mbox series

[v3,0/7] vfio: Improve error reporting when MMIO region mapping fails

Message ID 20250206131438.1505542-1-clg@redhat.com (mailing list archive)
Headers show
Series vfio: Improve error reporting when MMIO region mapping fails | expand

Message

Cédric Le Goater Feb. 6, 2025, 1:14 p.m. UTC
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Hello,

Under certain circumstances, a MMIO region of a device fails to map
because the region is outside the supported IOVA ranges of the VM. In
this case, PCI peer-to-peer transactions on BARs are not supported.
This typically occurs when the IOMMU address space width is less than
the physical address width, as can be the case on some Intel consumer
processors or when using a vIOMMU device with default settings.

This series tries to clarify the error message reported to the user.

Thanks,

C.

Changes in v3:

 - Fixed warn_report_err_once()
 - Improved commit logs a bit 
 - Dropped check on compatibility of CPU and IOMMU address space
   width. Will address later in its own series.

Changes in v2:

 - Removed advice on how to resolve the issue. Diagnostic is enough.
 - Introduced helpers
 - Checked device type, since this only applies to PCI
 - Added cleanup
 
Cédric Le Goater (7):
  util/error: Introduce warn_report_err_once()
  vfio/pci: Replace "iommu_device" by "vIOMMU"
  vfio: Rephrase comment in vfio_listener_region_add() error path
  vfio: Introduce vfio_get_vfio_device()
  vfio: Improve error reporting when MMIO region mapping fails
  vfio: Remove reports of DMA mapping errors in backends
  vfio: Remove superfluous error report in vfio_listener_region_add()

 include/hw/vfio/vfio-common.h |  1 +
 include/qapi/error.h          | 12 +++++++++++
 backends/iommufd.c            |  3 ---
 hw/vfio/common.c              | 40 +++++++++++++++++++++++++----------
 hw/vfio/container.c           |  2 --
 hw/vfio/helpers.c             | 10 +++++++++
 hw/vfio/pci.c                 |  2 +-
 util/error.c                  | 11 ++++++++++
 8 files changed, 64 insertions(+), 17 deletions(-)

Comments

Alex Williamson Feb. 10, 2025, 4:01 p.m. UTC | #1
On Thu,  6 Feb 2025 14:14:28 +0100
Cédric Le Goater <clg@redhat.com> wrote:

> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> Hello,
> 
> Under certain circumstances, a MMIO region of a device fails to map
> because the region is outside the supported IOVA ranges of the VM. In
> this case, PCI peer-to-peer transactions on BARs are not supported.
> This typically occurs when the IOMMU address space width is less than
> the physical address width, as can be the case on some Intel consumer
> processors or when using a vIOMMU device with default settings.
> 
> This series tries to clarify the error message reported to the user.
> 
> Thanks,
> 
> C.
> 
> Changes in v3:
> 
>  - Fixed warn_report_err_once()
>  - Improved commit logs a bit 
>  - Dropped check on compatibility of CPU and IOMMU address space
>    width. Will address later in its own series.
> 
> Changes in v2:
> 
>  - Removed advice on how to resolve the issue. Diagnostic is enough.
>  - Introduced helpers
>  - Checked device type, since this only applies to PCI
>  - Added cleanup
>  
> Cédric Le Goater (7):
>   util/error: Introduce warn_report_err_once()
>   vfio/pci: Replace "iommu_device" by "vIOMMU"
>   vfio: Rephrase comment in vfio_listener_region_add() error path
>   vfio: Introduce vfio_get_vfio_device()
>   vfio: Improve error reporting when MMIO region mapping fails
>   vfio: Remove reports of DMA mapping errors in backends
>   vfio: Remove superfluous error report in vfio_listener_region_add()
> 
>  include/hw/vfio/vfio-common.h |  1 +
>  include/qapi/error.h          | 12 +++++++++++
>  backends/iommufd.c            |  3 ---
>  hw/vfio/common.c              | 40 +++++++++++++++++++++++++----------
>  hw/vfio/container.c           |  2 --
>  hw/vfio/helpers.c             | 10 +++++++++
>  hw/vfio/pci.c                 |  2 +-
>  util/error.c                  | 11 ++++++++++
>  8 files changed, 64 insertions(+), 17 deletions(-)
> 

Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Cédric Le Goater Feb. 11, 2025, 1:32 p.m. UTC | #2
On 2/6/25 14:14, Cédric Le Goater wrote:
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> Hello,
> 
> Under certain circumstances, a MMIO region of a device fails to map
> because the region is outside the supported IOVA ranges of the VM. In
> this case, PCI peer-to-peer transactions on BARs are not supported.
> This typically occurs when the IOMMU address space width is less than
> the physical address width, as can be the case on some Intel consumer
> processors or when using a vIOMMU device with default settings.
> 
> This series tries to clarify the error message reported to the user.
> 
> Thanks,
> 
> C.
> 
> Changes in v3:
> 
>   - Fixed warn_report_err_once()
>   - Improved commit logs a bit
>   - Dropped check on compatibility of CPU and IOMMU address space
>     width. Will address later in its own series.
> 
> Changes in v2:
> 
>   - Removed advice on how to resolve the issue. Diagnostic is enough.
>   - Introduced helpers
>   - Checked device type, since this only applies to PCI
>   - Added cleanup
>   
> Cédric Le Goater (7):
>    util/error: Introduce warn_report_err_once()
>    vfio/pci: Replace "iommu_device" by "vIOMMU"
>    vfio: Rephrase comment in vfio_listener_region_add() error path
>    vfio: Introduce vfio_get_vfio_device()
>    vfio: Improve error reporting when MMIO region mapping fails
>    vfio: Remove reports of DMA mapping errors in backends
>    vfio: Remove superfluous error report in vfio_listener_region_add()
> 
>   include/hw/vfio/vfio-common.h |  1 +
>   include/qapi/error.h          | 12 +++++++++++
>   backends/iommufd.c            |  3 ---
>   hw/vfio/common.c              | 40 +++++++++++++++++++++++++----------
>   hw/vfio/container.c           |  2 --
>   hw/vfio/helpers.c             | 10 +++++++++
>   hw/vfio/pci.c                 |  2 +-
>   util/error.c                  | 11 ++++++++++
>   8 files changed, 64 insertions(+), 17 deletions(-)
> 


Applied to vfio-next.

Thanks,

C.