anv: Fix vm bind of DRM_XE_VM_BIND_FLAG_NULL

In this case bo is NULL so application was crashing when it was trying
to get the alloc_flags of bo to get the intel_device_info_pat_entry.

Fixes: 1a0d3504d5 ("anv: Fill PAT fields in Xe KMD gem_create and vm_bind uAPIs")
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26430>
This commit is contained in:
José Roberto de Souza 2023-11-30 09:11:20 -08:00 committed by Marge Bot
parent 5bc27e80c9
commit 42dd48e933

View file

@ -151,10 +151,12 @@ xe_vm_bind_op(struct anv_device *device,
.op = DRM_XE_VM_BIND_OP_UNMAP,
.flags = 0,
.prefetch_mem_region_instance = 0,
.pat_index = anv_device_get_pat_entry(device, bo->alloc_flags)->index,
};
if (bind->op == ANV_VM_BIND) {
const enum anv_bo_alloc_flags alloc_flags = bo ? bo->alloc_flags : 0;
xe_bind->pat_index = anv_device_get_pat_entry(device, alloc_flags)->index;
if (!bo) {
xe_bind->op = DRM_XE_VM_BIND_OP_MAP;
xe_bind->flags |= DRM_XE_VM_BIND_FLAG_NULL;