After svm range prefetch and migrate to GPU, if GPU has no access or
access in place attribute, add GPU to range access_bitmap to be able to
update GPU page table.

Signed-off-by: Philip Yang <[email protected]>
---
 drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index d9111fea724b..3b640772d9c5 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -2869,6 +2869,17 @@ svm_range_set_attr(struct kfd_process *p, uint64_t 
start, uint64_t size,
                        continue;
                }
 
+               if (migrated && prange->prefetch_loc) {
+                       int gpuidx;
+
+                       gpuidx = kfd_process_gpuidx_from_gpuid(p,
+                                                       prange->prefetch_loc);
+                       if (gpuidx >= 0 &&
+                           !test_bit(gpuidx, prange->bitmap_access) &&
+                           !test_bit(gpuidx, prange->bitmap_aip))
+                               bitmap_set(prange->bitmap_access, gpuidx, 1);
+               }
+
                r = svm_range_validate_and_map(mm, prange, MAX_GPU_INSTANCE,
                                               true, true);
                if (r)
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to