On 4/24/25 07:54, Shane Xiao wrote:
> In VM debug mode, it is desirable to notify the application
> to correct the freeing sequence by unmapping the memory before
> destroying the userptr in the old userptr path. Add a bitmask
> to decide whether to send gpu vm fault to the applition.
> 
> Signed-off-by: Shane Xiao <shane.x...@amd.com>

Reviewed-by: Christian König <christian.koe...@amd.com> for this one and feel 
free to add my acked-by to the second.

Regards,
Christian.

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 +
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index cc26cf1bd843..6a4c75124ad3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1230,6 +1230,7 @@ struct amdgpu_device {
>       bool                            debug_enable_ras_aca;
>       bool                            debug_exp_resets;
>       bool                            debug_disable_gpu_ring_reset;
> +     bool                            debug_vm_userptr;
>  
>       /* Protection for the following isolation structure */
>       struct mutex                    enforce_isolation_mutex;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index b9a1ef343c79..0ea3693a94de 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -143,6 +143,7 @@ enum AMDGPU_DEBUG_MASK {
>       AMDGPU_DEBUG_ENABLE_EXP_RESETS = BIT(5),
>       AMDGPU_DEBUG_DISABLE_GPU_RING_RESET = BIT(6),
>       AMDGPU_DEBUG_SMU_POOL = BIT(7),
> +     AMDGPU_DEBUG_VM_USERPTR = BIT(8),
>  };
>  
>  unsigned int amdgpu_vram_limit = UINT_MAX;
> @@ -2272,6 +2273,10 @@ static void amdgpu_init_debug_options(struct 
> amdgpu_device *adev)
>               pr_info("debug: use vram for smu pool\n");
>               adev->pm.smu_debug_mask |= SMU_DEBUG_POOL_USE_VRAM;
>       }
> +     if (amdgpu_debug_mask & AMDGPU_DEBUG_VM_USERPTR) {
> +             pr_info("debug: VM mode debug for userptr is enabled\n");
> +             adev->debug_vm_userptr = true;
> +     }
>  }
>  
>  static unsigned long amdgpu_fix_asic_type(struct pci_dev *pdev, unsigned 
> long flags)

Reply via email to