diff options
author | Alexey Kardashevskiy <aik@ozlabs.ru> | 2017-12-13 10:19:33 -0700 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2017-12-13 10:19:33 -0700 |
commit | c6e7958eb76ed267f7254b97f89773874df50e48 (patch) | |
tree | a78734e22b18cf42d25e0c9cb6cd7476a1d77a9c /hw/vfio | |
parent | f7f9c7b23243fef21296d04d03df1477d12c5c19 (diff) |
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.
Fixes: 318f67ce1371 ("vfio: spapr: Add DMA memory preregistering (SPAPR IOMMU v2)")
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'hw/vfio')
-rw-r--r-- | hw/vfio/common.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 216eec68ef..b77be3a8b3 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -1043,6 +1043,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; |