summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-07-06 22:23:53 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2018-07-06 22:23:53 +0300
commit1bb155702d0f533035aa2bd829b8e32848dbca3d (patch)
tree143344a22e4618690786b698b23386a9fa04aaef /samples
parentb4d0562137c9035becad5fc0588f6163aed916db (diff)
parentd7ef4899d7182f9d4267b4e4a5cc3689c1a04f25 (diff)
downloadlinux-1bb155702d0f533035aa2bd829b8e32848dbca3d.tar.xz
Merge tag 'vfio-v4.18-rc4' of git://github.com/awilliam/linux-vfio
Pull VFIO fixes from Alex Williamson: - Make vfio-pci IGD extensions optional via Kconfig (Alex Williamson) - Remove unused and soon to be removed map_atomic callback from mbochs sample driver, add unmap callback to avoid dmabuf leaks (Gerd Hoffmann) - Fix usage of get_user_pages_longterm() (Jason Gunthorpe) - Fix sample mbochs driver vm_operations_struct.fault return type (Souptick Joarder) * tag 'vfio-v4.18-rc4' of git://github.com/awilliam/linux-vfio: sample/vfio-mdev: Change return type to vm_fault_t vfio: Use get_user_pages_longterm correctly sample/mdev/mbochs: add mbochs_kunmap_dmabuf sample/mdev/mbochs: remove mbochs_kmap_atomic_dmabuf vfio/pci: Make IGD support a configurable option
Diffstat (limited to 'samples')
-rw-r--r--samples/vfio-mdev/mbochs.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c
index 2960e26c6ea4..d5d5a499160c 100644
--- a/samples/vfio-mdev/mbochs.c
+++ b/samples/vfio-mdev/mbochs.c
@@ -657,7 +657,7 @@ static void mbochs_put_pages(struct mdev_state *mdev_state)
dev_dbg(dev, "%s: %d pages released\n", __func__, count);
}
-static int mbochs_region_vm_fault(struct vm_fault *vmf)
+static vm_fault_t mbochs_region_vm_fault(struct vm_fault *vmf)
{
struct vm_area_struct *vma = vmf->vma;
struct mdev_state *mdev_state = vma->vm_private_data;
@@ -695,7 +695,7 @@ static int mbochs_mmap(struct mdev_device *mdev, struct vm_area_struct *vma)
return 0;
}
-static int mbochs_dmabuf_vm_fault(struct vm_fault *vmf)
+static vm_fault_t mbochs_dmabuf_vm_fault(struct vm_fault *vmf)
{
struct vm_area_struct *vma = vmf->vma;
struct mbochs_dmabuf *dmabuf = vma->vm_private_data;
@@ -803,29 +803,26 @@ static void mbochs_release_dmabuf(struct dma_buf *buf)
mutex_unlock(&mdev_state->ops_lock);
}
-static void *mbochs_kmap_atomic_dmabuf(struct dma_buf *buf,
- unsigned long page_num)
+static void *mbochs_kmap_dmabuf(struct dma_buf *buf, unsigned long page_num)
{
struct mbochs_dmabuf *dmabuf = buf->priv;
struct page *page = dmabuf->pages[page_num];
- return kmap_atomic(page);
+ return kmap(page);
}
-static void *mbochs_kmap_dmabuf(struct dma_buf *buf, unsigned long page_num)
+static void mbochs_kunmap_dmabuf(struct dma_buf *buf, unsigned long page_num,
+ void *vaddr)
{
- struct mbochs_dmabuf *dmabuf = buf->priv;
- struct page *page = dmabuf->pages[page_num];
-
- return kmap(page);
+ kunmap(vaddr);
}
static struct dma_buf_ops mbochs_dmabuf_ops = {
.map_dma_buf = mbochs_map_dmabuf,
.unmap_dma_buf = mbochs_unmap_dmabuf,
.release = mbochs_release_dmabuf,
- .map_atomic = mbochs_kmap_atomic_dmabuf,
.map = mbochs_kmap_dmabuf,
+ .unmap = mbochs_kunmap_dmabuf,
.mmap = mbochs_mmap_dmabuf,
};