Skip to contentSkip to conversation

drm/amdgpu: fix incorrect active RB bitmap in setup RBs

PATCH In review Tim Huang 2 participants 3 messages Jan 6, 2025

Subsystems (2)
lore
Share & tools
lore

Tim Huang

author
#0 lore raw

PATCH 1/2 drm/amdgpu: fix incorrect active RB bitmap in setup RBs

The RB bitmap width per SA may be 0x1 for some ASICs. Use the actual bitmap of SA instead of 0x3 to determine the active RB bitmap.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +4 -1
index 1f9279f69712..25641677cae2 100644
@@ -1914,6 +1914,7 @@ static u32 gfx_v11_0_get_rb_active_bitmap(struct amdgpu_device *adev)
 
 static void gfx_v11_0_setup_rb(struct amdgpu_device *adev)
 {
+	u32 rb_bitmap_per_sa;
 	u32 rb_bitmap_width_per_sa;
 	u32 max_sa;
 	u32 active_sa_bitmap;
@@ -1931,9 +1932,11 @@ static void gfx_v11_0_setup_rb(struct amdgpu_device *adev)
 		 adev->gfx.config.max_sh_per_se;
 	rb_bitmap_width_per_sa = adev->gfx.config.max_backends_per_se /
 				 adev->gfx.config.max_sh_per_se;
+	rb_bitmap_per_sa = amdgpu_gfx_create_bitmask(rb_bitmap_width_per_sa);
+
 	for (i = 0; i < max_sa; i++) {
 		if (active_sa_bitmap & (1 << i))
-			active_rb_bitmap |= (0x3 << (i * rb_bitmap_width_per_sa));
+			active_rb_bitmap |= (rb_bitmap_per_sa << (i * rb_bitmap_width_per_sa));
 	}
 
 	active_rb_bitmap &= global_active_rb_bitmap;
Signature · 1 line
2.43.0
author
#1 lore raw

PATCH 2/2 drm/amdgpu: fix incorrect number of active RBs for gfx12

The RB bitmap should be global active RB bitmap &
active RB bitmap based on active SA.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +5 -2
index 3aa34c55554d..f8d46651dbf5 100644
@@ -1650,6 +1650,7 @@ static u32 gfx_v12_0_get_rb_active_bitmap(struct amdgpu_device *adev)
 
 static void gfx_v12_0_setup_rb(struct amdgpu_device *adev)
 {
+	u32 rb_bitmap_per_sa;
 	u32 rb_bitmap_width_per_sa;
 	u32 max_sa;
 	u32 active_sa_bitmap;
@@ -1667,12 +1668,14 @@ static void gfx_v12_0_setup_rb(struct amdgpu_device *adev)
 		 adev->gfx.config.max_sh_per_se;
 	rb_bitmap_width_per_sa = adev->gfx.config.max_backends_per_se /
 				 adev->gfx.config.max_sh_per_se;
+	rb_bitmap_per_sa = amdgpu_gfx_create_bitmask(rb_bitmap_width_per_sa);
+
 	for (i = 0; i < max_sa; i++) {
 		if (active_sa_bitmap & (1 << i))
-			active_rb_bitmap |= (0x3 << (i * rb_bitmap_width_per_sa));
+			active_rb_bitmap |= (rb_bitmap_per_sa << (i * rb_bitmap_width_per_sa));
 	}
 
-	active_rb_bitmap |= global_active_rb_bitmap;
+	active_rb_bitmap &= global_active_rb_bitmap;
 	adev->gfx.config.backend_enable_mask = active_rb_bitmap;
 	adev->gfx.config.num_rbs = hweight32(active_rb_bitmap);
 }
Signature · 1 line
2.43.0
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] drm/amdgpu: fix incorrect number of active RBs for gfx12

Quoted 5 lines · Tim Huang

The RB bitmap should be global active RB bitmap &
active RB bitmap based on active SA.

Series is:

Quoted 36 lines
---
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +5 -3
index 3aa34c55554d..f8d46651dbf5 100644
@@ -1650,6 +1650,7 @@ static u32 gfx_v12_0_get_rb_active_bitmap(struct amdgpu_device *adev)
 
 static void gfx_v12_0_setup_rb(struct amdgpu_device *adev)
 {
+       u32 rb_bitmap_per_sa;
        u32 rb_bitmap_width_per_sa;
        u32 max_sa;
        u32 active_sa_bitmap;
@@ -1667,12 +1668,14 @@ static void gfx_v12_0_setup_rb(struct amdgpu_device *adev)
                 adev->gfx.config.max_sh_per_se;
        rb_bitmap_width_per_sa = adev->gfx.config.max_backends_per_se /
                                 adev->gfx.config.max_sh_per_se;
+       rb_bitmap_per_sa = amdgpu_gfx_create_bitmask(rb_bitmap_width_per_sa);
+
        for (i = 0; i < max_sa; i++) {
                if (active_sa_bitmap & (1 << i))
-                       active_rb_bitmap |= (0x3 << (i * rb_bitmap_width_per_sa));
+                       active_rb_bitmap |= (rb_bitmap_per_sa << (i * rb_bitmap_width_per_sa));
        }
 
-       active_rb_bitmap |= global_active_rb_bitmap;
+       active_rb_bitmap &= global_active_rb_bitmap;
        adev->gfx.config.backend_enable_mask = active_rb_bitmap;
        adev->gfx.config.num_rbs = hweight32(active_rb_bitmap);
 }
--

2.43.0