aboutsummaryrefslogtreecommitdiff
path: root/drivers/accel/habanalabs
AgeCommit message (Collapse)AuthorFilesLines
2024-06-23accel/habanalabs: gradual sleep in polling memory macroDidi Freiman1-2/+9
It’s better to avoid long sleeps right from the beginning of the polling since the data may be available much sooner than the sleep period. Because polling host memory is inexpensive, this change gradually increases the sleep time up to the user-requested period. Signed-off-by: Didi Freiman <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: move heartbeat work initialization to early initTomer Tayar1-2/+4
The device heartbeat work is currently initialized at device_heartbeat_schedule() which is called at the end of hl_device_init(). However hl_device_init() can fail at a previous step, and in such a case, a subsequent call to hl_device_fini() will lead to calling cleanup_resources() and accessing this work uninitialized. As there is no real need to re-initialize this work every time it is rescheduled, move this initialization to device_early_init() to be done once and early enough. Signed-off-by: Tomer Tayar <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: print timestamp of last PQ heartbeat on EQ heartbeat failureTomer Tayar3-12/+46
The test packet which is sent to FW for the PQ heartbeat is used also as the trigger in FW to send the EQ heartbeat event. Add the time of the last sent packet to the debug info which is printed upon a EQ heartbeat failure. Signed-off-by: Tomer Tayar <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: dump the EQ entries headers on EQ heartbeat failureTomer Tayar3-0/+28
Add a dump of the EQ entries headers upon a EQ heartbeat failure. Signed-off-by: Tomer Tayar <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: revise print on EQ heartbeat failureTomer Tayar1-9/+10
Don't print the "previous EQ index" value in case of a EQ heartbeat failure, because it is incremented along with the EQ CI and therefore redundant. In addition, as the CPU-CP PI is zeroed when it reaches a value that is twice the queue size, add a value of the CI with a similar wrap around, to make it easier to compare the values. Signed-off-by: Tomer Tayar <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: add more info upon cpu pkt timeoutFarah Kassabri1-3/+11
In order to have better debuggability upon encountering FW issues, We are adding additional info once CPU packet timeout expires. Signed-off-by: Farah Kassabri <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: additional print in device-in-use infoIlia Levi4-9/+63
When device release triggers a hard reset, there is a printout of the cause. Currently listed causes (that increment context refcount) are active command submissions and exported DMA buffer objects. In any other case, the printout emits "unknown reason". We identify and print another reason - allocated command buffers. Signed-off-by: Ilia Levi <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalbs/gaudi2: reduce interrupt count to 128Ofir Bitton2-6/+6
Some systems allow a maximum number of 128 MSI-X interrupts. Hence we reduce the interrupt count to 128 instead of 512. Reviewed-by: Tomer Tayar <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: disable EQ interrupt after disabling pciTal Cohen1-3/+4
When sending disable pci msg towards firmware, there is a possibility that an EQ packet is already pending, disabling EQ interrupt will prevent this from happening. The interrupt will be re-enabled after reset. Signed-off-by: Tal Cohen <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: change the heartbeat scheduling pointFarah Kassabri1-21/+33
Currently we schedule the heartbeat thread at late init, only then we set the INTS_REGISTER packet which enables events to be received from firmware. Init may take some time and we want to give firmware 2 full cycles of heartbeat thread after it received INTS_REGISTER. The patch will move the heartbeat thread scheduling to be after driver is done with all initializations. Signed-off-by: Farah Kassabri <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs/gaudi2: unsecure edma max outstanding registerRakesh Ughreja1-0/+1
Netowrk EDMAs uses more outstanding transfers so this needs to be programmed by EDMA firmware. Signed-off-by: Rakesh Ughreja <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: remove timestamp registration debug printsOfir Bitton1-13/+0
There are several timestamp registration debug prints which spams the kernel log whenever dyn debug is enabled. Remove those prints. Reviewed-by: Tomer Tayar <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: add cpld ts cpld_timestamp cpucpVitaly Margolin1-2/+3
Add cpld_timestamp field to cpucp_info structure and return cpld timestamp as part of cpld version Signed-off-by: Vitaly Margolin <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: add a common handler for clock change eventsTomer Tayar2-0/+47
As the new dynamic EQ includes clock change events which are common and not ASIC-specific, add a common handler for these events. Signed-off-by: Tomer Tayar <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs/gaudi2: add GAUDI2D revision supportFarah Kassabri6-1/+16
Gaudi2 with PCI revision ID with the value of '4' represents Gaudi2D device and should be detected and initialized as Gaudi2. Signed-off-by: Farah Kassabri <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: move hl_eq_heartbeat_event_handle() to common codeTomer Tayar3-6/+7
hl_eq_heartbeat_event_handle() doesn't have ASIC specific code, and therefore can be moved from Gaudi2-only code to common code, and possibly used for other ASICs. Signed-off-by: Tomer Tayar <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: add an EQ size ASIC propertyTomer Tayar2-3/+10
Future supported ASICs might use the dynamic EQ mechanism with the firmware, and in that case the EQ size won't be equal to the default HL_EQ_SIZE_IN_BYTES value. Add an ASIC property to enable overriding this value. Signed-off-by: Tomer Tayar <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs/gaudi2: assume hard-reset by FW upon MC SEI severe errorTomer Tayar1-2/+2
FW initiates a hard reset upon an MC SEI severe error. Align the driver to expect this reset and avoid accessing the device until the reset is done. Signed-off-by: Tomer Tayar <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs/gaudi2: revise return value handling in ↵Tomer Tayar1-4/+4
gaudi2_hbm_sei_handle_read_err() The return value in gaudi2_hbm_sei_handle_read_err() is boolean and not a bitmask, so there is need for "|= true". In addition, rename the 'rc' variable, as no "return code" is returned here but an indication if a hard reset is required. Signed-off-by: Tomer Tayar <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs/gaudi2: align interrupt names to tableAriel Suller1-75/+75
when reporting tpc events, the dcore and tpc in dcore should be reported and propagated, and not the generatl tpc number Signed-off-by: Ariel Suller <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: check for errors after preboot is readyFarah Kassabri1-12/+12
Driver should check and report any fatal errors detected by preboot, before it attempts to load the boot fit. Some errors may cause the driver to stop the boot process and mark the device as unusable. This check will allow the driver to fail and print the error reported by preboot and skip the time wasting attempt of trying to load the boot fit, which will fail due to the error. Signed-off-by: Farah Kassabri <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: use msg_header instead of desc_headerIgal Zeltser1-3/+3
Struct comms_desc_header is deprecated and replaced by struct comms_msg_header. As a preparation for removing comms_desc_header from FW, all it's usage in code is replaced by comms_msg_header. Signed-off-by: Igal Zeltser <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: add heartbeat debug infoFarah Kassabri3-1/+29
It is hard to debug the reason for heartbeat check failures. As an attempt to ease this task, this patch will provide more information when this failure happens. Heartbeat checks the communication with FW, so printing the CPU queue pi/ci and the counter of how many times that event was received would help in debugging the issue. Signed-off-by: Farah Kassabri <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: add device name to invalidation failure msgOhad Sharabi1-3/+5
This addition helps log parsers better define the error without the need to go back and search the device name on former log lines. Signed-off-by: Ohad Sharabi <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: expose server type in debugfsTal Risin1-0/+5
Exposing server type through debugfs to enable easier access via scripts. Signed-off-by: Tal Risin <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: use parent device for trace eventsTomer Tayar4-20/+24
Trace events might still be recorded after the accel device is released, while the device name is no longer available. Modify the trace functions to use the parent device instead, which is available at that point and still informative as the device name. Signed-off-by: Tomer Tayar <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: no CPUCP prints on heartbeat failureOhad Sharabi7-132/+128
If we detected heartbet event while some daemon in the background send (via driver interface) CPUCP messages the dmesg will be flooded. Instead, a slight refactor in hl_fw_send_cpu_message() returns -EAGAIN when CPU is disabled (i.e. heartbeat failure) and only then. Later, all calling functions that may be invoked by user space can issue prints only if the error code is not -EAGAIN. Signed-off-by: Ohad Sharabi <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs/gaudi2: align embedded specs headersOfir Bitton2-20/+15
Align embedded headers to latest release. Reviewed-by: Tomer Tayar <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: restructure function that checks heartbeat receivedOhad Sharabi1-8/+8
The function returned an error code which isn't propagated up the stack (nor is it printed). The return value is only checked for =0 or !=0 which implies bool return value. The function signature is updated accordingly, renamed, and slightly refactored. Signed-off-by: Ohad Sharabi <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs/gaudi2: update interrupts related headersFarah Kassabri1-47/+47
Align the interrupts related headers to latest release. Signed-off-by: Farah Kassabri <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs: add device name to error printDani Liberman1-7/+10
The extra info will help in better traceability and debug. Signed-off-by: Dani Liberman <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-06-23accel/habanalabs/gaudi2: use single function to compare FW versionsOhad Sharabi3-68/+34
Currently, the code contains 2 types of FW version comparison functions: - hl_is_fw_sw_ver_[below/equal_or_greater]() - gaudi2 specific function of the type gaudi2_is_fw_ver_[below/above]x_y_z() Moreover, some functions use the inner FW version which shuold be only stage during development but not version dependencies. Finally, some tests are done to deprecated FW version to which LKD should hold no compatibility. This commit aligns all APIs to a single function that just compares the version and return an integers indicator (similar in some way to strcmp()). In addition, this generic function now considers also the sub-minor FW version and also remove dead code resulting in deprecated FW versions compatibility. Signed-off-by: Ohad Sharabi <[email protected]> Reviewed-by: Ofir Bitton <[email protected]> Signed-off-by: Ofir Bitton <[email protected]>
2024-02-26accel/habanalabs: modify pci health checkOfir Bitton1-3/+3
Today we read PCI VENDOR-ID in order to make sure PCI link is healthy. Apparently the VENDOR-ID might be stored on host and hence, when we read it we might not access the PCI bus. In order to make sure PCI health check is reliable, we will start checking the DEVICE-ID instead. Signed-off-by: Ofir Bitton <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
2024-02-26accel/habanalabs: keep explicit size of reserved memory for FWTomer Tayar2-2/+2
The reserved memory for FW is currently saved in an ASIC property in units of MB, just like the value that comes from FW. Except the fact that it is not clear from the property's name, it means also that a calculation to actual size is required everywhere that it is used. Modify the property to hold the size in bytes. Signed-off-by: Tomer Tayar <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Reviewed-by: Carl Vanderlip <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
2024-02-26accel/habanalabs: handle reserved memory request when working with full FWTomer Tayar1-11/+8
Currently the reserved memory request from FW is handled when running with preboot only, but this request is relevant also when running with full FW. Modify to always handle this reservation request. Signed-off-by: Tomer Tayar <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Reviewed-by: Carl Vanderlip <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
2024-02-26accel/habanalabs/hwmon: rate limit errors user can generateOfir Bitton1-14/+15
Fetching sensor data can fail due to various reasons. In order not to pollute the kernel log, those error prints must be rate limited. Signed-off-by: Ofir Bitton <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Reviewed-by: Carl Vanderlip <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
2024-02-26accel/habanalabs/gaudi2: drain event lacks rd/wr indicationOfir Bitton1-11/+3
Due to a H/W issue, AXI drain event does not include a read/write indication, hence we remove this print. Signed-off-by: Ofir Bitton <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Reviewed-by: Carl Vanderlip <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
2024-02-26accel/habanalabs: fix error printDani Liberman1-2/+2
The unmasking is for event and it can be other event than RAZWI. Signed-off-by: Dani Liberman <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Reviewed-by: Carl Vanderlip <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
2024-02-26accel/habanalabs: initialize maybe-uninitialized variablesTal Risin1-2/+2
Prevent static analysis warning. Signed-off-by: Tal Risin <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Reviewed-by: Carl Vanderlip <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
2024-02-26accel/habanalabs: fix debugfs files permissionsAvri Kehat1-7/+7
debugfs files are created with permissions that don't align with the access requirements. Signed-off-by: Avri Kehat <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Reviewed-by: Carl Vanderlip <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
2024-02-26accel/habanalabs: fix glbl error cause handlingTomer Tayar5-18/+35
The glbl error cause handling has a wrong assumption that all error bits are consecutive. Fix the handling to check all relevant error bits per ASIC. Signed-off-by: Tomer Tayar <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Reviewed-by: Carl Vanderlip <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
2024-02-26accel/habanalabs/gaudi2: check extended errors according to PCIe addr_dec ↵Tomer Tayar1-10/+8
interrupt info The FW interrupt info for a PCIe addr_dec event is set correctly, so check for either global errors or razwi according to the indications there. Signed-off-by: Tomer Tayar <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Reviewed-by: Carl Vanderlip <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
2024-02-26accel/habanalabs: modify print for skip loading linux FW to debug logTomer Tayar1-1/+1
Skip loading a linux FW image into the device with the current supported ASICs is done for test purposes only. Moreover, for future supported ASICs it is possible that there won't be a need to load such an image. The print in such a case is therefore not needed in most cases, so replace the used dev_info() with dev_dbg(). Signed-off-by: Tomer Tayar <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Reviewed-by: Carl Vanderlip <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
2024-02-26accel/habanalabs: remove hop size from asic propertiesFarah Kassabri6-46/+36
The hop size related properties is a MMU properties and not asic properties. As for PMMU and HMMU we could have different sizes. Signed-off-by: Farah Kassabri <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Reviewed-by: Carl Vanderlip <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
2024-02-26accel/habanalabs: use kcalloc() instead of kzalloc()Erick Archer1-1/+1
As noted in the "Deprecated Interfaces, Language Features, Attributes, and Conventions" documentation [1], size calculations (especially multiplication) should not be performed in memory allocator (or similar) function arguments due to the risk of them overflowing. This could lead to values wrapping around and a smaller allocation being made than the caller was expecting. Using those allocations could lead to linear overflows of heap memory and other misbehaviors. So, use the purpose specific kcalloc() function instead of the argument size * count in the kzalloc() function. Link: https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [1] Link: https://github.com/KSPP/linux/issues/162 Signed-off-by: Erick Archer <[email protected]> Reviewed-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
2024-02-26accel/habanalabs/goya: remove redundant assignment to pointer 'input'Colin Ian King1-2/+1
The pointer input is assigned a value that is not read, it is being re-assigned again later with the same value. Resolve this by moving the declaration to input into the if block. Cleans up clang scan build warning: warning: Value stored to 'input' during its initialization is never read [deadcode.DeadStores] Signed-off-by: Colin Ian King <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
2024-02-26accel/habanalabs/gaudi2: fail memory memset when failing to copy QM packet ↵Tomer Tayar1-2/+8
to device gaudi2_memset_memory_chunk_using_edma_qm() calls the access_dev_mem() ASIC function, but ignores its return value. Add this missing check. Signed-off-by: Tomer Tayar <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
2024-02-26accel/habanalabs: remove call to deprecated functionDani Liberman2-3/+3
In newer kernel versions, irq_set_affinity_hint() is deprecated. Instead, use the newer version which is irq_set_affinity_and_hint(). Signed-off-by: Dani Liberman <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
2024-02-26accel/habanalabs: Remove unnecessary braces from if statementMalkoot Khan1-2/+1
The coding style in the Linux kernel prefers not to use braces for single-statement if conditions. This patch removes the unnecessary braces from an if statement in the file drivers/accel/habanalabs/common/command_submission.c, which also resolves a coding style warning. Signed-off-by: Malkoot Khan <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>
2024-02-26accel/habanalabs/gaudi2: move HMMU page tables to device memoryFarah Kassabri10-382/+836
Currently the HMMU page tables reside in the host memory, which will cause host access from the device for every page walk. This can affect PCIe bandwidth in certain scenarios. To prevent that problem, HMMU page tables will be moved to the device memory so the miss transaction will read the hops from there instead of going to the host. Signed-off-by: Farah Kassabri <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]>