aboutsummaryrefslogtreecommitdiff
path: root/hw/misc
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2013-06-25 12:31:46 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2013-07-04 17:42:47 +0200
commit5cb022a1bfaa0c15a13d3266bc6d683cc1f44d7f (patch)
tree4b79749e37bc7e28d556f5bf2c1af7a45394eb90 /hw/misc
parentdcb117bfda5af6f6ceb7231778d36d8bce4aee93 (diff)
downloadqemu-5cb022a1bfaa0c15a13d3266bc6d683cc1f44d7f.zip
qemu-5cb022a1bfaa0c15a13d3266bc6d683cc1f44d7f.tar.gz
qemu-5cb022a1bfaa0c15a13d3266bc6d683cc1f44d7f.tar.bz2
vfio: pass device to vfio_mmap_bar and use it to set owner
Cc: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/misc')
-rw-r--r--hw/misc/vfio.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
index 675bbfc..58013eb 100644
--- a/hw/misc/vfio.c
+++ b/hw/misc/vfio.c
@@ -2205,7 +2205,8 @@ static void vfio_unmap_bar(VFIODevice *vdev, int nr)
memory_region_destroy(&bar->mem);
}
-static int vfio_mmap_bar(VFIOBAR *bar, MemoryRegion *mem, MemoryRegion *submem,
+static int vfio_mmap_bar(VFIODevice *vdev, VFIOBAR *bar,
+ MemoryRegion *mem, MemoryRegion *submem,
void **map, size_t size, off_t offset,
const char *name)
{
@@ -2230,11 +2231,11 @@ static int vfio_mmap_bar(VFIOBAR *bar, MemoryRegion *mem, MemoryRegion *submem,
goto empty_region;
}
- memory_region_init_ram_ptr(submem, NULL, name, size, *map);
+ memory_region_init_ram_ptr(submem, OBJECT(vdev), name, size, *map);
} else {
empty_region:
/* Create a zero sized sub-region to make cleanup easy. */
- memory_region_init(submem, NULL, name, 0);
+ memory_region_init(submem, OBJECT(vdev), name, 0);
}
memory_region_add_subregion(mem, offset, submem);
@@ -2285,7 +2286,7 @@ static void vfio_map_bar(VFIODevice *vdev, int nr)
}
strncat(name, " mmap", sizeof(name) - strlen(name) - 1);
- if (vfio_mmap_bar(bar, &bar->mem,
+ if (vfio_mmap_bar(vdev, bar, &bar->mem,
&bar->mmap_mem, &bar->mmap, size, 0, name)) {
error_report("%s unsupported. Performance may be slow", name);
}
@@ -2299,7 +2300,7 @@ static void vfio_map_bar(VFIODevice *vdev, int nr)
size = start < bar->size ? bar->size - start : 0;
strncat(name, " msix-hi", sizeof(name) - strlen(name) - 1);
/* VFIOMSIXInfo contains another MemoryRegion for this mapping */
- if (vfio_mmap_bar(bar, &bar->mem, &vdev->msix->mmap_mem,
+ if (vfio_mmap_bar(vdev, bar, &bar->mem, &vdev->msix->mmap_mem,
&vdev->msix->mmap, size, start, name)) {
error_report("%s unsupported. Performance may be slow", name);
}