vfio: Improve error reporting when MMIO region mapping fails
When the IOMMU address space width is smaller than the physical address width, a MMIO region of a device can fail 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 can occur with the 39-bit IOMMU address space width, as can be the case on some Intel consumer processors, or when using a vIOMMU device with default settings. The current error message is unclear, improve it and also change the error report to a warning because it is a non fatal condition for the VM. To prevent excessive log messages, restrict these recurring DMA mapping errors to a single warning at runtime. Reviewed-by: Alex Williamson <alex.williamson@redhat.com> Link: https://lore.kernel.org/qemu-devel/20250206131438.1505542-6-clg@redhat.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
80936cf7f3
commit
aaec00422b
@ -555,6 +555,18 @@ static bool vfio_get_section_iova_range(VFIOContainerBase *bcontainer,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void vfio_device_error_append(VFIODevice *vbasedev, Error **errp)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* MMIO region mapping failures are not fatal but in this case PCI
|
||||||
|
* peer-to-peer transactions are broken.
|
||||||
|
*/
|
||||||
|
if (vbasedev && vbasedev->type == VFIO_DEVICE_TYPE_PCI) {
|
||||||
|
error_append_hint(errp, "%s: PCI peer-to-peer transactions "
|
||||||
|
"on BARs are not supported.\n", vbasedev->name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void vfio_listener_region_add(MemoryListener *listener,
|
static void vfio_listener_region_add(MemoryListener *listener,
|
||||||
MemoryRegionSection *section)
|
MemoryRegionSection *section)
|
||||||
{
|
{
|
||||||
@ -670,7 +682,10 @@ static void vfio_listener_region_add(MemoryListener *listener,
|
|||||||
strerror(-ret));
|
strerror(-ret));
|
||||||
if (memory_region_is_ram_device(section->mr)) {
|
if (memory_region_is_ram_device(section->mr)) {
|
||||||
/* Allow unexpected mappings not to be fatal for RAM devices */
|
/* Allow unexpected mappings not to be fatal for RAM devices */
|
||||||
error_report_err(err);
|
VFIODevice *vbasedev =
|
||||||
|
vfio_get_vfio_device(memory_region_owner(section->mr));
|
||||||
|
vfio_device_error_append(vbasedev, &err);
|
||||||
|
warn_report_err_once(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
goto fail;
|
goto fail;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user