Am 20.10.2017 um 05:33 schrieb Monk Liu: > cleanups, now only operate on the given ring > > Change-Id: I42ee081696ac348660d38be68807f34090ffcce2 > Signed-off-by: Monk Liu <Monk.Liu at amd.com> Reviewed-by: Christian König <christian.koenig at amd.com> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +++--- > drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 29 +++++++---------------------- > drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 3 +-- > 3 files changed, 11 insertions(+), 27 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > index 99acf29..dae1e5b 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > @@ -2871,7 +2871,7 @@ int amdgpu_sriov_gpu_reset(struct amdgpu_device *adev, struct amdgpu_job *job) > amd_sched_hw_job_reset(&ring->sched); > > /* after all hw jobs are reset, hw fence is meaningless, so force_completion */ > - amdgpu_fence_driver_force_completion_ring(ring); > + amdgpu_fence_driver_force_completion(ring); > } > > /* request to take full control of GPU before re-initialization */ > @@ -2990,9 +2990,9 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev) > continue; > kthread_park(ring->sched.thread); > amd_sched_hw_job_reset(&ring->sched); > + /* after all hw jobs are reset, hw fence is meaningless, so force_completion */ > + amdgpu_fence_driver_force_completion(ring); > } > - /* after all hw jobs are reset, hw fence is meaningless, so force_completion */ > - amdgpu_fence_driver_force_completion(adev); > > need_full_reset = amdgpu_need_full_reset(adev); > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c > index fb9f88ef..2167dac 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c > @@ -499,7 +499,7 @@ void amdgpu_fence_driver_fini(struct amdgpu_device *adev) > r = amdgpu_fence_wait_empty(ring); > if (r) { > /* no need to trigger GPU reset as we are unloading */ > - amdgpu_fence_driver_force_completion(adev); > + amdgpu_fence_driver_force_completion(ring); > } > amdgpu_irq_put(adev, ring->fence_drv.irq_src, > ring->fence_drv.irq_type); > @@ -534,7 +534,7 @@ void amdgpu_fence_driver_suspend(struct amdgpu_device *adev) > r = amdgpu_fence_wait_empty(ring); > if (r) { > /* delay GPU reset to resume */ > - amdgpu_fence_driver_force_completion(adev); > + amdgpu_fence_driver_force_completion(ring); > } > > /* disable the interrupt */ > @@ -571,30 +571,15 @@ void amdgpu_fence_driver_resume(struct amdgpu_device *adev) > } > > /** > - * amdgpu_fence_driver_force_completion - force all fence waiter to complete > + * amdgpu_fence_driver_force_completion - force signal latest fence of ring > * > - * @adev: amdgpu device pointer > + * @ring: fence of the ring to signal > * > - * In case of GPU reset failure make sure no process keep waiting on fence > - * that will never complete. > */ > -void amdgpu_fence_driver_force_completion(struct amdgpu_device *adev) > +void amdgpu_fence_driver_force_completion(struct amdgpu_ring *ring) > { > - int i; > - > - for (i = 0; i < AMDGPU_MAX_RINGS; i++) { > - struct amdgpu_ring *ring = adev->rings[i]; > - if (!ring || !ring->fence_drv.initialized) > - continue; > - > - amdgpu_fence_write(ring, ring->fence_drv.sync_seq); > - } > -} > - > -void amdgpu_fence_driver_force_completion_ring(struct amdgpu_ring *ring) > -{ > - if (ring) > - amdgpu_fence_write(ring, ring->fence_drv.sync_seq); > + amdgpu_fence_write(ring, ring->fence_drv.sync_seq); > + amdgpu_fence_process(ring); > } > > /* > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h > index b18c2b9..a6b89e3 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h > @@ -79,8 +79,7 @@ struct amdgpu_fence_driver { > > int amdgpu_fence_driver_init(struct amdgpu_device *adev); > void amdgpu_fence_driver_fini(struct amdgpu_device *adev); > -void amdgpu_fence_driver_force_completion(struct amdgpu_device *adev); > -void amdgpu_fence_driver_force_completion_ring(struct amdgpu_ring *ring); > +void amdgpu_fence_driver_force_completion(struct amdgpu_ring *ring); > > int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring, > unsigned num_hw_submission);