Commit 6bcb2d05 authored by Dani Liberman's avatar Dani Liberman Committed by Oded Gabbay
Browse files

habanalabs: fix user mappings calculation in case of page fault



As there are 2 types of user mappings, pmmu and hmmu, calculate
only the relevant mappings for the requested type.

Signed-off-by: default avatarDani Liberman <dliberman@habana.ai>
Reviewed-by: default avatarOded Gabbay <ogabbay@kernel.org>
Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
parent 5ad06bb1
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -2305,9 +2305,14 @@ static void hl_capture_user_mappings(struct hl_device *hdev, bool is_pmmu)
	}

	mutex_lock(&ctx->mem_hash_lock);
	hash_for_each(ctx->mem_hash, i, hnode, node)
	hash_for_each(ctx->mem_hash, i, hnode, node) {
		vm_type = hnode->ptr;
		if (((*vm_type == VM_TYPE_USERPTR) && is_pmmu) ||
				((*vm_type == VM_TYPE_PHYS_PACK) && !is_pmmu))
			pgf_info->num_of_user_mappings++;

	}

	if (!pgf_info->num_of_user_mappings)
		goto finish;