Commit d7bb1ac8 authored by Oded Gabbay's avatar Oded Gabbay
Browse files

habanalabs: add gaudi2 asic-specific code



Add the ASIC-specific code for Gaudi2. Supply (almost) all of the
function callbacks that the driver's common code need to initialize,
finalize and submit workloads to the Gaudi2 ASIC.

It also contains the code to initialize the F/W of the Gaudi2 ASIC
and to receive events from the F/W.

It contains new debugfs entry to dump razwi events. razwi is a case
where the device's engines create a transaction that reaches an
invalid destination.

Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
parent 97c6d22f
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -101,6 +101,15 @@ Description: Specify the size of the DMA transaction when using DMA to read
                When the write is finished, the user can read the "data_dma"
                blob

What:           /sys/kernel/debug/habanalabs/hl<n>/dump_razwi_events
Date:           Aug 2022
KernelVersion:  5.20
Contact:        fkassabri@habana.ai
Description:    Dumps all razwi events to dmesg if exist.
                After reading the status register of an existing event
                the routine will clear the status register.
                Usage: cat dump_razwi_events

What:           /sys/kernel/debug/habanalabs/hl<n>/dump_security_violations
Date:           Jan 2021
KernelVersion:  5.12
@@ -278,7 +287,7 @@ Description: Displays a list with information about the currently user
                to DMA addresses

What:           /sys/kernel/debug/habanalabs/hl<n>/userptr_lookup
Date:           Aug 2021
Date:           Oct 2021
KernelVersion:  5.15
Contact:        ogabbay@kernel.org
Description:    Allows to search for specific user pointers (user virtual
+3 −0
Original line number Diff line number Diff line
@@ -14,4 +14,7 @@ habanalabs-y += $(HL_GOYA_FILES)
include $(src)/gaudi/Makefile
habanalabs-y += $(HL_GAUDI_FILES)

include $(src)/gaudi2/Makefile
habanalabs-y += $(HL_GAUDI2_FILES)

habanalabs-$(CONFIG_DEBUG_FS) += common/debugfs.o
+2 −1
Original line number Diff line number Diff line
@@ -11,4 +11,5 @@ HL_COMMON_FILES := common/habanalabs_drv.o common/device.o common/context.o \
		common/command_buffer.o common/hw_queue.o common/irq.o \
		common/sysfs.o common/hwmon.o common/memory.o \
		common/command_submission.o common/firmware_if.o \
		common/state_dump.o common/memory_mgr.o
		common/state_dump.o common/memory_mgr.o \
		common/decoder.o
+2 −3
Original line number Diff line number Diff line
@@ -3334,9 +3334,8 @@ static int hl_interrupt_wait_ioctl(struct hl_fpriv *hpriv, void *data)

	interrupt_id = FIELD_GET(HL_WAIT_CS_FLAGS_INTERRUPT_MASK, args->in.flags);

	first_interrupt = prop->first_available_user_msix_interrupt;
	last_interrupt = prop->first_available_user_msix_interrupt +
						prop->user_interrupt_count - 1;
	first_interrupt = prop->first_available_user_interrupt;
	last_interrupt = prop->first_available_user_interrupt + prop->user_interrupt_count - 1;

	if ((interrupt_id < first_interrupt || interrupt_id > last_interrupt) &&
			interrupt_id != HL_COMMON_USER_INTERRUPT_ID) {
+3 −0
Original line number Diff line number Diff line
@@ -102,6 +102,9 @@ static void hl_ctx_fini(struct hl_ctx *ctx)
			hl_device_set_debug_mode(hdev, ctx, false);

		hdev->asic_funcs->ctx_fini(ctx);

		hl_dec_ctx_fini(ctx);

		hl_cb_va_pool_fini(ctx);
		hl_vm_ctx_fini(ctx);
		hl_asid_free(hdev, ctx->asid);
Loading