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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
From 5fc479aed6b83723c61b655c8c9c9ec13463e9d8 Mon Sep 17 00:00:00 2001
From: Kevin Wang <Kevin1.Wang@amd.com>
Date: Thu, 22 Mar 2018 15:50:11 +0800
Subject: [PATCH 3832/4131] drm/amdkcl: fix amdgpu_bo_create func para changed
error
Change-Id: I0911c079ca37b72d20a3dd049540c58cb40f9c93
Signed-off-by: Kevin.Wang <Kevin1.Wang@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Kalyan Alle <kalyan.alle@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 13 +++++++------
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 9 +++------
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++--
3 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 0902d52..d133922 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -329,7 +329,7 @@ static int amdgpu_amdkfd_bo_validate(struct amdgpu_bo *bo, uint32_t domain,
amdgpu_ttm_placement_from_domain(bo, domain);
- ret = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
+ ret = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
if (ret)
goto validate_fail;
if (wait) {
@@ -630,7 +630,7 @@ static int init_user_pages(struct kgd_mem *mem, struct mm_struct *mm,
goto release_out;
}
amdgpu_ttm_placement_from_domain(bo, mem->domain);
- ret = ttm_bo_validate(&bo->tbo, &bo->placement, true, false);
+ ret = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
if (ret)
pr_err("%s: failed to validate BO\n", __func__);
amdgpu_bo_unreserve(bo);
@@ -1181,6 +1181,7 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
struct amdgpu_vm *avm = (struct amdgpu_vm *)vm;
uint64_t user_addr = 0;
struct sg_table *sg = NULL;
+ enum ttm_bo_type bo_type = ttm_bo_type_device;
struct amdgpu_bo *bo;
int byte_align;
u32 domain, alloc_domain;
@@ -1267,8 +1268,8 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
/* Allocate buffer object. Userptr objects need to start out
* in the CPU domain, get moved to GTT when pinned.
*/
- ret = amdgpu_bo_create(adev, size, byte_align, false,
- alloc_domain, alloc_flags, sg, NULL, &bo);
+ ret = amdgpu_bo_create(adev, size, byte_align,
+ alloc_domain, alloc_flags, bo_type, NULL, &bo);
if (ret) {
pr_debug("Failed to create BO on domain %s. ret %d\n",
domain_string(alloc_domain), ret);
@@ -1956,7 +1957,7 @@ static int update_invalid_user_pages(struct amdkfd_process_info *process_info,
if (amdgpu_bo_reserve(bo, true))
return -EAGAIN;
amdgpu_ttm_placement_from_domain(bo, AMDGPU_GEM_DOMAIN_CPU);
- ret = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
+ ret = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
amdgpu_bo_unreserve(bo);
if (ret) {
pr_err("%s: Failed to invalidate userptr BO\n",
@@ -2100,7 +2101,7 @@ static int validate_invalid_user_pages(struct amdkfd_process_info *process_info)
amdgpu_ttm_tt_set_user_pages(bo->tbo.ttm,
mem->user_pages);
amdgpu_ttm_placement_from_domain(bo, mem->domain);
- ret = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
+ ret = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
if (ret) {
pr_err("%s: failed to validate BO\n", __func__);
goto unreserve_out;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 4a75ca6..b2a36ec 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -378,16 +378,13 @@ static int amdgpu_cs_bo_validate(struct amdgpu_cs_parser *p,
retry:
amdgpu_ttm_placement_from_domain(bo, domain);
- initial_bytes_moved = atomic64_read(&adev->num_bytes_moved);
r = ttm_bo_validate(&bo->tbo, &bo->placement, &ctx);
- bytes_moved = atomic64_read(&adev->num_bytes_moved) -
- initial_bytes_moved;
- p->bytes_moved += bytes_moved;
-
+
+ p->bytes_moved += ctx.bytes_moved;
if (adev->gmc.visible_vram_size < adev->gmc.real_vram_size &&
bo->tbo.mem.mem_type == TTM_PL_VRAM &&
bo->tbo.mem.start < adev->gmc.visible_vram_size >> PAGE_SHIFT)
- p->bytes_moved_vis += bytes_moved;
+ p->bytes_moved_vis += ctx.bytes_moved;
if (unlikely(r == -ENOMEM) && domain != bo->allowed_domains) {
domain = bo->allowed_domains;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index e6946fe..650659a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1354,10 +1354,10 @@ static int amdgpu_direct_gma_init(struct amdgpu_device *adev)
size = (unsigned long)amdgpu_direct_gma_size << 20;
/* reserve in visible vram */
- r = amdgpu_bo_create(adev, size, PAGE_SIZE, true, AMDGPU_GEM_DOMAIN_VRAM,
+ r = amdgpu_bo_create(adev, size, PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM,
AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS |
AMDGPU_GEM_CREATE_TOP_DOWN,
- NULL, NULL, &abo);
+ ttm_bo_type_kernel, NULL, &abo);
if (unlikely(r))
goto error_out;
--
2.7.4
|