habanalabs: don't init vm module if no MMU

In case we are running without MMU enabled (debug mode), no need to
initialize the VM module in the driver.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
This commit is contained in:
Oded Gabbay 2020-10-04 23:00:39 +03:00
parent 8f50314674
commit f3a965c250
1 changed files with 14 additions and 19 deletions

View File

@ -1685,27 +1685,19 @@ int hl_vm_ctx_init(struct hl_ctx *ctx)
* In case of DRAM mapping, the returned address is the physical
* address of the memory related to the given handle.
*/
if (ctx->hdev->mmu_enable) {
if (!ctx->hdev->mmu_enable)
return 0;
dram_range_start = prop->dmmu.start_addr;
dram_range_end = prop->dmmu.end_addr;
host_range_start = prop->pmmu.start_addr;
host_range_end = prop->pmmu.end_addr;
host_huge_range_start = prop->pmmu_huge.start_addr;
host_huge_range_end = prop->pmmu_huge.end_addr;
} else {
dram_range_start = prop->dram_user_base_address;
dram_range_end = prop->dram_end_address;
host_range_start = prop->dram_user_base_address;
host_range_end = prop->dram_end_address;
host_huge_range_start = prop->dram_user_base_address;
host_huge_range_end = prop->dram_end_address;
}
return vm_ctx_init_with_ranges(ctx, host_range_start, host_range_end,
host_huge_range_start,
host_huge_range_end,
dram_range_start,
dram_range_end);
host_huge_range_start, host_huge_range_end,
dram_range_start, dram_range_end);
}
/*
@ -1737,6 +1729,9 @@ void hl_vm_ctx_fini(struct hl_ctx *ctx)
struct hlist_node *tmp_node;
int i;
if (!ctx->hdev->mmu_enable)
return;
hl_debugfs_remove_ctx_mem_hash(hdev, ctx);
/*