All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va
@ 2026-07-07 15:41 Alex Deucher
  2026-07-07 15:41 ` [PATCH 02/30] drm/amdgpu/gfx11: WARN() rather than BUG() for invalid SDMA engine Alex Deucher
                   ` (28 more replies)
  0 siblings, 29 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

If the bo_va is not present, return an error rather than
crashing the kernel.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index a0ca6ab358c55..dc263553e216b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -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;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 02/30] drm/amdgpu/gfx11: WARN() rather than BUG() for invalid SDMA engine
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 03/30] drm/amdgpu/gfx12: " Alex Deucher
                   ` (27 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for these cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v11.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v11.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v11.c
index aaccf0b9947d4..d32ea91eeb343 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v11.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v11.c
@@ -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
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 03/30] drm/amdgpu/gfx12: WARN() rather than BUG() for invalid SDMA engine
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
  2026-07-07 15:41 ` [PATCH 02/30] drm/amdgpu/gfx11: WARN() rather than BUG() for invalid SDMA engine Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 04/30] drm/amdgpu/gfx12.1: " Alex Deucher
                   ` (26 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for these cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v12.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v12.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v12.c
index e0ceab400b2da..f37d51ed9a6b0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v12.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v12.c
@@ -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
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 04/30] drm/amdgpu/gfx12.1: WARN() rather than BUG() for invalid SDMA engine
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
  2026-07-07 15:41 ` [PATCH 02/30] drm/amdgpu/gfx11: WARN() rather than BUG() for invalid SDMA engine Alex Deucher
  2026-07-07 15:41 ` [PATCH 03/30] drm/amdgpu/gfx12: " Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 05/30] drm/amdgpu/atomfirmware: WARN() rather than BUG() Alex Deucher
                   ` (25 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for these cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v12_1.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v12_1.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v12_1.c
index bcb180f9d3ff8..38ca1aea33b2f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v12_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v12_1.c
@@ -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
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 05/30] drm/amdgpu/atomfirmware: WARN() rather than BUG()
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (2 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 04/30] drm/amdgpu/gfx12.1: " Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 06/30] drm/amdgpu/cgs: " Alex Deucher
                   ` (24 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for this case.  Just
return an error.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
index 6860a3a4d4667..1e21e3444802b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
@@ -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();
 			}
 		}
 	}
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 06/30] drm/amdgpu/cgs: WARN() rather than BUG()
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (3 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 05/30] drm/amdgpu/atomfirmware: WARN() rather than BUG() Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 07/30] drm/amdgpu/ucode: " Alex Deucher
                   ` (23 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for these cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
index 09c8942c22d3b..b90ed81be420a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
@@ -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)
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 07/30] drm/amdgpu/ucode: WARN() rather than BUG()
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (4 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 06/30] drm/amdgpu/cgs: " Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 08/30] drm/amdgpu/cik_sdma: replace BUG() with an error Alex Deucher
                   ` (22 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for this case.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
index 6d9e96fabd581..4f1c711df5bd7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
@@ -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);
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 08/30] drm/amdgpu/cik_sdma: replace BUG() with an error
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (5 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 07/30] drm/amdgpu/ucode: " Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 09/30] drm/amdgpu/sdma2.4: " Alex Deucher
                   ` (21 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for this case.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
index b703ef1fe3406..b951328d94cfb 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c
@@ -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++) {
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 09/30] drm/amdgpu/sdma2.4: replace BUG() with an error
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (6 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 08/30] drm/amdgpu/cik_sdma: replace BUG() with an error Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 10/30] drm/amdgpu/sdma3.0: " Alex Deucher
                   ` (20 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for this case.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
index 397b08c7173ab..c7253b908351c 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
@@ -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++) {
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 10/30] drm/amdgpu/sdma3.0: replace BUG() with an error
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (7 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 09/30] drm/amdgpu/sdma2.4: " Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 11/30] drm/amdgpu/si: drop BUG()s Alex Deucher
                   ` (19 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for this case.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
index 8ac1c9dae72e7..05cce4bde73eb 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
@@ -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++) {
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 11/30] drm/amdgpu/si: drop BUG()s
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (8 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 10/30] drm/amdgpu/sdma3.0: " Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 12/30] drm/amdgpu/gmc6: replace BUG() with an error Alex Deucher
                   ` (18 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for these cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/si.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/si.c b/drivers/gpu/drm/amd/amdgpu/si.c
index 6e455ad66d626..7100f30ffeffa 100644
--- a/drivers/gpu/drm/amd/amdgpu/si.c
+++ b/drivers/gpu/drm/amd/amdgpu/si.c
@@ -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;
 }
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 12/30] drm/amdgpu/gmc6: replace BUG() with an error
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (9 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 11/30] drm/amdgpu/si: drop BUG()s Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 13/30] drm/amdgpu/imu11: WARN() rather than BUG() Alex Deucher
                   ` (17 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for this case.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
index a914dd8183b58..b49098931d197 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
@@ -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 */
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 13/30] drm/amdgpu/imu11: WARN() rather than BUG()
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (10 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 12/30] drm/amdgpu/gmc6: replace BUG() with an error Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 14/30] drm/amdgpu/imu12: " Alex Deucher
                   ` (16 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for this case.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/imu_v11_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/imu_v11_0.c b/drivers/gpu/drm/amd/amdgpu/imu_v11_0.c
index 05b164f38c97a..138eb822ba137 100644
--- a/drivers/gpu/drm/amd/amdgpu/imu_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/imu_v11_0.c
@@ -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;
 	}
 
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 14/30] drm/amdgpu/imu12: WARN() rather than BUG()
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (11 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 13/30] drm/amdgpu/imu11: WARN() rather than BUG() Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 15/30] drm/amdgpu/mes11: drop all BUG()s Alex Deucher
                   ` (15 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for this case.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/imu_v12_0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/imu_v12_0.c b/drivers/gpu/drm/amd/amdgpu/imu_v12_0.c
index 58cd87db80619..2943ec9521eee 100644
--- a/drivers/gpu/drm/amd/amdgpu/imu_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/imu_v12_0.c
@@ -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;
 	}
 
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 15/30] drm/amdgpu/mes11: drop all BUG()s
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (12 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 14/30] drm/amdgpu/imu12: " Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-08 14:48   ` John Olender
  2026-07-07 15:41 ` [PATCH 16/30] drm/amdgpu/mes12: " Alex Deucher
                   ` (14 subsequent siblings)
  28 siblings, 1 reply; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for these cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
index 72ca7302bbfbc..ee5229ae3d75e 100644
--- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
@@ -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;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 16/30] drm/amdgpu/mes12: drop all BUG()s
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (13 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 15/30] drm/amdgpu/mes11: drop all BUG()s Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 17/30] drm/amdgpu/mes12.1: " Alex Deucher
                   ` (13 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for these cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
index 04465804c2544..322743b257702 100644
--- a/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.c
@@ -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;
 }
 
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 17/30] drm/amdgpu/mes12.1: drop all BUG()s
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (14 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 16/30] drm/amdgpu/mes12: " Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 18/30] drm/amdgpu/psp11: replace BUG() with an error Alex Deucher
                   ` (12 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for these cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/mes_v12_1.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v12_1.c b/drivers/gpu/drm/amd/amdgpu/mes_v12_1.c
index dbdb9ba02a5fc..c034b6946c7e8 100644
--- a/drivers/gpu/drm/amd/amdgpu/mes_v12_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v12_1.c
@@ -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;
 }
 
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 18/30] drm/amdgpu/psp11: replace BUG() with an error
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (15 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 17/30] drm/amdgpu/mes12.1: " Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 19/30] drm/amdgpu/psp13: " Alex Deucher
                   ` (11 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for this case.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
index 479690c44f0d5..ca36d434cfe1e 100644
--- a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
@@ -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;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 19/30] drm/amdgpu/psp13: replace BUG() with an error
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (16 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 18/30] drm/amdgpu/psp11: replace BUG() with an error Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 20/30] drm/amdgpu/psp13.0.4: " Alex Deucher
                   ` (10 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for this case.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/psp_v13_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v13_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v13_0.c
index 00b4a34e6601f..4b0ab1025c2fb 100644
--- a/drivers/gpu/drm/amd/amdgpu/psp_v13_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v13_0.c
@@ -133,7 +133,7 @@ static int psp_v13_0_init_microcode(struct psp_context *psp)
 			return err;
 		break;
 	default:
-		BUG();
+		return -EINVAL;
 	}
 
 	return 0;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 20/30] drm/amdgpu/psp13.0.4: replace BUG() with an error
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (17 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 19/30] drm/amdgpu/psp13: " Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 21/30] drm/amdgpu/psp14: " Alex Deucher
                   ` (9 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for this case.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/psp_v13_0_4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v13_0_4.c b/drivers/gpu/drm/amd/amdgpu/psp_v13_0_4.c
index 3d5e26b3fa00a..caaeeef27544c 100644
--- a/drivers/gpu/drm/amd/amdgpu/psp_v13_0_4.c
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v13_0_4.c
@@ -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;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 21/30] drm/amdgpu/psp14: replace BUG() with an error
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (18 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 20/30] drm/amdgpu/psp13.0.4: " Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 22/30] drm/amdgpu/gfx6: drop all BUG()s Alex Deucher
                   ` (8 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for this case.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/psp_v14_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v14_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v14_0.c
index 040a61aefa866..7ed5f41969330 100644
--- a/drivers/gpu/drm/amd/amdgpu/psp_v14_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v14_0.c
@@ -85,7 +85,7 @@ static int psp_v14_0_init_microcode(struct psp_context *psp)
 			return err;
 		break;
 	default:
-		BUG();
+		return -EINVAL;
 	}
 
 	return 0;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 22/30] drm/amdgpu/gfx6: drop all BUG()s
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (19 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 21/30] drm/amdgpu/psp14: " Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 23/30] drm/amdgpu/gfx7: " Alex Deucher
                   ` (7 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for these cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
index ac90d8e9d86a8..4ba9ff7c3b3f6 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
@@ -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;
 
 	}
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 23/30] drm/amdgpu/gfx7: drop all BUG()s
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (20 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 22/30] drm/amdgpu/gfx6: drop all BUG()s Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 24/30] drm/amdgpu/gfx8: " Alex Deucher
                   ` (6 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for these cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index 65b8497ad5f02..4a020323469c3 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
@@ -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,
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 24/30] drm/amdgpu/gfx8: drop all BUG()s
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (21 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 23/30] drm/amdgpu/gfx7: " Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 25/30] drm/amdgpu/gfx9: " Alex Deucher
                   ` (5 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for these cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 9e0840df88497..15084c0c98c85 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -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) {
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 25/30] drm/amdgpu/gfx9: drop all BUG()s
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (22 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 24/30] drm/amdgpu/gfx8: " Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:41 ` [PATCH 26/30] drm/amdgpu/gfx9.4.3: " Alex Deucher
                   ` (4 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for these cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index 556e5cb3f4cd0..7e13023c324b9 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -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");
 	}
 }
 
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 26/30] drm/amdgpu/gfx9.4.3: drop all BUG()s
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (23 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 25/30] drm/amdgpu/gfx9: " Alex Deucher
@ 2026-07-07 15:41 ` Alex Deucher
  2026-07-07 15:42 ` [PATCH 27/30] drm/amdgpu/gfx10: " Alex Deucher
                   ` (3 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for these cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
index 44d38b76cb4f7..cab29f58601a5 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
@@ -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");
 	}
 }
 
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 27/30] drm/amdgpu/gfx10: drop all BUG()s
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (24 preceding siblings ...)
  2026-07-07 15:41 ` [PATCH 26/30] drm/amdgpu/gfx9.4.3: " Alex Deucher
@ 2026-07-07 15:42 ` Alex Deucher
  2026-07-07 15:42 ` [PATCH 28/30] drm/amdgpu/gfx11: " Alex Deucher
                   ` (2 subsequent siblings)
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:42 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for these cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index fa3deae20b29f..2f06230dfe4eb 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -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;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 28/30] drm/amdgpu/gfx11: drop all BUG()s
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (25 preceding siblings ...)
  2026-07-07 15:42 ` [PATCH 27/30] drm/amdgpu/gfx10: " Alex Deucher
@ 2026-07-07 15:42 ` Alex Deucher
  2026-07-07 15:42 ` [PATCH 29/30] drm/amdgpu/gfx12: " Alex Deucher
  2026-07-07 15:42 ` [PATCH 30/30] drm/amdgpu/gfx12.1: " Alex Deucher
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:42 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for these cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
index d5cb653639a64..a286aee31f72f 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
@@ -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;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 29/30] drm/amdgpu/gfx12: drop all BUG()s
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (26 preceding siblings ...)
  2026-07-07 15:42 ` [PATCH 28/30] drm/amdgpu/gfx11: " Alex Deucher
@ 2026-07-07 15:42 ` Alex Deucher
  2026-07-07 15:42 ` [PATCH 30/30] drm/amdgpu/gfx12.1: " Alex Deucher
  28 siblings, 0 replies; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:42 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for these cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
index dbf0cbbbe8561..995e8caa054b8 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
@@ -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;
 		}
 	}
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 30/30] drm/amdgpu/gfx12.1: drop all BUG()s
  2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
                   ` (27 preceding siblings ...)
  2026-07-07 15:42 ` [PATCH 29/30] drm/amdgpu/gfx12: " Alex Deucher
@ 2026-07-07 15:42 ` Alex Deucher
  2026-07-07 16:53   ` Russell, Kent
  28 siblings, 1 reply; 32+ messages in thread
From: Alex Deucher @ 2026-07-07 15:42 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

There's no need to crash the kernel for these cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c b/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c
index b73f2c7d88be5..cefc2d03f0c69 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c
@@ -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");
 	}
 }
 
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* RE: [PATCH 30/30] drm/amdgpu/gfx12.1: drop all BUG()s
  2026-07-07 15:42 ` [PATCH 30/30] drm/amdgpu/gfx12.1: " Alex Deucher
@ 2026-07-07 16:53   ` Russell, Kent
  0 siblings, 0 replies; 32+ messages in thread
From: Russell, Kent @ 2026-07-07 16:53 UTC (permalink / raw)
  To: Deucher, Alexander, amd-gfx@lists.freedesktop.org; +Cc: Deucher, Alexander

AMD General

Looks good. Series is

Reviewed-by: Kent Russell <kent.russell@amd.com>

Kent

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex
> Deucher
> Sent: July 7, 2026 11:42 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>
> Subject: [PATCH 30/30] drm/amdgpu/gfx12.1: drop all BUG()s
>
> There's no need to crash the kernel for these cases.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c
> b/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c
> index b73f2c7d88be5..cefc2d03f0c69 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c
> @@ -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");
>       }
>  }
>
> --
> 2.55.0


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 15/30] drm/amdgpu/mes11: drop all BUG()s
  2026-07-07 15:41 ` [PATCH 15/30] drm/amdgpu/mes11: drop all BUG()s Alex Deucher
@ 2026-07-08 14:48   ` John Olender
  0 siblings, 0 replies; 32+ messages in thread
From: John Olender @ 2026-07-08 14:48 UTC (permalink / raw)
  To: Alex Deucher, amd-gfx

On 7/7/26 11:41 AM, Alex Deucher wrote:
> There's no need to crash the kernel for these cases.
> 
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
> index 72ca7302bbfbc..ee5229ae3d75e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
> @@ -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

>  	}
>  }
>  
> @@ -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");

See above.  Interestingly, scripts/checkpatch.pl doesn't catch this one.

There are additional prints like this in the series.

Thanks,
John

> +		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;


^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2026-07-08 14:48 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-07 15:41 [PATCH 01/30] drm/amdgpu: return an error instead of BUG() for CSA bo_va Alex Deucher
2026-07-07 15:41 ` [PATCH 02/30] drm/amdgpu/gfx11: WARN() rather than BUG() for invalid SDMA engine Alex Deucher
2026-07-07 15:41 ` [PATCH 03/30] drm/amdgpu/gfx12: " Alex Deucher
2026-07-07 15:41 ` [PATCH 04/30] drm/amdgpu/gfx12.1: " Alex Deucher
2026-07-07 15:41 ` [PATCH 05/30] drm/amdgpu/atomfirmware: WARN() rather than BUG() Alex Deucher
2026-07-07 15:41 ` [PATCH 06/30] drm/amdgpu/cgs: " Alex Deucher
2026-07-07 15:41 ` [PATCH 07/30] drm/amdgpu/ucode: " Alex Deucher
2026-07-07 15:41 ` [PATCH 08/30] drm/amdgpu/cik_sdma: replace BUG() with an error Alex Deucher
2026-07-07 15:41 ` [PATCH 09/30] drm/amdgpu/sdma2.4: " Alex Deucher
2026-07-07 15:41 ` [PATCH 10/30] drm/amdgpu/sdma3.0: " Alex Deucher
2026-07-07 15:41 ` [PATCH 11/30] drm/amdgpu/si: drop BUG()s Alex Deucher
2026-07-07 15:41 ` [PATCH 12/30] drm/amdgpu/gmc6: replace BUG() with an error Alex Deucher
2026-07-07 15:41 ` [PATCH 13/30] drm/amdgpu/imu11: WARN() rather than BUG() Alex Deucher
2026-07-07 15:41 ` [PATCH 14/30] drm/amdgpu/imu12: " Alex Deucher
2026-07-07 15:41 ` [PATCH 15/30] drm/amdgpu/mes11: drop all BUG()s Alex Deucher
2026-07-08 14:48   ` John Olender
2026-07-07 15:41 ` [PATCH 16/30] drm/amdgpu/mes12: " Alex Deucher
2026-07-07 15:41 ` [PATCH 17/30] drm/amdgpu/mes12.1: " Alex Deucher
2026-07-07 15:41 ` [PATCH 18/30] drm/amdgpu/psp11: replace BUG() with an error Alex Deucher
2026-07-07 15:41 ` [PATCH 19/30] drm/amdgpu/psp13: " Alex Deucher
2026-07-07 15:41 ` [PATCH 20/30] drm/amdgpu/psp13.0.4: " Alex Deucher
2026-07-07 15:41 ` [PATCH 21/30] drm/amdgpu/psp14: " Alex Deucher
2026-07-07 15:41 ` [PATCH 22/30] drm/amdgpu/gfx6: drop all BUG()s Alex Deucher
2026-07-07 15:41 ` [PATCH 23/30] drm/amdgpu/gfx7: " Alex Deucher
2026-07-07 15:41 ` [PATCH 24/30] drm/amdgpu/gfx8: " Alex Deucher
2026-07-07 15:41 ` [PATCH 25/30] drm/amdgpu/gfx9: " Alex Deucher
2026-07-07 15:41 ` [PATCH 26/30] drm/amdgpu/gfx9.4.3: " Alex Deucher
2026-07-07 15:42 ` [PATCH 27/30] drm/amdgpu/gfx10: " Alex Deucher
2026-07-07 15:42 ` [PATCH 28/30] drm/amdgpu/gfx11: " Alex Deucher
2026-07-07 15:42 ` [PATCH 29/30] drm/amdgpu/gfx12: " Alex Deucher
2026-07-07 15:42 ` [PATCH 30/30] drm/amdgpu/gfx12.1: " Alex Deucher
2026-07-07 16:53   ` Russell, Kent

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.