diff mbox

vfio: fix adding memory listener to the right address space

Message ID 1413608689-62203-1-git-send-email-blaschka@linux.vnet.ibm.com
State New
Headers show

Commit Message

Frank Blaschka Oct. 18, 2014, 5:04 a.m. UTC
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>
---
 hw/misc/vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alex Williamson Oct. 22, 2014, 6:03 p.m. UTC | #1
On Sat, 2014-10-18 at 07:04 +0200, Frank Blaschka wrote:
> 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>
> ---
>  hw/misc/vfio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
> index d66f3d2..fcc1958 100644
> --- a/hw/misc/vfio.c
> +++ b/hw/misc/vfio.c
> @@ -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
diff mbox

Patch

diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
index d66f3d2..fcc1958 100644
--- a/hw/misc/vfio.c
+++ b/hw/misc/vfio.c
@@ -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;