[PATCH] habanalabs: free host huge va_range if not used

2020-11-28 Thread Oded Gabbay
From: Ofir Bitton If huge range is not valid, driver uses the host range also for huge page allocations, but driver never frees its allocation. This introduces a memory leak every time a user closes its context. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay

[PATCH] habanalabs: Add mask for CS type bits in CS flags

2020-11-28 Thread Oded Gabbay
-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/command_submission.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/misc/habanalabs/common/command_submission.c b/drivers/misc/habanalabs/common/command_submission.c index bd2f54399020

[PATCH] habanalabs: add missing counter update

2020-11-25 Thread Oded Gabbay
The global CS drop-on-reset counter wasn't updated together with the context counter. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/hw_queue.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/habanalabs/common/hw_queue.c b/drivers/misc/habanalabs/common

[PATCH] habanalabs: add ull to PLL masks

2020-11-25 Thread Oded Gabbay
From: Alon Mizrahi These defines are 64-bit defines so they need ull suffix. Signed-off-by: Alon Mizrahi Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/include/common/cpucp_if.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git

[PATCH] habanalabs: add support for cs with timestamp

2020-11-25 Thread Oded Gabbay
From: Ofir Bitton add support for user to request a timestamp upon cs completion. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- .../habanalabs/common/command_submission.c| 44 ++- drivers/misc/habanalabs/common/habanalabs.h | 4

[PATCH] habanalabs: indicate to user that a cs is gone

2020-11-25 Thread Oded Gabbay
From: Ofir Bitton We want to indicate to the user that a certain command submission is finished long time ago and it is no longer in database. This means no further information regarding this cs can be obtained. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay

[PATCH] habanalabs: improve hard reset procedure

2020-11-08 Thread Oded Gabbay
f-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/device.c | 128 ++-- drivers/misc/habanalabs/common/habanalabs.h | 16 ++- 2 files changed, 106 insertions(+), 38 deletions(-) diff --git a/drivers/misc/habanalabs/commo

[PATCH] habanalabs: Rename hw_queues_mirror to cs_mirror

2020-11-08 Thread Oded Gabbay
Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- .../habanalabs/common/command_submission.c | 18 -- drivers/misc/habanalabs/common/device.c| 4 ++-- drivers/misc/habanalabs/common/habanalabs.h| 8 drivers/misc/habanalabs/common/hw_queue.c

[PATCH] habanalabs: refactor mmu va_range db structure

2020-11-08 Thread Oded Gabbay
From: Ofir Bitton Use an array of va_ranges instead of keeping each va_range separately, we do this for better readability and in order to support access to a specific range in a much elegant manner. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers

[PATCH] habanalabs: move asic property to correct structure

2020-11-09 Thread Oded Gabbay
Whether an ASIC has MMU towards its DRAM is an ASIC property, so move it to the asic fixed properties structure. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/debugfs.c| 2 +- drivers/misc/habanalabs/common/habanalabs.h | 4 ++-- drivers/misc/habanalabs/common/memory.c

[PATCH] habanalabs: use host va range for internal pools

2020-11-09 Thread Oded Gabbay
From: Ofir Bitton Instead of using a dedicated va range for each internal pool, we introduce a new way for reserving a va block from an existing va range. This is a more generic way of reserving va blocks for future use. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded

[PATCH] habanalabs: correctly cast variable to __le32

2019-09-03 Thread Oded Gabbay
When using the macro le32_to_cpu(x), we need to correctly convert x to be __le32 in case it is defined as u32 variable. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/habanalabs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/habanalabs

[PATCH v2 2/7] habanalabs: kill user process after CS rollback

2019-07-30 Thread Oded Gabbay
This patch calls the kill user process function after we rollback the in-flight CSs. This is because the user process can't be closed while there are open CSs. Therefore, there is no point of sending it a SIGKILL before we do the rollback CS part. Signed-off-by: Oded Gabbay --- drivers/misc

[PATCH v2 5/7] habanalabs: maintain a list of file private data objects

2019-07-30 Thread Oded Gabbay
structure per open file and once it is released, remove it from the list. As long as the list is not empty, it means we have a user that can do something with our device. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/device.c | 132 ++ drivers/misc/habanalabs

[PATCH v2 3/7] habanalabs: show the process context dram usage

2019-07-30 Thread Oded Gabbay
. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/habanalabs_ioctl.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/misc/habanalabs/habanalabs_ioctl.c b/drivers/misc/habanalabs/habanalabs_ioctl.c index 07127576b3e8..c9a4799eb251 100644

[PATCH v2 6/7] habanalabs: change device_setup_cdev() to be more generic

2019-07-30 Thread Oded Gabbay
per ASIC. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/device.c | 47 +--- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/drivers/misc/habanalabs/device.c b/drivers/misc/habanalabs/device.c index 926c85ff068f..60c779648f92 100644 --- a/drivers

[PATCH v2 7/7] habanalabs: create two char devices per ASIC

2019-07-30 Thread Oded Gabbay
where x is the minor number of the original char device + 64 (HL_CONTROL_MINOR). Applications that open this device can only call the INFO IOCTL. There is no limitation on the number of applications opening this device. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/dev

[PATCH v2 4/7] habanalabs: rename user_ctx as compute_ctx

2019-07-30 Thread Oded Gabbay
. This has no effect right now as we only have a single process and a single context, but this makes the code more ready for multiple process support. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/context.c| 13 - drivers/misc/habanalabs/debugfs.c| 4 ++-- drivers/misc

[PATCH v2 1/7] habanalabs: add handle field to context structure

2019-07-30 Thread Oded Gabbay
This patch adds a field to the context's structure that will hold a unique handle for the context. This will be needed when the user will create the context. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/context.c| 27 --- drivers/misc/habanalabs

[PATCH v2 0/7] habanalabs: support info queries by multiple processes

2019-07-30 Thread Oded Gabbay
of the number of open file-descriptors and replace it with tracking of the driver's internal file private data strcuture. - Patch 6 is a pre-requisite to creating the two char devices - Patch 7 introduce the additional char device Thanks, Oded Oded Gabbay (7): habanalabs: add handle field

Re: [PATCH v2 7/7] habanalabs: create two char devices per ASIC

2019-07-30 Thread Oded Gabbay
On Tue, Jul 30, 2019 at 1:42 PM Greg KH wrote: > > On Tue, Jul 30, 2019 at 12:47:24PM +0300, Oded Gabbay wrote: > > This patch changes the driver to create two char devices for each ASIC > > it discovers. This is done to allow system/monitoring applications to > > qu

[PATCH v3 3/7] habanalabs: show the process context dram usage

2019-07-31 Thread Oded Gabbay
. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/habanalabs_ioctl.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/misc/habanalabs/habanalabs_ioctl.c b/drivers/misc/habanalabs/habanalabs_ioctl.c index 07127576b3e8..c9a4799eb251 100644

[PATCH v3 0/7] habanalabs: support info queries by multiple processes

2019-07-31 Thread Oded Gabbay
char devices - Patch 7 introduce the additional char device Thanks, Oded Oded Gabbay (7): habanalabs: add handle field to context structure habanalabs: kill user process after CS rollback habanalabs: show the process context dram usage habanalabs: rename user_ctx as compute_ctx

[PATCH v3 4/7] habanalabs: rename user_ctx as compute_ctx

2019-07-31 Thread Oded Gabbay
. This has no effect right now as we only have a single process and a single context, but this makes the code more ready for multiple process support. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/context.c| 13 - drivers/misc/habanalabs/debugfs.c| 4 ++-- drivers/misc

[PATCH v3 5/7] habanalabs: maintain a list of file private data objects

2019-07-31 Thread Oded Gabbay
structure per open file and once it is released, remove it from the list. As long as the list is not empty, it means we have a user that can do something with our device. Signed-off-by: Oded Gabbay --- Changes in v3: - fix deadlock when changing pm mode to manual drivers/misc/habanalabs/device.c

[PATCH v3 6/7] habanalabs: change device_setup_cdev() to be more generic

2019-07-31 Thread Oded Gabbay
per ASIC. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/device.c | 47 +--- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/drivers/misc/habanalabs/device.c b/drivers/misc/habanalabs/device.c index 926c85ff068f..60c779648f92 100644 --- a/drivers

[PATCH v3 7/7] habanalabs: create two char devices per ASIC

2019-07-31 Thread Oded Gabbay
where x is the same index of the main device with a minor number of the original char device + 1. Applications that open this device can only call the INFO IOCTL. There is no limitation on the number of applications opening this device. Signed-off-by: Oded Gabbay --- Changes in v3: - control devi

[PATCH v3 2/7] habanalabs: kill user process after CS rollback

2019-07-31 Thread Oded Gabbay
This patch calls the kill user process function after we rollback the in-flight CSs. This is because the user process can't be closed while there are open CSs. Therefore, there is no point of sending it a SIGKILL before we do the rollback CS part. Signed-off-by: Oded Gabbay --- drivers/misc

[PATCH v3 1/7] habanalabs: add handle field to context structure

2019-07-31 Thread Oded Gabbay
This patch adds a field to the context's structure that will hold a unique handle for the context. This will be needed when the user will create the context. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/context.c| 27 --- drivers/misc/habanalabs

[PATCH 2/2] habanalabs: fix completion queue handling when host is BE

2019-08-07 Thread Oded Gabbay
From: Ben Segal This patch fix the CQ irq handler to work in hosts with BE architecture. It adds the correct endian-swapping macros around the relevant memory accesses. Signed-off-by: Ben Segal Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/irq.c | 27

[PATCH 1/2] habanalabs: fix endianness handling for packets from user

2019-08-07 Thread Oded Gabbay
or BE depending on the arch). Signed-off-by: Ben Segal Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 32 +++ .../habanalabs/include/goya/goya_packets.h| 13 2 files changed, 32 insertions(+), 13 deletions

Re: [PATCH] habanalabs: Expose devices after initialization is done

2019-08-08 Thread Oded Gabbay
>devt); > - cdev_del(>cdev); > + /* Hide devices and sysfs nodes from user */ > + device_cdev_sysfs_del(hdev); > > pr_info("removed device successfully\n"); > } > diff --git a/drivers/misc/habanalabs/habanalabs.h > b/drivers/misc/habanalabs/habanalabs.h > index 29d98901..1bb181285589 100644 > --- a/drivers/misc/habanalabs/habanalabs.h > +++ b/drivers/misc/habanalabs/habanalabs.h > @@ -1216,6 +1216,7 @@ struct hl_device_reset_work { > * @dma_mask: the dma mask that was set for this device > * @in_debug: is device under debug. This, together with fpriv_list, enforces > *that only a single user is configuring the debug > infrastructure. > + * @cdev_sysfs_created: were char devices and sysfs nodes created. > */ > struct hl_device { > struct pci_dev *pdev; > @@ -1291,6 +1292,7 @@ struct hl_device { > u8 device_cpu_disabled; > u8 dma_mask; > u8 in_debug; > + u8 cdev_sysfs_created; > > /* Parameters for bring-up */ > u8 mmu_enable; > -- > 2.17.1 > This patch is: Reviewed-by: Oded Gabbay

Re: [PATCH] habanalabs: Handle HW_IP_INFO if device disabled or in reset

2019-08-08 Thread Oded Gabbay
_HW_IP_INFO: > - rc = hw_ip_info(hdev, args); > - break; > - > case HL_INFO_HW_EVENTS: > rc = hw_events_info(hdev, args); > break; > -- > 2.17.1 > This patch is: Reviewed-by: Oded Gabbay

[PATCH] habanalabs: use correct variable to show fd open counter

2019-07-08 Thread Oded Gabbay
descriptors which the driver already maintains. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/habanalabs/sysfs.c b/drivers/misc/habanalabs/sysfs.c index 25eb46d29d88..881be19b5fad 100644 --- a/drivers

Re: [PATCH] habanalabs: use correct variable to show fd open counter

2019-07-08 Thread Oded Gabbay
On Mon, Jul 8, 2019 at 2:21 PM Greg KH wrote: > > On Mon, Jul 08, 2019 at 01:43:55PM +0300, Oded Gabbay wrote: > > The current code checks if the user context pointer is NULL or not to > > display the number of open file descriptors of a device. However, that >

Re: [PATCH] habanalabs: use correct variable to show fd open counter

2019-07-08 Thread Oded Gabbay
On Mon, Jul 8, 2019 at 2:30 PM Oded Gabbay wrote: > > On Mon, Jul 8, 2019 at 2:21 PM Greg KH wrote: > > > > On Mon, Jul 08, 2019 at 01:43:55PM +0300, Oded Gabbay wrote: > > > The current code checks if the user context pointer is NULL or not to > > > display

Re: [PATCH] habanalabs: use correct variable to show fd open counter

2019-07-08 Thread Oded Gabbay
On Mon, Jul 8, 2019 at 2:43 PM Greg KH wrote: > > On Mon, Jul 08, 2019 at 02:30:13PM +0300, Oded Gabbay wrote: > > On Mon, Jul 8, 2019 at 2:21 PM Greg KH wrote: > > > > > > On Mon, Jul 08, 2019 at 01:43:55PM +0300, Oded Gabbay wrote: > > > > The curre

[PATCH] habanalabs: remove write_open_cnt property

2019-07-08 Thread Oded Gabbay
This property has attempted to show the number of open file descriptors on the device. This was a stupid and futile attempt so remove this property completely. Signed-off-by: Oded Gabbay --- Documentation/ABI/testing/sysfs-driver-habanalabs | 9 + drivers/misc/habanalabs/sysfs.c

Re: [PATCH] habanalabs: use correct variable to show fd open counter

2019-07-08 Thread Oded Gabbay
On Mon, Jul 8, 2019 at 3:20 PM Greg KH wrote: > > On Mon, Jul 08, 2019 at 02:51:33PM +0300, Oded Gabbay wrote: > > On Mon, Jul 8, 2019 at 2:43 PM Greg KH wrote: > > > > > > On Mon, Jul 08, 2019 at 02:30:13PM +0300, Oded Gabbay wrote: > > > > On Mon, Jul

Re: [PATCH] habanalabs: use %pad for printing a dma_addr_t

2019-07-09 Thread Oded Gabbay
u_accessible_dma_pool = gen_pool_create(ilog2(32), -1); > if (!hdev->cpu_accessible_dma_pool) { > -- > 2.20.0 > This patch is: Reviewed-by: Oded Gabbay Thanks! applied to -next

Re: [PATCH] habanalabs: use %pad for printing a dma_addr_t

2019-07-09 Thread Oded Gabbay
On Tue, Jul 9, 2019 at 9:07 AM Oded Gabbay wrote: > > On Mon, Jul 8, 2019 at 3:39 PM Arnd Bergmann wrote: > > > > dma_addr_t might be different sizes depending on the configuration, > > so we cannot print it as %llx: > > > > drivers/misc/habanalabs/go

Re: [git pull v2] habanalabs fixes for 5.2-rc2/3

2019-05-31 Thread Oded Gabbay
On Fri, May 24, 2019 at 10:49 PM Oded Gabbay wrote: > > Hi Greg, > > This is the pull request containing fixes for 5.2-rc2/3. It is now > correctly rebased on your char-misc-linux branch. > > It supersedes the pull request from 12/5, so you can discard that pull > requ

Re: [PATCH 3/3] habanalabs: restore unsecured registers default values

2019-05-31 Thread Oded Gabbay
(dma_id - 1) * 4; > + WREG32(mmDMA_CH_0_WR_COMP_ADDR_LO + channel_off * dma_id, > + lower_32_bits(sob_addr)); > + } > + > WREG32(mmTPC_PLL_CLK_RLX_0, 0x200020); > + > goya_mmu_prepare(hdev, asid); > > goya_clear_sm_regs(hdev); > -- > 2.17.1 > The patch-set is: Reviewed-by: Oded Gabbay

Re: [PATCH v2] habanalabs: Use dev_get_drvdata

2019-07-23 Thread Oded Gabbay
ci_dev *pdev = to_pci_dev(dev); > - struct hl_device *hdev = pci_get_drvdata(pdev); > + struct hl_device *hdev = dev_get_drvdata(dev); > > pr_debug("Going to resume PCI device\n"); > > -- > 2.20.1 > This patch is: Reviewed-by: Oded Gabbay And pushed to -next Thanks, Oded

[PATCH 1/2] habanalabs: fix F/W download in BE architecture

2019-07-23 Thread Oded Gabbay
to PCIe adapters. That function also makes sure the data is copied "as-is", without byte-swapping. This patch use that function to copy the F/W to the GOYA ASIC instead of writeX macros. Signed-off-by: Ben Segal Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/

[PATCH 2/2] habanalabs: fix host memory polling in BE architecture

2019-07-23 Thread Oded Gabbay
it to the required value that the caller has given to the macro. Signed-off-by: Ben Segal Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/command_submission.c | 2 +- drivers/misc/habanalabs/firmware_if.c| 3 ++- drivers/misc/habanalabs/goya/goya.c

[PATCH] habanalabs: count dropped CS because max CS in-flight

2020-09-04 Thread Oded Gabbay
There is a case where the user reaches the maximum number of CS in-flight. In that case, the driver rejects the new CS of the user with EAGAIN. Count that event so the user can query the driver later to see if it happened. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common

[PATCH 2/6] habanalabs: remove unused ASIC function pointer

2020-09-04 Thread Oded Gabbay
Old function pointer that was left when the call to this function pointer was removed. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/habanalabs.h | 5 - drivers/misc/habanalabs/gaudi/gaudi.c | 1 - drivers/misc/habanalabs/goya/goya.c | 1 - 3 files changed, 7

[PATCH 3/6] habanalabs: remove unused define

2020-09-04 Thread Oded Gabbay
Cleanup the code. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/gaudi/gaudiP.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/misc/habanalabs/gaudi/gaudiP.h b/drivers/misc/habanalabs/gaudi/gaudiP.h index b86eb98b145c..dd222bc128f9 100644 --- a/drivers/misc/habanalabs

[PATCH 4/6] habanalabs: Fix alignment issue in cpucp_info structure

2020-09-04 Thread Oded Gabbay
-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/include/common/cpucp_if.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/habanalabs/include/common/cpucp_if.h b/drivers/misc/habanalabs/include/common/cpucp_if.h index 1e8480e978e2

[PATCH 5/6] habanalabs: increase PQ COMP_OFFSET by one nibble

2020-09-04 Thread Oded Gabbay
For future ASICs, we increase this field by one nibble. This field was not used by the current ASICs so this change doesn't break anything. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/include/common/qman_if.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers

[PATCH 1/6] habanalabs: rename ArmCP to CPU-CP

2020-09-04 Thread Oded Gabbay
There were a couple of comments where the name ArmCP was still used. Rename it to CPU-CP. In addition, rename ArmCP or ARM in log messages to "device CPU". Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/firmware_if.c | 17 --- drivers/misc/habanal

[PATCH 6/6] habanalabs: check flag before reset because of f/w event

2020-09-04 Thread Oded Gabbay
For consistency with GAUDI code, add check of the relevant flag in the device structure before resetting the GOYA device in case of firmware event. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers

[PATCH 2/2] habanalabs: fix report of RAZWI initiator coordinates

2020-08-29 Thread Oded Gabbay
From: Ofir Bitton All initiator coordinates received upon an 'MMU page fault RAZWI event' should be the routers coordinates, the only exception is the DMA initiators for which the reported coordinates correspond to their actual location. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay

[PATCH 1/2] habanalabs: prevent user buff overflow

2020-08-29 Thread Oded Gabbay
From: Moti Haimovski This commit fixes a potential debugfs issue that may occur when reading the clock gating mask into the user buffer since the user buffer size was not taken into consideration. Signed-off-by: Moti Haimovski Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers

[PATCH 1/2] habanalabs: replace armcp with the generic cpucp

2020-08-29 Thread Oded Gabbay
the armcp entries. Those will be deprecated next year. Add the documentation about it in sysfs documentation. Signed-off-by: Moti Haimovski Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- .../ABI/testing/sysfs-driver-habanalabs | 18 +- drivers/misc/habanalabs/common/debugfs.c

[PATCH 2/2] habanalabs: cast to u64 before shift > 31 bits

2020-08-29 Thread Oded Gabbay
When shifting a boolean variable by more than 31 bits and putting the result into a u64 variable, we need to cast the boolean into unsigned 64 bits to prevent possible overflow. Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs

[PATCH 3/3] habanalabs: make use of dma_mmap_coherent

2020-08-29 Thread Oded Gabbay
-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/command_buffer.c | 9 ++--- drivers/misc/habanalabs/common/habanalabs.h | 2 +- drivers/misc/habanalabs/gaudi/gaudi.c | 7 +++ drivers/misc/habanalabs/goya/goya.c | 7 +++ 4 files changed

[PATCH 1/3] habanalabs: restructure hl_mmap

2020-08-29 Thread Oded Gabbay
Arrange the hl_mmap code to be more structured and expandable for the future. Add better defines that describe our usage of the vm_pgoff. Note that I shamelessly took the code and defines from the amdkfd driver (my previous driver). Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common

[PATCH 2/3] habanalabs: clear vm_pgoff before doing the mmap

2020-08-29 Thread Oded Gabbay
The driver use vm_pgoff to hold the CB idr handle. Before we actually call the mapping function, we need to clear the handle so there won't be any garbage left in vm_pgoff. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/command_buffer.c | 4 1 file changed, 4 insertions

Re: [RFC PATCH] habanalabs: goya: make use of dma_mmap_coherent

2020-08-29 Thread Oded Gabbay
On Tue, Aug 25, 2020 at 4:05 AM Hillf Danton wrote: > > > On Mon, Aug 24, 2020 at 09:29 Hillf Danton wrote: > > On Sun, 23 Aug 2020 14:01:23 +0300 Oded Gabbay wrote: > > > On Sun, Aug 23, 2020 at 11:19 AM Hillf Danton wrote: > > > > On Sun, 23 Aug 2

[git pull] habanalabs fixes pull request for kernel 5.9-rc4

2020-08-31 Thread Oded Gabbay
Hello Greg, This is the pull request for habanalabs driver fixes for 5.9-rc4. Two small fixes, details are in the tag. Thanks, Oded The following changes since commit f75aef392f869018f78cfedf3c320a6b3fcfda6b: Linux 5.9-rc3 (2020-08-30 16:01:54 -0700) are available in the Git repository at:

[PATCH 6/9] habanalabs: remove redundant assignment to variable

2020-08-15 Thread Oded Gabbay
new_dma_pkt->ctl is assigned a value and then is reassigned a new value without the first value ever being used. Reported-by: kernel test robot Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/gaudi/gaudi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/misc/habanal

[PATCH 5/9] habanalabs: use FIELD_PREP() instead of <

2020-08-15 Thread Oded Gabbay
Use the standard FIELD_PREP() macro instead of << operator to perform bitmask operations. This ensures type check safety and eliminate compiler warnings. Reported-by: kernel test robot Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/hw_queue.c | 9 +- driver

[PATCH 4/9] habanalabs: use standard BIT() and GENMASK()

2020-08-15 Thread Oded Gabbay
Use the standard macros to define bitmasks. Reported-by: kernel test robot Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/gaudi/gaudiP.h | 44 +- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/misc/habanalabs/gaudi/gaudiP.h b/drivers

[PATCH 2/9] habanalabs: cast int to u32 before printing it with %u

2020-08-15 Thread Oded Gabbay
%u is used for unsigned so we need to cast the int variable to u32 to avoid compiler warning. Reported-by: kernel test robot Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/habanalabs/common

[PATCH 3/9] habanalabs: eliminate redundant else condition

2020-08-15 Thread Oded Gabbay
If both parts of if-else are goto statements, we can remove the else and put the else goto statement after the if statement. Reported-by: kernel test robot Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/command_submission.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions

[PATCH 1/9] habanalabs: change CB's ID to be 64 bits

2020-08-15 Thread Oded Gabbay
Although the possible values for CB's ID are only 32 bits, there are a few places in the code where this field is shifted and passed into a function which expects 64 bits. Reported-by: kernel test robot Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/command_buffer.c | 2

[PATCH 9/9] habanalabs: extend busy engines mask to 64 bits

2020-08-15 Thread Oded Gabbay
From: farah kassabri change busy engines bitmask to 64 bits in order to represent more engines, needed for future ASIC support. Signed-off-by: farah kassabri Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/habanalabs.h | 2 +- drivers/misc

[PATCH 7/9] habanalabs: check TPC vector pipe is empty

2020-08-15 Thread Oded Gabbay
The driver waits for the TPC vector pipe to be empty before checking if the TPC kernel has finished executing, but the code doesn't validate that the pipe was indeed empty, it just wait for it without checking the return value. Reported-by: kernel test robot Signed-off-by: Oded Gabbay

Re: [PATCH v3 00/14] Adding GAUDI NIC code to habanalabs driver

2020-09-18 Thread Oded Gabbay
On Fri, Sep 18, 2020 at 2:52 PM Leon Romanovsky wrote: > > On Fri, Sep 18, 2020 at 02:36:10PM +0300, Gal Pressman wrote: > > On 17/09/2020 20:18, Jason Gunthorpe wrote: > > > On Tue, Sep 15, 2020 at 11:46:58PM +0300, Oded Gabbay wrote: > > >> infrastructure f

Re: [PATCH v3 00/14] Adding GAUDI NIC code to habanalabs driver

2020-09-18 Thread Oded Gabbay
On Fri, Sep 18, 2020 at 2:56 PM Jason Gunthorpe wrote: > > On Fri, Sep 18, 2020 at 02:36:10PM +0300, Gal Pressman wrote: > > On 17/09/2020 20:18, Jason Gunthorpe wrote: > > > On Tue, Sep 15, 2020 at 11:46:58PM +0300, Oded Gabbay wrote: > > >> infrastructure f

Re: [PATCH v3 00/14] Adding GAUDI NIC code to habanalabs driver

2020-09-18 Thread Oded Gabbay
On Fri, Sep 18, 2020 at 3:00 PM Jason Gunthorpe wrote: > > > On Tue, Sep 15, 2020 at 08:10:08PM +0300, Oded Gabbay wrote: > > Hello, > > > > This is the second version of the patch-set to upstream the GAUDI NIC code > > into the habanalabs driver. >

Re: [PATCH v3 00/14] Adding GAUDI NIC code to habanalabs driver

2020-09-18 Thread Oded Gabbay
On Fri, Sep 18, 2020 at 3:03 PM Leon Romanovsky wrote: > > On Fri, Sep 18, 2020 at 02:56:09PM +0300, Oded Gabbay wrote: > > On Fri, Sep 18, 2020 at 2:52 PM Leon Romanovsky wrote: > > > > > > On Fri, Sep 18, 2020 at 02:36:10PM +0300, Gal Pressman wrote: >

Re: [PATCH v3 00/14] Adding GAUDI NIC code to habanalabs driver

2020-09-18 Thread Oded Gabbay
On Fri, Sep 18, 2020 at 2:36 PM Gal Pressman wrote: > > On 17/09/2020 20:18, Jason Gunthorpe wrote: > > On Tue, Sep 15, 2020 at 11:46:58PM +0300, Oded Gabbay wrote: > >> infrastructure for communication between multiple accelerators. Same > >> as Nvidia uses NV

Re: [PATCH v3 00/14] Adding GAUDI NIC code to habanalabs driver

2020-09-18 Thread Oded Gabbay
On Fri, Sep 18, 2020 at 3:19 PM Leon Romanovsky wrote: > > On Fri, Sep 18, 2020 at 03:07:19PM +0300, Oded Gabbay wrote: > > On Fri, Sep 18, 2020 at 3:03 PM Leon Romanovsky wrote: > > > > > > On Fri, Sep 18, 2020 at 02:56:09PM +0300, Oded Gabbay wrote: > > >

Re: [PATCH v3 00/14] Adding GAUDI NIC code to habanalabs driver

2020-09-18 Thread Oded Gabbay
On Fri, Sep 18, 2020 at 3:16 PM Jason Gunthorpe wrote: > > On Fri, Sep 18, 2020 at 02:59:28PM +0300, Oded Gabbay wrote: > > On Fri, Sep 18, 2020 at 2:56 PM Jason Gunthorpe wrote: > > > > > > On Fri, Sep 18, 2020 at 02:36:10PM +0300, Gal Pressman wrote: >

Re: [PATCH v3 00/14] Adding GAUDI NIC code to habanalabs driver

2020-09-18 Thread Oded Gabbay
On Fri, Sep 18, 2020 at 3:50 PM Jason Gunthorpe wrote: > > On Fri, Sep 18, 2020 at 03:34:54PM +0300, Oded Gabbay wrote: > > > > Another example is that the submission of WQ is done through our QMAN > > > > mechanism and is NOT mapped to userspace (due to the rest

Re: [PATCH v3 00/14] Adding GAUDI NIC code to habanalabs driver

2020-09-18 Thread Oded Gabbay
On Fri, Sep 18, 2020 at 4:26 PM Jason Gunthorpe wrote: > > On Fri, Sep 18, 2020 at 04:02:24PM +0300, Oded Gabbay wrote: > > > The problem with MR is that the API doesn't let us return a new VA. It > > forces us to use the original VA that the Host OS allocated. > >

Re: [PATCH v3 00/14] Adding GAUDI NIC code to habanalabs driver

2020-09-18 Thread Oded Gabbay
On Fri, Sep 18, 2020 at 4:59 PM Jason Gunthorpe wrote: > > On Fri, Sep 18, 2020 at 04:49:25PM +0300, Oded Gabbay wrote: > > On Fri, Sep 18, 2020 at 4:26 PM Jason Gunthorpe wrote: > > > > > > On Fri, Sep 18, 2020 at 04:02:24PM +0300, Oded Gabbay wrote: >

Re: [PATCH v3 00/14] Adding GAUDI NIC code to habanalabs driver

2020-09-18 Thread Oded Gabbay
On Fri, Sep 18, 2020 at 5:19 PM Jason Gunthorpe wrote: > > On Fri, Sep 18, 2020 at 05:12:04PM +0300, Oded Gabbay wrote: > > On Fri, Sep 18, 2020 at 4:59 PM Jason Gunthorpe wrote: > > > > > > On Fri, Sep 18, 2020 at 04:49:25PM +0300, Oded Gabbay wrote: > >

Re: [PATCH v3 00/14] Adding GAUDI NIC code to habanalabs driver

2020-09-18 Thread Oded Gabbay
On Fri, Sep 18, 2020 at 6:07 PM Jason Gunthorpe wrote: > > On Fri, Sep 18, 2020 at 05:45:21PM +0300, Oded Gabbay wrote: > > > Any access by the device's engines to the host memory is done via our > > device's MMU. Our MMU supports multiple ASIDs - Address Space IDs.

[PATCH 3/4] habanalabs: add debug messages for opening/closing context

2020-09-24 Thread Oded Gabbay
During debugging of error we sometimes need to know whether the error happened when a user context was open. Add debug prints when opening and closing user contexts. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/context.c | 5 + 1 file changed, 5 insertions(+) diff --git

[PATCH 4/4] habanalabs: add notice of device not idle

2020-09-24 Thread Oded Gabbay
The device should be idle after a context is closed. If not, print a notice. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/context.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/misc/habanalabs/common/context.c b/drivers/misc/habanalabs/common/context.c

[PATCH 2/4] habanalabs: release kernel context after hw_fini

2020-09-24 Thread Oded Gabbay
safely close the kernel context. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/device.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/misc/habanalabs/common/device.c b/drivers/misc/habanalabs/common/device.c index 196e35d71118

[PATCH 1/4] habanalabs: correct an error message

2020-09-24 Thread Oded Gabbay
We don't try to allocate huge pages here so remove the huge word. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/habanalabs/common/memory.c b/drivers/misc/habanalabs/common/memory.c

[PATCH] habanalabs/gaudi: configure QMAN LDMA registers properly

2020-09-24 Thread Oded Gabbay
From: Ofir Bitton LDMA registers are configured with a fixed value. We add new define set which gives the configuration a proper meaning. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/gaudi/gaudi.c | 62

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

2020-09-25 Thread Oded Gabbay
messages to help debug issues that happen during context open and close. Oded Gabbay (4): habanalabs: correct an error message habanalabs: release kernel context after hw_fini habanalabs: add debug messages for opening

[PATCH] habanalabs/gaudi: use correct define for qman init

2020-09-25 Thread Oded Gabbay
There was a copy-paste error, and the wrong define was used for initializing the QMAN. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/gaudi/gaudi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/habanalabs/gaudi/gaudi.c b/drivers/misc/habanalabs/gaudi

[PATCH] habanalabs/gaudi: remove unreachable code

2020-11-04 Thread Oded Gabbay
From: Ofir Bitton Remove unreachable code in gaudi collective flow. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/gaudi/gaudi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/misc/habanalabs/gaudi

[PATCH] habanalabs: make sure cs type is valid in cs_ioctl_signal_wait

2020-11-04 Thread Oded Gabbay
Although we get a valid cs type from the callee, in case new values will be added in the future, it is best to check the expected values in that function. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/command_submission.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion

[PATCH 2/2] habanalabs/gaudi: add support for FW security

2020-11-04 Thread Oded Gabbay
From: Ofir Bitton Skip relevant HW configurations once FW security is enabled because these configurations are being performed by FW. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/gaudi/gaudi.c | 123

[PATCH] habanalabs/gaudi: monitor device memory usage

2020-11-04 Thread Oded Gabbay
track of the HBM usage. This can be done as long as the user accurately reports the allocations and releases of HBM memory, through the existing MEMORY IOCTL uapi. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/memory.c | 56 ++--- 1 file changed, 50 insertions

[PATCH] habanalabs: initialize variable before use

2020-11-04 Thread Oded Gabbay
GCC 7.3.1 20180303 (Red Hat 7.3.1-5) complains that collective_engine_id might be used uninitialized. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/command_submission.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/habanalabs/common

[PATCH] habanalabs: advanced FW loading

2020-11-04 Thread Oded Gabbay
From: Ofir Bitton Today driver is able to load a whole FW binary into a specific location on ASIC. We add support for loading sections from the same FW binary into different loactions. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs

[PATCH] habanalabs: fix cs counters structure

2020-11-04 Thread Oded Gabbay
-by: Oded Gabbay Signed-off-by: Oded Gabbay --- .../habanalabs/common/command_submission.c| 18 +++-- drivers/misc/habanalabs/common/habanalabs.h | 73 ++- .../misc/habanalabs/common/habanalabs_ioctl.c | 35 ++--- drivers/misc/habanalabs/common/hw_queue.c | 5

[PATCH 1/2] habanalabs: fetch security indication from FW

2020-11-04 Thread Oded Gabbay
From: Ofir Bitton Add support for fetching security indication from FW. This indication is needed in order to skip unnecessary initializations done by FW. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/firmware_if.c | 60

[PATCH] habanalabs/gaudi: scrub all memory upon closing FD

2020-11-04 Thread Oded Gabbay
in Goya. To allow users that want to debug their applications, we add a kernel module parameter to load the driver with this feature disabled. Signed-off-by: farah kassabri Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/context.c | 3 + drivers/misc

[PATCH] habanalabs: refactor MMU to support dual residency MMU

2020-11-04 Thread Oded Gabbay
-off-by: Moti Haimovski Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/common/habanalabs.h | 57 ++- drivers/misc/habanalabs/common/mmu.c| 105 ++-- drivers/misc/habanalabs/common/mmu_v1.c | 28 +++--- 3 files changed, 143

[PATCH] habanalabs: Small refactoring of CS IOCTL handling

2020-11-04 Thread Oded Gabbay
From: Tomer Tayar Refactor the CS IOCTL handling by gathering common code into sub-functions, in order to ease future additions of new CS types. Signed-off-by: Tomer Tayar Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- .../habanalabs/common/command_submission.c| 419

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