summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-03-14 15:11:39 +0000
committerPeter Maydell <peter.maydell@linaro.org>2016-03-14 15:11:39 +0000
commit6dcea614251e01d99c352056baffed6b39bd4b26 (patch)
tree9540e1f427e9f3fafd37c9df004eee411c3e9cd5 /include
parent0dcee62261cb044339b10e4bda1f67ef7dc82803 (diff)
parent99b88c6d1fc81c9757bb6e116e0adf20b2906629 (diff)
downloadqemu-6dcea614251e01d99c352056baffed6b39bd4b26.tar.gz
Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20160311.0' into staging
VFIO updates 2016-03-11 - Allow devices to be specified via sysfs path (Alex Williamson) - vfio region helpers and generalization for future device specific regions (Alex Williamson) - Automatic ROM device ID and checksum fixup (Alex Williamson) - Split VGA setup to allow enabling VGA from quirks (Alex Williamson) - Remove fixed string limit for ROM MemoryRegion name (Neo Jia) - MAINTAINERS update (Thomas Huth) # gpg: Signature made Fri 11 Mar 2016 15:55:31 GMT using RSA key ID 3BB08B22 # gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>" # gpg: aka "Alex Williamson <alex@shazbot.org>" # gpg: aka "Alex Williamson <alwillia@redhat.com>" # gpg: aka "Alex Williamson <alex.l.williamson@gmail.com>" * remotes/awilliam/tags/vfio-update-20160311.0: MAINTAINERS: Add entry for the include/hw/vfio/ folder vfio/pci: replace fixed string limit by g_strdup_printf vfio/pci: Split out VGA setup vfio/pci: Fixup PCI option ROMs vfio/pci: Convert all MemoryRegion to dynamic alloc and consistent functions vfio: Generalize region support vfio: Wrap VFIO_DEVICE_GET_REGION_INFO vfio: Add sysfsdev property for pci & platform Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/hw/vfio/vfio-common.h31
1 files changed, 24 insertions, 7 deletions
diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
index f037f3c425..eb0e1b0342 100644
--- a/include/hw/vfio/vfio-common.h
+++ b/include/hw/vfio/vfio-common.h
@@ -25,6 +25,9 @@
#include "exec/memory.h"
#include "qemu/queue.h"
#include "qemu/notify.h"
+#ifdef CONFIG_LINUX
+#include <linux/vfio.h>
+#endif
/*#define DEBUG_VFIO*/
#ifdef DEBUG_VFIO
@@ -40,14 +43,21 @@ enum {
VFIO_DEVICE_TYPE_PLATFORM = 1,
};
+typedef struct VFIOMmap {
+ MemoryRegion mem;
+ void *mmap;
+ off_t offset;
+ size_t size;
+} VFIOMmap;
+
typedef struct VFIORegion {
struct VFIODevice *vbasedev;
off_t fd_offset; /* offset of region within device fd */
- MemoryRegion mem; /* slow, read/write access */
- MemoryRegion mmap_mem; /* direct mapped access */
- void *mmap;
+ MemoryRegion *mem; /* slow, read/write access */
size_t size;
uint32_t flags; /* VFIO region flags (rd/wr/mmap) */
+ uint32_t nr_mmaps;
+ VFIOMmap *mmaps;
uint8_t nr; /* cache the region number for debug */
} VFIORegion;
@@ -89,6 +99,7 @@ typedef struct VFIODeviceOps VFIODeviceOps;
typedef struct VFIODevice {
QLIST_ENTRY(VFIODevice) next;
struct VFIOGroup *group;
+ char *sysfsdev;
char *name;
int fd;
int type;
@@ -124,10 +135,12 @@ void vfio_region_write(void *opaque, hwaddr addr,
uint64_t data, unsigned size);
uint64_t vfio_region_read(void *opaque,
hwaddr addr, unsigned size);
-int vfio_mmap_region(Object *vdev, VFIORegion *region,
- MemoryRegion *mem, MemoryRegion *submem,
- void **map, size_t size, off_t offset,
- const char *name);
+int vfio_region_setup(Object *obj, VFIODevice *vbasedev, VFIORegion *region,
+ int index, const char *name);
+int vfio_region_mmap(VFIORegion *region);
+void vfio_region_mmaps_set_enabled(VFIORegion *region, bool enabled);
+void vfio_region_exit(VFIORegion *region);
+void vfio_region_finalize(VFIORegion *region);
void vfio_reset_handler(void *opaque);
VFIOGroup *vfio_get_group(int groupid, AddressSpace *as);
void vfio_put_group(VFIOGroup *group);
@@ -138,4 +151,8 @@ extern const MemoryRegionOps vfio_region_ops;
extern QLIST_HEAD(vfio_group_head, VFIOGroup) vfio_group_list;
extern QLIST_HEAD(vfio_as_head, VFIOAddressSpace) vfio_address_spaces;
+#ifdef CONFIG_LINUX
+int vfio_get_region_info(VFIODevice *vbasedev, int index,
+ struct vfio_region_info **info);
+#endif
#endif /* !HW_VFIO_VFIO_COMMON_H */