From: Alex Williamson <alex.williamson@redhat.com>
To: alex.williamson@redhat.com
Cc: kvm@vger.kernel.org, konrad.wilk@oracle.com,
linux-kernel@vger.kernel.org, qemu-devel@nongnu.org,
iommu@lists.linux-foundation.org, chegu_vinod@hp.com
Subject: [Qemu-devel] [PATCH 3/2] vfio: Provide module option to disable vfio_iommu_type1 hugepage support
Date: Tue, 28 May 2013 10:27:52 -0600 [thread overview]
Message-ID: <20130528162637.28848.76733.stgit@bling.home> (raw)
In-Reply-To: <20130524171613.14229.84050.stgit@bling.home>
Add a module option to vfio_iommu_type1 to disable IOMMU hugepage
support. This causes iommu_map to only be called with single page
mappings, disabling the IOMMU driver's ability to use hugepages.
This option can be enabled by loading vfio_iommu_type1 with
disable_hugepages=1 or dynamically through sysfs. If enabled
dynamically, only new mappings are restricted.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
As suggested by Konrad. This is cleaner to add as a follow-on
drivers/vfio/vfio_iommu_type1.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index 6654a7e..8a2be4e 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -48,6 +48,12 @@ module_param_named(allow_unsafe_interrupts,
MODULE_PARM_DESC(allow_unsafe_interrupts,
"Enable VFIO IOMMU support for on platforms without interrupt remapping support.");
+static bool disable_hugepages;
+module_param_named(disable_hugepages,
+ disable_hugepages, bool, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(disable_hugepages,
+ "Disable VFIO IOMMU support for IOMMU hugepages.");
+
struct vfio_iommu {
struct iommu_domain *domain;
struct mutex lock;
@@ -270,6 +276,11 @@ static long vfio_pin_pages(unsigned long vaddr, long npage,
return -ENOMEM;
}
+ if (unlikely(disable_hugepages)) {
+ vfio_lock_acct(1);
+ return 1;
+ }
+
/* Lock all the consecutive pages from pfn_base */
for (i = 1, vaddr += PAGE_SIZE; i < npage; i++, vaddr += PAGE_SIZE) {
unsigned long pfn = 0;
next prev parent reply other threads:[~2013-05-28 16:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-24 17:24 [Qemu-devel] [PATCH 0/2] vfio: type1 iommu hugepage support Alex Williamson
2013-05-24 17:24 ` [Qemu-devel] [PATCH 1/2] vfio: Convert type1 iommu to use rbtree Alex Williamson
2013-05-24 17:24 ` [Qemu-devel] [PATCH 2/2] vfio: hugepage support for vfio_iommu_type1 Alex Williamson
2013-05-25 11:20 ` Konrad Rzeszutek Wilk
2013-05-25 14:23 ` Alex Williamson
2013-05-27 8:41 ` Sethi Varun-B16395
2013-05-27 13:37 ` Alex Williamson
2013-05-25 11:21 ` [Qemu-devel] [PATCH 0/2] vfio: type1 iommu hugepage support Konrad Rzeszutek Wilk
2013-05-25 14:39 ` Alex Williamson
2013-05-28 16:27 ` Alex Williamson [this message]
2013-05-28 16:42 ` [Qemu-devel] [PATCH 3/2] vfio: Provide module option to disable vfio_iommu_type1 " Konrad Rzeszutek Wilk
2013-05-31 2:33 ` Chegu Vinod
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=20130528162637.28848.76733.stgit@bling.home \
--to=alex.williamson@redhat.com \
--cc=chegu_vinod@hp.com \
--cc=iommu@lists.linux-foundation.org \
--cc=konrad.wilk@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
/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).