diff options
| author | Dave Airlie <[email protected]> | 2022-07-12 11:07:30 +1000 | 
|---|---|---|
| committer | Dave Airlie <[email protected]> | 2022-07-12 11:07:32 +1000 | 
| commit | 344feb7ccf764756937cfd74fa4ac5caba069c99 (patch) | |
| tree | b86c7eb43878b310c31702094763d130b7e31dc5 /drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | |
| parent | c6a3d73592ae20f2f6306f823aa5121c83c88223 (diff) | |
| parent | c5da61cf5bab30059f22ea368702c445ee87171a (diff) | |
Merge tag 'amd-drm-next-5.20-2022-07-05' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-next-5.20-2022-07-05:
amdgpu:
- Various spelling and grammer fixes
- Various eDP fixes
- Various DMCUB fixes
- VCN fixes
- GMC 11 fixes
- RAS fixes
- TMZ support for GC 10.3.7
- GPUVM TLB flush fixes
- SMU 13.0.x updates
- DCN 3.2 Support
- DCN 3.2.1 Support
- MES updates
- GFX11 modifiers support
- USB-C fixes
- MMHUB 3.0.1 support
- SDMA 6.0 doorbell fixes
- Initial devcoredump support
- Enable high priority gfx queue on asics which support it
- Enable GPU reset for SMU 13.0.4
- OLED display fixes
- MPO fixes
- DC frame size fixes
- ASPM support for PCIE 7.4/7.6
- GPU reset support for SMU 13.0.0
- GFX11 updates
- VCN JPEG fix
- BACO support for SMU 13.0.7
- VCN instance handling fix
- GFX8 GPUVM TLB flush fix
- GPU reset rework
- VCN 4.0.2 support
- GTT size fixes
- DP link training fixes
- LSDMA 6.0.1 support
- Various backlight fixes
- Color encoding fixes
- Backlight config cleanup
- VCN 4.x unified queue cleanup
amdkfd:
- MMU notifier fixes
- Updates for GC 10.3.6 and 10.3.7
- P2P DMA support using dma-buf
- Add available memory IOCTL
- SDMA 6.0.1 fix
- MES fixes
- HMM profiler support
radeon:
- License fix
- Backlight config cleanup
UAPI:
- Add available memory IOCTL to amdkfd
  Proposed userspace: https://www.mail-archive.com/[email protected]/msg75743.html
- HMM profiler support for amdkfd
  Proposed userspace: https://lists.freedesktop.org/archives/amd-gfx/2022-June/080805.html
Signed-off-by: Dave Airlie <[email protected]>
From: Alex Deucher <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 48 | 
1 files changed, 44 insertions, 4 deletions
| diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c index d16c8c1f72db..39597ab807d1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c @@ -39,6 +39,7 @@  #include <drm/drm_drv.h>  #include "amdgpu.h"  #include "amdgpu_trace.h" +#include "amdgpu_reset.h"  /*   * Fences @@ -163,11 +164,16 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f, struct amd  	if (job && job->job_run_counter) {  		/* reinit seq for resubmitted jobs */  		fence->seqno = seq; +		/* TO be inline with external fence creation and other drivers */ +		dma_fence_get(fence);  	} else { -		if (job) +		if (job) {  			dma_fence_init(fence, &amdgpu_job_fence_ops,  				       &ring->fence_drv.lock,  				       adev->fence_context + ring->idx, seq); +			/* Against remove in amdgpu_job_{free, free_cb} */ +			dma_fence_get(fence); +		}  		else  			dma_fence_init(fence, &amdgpu_fence_ops,  				       &ring->fence_drv.lock, @@ -531,6 +537,24 @@ void amdgpu_fence_driver_hw_fini(struct amdgpu_device *adev)  	}  } +/* Will either stop and flush handlers for amdgpu interrupt or reanble it */ +void amdgpu_fence_driver_isr_toggle(struct amdgpu_device *adev, bool stop) +{ +	int i; + +	for (i = 0; i < AMDGPU_MAX_RINGS; i++) { +		struct amdgpu_ring *ring = adev->rings[i]; + +		if (!ring || !ring->fence_drv.initialized || !ring->fence_drv.irq_src) +			continue; + +		if (stop) +			disable_irq(adev->irq.irq); +		else +			enable_irq(adev->irq.irq); +	} +} +  void amdgpu_fence_driver_sw_fini(struct amdgpu_device *adev)  {  	unsigned int i, j; @@ -594,8 +618,10 @@ void amdgpu_fence_driver_clear_job_fences(struct amdgpu_ring *ring)  	for (i = 0; i <= ring->fence_drv.num_fences_mask; i++) {  		ptr = &ring->fence_drv.fences[i];  		old = rcu_dereference_protected(*ptr, 1); -		if (old && old->ops == &amdgpu_job_fence_ops) +		if (old && old->ops == &amdgpu_job_fence_ops) {  			RCU_INIT_POINTER(*ptr, NULL); +			dma_fence_put(old); +		}  	}  } @@ -798,7 +824,10 @@ static int gpu_recover_get(void *data, u64 *val)  		return 0;  	} -	*val = amdgpu_device_gpu_recover(adev, NULL); +	if (amdgpu_reset_domain_schedule(adev->reset_domain, &adev->reset_work)) +		flush_work(&adev->reset_work); + +	*val = atomic_read(&adev->reset_domain->reset_res);  	pm_runtime_mark_last_busy(dev->dev);  	pm_runtime_put_autosuspend(dev->dev); @@ -810,6 +839,14 @@ DEFINE_SHOW_ATTRIBUTE(amdgpu_debugfs_fence_info);  DEFINE_DEBUGFS_ATTRIBUTE(amdgpu_debugfs_gpu_recover_fops, gpu_recover_get, NULL,  			 "%lld\n"); +static void amdgpu_debugfs_reset_work(struct work_struct *work) +{ +	struct amdgpu_device *adev = container_of(work, struct amdgpu_device, +						  reset_work); + +	amdgpu_device_gpu_recover(adev, NULL); +} +  #endif  void amdgpu_debugfs_fence_init(struct amdgpu_device *adev) @@ -821,9 +858,12 @@ void amdgpu_debugfs_fence_init(struct amdgpu_device *adev)  	debugfs_create_file("amdgpu_fence_info", 0444, root, adev,  			    &amdgpu_debugfs_fence_info_fops); -	if (!amdgpu_sriov_vf(adev)) +	if (!amdgpu_sriov_vf(adev)) { + +		INIT_WORK(&adev->reset_work, amdgpu_debugfs_reset_work);  		debugfs_create_file("amdgpu_gpu_recover", 0444, root, adev,  				    &amdgpu_debugfs_gpu_recover_fops); +	}  #endif  } |