Skip to contentSkip to conversation

drm/amdgpu: update the handle ptr in dump_ip_state

PATCH In review Sunil Khatri 2 participants 3 messages Sep 25, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amdgpu: update the handle ptr in dump_ip_state

Update the ptr handle to amdgpu_ip_block ptr in all the functions.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_job.c    | 2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c     | 4 ++--
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c     | 4 ++--
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c     | 4 ++--
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c      | 4 ++--
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c    | 4 ++--
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c     | 4 ++--
 drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c   | 4 ++--
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c     | 4 ++--
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c     | 4 ++--
 drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c     | 4 ++--
 drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c     | 4 ++--
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c      | 4 ++--
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c      | 4 ++--
 drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c      | 4 ++--
 drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c      | 4 ++--
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c      | 4 ++--
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c    | 4 ++--
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c    | 4 ++--
 drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c    | 4 ++--
 drivers/gpu/drm/amd/include/amd_shared.h   | 4 +++-
 22 files changed, 43 insertions(+), 41 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
index c4d4fbcfca7a..c5827171b596 100644
@@ -5380,7 +5380,7 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev,
 			for (i = 0; i < tmp_adev->num_ip_blocks; i++)
 				if (tmp_adev->ip_blocks[i].version->funcs->dump_ip_state)
 					tmp_adev->ip_blocks[i].version->funcs
-						->dump_ip_state((void *)tmp_adev);
+						->dump_ip_state((void *)&tmp_adev->ip_blocks[i]);
 			dev_info(tmp_adev->dev, "Dumping IP State Completed\n");
 		}
 
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1 -1
index 13a3604cf107..fdadbe49c913 100644
@@ -42,7 +42,7 @@ static void amdgpu_job_do_core_dump(struct amdgpu_device *adev,
 	for (i = 0; i < adev->num_ip_blocks; i++)
 		if (adev->ip_blocks[i].version->funcs->dump_ip_state)
 			adev->ip_blocks[i].version->funcs
-				->dump_ip_state((void *)adev);
+				->dump_ip_state((void *)&adev->ip_blocks[i]);
 	dev_info(adev->dev, "Dumping IP State Completed\n");
 
 	amdgpu_coredump(adev, true, false, job);
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -2
index 45ed97038df0..61300eb88ab4 100644
@@ -9632,9 +9632,9 @@ static void gfx_v10_ip_print(void *handle, struct drm_printer *p)
 	}
 }
 
-static void gfx_v10_ip_dump(void *handle)
+static void gfx_v10_ip_dump(struct amdgpu_ip_block *ip_block)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	uint32_t i, j, k, reg, index = 0;
 	uint32_t reg_count = ARRAY_SIZE(gc_reg_list_10_1);
 
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +2 -2
index d3e8be82a172..36dc6af70330 100644
@@ -6703,9 +6703,9 @@ static void gfx_v11_ip_print(void *handle, struct drm_printer *p)
 	}
 }
 
-static void gfx_v11_ip_dump(void *handle)
+static void gfx_v11_ip_dump(struct amdgpu_ip_block *ip_block)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	uint32_t i, j, k, reg, index = 0;
 	uint32_t reg_count = ARRAY_SIZE(gc_reg_list_11_0);
 
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +2 -2
index 47b47d21f464..13baa6868a78 100644
@@ -5102,9 +5102,9 @@ static void gfx_v12_ip_print(void *handle, struct drm_printer *p)
 	}
 }
 
-static void gfx_v12_ip_dump(void *handle)
+static void gfx_v12_ip_dump(struct amdgpu_ip_block *ip_block)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	uint32_t i, j, k, reg, index = 0;
 	uint32_t reg_count = ARRAY_SIZE(gc_reg_list_12_0);
 
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index 23f0573ae47b..4d8db3dd3f37 100644
@@ -7356,9 +7356,9 @@ static void gfx_v9_ip_print(void *handle, struct drm_printer *p)
 
 }
 
-static void gfx_v9_ip_dump(void *handle)
+static void gfx_v9_ip_dump(struct amdgpu_ip_block *ip_block)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	uint32_t i, j, k, reg, index = 0;
 	uint32_t reg_count = ARRAY_SIZE(gc_reg_list_9);
 
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +2 -2
index c100845409f7..f973d922e6b3 100644
@@ -4643,9 +4643,9 @@ static void gfx_v9_4_3_ip_print(void *handle, struct drm_printer *p)
 	}
 }
 
-static void gfx_v9_4_3_ip_dump(void *handle)
+static void gfx_v9_4_3_ip_dump(struct amdgpu_ip_block *ip_block)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	uint32_t i, j, k;
 	uint32_t num_xcc, reg, num_inst;
 	uint32_t xcc_id, xcc_offset, inst_offset;
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +2 -2
index 23ef4eb36b40..50ad06f06c62 100644
@@ -2371,9 +2371,9 @@ static void sdma_v4_0_print_ip_state(void *handle, struct drm_printer *p)
 	}
 }
 
-static void sdma_v4_0_dump_ip_state(void *handle)
+static void sdma_v4_0_dump_ip_state(struct amdgpu_ip_block *ip_block)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	uint32_t instance_offset;
 	uint32_t reg_count = ARRAY_SIZE(sdma_reg_list_4_0);
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +2 -2
index c77889040760..487cc0992263 100644
@@ -1878,9 +1878,9 @@ static void sdma_v4_4_2_print_ip_state(void *handle, struct drm_printer *p)
 	}
 }
 
-static void sdma_v4_4_2_dump_ip_state(void *handle)
+static void sdma_v4_4_2_dump_ip_state(struct amdgpu_ip_block *ip_block)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	uint32_t instance_offset;
 	uint32_t reg_count = ARRAY_SIZE(sdma_reg_list_4_4_2);
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +2 -2
index 3e48ea38385d..3ecf77ce2f1a 100644
@@ -1799,9 +1799,9 @@ static void sdma_v5_0_print_ip_state(void *handle, struct drm_printer *p)
 	}
 }
 
-static void sdma_v5_0_dump_ip_state(void *handle)
+static void sdma_v5_0_dump_ip_state(struct amdgpu_ip_block *ip_block)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	uint32_t instance_offset;
 	uint32_t reg_count = ARRAY_SIZE(sdma_reg_list_5_0);
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +2 -2
index bc9b240a3488..d19dde1d6fc5 100644
@@ -1757,9 +1757,9 @@ static void sdma_v5_2_print_ip_state(void *handle, struct drm_printer *p)
 	}
 }
 
-static void sdma_v5_2_dump_ip_state(void *handle)
+static void sdma_v5_2_dump_ip_state(struct amdgpu_ip_block *ip_block)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	uint32_t instance_offset;
 	uint32_t reg_count = ARRAY_SIZE(sdma_reg_list_5_2);
drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c +2 -2
index 581fa550ef29..ed7413c1954c 100644
@@ -1624,9 +1624,9 @@ static void sdma_v6_0_print_ip_state(void *handle, struct drm_printer *p)
 	}
 }
 
-static void sdma_v6_0_dump_ip_state(void *handle)
+static void sdma_v6_0_dump_ip_state(struct amdgpu_ip_block *ip_block)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	uint32_t instance_offset;
 	uint32_t reg_count = ARRAY_SIZE(sdma_reg_list_6_0);
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c +2 -2
index cfd8e183ad50..a69b6cf7106c 100644
@@ -1556,9 +1556,9 @@ static void sdma_v7_0_print_ip_state(void *handle, struct drm_printer *p)
 	}
 }
 
-static void sdma_v7_0_dump_ip_state(void *handle)
+static void sdma_v7_0_dump_ip_state(struct amdgpu_ip_block *ip_block)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	uint32_t instance_offset;
 	uint32_t reg_count = ARRAY_SIZE(sdma_reg_list_7_0);
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +2 -2
index ecdfbfefd66a..78dfcd02d8da 100644
@@ -1957,9 +1957,9 @@ static void vcn_v1_0_print_ip_state(void *handle, struct drm_printer *p)
 	}
 }
 
-static void vcn_v1_0_dump_ip_state(void *handle)
+static void vcn_v1_0_dump_ip_state(struct amdgpu_ip_block *ip_block)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	bool is_powered;
 	uint32_t inst_off;
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +2 -2
index bfd067e2d2f1..5d6accdba480 100644
@@ -2066,9 +2066,9 @@ static void vcn_v2_0_print_ip_state(void *handle, struct drm_printer *p)
 	}
 }
 
-static void vcn_v2_0_dump_ip_state(void *handle)
+static void vcn_v2_0_dump_ip_state(struct amdgpu_ip_block *ip_block)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	bool is_powered;
 	uint32_t inst_off;
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +2 -2
index 04e9e806e318..8896c25fd1d4 100644
@@ -1958,9 +1958,9 @@ static void vcn_v2_5_print_ip_state(void *handle, struct drm_printer *p)
 	}
 }
 
-static void vcn_v2_5_dump_ip_state(void *handle)
+static void vcn_v2_5_dump_ip_state(struct amdgpu_ip_block *ip_block)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	bool is_powered;
 	uint32_t inst_off;
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +2 -2
index 65dd68b32280..3009f52f62d7 100644
@@ -2284,9 +2284,9 @@ static void vcn_v3_0_print_ip_state(void *handle, struct drm_printer *p)
 	}
 }
 
-static void vcn_v3_0_dump_ip_state(void *handle)
+static void vcn_v3_0_dump_ip_state(struct amdgpu_ip_block *ip_block)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	bool is_powered;
 	uint32_t inst_off;
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +2 -2
index 26c6f10a8c8f..17ea10c14e29 100644
@@ -2190,9 +2190,9 @@ static void vcn_v4_0_print_ip_state(void *handle, struct drm_printer *p)
 	}
 }
 
-static void vcn_v4_0_dump_ip_state(void *handle)
+static void vcn_v4_0_dump_ip_state(struct amdgpu_ip_block *ip_block)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	bool is_powered;
 	uint32_t inst_off;
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c +2 -2
index 0fda70336300..742bf09ae195 100644
@@ -1765,9 +1765,9 @@ static void vcn_v4_0_3_print_ip_state(void *handle, struct drm_printer *p)
 	}
 }
 
-static void vcn_v4_0_3_dump_ip_state(void *handle)
+static void vcn_v4_0_3_dump_ip_state(struct amdgpu_ip_block *ip_block)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	bool is_powered;
 	uint32_t inst_off, inst_id;
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c +2 -2
index 9d4f5352a62c..3fb8b218e278 100644
@@ -1648,9 +1648,9 @@ static void vcn_v4_0_5_print_ip_state(void *handle, struct drm_printer *p)
 	}
 }
 
-static void vcn_v4_0_5_dump_ip_state(void *handle)
+static void vcn_v4_0_5_dump_ip_state(struct amdgpu_ip_block *ip_block)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	bool is_powered;
 	uint32_t inst_off;
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +2 -2
index c305386358b4..25ae338df346 100644
@@ -1375,9 +1375,9 @@ static void vcn_v5_0_print_ip_state(void *handle, struct drm_printer *p)
 	}
 }
 
-static void vcn_v5_0_dump_ip_state(void *handle)
+static void vcn_v5_0_dump_ip_state(struct amdgpu_ip_block *ip_block)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	bool is_powered;
 	uint32_t inst_off;
drivers/gpu/drm/amd/include/amd_shared.h +3 -1
index 3f91926a50e9..cbb19895ddaf 100644
@@ -375,6 +375,8 @@ enum amd_dpm_forced_level;
  * making calls to hooks from each IP block. This list is ordered to ensure
  * that the driver initializes the IP blocks in a safe sequence.
  */
+struct amdgpu_ip_block;
+
 struct amd_ip_funcs {
 	char *name;
 	int (*early_init)(void *handle);
@@ -399,7 +401,7 @@ struct amd_ip_funcs {
 	int (*set_powergating_state)(void *handle,
 				     enum amd_powergating_state state);
 	void (*get_clockgating_state)(void *handle, u64 *flags);
-	void (*dump_ip_state)(void *handle);
+	void (*dump_ip_state)(struct amdgpu_ip_block *ip_block);
 	void (*print_ip_state)(void *handle, struct drm_printer *p);
 };
 
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 drm/amdgpu: update the handle ptr in print_ip_state

Update the ptr handle to amdgpu_ip_block ptr in all the functions affected.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c | 12 +++++-------
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c           |  4 ++--
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c           |  4 ++--
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c           |  4 ++--
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c            |  4 ++--
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c          |  4 ++--
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c           |  4 ++--
 drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c         |  4 ++--
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c           |  4 ++--
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c           |  4 ++--
 drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c           |  4 ++--
 drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c           |  4 ++--
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c            |  4 ++--
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c            |  4 ++--
 drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c            |  4 ++--
 drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c            |  4 ++--
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c            |  4 ++--
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c          |  4 ++--
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c          |  4 ++--
 drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c          |  4 ++--
 drivers/gpu/drm/amd/include/amd_shared.h         |  2 +-
 21 files changed, 44 insertions(+), 46 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +5 -7
index 5ac59b62020c..ecd4e8ea2de4 100644
@@ -203,6 +203,7 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
 	struct amdgpu_coredump_info *coredump = data;
 	struct drm_print_iterator iter;
 	struct amdgpu_vm_fault_info *fault_info;
+	struct amdgpu_ip_block *ip_block;
 	int ver;
 
 	iter.data = buffer;
@@ -282,13 +283,10 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
 	/* dump the ip state for each ip */
 	drm_printf(&p, "IP Dump\n");
 	for (int i = 0; i < coredump->adev->num_ip_blocks; i++) {
-		if (coredump->adev->ip_blocks[i].version->funcs->print_ip_state) {
-			drm_printf(&p, "IP: %s\n",
-				   coredump->adev->ip_blocks[i]
-					   .version->funcs->name);
-			coredump->adev->ip_blocks[i]
-				.version->funcs->print_ip_state(
-					(void *)coredump->adev, &p);
+		ip_block = &(coredump->adev->ip_blocks[i]);
+		if (ip_block->version->funcs->print_ip_state) {
+			drm_printf(&p, "IP: %s\n", ip_block->version->funcs->name);
+			ip_block->version->funcs->print_ip_state(ip_block, &p);
 			drm_printf(&p, "\n");
 		}
 	}
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -2
index 61300eb88ab4..4b889a2acb10 100644
@@ -9568,9 +9568,9 @@ static int gfx_v10_0_reset_kcq(struct amdgpu_ring *ring,
 	return amdgpu_ring_test_ring(ring);
 }
 
-static void gfx_v10_ip_print(void *handle, struct drm_printer *p)
+static void gfx_v10_ip_print(struct amdgpu_ip_block *ip_block, struct drm_printer *p)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	uint32_t i, j, k, reg, index = 0;
 	uint32_t reg_count = ARRAY_SIZE(gc_reg_list_10_1);
 
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +2 -2
index 36dc6af70330..7a6fc9a88d65 100644
@@ -6639,9 +6639,9 @@ static int gfx_v11_0_reset_kcq(struct amdgpu_ring *ring, unsigned int vmid)
 	return amdgpu_ring_test_ring(ring);
 }
 
-static void gfx_v11_ip_print(void *handle, struct drm_printer *p)
+static void gfx_v11_ip_print(struct amdgpu_ip_block *ip_block, struct drm_printer *p)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	uint32_t i, j, k, reg, index = 0;
 	uint32_t reg_count = ARRAY_SIZE(gc_reg_list_11_0);
 
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +2 -2
index 13baa6868a78..3044436436c8 100644
@@ -5038,9 +5038,9 @@ static void gfx_v12_ring_insert_nop(struct amdgpu_ring *ring, uint32_t num_nop)
 		amdgpu_ring_write(ring, ring->funcs->nop);
 }
 
-static void gfx_v12_ip_print(void *handle, struct drm_printer *p)
+static void gfx_v12_ip_print(struct amdgpu_ip_block *ip_block, struct drm_printer *p)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	uint32_t i, j, k, reg, index = 0;
 	uint32_t reg_count = ARRAY_SIZE(gc_reg_list_12_0);
 
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index 4d8db3dd3f37..8f4f167cfd73 100644
@@ -7316,9 +7316,9 @@ static int gfx_v9_0_reset_kcq(struct amdgpu_ring *ring,
 	return amdgpu_ring_test_ring(ring);
 }
 
-static void gfx_v9_ip_print(void *handle, struct drm_printer *p)
+static void gfx_v9_ip_print(struct amdgpu_ip_block *ip_block, struct drm_printer *p)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	uint32_t i, j, k, reg, index = 0;
 	uint32_t reg_count = ARRAY_SIZE(gc_reg_list_9);
 
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +2 -2
index f973d922e6b3..3757a5b88762 100644
@@ -4583,9 +4583,9 @@ static void gfx_v9_4_3_ring_insert_nop(struct amdgpu_ring *ring, uint32_t num_no
 		amdgpu_ring_write(ring, ring->funcs->nop);
 }
 
-static void gfx_v9_4_3_ip_print(void *handle, struct drm_printer *p)
+static void gfx_v9_4_3_ip_print(struct amdgpu_ip_block *ip_block, struct drm_printer *p)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	uint32_t i, j, k;
 	uint32_t xcc_id, xcc_offset, inst_offset;
 	uint32_t num_xcc, reg, num_inst;
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +2 -2
index 50ad06f06c62..f17ce2d53b92 100644
@@ -2350,9 +2350,9 @@ static void sdma_v4_0_get_clockgating_state(void *handle, u64 *flags)
 		*flags |= AMD_CG_SUPPORT_SDMA_LS;
 }
 
-static void sdma_v4_0_print_ip_state(void *handle, struct drm_printer *p)
+static void sdma_v4_0_print_ip_state(struct amdgpu_ip_block *ip_block, struct drm_printer *p)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	uint32_t reg_count = ARRAY_SIZE(sdma_reg_list_4_0);
 	uint32_t instance_offset;
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +2 -2
index 487cc0992263..d577b973d0a4 100644
@@ -1857,9 +1857,9 @@ static void sdma_v4_4_2_get_clockgating_state(void *handle, u64 *flags)
 		*flags |= AMD_CG_SUPPORT_SDMA_LS;
 }
 
-static void sdma_v4_4_2_print_ip_state(void *handle, struct drm_printer *p)
+static void sdma_v4_4_2_print_ip_state(struct amdgpu_ip_block *ip_block, struct drm_printer *p)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	uint32_t reg_count = ARRAY_SIZE(sdma_reg_list_4_4_2);
 	uint32_t instance_offset;
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +2 -2
index 3ecf77ce2f1a..b44d7d17d137 100644
@@ -1778,9 +1778,9 @@ static void sdma_v5_0_get_clockgating_state(void *handle, u64 *flags)
 		*flags |= AMD_CG_SUPPORT_SDMA_LS;
 }
 
-static void sdma_v5_0_print_ip_state(void *handle, struct drm_printer *p)
+static void sdma_v5_0_print_ip_state(struct amdgpu_ip_block *ip_block, struct drm_printer *p)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	uint32_t reg_count = ARRAY_SIZE(sdma_reg_list_5_0);
 	uint32_t instance_offset;
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +2 -2
index d19dde1d6fc5..8761b54050ca 100644
@@ -1736,9 +1736,9 @@ static void sdma_v5_2_ring_end_use(struct amdgpu_ring *ring)
 	amdgpu_gfx_off_ctrl(adev, true);
 }
 
-static void sdma_v5_2_print_ip_state(void *handle, struct drm_printer *p)
+static void sdma_v5_2_print_ip_state(struct amdgpu_ip_block *ip_block, struct drm_printer *p)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	uint32_t reg_count = ARRAY_SIZE(sdma_reg_list_5_2);
 	uint32_t instance_offset;
drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c +2 -2
index ed7413c1954c..5eafc81e82f9 100644
@@ -1603,9 +1603,9 @@ static void sdma_v6_0_get_clockgating_state(void *handle, u64 *flags)
 {
 }
 
-static void sdma_v6_0_print_ip_state(void *handle, struct drm_printer *p)
+static void sdma_v6_0_print_ip_state(struct amdgpu_ip_block *ip_block, struct drm_printer *p)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	uint32_t reg_count = ARRAY_SIZE(sdma_reg_list_6_0);
 	uint32_t instance_offset;
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c +2 -2
index a69b6cf7106c..fe4b7b758afa 100644
@@ -1535,9 +1535,9 @@ static void sdma_v7_0_get_clockgating_state(void *handle, u64 *flags)
 {
 }
 
-static void sdma_v7_0_print_ip_state(void *handle, struct drm_printer *p)
+static void sdma_v7_0_print_ip_state(struct amdgpu_ip_block *ip_block, struct drm_printer *p)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	uint32_t reg_count = ARRAY_SIZE(sdma_reg_list_7_0);
 	uint32_t instance_offset;
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +2 -2
index 78dfcd02d8da..21e0962e53c2 100644
@@ -1925,9 +1925,9 @@ void vcn_v1_0_ring_end_use(struct amdgpu_ring *ring)
 	mutex_unlock(&ring->adev->vcn.vcn1_jpeg1_workaround);
 }
 
-static void vcn_v1_0_print_ip_state(void *handle, struct drm_printer *p)
+static void vcn_v1_0_print_ip_state(struct amdgpu_ip_block *ip_block, struct drm_printer *p)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	uint32_t reg_count = ARRAY_SIZE(vcn_reg_list_1_0);
 	uint32_t inst_off, is_powered;
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +2 -2
index 5d6accdba480..b6d41d531ef9 100644
@@ -2034,9 +2034,9 @@ static int vcn_v2_0_start_sriov(struct amdgpu_device *adev)
 	return vcn_v2_0_start_mmsch(adev, &adev->virt.mm_table);
 }
 
-static void vcn_v2_0_print_ip_state(void *handle, struct drm_printer *p)
+static void vcn_v2_0_print_ip_state(struct amdgpu_ip_block *ip_block, struct drm_printer *p)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	uint32_t reg_count = ARRAY_SIZE(vcn_reg_list_2_0);
 	uint32_t inst_off, is_powered;
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +2 -2
index 8896c25fd1d4..6be770a060ef 100644
@@ -1926,9 +1926,9 @@ static void vcn_v2_5_set_irq_funcs(struct amdgpu_device *adev)
 	}
 }
 
-static void vcn_v2_5_print_ip_state(void *handle, struct drm_printer *p)
+static void vcn_v2_5_print_ip_state(struct amdgpu_ip_block *ip_block, struct drm_printer *p)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	uint32_t reg_count = ARRAY_SIZE(vcn_reg_list_2_5);
 	uint32_t inst_off, is_powered;
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +2 -2
index 3009f52f62d7..0c2d698ca046 100644
@@ -2251,9 +2251,9 @@ static void vcn_v3_0_set_irq_funcs(struct amdgpu_device *adev)
 	}
 }
 
-static void vcn_v3_0_print_ip_state(void *handle, struct drm_printer *p)
+static void vcn_v3_0_print_ip_state(struct amdgpu_ip_block *ip_block, struct drm_printer *p)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	uint32_t reg_count = ARRAY_SIZE(vcn_reg_list_3_0);
 	uint32_t inst_off;
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +2 -2
index 17ea10c14e29..d3aa1a5b2529 100644
@@ -2158,9 +2158,9 @@ static void vcn_v4_0_set_irq_funcs(struct amdgpu_device *adev)
 	}
 }
 
-static void vcn_v4_0_print_ip_state(void *handle, struct drm_printer *p)
+static void vcn_v4_0_print_ip_state(struct amdgpu_ip_block *ip_block, struct drm_printer *p)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	uint32_t reg_count = ARRAY_SIZE(vcn_reg_list_4_0);
 	uint32_t inst_off, is_powered;
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c +2 -2
index 742bf09ae195..ca5ac917f07d 100644
@@ -1733,9 +1733,9 @@ static void vcn_v4_0_3_set_irq_funcs(struct amdgpu_device *adev)
 	adev->vcn.inst->irq.funcs = &vcn_v4_0_3_irq_funcs;
 }
 
-static void vcn_v4_0_3_print_ip_state(void *handle, struct drm_printer *p)
+static void vcn_v4_0_3_print_ip_state(struct amdgpu_ip_block *ip_block, struct drm_printer *p)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	uint32_t reg_count = ARRAY_SIZE(vcn_reg_list_4_0_3);
 	uint32_t inst_off, is_powered;
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c +2 -2
index 3fb8b218e278..0d8aa5a0904b 100644
@@ -1616,9 +1616,9 @@ static void vcn_v4_0_5_set_irq_funcs(struct amdgpu_device *adev)
 	}
 }
 
-static void vcn_v4_0_5_print_ip_state(void *handle, struct drm_printer *p)
+static void vcn_v4_0_5_print_ip_state(struct amdgpu_ip_block *ip_block, struct drm_printer *p)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	uint32_t reg_count = ARRAY_SIZE(vcn_reg_list_4_0_5);
 	uint32_t inst_off, is_powered;
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +2 -2
index 25ae338df346..8a2e217ae5c9 100644
@@ -1343,9 +1343,9 @@ static void vcn_v5_0_0_set_irq_funcs(struct amdgpu_device *adev)
 	}
 }
 
-static void vcn_v5_0_print_ip_state(void *handle, struct drm_printer *p)
+static void vcn_v5_0_print_ip_state(struct amdgpu_ip_block *ip_block, struct drm_printer *p)
 {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
 	int i, j;
 	uint32_t reg_count = ARRAY_SIZE(vcn_reg_list_5_0);
 	uint32_t inst_off, is_powered;
drivers/gpu/drm/amd/include/amd_shared.h +1 -1
index cbb19895ddaf..9b02ab1c2048 100644
@@ -402,7 +402,7 @@ struct amd_ip_funcs {
 				     enum amd_powergating_state state);
 	void (*get_clockgating_state)(void *handle, u64 *flags);
 	void (*dump_ip_state)(struct amdgpu_ip_block *ip_block);
-	void (*print_ip_state)(void *handle, struct drm_printer *p);
+	void (*print_ip_state)(struct amdgpu_ip_block *ip_block, struct drm_printer *p);
 };
 
 
Signature · 1 line
2.34.1
maintainer
#2 lore raw
In reply to Sunil Khatri

Am 25.09.24 um 05:51 schrieb Sunil Khatri:

Quoted 4 lines

Update the ptr handle to amdgpu_ip_block ptr in all the functions.

Both patches look like a straightforward cleanup to me.

Feel free to add Reviewed-by: Christian König <[email protected]> to the series.

Thanks,
Christian.

Quoted 377 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_job.c    | 2 +-
  drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c     | 4 ++--
  drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c     | 4 ++--
  drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c     | 4 ++--
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c      | 4 ++--
  drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c    | 4 ++--
  drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c     | 4 ++--
  drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c   | 4 ++--
  drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c     | 4 ++--
  drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c     | 4 ++--
  drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c     | 4 ++--
  drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c     | 4 ++--
  drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c      | 4 ++--
  drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c      | 4 ++--
  drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c      | 4 ++--
  drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c      | 4 ++--
  drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c      | 4 ++--
  drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c    | 4 ++--
  drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c    | 4 ++--
  drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c    | 4 ++--
  drivers/gpu/drm/amd/include/amd_shared.h   | 4 +++-
  22 files changed, 43 insertions(+), 41 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
index c4d4fbcfca7a..c5827171b596 100644
@@ -5380,7 +5380,7 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev,
  			for (i = 0; i < tmp_adev->num_ip_blocks; i++)
  				if (tmp_adev->ip_blocks[i].version->funcs->dump_ip_state)
  					tmp_adev->ip_blocks[i].version->funcs
-						->dump_ip_state((void *)tmp_adev);
+						->dump_ip_state((void *)&tmp_adev->ip_blocks[i]);
  			dev_info(tmp_adev->dev, "Dumping IP State Completed\n");
  		}
 
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1 -1
index 13a3604cf107..fdadbe49c913 100644
@@ -42,7 +42,7 @@ static void amdgpu_job_do_core_dump(struct amdgpu_device *adev,
  	for (i = 0; i < adev->num_ip_blocks; i++)
  		if (adev->ip_blocks[i].version->funcs->dump_ip_state)
  			adev->ip_blocks[i].version->funcs
-				->dump_ip_state((void *)adev);
+				->dump_ip_state((void *)&adev->ip_blocks[i]);
  	dev_info(adev->dev, "Dumping IP State Completed\n");
 
  	amdgpu_coredump(adev, true, false, job);
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -2
index 45ed97038df0..61300eb88ab4 100644
@@ -9632,9 +9632,9 @@ static void gfx_v10_ip_print(void *handle, struct drm_printer *p)
  	}
  }
 
-static void gfx_v10_ip_dump(void *handle)
+static void gfx_v10_ip_dump(struct amdgpu_ip_block *ip_block)
  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
  	uint32_t i, j, k, reg, index = 0;
  	uint32_t reg_count = ARRAY_SIZE(gc_reg_list_10_1);
 
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +2 -2
index d3e8be82a172..36dc6af70330 100644
@@ -6703,9 +6703,9 @@ static void gfx_v11_ip_print(void *handle, struct drm_printer *p)
  	}
  }
 
-static void gfx_v11_ip_dump(void *handle)
+static void gfx_v11_ip_dump(struct amdgpu_ip_block *ip_block)
  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
  	uint32_t i, j, k, reg, index = 0;
  	uint32_t reg_count = ARRAY_SIZE(gc_reg_list_11_0);
 
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +2 -2
index 47b47d21f464..13baa6868a78 100644
@@ -5102,9 +5102,9 @@ static void gfx_v12_ip_print(void *handle, struct drm_printer *p)
  	}
  }
 
-static void gfx_v12_ip_dump(void *handle)
+static void gfx_v12_ip_dump(struct amdgpu_ip_block *ip_block)
  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
  	uint32_t i, j, k, reg, index = 0;
  	uint32_t reg_count = ARRAY_SIZE(gc_reg_list_12_0);
 
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index 23f0573ae47b..4d8db3dd3f37 100644
@@ -7356,9 +7356,9 @@ static void gfx_v9_ip_print(void *handle, struct drm_printer *p)
 
  }
 
-static void gfx_v9_ip_dump(void *handle)
+static void gfx_v9_ip_dump(struct amdgpu_ip_block *ip_block)
  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
  	uint32_t i, j, k, reg, index = 0;
  	uint32_t reg_count = ARRAY_SIZE(gc_reg_list_9);
 
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +2 -2
index c100845409f7..f973d922e6b3 100644
@@ -4643,9 +4643,9 @@ static void gfx_v9_4_3_ip_print(void *handle, struct drm_printer *p)
  	}
  }
 
-static void gfx_v9_4_3_ip_dump(void *handle)
+static void gfx_v9_4_3_ip_dump(struct amdgpu_ip_block *ip_block)
  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
  	uint32_t i, j, k;
  	uint32_t num_xcc, reg, num_inst;
  	uint32_t xcc_id, xcc_offset, inst_offset;
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +2 -2
index 23ef4eb36b40..50ad06f06c62 100644
@@ -2371,9 +2371,9 @@ static void sdma_v4_0_print_ip_state(void *handle, struct drm_printer *p)
  	}
  }
 
-static void sdma_v4_0_dump_ip_state(void *handle)
+static void sdma_v4_0_dump_ip_state(struct amdgpu_ip_block *ip_block)
  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
  	int i, j;
  	uint32_t instance_offset;
  	uint32_t reg_count = ARRAY_SIZE(sdma_reg_list_4_0);
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +2 -2
index c77889040760..487cc0992263 100644
@@ -1878,9 +1878,9 @@ static void sdma_v4_4_2_print_ip_state(void *handle, struct drm_printer *p)
  	}
  }
 
-static void sdma_v4_4_2_dump_ip_state(void *handle)
+static void sdma_v4_4_2_dump_ip_state(struct amdgpu_ip_block *ip_block)
  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
  	int i, j;
  	uint32_t instance_offset;
  	uint32_t reg_count = ARRAY_SIZE(sdma_reg_list_4_4_2);
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +2 -2
index 3e48ea38385d..3ecf77ce2f1a 100644
@@ -1799,9 +1799,9 @@ static void sdma_v5_0_print_ip_state(void *handle, struct drm_printer *p)
  	}
  }
 
-static void sdma_v5_0_dump_ip_state(void *handle)
+static void sdma_v5_0_dump_ip_state(struct amdgpu_ip_block *ip_block)
  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
  	int i, j;
  	uint32_t instance_offset;
  	uint32_t reg_count = ARRAY_SIZE(sdma_reg_list_5_0);
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +2 -2
index bc9b240a3488..d19dde1d6fc5 100644
@@ -1757,9 +1757,9 @@ static void sdma_v5_2_print_ip_state(void *handle, struct drm_printer *p)
  	}
  }
 
-static void sdma_v5_2_dump_ip_state(void *handle)
+static void sdma_v5_2_dump_ip_state(struct amdgpu_ip_block *ip_block)
  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
  	int i, j;
  	uint32_t instance_offset;
  	uint32_t reg_count = ARRAY_SIZE(sdma_reg_list_5_2);
drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c +2 -2
index 581fa550ef29..ed7413c1954c 100644
@@ -1624,9 +1624,9 @@ static void sdma_v6_0_print_ip_state(void *handle, struct drm_printer *p)
  	}
  }
 
-static void sdma_v6_0_dump_ip_state(void *handle)
+static void sdma_v6_0_dump_ip_state(struct amdgpu_ip_block *ip_block)
  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
  	int i, j;
  	uint32_t instance_offset;
  	uint32_t reg_count = ARRAY_SIZE(sdma_reg_list_6_0);
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c +2 -2
index cfd8e183ad50..a69b6cf7106c 100644
@@ -1556,9 +1556,9 @@ static void sdma_v7_0_print_ip_state(void *handle, struct drm_printer *p)
  	}
  }
 
-static void sdma_v7_0_dump_ip_state(void *handle)
+static void sdma_v7_0_dump_ip_state(struct amdgpu_ip_block *ip_block)
  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
  	int i, j;
  	uint32_t instance_offset;
  	uint32_t reg_count = ARRAY_SIZE(sdma_reg_list_7_0);
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +2 -2
index ecdfbfefd66a..78dfcd02d8da 100644
@@ -1957,9 +1957,9 @@ static void vcn_v1_0_print_ip_state(void *handle, struct drm_printer *p)
  	}
  }
 
-static void vcn_v1_0_dump_ip_state(void *handle)
+static void vcn_v1_0_dump_ip_state(struct amdgpu_ip_block *ip_block)
  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
  	int i, j;
  	bool is_powered;
  	uint32_t inst_off;
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +2 -2
index bfd067e2d2f1..5d6accdba480 100644
@@ -2066,9 +2066,9 @@ static void vcn_v2_0_print_ip_state(void *handle, struct drm_printer *p)
  	}
  }
 
-static void vcn_v2_0_dump_ip_state(void *handle)
+static void vcn_v2_0_dump_ip_state(struct amdgpu_ip_block *ip_block)
  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
  	int i, j;
  	bool is_powered;
  	uint32_t inst_off;
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +2 -2
index 04e9e806e318..8896c25fd1d4 100644
@@ -1958,9 +1958,9 @@ static void vcn_v2_5_print_ip_state(void *handle, struct drm_printer *p)
  	}
  }
 
-static void vcn_v2_5_dump_ip_state(void *handle)
+static void vcn_v2_5_dump_ip_state(struct amdgpu_ip_block *ip_block)
  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
  	int i, j;
  	bool is_powered;
  	uint32_t inst_off;
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +2 -2
index 65dd68b32280..3009f52f62d7 100644
@@ -2284,9 +2284,9 @@ static void vcn_v3_0_print_ip_state(void *handle, struct drm_printer *p)
  	}
  }
 
-static void vcn_v3_0_dump_ip_state(void *handle)
+static void vcn_v3_0_dump_ip_state(struct amdgpu_ip_block *ip_block)
  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
  	int i, j;
  	bool is_powered;
  	uint32_t inst_off;
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +2 -2
index 26c6f10a8c8f..17ea10c14e29 100644
@@ -2190,9 +2190,9 @@ static void vcn_v4_0_print_ip_state(void *handle, struct drm_printer *p)
  	}
  }
 
-static void vcn_v4_0_dump_ip_state(void *handle)
+static void vcn_v4_0_dump_ip_state(struct amdgpu_ip_block *ip_block)
  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
  	int i, j;
  	bool is_powered;
  	uint32_t inst_off;
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c +2 -2
index 0fda70336300..742bf09ae195 100644
@@ -1765,9 +1765,9 @@ static void vcn_v4_0_3_print_ip_state(void *handle, struct drm_printer *p)
  	}
  }
 
-static void vcn_v4_0_3_dump_ip_state(void *handle)
+static void vcn_v4_0_3_dump_ip_state(struct amdgpu_ip_block *ip_block)
  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
  	int i, j;
  	bool is_powered;
  	uint32_t inst_off, inst_id;
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c +2 -2
index 9d4f5352a62c..3fb8b218e278 100644
@@ -1648,9 +1648,9 @@ static void vcn_v4_0_5_print_ip_state(void *handle, struct drm_printer *p)
  	}
  }
 
-static void vcn_v4_0_5_dump_ip_state(void *handle)
+static void vcn_v4_0_5_dump_ip_state(struct amdgpu_ip_block *ip_block)
  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
  	int i, j;
  	bool is_powered;
  	uint32_t inst_off;
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +2 -2
index c305386358b4..25ae338df346 100644
@@ -1375,9 +1375,9 @@ static void vcn_v5_0_print_ip_state(void *handle, struct drm_printer *p)
  	}
  }
 
-static void vcn_v5_0_dump_ip_state(void *handle)
+static void vcn_v5_0_dump_ip_state(struct amdgpu_ip_block *ip_block)
  {
-	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = ip_block->adev;
  	int i, j;
  	bool is_powered;
  	uint32_t inst_off;
drivers/gpu/drm/amd/include/amd_shared.h +3 -1
index 3f91926a50e9..cbb19895ddaf 100644
@@ -375,6 +375,8 @@ enum amd_dpm_forced_level;
   * making calls to hooks from each IP block. This list is ordered to ensure
   * that the driver initializes the IP blocks in a safe sequence.
   */
+struct amdgpu_ip_block;
+
  struct amd_ip_funcs {
  	char *name;
  	int (*early_init)(void *handle);
@@ -399,7 +401,7 @@ struct amd_ip_funcs {
  	int (*set_powergating_state)(void *handle,
  				     enum amd_powergating_state state);
  	void (*get_clockgating_state)(void *handle, u64 *flags);
-	void (*dump_ip_state)(void *handle);
+	void (*dump_ip_state)(struct amdgpu_ip_block *ip_block);
  	void (*print_ip_state)(void *handle, struct drm_printer *p);
  };