drm/amdgpu: Expose an IP function to get register offset
Subsystems (2)
PATCH 1/1 drm/amdgpu: Expose an IP function to get register offset
Expose get_reg_offset function of sdma_v4_0 for kfd to use
--- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 7 +++++++ drivers/gpu/drm/amd/include/amd_shared.h | 3 +++ 2 files changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +7 -0
@@ -206,6 +206,12 @@ static u32 sdma_v4_0_get_reg_offset(struct amdgpu_device *adev,return 0 ; } +static u32 sdma_v4_0_get_reg_offset_external (void *handle,u32 instance,u32 offset) +{ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +return sdma_v4_0_get_reg_offset (adev, instance, offset); +} +static unsigned sdma_v4_0_seq_to_irq_id (int seq_num) {switch (seq_num) {
@@ -1746,6 +1752,7 @@ const struct amd_ip_funcs sdma_v4_0_ip_funcs = { .set_clockgating_state = sdma_v4_0_set_clockgating_state, .set_powergating_state = sdma_v4_0_set_powergating_state, .get_clockgating_state = sdma_v4_0_get_clockgating_state, + .get_reg_offset = sdma_v4_0_get_reg_offset_external, };static const struct amdgpu_ring_funcs sdma_v4_0_ring_funcs = {
drivers/gpu/drm/amd/include/amd_shared.h +3 -0
@@ -173,6 +173,9 @@ struct amd_ip_funcs { enum amd_powergating_state state);/* get current clockgating status */ void (*get_clockgating_state)(void *handle,u32 *flags); + +/* get instance's register offset */ +u32 (*get_reg_offset)(void *handle,u32 instance,u32 offset); };
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1540932032-29755-1-git-send-email-Oak.Zeng-5C7GfCeVMHo@public.gmane.org
Quoted 8 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Oak Zeng
Sent: Tuesday, October 30, 2018 4:41 PM
To: [email protected]
Cc: Zeng, Oak <[email protected]>
Subject: [PATCH] drm/amdgpu: Expose an IP function to get register offset
Quoted 4 lines
Expose
get_reg_offsetfunction ofsdma_v4_0for kfd to useChange-Id Ib687b390d6d3f8c8a35651e064e35aacf6722f98Signed-off-by Oak Zeng <[email protected]>
First, split something like this into two patches, one to add the new API, one to add the implementations.
Next how are you planning to use this? Do you have plans to add this for other IPs as well, or is it just a one off for
sdma? I'd rather not a new functionality at the IP level as a one-off for one IP. The implementation is trivial; it's just a wrapper around an array lookup. It's probably easier to just implement the same thing in kfd rather than adding a new callback. Or even make a generic wrapper e.g.,
amdgpu_device_ip_get_reg_offset(hwip, instance, seg, offset)
{
return adev->reg_offset[hwip][instance][seg] + offset;
}Alex
Quoted 48 lines
--- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 7 +++++++ drivers/gpu/drm/amd/include/amd_shared.h | 3 +++ 2 files changed, 10 insertions(+)drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +6
-0@@ -206,6 +206,12 @@ static u32 sdma_v4_0_get_reg_offset(structamdgpu_device *adev, return 0; } +static u32 sdma_v4_0_get_reg_offset_external (void *handle,u32 +instance,u32 offset) { +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +return sdma_v4_0_get_reg_offset (adev, instance, offset); } +static unsigned sdma_v4_0_seq_to_irq_id (int seq_num) {switch (seq_num) {@@ -1746,6 +1752,7 @@ const struct amd_ip_funcs sdma_v4_0_ip_funcs = { .set_clockgating_state = sdma_v4_0_set_clockgating_state, .set_powergating_state = sdma_v4_0_set_powergating_state, .get_clockgating_state = sdma_v4_0_get_clockgating_state, + .get_reg_offset = sdma_v4_0_get_reg_offset_external, }; static const struct amdgpu_ring_funcs sdma_v4_0_ring_funcs = { diff --git
a/drivers/gpu/drm/amd/include/amd_shared.hb/drivers/gpu/drm/amd/include/amd_shared.h
index fc7fcb1..ab44fa8 100644drivers/gpu/drm/amd/include/amd_shared.h +3
-1@@ -173,6 +173,9 @@ struct amd_ip_funcs { enum amd_powergating_state state);/* get current clockgating status */ void (*get_clockgating_state)(void *handle,u32 *flags); + +/* get instance's register offset */ +u32 (*get_reg_offset)(void *handle,u32 instance,u32 offset); }; --2.7.4
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx