[PATCH] drm/amdgpu: properly handle GC vs MM in amdgpu_vmid_mgr_init()
Yadav, Arvind
arvyadav at amd.com
Wed Apr 30 14:40:56 UTC 2025
I also thought for previous patch but else was doing that. We can use
something like this.
just alternative solution.
if (amdgpu_ip_version(adev, GC_HWIP, 0) < IP_VERSION(10, 0, 0) ||
(!AMDGPU_IS_MMHUB0(i) && !AMDGPU_IS_MMHUB1(i)))
id_mgr->num_ids = adev->vm_manager.first_kfd_vmid;
else
id_mgr->num_ids = 16;
Reviewed-by: Arvind Yadav <Arvind.Yadav at amd.com>
On 4/30/2025 7:04 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")
>
> v2: Properly handle pre-GC 10 hardware
>
> Fixes: 1f61fc28b939 ("drm/amdgpu/mes: make more vmids available when disable_kq=1")
> Cc: Arvind Yadav <Arvind.Yadav at amd.com>
> Reviewed-by: Arvind Yadav <Arvind.Yadav at amd.com> v1
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 12 ++++++++++--
> drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 2 +-
> drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 2 +-
> 3 files changed, 12 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..5dd78a9cb12dd 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
> @@ -576,8 +576,16 @@ 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;
> + /* for GC <10, SDMA uses MMHUB so use first_kfd_vmid for both GC and MM */
> + if (amdgpu_ip_version(adev, GC_HWIP, 0) < IP_VERSION(10, 0, 0))
> + /* manage only VMIDs not used by KFD */
> + id_mgr->num_ids = adev->vm_manager.first_kfd_vmid;
> + else 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;
>
> /* 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