drm/amdgpu: update the handle ptr in dump_ip_state
authorSunil Khatri <sunil.khatri@amd.com>
Tue, 24 Sep 2024 16:00:17 +0000 (21:30 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 1 Oct 2024 21:28:51 +0000 (17:28 -0400)
Update the ptr handle to amdgpu_ip_block ptr in all
the functions.

Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
22 files changed:
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c
drivers/gpu/drm/amd/include/amd_shared.h

index de1f2ca..1c5a4c6 100644 (file)
@@ -5358,7 +5358,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");
                }
 
index 16f2605..e3bb234 100644 (file)
@@ -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);
index 45ed970..61300eb 100644 (file)
@@ -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);
 
index 33fd2da..acf2e76 100644 (file)
@@ -6705,9 +6705,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);
 
index 47b47d2..13baa68 100644 (file)
@@ -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);
 
index 3a3ef93..fb4402f 100644 (file)
@@ -7377,9 +7377,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);
 
index 59d0c34..3d48eb2 100644 (file)
@@ -4645,9 +4645,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;
index 23ef4eb..50ad06f 100644 (file)
@@ -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);
index c778890..487cc09 100644 (file)
@@ -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);
index e813da1..4dc8ff7 100644 (file)
@@ -1822,9 +1822,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);
index bc9b240..d19dde1 100644 (file)
@@ -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);
index 581fa55..ed7413c 100644 (file)
@@ -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);
index a876349..9e8b1ec 100644 (file)
@@ -1559,9 +1559,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);
index ecdfbfe..78dfcd0 100644 (file)
@@ -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;
index bfd067e..5d6accd 100644 (file)
@@ -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;
index 04e9e80..8896c25 100644 (file)
@@ -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;
index 65dd68b..3009f52 100644 (file)
@@ -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;
index 26c6f10..17ea10c 100644 (file)
@@ -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;
index 0fda703..742bf09 100644 (file)
@@ -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;
index 9d4f535..3fb8b21 100644 (file)
@@ -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;
index c305386..25ae338 100644 (file)
@@ -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;
index 3f91926..cbb1989 100644 (file)
@@ -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);
 };