vfio: fix adding memory listener to the right address space

Depending on the device, container->space->as contains the valid AddressSpace.
Using address_space_memory breaks devices sitting behind an iommu (and using
a separate address space).

Signed-off-by: Frank Blaschka <blaschka@linux.vnet.ibm.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
Frank Blaschka 2014-12-19 14:40:06 -07:00 committed by Alex Williamson
parent 385f57cf9a
commit c67676711c

View File

@ -3713,7 +3713,7 @@ static int vfio_connect_container(VFIOGroup *group, AddressSpace *as)
container->iommu_data.release = vfio_listener_release;
memory_listener_register(&container->iommu_data.type1.listener,
&address_space_memory);
container->space->as);
if (container->iommu_data.type1.error) {
ret = container->iommu_data.type1.error;