Skip to content

Commit

Permalink
habanalabs: add basic Goya h/w initialization
Browse files Browse the repository at this point in the history
This patch adds the basic part of Goya's H/W initialization. It adds code
that initializes Goya's internal CPU, various registers that are related to
internal routing, scrambling, workarounds for H/W bugs, etc.

It also initializes Goya's security scheme that prevents the user from
abusing Goya to steal data from the host, crash the host, change
Goya's F/W, etc.

Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Oded Gabbay authored and Greg Kroah-Hartman committed Feb 18, 2019
1 parent be5d926 commit 839c480
Show file tree
Hide file tree
Showing 10 changed files with 3,991 additions and 8 deletions.
12 changes: 12 additions & 0 deletions drivers/misc/habanalabs/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,15 @@ int hl_device_init(struct hl_device *hdev, struct class *hclass)
goto release_ctx;
}

rc = hdev->asic_funcs->hw_init(hdev);
if (rc) {
dev_err(hdev->dev, "failed to initialize the H/W\n");
rc = 0;
goto out_disabled;
}

hdev->disabled = false;

dev_notice(hdev->dev,
"Successfully added device to habanalabs driver\n");

Expand Down Expand Up @@ -370,6 +379,9 @@ void hl_device_fini(struct hl_device *hdev)
if ((hdev->kernel_ctx) && (hl_ctx_put(hdev->kernel_ctx) != 1))
dev_err(hdev->dev, "kernel ctx is still alive\n");

/* Reset the H/W. It will be in idle state after this returns */
hdev->asic_funcs->hw_fini(hdev, true);

/* Call ASIC S/W finalize function */
hdev->asic_funcs->sw_fini(hdev);

Expand Down
2 changes: 1 addition & 1 deletion drivers/misc/habanalabs/goya/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
subdir-ccflags-y += -I$(src)

HL_GOYA_FILES := goya/goya.o
HL_GOYA_FILES := goya/goya.o goya/goya_security.o
Loading

0 comments on commit 839c480

Please sign in to comment.