[bug report] drm/xe: Set PTE_AE for smem allocations in integrated devices

Dan Carpenter dan.carpenter at linaro.org
Tue Feb 20 10:44:19 UTC 2024


Hello José Roberto de Souza,

This is a semi-automatic email about new static checker warnings.

    drivers/gpu/drm/xe/xe_pt.c:616 xe_pt_stage_bind()
    warn: variable dereferenced before check 'vma' (see line 595)

drivers/gpu/drm/xe/xe_pt.c
   594		struct xe_device *xe = tile_to_xe(tile);
   595		struct xe_bo *bo = xe_vma_bo(vma);
                                             ^^^
vma is dereferenced

   596		bool is_devmem = !xe_vma_is_userptr(vma) && bo &&
   597			(xe_bo_is_vram(bo) || xe_bo_is_stolen_devmem(bo));
   598		struct xe_res_cursor curs;
   599		struct xe_pt_stage_bind_walk xe_walk = {
   600			.base = {
   601				.ops = &xe_pt_stage_bind_ops,
   602				.shifts = xe_normal_pt_shifts,
   603				.max_level = XE_PT_HIGHEST_LEVEL,
   604			},
   605			.vm = xe_vma_vm(vma),
   606			.tile = tile,
   607			.curs = &curs,
   608			.va_curs_start = xe_vma_start(vma),
   609			.vma = vma,
   610			.wupd.entries = entries,
   611			.needs_64K = (xe_vma_vm(vma)->flags & XE_VM_FLAG_64K) && is_devmem,
   612		};
   613		struct xe_pt *pt = xe_vma_vm(vma)->pt_root[tile->id];
   614		int ret;
   615	
   616		if (vma && (vma->gpuva.flags & XE_VMA_ATOMIC_PTE_BIT) &&
                    ^^^
The patch adds a check for NULL after we would already have crashed.
Hopefully, the check can be removed.

   617		    (is_devmem || !IS_DGFX(xe)))
   618			xe_walk.default_pte |= XE_USM_PPGTT_PTE_AE;

regards,
dan carpenter


More information about the Intel-xe mailing list