Skip to content

Commit 9431042

Browse files
committed
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 <[email protected]> Cc: Michal Hocko <[email protected]> Cc: "Matthew Wilcox (Oracle)" <[email protected]> Cc: "Kirill A. Shutemov" <[email protected]> Cc: Ralph Campbell <[email protected]> Cc: "Jérôme Glisse" <[email protected]> Cc: "Christian König" <[email protected]> Cc: Dan Williams <[email protected]> Signed-off-by: Thomas Hellstrom (VMware) <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Acked-by: Christian König <[email protected]>
1 parent 7546f7f commit 9431042

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

drivers/gpu/drm/drm_file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,4 +1011,5 @@ unsigned long drm_get_unmapped_area(struct file *file,
10111011
return current->mm->get_unmapped_area(file, uaddr, len, pgoff, flags);
10121012
}
10131013
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
1014+
EXPORT_SYMBOL_GPL(drm_get_unmapped_area);
10141015
#endif /* CONFIG_MMU */

drivers/gpu/drm/vmwgfx/vmwgfx_drv.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,18 @@ static void vmw_remove(struct pci_dev *pdev)
12301230
pci_disable_device(pdev);
12311231
}
12321232

1233+
static unsigned long
1234+
vmw_get_unmapped_area(struct file *file, unsigned long uaddr,
1235+
unsigned long len, unsigned long pgoff,
1236+
unsigned long flags)
1237+
{
1238+
struct drm_file *file_priv = file->private_data;
1239+
struct vmw_private *dev_priv = vmw_priv(file_priv->minor->dev);
1240+
1241+
return drm_get_unmapped_area(file, uaddr, len, pgoff, flags,
1242+
&dev_priv->vma_manager);
1243+
}
1244+
12331245
static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val,
12341246
void *ptr)
12351247
{
@@ -1401,6 +1413,7 @@ static const struct file_operations vmwgfx_driver_fops = {
14011413
.compat_ioctl = vmw_compat_ioctl,
14021414
#endif
14031415
.llseek = noop_llseek,
1416+
.get_unmapped_area = vmw_get_unmapped_area,
14041417
};
14051418

14061419
static struct drm_driver driver = {

drivers/gpu/drm/vmwgfx/vmwgfx_drv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,7 @@ extern int vmw_mmap(struct file *filp, struct vm_area_struct *vma);
915915

916916
extern void vmw_validation_mem_init_ttm(struct vmw_private *dev_priv,
917917
size_t gran);
918+
918919
/**
919920
* TTM buffer object driver - vmwgfx_ttm_buffer.c
920921
*/

drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ static int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
749749
break;
750750
case TTM_PL_VRAM:
751751
/* "On-card" video ram */
752-
man->func = &ttm_bo_manager_func;
752+
man->func = &vmw_thp_func;
753753
man->gpu_offset = 0;
754754
man->flags = TTM_MEMTYPE_FLAG_FIXED | TTM_MEMTYPE_FLAG_MAPPABLE;
755755
man->available_caching = TTM_PL_FLAG_CACHED;

0 commit comments

Comments
 (0)