[PATCH] habanalabs: fix MMU print message

2020-11-04 Thread Oded Gabbay
From: Moti Haimovski This commit fixes an incorrect error message Signed-off-by: Moti Haimovski Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/habanalabs/common

[PATCH] habanalabs/gaudi: fetch PLL info from FW

2020-11-04 Thread Oded Gabbay
From: Ofir Bitton Once FW security is enabled there is no access to PLL registers, need to read values from FW using a dedicated interface. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/firmware_if.c | 26

[PATCH] habanalabs: restore vm_pgoff after mmap

2020-11-04 Thread Oded Gabbay
ogy recipe. To re-enable that functionality, the driver can simply restore the value of vm_pgoff before returning to userspace but after calling dma_mmap_coherent(). Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/command_buffer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dr

[PATCH] habanalabs: Move repeatedly included headers to habanalabs.h

2020-11-04 Thread Oded Gabbay
From: Tomer Tayar Several header files are repeatedly included in many files. Move these files to habanalabs.h which is included by all. Signed-off-by: Tomer Tayar Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/command_buffer.c | 1 - drivers/misc

[PATCH] habanalabs/gaudi: remove pcie_en strap toggle

2020-11-04 Thread Oded Gabbay
Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/gaudi/gaudi.c | 14 +- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi/gaudi.c index ae4f3669261d..c075f7f10843 100644

[PATCH] habanalabs: add 'needs reset' state in driver

2020-11-04 Thread Oded Gabbay
From: Ofir Bitton The new state indicates that device should be reset in order to re-gain funcionality. This unique state can occur if reset_on_lockup is disabled and an actual lockup has occurred. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- .../misc

[PATCH] habanalabs: Small refactoring of cs_do_release()

2020-11-04 Thread Oded Gabbay
From: Tomer Tayar Slightly refactor the cs_do_release() function, to reduce nesting level and to ease the handling of future CS types. Signed-off-by: Tomer Tayar Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- .../habanalabs/common/command_submission.c| 99 +-- 1

[PATCH] habanalabs: reset device upon fw read failure

2020-11-04 Thread Oded Gabbay
From: farah kassabri failure in reading pre-boot verion is not handled correctly, upon failure we need to reset the device in order to be able to reinstall the driver. Signed-off-by: farah kassabri Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common

[PATCH] habanalabs: fix hard reset print and comment

2020-11-04 Thread Oded Gabbay
. Signed-off-by: Omer Shpigelman Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/device.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c

[PATCH] habanalabs: release signal if collective wait was dropped

2020-11-04 Thread Oded Gabbay
From: Ofir Bitton As in standard wait cs, we must release a signal fence once a collective wait cs was dropped and not submitted. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/command_submission.c | 6 -- 1 file changed

[PATCH] habanalabs: remove duplicate print

2020-11-04 Thread Oded Gabbay
We print twice the firmware status regarding security, once in common code and once in asic code. Remove the print in asic code and leave the common code print. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/gaudi/gaudi.c | 3 --- drivers/misc/habanalabs/goya/goya.c | 3 --- 2 files

[PATCH] habanalabs: Separate CS job completion from its deallocation

2020-11-04 Thread Oded Gabbay
-by: Tomer Tayar Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- .../habanalabs/common/command_submission.c| 25 ++- drivers/misc/habanalabs/common/debugfs.c | 13 +- drivers/misc/habanalabs/common/habanalabs.h | 2 ++ 3 files changed, 28 insertions(+), 12

[PATCH] habanalabs: Skip updating CI of internal queues if not in use

2020-11-04 Thread Oded Gabbay
From: Tomer Tayar There are no internal queues if H/W queues are being used. In this case we can skip the redundant traversal over the queues array, looking for internal queues. Signed-off-by: Tomer Tayar Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common

[PATCH] habanalabs/gaudi: increase MAX CS to 16K

2020-11-04 Thread Oded Gabbay
of those queues are full. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/gaudi/gaudiP.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/habanalabs/gaudi/gaudiP.h b/drivers/misc/habanalabs/gaudi/gaudiP.h index 1dcf7c41e698..c3c24e8da4e2 100644 --- a/drivers

[PATCH] habanalabs: move HW dirty check to a proper location

2020-11-05 Thread Oded Gabbay
From: Ofir Bitton Driver must verify if HW is dirty before trying to fetch preboot information. Hence, we move this validation to a prior stage of the boot sequence. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/device.c

[git pull] habanalabs pull request for kernel 5.10-rc1

2020-09-22 Thread Oded Gabbay
support for MMU with 6 HOPs Oded Gabbay (28): habanalabs: increase length of ASIC name habanalabs: change CB's ID to be 64 bits habanalabs: cast int to u32 before printing it with %u habanalabs: eliminate redundant else condition habanalabs: use standard BIT

Re: drivers/misc/habanalabs: atomic_t api usage inconsistencies

2020-09-23 Thread Oded Gabbay
On Tue, Sep 22, 2020 at 1:08 AM Shuah Khan wrote: > > All, > > While I was looking at the atomic_t api usages for an unrelated issue, > I noticed free_slots_cnt in struct hl_cq incerment/decrement/reads are > not consistent. > > atomic_inc() and atomic_set() are used, however instead of

[PATCH 2/4] habanalabs/gaudi: add NIC firmware-related definitions

2020-11-02 Thread Oded Gabbay
Add new structures and messages that the driver use to interact with the firmware to receive information and events (errors) about GAUDI's NIC. Signed-off-by: Omer Shpigelman Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- .../misc/habanalabs/include/common/cpucp_if.h | 34

[PATCH 0/4] Enable support of GAUDI NIC QMANs

2020-11-02 Thread Oded Gabbay
, such as collective wait mechanism. Thanks, Oded Oded Gabbay (4): habanalabs/gaudi: add NIC QMAN H/W and registers definitions habanalabs/gaudi: add NIC firmware-related definitions habanalabs/gaudi: add NIC security configuration habanalabs/gaudi: add support for NIC QMANs drivers/misc/habanalabs/common

[PATCH 4/4] habanalabs/gaudi: add support for NIC QMANs

2020-11-02 Thread Oded Gabbay
the firmware. However, the nic_ports_mask is still initialized to 0. That means this code won't initialize the QMANs just yet. That will be in a later patch. Signed-off-by: Omer Shpigelman Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/habanalabs.h | 3

[PATCH 2/3] habanalabs/gaudi: Set DMA5 QMAN internal

2020-11-03 Thread Oded Gabbay
From: Ofir Bitton DMA5 QMAN is designated to be used for reduction process, hence it will be no longer configured as external queue. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/gaudi/gaudi.c | 31

[PATCH 3/3] habanalabs: sync stream collective support

2020-11-03 Thread Oded Gabbay
From: Ofir Bitton Implement sync stream collective for GAUDI. Need to allocate additional resources for that and add ctx_fini() to clean up those resources. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- .../habanalabs/common/command_submission.c| 11

[PATCH 1/3] habanalabs: sync stream collective infrastructure

2020-11-03 Thread Oded Gabbay
From: Ofir Bitton Define new API for collective wait support and modify sync stream common flow. In addition add kernel CB allocation support for internal queues. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- .../habanalabs/common/command_submission.c

[PATCH] habanalabs: use enum for CB allocation options

2020-11-03 Thread Oded Gabbay
will allow to combine the two options. Add a flag to the uapi so the user will be able to indicate whether the CB was allocated by kernel or by user. Of course the driver validates that. Signed-off-by: Tal Cohen Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- .../habanalabs/common

[git pull] habanalabs fixes for 5.10-rc3

2020-11-03 Thread Oded Gabbay
the configuration was not executed in some cases - Mask watchdog timeout errors in QMANs which can spam the kernel log Arnd Bergmann (1): habanalabs: fix kernel pointer type Oded Gabbay (1): habanalabs/gaudi: mask WDT error

[PATCH 1/2] habanalabs/gaudi: move coresight mmu config

2020-11-02 Thread Oded Gabbay
From: Ofir Bitton We must relocate the coresight mmu configuration to the coresight flow to make it work in case the first submission is to configure the profiler. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/gaudi/gaudi.c

[PATCH 2/2] habanalabs/gaudi: mask WDT error in QMAN

2020-11-02 Thread Oded Gabbay
This interrupt cause is not relevant because of how the user use the QMAN arbitration mechanism. We must mask it as the log explodes with it. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/include/gaudi/gaudi_masks.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/misc

[PATCH] MAINTAINERS: update email, git repo of habanalabs driver

2020-11-02 Thread Oded Gabbay
Update the email to my kernel.org email address and update the git repository address to the git.kernel.org Signed-off-by: Oded Gabbay --- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index b516bb34a8d5..c3f3704acd64 100644

[PATCH] habanalabs/gaudi: move mmu_prepare to context init

2020-11-02 Thread Oded Gabbay
From: Ofir Bitton Currently mmu_prepare is located at context switch. Since we support a single context, no reason to reconfigure the MMU registers every context switch. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/gaudi/gaudi.c

[PATCH] habanalabs: change aggregate cs counters to atomic

2020-11-02 Thread Oded Gabbay
In case we will have multiple contexts/processes, we can't just increment aggregated counters. We need to make them atomic as they can be incremented by multiple processes Signed-off-by: Oded Gabbay --- .../habanalabs/common/command_submission.c| 42 +-- drivers/misc

[PATCH] habanalabs: we need CPU queues for hwmon

2020-11-02 Thread Oded Gabbay
F/W can be loaded but device CPU queues disabled. In that case, HWMON should be disabled. This is only relevant when debugging Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/habanalabs/common

[PATCH 4/4] habanalabs: remove duplicate check

2020-11-02 Thread Oded Gabbay
We already check if queue index is smaller than max queues a few lines above this check so no need to check this again. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/command_submission.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/misc

[PATCH] habanalabs: minimize prints when everything is fine

2020-11-02 Thread Oded Gabbay
No need to print when the driver starts to initialize the H/W. Drivers should be silent when everything is OK. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/gaudi/gaudi.c | 2 -- drivers/misc/habanalabs/goya/goya.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/drivers/misc

[PATCH] habanalabs: don't init vm module if no MMU

2020-11-02 Thread Oded Gabbay
In case we are running without MMU enabled (debug mode), no need to initialize the VM module in the driver. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/memory.c | 33 +++-- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/drivers/misc

[PATCH 2/4] habanalabs: add support for multiple SOBs per monitor

2020-11-02 Thread Oded Gabbay
From: Ofir Bitton Support advanced monitor functionality to monitor more than a single SOB. In addition expand all CB generation functions with buffer offset in order to put in them multiple packets that are generated by different functions. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay

[PATCH 1/4] habanalabs: sync stream structures refactor

2020-11-02 Thread Oded Gabbay
From: Ofir Bitton Refactor sync stream implementation by adding more structures for better readability. In addition reducing allocated resources. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/habanalabs.h | 78

[PATCH 3/4] habanalabs: sync stream refactor functions

2020-11-02 Thread Oded Gabbay
From: Ofir Bitton Refactor sync stream implementation by reducing function length for better readability. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- .../habanalabs/common/command_submission.c| 210 ++ 1 file changed, 119 insertions

[PATCH] habanalabs: support multiple types of firmwares

2020-11-02 Thread Oded Gabbay
The driver now loads the firmware in two stages. For debugging purposes we need to support situations where only the first stage firmware is loaded. Therefore, use a bitmask to determine which F/W is loaded Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/firmware_if.c| 9

[PATCH] habanalabs: add CS completion and timeout properties

2021-01-26 Thread Oded Gabbay
From: Ofir Bitton In order to support staged submission feature, we need to distinguish on which command submission we want to receive timeout and for which we want to receive completion. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- .../habanalabs

[git pull] habanalabs pull request for kernel 5.12

2021-01-27 Thread Oded Gabbay
habanalabs: report dram_page_size in hw_ip_info ioctl habanalabs: support non power-of-2 DRAM phys page sizes Oded Gabbay (8): habanalabs: update firmware boot interface habanalabs: add ASIC property of functional HBMs habanalabs: update to latest hl_boot_if.h habanala

[PATCH 2/3] habanalabs/gaudi: unmask HBM interrupts after handling

2021-01-26 Thread Oded Gabbay
As the driver does with all interrupts, we need to tell F/W to unmask the HBM interrupts after the driver handled them. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/gaudi/gaudi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc

[PATCH 1/3] habanalabs: update SyncManager interrupt handling

2021-01-26 Thread Oded Gabbay
The firmware provides more information about SyncManager events. Adjust the code to the latest firmware interface file. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/gaudi/gaudi.c | 14 +++--- drivers/misc/habanalabs/include/common/cpucp_if.h | 11 +-- 2

[PATCH 3/3] habanalabs: update to latest hl_boot_if.h spec from F/W

2021-01-26 Thread Oded Gabbay
It adds the definition for indication that the F/W handles HBM ECC events. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/include/common/hl_boot_if.h | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/misc/habanalabs/include/common/hl_boot_if.h b/drivers

[PATCH 2/3] habanalabs: staged submission support

2021-01-26 Thread Oded Gabbay
Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- .../habanalabs/common/command_submission.c| 214 -- drivers/misc/habanalabs/common/habanalabs.h | 9 + drivers/misc/habanalabs/common/hw_queue.c | 27 +++ drivers/misc/habanalabs/gaudi/gaudi.c | 1 + 4

[PATCH 3/3] habanalabs: fix ETR security issue

2021-01-26 Thread Oded Gabbay
From: Ohad Sharabi ETR should always be non-secured as it is used by the users to record profiling/trace data. This patch fixes the configuration to match those requirements. Signed-off-by: Ohad Sharabi Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- .../misc/habanalabs/gaudi

[PATCH 1/3] habanalabs: modify device_idle interface

2021-01-26 Thread Oded Gabbay
From: Ohad Sharabi Currently this API uses single 64 bits mask for engines idle indication. Recently, it was observed that more bits are needed for some ASICs. This patch modifies the use of the idle mask and the idle_extensions mask. Signed-off-by: Ohad Sharabi Reviewed-by: Oded Gabbay

[PATCH 1/4] habanalabs: improve communication protocol with cpucp

2021-02-02 Thread Oded Gabbay
-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/firmware_if.c| 17 +++-- drivers/misc/habanalabs/common/habanalabs.h | 3 +++ drivers/misc/habanalabs/gaudi/gaudi.c | 6 +- drivers/misc/habanalabs/goya/goya.c | 6

[PATCH 2/4] habanalabs: support fetching first available user CQ

2021-02-02 Thread Oded Gabbay
From: Ofir Bitton User must be aware of the available CQs when it needs to use them. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/habanalabs.h | 2 ++ drivers/misc/habanalabs/common/habanalabs_ioctl.c | 3

[PATCH 4/4] habanalabs: enable F/W events after init done

2021-02-02 Thread Oded Gabbay
it shouldn't be. Same logic should be applied after hard-reset. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/device.c | 23 + drivers/misc/habanalabs/common/habanalabs.h | 9 ++-- drivers/misc/habanalabs/gaudi/gaudi.c | 10 ++--- drivers/misc

[PATCH 3/4] habanalabs/gaudi: use HBM_ECC_EN bit for ECC ERR

2021-02-02 Thread Oded Gabbay
From: Ohad Sharabi driver should use ECC info from FW only if HBM ECC CAP is set. otherwise, try to fetch the data from MC regs only if security is disabled. Signed-off-by: Ohad Sharabi Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/gaudi/gaudi.c | 18

[PATCH] habanalabs: add comments on INFO IOCTL

2019-07-16 Thread Oded Gabbay
This patch adds some in-code documentation on the different opcodes of the INFO IOCTL. Signed-off-by: Oded Gabbay --- include/uapi/misc/habanalabs.h | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/include/uapi/misc/habanalabs.h b/include/uapi/misc/habanalabs.h

[PATCH] habanalabs: add debug print when rejecting CS

2019-07-18 Thread Oded Gabbay
When rejecting CS because of too many in-flight CS, print a debug message about it as it useful to know when the user is debugging (it indicates a back-pressure from the driver as the device is not fast enough to consume the CS) Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs

[PATCH] habanalabs: cap simulator timeout

2019-07-18 Thread Oded Gabbay
seconds, which is our largest timeout in the code. That is more then enough for anything the simulator is doing. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/habanalabs.h | 20 ++-- 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/misc/habanalabs

[git pull] habanalabs pull request for kernel 5.8

2020-05-19 Thread Oded Gabbay
habanalabs: support hwmon_reset_history attribute Dotan Barak (1): habanalabs: print all CB handles as hex numbers Oded Gabbay (17): habanalabs: don't wait for ASIC CPU after reset habanalabs: unify and improve device cpu init habanalabs: print warning when reset is

Re: [PATCH] habanalabs: fix error code in unmap_device_va()

2020-05-28 Thread Oded Gabbay
Thanks, we already have a patch ready for that in -fixes branch that will be applied in 5.8-rc2 Oded On Thu, May 28, 2020 at 3:39 PM Dan Carpenter wrote: > > Smatch complains that "rc" can be uninitialized on certain paths. > > Fixes: 8ff5f4fd40df ("habanalabs: handle MMU cache invalidation

Re: [PATCH] habanalabs: handle MMU cache invalidation timeout

2020-05-24 Thread Oded Gabbay
vaddr + phys_pg_pack->total_size - 1); > + int tmp_rc; > + > if (rc) > + dev_err(hdev->dev, > + "unmapping vaddr 0x%llx failed due to MMU > cache invalidation\n", > + vaddr); > + > + tmp_rc = add_va_block(hdev, va_range, vaddr, > + vaddr + phys_pg_pack->total_size - 1); > + if (tmp_rc) { > dev_warn(hdev->dev, > "add va block failed for vaddr: > 0x%llx\n", > vaddr); > + if (!rc) > + rc = tmp_rc; > + } > } > > atomic_dec(_pg_pack->mapping_cnt); > @@ -1108,7 +1129,7 @@ static int unmap_device_va(struct hl_ctx *ctx, u64 > vaddr, bool ctx_free) > dma_unmap_host_va(hdev, userptr); > } > > - return 0; > + return rc; > > mapping_cnt_err: > if (is_userptr) > -- > 2.17.1 > This patch is: Reviewed-by: Oded Gabbay

[git pull] habanalabs second pull request for kernel 5.8

2020-05-24 Thread Oded Gabbay
because of gen_pool checks - Don't initialize the default wait callback of dma_buf with the default wait function as that's the default... Daniel Vetter (1): habanalabs: don't set default fence_ops->wait Oded Gabbay

[PATCH 2/2] habanalabs: correctly cast u64 to void*

2020-06-01 Thread Oded Gabbay
Use the u64_to_user_ptr(x) kernel macro to correctly cast u64 to void* Reported-by: kbuild test robot Reviewed-by: Omer Shpigelman Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/command_submission.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc

[PATCH 1/2] habanalabs: initialize variable to default value

2020-06-01 Thread Oded Gabbay
From: Tomer Tayar Fix the following smatch error in unmap_device_va(): error: uninitialized symbol 'rc'. Signed-off-by: Tomer Tayar Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

Re: [PATCH] habanalabs: Fix static analysis error

2020-05-27 Thread Oded Gabbay
ruct hl_ctx *ctx, u64 > vaddr, bool ctx_free) > struct hl_va_range *va_range; > enum vm_type_t *vm_type; > bool is_userptr; > - int rc; > + int rc = 0; > > /* protect from double entrance */ > mutex_lock(>mem_hash_lock); > -- > 2.17.1 > This patch is: Reviewed-by: Oded Gabbay Applied to -fixes

[PATCH] habanalabs: correctly cast u64 to void*

2020-05-31 Thread Oded Gabbay
Use the u64_to_user_ptr(x) kernel macro to correctly cast u64 to void* Reported-by: kbuild test robot Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/command_submission.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/habanalabs/command_submission.c b

[PATCH 2/2] habanalabs: use PI in MMU cache invalidation

2020-06-05 Thread Oded Gabbay
From: Omer Shpigelman The PS flow for MMU cache invalidation caused timeouts in stress tests. Use PS + PI flow so no timeouts should happen whatsoever. Signed-off-by: Omer Shpigelman Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/gaudi/gaudi.c | 8

[PATCH 1/2] habanalabs: block scalar load_and_exe on external queue

2020-06-05 Thread Oded Gabbay
In Gaudi, the user can't execute scalar load_and_exe on external queue because it can be a security hole. The driver doesn't parse the commands being loaded and it can be msg_prot, which the user isn't allowed to use. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/gaudi/gaudi.c

[PATCH] habanalabs: rename mmu_write() to mmu_asid_va_write()

2020-06-06 Thread Oded Gabbay
The function name conflicts with a static inline function in arch/m68k/include/asm/mcfmmu.h Reported-by: kernel test robot Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/habanalabs/debugfs.c

Re: [PATCH] drm/amdkfd: Use ARRAY_SIZE macro in kfd_build_sysfs_node_entry

2018-01-31 Thread Oded Gabbay
On Sat, Jan 20, 2018 at 12:30 AM, Gustavo A. R. Silva wrote: > > Quoting Felix Kuehling : > >> Looks good. This change is Reviewed-by: Felix Kuehling >> >> > > Thanks Felix. > -- > Gustavo > Applied to -next Oded > > > >

[PATCH 0/8] Fixing DMA mask issues in habanalabs driver

2019-06-10 Thread Oded Gabbay
on other architectures (e.g. x86-64, ARM). Thanks, Oded Oded Gabbay (8): habanalabs: initialize device CPU queues after MMU init habanalabs: de-couple MMU and VM module initialization habanalabs: initialize MMU context for driver habanalabs: add MMU mappings for Goya CPU habanalabs: set Goya

[PATCH 6/8] habanalabs: remove DMA mask hack for Goya

2019-06-10 Thread Oded Gabbay
, a practice that is not working on POWER architecture. The patch sets the DMA mask to 48 bits once during the initialization. The address of the CPU accessible memory area is configured to the MMU and the matching VA is given to the device CPU. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya

[PATCH 7/8] habanalabs: add WARN in case of bad MMU mapping

2019-06-10 Thread Oded Gabbay
(the remainder of address/page size). Because the physical address is being handled by the driver, a WARN is suitable here as it implies a bug in the driver code itself and not a user bug. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/mmu.c | 4 1 file changed, 4 insertions(+) diff --git

[PATCH 8/8] habanalabs: enable 64-bit DMA mask in POWER9

2019-06-10 Thread Oded Gabbay
. And upon such failure, the driver must fall-back to set the mask to 32 bits. 3. There is no standard way to differentiate in runtime between POWER9 and other architectures. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 6 +- drivers/misc/habanalabs

[PATCH 5/8] habanalabs: set Goya CPU to use ASIC MMU

2019-06-10 Thread Oded Gabbay
This patch configures the Goya CPU to actually go through the MMU for translation. The configuration is done after the configuration of the relevant MMU mappings. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 23 --- 1 file changed, 20 insertions(+), 3

[PATCH 1/8] habanalabs: initialize device CPU queues after MMU init

2019-06-10 Thread Oded Gabbay
This patch changes the order of H/W IP initializations. The MMU needs to be initialized before the device CPU queues, because the CPU will go through the ASIC MMU in order to reach the host memory (where the queues are located). Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/asid.c

[PATCH 4/8] habanalabs: add MMU mappings for Goya CPU

2019-06-10 Thread Oded Gabbay
and the device CPU is also being mapped. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/debugfs.c| 7 +- drivers/misc/habanalabs/goya/goya.c | 126 +-- drivers/misc/habanalabs/goya/goyaP.h | 12 ++- drivers/misc/habanalabs/habanalabs.h | 6 +- 4 files changed, 137

[PATCH 2/8] habanalabs: de-couple MMU and VM module initialization

2019-06-10 Thread Oded Gabbay
because it depends on the size of the DRAM, which is retrieved from the device CPU. Communication with the device CPU will require the MMU mappings to be configured and hence the de-coupling. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/device.c | 23 --- drivers/misc

[PATCH 3/8] habanalabs: initialize MMU context for driver

2019-06-10 Thread Oded Gabbay
This patch initializes the MMU structures for the kernel context. This is needed before we can configure mappings for the kernel context. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/context.c | 7 +++ drivers/misc/habanalabs/mmu.c | 10 ++ 2 files changed, 13

Re: [PATCH 8/8] habanalabs: enable 64-bit DMA mask in POWER9

2019-06-11 Thread Oded Gabbay
On Tue, Jun 11, 2019 at 10:59 AM Greg KH wrote: > > On Tue, Jun 11, 2019 at 08:50:45AM +0300, Oded Gabbay wrote: > > --- a/drivers/misc/habanalabs/habanalabs_drv.c > > +++ b/drivers/misc/habanalabs/habanalabs_drv.c > > @@ -28,6 +28,7 @@ static DEFINE_MUTEX(hl_devs_idr_lo

Re: [PATCH 8/8] habanalabs: enable 64-bit DMA mask in POWER9

2019-06-11 Thread Oded Gabbay
On Tue, Jun 11, 2019 at 11:08 AM Oded Gabbay wrote: > > On Tue, Jun 11, 2019 at 10:59 AM Greg KH wrote: > > > > On Tue, Jun 11, 2019 at 08:50:45AM +0300, Oded Gabbay wrote: > > > --- a/drivers/misc/habanalabs/habanalabs_drv.c > > > +++ b/drivers/misc/habana

[PATCH v2 8/8] habanalabs: enable 64-bit DMA mask in POWER9

2019-06-11 Thread Oded Gabbay
. The activation of this special configuration is done in case the PCI parent device of Goya is a PHB4 PCI device of IBM. Signed-off-by: Oded Gabbay --- Changes in v2: - Remove kernel module parameter and instead read the PCI device ID of the parent PCI bus. If it is PHB4, do the special configuration

Re: [PATCH] habanalabs: Avoid double free in error flow

2019-08-01 Thread Oded Gabbay
"kernel ctx is still alive on initialization > failure\n"); > -free_ctx: > - kfree(hdev->kernel_ctx); > mmu_fini: > hl_mmu_fini(hdev); > eq_fini: > -- > 2.17.1 > This patch is: Reviewed-by: Oded Gabbay Applied to -fixed Oded

[PATCH] habanalabs: fix bug in checking huge page optimization

2019-05-30 Thread Oded Gabbay
, the code ignored the first requirement for the first DMA chunk. This patch fix that issue by making sure the requirement of address alignment is validated against all DMA chunks. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/memory.c | 6 -- 1 file changed, 6 deletions(-) diff --git

[PATCH] habanalabs: don't reset device when getting VRHOT

2019-07-21 Thread Oded Gabbay
VRHOT event from the F/W indicates the device has reached a temperature of 100 Celsius degrees. In this case, the driver should only print this information to the kernel log. The device will shutdown itself automatically when reaching 125 degrees. Signed-off-by: Oded Gabbay --- drivers/misc

[PATCH] habanalabs: power management through sysfs is only for GOYA

2019-07-21 Thread Oded Gabbay
-by: Oded Gabbay --- .../ABI/testing/sysfs-driver-habanalabs | 5 +- drivers/misc/habanalabs/goya/goya_hwmgr.c | 98 +++ drivers/misc/habanalabs/sysfs.c | 98 --- 3 files changed, 101 insertions(+), 100 deletions(-) diff --git a/Documentation/ABI

[git pull] habanalabs fixes for 5.3-rc2

2019-07-22 Thread Oded Gabbay
Arnd Bergmann (1): habanalabs: use %pad for printing a dma_addr_t Oded Gabbay (1): habanalabs: don't reset device when getting VRHOT drivers/misc/habanalabs/goya/goya.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)

Re: [PATCH 2/2] habanalabs: Add descriptive name to PSOC app status register

2019-08-05 Thread Oded Gabbay
_reg_map.h > @@ -29,4 +29,6 @@ > #define mmUBOOT_OFFSET mmPSOC_GLOBAL_CONF_SCRATCHPAD_30 > #define mmBTL_ID mmPSOC_GLOBAL_CONF_SCRATCHPAD_31 > > +#define mmHW_STATE mmPSOC_GLOBAL_CONF_APP_STATUS > + > #endif /* GOYA_REG_MAP_H_ */ > -- > 2.17.1 > The two patches are: Reviewed-by: Oded Gabbay Applied to -next. Thanks, Oded

Re: [PATCH] habanalabs: Update DRAM consumption on context tear down

2019-08-05 Thread Oded Gabbay
gt;asid); > + atomic64_sub(phys_pg_list->total_size, > + >dram_used_mem); > free_phys_pg_pack(hdev, phys_pg_list); > idr_remove(>phys_pg_pack_handles, i); > } > -- > 2.17.1 > This patch is: Reviewed-by: Oded Gabbay Applied to -fixed. Thanks. Oded

Re: [PATCH 2/2] habanalabs: improve security in Debug IOCTL

2019-08-06 Thread Oded Gabbay
nt_types[i]); > + WREG32(base_reg + SPMU_EVENT_TYPES_OFFSET + i * 4, > + input->event_types[i]); > > WREG32(base_reg + 0xE04, 0x41013041); > WREG32(base_reg + 0xC00, 0x803F); > @@ -567,6 +615,12 @@ static int goya_config_spmu(struct hl_device *hdev, > return -EINVAL; > } > > + if (events_num > SPMU_MAX_EVENTS) { > + dev_err(hdev->dev, > + "too many events values for SPMU disable\n"); > + return -EINVAL; > + } > + > WREG32(base_reg + 0xE04, 0x41013040); > > for (i = 0 ; i < events_num ; i++) > -- > 2.17.1 > Both patches are: Reviewed-by: Oded Gabbay

Re: [PATCH -next] habanalabs: remove set but not used variable 'ctx'

2019-09-29 Thread Oded Gabbay
struct hl_fpriv *hpriv; > struct hl_device *hdev; > - struct hl_ctx *ctx; > > hpriv = container_of(ref, struct hl_fpriv, refcount); > > hdev = hpriv->hdev; > - ctx = hpriv->ctx; > > put_pid(hpriv->taskpid); > > -- > 2.7.4 > > This patch is: Reviewed-by: Oded Gabbay Applied to -next. Thanks, Oded

[PATCH 1/2] habanalabs: add uapi to retrieve device utilization

2019-08-30 Thread Oded Gabbay
as percentage the total utilization rate. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/command_submission.c | 20 +++- drivers/misc/habanalabs/device.c | 114 ++- drivers/misc/habanalabs/habanalabs.h | 23 +++- drivers/misc/habanalabs/habanalabs_ioctl.c

[PATCH 2/2] habanalabs: add uapi to retrieve aggregate H/W events

2019-08-30 Thread Oded Gabbay
Add a new opcode to INFO IOCTL to retrieve aggregate H/W events. i.e. the events counters are NOT cleared upon device reset, but count from the loading of the driver. Add the code to support it in the device event handling function. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya

[PATCH] habanalabs: display card name as sensors header

2019-08-30 Thread Oded Gabbay
is displayed as the sensors group name. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c| 4 drivers/misc/habanalabs/goya/goyaP.h | 2 ++ drivers/misc/habanalabs/hwmon.c| 4 +++- drivers/misc/habanalabs/include/armcp_if.h | 17

[PATCH 1/2] habanalabs: stop using the acronym KMD

2019-09-02 Thread Oded Gabbay
We want to stop using the acronym KMD. Therefore, replace all locations (except for register names we can't modify) where KMD is written to other terms such as "Linux kernel driver" or "Host kernel driver", etc. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/asid.

[PATCH 2/2] habanalabs: show correct id in error print

2019-09-02 Thread Oded Gabbay
If the initialization of a device failed, the driver prints an error message with the id of the device. The device index on the file system is that id divided by 2. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff

[PATCH] habanalabs: handle F/W failure for sensor initialization

2019-09-16 Thread Oded Gabbay
In case the F/W fails to initialize the thermal sensors, print an appropriate error message to kernel log and fail the device initialization. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 5 + drivers/misc/habanalabs/include/hl_boot_if.h | 2 ++ 2 files

Re: [PATCH] habanalabs: Fix typos

2019-10-05 Thread Oded Gabbay
ing. The user will wait > - * inside the kernel until the CS has finished or until the user-requeusted > + * inside the kernel until the CS has finished or until the user-requested > * timeout has expired. > * > * The return value of the IOCTL is a standard Linux error code. The possible > -- > 2.17.1 > This patch is: Reviewed-by: Oded Gabbay

Re: [PATCH v2 1/4] habanalabs: Mark queue as expecting to CB handle or address

2019-10-05 Thread Oded Gabbay
* @type: queue type. > * @driver_only: true if only the driver is allowed to send a job to this > queue, > * false otherwise. > + * @requires_kernel_cb: true if a CB handle must be provided for jobs on this > + * queue, false otherwise (a CB add

[PATCH] habanalabs: set TPC Icache to 16 cache lines

2019-10-05 Thread Oded Gabbay
Reduce latency to memory during TPC kernel execution. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 3 +++ drivers/misc/habanalabs/habanalabs.h | 7 --- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc

Question about using #ifdef CONFIG_PPC64 in driver code

2019-10-06 Thread Oded Gabbay
Hi Greg, a while ago we had an argument about identifying in my driver's code whether I'm running on x86 or powerpc. I tried to do something dynamically (based on parent pci bridge ID), and you and other people objected to it. I see in other drivers (more then a few) that they are using #ifdef

Re: [PATCH] habanalabs: Make the Coresight timestamp perpetual

2019-08-28 Thread Oded Gabbay
bs.h > @@ -451,7 +451,7 @@ struct hl_debug_params_spmu { > #define HL_DEBUG_OP_BMON 4 > /* Opcode for SPMU component */ > #define HL_DEBUG_OP_SPMU 5 > -/* Opcode for timestamp */ > +/* Opcode for timestamp (deprecated) */ > #define HL_DEBUG_OP_TIMESTAMP 6 > /* Opcode for setting the device into or out of debug mode. The enable > * variable should be 1 for enabling debug mode and 0 for disabling it > -- > 2.17.1 > This patch is: Reviewed-by: Oded Gabbay Applied to -next Oded

[PATCH 1/2] habanalabs: fix endianness handling for internal QMAN submission

2019-08-10 Thread Oded Gabbay
() so it would work in architectures that have separate address ranges for IO memory. This patch makes the code that writes the PQE to be ASIC-specific so we can handle this properly per ASIC. Signed-off-by: Oded Gabbay Tested-by: Ben Segal --- drivers/misc/habanalabs/goya/goya.c | 7

[PATCH 2/2] habanalabs: fix device IRQ unmasking for BE host

2019-08-10 Thread Oded Gabbay
the endianness of a couple of kernel log debug messages that print values of packets Signed-off-by: Ben Segal Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 33 + 1 file changed, 24 insertions(+), 9 deletions(-) diff --git

[PATCH] habanalabs: print to kernel log when reset is finished

2019-08-10 Thread Oded Gabbay
Now that we don't print the queue testing messages, we need to print when the reset is finished so whoever looks at the kernel log will know the reset process was finished successfully and the driver is not stuck. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/device.c | 2 ++ 1 file

<    5   6   7   8   9   10   11   12   13   14   >