aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0842-drm-amdgpu-Fix-non-contig-ptrace-VRAM-access-crossin.patch
blob: 5d771e8ae1b9aa806aa7adc0e01fe25147fd6c09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From 2e34be59854020f8e0bb451588bda0eeb731dc20 Mon Sep 17 00:00:00 2001
From: Felix Kuehling <Felix.Kuehling@amd.com>
Date: Thu, 22 Jun 2017 15:04:01 -0400
Subject: [PATCH 0842/4131] drm/amdgpu: Fix non-contig ptrace VRAM access
 crossing nodes

Fix ptrace VRAM access when crossing non-contiguous VRAM node
boundaries.

Change-Id: I9c876145d0087a78fc17f0a76b9ac47f55a4f35b
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 57904b9..94e7611 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1617,6 +1617,10 @@ static int amdgpu_ttm_bo_access_vram(struct amdgpu_bo *abo,
 		buf = (uint8_t *)buf + bytes;
 		pos += bytes;
 		len -= bytes;
+		if (pos >= (nodes->start + nodes->size) << PAGE_SHIFT) {
+			++nodes;
+			pos = (nodes->start << PAGE_SHIFT);
+		}
 	}
 
 	return result;
-- 
2.7.4