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>
This commit is contained in:
committed by
Dave Airlie
parent
fe0f5c6576
commit
07999a7e0e
@@ -411,7 +411,6 @@ extern void vmw_fifo_commit(struct vmw_private *dev_priv, uint32_t bytes);
|
|||||||
extern int vmw_fifo_send_fence(struct vmw_private *dev_priv,
|
extern int vmw_fifo_send_fence(struct vmw_private *dev_priv,
|
||||||
uint32_t *sequence);
|
uint32_t *sequence);
|
||||||
extern void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason);
|
extern void vmw_fifo_ping_host(struct vmw_private *dev_priv, uint32_t reason);
|
||||||
extern int vmw_fifo_mmap(struct file *filp, struct vm_area_struct *vma);
|
|
||||||
extern bool vmw_fifo_have_3d(struct vmw_private *dev_priv);
|
extern bool vmw_fifo_have_3d(struct vmw_private *dev_priv);
|
||||||
extern bool vmw_fifo_have_pitchlock(struct vmw_private *dev_priv);
|
extern bool vmw_fifo_have_pitchlock(struct vmw_private *dev_priv);
|
||||||
|
|
||||||
|
@@ -491,51 +491,3 @@ int vmw_fifo_send_fence(struct vmw_private *dev_priv, uint32_t *sequence)
|
|||||||
out_err:
|
out_err:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Map the first page of the FIFO read-only to user-space.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int vmw_fifo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
unsigned long address = (unsigned long)vmf->virtual_address;
|
|
||||||
|
|
||||||
if (address != vma->vm_start)
|
|
||||||
return VM_FAULT_SIGBUS;
|
|
||||||
|
|
||||||
ret = vm_insert_pfn(vma, address, vma->vm_pgoff);
|
|
||||||
if (likely(ret == -EBUSY || ret == 0))
|
|
||||||
return VM_FAULT_NOPAGE;
|
|
||||||
else if (ret == -ENOMEM)
|
|
||||||
return VM_FAULT_OOM;
|
|
||||||
|
|
||||||
return VM_FAULT_SIGBUS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct vm_operations_struct vmw_fifo_vm_ops = {
|
|
||||||
.fault = vmw_fifo_vm_fault,
|
|
||||||
.open = NULL,
|
|
||||||
.close = NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
int vmw_fifo_mmap(struct file *filp, struct vm_area_struct *vma)
|
|
||||||
{
|
|
||||||
struct drm_file *file_priv;
|
|
||||||
struct vmw_private *dev_priv;
|
|
||||||
|
|
||||||
file_priv = filp->private_data;
|
|
||||||
dev_priv = vmw_priv(file_priv->minor->dev);
|
|
||||||
|
|
||||||
if (vma->vm_pgoff != (dev_priv->mmio_start >> PAGE_SHIFT) ||
|
|
||||||
(vma->vm_end - vma->vm_start) != PAGE_SIZE)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
vma->vm_flags &= ~(VM_WRITE | VM_MAYWRITE);
|
|
||||||
vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_SHARED;
|
|
||||||
vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
|
|
||||||
vma->vm_page_prot = ttm_io_prot(TTM_PL_FLAG_UNCACHED,
|
|
||||||
vma->vm_page_prot);
|
|
||||||
vma->vm_ops = &vmw_fifo_vm_ops;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
@@ -45,9 +45,6 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data,
|
|||||||
case DRM_VMW_PARAM_3D:
|
case DRM_VMW_PARAM_3D:
|
||||||
param->value = vmw_fifo_have_3d(dev_priv) ? 1 : 0;
|
param->value = vmw_fifo_have_3d(dev_priv) ? 1 : 0;
|
||||||
break;
|
break;
|
||||||
case DRM_VMW_PARAM_FIFO_OFFSET:
|
|
||||||
param->value = dev_priv->mmio_start;
|
|
||||||
break;
|
|
||||||
case DRM_VMW_PARAM_HW_CAPS:
|
case DRM_VMW_PARAM_HW_CAPS:
|
||||||
param->value = dev_priv->capabilities;
|
param->value = dev_priv->capabilities;
|
||||||
break;
|
break;
|
||||||
|
@@ -34,9 +34,8 @@ int vmw_mmap(struct file *filp, struct vm_area_struct *vma)
|
|||||||
struct vmw_private *dev_priv;
|
struct vmw_private *dev_priv;
|
||||||
|
|
||||||
if (unlikely(vma->vm_pgoff < VMWGFX_FILE_PAGE_OFFSET)) {
|
if (unlikely(vma->vm_pgoff < VMWGFX_FILE_PAGE_OFFSET)) {
|
||||||
if (vmw_fifo_mmap(filp, vma) == 0)
|
DRM_ERROR("Illegal attempt to mmap old fifo space.\n");
|
||||||
return 0;
|
return -EINVAL;
|
||||||
return drm_mmap(filp, vma);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
file_priv = filp->private_data;
|
file_priv = filp->private_data;
|
||||||
|
@@ -65,10 +65,9 @@
|
|||||||
#define DRM_VMW_PARAM_NUM_STREAMS 0
|
#define DRM_VMW_PARAM_NUM_STREAMS 0
|
||||||
#define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
|
#define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
|
||||||
#define DRM_VMW_PARAM_3D 2
|
#define DRM_VMW_PARAM_3D 2
|
||||||
#define DRM_VMW_PARAM_FIFO_OFFSET 3
|
#define DRM_VMW_PARAM_HW_CAPS 3
|
||||||
#define DRM_VMW_PARAM_HW_CAPS 4
|
#define DRM_VMW_PARAM_FIFO_CAPS 4
|
||||||
#define DRM_VMW_PARAM_FIFO_CAPS 5
|
#define DRM_VMW_PARAM_MAX_FB_SIZE 5
|
||||||
#define DRM_VMW_PARAM_MAX_FB_SIZE 6
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct drm_vmw_getparam_arg
|
* struct drm_vmw_getparam_arg
|
||||||
|
Reference in New Issue
Block a user