[PATCH] drm/amdgpu: Remove PACKET2 from amdgpu since it is not used

2025-04-12 Thread Rodrigo Siqueira
It looks like that CP_PACKET2 is from the radeon GPU driver and was brought to amdgpu, but it was never used. This commit removes PACKET2 and related defines from amdgpu. Signed-off-by: Rodrigo Siqueira --- drivers/gpu/drm/amd/amdgpu/cikd.h | 5 - drivers/gpu/drm/amd/amdgpu/nvd.h| 5 --

[PATCH] drm/amdgpu: Add documentation to some parts of the AMDGPU ring and wb

2025-04-12 Thread Rodrigo Siqueira
Add some random documentation associated with the ring buffer manipulations and writeback. Signed-off-by: Rodrigo Siqueira --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 29 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 37 2 files changed, 65 insertions

Re: [PATCH 0/6] Introduce a generic function to get the CSB buffer

2025-04-12 Thread Rodrigo Siqueira
On 04/08, Rodrigo Siqueira wrote: > On 04/07, Alex Deucher wrote: > > On Mon, Apr 7, 2025 at 4:15 PM Rodrigo Siqueira wrote: > > > > > > On 04/07, Alex Deucher wrote: > > > > On Sun, Apr 6, 2025 at 7:07 PM Rodrigo Siqueira > > > > wrote: > > > > > > > > > > This patchset was inspired and made on

[PATCH v2 3/9] drm/amdgpu/gfx: Use CSB helpers in gfx_v10_0_get_csb_buffer

2025-04-12 Thread Rodrigo Siqueira
Remove duplicate code by using CSB helpers. Signed-off-by: Rodrigo Siqueira --- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 34 -- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c

[PATCH v2 4/9] drm/amdgpu/gfx: Use CSB helpers in gfx_v9_0_get_csb_buffer

2025-04-12 Thread Rodrigo Siqueira
Eliminate code duplication in gfx_v9_0_get_csb_buffer by using CSB helpers. Signed-off-by: Rodrigo Siqueira --- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 32 --- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/

[PATCH v2 2/9] drm/amdgpu/gfx: Use CSB helpers in gfx_v11_0_get_csb_buffer

2025-04-12 Thread Rodrigo Siqueira
Part of the code in gfx_v11_0_get_csb_buffer can be removed in favor of some GFX CSB helpers. This commit removes the duplicated part for the GFX 11 CSB function. Signed-off-by: Rodrigo Siqueira --- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 34 -- 1 file changed, 5 inserti

[PATCH v2 5/9] drm/amdgpu/gfx: Use CSB helpers in gfx_v8_0_get_csb_buffer

2025-04-12 Thread Rodrigo Siqueira
Remove code duplication from gfx_v8_0_get_csb_buffer by using CSB helpers. Signed-off-by: Rodrigo Siqueira --- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 34 --- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/g

[PATCH v2 9/9] drm/amdgpu: Add CSB documentation

2025-04-12 Thread Rodrigo Siqueira
Add a description for the get_csb_buffer callback and an entry for CSB in the glossary. Signed-off-by: Rodrigo Siqueira --- Documentation/gpu/amdgpu/amdgpu-glossary.rst | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h | 14 ++ 2 files changed, 17 insertions(+) diff --git a/Doc

[PATCH v2 1/9] drm/amdgpu/gfx: Introduce helpers for CSB manipulation

2025-04-12 Thread Rodrigo Siqueira
>From GFX6 to GFX11, there is a function for getting the CSB buffer to be put into the hardware. Three common parts are duplicated in all of these GFX functions: 1. Prepare the CSB preamble. 2. Parser the CS data. 3. End the CSB preamble. This commit creates helpers to be used from GFX6 to GFX11.

[PATCH v2 6/9] drm/amdgpu/gfx: Use CSB helpers in gfx_v7_0_get_csb_buffer

2025-04-12 Thread Rodrigo Siqueira
Use CSB helpers to remove code duplication from gfx_v7_0_get_csb_buffer. Signed-off-by: Rodrigo Siqueira --- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 30 --- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu

[PATCH v2 0/9] Introduce a helper functions to get the CSB buffer

2025-04-12 Thread Rodrigo Siqueira
This patchset was inspired from the below series: https://lore.kernel.org/amd-gfx/20250319162225.3775315-1-alexander.deuc...@amd.com/ In the above series, there is a bug fix in many functions named gfx_vX_0_get_csb_buffer (where X ranges from 6 to 11). After closely looking at those functions, it

[PATCH v2 7/9] drm/amdgpu/gfx: Clean up gfx_v7_0_get_csb_buffer

2025-04-12 Thread Rodrigo Siqueira
CHIP_KAVERI, CHIP_KABINI, and CHIP_MULLINS have the same buffer manipulation as the default option in the switch case. Remove those specific manipulations and rely on the default behavior for them. Signed-off-by: Rodrigo Siqueira --- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 9 - 1 file ch

[PATCH v2 8/9] drm/amdgpu/gfx: Use CSB helpers in gfx_v6_0_get_csb_buffer

2025-04-12 Thread Rodrigo Siqueira
Remove duplications from gfx_v6_0_get_csb_buffer by using CSB helpers. Signed-off-by: Rodrigo Siqueira --- drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 29 --- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c b/drivers/gpu/d

[PATCH v2 2/2] drm/amdgpu: Clean up error handling in amdgpu_userq_fence_driver_alloc()

2025-04-12 Thread Dan Carpenter
1) Checkpatch complains if we print an error message for kzalloc() failure. The kzalloc() failure already has it's own error messages built in. Also this allocation is small enough that it is guaranteed to succeed. 2) Return directly instead of doing a goto free_fence_drv. The "fence

[PATCH v2 1/2] drm/amdgpu: Fix double free in amdgpu_userq_fence_driver_alloc()

2025-04-12 Thread Dan Carpenter
The goto frees "fence_drv" so this is a double free bug. There is no need to call amdgpu_seq64_free(adev, fence_drv->va) since the seq64 allocation failed so change the goto to goto free_fence_drv. Also propagate the error code from amdgpu_seq64_alloc() instead of hard coding it to -ENOMEM. Fixe

Re: [PATCH next] drm/amdgpu: Fix double free in amdgpu_userq_fence_driver_alloc()

2025-04-12 Thread Dan Carpenter
On Thu, Apr 10, 2025 at 10:29:31PM +0530, Yadav, Arvind wrote: > Please change this also instead of 'goto free_fence_drv' just return err. > >     fence_drv = kzalloc(sizeof(*fence_drv), GFP_KERNEL); >     if (!fence_drv) { >     DRM_ERROR("Failed to allocate memory for fence d

[PATCH v2 0/2] drm/amdgpu: Fixes to amdgpu_userq_fence_driver_alloc()

2025-04-12 Thread Dan Carpenter
This fixes a double free on one error path in amdgpu_userq_fence_driver_alloc() and cleans up another error path. v2: Did some additional cleanup Dan Carpenter (2): drm/amdgpu: Fix double free in amdgpu_userq_fence_driver_alloc() drm/amdgpu: Clean up error handling in amdgpu_userq_fence_d

[PATCH] drm/amdgpu: Add queue id support to the user queue wait IOCTL

2025-04-12 Thread Arunpravin Paneer Selvam
Add queue id support to the user queue wait IOCTL drm_amdgpu_userq_wait structure. This is required to retrieve the wait user queue and maintain the fence driver references in it so that the user queue in the same context releases their reference to the fence drivers at some point before queue des

[PATCH v2] drm/amdgpu: Add queue id support to the user queue wait IOCTL

2025-04-12 Thread Arunpravin Paneer Selvam
Add queue id support to the user queue wait IOCTL drm_amdgpu_userq_wait structure. This is required to retrieve the wait user queue and maintain the fence driver references in it so that the user queue in the same context releases their reference to the fence drivers at some point before queue des