[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101030165917.885.98984.stgit@s20.home>
Date: Sat, 30 Oct 2010 10:59:23 -0600
From: Alex Williamson <alex.williamson@...hat.com>
To: pugs@...co.com
Cc: linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
kvm@...r.kernel.org, avi@...hat.com, chrisw@...hat.com,
mst@...hat.com, alex.williamson@...hat.com
Subject: [PATCH 2/5] vfio: Fix requested regions
We've already got a more descriptive name than "vfio" in vfio->name,
use it. We also need to request regions for resources that are
only mmap'd.
Signed-off-by: Alex Williamson <alex.williamson@...hat.com>
---
drivers/vfio/vfio_main.c | 12 ++++++++++++
drivers/vfio/vfio_rdwr.c | 4 ++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
index 3b7d352..f671795 100644
--- a/drivers/vfio/vfio_main.c
+++ b/drivers/vfio/vfio_main.c
@@ -316,6 +316,18 @@ static int vfio_mmap(struct file *filep, struct vm_area_struct *vma)
if (requested > actual || actual == 0)
return -EINVAL;
+ /*
+ * Even though we don't make use of the barmap for the mmap,
+ * we need to request the region and the barmap tracks that.
+ */
+ if (!vdev->barmap[pci_space]) {
+ ret = pci_request_selected_regions(pdev, (1 << pci_space),
+ vdev->name);
+ if (ret)
+ return ret;
+ vdev->barmap[pci_space] = pci_iomap(pdev, pci_space, 0);
+ }
+
start = vma->vm_pgoff << PAGE_SHIFT;
len = vma->vm_end - vma->vm_start;
if (allow_unsafe_intrs && (vma->vm_flags & VM_WRITE)) {
diff --git a/drivers/vfio/vfio_rdwr.c b/drivers/vfio/vfio_rdwr.c
index b75bf92..83ae38a 100644
--- a/drivers/vfio/vfio_rdwr.c
+++ b/drivers/vfio/vfio_rdwr.c
@@ -67,7 +67,7 @@ ssize_t vfio_io_readwrite(
int ret;
ret = pci_request_selected_regions(pdev,
- (1 << pci_space), "vfio");
+ (1 << pci_space), vdev->name);
if (ret)
return ret;
vdev->barmap[pci_space] = pci_iomap(pdev, pci_space, 0);
@@ -164,7 +164,7 @@ ssize_t vfio_mem_readwrite(
int ret;
ret = pci_request_selected_regions(pdev,
- (1 << pci_space), "vfio");
+ (1 << pci_space), vdev->name);
if (ret)
return ret;
vdev->barmap[pci_space] =
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists