From: Alex Williamson <alex.williamson@redhat.com>
To: qemu-devel@nongnu.org
Cc: alex.williamson@redhat.com, Samuel Pitoiset <samuel.pitoiset@gmail.com>
Subject: [Qemu-devel] [PULL 3/4] vfio: allow to disable MMAP per device with -x-mmap=off option
Date: Mon, 02 Mar 2015 12:03:44 -0700 [thread overview]
Message-ID: <20150302190344.2706.47653.stgit@gimli.home> (raw)
In-Reply-To: <20150302190237.2706.61507.stgit@gimli.home>
From: Samuel Pitoiset <samuel.pitoiset@gmail.com>
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 <samuel.pitoiset@gmail.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
hw/vfio/common.c | 2 +-
hw/vfio/pci.c | 1 +
include/hw/vfio/vfio-common.h | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 4ff8cab..9db7d8d 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 84e9d99..3c71de3 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),
diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
index 3d3892c..0d1fb80 100644
--- a/include/hw/vfio/vfio-common.h
+++ b/include/hw/vfio/vfio-common.h
@@ -36,7 +36,6 @@
#endif
/* Extra debugging, trap acceleration paths for more logging */
-#define VFIO_ALLOW_MMAP 1
#define VFIO_ALLOW_KVM_INTX 1
#define VFIO_ALLOW_KVM_MSI 1
#define VFIO_ALLOW_KVM_MSIX 1
@@ -102,6 +101,7 @@ typedef struct VFIODevice {
int type;
bool reset_works;
bool needs_reset;
+ bool allow_mmap;
VFIODeviceOps *ops;
unsigned int num_irqs;
unsigned int num_regions;
next prev parent reply other threads:[~2015-03-02 19:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-02 19:03 [Qemu-devel] [PULL 0/4] vfio: Updates for QEMU 2.3-rc0 Alex Williamson
2015-03-02 19:03 ` [Qemu-devel] [PULL 1/4] vfio: Add ioctl number to error report Alex Williamson
2015-03-02 19:03 ` [Qemu-devel] [PULL 2/4] vfio: Make type1 listener symbols static Alex Williamson
2015-03-02 19:03 ` Alex Williamson [this message]
2015-03-02 19:03 ` [Qemu-devel] [PULL 4/4] vfio-pci: Enable device request notification support Alex Williamson
2015-03-04 15:32 ` [Qemu-devel] [PULL 0/4] vfio: Updates for QEMU 2.3-rc0 Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150302190344.2706.47653.stgit@gimli.home \
--to=alex.williamson@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=samuel.pitoiset@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).