gart table recovery V2
Subsystems (2)
save gtt info by list, re-bind gtt after gpu reset. V2:
spinlock instead of mutex.
rename function name.
recover gart table ahead of ring test.
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1472549549-18987-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org
PATCH 1/2 drm/amdgpu: link all gtt when binding them V2
V2:
spin lock instead of mutex for gtt list
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 9 +++++++++ 3 files changed, 16 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +4 -0
@@ -2117,6 +2117,10 @@ struct amdgpu_device {/* link all shadow bo */ struct list_head shadow_list;struct mutex shadow_list_lock; +/* link all gtt */ +spinlock_t gtt_list_lock; +struct list_head gtt_list; + };bool amdgpu_device_is_px (struct drm_device *dev);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
@@ -1591,6 +1591,9 @@ int amdgpu_device_init(struct amdgpu_device *adev,INIT_LIST_HEAD (&adev->shadow_list);mutex_init (&adev->shadow_list_lock); +INIT_LIST_HEAD (&adev->gtt_list); +spin_lock_init (&adev->gtt_list_lock); + adev->rmmio_base =pci_resource_start (adev->pdev,5 ); adev->rmmio_size =pci_resource_len (adev->pdev,5 ); adev->rmmio =ioremap (adev->rmmio_base, adev->rmmio_size);
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +9 -0
@@ -521,6 +521,7 @@ struct amdgpu_ttm_tt {spinlock_t guptasklock;struct list_head guptasks;atomic_t mmu_invalidations; +struct list_head list; };int amdgpu_ttm_tt_get_user_pages (struct ttm_tt *ttm,struct page **pages)
@@ -667,6 +668,9 @@ static int amdgpu_ttm_backend_bind(struct ttm_tt *ttm, ttm->num_pages, (unsigned)gtt->offset);return r; } +spin_lock (>t->adev->gtt_list_lock); +list_add_tail (>t->list, >t->adev->gtt_list); +spin_unlock (>t->adev->gtt_list_lock);return 0 ; }
@@ -681,6 +685,10 @@ static int amdgpu_ttm_backend_unbind(struct ttm_tt *ttm)if (gtt->userptr)amdgpu_ttm_tt_unpin_userptr (ttm); +spin_lock (>t->adev->gtt_list_lock); +list_del_init (>t->list); +spin_unlock (>t->adev->gtt_list_lock); +return 0 ; }
@@ -717,6 +725,7 @@ static struct ttm_tt *amdgpu_ttm_tt_create(struct ttm_bo_device *bdev,kfree (gtt);return NULL ; } +INIT_LIST_HEAD (>t->list);return >t->ttm.ttm; }
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/2 drm/amdgpu: add gart recovery by gtt list V2
In reply to a message not in the archiveV2:
a. gart recovery should be ahead of ring test.
b. rename to amdgpu_ttm_recover_gart
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -620,6 +620,7 @@ void amdgpu_gart_unbind(struct amdgpu_device *adev, unsigned offset,int amdgpu_gart_bind (struct amdgpu_device *adev,unsigned offset,int pages,struct page **pagelist,dma_addr_t *dma_addr,uint32_t flags); +int amdgpu_ttm_recover_gart (struct amdgpu_device *adev);/* * GPU MC structures, functions & helpers
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
@@ -2230,6 +2230,11 @@ retry: }if (!r) {amdgpu_irq_gpu_reset_resume_helper (adev); +if (need_full_reset &&amdgpu_need_backup (adev)) { + r =amdgpu_ttm_recover_gart (adev); +if (r) +DRM_ERROR ("gart recovery failed!!!\n" ); + } r =amdgpu_ib_ring_tests (adev);if (r) {dev_err (adev->dev,"ib ring test failed (%d).\n" , r);
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +25 -0
@@ -674,6 +674,31 @@ static int amdgpu_ttm_backend_bind(struct ttm_tt *ttm,return 0 ; } +int amdgpu_ttm_recover_gart (struct amdgpu_device *adev) +{ +struct amdgpu_ttm_tt *gtt, *tmp; +struct ttm_mem_reg bo_mem; +uint32_t flags; +int r; + + bo_mem.mem_type =TTM_PL_TT ; +spin_lock (&adev->gtt_list_lock); +list_for_each_entry_safe (gtt, tmp, &adev->gtt_list, list) { + flags =amdgpu_ttm_tt_pte_flags (gtt->adev, >t->ttm.ttm, &bo_mem); + r =amdgpu_gart_bind (adev, gtt->offset, gtt->ttm.ttm.num_pages, + gtt->ttm.ttm.pages, gtt->ttm.dma_address, + flags); +if (r) { +spin_unlock (&adev->gtt_list_lock); +DRM_ERROR ("failed to bind %lu pages at 0x%08X\n" , + gtt->ttm.ttm.num_pages, (unsigned )gtt->offset); +return r; + } + } +spin_unlock (&adev->gtt_list_lock); +return 0 ; +} +static int amdgpu_ttm_backend_unbind (struct ttm_tt *ttm) {struct amdgpu_ttm_tt *gtt = (void *)ttm;
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König
Reviewed-byRegards,
Christian.
Am 30.08.2016 um 11:32 schrieb Chunming Zhou:
Quoted 10 lines
save gtt info by list, re-bind gtt after gpu reset. V2:
spinlock instead of mutex.
rename function name.
recover gart table ahead of ring test._______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx