Skip to content

Commit 8e320f6

Browse files
AMD-ShaneXiaoalexdeucher
authored andcommitted
drm/amdgpu: Add debug bit for userptr usage
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.xiao@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent def4114 commit 8e320f6

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,7 @@ struct amdgpu_device {
12811281
bool debug_enable_ras_aca;
12821282
bool debug_exp_resets;
12831283
bool debug_disable_gpu_ring_reset;
1284+
bool debug_vm_userptr;
12841285

12851286
/* Protection for the following isolation structure */
12861287
struct mutex enforce_isolation_mutex;

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ enum AMDGPU_DEBUG_MASK {
143143
AMDGPU_DEBUG_ENABLE_EXP_RESETS = BIT(5),
144144
AMDGPU_DEBUG_DISABLE_GPU_RING_RESET = BIT(6),
145145
AMDGPU_DEBUG_SMU_POOL = BIT(7),
146+
AMDGPU_DEBUG_VM_USERPTR = BIT(8),
146147
};
147148

148149
unsigned int amdgpu_vram_limit = UINT_MAX;
@@ -2273,6 +2274,10 @@ static void amdgpu_init_debug_options(struct amdgpu_device *adev)
22732274
pr_info("debug: use vram for smu pool\n");
22742275
adev->pm.smu_debug_mask |= SMU_DEBUG_POOL_USE_VRAM;
22752276
}
2277+
if (amdgpu_debug_mask & AMDGPU_DEBUG_VM_USERPTR) {
2278+
pr_info("debug: VM mode debug for userptr is enabled\n");
2279+
adev->debug_vm_userptr = true;
2280+
}
22762281
}
22772282

22782283
static unsigned long amdgpu_fix_asic_type(struct pci_dev *pdev, unsigned long flags)

0 commit comments

Comments
 (0)