habanalabs/goya: move mmu_prepare to context init
authorOhad Sharabi <osharabi@habana.ai>
Tue, 1 Dec 2020 12:06:27 +0000 (14:06 +0200)
committerOded Gabbay <ogabbay@kernel.org>
Wed, 27 Jan 2021 19:03:49 +0000 (21:03 +0200)
Currently mmu_prepare is located at context switch.
Since we support a single context, no reason to reconfigure
the MMU registers every context switch.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/goya/goya.c

index 19b5bcc..720484b 100644 (file)
@@ -4877,8 +4877,6 @@ int goya_context_switch(struct hl_device *hdev, u32 asid)
 
        WREG32(mmTPC_PLL_CLK_RLX_0, 0x200020);
 
-       goya_mmu_prepare(hdev, asid);
-
        goya_clear_sm_regs(hdev);
 
        return 0;
@@ -5313,6 +5311,9 @@ static int goya_get_eeprom_data(struct hl_device *hdev, void *data,
 
 static int goya_ctx_init(struct hl_ctx *ctx)
 {
+       if (ctx->asid != HL_KERNEL_ASID_ID)
+               goya_mmu_prepare(ctx->hdev, ctx->asid);
+
        return 0;
 }