diff options
-rw-r--r-- | drivers/gpu/drm/ast/ast_ttm.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/bochs/bochs_mm.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/cirrus/cirrus_ttm.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_fops.c | 25 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_stub.c | 84 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_ttm.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_gem.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_ttm.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_gem.c | 34 | ||||
-rw-r--r-- | drivers/gpu/drm/qxl/qxl_object.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/qxl/qxl_ttm.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_object.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_ttm.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 5 | ||||
-rw-r--r-- | fs/dcache.c | 1 | ||||
-rw-r--r-- | include/drm/drmP.h | 2 | ||||
-rw-r--r-- | include/drm/drm_vma_manager.h | 6 | ||||
-rw-r--r-- | include/drm/ttm/ttm_bo_driver.h | 2 |
20 files changed, 140 insertions, 66 deletions
diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c index 4ea9b17ac17a..b8246227bab0 100644 --- a/drivers/gpu/drm/ast/ast_ttm.c +++ b/drivers/gpu/drm/ast/ast_ttm.c | |||
@@ -259,7 +259,9 @@ int ast_mm_init(struct ast_private *ast) | |||
259 | 259 | ||
260 | ret = ttm_bo_device_init(&ast->ttm.bdev, | 260 | ret = ttm_bo_device_init(&ast->ttm.bdev, |
261 | ast->ttm.bo_global_ref.ref.object, | 261 | ast->ttm.bo_global_ref.ref.object, |
262 | &ast_bo_driver, DRM_FILE_PAGE_OFFSET, | 262 | &ast_bo_driver, |
263 | dev->anon_inode->i_mapping, | ||
264 | DRM_FILE_PAGE_OFFSET, | ||
263 | true); | 265 | true); |
264 | if (ret) { | 266 | if (ret) { |
265 | DRM_ERROR("Error initialising bo driver; %d\n", ret); | 267 | DRM_ERROR("Error initialising bo driver; %d\n", ret); |
@@ -324,7 +326,6 @@ int ast_bo_create(struct drm_device *dev, int size, int align, | |||
324 | } | 326 | } |
325 | 327 | ||
326 | astbo->bo.bdev = &ast->ttm.bdev; | 328 | astbo->bo.bdev = &ast->ttm.bdev; |
327 | astbo->bo.bdev->dev_mapping = dev->dev_mapping; | ||
328 | 329 | ||
329 | ast_ttm_placement(astbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); | 330 | ast_ttm_placement(astbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); |
330 | 331 | ||
diff --git a/drivers/gpu/drm/bochs/bochs_mm.c b/drivers/gpu/drm/bochs/bochs_mm.c index ce6858765b37..f488be55d650 100644 --- a/drivers/gpu/drm/bochs/bochs_mm.c +++ b/drivers/gpu/drm/bochs/bochs_mm.c | |||
@@ -225,7 +225,9 @@ int bochs_mm_init(struct bochs_device *bochs) | |||
225 | 225 | ||
226 | ret = ttm_bo_device_init(&bochs->ttm.bdev, | 226 | ret = ttm_bo_device_init(&bochs->ttm.bdev, |
227 | bochs->ttm.bo_global_ref.ref.object, | 227 | bochs->ttm.bo_global_ref.ref.object, |
228 | &bochs_bo_driver, DRM_FILE_PAGE_OFFSET, | 228 | &bochs_bo_driver, |
229 | bochs->dev->anon_inode->i_mapping, | ||
230 | DRM_FILE_PAGE_OFFSET, | ||
229 | true); | 231 | true); |
230 | if (ret) { | 232 | if (ret) { |
231 | DRM_ERROR("Error initialising bo driver; %d\n", ret); | 233 | DRM_ERROR("Error initialising bo driver; %d\n", ret); |
@@ -359,7 +361,7 @@ static int bochs_bo_create(struct drm_device *dev, int size, int align, | |||
359 | } | 361 | } |
360 | 362 | ||
361 | bochsbo->bo.bdev = &bochs->ttm.bdev; | 363 | bochsbo->bo.bdev = &bochs->ttm.bdev; |
362 | bochsbo->bo.bdev->dev_mapping = dev->dev_mapping; | 364 | bochsbo->bo.bdev->dev_mapping = dev->anon_inode->i_mapping; |
363 | 365 | ||
364 | bochs_ttm_placement(bochsbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); | 366 | bochs_ttm_placement(bochsbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); |
365 | 367 | ||
diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c b/drivers/gpu/drm/cirrus/cirrus_ttm.c index 8b37c25ff9bd..92e6b7786097 100644 --- a/drivers/gpu/drm/cirrus/cirrus_ttm.c +++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c | |||
@@ -259,7 +259,9 @@ int cirrus_mm_init(struct cirrus_device *cirrus) | |||
259 | 259 | ||
260 | ret = ttm_bo_device_init(&cirrus->ttm.bdev, | 260 | ret = ttm_bo_device_init(&cirrus->ttm.bdev, |
261 | cirrus->ttm.bo_global_ref.ref.object, | 261 | cirrus->ttm.bo_global_ref.ref.object, |
262 | &cirrus_bo_driver, DRM_FILE_PAGE_OFFSET, | 262 | &cirrus_bo_driver, |
263 | dev->anon_inode->i_mapping, | ||
264 | DRM_FILE_PAGE_OFFSET, | ||
263 | true); | 265 | true); |
264 | if (ret) { | 266 | if (ret) { |
265 | DRM_ERROR("Error initialising bo driver; %d\n", ret); | 267 | DRM_ERROR("Error initialising bo driver; %d\n", ret); |
@@ -329,7 +331,6 @@ int cirrus_bo_create(struct drm_device *dev, int size, int align, | |||
329 | } | 331 | } |
330 | 332 | ||
331 | cirrusbo->bo.bdev = &cirrus->ttm.bdev; | 333 | cirrusbo->bo.bdev = &cirrus->ttm.bdev; |
332 | cirrusbo->bo.bdev->dev_mapping = dev->dev_mapping; | ||
333 | 334 | ||
334 | cirrus_ttm_placement(cirrusbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); | 335 | cirrus_ttm_placement(cirrusbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); |
335 | 336 | ||
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 8f46fe273ba3..9b02f126fb0d 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
@@ -83,8 +83,6 @@ int drm_open(struct inode *inode, struct file *filp) | |||
83 | struct drm_minor *minor; | 83 | struct drm_minor *minor; |
84 | int retcode; | 84 | int retcode; |
85 | int need_setup = 0; | 85 | int need_setup = 0; |
86 | struct address_space *old_mapping; | ||
87 | struct address_space *old_imapping; | ||
88 | 86 | ||
89 | minor = drm_minor_acquire(iminor(inode)); | 87 | minor = drm_minor_acquire(iminor(inode)); |
90 | if (IS_ERR(minor)) | 88 | if (IS_ERR(minor)) |
@@ -93,16 +91,9 @@ int drm_open(struct inode *inode, struct file *filp) | |||
93 | dev = minor->dev; | 91 | dev = minor->dev; |
94 | if (!dev->open_count++) | 92 | if (!dev->open_count++) |
95 | need_setup = 1; | 93 | need_setup = 1; |
96 | mutex_lock(&dev->struct_mutex); | 94 | |
97 | old_imapping = inode->i_mapping; | 95 | /* share address_space across all char-devs of a single device */ |
98 | old_mapping = dev->dev_mapping; | 96 | filp->f_mapping = dev->anon_inode->i_mapping; |
99 | if (old_mapping == NULL) | ||
100 | dev->dev_mapping = &inode->i_data; | ||
101 | /* ihold ensures nobody can remove inode with our i_data */ | ||
102 | ihold(container_of(dev->dev_mapping, struct inode, i_data)); | ||
103 | inode->i_mapping = dev->dev_mapping; | ||
104 | filp->f_mapping = dev->dev_mapping; | ||
105 | mutex_unlock(&dev->struct_mutex); | ||
106 | 97 | ||
107 | retcode = drm_open_helper(inode, filp, minor); | 98 | retcode = drm_open_helper(inode, filp, minor); |
108 | if (retcode) | 99 | if (retcode) |
@@ -115,12 +106,6 @@ int drm_open(struct inode *inode, struct file *filp) | |||
115 | return 0; | 106 | return 0; |
116 | 107 | ||
117 | err_undo: | 108 | err_undo: |
118 | mutex_lock(&dev->struct_mutex); | ||
119 | filp->f_mapping = old_imapping; | ||
120 | inode->i_mapping = old_imapping; | ||
121 | iput(container_of(dev->dev_mapping, struct inode, i_data)); | ||
122 | dev->dev_mapping = old_mapping; | ||
123 | mutex_unlock(&dev->struct_mutex); | ||
124 | dev->open_count--; | 109 | dev->open_count--; |
125 | drm_minor_release(minor); | 110 | drm_minor_release(minor); |
126 | return retcode; | 111 | return retcode; |
@@ -421,7 +406,6 @@ int drm_lastclose(struct drm_device * dev) | |||
421 | 406 | ||
422 | drm_legacy_dma_takedown(dev); | 407 | drm_legacy_dma_takedown(dev); |
423 | 408 | ||
424 | dev->dev_mapping = NULL; | ||
425 | mutex_unlock(&dev->struct_mutex); | 409 | mutex_unlock(&dev->struct_mutex); |
426 | 410 | ||
427 | drm_legacy_dev_reinit(dev); | 411 | drm_legacy_dev_reinit(dev); |
@@ -537,9 +521,6 @@ int drm_release(struct inode *inode, struct file *filp) | |||
537 | } | 521 | } |
538 | } | 522 | } |
539 | 523 | ||
540 | BUG_ON(dev->dev_mapping == NULL); | ||
541 | iput(container_of(dev->dev_mapping, struct inode, i_data)); | ||
542 | |||
543 | /* drop the reference held my the file priv */ | 524 | /* drop the reference held my the file priv */ |
544 | if (file_priv->master) | 525 | if (file_priv->master) |
545 | drm_master_put(&file_priv->master); | 526 | drm_master_put(&file_priv->master); |
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index c23eaf6442ff..dc2c6095d850 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c | |||
@@ -31,8 +31,10 @@ | |||
31 | * DEALINGS IN THE SOFTWARE. | 31 | * DEALINGS IN THE SOFTWARE. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <linux/fs.h> | ||
34 | #include <linux/module.h> | 35 | #include <linux/module.h> |
35 | #include <linux/moduleparam.h> | 36 | #include <linux/moduleparam.h> |
37 | #include <linux/mount.h> | ||
36 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
37 | #include <drm/drmP.h> | 39 | #include <drm/drmP.h> |
38 | #include <drm/drm_core.h> | 40 | #include <drm/drm_core.h> |
@@ -459,6 +461,78 @@ void drm_unplug_dev(struct drm_device *dev) | |||
459 | } | 461 | } |
460 | EXPORT_SYMBOL(drm_unplug_dev); | 462 | EXPORT_SYMBOL(drm_unplug_dev); |
461 | 463 | ||
464 | /* | ||
465 | * DRM internal mount | ||
466 | * We want to be able to allocate our own "struct address_space" to control | ||
467 | * memory-mappings in VRAM (or stolen RAM, ...). However, core MM does not allow | ||
468 | * stand-alone address_space objects, so we need an underlying inode. As there | ||
469 | * is no way to allocate an independent inode easily, we need a fake internal | ||
470 | * VFS mount-point. | ||
471 | * | ||
472 | * The drm_fs_inode_new() function allocates a new inode, drm_fs_inode_free() | ||
473 | * frees it again. You are allowed to use iget() and iput() to get references to | ||
474 | * the inode. But each drm_fs_inode_new() call must be paired with exactly one | ||
475 | * drm_fs_inode_free() call (which does not have to be the last iput()). | ||
476 | * We use drm_fs_inode_*() to manage our internal VFS mount-point and share it | ||
477 | * between multiple inode-users. You could, technically, call | ||
478 | * iget() + drm_fs_inode_free() directly after alloc and sometime later do an | ||
479 | * iput(), but this way you'd end up with a new vfsmount for each inode. | ||
480 | */ | ||
481 | |||
482 | static int drm_fs_cnt; | ||
483 | static struct vfsmount *drm_fs_mnt; | ||
484 | |||
485 | static const struct dentry_operations drm_fs_dops = { | ||
486 | .d_dname = simple_dname, | ||
487 | }; | ||
488 | |||
489 | static const struct super_operations drm_fs_sops = { | ||
490 | .statfs = simple_statfs, | ||
491 | }; | ||
492 | |||
493 | static struct dentry *drm_fs_mount(struct file_system_type *fs_type, int flags, | ||
494 | const char *dev_name, void *data) | ||
495 | { | ||
496 | return mount_pseudo(fs_type, | ||
497 | "drm:", | ||
498 | &drm_fs_sops, | ||
499 | &drm_fs_dops, | ||
500 | 0x010203ff); | ||
501 | } | ||
502 | |||
503 | static struct file_system_type drm_fs_type = { | ||
504 | .name = "drm", | ||
505 | .owner = THIS_MODULE, | ||
506 | .mount = drm_fs_mount, | ||
507 | .kill_sb = kill_anon_super, | ||
508 | }; | ||
509 | |||
510 | static struct inode *drm_fs_inode_new(void) | ||
511 | { | ||
512 | struct inode *inode; | ||
513 | int r; | ||
514 | |||
515 | r = simple_pin_fs(&drm_fs_type, &drm_fs_mnt, &drm_fs_cnt); | ||
516 | if (r < 0) { | ||
517 | DRM_ERROR("Cannot mount pseudo fs: %d\n", r); | ||
518 | return ERR_PTR(r); | ||
519 | } | ||
520 | |||
521 | inode = alloc_anon_inode(drm_fs_mnt->mnt_sb); | ||
522 | if (IS_ERR(inode)) | ||
523 | simple_release_fs(&drm_fs_mnt, &drm_fs_cnt); | ||
524 | |||
525 | return inode; | ||
526 | } | ||
527 | |||
528 | static void drm_fs_inode_free(struct inode *inode) | ||
529 | { | ||
530 | if (inode) { | ||
531 | iput(inode); | ||
532 | simple_release_fs(&drm_fs_mnt, &drm_fs_cnt); | ||
533 | } | ||
534 | } | ||
535 | |||
462 | /** | 536 | /** |
463 | * drm_dev_alloc - Allocate new drm device | 537 | * drm_dev_alloc - Allocate new drm device |
464 | * @driver: DRM driver to allocate device for | 538 | * @driver: DRM driver to allocate device for |
@@ -499,6 +573,13 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver, | |||
499 | mutex_init(&dev->struct_mutex); | 573 | mutex_init(&dev->struct_mutex); |
500 | mutex_init(&dev->ctxlist_mutex); | 574 | mutex_init(&dev->ctxlist_mutex); |
501 | 575 | ||
576 | dev->anon_inode = drm_fs_inode_new(); | ||
577 | if (IS_ERR(dev->anon_inode)) { | ||
578 | ret = PTR_ERR(dev->anon_inode); | ||
579 | DRM_ERROR("Cannot allocate anonymous inode: %d\n", ret); | ||
580 | goto err_free; | ||
581 | } | ||
582 | |||
502 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 583 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
503 | ret = drm_minor_alloc(dev, DRM_MINOR_CONTROL); | 584 | ret = drm_minor_alloc(dev, DRM_MINOR_CONTROL); |
504 | if (ret) | 585 | if (ret) |
@@ -542,6 +623,8 @@ err_minors: | |||
542 | drm_minor_free(dev, DRM_MINOR_LEGACY); | 623 | drm_minor_free(dev, DRM_MINOR_LEGACY); |
543 | drm_minor_free(dev, DRM_MINOR_RENDER); | 624 | drm_minor_free(dev, DRM_MINOR_RENDER); |
544 | drm_minor_free(dev, DRM_MINOR_CONTROL); | 625 | drm_minor_free(dev, DRM_MINOR_CONTROL); |
626 | drm_fs_inode_free(dev->anon_inode); | ||
627 | err_free: | ||
545 | kfree(dev); | 628 | kfree(dev); |
546 | return NULL; | 629 | return NULL; |
547 | } | 630 | } |
@@ -556,6 +639,7 @@ static void drm_dev_release(struct kref *ref) | |||
556 | 639 | ||
557 | drm_ctxbitmap_cleanup(dev); | 640 | drm_ctxbitmap_cleanup(dev); |
558 | drm_ht_remove(&dev->map_hash); | 641 | drm_ht_remove(&dev->map_hash); |
642 | drm_fs_inode_free(dev->anon_inode); | ||
559 | 643 | ||
560 | drm_minor_free(dev, DRM_MINOR_LEGACY); | 644 | drm_minor_free(dev, DRM_MINOR_LEGACY); |
561 | drm_minor_free(dev, DRM_MINOR_RENDER); | 645 | drm_minor_free(dev, DRM_MINOR_RENDER); |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 177c20722656..9c52f68df66c 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1532,7 +1532,8 @@ i915_gem_release_mmap(struct drm_i915_gem_object *obj) | |||
1532 | if (!obj->fault_mappable) | 1532 | if (!obj->fault_mappable) |
1533 | return; | 1533 | return; |
1534 | 1534 | ||
1535 | drm_vma_node_unmap(&obj->base.vma_node, obj->base.dev->dev_mapping); | 1535 | drm_vma_node_unmap(&obj->base.vma_node, |
1536 | obj->base.dev->anon_inode->i_mapping); | ||
1536 | obj->fault_mappable = false; | 1537 | obj->fault_mappable = false; |
1537 | } | 1538 | } |
1538 | 1539 | ||
diff --git a/drivers/gpu/drm/mgag200/mgag200_ttm.c b/drivers/gpu/drm/mgag200/mgag200_ttm.c index adb5166a5dfd..5a00e90696de 100644 --- a/drivers/gpu/drm/mgag200/mgag200_ttm.c +++ b/drivers/gpu/drm/mgag200/mgag200_ttm.c | |||
@@ -259,7 +259,9 @@ int mgag200_mm_init(struct mga_device *mdev) | |||
259 | 259 | ||
260 | ret = ttm_bo_device_init(&mdev->ttm.bdev, | 260 | ret = ttm_bo_device_init(&mdev->ttm.bdev, |
261 | mdev->ttm.bo_global_ref.ref.object, | 261 | mdev->ttm.bo_global_ref.ref.object, |
262 | &mgag200_bo_driver, DRM_FILE_PAGE_OFFSET, | 262 | &mgag200_bo_driver, |
263 | dev->anon_inode->i_mapping, | ||
264 | DRM_FILE_PAGE_OFFSET, | ||
263 | true); | 265 | true); |
264 | if (ret) { | 266 | if (ret) { |
265 | DRM_ERROR("Error initialising bo driver; %d\n", ret); | 267 | DRM_ERROR("Error initialising bo driver; %d\n", ret); |
@@ -324,7 +326,6 @@ int mgag200_bo_create(struct drm_device *dev, int size, int align, | |||
324 | } | 326 | } |
325 | 327 | ||
326 | mgabo->bo.bdev = &mdev->ttm.bdev; | 328 | mgabo->bo.bdev = &mdev->ttm.bdev; |
327 | mgabo->bo.bdev->dev_mapping = dev->dev_mapping; | ||
328 | 329 | ||
329 | mgag200_ttm_placement(mgabo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); | 330 | mgag200_ttm_placement(mgabo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); |
330 | 331 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 27c3fd89e8ce..c90c0dc0afe8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c | |||
@@ -228,8 +228,6 @@ nouveau_gem_ioctl_new(struct drm_device *dev, void *data, | |||
228 | struct nouveau_bo *nvbo = NULL; | 228 | struct nouveau_bo *nvbo = NULL; |
229 | int ret = 0; | 229 | int ret = 0; |
230 | 230 | ||
231 | drm->ttm.bdev.dev_mapping = drm->dev->dev_mapping; | ||
232 | |||
233 | if (!pfb->memtype_valid(pfb, req->info.tile_flags)) { | 231 | if (!pfb->memtype_valid(pfb, req->info.tile_flags)) { |
234 | NV_ERROR(cli, "bad page flags: 0x%08x\n", req->info.tile_flags); | 232 | NV_ERROR(cli, "bad page flags: 0x%08x\n", req->info.tile_flags); |
235 | return -EINVAL; | 233 | return -EINVAL; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c index d45d50da978f..be3a3c9feafa 100644 --- a/drivers/gpu/drm/nouveau/nouveau_ttm.c +++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c | |||
@@ -376,7 +376,9 @@ nouveau_ttm_init(struct nouveau_drm *drm) | |||
376 | 376 | ||
377 | ret = ttm_bo_device_init(&drm->ttm.bdev, | 377 | ret = ttm_bo_device_init(&drm->ttm.bdev, |
378 | drm->ttm.bo_global_ref.ref.object, | 378 | drm->ttm.bo_global_ref.ref.object, |
379 | &nouveau_bo_driver, DRM_FILE_PAGE_OFFSET, | 379 | &nouveau_bo_driver, |
380 | dev->anon_inode->i_mapping, | ||
381 | DRM_FILE_PAGE_OFFSET, | ||
380 | bits <= 32 ? true : false); | 382 | bits <= 32 ? true : false); |
381 | if (ret) { | 383 | if (ret) { |
382 | NV_ERROR(drm, "error initialising bo driver, %d\n", ret); | 384 | NV_ERROR(drm, "error initialising bo driver, %d\n", ret); |
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c index 5aec3e81fe24..c8d972763889 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem.c +++ b/drivers/gpu/drm/omapdrm/omap_gem.c | |||
@@ -153,24 +153,24 @@ static struct { | |||
153 | static void evict_entry(struct drm_gem_object *obj, | 153 | static void evict_entry(struct drm_gem_object *obj, |
154 | enum tiler_fmt fmt, struct usergart_entry *entry) | 154 | enum tiler_fmt fmt, struct usergart_entry *entry) |
155 | { | 155 | { |
156 | if (obj->dev->dev_mapping) { | 156 | struct omap_gem_object *omap_obj = to_omap_bo(obj); |
157 | struct omap_gem_object *omap_obj = to_omap_bo(obj); | 157 | int n = usergart[fmt].height; |
158 | int n = usergart[fmt].height; | 158 | size_t size = PAGE_SIZE * n; |
159 | size_t size = PAGE_SIZE * n; | 159 | loff_t off = mmap_offset(obj) + |
160 | loff_t off = mmap_offset(obj) + | 160 | (entry->obj_pgoff << PAGE_SHIFT); |
161 | (entry->obj_pgoff << PAGE_SHIFT); | 161 | const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE); |
162 | const int m = 1 + ((omap_obj->width << fmt) / PAGE_SIZE); | 162 | |
163 | if (m > 1) { | 163 | if (m > 1) { |
164 | int i; | 164 | int i; |
165 | /* if stride > than PAGE_SIZE then sparse mapping: */ | 165 | /* if stride > than PAGE_SIZE then sparse mapping: */ |
166 | for (i = n; i > 0; i--) { | 166 | for (i = n; i > 0; i--) { |
167 | unmap_mapping_range(obj->dev->dev_mapping, | 167 | unmap_mapping_range(obj->dev->anon_inode->i_mapping, |
168 | off, PAGE_SIZE, 1); | 168 | off, PAGE_SIZE, 1); |
169 | off += PAGE_SIZE * m; | 169 | off += PAGE_SIZE * m; |
170 | } | ||
171 | } else { | ||
172 | unmap_mapping_range(obj->dev->dev_mapping, off, size, 1); | ||
173 | } | 170 | } |
171 | } else { | ||
172 | unmap_mapping_range(obj->dev->anon_inode->i_mapping, | ||
173 | off, size, 1); | ||
174 | } | 174 | } |
175 | 175 | ||
176 | entry->obj = NULL; | 176 | entry->obj = NULL; |
diff --git a/drivers/gpu/drm/qxl/qxl_object.c b/drivers/gpu/drm/qxl/qxl_object.c index 8691c76c5ef0..b95f144f0b49 100644 --- a/drivers/gpu/drm/qxl/qxl_object.c +++ b/drivers/gpu/drm/qxl/qxl_object.c | |||
@@ -82,8 +82,6 @@ int qxl_bo_create(struct qxl_device *qdev, | |||
82 | enum ttm_bo_type type; | 82 | enum ttm_bo_type type; |
83 | int r; | 83 | int r; |
84 | 84 | ||
85 | if (unlikely(qdev->mman.bdev.dev_mapping == NULL)) | ||
86 | qdev->mman.bdev.dev_mapping = qdev->ddev->dev_mapping; | ||
87 | if (kernel) | 85 | if (kernel) |
88 | type = ttm_bo_type_kernel; | 86 | type = ttm_bo_type_kernel; |
89 | else | 87 | else |
diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c index c7e7e6590c2b..29c02e0e857f 100644 --- a/drivers/gpu/drm/qxl/qxl_ttm.c +++ b/drivers/gpu/drm/qxl/qxl_ttm.c | |||
@@ -493,7 +493,9 @@ int qxl_ttm_init(struct qxl_device *qdev) | |||
493 | /* No others user of address space so set it to 0 */ | 493 | /* No others user of address space so set it to 0 */ |
494 | r = ttm_bo_device_init(&qdev->mman.bdev, | 494 | r = ttm_bo_device_init(&qdev->mman.bdev, |
495 | qdev->mman.bo_global_ref.ref.object, | 495 | qdev->mman.bo_global_ref.ref.object, |
496 | &qxl_bo_driver, DRM_FILE_PAGE_OFFSET, 0); | 496 | &qxl_bo_driver, |
497 | qdev->ddev->anon_inode->i_mapping, | ||
498 | DRM_FILE_PAGE_OFFSET, 0); | ||
497 | if (r) { | 499 | if (r) { |
498 | DRM_ERROR("failed initializing buffer object driver(%d).\n", r); | 500 | DRM_ERROR("failed initializing buffer object driver(%d).\n", r); |
499 | return r; | 501 | return r; |
@@ -518,8 +520,6 @@ int qxl_ttm_init(struct qxl_device *qdev) | |||
518 | ((unsigned)num_io_pages * PAGE_SIZE) / (1024 * 1024)); | 520 | ((unsigned)num_io_pages * PAGE_SIZE) / (1024 * 1024)); |
519 | DRM_INFO("qxl: %uM of Surface memory size\n", | 521 | DRM_INFO("qxl: %uM of Surface memory size\n", |
520 | (unsigned)qdev->surfaceram_size / (1024 * 1024)); | 522 | (unsigned)qdev->surfaceram_size / (1024 * 1024)); |
521 | if (unlikely(qdev->mman.bdev.dev_mapping == NULL)) | ||
522 | qdev->mman.bdev.dev_mapping = qdev->ddev->dev_mapping; | ||
523 | r = qxl_ttm_debugfs_init(qdev); | 523 | r = qxl_ttm_debugfs_init(qdev); |
524 | if (r) { | 524 | if (r) { |
525 | DRM_ERROR("Failed to init debugfs\n"); | 525 | DRM_ERROR("Failed to init debugfs\n"); |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index ca79431b2c1c..1375ff85b08a 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -145,7 +145,6 @@ int radeon_bo_create(struct radeon_device *rdev, | |||
145 | 145 | ||
146 | size = ALIGN(size, PAGE_SIZE); | 146 | size = ALIGN(size, PAGE_SIZE); |
147 | 147 | ||
148 | rdev->mman.bdev.dev_mapping = rdev->ddev->dev_mapping; | ||
149 | if (kernel) { | 148 | if (kernel) { |
150 | type = ttm_bo_type_kernel; | 149 | type = ttm_bo_type_kernel; |
151 | } else if (sg) { | 150 | } else if (sg) { |
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index d46b33a1cbcd..c8a8a5144ec1 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c | |||
@@ -707,7 +707,9 @@ int radeon_ttm_init(struct radeon_device *rdev) | |||
707 | /* No others user of address space so set it to 0 */ | 707 | /* No others user of address space so set it to 0 */ |
708 | r = ttm_bo_device_init(&rdev->mman.bdev, | 708 | r = ttm_bo_device_init(&rdev->mman.bdev, |
709 | rdev->mman.bo_global_ref.ref.object, | 709 | rdev->mman.bo_global_ref.ref.object, |
710 | &radeon_bo_driver, DRM_FILE_PAGE_OFFSET, | 710 | &radeon_bo_driver, |
711 | rdev->ddev->anon_inode->i_mapping, | ||
712 | DRM_FILE_PAGE_OFFSET, | ||
711 | rdev->need_dma32); | 713 | rdev->need_dma32); |
712 | if (r) { | 714 | if (r) { |
713 | DRM_ERROR("failed initializing buffer object driver(%d).\n", r); | 715 | DRM_ERROR("failed initializing buffer object driver(%d).\n", r); |
@@ -748,7 +750,6 @@ int radeon_ttm_init(struct radeon_device *rdev) | |||
748 | } | 750 | } |
749 | DRM_INFO("radeon: %uM of GTT memory ready.\n", | 751 | DRM_INFO("radeon: %uM of GTT memory ready.\n", |
750 | (unsigned)(rdev->mc.gtt_size / (1024 * 1024))); | 752 | (unsigned)(rdev->mc.gtt_size / (1024 * 1024))); |
751 | rdev->mman.bdev.dev_mapping = rdev->ddev->dev_mapping; | ||
752 | 753 | ||
753 | r = radeon_ttm_debugfs_init(rdev); | 754 | r = radeon_ttm_debugfs_init(rdev); |
754 | if (r) { | 755 | if (r) { |
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 214b7992a3aa..9df79ac7b8f5 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -1451,6 +1451,7 @@ EXPORT_SYMBOL(ttm_bo_device_release); | |||
1451 | int ttm_bo_device_init(struct ttm_bo_device *bdev, | 1451 | int ttm_bo_device_init(struct ttm_bo_device *bdev, |
1452 | struct ttm_bo_global *glob, | 1452 | struct ttm_bo_global *glob, |
1453 | struct ttm_bo_driver *driver, | 1453 | struct ttm_bo_driver *driver, |
1454 | struct address_space *mapping, | ||
1454 | uint64_t file_page_offset, | 1455 | uint64_t file_page_offset, |
1455 | bool need_dma32) | 1456 | bool need_dma32) |
1456 | { | 1457 | { |
@@ -1472,7 +1473,7 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev, | |||
1472 | 0x10000000); | 1473 | 0x10000000); |
1473 | INIT_DELAYED_WORK(&bdev->wq, ttm_bo_delayed_workqueue); | 1474 | INIT_DELAYED_WORK(&bdev->wq, ttm_bo_delayed_workqueue); |
1474 | INIT_LIST_HEAD(&bdev->ddestroy); | 1475 | INIT_LIST_HEAD(&bdev->ddestroy); |
1475 | bdev->dev_mapping = NULL; | 1476 | bdev->dev_mapping = mapping; |
1476 | bdev->glob = glob; | 1477 | bdev->glob = glob; |
1477 | bdev->need_dma32 = need_dma32; | 1478 | bdev->need_dma32 = need_dma32; |
1478 | bdev->val_seq = 0; | 1479 | bdev->val_seq = 0; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 0083cbf99edf..c35715f26f40 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | |||
@@ -722,7 +722,9 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
722 | 722 | ||
723 | ret = ttm_bo_device_init(&dev_priv->bdev, | 723 | ret = ttm_bo_device_init(&dev_priv->bdev, |
724 | dev_priv->bo_global_ref.ref.object, | 724 | dev_priv->bo_global_ref.ref.object, |
725 | &vmw_bo_driver, VMWGFX_FILE_PAGE_OFFSET, | 725 | &vmw_bo_driver, |
726 | dev->anon_inode->i_mapping, | ||
727 | VMWGFX_FILE_PAGE_OFFSET, | ||
726 | false); | 728 | false); |
727 | if (unlikely(ret != 0)) { | 729 | if (unlikely(ret != 0)) { |
728 | DRM_ERROR("Failed initializing TTM buffer object driver.\n"); | 730 | DRM_ERROR("Failed initializing TTM buffer object driver.\n"); |
@@ -969,7 +971,6 @@ static int vmw_driver_open(struct drm_device *dev, struct drm_file *file_priv) | |||
969 | goto out_no_shman; | 971 | goto out_no_shman; |
970 | 972 | ||
971 | file_priv->driver_priv = vmw_fp; | 973 | file_priv->driver_priv = vmw_fp; |
972 | dev_priv->bdev.dev_mapping = dev->dev_mapping; | ||
973 | 974 | ||
974 | return 0; | 975 | return 0; |
975 | 976 | ||
diff --git a/fs/dcache.c b/fs/dcache.c index 265e0ce9769c..66dc62cb766d 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -3112,6 +3112,7 @@ char *simple_dname(struct dentry *dentry, char *buffer, int buflen) | |||
3112 | end = ERR_PTR(-ENAMETOOLONG); | 3112 | end = ERR_PTR(-ENAMETOOLONG); |
3113 | return end; | 3113 | return end; |
3114 | } | 3114 | } |
3115 | EXPORT_SYMBOL(simple_dname); | ||
3115 | 3116 | ||
3116 | /* | 3117 | /* |
3117 | * Write full pathname from the root of the filesystem into the buffer. | 3118 | * Write full pathname from the root of the filesystem into the buffer. |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 319ec1eb0372..daac00a93126 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -1091,11 +1091,11 @@ struct drm_device { | |||
1091 | struct device *dev; /**< Device structure of bus-device */ | 1091 | struct device *dev; /**< Device structure of bus-device */ |
1092 | struct drm_driver *driver; /**< DRM driver managing the device */ | 1092 | struct drm_driver *driver; /**< DRM driver managing the device */ |
1093 | void *dev_private; /**< DRM driver private data */ | 1093 | void *dev_private; /**< DRM driver private data */ |
1094 | struct address_space *dev_mapping; /**< Private addr-space just for the device */ | ||
1095 | struct drm_minor *control; /**< Control node */ | 1094 | struct drm_minor *control; /**< Control node */ |
1096 | struct drm_minor *primary; /**< Primary node */ | 1095 | struct drm_minor *primary; /**< Primary node */ |
1097 | struct drm_minor *render; /**< Render node */ | 1096 | struct drm_minor *render; /**< Render node */ |
1098 | atomic_t unplugged; /**< Flag whether dev is dead */ | 1097 | atomic_t unplugged; /**< Flag whether dev is dead */ |
1098 | struct inode *anon_inode; /**< inode for private address-space */ | ||
1099 | /*@} */ | 1099 | /*@} */ |
1100 | 1100 | ||
1101 | /** \name Locks */ | 1101 | /** \name Locks */ |
diff --git a/include/drm/drm_vma_manager.h b/include/drm/drm_vma_manager.h index c18a593d1744..8cd402c73a5f 100644 --- a/include/drm/drm_vma_manager.h +++ b/include/drm/drm_vma_manager.h | |||
@@ -221,8 +221,8 @@ static inline __u64 drm_vma_node_offset_addr(struct drm_vma_offset_node *node) | |||
221 | * @file_mapping: Address space to unmap @node from | 221 | * @file_mapping: Address space to unmap @node from |
222 | * | 222 | * |
223 | * Unmap all userspace mappings for a given offset node. The mappings must be | 223 | * Unmap all userspace mappings for a given offset node. The mappings must be |
224 | * associated with the @file_mapping address-space. If no offset exists or | 224 | * associated with the @file_mapping address-space. If no offset exists |
225 | * the address-space is invalid, nothing is done. | 225 | * nothing is done. |
226 | * | 226 | * |
227 | * This call is unlocked. The caller must guarantee that drm_vma_offset_remove() | 227 | * This call is unlocked. The caller must guarantee that drm_vma_offset_remove() |
228 | * is not called on this node concurrently. | 228 | * is not called on this node concurrently. |
@@ -230,7 +230,7 @@ static inline __u64 drm_vma_node_offset_addr(struct drm_vma_offset_node *node) | |||
230 | static inline void drm_vma_node_unmap(struct drm_vma_offset_node *node, | 230 | static inline void drm_vma_node_unmap(struct drm_vma_offset_node *node, |
231 | struct address_space *file_mapping) | 231 | struct address_space *file_mapping) |
232 | { | 232 | { |
233 | if (file_mapping && drm_vma_node_has_offset(node)) | 233 | if (drm_vma_node_has_offset(node)) |
234 | unmap_mapping_range(file_mapping, | 234 | unmap_mapping_range(file_mapping, |
235 | drm_vma_node_offset_addr(node), | 235 | drm_vma_node_offset_addr(node), |
236 | drm_vma_node_size(node) << PAGE_SHIFT, 1); | 236 | drm_vma_node_size(node) << PAGE_SHIFT, 1); |
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index 32d34ebf0706..5d8aabe68f6c 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
@@ -747,6 +747,7 @@ extern int ttm_bo_device_release(struct ttm_bo_device *bdev); | |||
747 | * @bdev: A pointer to a struct ttm_bo_device to initialize. | 747 | * @bdev: A pointer to a struct ttm_bo_device to initialize. |
748 | * @glob: A pointer to an initialized struct ttm_bo_global. | 748 | * @glob: A pointer to an initialized struct ttm_bo_global. |
749 | * @driver: A pointer to a struct ttm_bo_driver set up by the caller. | 749 | * @driver: A pointer to a struct ttm_bo_driver set up by the caller. |
750 | * @mapping: The address space to use for this bo. | ||
750 | * @file_page_offset: Offset into the device address space that is available | 751 | * @file_page_offset: Offset into the device address space that is available |
751 | * for buffer data. This ensures compatibility with other users of the | 752 | * for buffer data. This ensures compatibility with other users of the |
752 | * address space. | 753 | * address space. |
@@ -758,6 +759,7 @@ extern int ttm_bo_device_release(struct ttm_bo_device *bdev); | |||
758 | extern int ttm_bo_device_init(struct ttm_bo_device *bdev, | 759 | extern int ttm_bo_device_init(struct ttm_bo_device *bdev, |
759 | struct ttm_bo_global *glob, | 760 | struct ttm_bo_global *glob, |
760 | struct ttm_bo_driver *driver, | 761 | struct ttm_bo_driver *driver, |
762 | struct address_space *mapping, | ||
761 | uint64_t file_page_offset, bool need_dma32); | 763 | uint64_t file_page_offset, bool need_dma32); |
762 | 764 | ||
763 | /** | 765 | /** |