[PATCH] drm/amdkfd: Enforce queue BO's adev

Alex Deucher alexdeucher at gmail.com
Wed Apr 24 18:01:12 UTC 2024


On Wed, Apr 24, 2024 at 1:57 PM Harish Kasiviswanathan
<Harish.Kasiviswanathan at amd.com> wrote:
>
> Queue buffer, though it is in system memory, has to be created using the
> correct amdgpu device. Enforce this as the BO needs to mapped to the
> GART for MES Hardware scheduler to access it.
>
> Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan at amd.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> index 8fd5e0da628c..963cf6d657cb 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
> @@ -373,6 +373,11 @@ static int kfd_ioctl_create_queue(struct file *filep, struct kfd_process *p,
>                         err = -EINVAL;
>                         goto err_wptr_map_gart;
>                 }
> +               if (dev->adev != amdgpu_ttm_adev(wptr_bo->tbo.bdev)) {
> +                       pr_err("Queue memory allocated to wrong device\n");
> +                       err = -EINVAL;
> +                       goto err_wptr_map_gart;
> +               }
>
>                 err = amdgpu_amdkfd_map_gtt_bo_to_gart(dev->adev, wptr_bo);
>                 if (err) {
> --
> 2.34.1
>


More information about the amd-gfx mailing list