drm/amd/dc/dce120: Fix audio register mapping, stop triggering KASAN
PATCH 1/1 drm/amd/dc/dce120: Fix audio register mapping, stop triggering KASAN
There's been a very long running bug that seems to have been neglected for a while, where amdgpu consistently triggers a KASAN error at start:
BUG: KASAN: global-out-of-bounds in read_indirect_azalia_reg+0x1d4/0x2a0 [amdgpu] Read of size 4 at addr ffffffffc2274b28 by task modprobe/1889
After digging through amd's rather creative method for accessing registers, I eventually discovered the problem likely has to do with the fact that on my dce120 GPU there are supposedly 7 sets of audio registers. But we only define a register mapping for 6 sets.
So, fix this and fix the KASAN warning finally.
---
Sending this one separately from the rest of my fixes since:
* It's definitely completely unrelated to the Gitlab 2171 issue
* I'm not sure if this is the correct fix since it's in DC
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +2 -1
@@ -359,7 +359,8 @@ static const struct dce_audio_registers audio_regs[] = {audio_regs (2 ),audio_regs (3 ),audio_regs (4 ), - audio_regs(5) +audio_regs (5 ), + audio_regs(6), };#define DCE120_AUD_COMMON_MASK_SH_LIST (mask_sh)\
Signature · 1 line
2.37.3
Quoted 12 lines · Lyude Paul
There's been a very long running bug that seems to have been neglected for a while, where amdgpu consistently triggers a KASAN error at start:
BUG: KASAN: global-out-of-bounds in read_indirect_azalia_reg+0x1d4/0x2a0 [amdgpu] Read of size 4 at addr ffffffffc2274b28 by task modprobe/1889After digging through amd's rather creative method for accessing registers, I eventually discovered the problem likely has to do with the fact that on my dce120 GPU there are supposedly 7 sets of audio registers. But we only define a register mapping for 6 sets.
Quoted 4 lines
So, fix this and fix the KASAN warning finally.
Signed-off-by Lyude Paul <[email protected]>
This is the correct fix for asics having 7 audio instances. It looks correct to me, assuming DCE12 actually has 7 audio instances. @Wentland, Harry Do you know off hand? If you can confirm that, the patch is:
Quoted 26 lines
---
Sending this one separately from the rest of my fixes since:* It's definitely completely unrelated to the Gitlab 2171 issue
* I'm not sure if this is the correct fix since it's in DCdrivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +2
-2@@ -359,7 +359,8 @@ static const struct dce_audio_registers audio_regs[] = {audio_regs (2 ),audio_regs (3 ),audio_regs (4 ), - audio_regs(5) +audio_regs (5 ), + audio_regs(6), };#define DCE120_AUD_COMMON_MASK_SH_LIST (mask_sh)\ --2.37.3
Quoted 16 lines · Alex Deucher
Quoted 14 lines · Lyude Paul
There's been a very long running bug that seems to have been neglected for a while, where amdgpu consistently triggers a KASAN error at start:
BUG: KASAN: global-out-of-bounds in read_indirect_azalia_reg+0x1d4/0x2a0 [amdgpu] Read of size 4 at addr ffffffffc2274b28 by task modprobe/1889After digging through amd's rather creative method for accessing registers, I eventually discovered the problem likely has to do with the fact that on my dce120 GPU there are supposedly 7 sets of audio registers. But we only define a register mapping for 6 sets.
So, fix this and fix the KASAN warning finally.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Lyude Paul <[email protected]>This is the correct fix for asics having 7 audio instances. It looks correct to me, assuming DCE12 actually has 7 audio instances. @Wentland, Harry Do you know off hand? If you can confirm that, the patch is:
Reviewed-by Alex Deucher <[email protected]>
The driver currently defines 7 audio instances, whether or not it actually has 7 remains to be seen but the code as is is broken, so I'll apply this. If it turns out there are only 6 instances we can fix the count later. Applied. Thanks!
Alex
Quoted 28 lines
Quoted 28 lines
---
Sending this one separately from the rest of my fixes since:* It's definitely completely unrelated to the Gitlab 2171 issue
* I'm not sure if this is the correct fix since it's in DCdrivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +2
-2@@ -359,7 +359,8 @@ static const struct dce_audio_registers audio_regs[] = {audio_regs (2 ),audio_regs (3 ),audio_regs (4 ), - audio_regs(5) +audio_regs (5 ), + audio_regs(6), };#define DCE120_AUD_COMMON_MASK_SH_LIST (mask_sh)\ --2.37.3
Quoted 26 lines · Alex Deucher
Quoted 16 lines · Alex Deucher
Quoted 14 lines · Lyude Paul
There's been a very long running bug that seems to have been neglected for a while, where amdgpu consistently triggers a KASAN error at start:
BUG: KASAN: global-out-of-bounds in read_indirect_azalia_reg+0x1d4/0x2a0 [amdgpu] Read of size 4 at addr ffffffffc2274b28 by task modprobe/1889After digging through amd's rather creative method for accessing registers, I eventually discovered the problem likely has to do with the fact that on my dce120 GPU there are supposedly 7 sets of audio registers. But we only define a register mapping for 6 sets.
So, fix this and fix the KASAN warning finally.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Lyude Paul <[email protected]>This is the correct fix for asics having 7 audio instances. It looks correct to me, assuming DCE12 actually has 7 audio instances. @Wentland, Harry Do you know off hand? If you can confirm that, the patch is:
Reviewed-by Alex Deucher <[email protected]>
Quoted 5 lines
The driver currently defines 7 audio instances, whether or not it actually has 7 remains to be seen but the code as is is broken, so I'll apply this. If it turns out there are only 6 instances we can fix the count later. Applied. Thanks!
Good catch. I seem to recall some DCE generations had an extra audio device and if DCE12 defines 7 audio instances then this is the correct fix.
Harry
Quoted 30 lines
Alex
Quoted 28 lines
Quoted 28 lines
---
Sending this one separately from the rest of my fixes since:* It's definitely completely unrelated to the Gitlab 2171 issue
* I'm not sure if this is the correct fix since it's in DCdrivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +2
-2@@ -359,7 +359,8 @@ static const struct dce_audio_registers audio_regs[] = {audio_regs (2 ),audio_regs (3 ),audio_regs (4 ), - audio_regs(5) +audio_regs (5 ), + audio_regs(6), };#define DCE120_AUD_COMMON_MASK_SH_LIST (mask_sh)\ --2.37.3