vfio/spapr: Allow fallback to SPAPR TCE IOMMU v1
PATCH v2 1/1 vfio/spapr: Allow fallback to SPAPR TCE IOMMU v1
The vfio_iommu_spapr_tce driver advertises kernel's support for v1 and v2 IOMMU support, however it is not always possible to use the requested IOMMU type. For example, a pseries host platform does not support dynamic DMA windows so v2 cannot initialize and QEMU fails to start.
This adds a fallback to the v1 IOMMU if v2 cannot be used.
---
Changes:
v2:
* updated commit log
--- hw/vfio/common.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/vfio/common.c +5 -0
@@ -1040,6 +1040,11 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as, v2 ? VFIO_SPAPR_TCE_v2_IOMMU :VFIO_SPAPR_TCE_IOMMU ; ret =ioctl (fd,VFIO_SET_IOMMU , container->iommu_type);if (ret) { + container->iommu_type =VFIO_SPAPR_TCE_IOMMU ; + v2 = false; + ret =ioctl (fd,VFIO_SET_IOMMU , container->iommu_type); + } +if (ret) {error_setg_errno (errp, errno,"failed to set iommu for container" ); ret = -errno; goto free_container_exit;
Signature · 1 line
2.11.0
Quoted 10 lines · Alexey Kardashevskiy
The
vfio_iommu_spapr_tcedriver advertises kernel's support for v1 and v2 IOMMU support, however it is not always possible to use the requested IOMMU type. For example, a pseries host platform does not support dynamic DMA windows so v2 cannot initialize and QEMU fails to start.This adds a fallback to the v1 IOMMU if v2 cannot be used.
Fixes 318f67ce1371 "vfio: spapr: Add DMA memory preregistering (SPAPR IOMMU v2)"Signed-off-by Alexey Kardashevskiy <[email protected]>
Alex, will you take this through your tree, or should I take it through mine?
Quoted 25 lines
---
Changes:
v2:
* updated commit log--- hw/vfio/common.c | 5 +++++ 1 file changed, 5 insertions(+)hw/vfio/common.c +5
-0@@ -1040,6 +1040,11 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as, v2 ? VFIO_SPAPR_TCE_v2_IOMMU :VFIO_SPAPR_TCE_IOMMU ; ret =ioctl (fd,VFIO_SET_IOMMU , container->iommu_type);if (ret) { + container->iommu_type =VFIO_SPAPR_TCE_IOMMU ; + v2 = false; + ret =ioctl (fd,VFIO_SET_IOMMU , container->iommu_type); + } +if (ret) {error_setg_errno (errp, errno,"failed to set iommu for container" ); ret = -errno; goto free_container_exit;
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 9 lines · David Gibson
Quoted 8 lines · Alexey Kardashevskiy
The
vfio_iommu_spapr_tcedriver advertises kernel's support for v1 and v2 IOMMU support, however it is not always possible to use the requested IOMMU type. For example, a pseries host platform does not support dynamic DMA windows so v2 cannot initialize and QEMU fails to start.This adds a fallback to the v1 IOMMU if v2 cannot be used.
Quoted 7 lines
Quoted 2 lines
Fixes 318f67ce1371 "vfio: spapr: Add DMA memory preregistering (SPAPR IOMMU v2)"Signed-off-by Alexey Kardashevskiy <[email protected]>Reviewed-by David Gibson <[email protected]>Alex, will you take this through your tree, or should I take it through mine?
It is already in upstream.
Quoted 27 lines
Quoted 26 lines
---
Changes:
v2:
* updated commit log--- hw/vfio/common.c | 5 +++++ 1 file changed, 5 insertions(+)hw/vfio/common.c +5
-0@@ -1040,6 +1040,11 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as, v2 ? VFIO_SPAPR_TCE_v2_IOMMU :VFIO_SPAPR_TCE_IOMMU ; ret =ioctl (fd,VFIO_SET_IOMMU , container->iommu_type);if (ret) { + container->iommu_type =VFIO_SPAPR_TCE_IOMMU ; + v2 = false; + ret =ioctl (fd,VFIO_SET_IOMMU , container->iommu_type); + } +if (ret) {error_setg_errno (errp, errno,"failed to set iommu for container" ); ret = -errno; goto free_container_exit;
Signature · 1 line
Alexey