summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTan Xiaojun <tanxiaojun@huawei.com>2017-12-25 11:43:23 +0800
committerAlex Deucher <alexander.deucher@amd.com>2017-12-27 11:34:37 -0500
commitc67fa6edc8b11afe22c88a23963170bf5f151acf (patch)
tree852082dd9eac2f8d47380e045ea18b2aa597fc60
parent727ffdf2ac6d165f611b1accdf7f6ca770595aea (diff)
downloadlinux-c67fa6edc8b11afe22c88a23963170bf5f151acf.tar.gz
linux-c67fa6edc8b11afe22c88a23963170bf5f151acf.tar.xz
drm/ttm: add ttm_bo_io_mem_pfn to check io_mem_pfn
The io_mem_pfn field was added in commit ea642c3216cb ("drm/ttm: add io_mem_pfn callback") and is called unconditionally. However, not all drivers were updated to set it. Use the ttm_bo_default_io_mem_pfn function if a driver did not set its own. And add new function ttm_bo_io_mem_pfn() as wrapper. Signed-off-by: Michal Srb <msrb@suse.com> Signed-off-by: Tan Xiaojun <tanxiaojun@huawei.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo_vm.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
index c8ebb757e36b..292d157d1a61 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
@@ -92,6 +92,17 @@ out_unlock:
return ret;
}
+static unsigned long ttm_bo_io_mem_pfn(struct ttm_buffer_object *bo,
+ unsigned long page_offset)
+{
+ struct ttm_bo_device *bdev = bo->bdev;
+
+ if (bdev->driver->io_mem_pfn)
+ return bdev->driver->io_mem_pfn(bo, page_offset);
+
+ return ttm_bo_default_io_mem_pfn(bo, page_offset);
+}
+
static int ttm_bo_vm_fault(struct vm_fault *vmf)
{
struct vm_area_struct *vma = vmf->vma;
@@ -234,7 +245,7 @@ static int ttm_bo_vm_fault(struct vm_fault *vmf)
if (bo->mem.bus.is_iomem) {
/* Iomem should not be marked encrypted */
cvma.vm_page_prot = pgprot_decrypted(cvma.vm_page_prot);
- pfn = bdev->driver->io_mem_pfn(bo, page_offset);
+ pfn = ttm_bo_io_mem_pfn(bo, page_offset);
} else {
page = ttm->pages[page_offset];
if (unlikely(!page && i == 0)) {