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

Merge tag 'misc-habanalabs-next-2021-01-27' of...

Merge tag 'misc-habanalabs-next-2021-01-27' 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.12:

- Add feature called "staged command submissions". In this feature,
  the driver allows the user to submit multiple command submissions
  that describe a single pass on the deep learning graph. The driver
  tracks the completion of the entire pass by the last stage CS.

- Update code to support the latest firmware image

- Optimizations and improvements to MMU code:
  - Support page size that is not power-of-2
  - Make the locks scheme simpler
  - mmap areas in device configuration space to userspace

- Security fixes:
  - Make ETR non-secured
  - Remove access to kernel memory through debug-fs interface
  - Remove access through PCI bar to SyncManager register block
    in Gaudi

- Many small bug fixes

* tag 'misc-habanalabs-next-2021-01-27' of https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux: (41 commits)
  habanalabs: update to latest hl_boot_if.h spec from F/W
  habanalabs/gaudi: unmask HBM interrupts after handling
  habanalabs: update SyncManager interrupt handling
  habanalabs: fix ETR security issue
  habanalabs: staged submission support
  habanalabs: modify device_idle interface
  habanalabs: add CS completion and timeout properties
  habanalabs: add new mem ioctl op for mapping hw blocks
  habanalabs: fix MMU debugfs related nodes
  habanalabs: add user available interrupt to hw_ip
  habanalabs: always try to use the hint address
  CREDITS: update email address and home address
  habanalabs: update email address in sysfs/debugfs docs
  habanalabs: add security violations dump to debugfs
  habanalabs: ignore F/W BMC errors in case no BMC present
  habanalabs/gaudi: print sync manager SEI interrupt info
  habanalabs: Use 'dma_set_mask_and_coherent()'
  habanalabs/gaudi: remove PCI access to SM block
  habanalabs: add driver support for internal cb scheduling
  habanalabs: increment ctx ref from within a cs allocation
  ...
parents 3a11b0b5 f1aebf5e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1244,10 +1244,10 @@ S: 80050-430 - Curitiba - Paraná
S: Brazil

N: Oded Gabbay
E: oded.gabbay@gmail.com
D: HabanaLabs and AMD KFD maintainer
S: 12 Shraga Raphaeli
S: Petah-Tikva, 4906418
E: ogabbay@kernel.org
D: HabanaLabs maintainer
S: 29 Duchifat St.
S: Ra'anana 4372029
S: Israel

N: Kumar Gala
+29 −21
Original line number Diff line number Diff line
What:           /sys/kernel/debug/habanalabs/hl<n>/addr
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Sets the device address to be used for read or write through
                PCI bar, or the device VA of a host mapped memory to be read or
                written directly from the host. The latter option is allowed
@@ -11,7 +11,7 @@ Description: Sets the device address to be used for read or write through
What:           /sys/kernel/debug/habanalabs/hl<n>/clk_gate
Date:           May 2020
KernelVersion:  5.8
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Allow the root user to disable/enable in runtime the clock
                gating mechanism in Gaudi. Due to how Gaudi is built, the
                clock gating needs to be disabled in order to access the
@@ -34,28 +34,28 @@ Description: Allow the root user to disable/enable in runtime the clock
What:           /sys/kernel/debug/habanalabs/hl<n>/command_buffers
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Displays a list with information about the currently allocated
                command buffers

What:           /sys/kernel/debug/habanalabs/hl<n>/command_submission
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Displays a list with information about the currently active
                command submissions

What:           /sys/kernel/debug/habanalabs/hl<n>/command_submission_jobs
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Displays a list with detailed information about each JOB (CB) of
                each active command submission

What:           /sys/kernel/debug/habanalabs/hl<n>/data32
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Allows the root user to read or write directly through the
                device's PCI bar. Writing to this file generates a write
                transaction while reading from the file generates a read
@@ -70,7 +70,7 @@ Description: Allows the root user to read or write directly through the
What:           /sys/kernel/debug/habanalabs/hl<n>/data64
Date:           Jan 2020
KernelVersion:  5.6
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Allows the root user to read or write 64 bit data directly
                through the device's PCI bar. Writing to this file generates a
                write transaction while reading from the file generates a read
@@ -85,7 +85,7 @@ Description: Allows the root user to read or write 64 bit data directly
What:           /sys/kernel/debug/habanalabs/hl<n>/device
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Enables the root user to set the device to specific state.
                Valid values are "disable", "enable", "suspend", "resume".
                User can read this property to see the valid values
@@ -93,28 +93,28 @@ Description: Enables the root user to set the device to specific state.
What:           /sys/kernel/debug/habanalabs/hl<n>/engines
Date:           Jul 2019
KernelVersion:  5.3
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Displays the status registers values of the device engines and
                their derived idle status

What:           /sys/kernel/debug/habanalabs/hl<n>/i2c_addr
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Sets I2C device address for I2C transaction that is generated
                by the device's CPU

What:           /sys/kernel/debug/habanalabs/hl<n>/i2c_bus
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Sets I2C bus address for I2C transaction that is generated by
                the device's CPU

What:           /sys/kernel/debug/habanalabs/hl<n>/i2c_data
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Triggers an I2C transaction that is generated by the device's
                CPU. Writing to this file generates a write transaction while
                reading from the file generates a read transcation
@@ -122,32 +122,32 @@ Description: Triggers an I2C transaction that is generated by the device's
What:           /sys/kernel/debug/habanalabs/hl<n>/i2c_reg
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Sets I2C register id for I2C transaction that is generated by
                the device's CPU

What:           /sys/kernel/debug/habanalabs/hl<n>/led0
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Sets the state of the first S/W led on the device

What:           /sys/kernel/debug/habanalabs/hl<n>/led1
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Sets the state of the second S/W led on the device

What:           /sys/kernel/debug/habanalabs/hl<n>/led2
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Sets the state of the third S/W led on the device

What:           /sys/kernel/debug/habanalabs/hl<n>/mmu
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Displays the hop values and physical address for a given ASID
                and virtual address. The user should write the ASID and VA into
                the file and then read the file to get the result.
@@ -157,14 +157,14 @@ Description: Displays the hop values and physical address for a given ASID
What:           /sys/kernel/debug/habanalabs/hl<n>/set_power_state
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Sets the PCI power state. Valid values are "1" for D0 and "2"
                for D3Hot

What:           /sys/kernel/debug/habanalabs/hl<n>/userptr
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Displays a list with information about the currently user
                pointers (user virtual addresses) that are pinned and mapped
                to DMA addresses
@@ -172,13 +172,21 @@ Description: Displays a list with information about the currently user
What:           /sys/kernel/debug/habanalabs/hl<n>/vm
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Displays a list with information about all the active virtual
                address mappings per ASID

What:           /sys/kernel/debug/habanalabs/hl<n>/stop_on_err
Date:           Mar 2020
KernelVersion:  5.6
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Sets the stop-on_error option for the device engines. Value of
                "0" is for disable, otherwise enable.

What:           /sys/kernel/debug/habanalabs/hl<n>/dump_security_violations
Date:           Jan 2021
KernelVersion:  5.12
Contact:        ogabbay@kernel.org
Description:    Dumps all security violations to dmesg. This will also ack
                all security violations meanings those violations will not be
                dumped next time user calls this API
+29 −29
Original line number Diff line number Diff line
What:           /sys/class/habanalabs/hl<n>/armcp_kernel_ver
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Version of the Linux kernel running on the device's CPU.
                Will be DEPRECATED in Linux kernel version 5.10, and be
                replaced with cpucp_kernel_ver
@@ -9,7 +9,7 @@ Description: Version of the Linux kernel running on the device's CPU.
What:           /sys/class/habanalabs/hl<n>/armcp_ver
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Version of the application running on the device's CPU
                Will be DEPRECATED in Linux kernel version 5.10, and be
                replaced with cpucp_ver
@@ -17,7 +17,7 @@ Description: Version of the application running on the device's CPU
What:           /sys/class/habanalabs/hl<n>/clk_max_freq_mhz
Date:           Jun 2019
KernelVersion:  not yet upstreamed
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Allows the user to set the maximum clock frequency, in MHz.
                The device clock might be set to lower value than the maximum.
                The user should read the clk_cur_freq_mhz to see the actual
@@ -27,52 +27,52 @@ Description: Allows the user to set the maximum clock frequency, in MHz.
What:           /sys/class/habanalabs/hl<n>/clk_cur_freq_mhz
Date:           Jun 2019
KernelVersion:  not yet upstreamed
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Displays the current frequency, in MHz, of the device clock.
                This property is valid only for the Gaudi ASIC family

What:           /sys/class/habanalabs/hl<n>/cpld_ver
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Version of the Device's CPLD F/W

What:           /sys/class/habanalabs/hl<n>/cpucp_kernel_ver
Date:           Oct 2020
KernelVersion:  5.10
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Version of the Linux kernel running on the device's CPU

What:           /sys/class/habanalabs/hl<n>/cpucp_ver
Date:           Oct 2020
KernelVersion:  5.10
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Version of the application running on the device's CPU

What:           /sys/class/habanalabs/hl<n>/device_type
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Displays the code name of the device according to its type.
                The supported values are: "GOYA"

What:           /sys/class/habanalabs/hl<n>/eeprom
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    A binary file attribute that contains the contents of the
                on-board EEPROM

What:           /sys/class/habanalabs/hl<n>/fuse_ver
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Displays the device's version from the eFuse

What:           /sys/class/habanalabs/hl<n>/hard_reset
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Interface to trigger a hard-reset operation for the device.
                Hard-reset will reset ALL internal components of the device
                except for the PCI interface and the internal PLLs
@@ -80,14 +80,14 @@ Description: Interface to trigger a hard-reset operation for the device.
What:           /sys/class/habanalabs/hl<n>/hard_reset_cnt
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Displays how many times the device have undergone a hard-reset
                operation since the driver was loaded

What:           /sys/class/habanalabs/hl<n>/high_pll
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Allows the user to set the maximum clock frequency for MME, TPC
                and IC when the power management profile is set to "automatic".
                This property is valid only for the Goya ASIC family
@@ -95,7 +95,7 @@ Description: Allows the user to set the maximum clock frequency for MME, TPC
What:           /sys/class/habanalabs/hl<n>/ic_clk
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Allows the user to set the maximum clock frequency, in Hz, of
                the Interconnect fabric. Writes to this parameter affect the
                device only when the power management profile is set to "manual"
@@ -107,27 +107,27 @@ Description: Allows the user to set the maximum clock frequency, in Hz, of
What:           /sys/class/habanalabs/hl<n>/ic_clk_curr
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Displays the current clock frequency, in Hz, of the Interconnect
                fabric. This property is valid only for the Goya ASIC family

What:           /sys/class/habanalabs/hl<n>/infineon_ver
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Version of the Device's power supply F/W code

What:           /sys/class/habanalabs/hl<n>/max_power
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Allows the user to set the maximum power consumption of the
                device in milliwatts.

What:           /sys/class/habanalabs/hl<n>/mme_clk
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Allows the user to set the maximum clock frequency, in Hz, of
                the MME compute engine. Writes to this parameter affect the
                device only when the power management profile is set to "manual"
@@ -139,21 +139,21 @@ Description: Allows the user to set the maximum clock frequency, in Hz, of
What:           /sys/class/habanalabs/hl<n>/mme_clk_curr
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Displays the current clock frequency, in Hz, of the MME compute
                engine. This property is valid only for the Goya ASIC family

What:           /sys/class/habanalabs/hl<n>/pci_addr
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Displays the PCI address of the device. This is needed so the
                user would be able to open a device based on its PCI address

What:           /sys/class/habanalabs/hl<n>/pm_mng_profile
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Power management profile. Values are "auto", "manual". In "auto"
                mode, the driver will set the maximum clock frequency to a high
                value when a user-space process opens the device's file (unless
@@ -167,13 +167,13 @@ Description: Power management profile. Values are "auto", "manual". In "auto"
What:           /sys/class/habanalabs/hl<n>/preboot_btl_ver
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Version of the device's preboot F/W code

What:           /sys/class/habanalabs/hl<n>/soft_reset
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Interface to trigger a soft-reset operation for the device.
                Soft-reset will reset only the compute and DMA engines of the
                device
@@ -181,26 +181,26 @@ Description: Interface to trigger a soft-reset operation for the device.
What:           /sys/class/habanalabs/hl<n>/soft_reset_cnt
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Displays how many times the device have undergone a soft-reset
                operation since the driver was loaded

What:           /sys/class/habanalabs/hl<n>/status
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Status of the card: "Operational", "Malfunction", "In reset".

What:           /sys/class/habanalabs/hl<n>/thermal_ver
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Version of the Device's thermal daemon

What:           /sys/class/habanalabs/hl<n>/tpc_clk
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Allows the user to set the maximum clock frequency, in Hz, of
                the TPC compute engines. Writes to this parameter affect the
                device only when the power management profile is set to "manual"
@@ -212,12 +212,12 @@ Description: Allows the user to set the maximum clock frequency, in Hz, of
What:           /sys/class/habanalabs/hl<n>/tpc_clk_curr
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Displays the current clock frequency, in Hz, of the TPC compute
                engines. This property is valid only for the Goya ASIC family

What:           /sys/class/habanalabs/hl<n>/uboot_ver
Date:           Jan 2019
KernelVersion:  5.1
Contact:        oded.gabbay@gmail.com
Contact:        ogabbay@kernel.org
Description:    Version of the u-boot running on the device's CPU
 No newline at end of file
+8 −2
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only

include $(src)/common/mmu/Makefile
habanalabs-y += $(HL_COMMON_MMU_FILES)

include $(src)/common/pci/Makefile
habanalabs-y += $(HL_COMMON_PCI_FILES)

HL_COMMON_FILES := common/habanalabs_drv.o common/device.o common/context.o \
		common/asid.o common/habanalabs_ioctl.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/mmu.o common/mmu_v1.o \
		common/firmware_if.o common/pci.o
		common/command_submission.o common/firmware_if.o
+4 −2
Original line number Diff line number Diff line
@@ -50,8 +50,10 @@ unsigned long hl_asid_alloc(struct hl_device *hdev)

void hl_asid_free(struct hl_device *hdev, unsigned long asid)
{
	if (WARN((asid == 0 || asid >= hdev->asic_prop.max_asid),
						"Invalid ASID %lu", asid))
	if (asid == HL_KERNEL_ASID_ID || asid >= hdev->asic_prop.max_asid) {
		dev_crit(hdev->dev, "Invalid ASID %lu", asid);
		return;
	}

	clear_bit(asid, hdev->asid_bitmap);
}
Loading