Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 839c4803 authored by Oded Gabbay's avatar Oded Gabbay Committed by Greg Kroah-Hartman
Browse files

habanalabs: add basic Goya h/w initialization



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: default avatarMike Rapoport <rppt@linux.ibm.com>
Signed-off-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent be5d926b
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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");

@@ -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);

+1 −1
Original line number Diff line number Diff line
subdir-ccflags-y += -I$(src)

HL_GOYA_FILES :=  goya/goya.o
HL_GOYA_FILES :=  goya/goya.o goya/goya_security.o
+875 −7

File changed.

Preview size limit exceeded, changes collapsed.

+4 −0
Original line number Diff line number Diff line
@@ -10,7 +10,9 @@

#include <uapi/misc/habanalabs.h>
#include "habanalabs.h"
#include "include/hl_boot_if.h"
#include "include/goya/goya.h"
#include "include/goya/goya_fw_if.h"

#define NUMBER_OF_CMPLT_QUEUES		5
#define NUMBER_OF_EXT_HW_QUEUES		5
@@ -149,4 +151,6 @@ struct goya_device {
	u32		hw_cap_initialized;
};

void goya_init_security(struct hl_device *hdev);

#endif /* GOYAP_H_ */
+2999 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading