From 6ee47c90081b3ab5980eeef1a8b12b54bac98bb5 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 2 Mar 2015 11:38:55 -0700 Subject: vfio: allow to disable MMAP per device with -x-mmap=off option Disabling MMAP support uses the slower read/write accesses but allows to trace all MMIO accesses, which is not good for performance, but very useful for reverse engineering PCI drivers. This option allows to disable MMAP per device without a compile-time change. Signed-off-by: Samuel Pitoiset Signed-off-by: Alex Williamson --- hw/vfio/common.c | 2 +- hw/vfio/pci.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'hw') diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 4ff8cab0df..9db7d8da17 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -493,7 +493,7 @@ int vfio_mmap_region(Object *obj, VFIORegion *region, int ret = 0; VFIODevice *vbasedev = region->vbasedev; - if (VFIO_ALLOW_MMAP && size && region->flags & + if (vbasedev->allow_mmap && size && region->flags & VFIO_REGION_INFO_FLAG_MMAP) { int prot = 0; diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 84e9d995aa..3c71de3023 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -3456,6 +3456,7 @@ static Property vfio_pci_dev_properties[] = { DEFINE_PROP_BIT("x-vga", VFIOPCIDevice, features, VFIO_FEATURE_ENABLE_VGA_BIT, false), DEFINE_PROP_INT32("bootindex", VFIOPCIDevice, bootindex, -1), + DEFINE_PROP_BOOL("x-mmap", VFIOPCIDevice, vbasedev.allow_mmap, true), /* * TODO - support passed fds... is this necessary? * DEFINE_PROP_STRING("vfiofd", VFIOPCIDevice, vfiofd_name), -- cgit v1.2.3