Commit bc2c6a5e authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Merge tag 'misc-habanalabs-next-2022-07-12' of...

Merge tag 'misc-habanalabs-next-2022-07-12' of https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux into char-misc-next

Oded writes:

This tag contains habanalabs driver changes for v5.20:

- Add Gaudi2 ASIC support. All the features required for Gaudi2 are included
  in this tag (except the networking aspect).

- Add more events to the eventfd support in the driver. With the new code, we
  expose three events that the user can register to get notification about them.

- re-factor soft reset code and replace its name to compute reset to better
  reflect the actual reset done in new ASICs

- Change the way Gaudi2 triggers an MSI-X interrupt due to h/w bug.

- Improve the code of the debugfs node that scrubs the device's memory.

- Add mechanism for better compatibility with older f/w versions

- Cleanup kernel log prints by moving some prints to debug and removing others.

- Many small bug fixes and minor changes.

* tag 'misc-habanalabs-next-2022-07-12' of https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux: (88 commits)
  habanalabs: move h/w dirty message to debug
  habanalabs: rename soft reset to compute reset
  habanalabs: add status of reset after device release
  habanalabs: fix update of is_in_soft_reset
  habanalabs: expose only valid debugfs nodes
  habanalabs/gaudi2: map virtual MSI-X doorbell memory for user
  habanalabs/gaudi2: modify decoder to use virtual MSI-X doorbell
  habanalabs/gaudi2: modify CS completion CQ to use virtual MSI-X doorbell
  habanalabs/gaudi2: replace defines for reserved sob/mob with enums
  habanalabs/gaudi2: configure virtual MSI-X doorbell interface
  habanalabs: add a value field to hl_fw_send_pci_access_msg()
  habanalabs: fixes to the poll-timeout macros
  habanalabs/gaudi2: use DIV_ROUND_UP_SECTOR_T instead of roundup
  habanalabs: initialize variable explicitly
  habanalabs: Use the bitmap API to allocate bitmaps
  habanalabs/gaudi2: remove unused defines
  habanalabs: make sure variable is set before used
  habanalabs: don't declare tmp twice in same function
  habanalabs: do not set max power on a secured device
  habanalabs/gaudi2: SM mask can only be 8-bit
  ...
parents 3af0b1d3 a919b823
Loading
Loading
Loading
Loading
+28 −10
Original line number Original line 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"
                When the write is finished, the user can read the "data_dma"
                blob
                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
What:           /sys/kernel/debug/habanalabs/hl<n>/dump_security_violations
Date:           Jan 2021
Date:           Jan 2021
KernelVersion:  5.12
KernelVersion:  5.12
@@ -121,14 +130,16 @@ Date: Jan 2019
KernelVersion:  5.1
KernelVersion:  5.1
Contact:        ogabbay@kernel.org
Contact:        ogabbay@kernel.org
Description:    Sets I2C device address for I2C transaction that is generated
Description:    Sets I2C device address for I2C transaction that is generated
                by the device's CPU
                by the device's CPU, Not available when device is loaded with secured
                firmware


What:           /sys/kernel/debug/habanalabs/hl<n>/i2c_bus
What:           /sys/kernel/debug/habanalabs/hl<n>/i2c_bus
Date:           Jan 2019
Date:           Jan 2019
KernelVersion:  5.1
KernelVersion:  5.1
Contact:        ogabbay@kernel.org
Contact:        ogabbay@kernel.org
Description:    Sets I2C bus address for I2C transaction that is generated by
Description:    Sets I2C bus address for I2C transaction that is generated by
                the device's CPU
                the device's CPU, Not available when device is loaded with secured
                firmware


What:           /sys/kernel/debug/habanalabs/hl<n>/i2c_data
What:           /sys/kernel/debug/habanalabs/hl<n>/i2c_data
Date:           Jan 2019
Date:           Jan 2019
@@ -136,39 +147,45 @@ KernelVersion: 5.1
Contact:        ogabbay@kernel.org
Contact:        ogabbay@kernel.org
Description:    Triggers an I2C transaction that is generated by the device's
Description:    Triggers an I2C transaction that is generated by the device's
                CPU. Writing to this file generates a write transaction while
                CPU. Writing to this file generates a write transaction while
                reading from the file generates a read transaction
                reading from the file generates a read transaction, Not available
                when device is loaded with secured firmware


What:           /sys/kernel/debug/habanalabs/hl<n>/i2c_len
What:           /sys/kernel/debug/habanalabs/hl<n>/i2c_len
Date:           Dec 2021
Date:           Dec 2021
KernelVersion:  5.17
KernelVersion:  5.17
Contact:        obitton@habana.ai
Contact:        obitton@habana.ai
Description:    Sets I2C length in bytes for I2C transaction that is generated by
Description:    Sets I2C length in bytes for I2C transaction that is generated by
                the device's CPU
                the device's CPU, Not available when device is loaded with secured
                firmware


What:           /sys/kernel/debug/habanalabs/hl<n>/i2c_reg
What:           /sys/kernel/debug/habanalabs/hl<n>/i2c_reg
Date:           Jan 2019
Date:           Jan 2019
KernelVersion:  5.1
KernelVersion:  5.1
Contact:        ogabbay@kernel.org
Contact:        ogabbay@kernel.org
Description:    Sets I2C register id for I2C transaction that is generated by
Description:    Sets I2C register id for I2C transaction that is generated by
                the device's CPU
                the device's CPU, Not available when device is loaded with secured
                firmware


What:           /sys/kernel/debug/habanalabs/hl<n>/led0
What:           /sys/kernel/debug/habanalabs/hl<n>/led0
Date:           Jan 2019
Date:           Jan 2019
KernelVersion:  5.1
KernelVersion:  5.1
Contact:        ogabbay@kernel.org
Contact:        ogabbay@kernel.org
Description:    Sets the state of the first S/W led on the device
Description:    Sets the state of the first S/W led on the device, Not available
                when device is loaded with secured firmware


What:           /sys/kernel/debug/habanalabs/hl<n>/led1
What:           /sys/kernel/debug/habanalabs/hl<n>/led1
Date:           Jan 2019
Date:           Jan 2019
KernelVersion:  5.1
KernelVersion:  5.1
Contact:        ogabbay@kernel.org
Contact:        ogabbay@kernel.org
Description:    Sets the state of the second S/W led on the device
Description:    Sets the state of the second S/W led on the device, Not available
                when device is loaded with secured firmware


What:           /sys/kernel/debug/habanalabs/hl<n>/led2
What:           /sys/kernel/debug/habanalabs/hl<n>/led2
Date:           Jan 2019
Date:           Jan 2019
KernelVersion:  5.1
KernelVersion:  5.1
Contact:        ogabbay@kernel.org
Contact:        ogabbay@kernel.org
Description:    Sets the state of the third S/W led on the device
Description:    Sets the state of the third S/W led on the device, Not available
                when device is loaded with secured firmware


What:           /sys/kernel/debug/habanalabs/hl<n>/memory_scrub
What:           /sys/kernel/debug/habanalabs/hl<n>/memory_scrub
Date:           May 2022
Date:           May 2022
@@ -182,7 +199,8 @@ Date: May 2022
KernelVersion:  5.19
KernelVersion:  5.19
Contact:        dhirschfeld@habana.ai
Contact:        dhirschfeld@habana.ai
Description:    The value to which the dram will be set to when the user
Description:    The value to which the dram will be set to when the user
                scrubs the dram using 'memory_scrub' debugfs file
                scrubs the dram using 'memory_scrub' debugfs file and
                the scrubbing value when using module param 'memory_scrub'


What:           /sys/kernel/debug/habanalabs/hl<n>/mmu
What:           /sys/kernel/debug/habanalabs/hl<n>/mmu
Date:           Jan 2019
Date:           Jan 2019
@@ -277,7 +295,7 @@ Description: Displays a list with information about the currently user
                to DMA addresses
                to DMA addresses


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


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

habanalabs-$(CONFIG_DEBUG_FS) += common/debugfs.o
habanalabs-$(CONFIG_DEBUG_FS) += common/debugfs.o
+2 −1
Original line number Original line 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/command_buffer.o common/hw_queue.o common/irq.o \
		common/sysfs.o common/hwmon.o common/memory.o \
		common/sysfs.o common/hwmon.o common/memory.o \
		common/command_submission.o common/firmware_if.o \
		common/command_submission.o common/firmware_if.o \
		common/state_dump.o common/memory_mgr.o
		common/security.o common/state_dump.o \
		common/memory_mgr.o common/decoder.o
+2 −3
Original line number Original line Diff line number Diff line
@@ -11,8 +11,7 @@


int hl_asid_init(struct hl_device *hdev)
int hl_asid_init(struct hl_device *hdev)
{
{
	hdev->asid_bitmap = kcalloc(BITS_TO_LONGS(hdev->asic_prop.max_asid),
	hdev->asid_bitmap = bitmap_zalloc(hdev->asic_prop.max_asid, GFP_KERNEL);
					sizeof(*hdev->asid_bitmap), GFP_KERNEL);
	if (!hdev->asid_bitmap)
	if (!hdev->asid_bitmap)
		return -ENOMEM;
		return -ENOMEM;


@@ -27,7 +26,7 @@ int hl_asid_init(struct hl_device *hdev)
void hl_asid_fini(struct hl_device *hdev)
void hl_asid_fini(struct hl_device *hdev)
{
{
	mutex_destroy(&hdev->asid_mutex);
	mutex_destroy(&hdev->asid_mutex);
	kfree(hdev->asid_bitmap);
	bitmap_free(hdev->asid_bitmap);
}
}


unsigned long hl_asid_alloc(struct hl_device *hdev)
unsigned long hl_asid_alloc(struct hl_device *hdev)
+4 −8
Original line number Original line Diff line number Diff line
@@ -143,8 +143,7 @@ static void cb_fini(struct hl_device *hdev, struct hl_cb *cb)
		gen_pool_free(hdev->internal_cb_pool,
		gen_pool_free(hdev->internal_cb_pool,
				(uintptr_t)cb->kernel_address, cb->size);
				(uintptr_t)cb->kernel_address, cb->size);
	else
	else
		hdev->asic_funcs->asic_dma_free_coherent(hdev, cb->size,
		hl_asic_dma_free_coherent(hdev, cb->size, cb->kernel_address, cb->bus_address);
				cb->kernel_address, cb->bus_address);


	kfree(cb);
	kfree(cb);
}
}
@@ -195,14 +194,11 @@ static struct hl_cb *hl_cb_alloc(struct hl_device *hdev, u32 cb_size,
		cb->is_internal = true;
		cb->is_internal = true;
		cb->bus_address =  hdev->internal_cb_va_base + cb_offset;
		cb->bus_address =  hdev->internal_cb_va_base + cb_offset;
	} else if (ctx_id == HL_KERNEL_ASID_ID) {
	} else if (ctx_id == HL_KERNEL_ASID_ID) {
		p = hdev->asic_funcs->asic_dma_alloc_coherent(hdev, cb_size,
		p = hl_asic_dma_alloc_coherent(hdev, cb_size, &cb->bus_address, GFP_ATOMIC);
						&cb->bus_address, GFP_ATOMIC);
		if (!p)
		if (!p)
			p = hdev->asic_funcs->asic_dma_alloc_coherent(hdev,
			p = hl_asic_dma_alloc_coherent(hdev, cb_size, &cb->bus_address, GFP_KERNEL);
					cb_size, &cb->bus_address, GFP_KERNEL);
	} else {
	} else {
		p = hdev->asic_funcs->asic_dma_alloc_coherent(hdev, cb_size,
		p = hl_asic_dma_alloc_coherent(hdev, cb_size, &cb->bus_address,
						&cb->bus_address,
						GFP_USER | __GFP_ZERO);
						GFP_USER | __GFP_ZERO);
	}
	}


Loading