[PATCH 10/16] drm/mgag200: Invalidate page tables when pinning a BO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When a BO gets pinned the placement may get changed. If the memory is
mapped into user space and user space has already accessed the mapped
range the page tables are set up but now point to the wrong memory.
A call to ttm_bo_unmap_virtual() will invalidate all page tables of
all mappings of this BO. When user space accesses this memory again we
will receive a page fault and are able to set up the page tables to
point to the correct physical memory.

Signed-off-by: Egbert Eich <eich@xxxxxxxx>
---
 drivers/gpu/drm/mgag200/mgag200_ttm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/mgag200/mgag200_ttm.c b/drivers/gpu/drm/mgag200/mgag200_ttm.c
index 3a2e5e2..8ceeb0c 100644
--- a/drivers/gpu/drm/mgag200/mgag200_ttm.c
+++ b/drivers/gpu/drm/mgag200/mgag200_ttm.c
@@ -321,6 +321,7 @@ int mgag200_bo_create(struct drm_device *dev, int size, int align,
 
 	mgabo->gem.driver_private = NULL;
 	mgabo->bo.bdev = &mdev->ttm.bdev;
+	mgabo->bo.bdev->dev_mapping = dev->dev_mapping;
 
 	mgag200_ttm_placement(mgabo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM);
 
@@ -359,6 +360,7 @@ int mgag200_bo_pin(struct mgag200_bo *bo, u32 pl_flag, u64 *gpu_addr)
 		if (ret)
 			return ret;
 	}
+	ttm_bo_unmap_virtual(&bo->bo);
 	bo->pin_count++;
 	if (gpu_addr)
 		*gpu_addr = mgag200_bo_gpu_offset(bo);
-- 
1.8.1.4

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux