Skip to contentSkip to conversation

vfio: fix adding memory listener to the right address space

PATCH In review Frank Blaschka 2 participants 2 messages Oct 18, 2014 – Oct 22, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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).

---
 hw/misc/vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/misc/vfio.c +1 -1
index d66f3d2..fcc1958 100644
@@ -3703,7 +3703,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;
Signature · 1 line
1.8.5.5
#1 lore raw
Quoted 14 lines · Frank Blaschka

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).

---
 hw/misc/vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/misc/vfio.c +0 -0
index d66f3d2..fcc1958 100644

hw/misc/vfio.c static int vfio_connect_container(VFIOGroup *group, AddressSpace *as) · line 3709

Quoted 8 lines
hw/misc/vfio.c +1 -1
@@ -3703,7 +3703,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;

This looks right to me, I'll do some testing and put it in after QEMU 2.2. Thanks!

Alex