drm/amdgpu: return an error instead of BUG() for CSA bo_va
Subsystems (3)
Alex Deucher
maintainerPATCH 1/30 drm/amdgpu: return an error instead of BUG() for CSA bo_va
If the bo_va is not present, return an error rather than crashing the kernel.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -1
@@ -1121,7 +1121,8 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p)if (fpriv->csa_va) { bo_va = fpriv->csa_va; -BUG_ON (!bo_va); +if (!bo_va) +return -ENOMEM ; r =amdgpu_vm_bo_update (adev, bo_va, false);if (r)return r;
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 2/30 drm/amdgpu/gfx11: WARN() rather than BUG() for invalid SDMA engine
There's no need to crash the kernel for these cases.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v11.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v11.c +2 -1
@@ -139,7 +139,8 @@ static uint32_t get_sdma_rlc_reg_offset(struct amdgpu_device *adev, regSDMA1_QUEUE0_RB_CNTL) - regSDMA0_QUEUE0_RB_CNTL;break ;default : -BUG (); +WARN (1 ,"Invalid SDMA engine id %d\n" , engine_id); +break ; } sdma_rlc_reg_offset = sdma_engine_reg_base
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 3/30 drm/amdgpu/gfx12: WARN() rather than BUG() for invalid SDMA engine
In reply to Alex DeucherThere's no need to crash the kernel for these cases.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v12.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v12.c +2 -1
@@ -90,7 +90,8 @@ static uint32_t get_sdma_rlc_reg_offset(struct amdgpu_device *adev, regSDMA1_QUEUE0_RB_CNTL) - regSDMA0_QUEUE0_RB_CNTL;break ;default : -BUG (); +WARN (1 ,"Invalid SDMA engine id %d\n" , engine_id); +break ; } sdma_rlc_reg_offset = sdma_engine_reg_base
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 4/30 drm/amdgpu/gfx12.1: WARN() rather than BUG() for invalid SDMA engine
In reply to Alex DeucherThere's no need to crash the kernel for these cases.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v12_1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v12_1.c +2 -1
@@ -93,7 +93,8 @@ static uint32_t get_sdma_rlc_reg_offset(struct amdgpu_device *adev, regSDMA1_SDMA_QUEUE0_RB_CNTL) - regSDMA0_SDMA_QUEUE0_RB_CNTL;break ;default : -BUG (); +WARN (1 ,"Invalid SDMA engine id %d\n" , engine_id); +break ; } sdma_rlc_reg_offset = sdma_engine_reg_base
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 5/30 drm/amdgpu/atomfirmware: WARN() rather than BUG()
In reply to Alex DeucherThere's no need to crash the kernel for this case. Just return an error.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c +0 -2
@@ -917,8 +917,6 @@ int amdgpu_atomfirmware_get_clock_info(struct amdgpu_device *adev) (crev != 6)) { spll->reference_freq =le32_to_cpu (gfx_info->v22.rlc_gpu_timer_refclk); ret =0 ; - } else { -BUG (); } } }
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 6/30 drm/amdgpu/cgs: WARN() rather than BUG()
In reply to Alex DeucherThere's no need to crash the kernel for these cases.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +3 -5
@@ -76,10 +76,9 @@ static uint32_t amdgpu_cgs_read_ind_register(struct cgs_device *cgs_device,DRM_ERROR ("audio endpt register access not implemented.\n" );return 0 ;default : -BUG (); +WARN (1 ,"Invalid indirect register space" ); +return 0 ; } -WARN (1 ,"Invalid indirect register space" ); -return 0 ; } static void amdgpu_cgs_write_ind_register(struct cgs_device *cgs_device,
@@ -104,9 +103,8 @@ static void amdgpu_cgs_write_ind_register(struct cgs_device *cgs_device,DRM_ERROR ("audio endpt register access not implemented.\n" );return ;default : -BUG (); +WARN (1 ,"Invalid indirect register space" ); } -WARN (1 ,"Invalid indirect register space" ); }static uint32_t fw_type_convert (struct cgs_device *cgs_device,uint32_t fw_type)
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 7/30 drm/amdgpu/ucode: WARN() rather than BUG()
In reply to Alex DeucherThere's no need to crash the kernel for this case.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +2 -1
@@ -1478,7 +1478,8 @@ void amdgpu_ucode_ip_version_decode(struct amdgpu_device *adev, int block_type, ip_name ="isp" ;break ;default : -BUG (); +WARN (1 ,"invalid HWIP %d\n" , block_type); +return ; } maj =IP_VERSION_MAJ (version);
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 8/30 drm/amdgpu/cik_sdma: replace BUG() with an error
In reply to Alex DeucherThere's no need to crash the kernel for this case.
--- drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +2 -1
@@ -125,7 +125,8 @@ static int cik_sdma_init_microcode(struct amdgpu_device *adev)case CHIP_MULLINS : chip_name ="mullins" ;break ; -default :BUG (); +default : +return -EINVAL ; }for (i =0 ; i < adev->sdma.num_instances; i++) {
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 9/30 drm/amdgpu/sdma2.4: replace BUG() with an error
In reply to Alex DeucherThere's no need to crash the kernel for this case.
--- drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +1 -1
@@ -138,7 +138,7 @@ static int sdma_v2_4_init_microcode(struct amdgpu_device *adev) chip_name ="topaz" ;break ;default : -BUG (); +return -EINVAL ; }for (i =0 ; i < adev->sdma.num_instances; i++) {
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 10/30 drm/amdgpu/sdma3.0: replace BUG() with an error
In reply to Alex DeucherThere's no need to crash the kernel for this case.
--- drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +2 -1
@@ -298,7 +298,8 @@ static int sdma_v3_0_init_microcode(struct amdgpu_device *adev)case CHIP_STONEY : chip_name ="stoney" ;break ; -default :BUG (); +default : +return -EINVAL ; }for (i =0 ; i < adev->sdma.num_instances; i++) {
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 11/30 drm/amdgpu/si: drop BUG()s
In reply to Alex DeucherThere's no need to crash the kernel for these cases.
--- drivers/gpu/drm/amd/amdgpu/si.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/si.c +2 -2
@@ -2218,7 +2218,7 @@ static void si_init_golden_registers(struct amdgpu_device *adev)default : -BUG (); +break ; } }
@@ -2735,7 +2735,7 @@ int si_set_ip_blocks(struct amdgpu_device *adev)amdgpu_device_ip_block_add (adev, &amdgpu_vkms_ip_block);break ;default : -BUG (); +break ; }return 0 ; }
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 12/30 drm/amdgpu/gmc6: replace BUG() with an error
In reply to Alex DeucherThere's no need to crash the kernel for this case.
--- drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +1 -1
@@ -124,7 +124,7 @@ static int gmc_v6_0_init_microcode(struct amdgpu_device *adev) chip_name ="hainan" ;break ;default : -BUG (); +return -EINVAL ; }/* this memory configuration requires special firmware */
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 13/30 drm/amdgpu/imu11: WARN() rather than BUG()
In reply to Alex DeucherThere's no need to crash the kernel for this case.
--- drivers/gpu/drm/amd/amdgpu/imu_v11_0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/imu_v11_0.c +2 -1
@@ -377,7 +377,8 @@ static void imu_v11_0_program_rlc_ram(struct amdgpu_device *adev)imu_v11_0_3_program_rlc_ram (adev);break ;default : -BUG (); +WARN (1 ,"Invalid GFX/IMU IP version 0x%08x\n" , +amdgpu_ip_version (adev,GC_HWIP ,0 ));break ; }
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 14/30 drm/amdgpu/imu12: WARN() rather than BUG()
In reply to Alex DeucherThere's no need to crash the kernel for this case.
--- drivers/gpu/drm/amd/amdgpu/imu_v12_0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/imu_v12_0.c +2 -1
@@ -382,7 +382,8 @@ static void imu_v12_0_program_rlc_ram(struct amdgpu_device *adev) (const u32)ARRAY_SIZE(imu_rlc_ram_golden_12_0_1));break ;default : -BUG (); +WARN (1 ,"Invalid GFX/IMU IP version 0x%08x\n" , +amdgpu_ip_version (adev,GC_HWIP ,0 ));break ; }
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 15/30 drm/amdgpu/mes11: drop all BUG()s
In reply to Alex DeucherThere's no need to crash the kernel for these cases.
--- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +10 -7
@@ -86,7 +86,7 @@ static void mes_v11_0_ring_set_wptr(struct amdgpu_ring *ring) ring->wptr);WDOORBELL64 (ring->doorbell_index, ring->wptr); }else { -BUG (); +dev_warn (adev->dev,"mes_v11_0_ring_set_wptr() requires doorbell!\n" ); } }
@@ -97,12 +97,15 @@ static u64 mes_v11_0_ring_get_rptr(struct amdgpu_ring *ring)static u64 mes_v11_0_ring_get_wptr (struct amdgpu_ring *ring) { +struct amdgpu_device *adev = ring->adev;u64 wptr; -if (ring->use_doorbell) +if (ring->use_doorbell) { wptr =atomic64_read ((atomic64_t *)ring->wptr_cpu_addr); -else -BUG (); + }else { +dev_warn (adev->dev,"mes_v11_0_ring_get_wptr() requires doorbell!\n" ); + wptr =0 ; + }return wptr; }
@@ -294,7 +297,7 @@ static int convert_to_mes_queue_type(int queue_type)else if (queue_type ==AMDGPU_RING_TYPE_SDMA )return MES_QUEUE_TYPE_SDMA ;else -BUG (); +WARN (1 ,"Invalid queue type %d\n" , queue_type);return -1 ; }
@@ -1544,7 +1547,7 @@ static int mes_v11_0_queue_init(struct amdgpu_device *adev,else if (pipe ==AMDGPU_MES_SCHED_PIPE ) ring = &adev->mes.ring[0 ];else -BUG (); +WARN (1 ,"Invalid MES pipe %d\n" , pipe);if ((pipe ==AMDGPU_MES_SCHED_PIPE ) && (amdgpu_in_reset (adev) || adev->in_suspend)) {
@@ -1627,7 +1630,7 @@ static int mes_v11_0_mqd_sw_init(struct amdgpu_device *adev,else if (pipe ==AMDGPU_MES_SCHED_PIPE ) ring = &adev->mes.ring[0 ];else -BUG (); +return -EINVAL ;if (ring->mqd_obj)return 0 ;
Signature · 1 line
2.55.0
Re: [PATCH 15/30] drm/amdgpu/mes11: drop all BUG()s
Quoted 12 lines · Alex Deucher
There's no need to crash the kernel for these cases.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +0
-0
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c static void mes_v11_0_ring_set_wptr(struct amdgpu_ring *ring) · line 89
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +1
-1@@ -86,7 +86,7 @@ static void mes_v11_0_ring_set_wptr(struct amdgpu_ring *ring) ring->wptr);WDOORBELL64 (ring->doorbell_index, ring->wptr); }else { -BUG (); +dev_warn (adev->dev,"mes_v11_0_ring_set_wptr() requires doorbell!\n" );
Per scripts/checkpatch.pl:
WARNING: Prefer using '"%s...", __func__' to using 'mes_v11_0_ring_set_wptr', this function's name, in a string
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +0
-0} }@@ -97,12 +97,15 @@ static u64 mes_v11_0_ring_get_rptr(struct amdgpu_ring *ring)static u64 mes_v11_0_ring_get_wptr (struct amdgpu_ring *ring) {
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c static u64 mes_v11_0_ring_get_rptr(struct amdgpu_ring *ring) · line 106
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +4
-3+struct amdgpu_device *adev = ring->adev;u64 wptr; -if (ring->use_doorbell) +if (ring->use_doorbell) { wptr =atomic64_read ((atomic64_t *)ring->wptr_cpu_addr); -else -BUG (); + }else { +dev_warn (adev->dev,"mes_v11_0_ring_get_wptr() requires doorbell!\n" );
See above. Interestingly, scripts/checkpatch.pl doesn't catch this one.
There are additional prints like this in the series.
Thanks,
John
Quoted 32 lines
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +5
-3+ wptr =0 ; + }return wptr; }@@ -294,7 +297,7 @@ static int convert_to_mes_queue_type(int queue_type)else if (queue_type ==AMDGPU_RING_TYPE_SDMA )return MES_QUEUE_TYPE_SDMA ;else -BUG (); +WARN (1 ,"Invalid queue type %d\n" , queue_type);return -1 ; }@@ -1544,7 +1547,7 @@ static int mes_v11_0_queue_init(struct amdgpu_device *adev,else if (pipe ==AMDGPU_MES_SCHED_PIPE ) ring = &adev->mes.ring[0 ];else -BUG (); +WARN (1 ,"Invalid MES pipe %d\n" , pipe);if ((pipe ==AMDGPU_MES_SCHED_PIPE ) && (amdgpu_in_reset (adev) || adev->in_suspend)) {@@ -1627,7 +1630,7 @@ static int mes_v11_0_mqd_sw_init(struct amdgpu_device *adev,else if (pipe ==AMDGPU_MES_SCHED_PIPE ) ring = &adev->mes.ring[0 ];else -BUG (); +return -EINVAL ;if (ring->mqd_obj)return 0 ;
Alex Deucher
maintainerPATCH 16/30 drm/amdgpu/mes12: drop all BUG()s
In reply to Alex DeucherThere's no need to crash the kernel for these cases.
--- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +8 -5
@@ -59,7 +59,7 @@ static void mes_v12_0_ring_set_wptr(struct amdgpu_ring *ring) ring->wptr);WDOORBELL64 (ring->doorbell_index, ring->wptr); }else { -BUG (); +dev_warn (adev->dev,"mes_v12_0_ring_set_wptr() requires doorbell!\n" ); } }
@@ -70,12 +70,15 @@ static u64 mes_v12_0_ring_get_rptr(struct amdgpu_ring *ring)static u64 mes_v12_0_ring_get_wptr (struct amdgpu_ring *ring) { +struct amdgpu_device *adev = ring->adev;u64 wptr; -if (ring->use_doorbell) +if (ring->use_doorbell) { wptr =atomic64_read ((atomic64_t *)ring->wptr_cpu_addr); -else -BUG (); + }else { +dev_warn (adev->dev,"mes_v12_0_ring_get_wptr() requires doorbell!\n" ); + wptr =0 ; + }return wptr; }
@@ -279,7 +282,7 @@ static int convert_to_mes_queue_type(int queue_type)else if (queue_type ==AMDGPU_RING_TYPE_MES )return MES_QUEUE_TYPE_SCHQ ;else -BUG (); +WARN (1 ,"Invalid queue type %d\n" , queue_type);return -1 ; }
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 17/30 drm/amdgpu/mes12.1: drop all BUG()s
In reply to Alex DeucherThere's no need to crash the kernel for these cases.
--- drivers/gpu/drm/amd/amdgpu/mes_v12_1.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_v12_1.c +9 -5
@@ -61,7 +61,7 @@ static void mes_v12_1_ring_set_wptr(struct amdgpu_ring *ring) ring->wptr);WDOORBELL64 (ring->doorbell_index, ring->wptr); }else { -BUG (); +dev_warn (adev->dev,"mes_v12_1_ring_set_wptr() requires doorbell!\n" ); } }
@@ -72,12 +72,16 @@ static u64 mes_v12_1_ring_get_rptr(struct amdgpu_ring *ring)static u64 mes_v12_1_ring_get_wptr (struct amdgpu_ring *ring) { +struct amdgpu_device *adev = ring->adev;u64 wptr; -if (ring->use_doorbell) +if (ring->use_doorbell) { wptr =atomic64_read ((atomic64_t *)ring->wptr_cpu_addr); -else -BUG (); + }else { +dev_warn (adev->dev,"mes_v12_1_ring_get_wptr() requires doorbell!\n" ); + wptr =0 ; + + }return wptr; }
@@ -278,7 +282,7 @@ static int convert_to_mes_queue_type(int queue_type)else if (queue_type ==AMDGPU_RING_TYPE_MES )return MES_QUEUE_TYPE_SCHQ ;else -BUG (); +WARN (1 ,"Invalid queue type %d\n" , queue_type);return -1 ; }
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 18/30 drm/amdgpu/psp11: replace BUG() with an error
In reply to Alex DeucherThere's no need to crash the kernel for this case.
--- drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +1 -1
@@ -136,7 +136,7 @@ static int psp_v11_0_init_microcode(struct psp_context *psp) err =psp_init_toc_microcode (psp, ucode_prefix);break ;default : -BUG (); +return -EINVAL ; }return err;
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 19/30 drm/amdgpu/psp13: replace BUG() with an error
In reply to Alex DeucherThere's no need to crash the kernel for this case.
--- drivers/gpu/drm/amd/amdgpu/psp_v13_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/psp_v13_0.c +1 -1
@@ -133,7 +133,7 @@ static int psp_v13_0_init_microcode(struct psp_context *psp)return err;break ;default : -BUG (); +return -EINVAL ; }return 0 ;
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 20/30 drm/amdgpu/psp13.0.4: replace BUG() with an error
In reply to Alex DeucherThere's no need to crash the kernel for this case.
--- drivers/gpu/drm/amd/amdgpu/psp_v13_0_4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/psp_v13_0_4.c +1 -1
@@ -50,7 +50,7 @@ static int psp_v13_0_4_init_microcode(struct psp_context *psp)return err;break ;default : -BUG (); +return -EINVAL ; }return 0 ;
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 21/30 drm/amdgpu/psp14: replace BUG() with an error
In reply to Alex DeucherThere's no need to crash the kernel for this case.
--- drivers/gpu/drm/amd/amdgpu/psp_v14_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/psp_v14_0.c +1 -1
@@ -85,7 +85,7 @@ static int psp_v14_0_init_microcode(struct psp_context *psp)return err;break ;default : -BUG (); +return -EINVAL ; }return 0 ;
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 22/30 drm/amdgpu/gfx6: drop all BUG()s
In reply to Alex DeucherThere's no need to crash the kernel for these cases.
--- drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -6
@@ -347,7 +347,8 @@ static int gfx_v6_0_init_microcode(struct amdgpu_device *adev)case CHIP_HAINAN : chip_name ="hainan" ;break ; -default :BUG (); +default : +return -EINVAL ; } err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
@@ -1736,7 +1737,6 @@ static void gfx_v6_0_constants_init(struct amdgpu_device *adev) gb_addr_config =HAINAN_GB_ADDR_CONFIG_GOLDEN ;break ;default : -BUG ();break ; }
@@ -2202,7 +2202,7 @@ static u64 gfx_v6_0_ring_get_wptr(struct amdgpu_ring *ring)else if (ring == &adev->gfx.compute_ring[1 ])return RREG32 (mmCP_RB2_WPTR);else -BUG (); +return 0 ; }static void gfx_v6_0_ring_set_wptr_gfx (struct amdgpu_ring *ring)
@@ -2223,8 +2223,6 @@ static void gfx_v6_0_ring_set_wptr_compute(struct amdgpu_ring *ring) }else if (ring == &adev->gfx.compute_ring[1 ]) {WREG32 (mmCP_RB2_WPTR,lower_32_bits (ring->wptr)); (void )RREG32 (mmCP_RB2_WPTR); - }else { -BUG (); } }
@@ -3310,7 +3308,6 @@ static void gfx_v6_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev, }default : -BUG ();break ; }
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 23/30 drm/amdgpu/gfx7: drop all BUG()s
In reply to Alex DeucherThere's no need to crash the kernel for these cases.
--- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +1 -1
@@ -933,7 +933,7 @@ static int gfx_v7_0_init_microcode(struct amdgpu_device *adev) chip_name ="mullins" ;break ;default : -BUG (); +return -EINVAL ; } err = amdgpu_ucode_request(adev, &adev->gfx.pfp_fw,
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 24/30 drm/amdgpu/gfx8: drop all BUG()s
In reply to Alex DeucherThere's no need to crash the kernel for these cases.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -1
@@ -977,7 +977,7 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) chip_name ="vegam" ;break ;default : -BUG (); +return -EINVAL ; }if (adev->asic_type >=CHIP_POLARIS10 && adev->asic_type <=CHIP_POLARIS12 ) {
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 25/30 drm/amdgpu/gfx9: drop all BUG()s
In reply to Alex DeucherThere's no need to crash the kernel for these cases.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +9 -7
@@ -2107,8 +2107,7 @@ static int gfx_v9_0_gpu_early_init(struct amdgpu_device *adev)return err;break ;default : -BUG (); -break ; +return -EINVAL ; } adev->gfx.config.gb_addr_config = gb_addr_config;
@@ -5681,13 +5680,16 @@ static u64 gfx_v9_0_ring_get_rptr_compute(struct amdgpu_ring *ring)static u64 gfx_v9_0_ring_get_wptr_compute (struct amdgpu_ring *ring) { +struct amdgpu_device *adev = ring->adev;u64 wptr;/* XXX check if swapping is necessary on BE */ -if (ring->use_doorbell) +if (ring->use_doorbell) { wptr =atomic64_read ((atomic64_t *)ring->wptr_cpu_addr); -else -BUG (); + }else { +dev_warn (adev->dev,"gfx_v9_0_ring_get_wptr_compute() requires doorbell!\n" ); + wptr =0 ; + }return wptr; }
@@ -5699,8 +5701,8 @@ static void gfx_v9_0_ring_set_wptr_compute(struct amdgpu_ring *ring)if (ring->use_doorbell) {atomic64_set ((atomic64_t *)ring->wptr_cpu_addr, ring->wptr);WDOORBELL64 (ring->doorbell_index, ring->wptr); - }else { -BUG ();/* only DOORBELL method supported on gfx9 now */ + }else { +dev_warn (adev->dev,"gfx_v9_0_ring_set_wptr_compute() requires doorbell!\n" ); } }
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 26/30 drm/amdgpu/gfx9.4.3: drop all BUG()s
In reply to Alex DeucherThere's no need to crash the kernel for these cases.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +10 -4
@@ -3029,13 +3029,18 @@ static u64 gfx_v9_4_3_ring_get_rptr_compute(struct amdgpu_ring *ring)static u64 gfx_v9_4_3_ring_get_wptr_compute (struct amdgpu_ring *ring) { +struct amdgpu_device *adev = ring->adev;u64 wptr;/* XXX check if swapping is necessary on BE */ -if (ring->use_doorbell) +if (ring->use_doorbell) { wptr =atomic64_read ((atomic64_t *)&ring->adev->wb.wb[ring->wptr_offs]); -else -BUG (); + }else { +dev_warn (adev->dev, +"gfx_v9_4_3_ring_get_wptr_compute() requires doorbell!\n" ); + wptr =0 ; + + }return wptr; }
@@ -3048,7 +3053,8 @@ static void gfx_v9_4_3_ring_set_wptr_compute(struct amdgpu_ring *ring)atomic64_set ((atomic64_t *)&adev->wb.wb[ring->wptr_offs], ring->wptr);WDOORBELL64 (ring->doorbell_index, ring->wptr); }else { -BUG ();/* only DOORBELL method supported on gfx9 now */ +dev_warn (adev->dev, +"gfx_v9_4_3_ring_set_wptr_compute() requires doorbell!\n" ); } }
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 27/30 drm/amdgpu/gfx10: drop all BUG()s
In reply to Alex DeucherThere's no need to crash the kernel for these cases.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +10 -8
@@ -4580,7 +4580,7 @@ static const struct amdgpu_gfx_funcs gfx_v10_0_gfx_funcs = {static void gfx_v10_0_gpu_early_init (struct amdgpu_device *adev) { -u32 gb_addr_config; +u32 gb_addr_config =0 ;switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (10 ,1 ,10 ):
@@ -4620,7 +4620,6 @@ static void gfx_v10_0_gpu_early_init(struct amdgpu_device *adev) gb_addr_config =CYAN_SKILLFISH_GB_ADDR_CONFIG_GOLDEN ;break ;default : -BUG ();break ; }
@@ -8599,13 +8598,16 @@ static u64 gfx_v10_0_ring_get_rptr_compute(struct amdgpu_ring *ring)static u64 gfx_v10_0_ring_get_wptr_compute (struct amdgpu_ring *ring) { +struct amdgpu_device *adev = ring->adev;u64 wptr;/* XXX check if swapping is necessary on BE */ -if (ring->use_doorbell) +if (ring->use_doorbell) { wptr =atomic64_read ((atomic64_t *)ring->wptr_cpu_addr); -else -BUG (); + }else { +dev_warn (adev->dev,"gfx_v10_0_ring_get_wptr_compute() requires doorbell!\n" ); + wptr =0 ; + }return wptr; }
@@ -8618,7 +8620,7 @@ static void gfx_v10_0_ring_set_wptr_compute(struct amdgpu_ring *ring) ring->wptr);WDOORBELL64 (ring->doorbell_index, ring->wptr); }else { -BUG ();/* only DOORBELL method supported on gfx10 now */ +dev_warn (adev->dev,"gfx_v10_0_ring_set_wptr_compute() requires doorbell!\n" ); } }
@@ -9376,7 +9378,7 @@ static void gfx_v10_0_handle_priv_fault(struct amdgpu_device *adev, }break ;default : -BUG (); +break ; } }
@@ -9446,7 +9448,7 @@ static int gfx_v10_0_kiq_set_interrupt_state(struct amdgpu_device *adev, }break ;default : -BUG ();/* kiq only support GENERIC2_INT now */ +/* kiq only support GENERIC2_INT now */ break ; }return 0 ;
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 28/30 drm/amdgpu/gfx11: drop all BUG()s
In reply to Alex DeucherThere's no need to crash the kernel for these cases.
--- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +9 -8
@@ -1145,8 +1145,7 @@ static int gfx_v11_0_gpu_early_init(struct amdgpu_device *adev) adev->gfx.config.sc_earlyz_tile_fifo_size =0x300 ;break ;default : -BUG (); -break ; +return -EINVAL ; }return 0 ;
@@ -5958,13 +5957,16 @@ static u64 gfx_v11_0_ring_get_rptr_compute(struct amdgpu_ring *ring)static u64 gfx_v11_0_ring_get_wptr_compute (struct amdgpu_ring *ring) { +struct amdgpu_device *adev = ring->adev;u64 wptr;/* XXX check if swapping is necessary on BE */ -if (ring->use_doorbell) +if (ring->use_doorbell) { wptr =atomic64_read ((atomic64_t *)ring->wptr_cpu_addr); -else -BUG (); + }else { +dev_warn (adev->dev,"gfx_v11_0_ring_get_wptr_compute() requires doorbell!\n" ); + wptr =0 ; + }return wptr; }
@@ -5978,7 +5980,7 @@ static void gfx_v11_0_ring_set_wptr_compute(struct amdgpu_ring *ring) ring->wptr);WDOORBELL64 (ring->doorbell_index, ring->wptr); }else { -BUG ();/* only DOORBELL method supported on gfx11 now */ +dev_warn (adev->dev,"gfx_v11_0_ring_set_wptr_compute() requires doorbell!\n" ); } }
@@ -6751,7 +6753,6 @@ static void gfx_v11_0_handle_priv_fault(struct amdgpu_device *adev, }break ;default : -BUG ();break ; } }
@@ -6836,7 +6837,7 @@ static int gfx_v11_0_kiq_set_interrupt_state(struct amdgpu_device *adev, }break ;default : -BUG ();/* kiq only support GENERIC2_INT now */ +/* kiq only support GENERIC2_INT now */ break ; }return 0 ;
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 29/30 drm/amdgpu/gfx12: drop all BUG()s
In reply to Alex DeucherThere's no need to crash the kernel for these cases.
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +8 -7
@@ -964,8 +964,7 @@ static int gfx_v12_0_gpu_early_init(struct amdgpu_device *adev) adev->gfx.config.sc_earlyz_tile_fifo_size =0x4C0 ;break ;default : -BUG (); -break ; +return -EINVAL ; }return 0 ;
@@ -4469,13 +4468,16 @@ static u64 gfx_v12_0_ring_get_rptr_compute(struct amdgpu_ring *ring)static u64 gfx_v12_0_ring_get_wptr_compute (struct amdgpu_ring *ring) { +struct amdgpu_device *adev = ring->adev;u64 wptr;/* XXX check if swapping is necessary on BE */ -if (ring->use_doorbell) +if (ring->use_doorbell) { wptr =atomic64_read ((atomic64_t *)ring->wptr_cpu_addr); -else -BUG (); + }else { +dev_warn (adev->dev,"gfx_v12_0_ring_get_wptr_compute() requires doorbell!\n" ); + wptr =0 ; + }return wptr; }
@@ -4489,7 +4491,7 @@ static void gfx_v12_0_ring_set_wptr_compute(struct amdgpu_ring *ring) ring->wptr);WDOORBELL64 (ring->doorbell_index, ring->wptr); }else { -BUG ();/* only DOORBELL method supported on gfx12 now */ +dev_warn (adev->dev,"gfx_v12_0_ring_set_wptr_compute() requires doorbell!\n" ); } }
@@ -5084,7 +5086,6 @@ static void gfx_v12_0_handle_priv_fault(struct amdgpu_device *adev, }break ;default : -BUG ();break ; } }
Signature · 1 line
2.55.0
Alex Deucher
maintainerPATCH 30/30 drm/amdgpu/gfx12.1: drop all BUG()s
In reply to Alex DeucherThere's no need to crash the kernel for these cases.
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c +8 -6
@@ -891,8 +891,7 @@ static int gfx_v12_1_gpu_early_init(struct amdgpu_device *adev) adev->gfx.config.sc_earlyz_tile_fifo_size =0x4C0 ;break ;default : -BUG (); -break ; +return -EINVAL ; }return 0 ;
@@ -3671,13 +3670,16 @@ static u64 gfx_v12_1_ring_get_rptr_compute(struct amdgpu_ring *ring)static u64 gfx_v12_1_ring_get_wptr_compute (struct amdgpu_ring *ring) { +struct amdgpu_device *adev = ring->adev;u64 wptr;/* XXX check if swapping is necessary on BE */ -if (ring->use_doorbell) +if (ring->use_doorbell) { wptr =atomic64_read ((atomic64_t *)ring->wptr_cpu_addr); -else -BUG (); + }else { +dev_warn (adev->dev,"gfx_v12_1_ring_get_wptr_compute() requires doorbell!\n" ); + wptr =0 ; + }return wptr; }
@@ -3691,7 +3693,7 @@ static void gfx_v12_1_ring_set_wptr_compute(struct amdgpu_ring *ring) ring->wptr);WDOORBELL64 (ring->doorbell_index, ring->wptr); }else { -BUG ();/* only DOORBELL method supported on gfx12 now */ +dev_warn (adev->dev,"gfx_v12_1_ring_set_wptr_compute() requires doorbell!\n" ); } }
Signature · 1 line
2.55.0
RE: [PATCH 30/30] drm/amdgpu/gfx12.1: drop all BUG()s
AMD General
Looks good. Series is
Kent
Quoted 66 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: July 7, 2026 11:42 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 30/30] drm/amdgpu/gfx12.1: drop all BUG()sThere's no need to crash the kernel for these cases.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c +1
-2@@ -891,8 +891,7 @@ static int gfx_v12_1_gpu_early_init(struct amdgpu_device *adev) adev->gfx.config.sc_earlyz_tile_fifo_size = 0x4C0;break ;default : -BUG (); -break ; +return -EINVAL ; }return 0;drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c +6
-3@@ -3671,13 +3670,16 @@ static u64 gfx_v12_1_ring_get_rptr_compute(struct amdgpu_ring *ring) static u64 gfx_v12_1_ring_get_wptr_compute(struct amdgpu_ring *ring) { + struct amdgpu_device *adev = ring->adev; u64 wptr; /* XXX check if swapping is necessary on BE */ -if (ring->use_doorbell) + if (ring->use_doorbell) { wptr = atomic64_read((atomic64_t *)ring->wptr_cpu_addr); -else -BUG (); + } else { + dev_warn(adev->dev, "gfx_v12_1_ring_get_wptr_compute() requires doorbell!\n"); + wptr = 0; + } return wptr;}
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c +1
-1@@ -3691,7 +3693,7 @@ static void gfx_v12_1_ring_set_wptr_compute(struct amdgpu_ring *ring) ring->wptr);WDOORBELL64 (ring->doorbell_index, ring->wptr); } else { -BUG ();/* only DOORBELL method supported on gfx12 now */ + dev_warn(adev->dev, "gfx_v12_1_ring_set_wptr_compute() requires doorbell!\n"); }}
--
2.55.0