aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/ttm/ttm_bo_vm.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2014-01-03 05:17:18 -0500
committerThomas Hellstrom <thellstrom@vmware.com>2014-01-08 03:55:05 -0500
commit667a50db0477d47fdff01c666f5ee1ce26b5264c (patch)
tree88aba940909300eba870e65ee9c694da8bca1b67 /drivers/gpu/drm/ttm/ttm_bo_vm.c
parent7dfe8b6187f43d791229b1f8eef9b7fa872f7195 (diff)
drm/ttm: Refuse to fault (prime-) imported pages
This is illegal for at least two reasons: 1) While it may work on some platforms / iommus, obtaining page pointers from mapped sg-lists is illegal, since the DMA API allows page pointer information to be destroyed in the sg mapping process. 2) TTM has no way of determining the linear kernel map caching state of the underlying pages. PTEs with conflicting caching state pointing to the same pfn is not allowed. TTM operations touching pages of imported sg-tables should be redirected through the proper dma-buf operations. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Acked-by: Daniel Vetter <daniel@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_bo_vm.c')
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo_vm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
index cdda78458885..12d7f53b7c13 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
@@ -132,6 +132,15 @@ static int ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
132 return VM_FAULT_NOPAGE; 132 return VM_FAULT_NOPAGE;
133 } 133 }
134 134
135 /*
136 * Refuse to fault imported pages. This should be handled
137 * (if at all) by redirecting mmap to the exporter.
138 */
139 if (bo->ttm && (bo->ttm->page_flags & TTM_PAGE_FLAG_SG)) {
140 retval = VM_FAULT_SIGBUS;
141 goto out_unlock;
142 }
143
135 if (bdev->driver->fault_reserve_notify) { 144 if (bdev->driver->fault_reserve_notify) {
136 ret = bdev->driver->fault_reserve_notify(bo); 145 ret = bdev->driver->fault_reserve_notify(bo);
137 switch (ret) { 146 switch (ret) {