[Public] When disabling the gfx kernel queue, then the related ring function callback should be unassigned, and the clean shader callback should also not be further invoked. To avoid the clean shader resource allocated, we may need to drop the shader clean initialized at *_ sw_init() when disable gfx kernel queue. Regards, Prike > -----Original Message----- > From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of Alex > Deucher > Sent: Thursday, March 13, 2025 10:41 PM > To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx > Cc: Deucher, Alexander <Alexander.Deucher@xxxxxxx> > Subject: [PATCH 03/11] drm/amdgpu/gfx: add generic handling for disable_kq > > Add proper checks for disable_kq functionality in gfx helper functions. Add special > logic for families that require the clear state setup. > > v2: use ring count as per Felix suggestion > v3: fix num_gfx_rings handling in amdgpu_gfx_graphics_queue_acquire() > > Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 8 ++++++-- > drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 2 ++ > 2 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c > index 984e6ff6e4632..a08243dd0798e 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c > @@ -258,8 +258,9 @@ void amdgpu_gfx_graphics_queue_acquire(struct > amdgpu_device *adev) > } > > /* update the number of active graphics rings */ > - adev->gfx.num_gfx_rings = > - bitmap_weight(adev->gfx.me.queue_bitmap, > AMDGPU_MAX_GFX_QUEUES); > + if (adev->gfx.num_gfx_rings) > + adev->gfx.num_gfx_rings = > + bitmap_weight(adev->gfx.me.queue_bitmap, > AMDGPU_MAX_GFX_QUEUES); > } > > static int amdgpu_gfx_kiq_acquire(struct amdgpu_device *adev, @@ -1544,6 > +1545,9 @@ static ssize_t amdgpu_gfx_set_run_cleaner_shader(struct device > *dev, > if (adev->in_suspend && !adev->in_runpm) > return -EPERM; > > + if (adev->gfx.disable_kq) > + return -ENOTSUPP; > + > ret = kstrtol(buf, 0, &value); > > if (ret) > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h > b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h > index ddf4533614bac..8fa68a4ac34f1 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h > @@ -483,6 +483,8 @@ struct amdgpu_gfx { > > atomic_t total_submission_cnt; > struct delayed_work idle_work; > + > + bool disable_kq; > }; > > struct amdgpu_gfx_ras_reg_entry { > -- > 2.48.1