drm/vmwgfx: Hook up the helpers to align buffer objects

Start using the helpers that align buffer object user-space addresses and
buffer object vram addresses to huge page boundaries.
This is to improve the chances of allowing huge page-table entries.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Ralph Campbell <rcampbell@nvidia.com>
Cc: "Jérôme Glisse" <jglisse@redhat.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarThomas Hellstrom (VMware) <thomas_os@shipmail.org>
Reviewed-by: default avatarRoland Scheidegger <sroland@vmware.com>
Acked-by: default avatarChristian König <christian.koenig@amd.com>
parent 7546f7ff
...@@ -1011,4 +1011,5 @@ unsigned long drm_get_unmapped_area(struct file *file, ...@@ -1011,4 +1011,5 @@ unsigned long drm_get_unmapped_area(struct file *file,
return current->mm->get_unmapped_area(file, uaddr, len, pgoff, flags); return current->mm->get_unmapped_area(file, uaddr, len, pgoff, flags);
} }
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
EXPORT_SYMBOL_GPL(drm_get_unmapped_area);
#endif /* CONFIG_MMU */ #endif /* CONFIG_MMU */
...@@ -1230,6 +1230,18 @@ static void vmw_remove(struct pci_dev *pdev) ...@@ -1230,6 +1230,18 @@ static void vmw_remove(struct pci_dev *pdev)
pci_disable_device(pdev); pci_disable_device(pdev);
} }
static unsigned long
vmw_get_unmapped_area(struct file *file, unsigned long uaddr,
unsigned long len, unsigned long pgoff,
unsigned long flags)
{
struct drm_file *file_priv = file->private_data;
struct vmw_private *dev_priv = vmw_priv(file_priv->minor->dev);
return drm_get_unmapped_area(file, uaddr, len, pgoff, flags,
&dev_priv->vma_manager);
}
static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val, static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val,
void *ptr) void *ptr)
{ {
...@@ -1401,6 +1413,7 @@ static const struct file_operations vmwgfx_driver_fops = { ...@@ -1401,6 +1413,7 @@ static const struct file_operations vmwgfx_driver_fops = {
.compat_ioctl = vmw_compat_ioctl, .compat_ioctl = vmw_compat_ioctl,
#endif #endif
.llseek = noop_llseek, .llseek = noop_llseek,
.get_unmapped_area = vmw_get_unmapped_area,
}; };
static struct drm_driver driver = { static struct drm_driver driver = {
......
...@@ -915,6 +915,7 @@ extern int vmw_mmap(struct file *filp, struct vm_area_struct *vma); ...@@ -915,6 +915,7 @@ extern int vmw_mmap(struct file *filp, struct vm_area_struct *vma);
extern void vmw_validation_mem_init_ttm(struct vmw_private *dev_priv, extern void vmw_validation_mem_init_ttm(struct vmw_private *dev_priv,
size_t gran); size_t gran);
/** /**
* TTM buffer object driver - vmwgfx_ttm_buffer.c * TTM buffer object driver - vmwgfx_ttm_buffer.c
*/ */
......
...@@ -749,7 +749,7 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, ...@@ -749,7 +749,7 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
break; break;
case TTM_PL_VRAM: case TTM_PL_VRAM:
/* "On-card" video ram */ /* "On-card" video ram */
man->func = &ttm_bo_manager_func; man->func = &vmw_thp_func;
man->gpu_offset = 0; man->gpu_offset = 0;
man->flags = TTM_MEMTYPE_FLAG_FIXED | TTM_MEMTYPE_FLAG_MAPPABLE; man->flags = TTM_MEMTYPE_FLAG_FIXED | TTM_MEMTYPE_FLAG_MAPPABLE;
man->available_caching = TTM_PL_FLAG_CACHED; man->available_caching = TTM_PL_FLAG_CACHED;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment