From: Alex Williamson <alex.williamson@redhat.com>
To: pugs@cisco.com
Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
kvm@vger.kernel.org, avi@redhat.com, chrisw@redhat.com,
mst@redhat.com, alex.williamson@redhat.com
Subject: [PATCH 2/5] vfio: Fix requested regions
Date: Sat, 30 Oct 2010 10:59:23 -0600 [thread overview]
Message-ID: <20101030165917.885.98984.stgit@s20.home> (raw)
In-Reply-To: <20101030164626.885.89216.stgit@s20.home>
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@redhat.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] =
next prev parent reply other threads:[~2010-10-30 16:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-30 16:58 [PATCH 0/5] Fixes, non-PCI-2.3 support, EOI enhancements Alex Williamson
2010-10-30 16:59 ` [PATCH 1/5] vfio: Fix the ROM mask Alex Williamson
2010-10-30 16:59 ` Alex Williamson [this message]
2010-10-30 16:59 ` [PATCH 3/5] vfio: Add ioctl to re-enable interrupts Alex Williamson
2010-10-30 16:59 ` [PATCH 4/5] vfio: Add support for non-PCI 2.3 compliant devices Alex Williamson
2010-10-30 16:59 ` [PATCH 5/5] vfio: Add a new ioctl to support EOI via eventfd Alex Williamson
2010-11-01 21:22 ` [PATCH 0/5] Fixes, non-PCI-2.3 support, EOI enhancements Tom Lyon
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=20101030165917.885.98984.stgit@s20.home \
--to=alex.williamson@redhat.com \
--cc=avi@redhat.com \
--cc=chrisw@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mst@redhat.com \
--cc=pugs@cisco.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
Powered by JetHome