VFIO updates for v2.12
The following changes since commit 0a0dc59d27527b78a195c2d838d28b7b49e5a639:
Update version for v2.11.0 release (2017-12-13 14:31:09 +0000)
are available in the git repository at:
git://github.com/awilliam/qemu-vfio.git tags/vfio-update-20171213.0
for you to fetch changes up to 2fb9636ebf24e695617bf407bf0a345aa223d1ac:
vfio-pci: Remove unused fields from VFIOMSIXInfo (2017-12-13 10:19:34 -0700)
----------------------------------------------------------------
VFIO updates for v2.12
- Fix bug failing to register all but the first group attached to a container with kvm-vfio device (Alex Williamson)
- Explicit QLIST init (Yi Lui)
- SPAPR IOMMU v1 fallback (Alexey Kardashevskiy)
- Remove unused structure fields (Alexey Kardashevskiy)
----------------------------------------------------------------
Alex Williamson (1):
vfio: Fix vfio-kvm group registration
Alexey Kardashevskiy (2):
vfio/spapr: Allow fallback to SPAPR TCE IOMMU v1
vfio-pci: Remove unused fields from VFIOMSIXInfo
Liu, Yi L (1):
vfio/common: init giommu_list and hostwin_list of vfio container
hw/vfio/common.c | 8 ++++++++ hw/vfio/pci.h | 2 -- 2 files changed, 8 insertions(+), 2 deletions(-)
[Qemu-devel] [PULL 1/4] vfio: Fix vfio-kvm group registration
Commit 8c37faa475f3 ("vfio-pci, ppc64/spapr: Reorder group-to-container attaching") moved registration of groups with the vfio-kvm device from vfio_get_group() to vfio_connect_container(), but it missed the case where a group is attached to an existing container and takes an early exit. Perhaps this is a less common case on ppc64/spapr, but on x86 (without viommu) all groups are connected to the same container and thus only the first group gets registered with the vfio-kvm device. This becomes a problem if we then hot-unplug the devices associated with that first group and we end up with KVM being misinformed about any vfio connections that might remain. Fix by including the call to vfio_kvm_device_add_group() in this early exit path.
--- hw/vfio/common.c | 1 + 1 file changed, 1 insertion(+)
hw/vfio/common.c +1 -0
@@ -968,6 +968,7 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as,if (!ioctl (group->fd,VFIO_GROUP_SET_CONTAINER , &container->fd)) { group->container = container;QLIST_INSERT_HEAD (&container->group_list, group, container_next); +vfio_kvm_device_add_group (group);return 0 ; } }
[Qemu-devel] [PULL 2/4] vfio/common: init giommu_list and hostwin_list of vfio container
In reply to Alex WilliamsonFrom: Liu, Yi L <[email protected]>
The init of giommu_list and hostwin_list is missed during container initialization.
--- hw/vfio/common.c | 2 ++ 1 file changed, 2 insertions(+)
hw/vfio/common.c +2 -0
@@ -991,6 +991,8 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as, container =g_malloc0 (sizeof (*container)); container->space = space; container->fd = fd; +QLIST_INIT (&container->giommu_list); +QLIST_INIT (&container->hostwin_list);if (ioctl (fd,VFIO_CHECK_EXTENSION ,VFIO_TYPE1_IOMMU ) ||ioctl (fd,VFIO_CHECK_EXTENSION , VFIO_TYPE1v2_IOMMU)) {bool v2 = !!ioctl (fd,VFIO_CHECK_EXTENSION , VFIO_TYPE1v2_IOMMU);
[Qemu-devel] [PULL 3/4] vfio/spapr: Allow fallback to SPAPR TCE IOMMU v1
In reply to Alex WilliamsonFrom: Alexey Kardashevskiy <[email protected]>
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.
--- hw/vfio/common.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/vfio/common.c +5 -0
@@ -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;
[Qemu-devel] [PULL 4/4] vfio-pci: Remove unused fields from VFIOMSIXInfo
In reply to Alex WilliamsonFrom: Alexey Kardashevskiy <[email protected]>
When support for multiple mappings per a region were added, this was left behind, let's finish and remove unused bits.
--- hw/vfio/pci.h | 2 -- 1 file changed, 2 deletions(-)
hw/vfio/pci.h +0 -2
@@ -93,8 +93,6 @@ typedef struct VFIOMSIXInfo {uint16_t entries;uint32_t table_offset;uint32_t pba_offset; -MemoryRegion mmap_mem; -void *mmap;unsigned long *pending; } VFIOMSIXInfo;
Peter Maydell
AppliedQuoted 18 lines · Alex Williamson
The following changes since commit
0a0dc59d27527b78a195c2d838d28b7b49e5a639:Update version for v2.11.0 release (2017-12-13 14:31:09 +0000)
are available in the git repository at:
git://github.com/awilliam/qemu-vfio.gittags/vfio-update-20171213.0for you to fetch changes up to
2fb9636ebf24e695617bf407bf0a345aa223d1ac:vfio-pci: Remove unused fields from VFIOMSIXInfo (2017-12-13 10:19:34 -0700)
----------------------------------------------------------------
VFIO updates for v2.12- Fix bug failing to register all but the first group attached to a container with kvm-vfio device (Alex Williamson)
Quoted 7 lines
- Explicit QLIST init (Yi Lui)
- SPAPR IOMMU v1 fallback (Alexey Kardashevskiy)
- Remove unused structure fields (Alexey Kardashevskiy)
----------------------------------------------------------------
Applied, thanks.
-- PMM