[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 38/66] vfio: pass device to vfio_mmap_bar and use it
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 38/66] vfio: pass device to vfio_mmap_bar and use it to set owner |
Date: |
Thu, 4 Jul 2013 17:13:34 +0200 |
Cc: Alex Williamson <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/misc/vfio.c | 11 ++++++-----
1 file 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);
}
--
1.8.1.4
- Re: [Qemu-devel] [PATCH 28/66] exec: reorganize address_space_map, (continued)
- [Qemu-devel] [PATCH 29/66] memory: ref/unref memory across address_space_map/unmap, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 30/66] escc: rename struct to ESCCState, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 31/66] vga: pass owner to vga_init, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 32/66] vga: pass owner to vga_common_init, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 33/66] vga: pass owner to cirrus_init_common, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 34/66] vga: pass owner to vga_init_vbe, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 35/66] vga: pass owner to vga_init_io, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 36/66] vga: set owner in vga_update_memory_access, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 37/66] ne2000: pass device to ne2000_setup_io, use it as owner, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 38/66] vfio: pass device to vfio_mmap_bar and use it to set owner,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 39/66] spapr_iommu: pass device to spapr_tce_new_table and use it to set owner, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 40/66] pam: pass device to init_pam and use it to set owner, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 41/66] piolist: add owner argument to initialization functions and pass devices, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 43/66] hw/block: pass owner to memory_region_init* functions, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 44/66] hw/c*: pass owner to memory_region_init* functions, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 42/66] hw/a*: pass owner to memory_region_init* functions, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 45/66] hw/d*: pass owner to memory_region_init* functions, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 46/66] hw/gpio: pass owner to memory_region_init* functions, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 47/66] hw/i*: pass owner to memory_region_init* functions, Paolo Bonzini, 2013/07/04
- [Qemu-devel] [PATCH 48/66] hw/m*: pass owner to memory_region_init* functions, Paolo Bonzini, 2013/07/04