Skip to contentSkip to conversation

drm/amdgpu/gfx6: fix CSIB handling

PATCH In review Alex Deucher 3 participants 10 messages Mar 19, 2025 – Mar 25, 2025

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/6 drm/amdgpu/gfx6: fix CSIB handling

We shouldn't return after the last section.
We need to update the rest of the CSIB.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -2
index 13fbee46417af..cee2cf47112c9 100644
@@ -2874,8 +2874,6 @@ static void gfx_v6_0_get_csb_buffer(struct amdgpu_device *adev,
 				buffer[count++] = cpu_to_le32(ext->reg_index - 0xa000);
 				for (i = 0; i < ext->reg_count; i++)
 					buffer[count++] = cpu_to_le32(ext->extent[i]);
-			} else {
-				return;
 			}
 		}
 	}
Signature · 1 line
2.48.1
author maintainer
#1 lore raw

PATCH 2/6 drm/amdgpu/gfx7: fix CSIB handling

We shouldn't return after the last section.
We need to update the rest of the CSIB.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -2
index 8181bd0e4f189..0deeee542623a 100644
@@ -3906,8 +3906,6 @@ static void gfx_v7_0_get_csb_buffer(struct amdgpu_device *adev,
 				buffer[count++] = cpu_to_le32(ext->reg_index - PACKET3_SET_CONTEXT_REG_START);
 				for (i = 0; i < ext->reg_count; i++)
 					buffer[count++] = cpu_to_le32(ext->extent[i]);
-			} else {
-				return;
 			}
 		}
 	}
Signature · 1 line
2.48.1
author maintainer
#2 lore raw

PATCH 3/6 drm/amdgpu/gfx8: fix CSIB handling

In reply to Alex Deucher

We shouldn't return after the last section.
We need to update the rest of the CSIB.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -2
index bfedd487efc53..fc73be4ab0685 100644
@@ -1248,8 +1248,6 @@ static void gfx_v8_0_get_csb_buffer(struct amdgpu_device *adev,
 						PACKET3_SET_CONTEXT_REG_START);
 				for (i = 0; i < ext->reg_count; i++)
 					buffer[count++] = cpu_to_le32(ext->extent[i]);
-			} else {
-				return;
 			}
 		}
 	}
Signature · 1 line
2.48.1
author maintainer
#3 lore raw

PATCH 4/6 drm/amdgpu/gfx9: fix CSIB handling

In reply to Alex Deucher

We shouldn't return after the last section.
We need to update the rest of the CSIB.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -2
index 1080e9198ad9d..2d3054b305722 100644
@@ -1648,8 +1648,6 @@ static void gfx_v9_0_get_csb_buffer(struct amdgpu_device *adev,
 						PACKET3_SET_CONTEXT_REG_START);
 				for (i = 0; i < ext->reg_count; i++)
 					buffer[count++] = cpu_to_le32(ext->extent[i]);
-			} else {
-				return;
 			}
 		}
 	}
Signature · 1 line
2.48.1
author maintainer
#4 lore raw

PATCH 5/6 drm/amdgpu/gfx10: fix CSIB handling

In reply to Alex Deucher

We shouldn't return after the last section.
We need to update the rest of the CSIB.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +0 -2
index a63ce747863f1..a1e3bb43babcb 100644
@@ -4322,8 +4322,6 @@ static void gfx_v10_0_get_csb_buffer(struct amdgpu_device *adev,
 						PACKET3_SET_CONTEXT_REG_START);
 				for (i = 0; i < ext->reg_count; i++)
 					buffer[count++] = cpu_to_le32(ext->extent[i]);
-			} else {
-				return;
 			}
 		}
 	}
Signature · 1 line
2.48.1
author maintainer
#5 lore raw

PATCH 6/6 drm/amdgpu/gfx11: fix CSIB handling

In reply to Alex Deucher

We shouldn't return after the last section.
We need to update the rest of the CSIB.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +0 -2
index 5961fe15a3e26..d4646e5a52231 100644
@@ -861,8 +861,6 @@ static void gfx_v11_0_get_csb_buffer(struct amdgpu_device *adev,
 						PACKET3_SET_CONTEXT_REG_START);
 				for (i = 0; i < ext->reg_count; i++)
 					buffer[count++] = cpu_to_le32(ext->extent[i]);
-			} else {
-				return;
 			}
 		}
 	}
Signature · 1 line
2.48.1
#6 lore raw
In reply to Alex Deucher

ping on this series?

Alex

Quoted 25 lines · Alex Deucher

We shouldn't return after the last section.
We need to update the rest of the CSIB.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -3
index 13fbee46417af..cee2cf47112c9 100644
@@ -2874,8 +2874,6 @@ static void gfx_v6_0_get_csb_buffer(struct amdgpu_device *adev,
                                buffer[count++] = cpu_to_le32(ext->reg_index - 0xa000);
                                for (i = 0; i < ext->reg_count; i++)
                                        buffer[count++] = cpu_to_le32(ext->extent[i]);
-                       } else {
-                               return;
                        }
                }
        }
--

2.48.1

#7 lore raw
In reply to Alex Deucher
Quoted 2 lines · Alex Deucher

We shouldn't return after the last section.
We need to update the rest of the CSIB.

What is CSIB?

What happens if the other CSIB is not updated?

Thanks

Quoted 22 lines
---
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -2
index 13fbee46417af..cee2cf47112c9 100644
@@ -2874,8 +2874,6 @@ static void gfx_v6_0_get_csb_buffer(struct amdgpu_device *adev,
 				buffer[count++] = cpu_to_le32(ext->reg_index - 0xa000);
 				for (i = 0; i < ext->reg_count; i++)
 					buffer[count++] = cpu_to_le32(ext->extent[i]);
-			} else {
-				return;
 			}
 		}
 	}
Signature · 1 line
2.48.1
Signature · 1 line
Rodrigo Siqueira
#8 lore raw
Quoted 6 lines · Rodrigo Siqueira
Quoted 2 lines · Alex Deucher

We shouldn't return after the last section.
We need to update the rest of the CSIB.

What is CSIB?

Clear State Indirect Buffer. It provides the clear state that gets put into the hardware context if when user mode puts requests the clear state in their command buffer. Driver programs this explicitly when it sets up the kernel rings. Driver also provides a pointer to it which is used by the firmware to load the clear state in some cases.

Quoted 2 lines

What happens if the other CSIB is not updated?

The clear state packet submitted by userspace won't work as expected if the clear state is not properly initialized. In this case, I'm not sure if there is actually a function difference since the driver always initializes the clear state at kernel queue init time, but best to make sure the buffer pointed to by the RLC is correct.

Alex

Quoted 28 lines

Thanks

Quoted 20 lines
---
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -3
index 13fbee46417af..cee2cf47112c9 100644
@@ -2874,8 +2874,6 @@ static void gfx_v6_0_get_csb_buffer(struct amdgpu_device *adev,
                              buffer[count++] = cpu_to_le32(ext->reg_index - 0xa000);
                              for (i = 0; i < ext->reg_count; i++)
                                      buffer[count++] = cpu_to_le32(ext->extent[i]);
-                     } else {
-                             return;
                      }
              }
      }
--
Quoted 2 lines

2.48.1

--
Rodrigo Siqueira

Reviewed-by
#9 lore raw
Quoted 6 lines · Alex Deucher
Quoted 5 lines · Rodrigo Siqueira
Quoted 2 lines · Alex Deucher

We shouldn't return after the last section.
We need to update the rest of the CSIB.

Quoted 9 lines
Quoted 1 line

What is CSIB?

Clear State Indirect Buffer. It provides the clear state that gets put into the hardware context if when user mode puts requests the clear state in their command buffer. Driver programs this explicitly when it sets up the kernel rings. Driver also provides a pointer to it which is used by the firmware to load the clear state in some cases.

Thanks for the explanation.

Quoted 9 lines
Quoted 2 lines

What happens if the other CSIB is not updated?

The clear state packet submitted by userspace won't work as expected if the clear state is not properly initialized. In this case, I'm not sure if there is actually a function difference since the driver always initializes the clear state at kernel queue init time, but best to make sure the buffer pointed to by the RLC is correct.

Make sense.

This series is:

Thanks

Quoted 30 lines

Alex

Quoted 28 lines

Thanks

Quoted 20 lines
---
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -3
index 13fbee46417af..cee2cf47112c9 100644
@@ -2874,8 +2874,6 @@ static void gfx_v6_0_get_csb_buffer(struct amdgpu_device *adev,
                              buffer[count++] = cpu_to_le32(ext->reg_index - 0xa000);
                              for (i = 0; i < ext->reg_count; i++)
                                      buffer[count++] = cpu_to_le32(ext->extent[i]);
-                     } else {
-                             return;
                      }
              }
      }
--
Quoted 2 lines

2.48.1

--
Rodrigo Siqueira

Signature · 1 line
Rodrigo Siqueira