aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2011-09-01 16:18:40 -0400
committerDave Airlie <airlied@redhat.com>2011-09-06 06:48:34 -0400
commit07999a7e0e409891cb27f34fa1da851d8484a5c5 (patch)
tree26536a623b5086aa20fb9c2a69b7a2d1ce82e3c9 /drivers/gpu/drm/vmwgfx
parentfe0f5c657601c28d295b1d60691cce40e8b42d92 (diff)
vmwgfx: Remove the possibility to map the fifo from user-space
This was previously used by user-space to check whether a fence sequence had passed or not. With fence objects that's not needed anymore. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_drv.h1
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c48
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c3
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c5
4 files changed, 2 insertions, 55 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index a99400f10531..39be79619068 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -411,7 +411,6 @@ extern void vmw_fifo_commit(struct vmw_private *dev_priv, uint32_t bytes);
411extern int vmw_fifo_send_fence(struct vmw_private *dev_priv, 411extern int vmw_fifo_send_fence(struct vmw_private *dev_priv,
412 uint32_t *sequence); 412 uint32_t *sequence);
413extern void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason); 413extern void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason);
414extern int vmw_fifo_mmap(struct file *filp, struct vm_area_struct *vma);
415extern bool vmw_fifo_have_3d(struct vmw_private *dev_priv); 414extern bool vmw_fifo_have_3d(struct vmw_private *dev_priv);
416extern bool vmw_fifo_have_pitchlock(struct vmw_private *dev_priv); 415extern bool vmw_fifo_have_pitchlock(struct vmw_private *dev_priv);
417 416
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
index d031c555fa47..aae01b9ae4dc 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
@@ -491,51 +491,3 @@ int vmw_fifo_send_fence(struct vmw_private *dev_priv, uint32_t *sequence)
491out_err: 491out_err:
492 return ret; 492 return ret;
493} 493}
494
495/**
496 * Map the first page of the FIFO read-only to user-space.
497 */
498
499static int vmw_fifo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
500{
501 int ret;
502 unsigned long address = (unsigned long)vmf->virtual_address;
503
504 if (address != vma->vm_start)
505 return VM_FAULT_SIGBUS;
506
507 ret = vm_insert_pfn(vma, address, vma->vm_pgoff);
508 if (likely(ret == -EBUSY || ret == 0))
509 return VM_FAULT_NOPAGE;
510 else if (ret == -ENOMEM)
511 return VM_FAULT_OOM;
512
513 return VM_FAULT_SIGBUS;
514}
515
516static struct vm_operations_struct vmw_fifo_vm_ops = {
517 .fault = vmw_fifo_vm_fault,
518 .open = NULL,
519 .close = NULL
520};
521
522int vmw_fifo_mmap(struct file *filp, struct vm_area_struct *vma)
523{
524 struct drm_file *file_priv;
525 struct vmw_private *dev_priv;
526
527 file_priv = filp->private_data;
528 dev_priv = vmw_priv(file_priv->minor->dev);
529
530 if (vma->vm_pgoff != (dev_priv->mmio_start >> PAGE_SHIFT) ||
531 (vma->vm_end - vma->vm_start) != PAGE_SIZE)
532 return -EINVAL;
533
534 vma->vm_flags &= ~(VM_WRITE | VM_MAYWRITE);
535 vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_SHARED;
536 vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
537 vma->vm_page_prot = ttm_io_prot(TTM_PL_FLAG_UNCACHED,
538 vma->vm_page_prot);
539 vma->vm_ops = &vmw_fifo_vm_ops;
540 return 0;
541}
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
index f1b9175bee94..74b1dc8a7cdd 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
@@ -45,9 +45,6 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data,
45 case DRM_VMW_PARAM_3D: 45 case DRM_VMW_PARAM_3D:
46 param->value = vmw_fifo_have_3d(dev_priv) ? 1 : 0; 46 param->value = vmw_fifo_have_3d(dev_priv) ? 1 : 0;
47 break; 47 break;
48 case DRM_VMW_PARAM_FIFO_OFFSET:
49 param->value = dev_priv->mmio_start;
50 break;
51 case DRM_VMW_PARAM_HW_CAPS: 48 case DRM_VMW_PARAM_HW_CAPS:
52 param->value = dev_priv->capabilities; 49 param->value = dev_priv->capabilities;
53 break; 50 break;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c
index 1e8eedd901e0..d3c11f5184f3 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c
@@ -34,9 +34,8 @@ int vmw_mmap(struct file *filp, struct vm_area_struct *vma)
34 struct vmw_private *dev_priv; 34 struct vmw_private *dev_priv;
35 35
36 if (unlikely(vma->vm_pgoff < VMWGFX_FILE_PAGE_OFFSET)) { 36 if (unlikely(vma->vm_pgoff < VMWGFX_FILE_PAGE_OFFSET)) {
37 if (vmw_fifo_mmap(filp, vma) == 0) 37 DRM_ERROR("Illegal attempt to mmap old fifo space.\n");
38 return 0; 38 return -EINVAL;
39 return drm_mmap(filp, vma);
40 } 39 }
41 40
42 file_priv = filp->private_data; 41 file_priv = filp->private_data;