aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorOhad Sharabi <osharabi@habana.ai>2022-04-10 11:19:42 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-05-22 21:01:18 +0200
commit5d1a0de2c778f369970dd50f6713e95068926a8b (patch)
treecb9e460ceda645a806dc760f96d5347decf43fda /drivers/misc
parenthabanalabs: Stop using iommu_present() (diff)
downloadlinux-dev-5d1a0de2c778f369970dd50f6713e95068926a8b.tar.xz
linux-dev-5d1a0de2c778f369970dd50f6713e95068926a8b.zip
habanalabs: add prefetch flag to the MAP operation
This patch let the user decide whether the translations done in the page tables will be fetched directly to the STLB right after the map. We want to let the user control whether to perform prefetch upon map operation. To do so a memory flag was added, to be used in the MAP ioctl, called HL_MEM_PREFETCH and if set- the mappings will be fetched directly to the STLB after map operation. Signed-off-by: Ohad Sharabi <osharabi@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/habanalabs/common/memory.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/misc/habanalabs/common/memory.c b/drivers/misc/habanalabs/common/memory.c
index 326c2179628f..6face45c57e3 100644
--- a/drivers/misc/habanalabs/common/memory.c
+++ b/drivers/misc/habanalabs/common/memory.c
@@ -1250,11 +1250,12 @@ static int map_device_va(struct hl_ctx *ctx, struct hl_mem_in *args,
if (rc)
goto map_err;
- /* already prefetch the relevant translations to the cache */
- rc = hl_mmu_prefetch_cache_range(hdev, *vm_type, ctx->asid, ret_vaddr,
- phys_pg_pack->total_size);
- if (rc)
- goto map_err;
+ if (args->flags & HL_MEM_PREFETCH) {
+ rc = hl_mmu_prefetch_cache_range(hdev, *vm_type, ctx->asid, ret_vaddr,
+ phys_pg_pack->total_size);
+ if (rc)
+ goto map_err;
+ }
mutex_unlock(&ctx->mmu_lock);