Skip to contentSkip to conversation

drm/amdgpu: Add reset_context flag for host FLR

PATCH Superseded Yunxiang Li 1 participant 1 message Apr 22, 2024

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Add reset_context flag for host FLR

Using the job pointer to check if the FLR comes from the host is wrong, there are other reset triggers that pass NULL for job. So add a flag explicitly for host triggered reset.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h  | 1 +
 drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c      | 1 +
 drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c      | 1 +
 drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c      | 1 +
 5 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -1
index f8a34db5d9e3..ebf2042f3fb7 100644
@@ -5678,6 +5678,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
 	int i, r = 0;
 	bool need_emergency_restart = false;
 	bool audio_suspended = false;
+	bool from_hypervisor = false;
 
 	/*
 	 * Special case: RAS triggered and full reset isn't supported
@@ -5825,7 +5826,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
 	/* Actual ASIC resets if needed.*/
 	/* Host driver will handle XGMI hive reset for SRIOV */
 	if (amdgpu_sriov_vf(adev)) {
-		r = amdgpu_device_reset_sriov(adev, job ? false : true);
+		from_hypervisor = test_bit(AMDGPU_HOST_FLR, &reset_context.flags);
+		r = amdgpu_device_reset_sriov(adev, from_hypervisor);
 		if (r)
 			adev->asic_reset_res = r;
 
drivers/gpu/drm/amd/amdgpu/amdgpu_reset.h +1 -0
index b11d190ece53..5a9cc043b858 100644
@@ -33,6 +33,7 @@ enum AMDGPU_RESET_FLAGS {
 	AMDGPU_NEED_FULL_RESET = 0,
 	AMDGPU_SKIP_HW_RESET = 1,
 	AMDGPU_SKIP_COREDUMP = 2,
+	AMDGPU_HOST_FLR = 3,
 };
 
 struct amdgpu_reset_context {
drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c +1 -0
index 0c7275bca8f7..7275b5ca6f93 100644
@@ -292,6 +292,7 @@ static void xgpu_ai_mailbox_flr_work(struct work_struct *work)
 		reset_context.method = AMD_RESET_METHOD_NONE;
 		reset_context.reset_req_dev = adev;
 		clear_bit(AMDGPU_NEED_FULL_RESET, &reset_context.flags);
+		set_bit(AMDGPU_HOST_FLR, &reset_context.flags);
 
 		amdgpu_device_gpu_recover(adev, NULL, &reset_context);
 	}
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c +1 -0
index aba00d961627..811fe7a6e4fb 100644
@@ -328,6 +328,7 @@ static void xgpu_nv_mailbox_flr_work(struct work_struct *work)
 		reset_context.method = AMD_RESET_METHOD_NONE;
 		reset_context.reset_req_dev = adev;
 		clear_bit(AMDGPU_NEED_FULL_RESET, &reset_context.flags);
+		set_bit(AMDGPU_HOST_FLR, &reset_context.flags);
 
 		amdgpu_device_gpu_recover(adev, NULL, &reset_context);
 	}
drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c +1 -0
index 59f53c743362..95c225083939 100644
@@ -529,6 +529,7 @@ static void xgpu_vi_mailbox_flr_work(struct work_struct *work)
 		reset_context.method = AMD_RESET_METHOD_NONE;
 		reset_context.reset_req_dev = adev;
 		clear_bit(AMDGPU_NEED_FULL_RESET, &reset_context.flags);
+		set_bit(AMDGPU_HOST_FLR, &reset_context.flags);
 
 		amdgpu_device_gpu_recover(adev, NULL, &reset_context);
 	}
Signature · 1 line
2.34.1