diff options
| author | Jiri Kosina <jkosina@suse.com> | 2024-03-13 21:17:33 +0100 | 
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.com> | 2024-03-13 21:17:33 +0100 | 
| commit | 2e21dee6a46a66e4c2ced778485e1044101edee4 (patch) | |
| tree | b9a9565cf9e3954ad316c343715b43b401c51074 /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |
| parent | 9a5b1521e2d0d7ace70c6e5eed073babcec91409 (diff) | |
| parent | 90184f90c9ac559062a04aca72e5d05730164de0 (diff) | |
Merge branch 'for-6.9/amd-sfh' into for-linus
- assorted fixes and optimizations for amd-sfh (Basavaraj Natikar)
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 69 | 
1 files changed, 15 insertions, 54 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 5bb444bb36ce..fdde7488d0ed 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -1544,6 +1544,7 @@ bool amdgpu_device_need_post(struct amdgpu_device *adev)  				return true;  			fw_ver = *((uint32_t *)adev->pm.fw->data + 69); +			release_firmware(adev->pm.fw);  			if (fw_ver < 0x00160e00)  				return true;  		} @@ -4120,23 +4121,13 @@ int amdgpu_device_init(struct amdgpu_device *adev,  				}  			}  		} else { -			switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) { -			case IP_VERSION(13, 0, 0): -			case IP_VERSION(13, 0, 7): -			case IP_VERSION(13, 0, 10): -				r = psp_gpu_reset(adev); -				break; -			default: -				tmp = amdgpu_reset_method; -				/* It should do a default reset when loading or reloading the driver, -				 * regardless of the module parameter reset_method. -				 */ -				amdgpu_reset_method = AMD_RESET_METHOD_NONE; -				r = amdgpu_asic_reset(adev); -				amdgpu_reset_method = tmp; -				break; -			} - +			tmp = amdgpu_reset_method; +			/* It should do a default reset when loading or reloading the driver, +			 * regardless of the module parameter reset_method. +			 */ +			amdgpu_reset_method = AMD_RESET_METHOD_NONE; +			r = amdgpu_asic_reset(adev); +			amdgpu_reset_method = tmp;  			if (r) {  				dev_err(adev->dev, "asic reset on init failed\n");  				goto failed; @@ -5030,7 +5021,7 @@ bool amdgpu_device_has_job_running(struct amdgpu_device *adev)  	for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {  		struct amdgpu_ring *ring = adev->rings[i]; -		if (!ring || !drm_sched_wqueue_ready(&ring->sched)) +		if (!amdgpu_ring_sched_ready(ring))  			continue;  		spin_lock(&ring->sched.job_list_lock); @@ -5169,7 +5160,7 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev,  	for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {  		struct amdgpu_ring *ring = adev->rings[i]; -		if (!ring || !drm_sched_wqueue_ready(&ring->sched)) +		if (!amdgpu_ring_sched_ready(ring))  			continue;  		/* Clear job fence from fence drv to avoid force_completion @@ -5245,7 +5236,6 @@ int amdgpu_do_asic_reset(struct list_head *device_list_handle,  	struct amdgpu_device *tmp_adev = NULL;  	bool need_full_reset, skip_hw_reset, vram_lost = false;  	int r = 0; -	bool gpu_reset_for_dev_remove = 0;  	/* Try reset handler method first */  	tmp_adev = list_first_entry(device_list_handle, struct amdgpu_device, @@ -5265,10 +5255,6 @@ int amdgpu_do_asic_reset(struct list_head *device_list_handle,  		test_bit(AMDGPU_NEED_FULL_RESET, &reset_context->flags);  	skip_hw_reset = test_bit(AMDGPU_SKIP_HW_RESET, &reset_context->flags); -	gpu_reset_for_dev_remove = -		test_bit(AMDGPU_RESET_FOR_DEVICE_REMOVE, &reset_context->flags) && -			test_bit(AMDGPU_NEED_FULL_RESET, &reset_context->flags); -  	/*  	 * ASIC reset has to be done on all XGMI hive nodes ASAP  	 * to allow proper links negotiation in FW (within 1 sec) @@ -5311,18 +5297,6 @@ int amdgpu_do_asic_reset(struct list_head *device_list_handle,  		amdgpu_ras_intr_cleared();  	} -	/* Since the mode1 reset affects base ip blocks, the -	 * phase1 ip blocks need to be resumed. Otherwise there -	 * will be a BIOS signature error and the psp bootloader -	 * can't load kdb on the next amdgpu install. -	 */ -	if (gpu_reset_for_dev_remove) { -		list_for_each_entry(tmp_adev, device_list_handle, reset_list) -			amdgpu_device_ip_resume_phase1(tmp_adev); - -		goto end; -	} -  	list_for_each_entry(tmp_adev, device_list_handle, reset_list) {  		if (need_full_reset) {  			/* post card */ @@ -5559,11 +5533,6 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,  	int i, r = 0;  	bool need_emergency_restart = false;  	bool audio_suspended = false; -	bool gpu_reset_for_dev_remove = false; - -	gpu_reset_for_dev_remove = -			test_bit(AMDGPU_RESET_FOR_DEVICE_REMOVE, &reset_context->flags) && -				test_bit(AMDGPU_NEED_FULL_RESET, &reset_context->flags);  	/*  	 * Special case: RAS triggered and full reset isn't supported @@ -5601,7 +5570,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,  	if (!amdgpu_sriov_vf(adev) && (adev->gmc.xgmi.num_physical_nodes > 1)) {  		list_for_each_entry(tmp_adev, &hive->device_list, gmc.xgmi.head) {  			list_add_tail(&tmp_adev->reset_list, &device_list); -			if (gpu_reset_for_dev_remove && adev->shutdown) +			if (adev->shutdown)  				tmp_adev->shutdown = true;  		}  		if (!list_is_first(&adev->reset_list, &device_list)) @@ -5658,7 +5627,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,  		for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {  			struct amdgpu_ring *ring = tmp_adev->rings[i]; -			if (!ring || !drm_sched_wqueue_ready(&ring->sched)) +			if (!amdgpu_ring_sched_ready(ring))  				continue;  			drm_sched_stop(&ring->sched, job ? &job->base : NULL); @@ -5686,10 +5655,6 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,  retry:	/* Rest of adevs pre asic reset from XGMI hive. */  	list_for_each_entry(tmp_adev, device_list_handle, reset_list) { -		if (gpu_reset_for_dev_remove) { -			/* Workaroud for ASICs need to disable SMC first */ -			amdgpu_device_smu_fini_early(tmp_adev); -		}  		r = amdgpu_device_pre_asic_reset(tmp_adev, reset_context);  		/*TODO Should we stop ?*/  		if (r) { @@ -5721,9 +5686,6 @@ retry:	/* Rest of adevs pre asic reset from XGMI hive. */  		r = amdgpu_do_asic_reset(device_list_handle, reset_context);  		if (r && r == -EAGAIN)  			goto retry; - -		if (!r && gpu_reset_for_dev_remove) -			goto recover_end;  	}  skip_hw_reset: @@ -5734,7 +5696,7 @@ skip_hw_reset:  		for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {  			struct amdgpu_ring *ring = tmp_adev->rings[i]; -			if (!ring || !drm_sched_wqueue_ready(&ring->sched)) +			if (!amdgpu_ring_sched_ready(ring))  				continue;  			drm_sched_start(&ring->sched, true); @@ -5779,7 +5741,6 @@ skip_sched_resume:  		amdgpu_ras_set_error_query_ready(tmp_adev, true);  	} -recover_end:  	tmp_adev = list_first_entry(device_list_handle, struct amdgpu_device,  					    reset_list);  	amdgpu_device_unlock_reset_domain(tmp_adev->reset_domain); @@ -6090,7 +6051,7 @@ pci_ers_result_t amdgpu_pci_error_detected(struct pci_dev *pdev, pci_channel_sta  		for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {  			struct amdgpu_ring *ring = adev->rings[i]; -			if (!ring || !drm_sched_wqueue_ready(&ring->sched)) +			if (!amdgpu_ring_sched_ready(ring))  				continue;  			drm_sched_stop(&ring->sched, NULL); @@ -6218,7 +6179,7 @@ void amdgpu_pci_resume(struct pci_dev *pdev)  	for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {  		struct amdgpu_ring *ring = adev->rings[i]; -		if (!ring || !drm_sched_wqueue_ready(&ring->sched)) +		if (!amdgpu_ring_sched_ready(ring))  			continue;  		drm_sched_start(&ring->sched, true);  | 
