Skip to contentSkip to conversation

drm/amdgpu: fix mes packet params issue when flush hdp.

PATCH Superseded chong li 1 participant 1 message Dec 10, 2025

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

chong li

author
#0 lore raw

PATCH v3 1/1 drm/amdgpu: fix mes packet params issue when flush hdp.

v3:
Unify the get_ref_and_mask function in amdgpu_gfx_funcs, to support both GFX11 and earlier generations

v2:
place "get_ref_and_mask" in amdgpu_gfx_funcs instead of amdgpu_ring, since this function only assigns the cp entry.

v1:
both gfx ring and mes ring use cp0 to flush hdp, cause conflict.

use function get_ref_and_mask to assign the cp entry. reassign mes to use cp8 instead.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h |  2 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 13 ++++-
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c  | 60 ++++++++++++++++-------
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c  | 64 ++++++++++++++++++-------
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c  | 64 ++++++++++++++++++-------
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   | 59 +++++++++++++++++------
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 59 ++++++++++++++++-------
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 60 ++++++++++++++++-------
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 60 ++++++++++++++++-------
 9 files changed, 327 insertions(+), 114 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +2 -0
index efd61a1ccc66..090714127cba 100644
@@ -356,6 +356,8 @@ struct amdgpu_gfx_funcs {
 				     int num_xccs_per_xcp);
 	int (*ih_node_to_logical_xcc)(struct amdgpu_device *adev, int ih_node);
 	int (*get_xccs_per_xcp)(struct amdgpu_device *adev);
+	void (*get_ref_and_mask)(struct amdgpu_ring *ring,
+				uint32_t *ref_and_mask, uint32_t *reg_mem_engine);
 };
 
 struct sq_work {
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +11 -2
index 895b841b9626..77d25317973e 100644
@@ -556,11 +556,20 @@ int amdgpu_mes_reg_write_reg_wait(struct amdgpu_device *adev,
 
 int amdgpu_mes_hdp_flush(struct amdgpu_device *adev)
 {
-	uint32_t hdp_flush_req_offset, hdp_flush_done_offset, ref_and_mask;
+	uint32_t hdp_flush_req_offset, hdp_flush_done_offset;
+	struct amdgpu_ring *mes_ring;
+	uint32_t ref_and_mask = 0, reg_mem_engine = 0;
 
+	if (!adev->gfx.funcs->get_ref_and_mask) {
+		dev_err(adev->dev, "mes hdp flush is not supported.\n");
+		return -EINVAL;
+	}
+
+	mes_ring = &adev->mes.ring[0];
 	hdp_flush_req_offset = adev->nbio.funcs->get_hdp_flush_req_offset(adev);
 	hdp_flush_done_offset = adev->nbio.funcs->get_hdp_flush_done_offset(adev);
-	ref_and_mask = adev->nbio.hdp_flush_reg->ref_and_mask_cp0;
+
+	adev->gfx.funcs->get_ref_and_mask(mes_ring, &ref_and_mask, &reg_mem_engine);
 
 	return amdgpu_mes_reg_write_reg_wait(adev, hdp_flush_req_offset, hdp_flush_done_offset,
 					     ref_and_mask, ref_and_mask, 0);
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +44 -16

81 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +48 -16

85 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +48 -16

85 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +44 -15

79 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +42 -17

80 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +44 -16

81 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +44 -16

81 lines not on this page · raw message

Signature · 1 line
2.48.1