[PATCH] habanalabs/gaudi: move mmu_prepare to context init

From: Oded Gabbay
Date: Mon Nov 02 2020 - 14:47:14 EST


From: Ofir Bitton <obitton@xxxxxxxxx>

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: Ofir Bitton <obitton@xxxxxxxxx>
Reviewed-by: Oded Gabbay <ogabbay@xxxxxxxxxx>
Signed-off-by: Oded Gabbay <ogabbay@xxxxxxxxxx>
---
drivers/misc/habanalabs/gaudi/gaudi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi/gaudi.c
index 5f65a1691551..2910f427c716 100644
--- a/drivers/misc/habanalabs/gaudi/gaudi.c
+++ b/drivers/misc/habanalabs/gaudi/gaudi.c
@@ -4505,8 +4505,6 @@ static int gaudi_context_switch(struct hl_device *hdev, u32 asid)
return rc;
}

- gaudi_mmu_prepare(hdev, asid);
-
gaudi_restore_user_registers(hdev);

return 0;
@@ -6359,6 +6357,8 @@ static enum hl_device_hw_state gaudi_get_hw_state(struct hl_device *hdev)

static int gaudi_ctx_init(struct hl_ctx *ctx)
{
+ gaudi_mmu_prepare(ctx->hdev, ctx->asid);
+
return 0;
}

--
2.17.1