[PATCH] drm/amdgpu: properly handle GC vs MM in amdgpu_vmid_mgr_init()
Alex Deucher
alexdeucher at gmail.com
Wed Apr 30 14:21:54 UTC 2025
On Wed, Apr 30, 2025 at 1:05 AM Yadav, Arvind <arvyadav at amd.com> wrote:
>
> Reviewed-by: Arvind Yadav <Arvind.Yadav at amd.com>
>
> On 4/29/2025 11:20 PM, Alex Deucher wrote:
> > When kernel queues are disabled, all GC vmids are available
> > for the scheduler. MM vmids are still managed by the driver
> > so make all 16 available.
> >
> > Also fix gmc 10 vs 11 mix up in
> > commit 1f61fc28b939 ("drm/amdgpu/mes: make more vmids available when disable_kq=1")
> >
> > Fixes: 1f61fc28b939 ("drm/amdgpu/mes: make more vmids available when disable_kq=1")
> > Cc: Arvind Yadav <Arvind.Yadav at amd.com>
> > Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> > ---
> > drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 8 ++++++--
> > drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 2 +-
> > drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 2 +-
> > 3 files changed, 8 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
> > index 359c19de9a5b9..c7a6d40ded5c3 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
> > @@ -576,8 +576,12 @@ void amdgpu_vmid_mgr_init(struct amdgpu_device *adev)
> > INIT_LIST_HEAD(&id_mgr->ids_lru);
> > id_mgr->reserved_use_count = 0;
> >
> > - /* manage only VMIDs not used by KFD */
> > - id_mgr->num_ids = adev->vm_manager.first_kfd_vmid;
> > + if (AMDGPU_IS_MMHUB0(i) ||
> > + AMDGPU_IS_MMHUB1(i))
> > + id_mgr->num_ids = 16;
> > + else
> > + /* manage only VMIDs not used by KFD */
> > + id_mgr->num_ids = adev->vm_manager.first_kfd_vmid;
We need to handle pre GC 10 here as well. I just sent out an updated patch.
Alex
> >
> > /* skip over VMID 0, since it is the system VM */
> > for (j = 1; j < id_mgr->num_ids; ++j) {
> > diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
> > index 7648e977b44bc..a3e2787501f18 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
> > @@ -896,7 +896,7 @@ static int gmc_v10_0_sw_init(struct amdgpu_ip_block *ip_block)
> > * amdgpu graphics/compute will use VMIDs 1-7
> > * amdkfd will use VMIDs 8-15
> > */
> > - adev->vm_manager.first_kfd_vmid = adev->gfx.disable_kq ? 1 : 8;
> > + adev->vm_manager.first_kfd_vmid = 8;
> >
> > amdgpu_vm_manager_init(adev);
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c
> > index 7f5ca170f141a..917d894a1316a 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c
> > @@ -828,7 +828,7 @@ static int gmc_v11_0_sw_init(struct amdgpu_ip_block *ip_block)
> > * amdgpu graphics/compute will use VMIDs 1-7
> > * amdkfd will use VMIDs 8-15
> > */
> > - adev->vm_manager.first_kfd_vmid = 8;
> > + adev->vm_manager.first_kfd_vmid = adev->gfx.disable_kq ? 1 : 8;
> >
> > amdgpu_vm_manager_init(adev);
> >
More information about the amd-gfx
mailing list