Skip to content

Commit 929cbab

Browse files
committed
habanalabs/gaudi: restore user registers when context opens
Because we don't have multiple contexts in GAUDI, and to minimize calls to is_idle function (which uses many register reads), move the call to clear the user registers to the opening of the single user context. Signed-off-by: Oded Gabbay <[email protected]>
1 parent 60d86e7 commit 929cbab

File tree

1 file changed

+12
-2
lines changed
  • drivers/misc/habanalabs/gaudi

1 file changed

+12
-2
lines changed

drivers/misc/habanalabs/gaudi/gaudi.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6087,7 +6087,7 @@ static int gaudi_restore_user_registers(struct hl_device *hdev)
60876087

60886088
static int gaudi_context_switch(struct hl_device *hdev, u32 asid)
60896089
{
6090-
return gaudi_restore_user_registers(hdev);
6090+
return 0;
60916091
}
60926092

60936093
static int gaudi_mmu_clear_pgt_range(struct hl_device *hdev)
@@ -8657,10 +8657,20 @@ static void gaudi_internal_cb_pool_fini(struct hl_device *hdev,
86578657

86588658
static int gaudi_ctx_init(struct hl_ctx *ctx)
86598659
{
8660+
int rc;
8661+
86608662
if (ctx->asid == HL_KERNEL_ASID_ID)
86618663
return 0;
86628664

8663-
return gaudi_internal_cb_pool_init(ctx->hdev, ctx);
8665+
rc = gaudi_internal_cb_pool_init(ctx->hdev, ctx);
8666+
if (rc)
8667+
return rc;
8668+
8669+
rc = gaudi_restore_user_registers(ctx->hdev);
8670+
if (rc)
8671+
gaudi_internal_cb_pool_fini(ctx->hdev, ctx);
8672+
8673+
return rc;
86648674
}
86658675

86668676
static void gaudi_ctx_fini(struct hl_ctx *ctx)

0 commit comments

Comments
 (0)