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 de1f2cabdddd320324867f950be2281d33dcb86b..1c5a4c697c7cbeed5060f471fdf2103600325a77 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 16f2605ac50b9964c39d378f01963e8bc5fba9e5..e3bb234753efdf8dde7c733d6842c88ceb5e3664 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 45ed97038df0c8a53b9c6f8a6cf9970b3b7b3eb1..61300eb88ab4dae3d1c235e72c7d4e218d8f1be9 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 33fd2da49a2a7e1510ff5a655a40c46cbc4b75cc..acf2e7634200cd5066ee2fd317c4c9aa60191dc1 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 47b47d21f464477ac198068f4e61b9b92e0df4fa..13baa6868a78906b432ea1c792917c95c72f8004 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 3a3ef93f2f43a74b47e534263922767ea3146066..fb4402f9bd8d41576da43a5f2b1ad536635bc5d9 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 59d0c34aeacf9c31d94ef67329f889322c7c1626..3d48eb281e99b260698b1f8efa96113b6512a866 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 23ef4eb36b407a2a1867610a2041a043bf48a3d0..50ad06f06c62353bd7e3922374ed090c8f8e529c 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 c77889040760adc25272dbbe97ed9dd83555a5dc..487cc0992263bba21794e9756825ccfc139a634b 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 e813da1e48aa800f0e6a15486459dc50447d4a64..4dc8ff761888516f2b26521b5db726123dd6be6e 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 bc9b240a3488e6d40313404d06c7e978d4dd022e..d19dde1d6fc5b9cb3d9550395665d2cc6be8c857 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 581fa550ef29f4e37dc197d552f94c92d0611cd8..ed7413c1954c419c646bb29a50d063c5da7daf72 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 a8763496aed315b5526accadd2872f26c0d50c37..9e8b1ec4e6cb88f10c9af84c27ef4cf7db72bdc1 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 ecdfbfefd66ad2b32de894eef07324fd3194aef3..78dfcd02d8da4e2e1ba115bd6ff46c9aac902207 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 bfd067e2d2f1d20769f369b68929997c307ca7b5..5d6accdba4804eb868330fc5b87697416dad49e5 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 04e9e806e3187fcde7d371afbd598a6283065686..8896c25fd1d43839a14aa007f447bcbf4c752b63 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 65dd68b322806e5892b8c5257e7fd27f78a53da0..3009f52f62d7c1aa3c832a39ecedcdf01442c8f9 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 26c6f10a8c8fae112f4c5e0ad2be24377dd02753..17ea10c14e299701910bb63108832e259dd4c2b7 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 0fda703363004f902a9853e89f5c94b6d3c3e79b..742bf09ae195e3335f47ab1ec48597ca32c88e75 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 9d4f5352a62c8c4a283aa7d3f203b313d5d73845..3fb8b218e27819eccad033caa5d9b8a763894949 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 c305386358b4b44ef517e19e4d47d7fce5793cd9..25ae338df3461e1d64052009d71a2b7d6ccfbf97 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 3f91926a50e99b88d6347b910e5e07e19f33cde5..cbb19895ddaf566db6340b1e8f629463762e3961 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);
 };