[PATCH v4 03/15] habanalabs: add basic Goya support

2019-02-11 Thread Oded Gabbay
This patch adds a basic support for the Goya device. The code initializes the device's PCI controller and PCI bars. It also initializes various S/W structures and adds some basic helper functions. Reviewed-by: Mike Rapoport Signed-off-by: Oded Gabbay --- Changes in v4: - Remove empty line

[PATCH v4 08/15] habanalabs: add event queue and interrupts

2019-02-11 Thread Oded Gabbay
entry to the EQ, the control CPU will trigger its dedicated MSI-X entry to signal the driver that there is a new entry in the EQ. The driver will then read the entry and act accordingly. Reviewed-by: Mike Rapoport Signed-off-by: Oded Gabbay --- Changes in v4: - Do not assume state of device CPU

[PATCH v4 09/15] habanalabs: add sysfs and hwmon support

2019-02-11 Thread Oded Gabbay
(operational, malfunction, in_reset) - How many processes are open on the device's file Reviewed-by: Mike Rapoport Signed-off-by: Oded Gabbay --- Changes in v4: - Use sprintf instead of snprintf in sysfs - Use device attribute groups to manage sysfs attributes .../ABI/testing/sysfs-driver

[PATCH v4 11/15] habanalabs: add command submission module

2019-02-11 Thread Oded Gabbay
then query the driver regarding the status of the CS, using that sequence number. In case the CS doesn't finish before the timeout expires, the driver will perform a soft-reset of the device. Reviewed-by: Mike Rapoport Signed-off-by: Oded Gabbay --- Changes in v4: - Remove empty line at end

[PATCH v4 13/15] habanalabs: implement INFO IOCTL

2019-02-11 Thread Oded Gabbay
-by: Mike Rapoport Signed-off-by: Oded Gabbay --- Changes in v4: - Use -ENOTTY to signal bad ioctl parameter in info ioctl drivers/misc/habanalabs/goya/goya.c| 6 + drivers/misc/habanalabs/habanalabs.h | 2 + drivers/misc/habanalabs/habanalabs_ioctl.c | 126

[PATCH v4 10/15] habanalabs: add device reset support

2019-02-11 Thread Oded Gabbay
will restore the max power attribute and in case of manual power management, the frequencies that were set. This patch also adds two entries to the sysfs, which allows the root user to initiate a soft or hard reset. Reviewed-by: Mike Rapoport Signed-off-by: Oded Gabbay --- Changes in v4: - Use

[PATCH v4 14/15] habanalabs: add debugfs support

2019-02-11 Thread Oded Gabbay
to perform reads and writes through Goya's PCI bars. Reviewed-by: Mike Rapoport Signed-off-by: Oded Gabbay --- Changes in v4: - debugfs init shouldn't check for errors - Remove empty line at end of debugfs-driver-habanalabs .../ABI/testing/debugfs-driver-habanalabs | 126 ++ drivers/misc

[PATCH v4 12/15] habanalabs: add virtual memory and MMU modules

2019-02-11 Thread Oded Gabbay
and freeing memory on the DDR upon user request. It also provides an interface to map and unmap DDR and Host memory to the device address space. Signed-off-by: Omer Shpigelman Signed-off-by: Oded Gabbay --- Changes in v4: - Return number of ptes in dec pte - Rename dec/inc_num_of_ptes to put/get_pte

[PATCH v4 15/15] Update MAINTAINERS and CREDITS with habanalabs info

2019-02-11 Thread Oded Gabbay
The habanalabs driver was written from scratch from the very first days of Habana and is maintained by Oded Gabbay. Signed-off-by: Oded Gabbay --- CREDITS | 2 +- MAINTAINERS | 9 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CREDITS b/CREDITS index e818eb6a3e71

[PATCH v4 07/15] habanalabs: add h/w queues module

2019-02-11 Thread Oded Gabbay
that was given to it. The internal QMAN doesn't do that. Reviewed-by: Mike Rapoport Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/Makefile |2 +- drivers/misc/habanalabs/device.c | 75 +- drivers/misc/habanalabs/goya/goya.c | 1525

[PATCH v4 05/15] habanalabs: add command buffer module

2019-02-11 Thread Oded Gabbay
is empty, the driver will go to the slow-path of allocating a new CB, i.e. calling dma_alloc_coherent. Reviewed-by: Mike Rapoport Signed-off-by: Oded Gabbay --- Changes in v4: - Use -ENOTTY to signal bad ioctl parameter - Call put_cb() after updating its values (to prevent dereference after free

Re: [PATCH 01/15] habanalabs: add skeleton driver

2019-01-29 Thread Oded Gabbay
On Sun, Jan 27, 2019 at 10:32 AM gregkh wrote: > > On Sat, Jan 26, 2019 at 11:48:02PM +0200, Oded Gabbay wrote: > > On Sat, Jan 26, 2019 at 11:14 PM Arnd Bergmann wrote: > > > > > > On Sat, Jan 26, 2019 at 5:25 PM Oded Gabbay wrote: > > > > > > &

Re: [PATCH 12/15] habanalabs: add virtual memory and MMU modules

2019-01-30 Thread Oded Gabbay
On Sun, Jan 27, 2019 at 6:13 PM Mike Rapoport wrote: > > On Wed, Jan 23, 2019 at 02:00:54AM +0200, Oded Gabbay wrote: > > From: Omer Shpigelman > > > > This patch adds the Virtual Memory and MMU modules. > > > > Goya has an internal MMU which provides proce

[PATCH v2 00/15] Habana Labs kernel driver

2019-01-30 Thread Oded Gabbay
instead of looking at the emails, you can grab a copy from our company's page in GitHub: https://github.com/HabanaAI/linux/releases/tag/hl_patchset_v2_20190130 Oded Gabbay (14): habanalabs: add skeleton driver habanalabs: add Goya registers header files habanalabs: add basic Goya support

[PATCH v2 15/15] Update MAINTAINERS and CREDITS with habanalabs info

2019-01-30 Thread Oded Gabbay
The habanalabs driver was written from scratch from the very first days of Habana and is maintained by Oded Gabbay. Signed-off-by: Oded Gabbay --- CREDITS | 2 +- MAINTAINERS | 9 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CREDITS b/CREDITS index e818eb6a3e71

[PATCH v2 14/15] habanalabs: add debugfs support

2019-01-30 Thread Oded Gabbay
to perform reads and writes through Goya's PCI bars. Signed-off-by: Oded Gabbay --- Changes in v2: - Replace /** with /* in all functions - Use generic function for testing disabled or in reset - Switch MMU physical pages list to array as list is not needed - Remove Authors: from comment

[PATCH v2 11/15] habanalabs: add command submission module

2019-01-30 Thread Oded Gabbay
then query the driver regarding the status of the CS, using that sequence number. In case the CS doesn't finish before the timeout expires, the driver will perform a soft-reset of the device. Signed-off-by: Oded Gabbay --- Changes in v2: - Replace /** with /* in all functions - Use generic

[PATCH v2 01/15] habanalabs: add skeleton driver

2019-01-30 Thread Oded Gabbay
This patch adds the habanalabs skeleton driver. The driver does nothing at this stage except very basic operations. It contains the minimal code to insmod and rmmod the driver and to create a /dev/hlX file per PCI device. Signed-off-by: Oded Gabbay --- Changes in v2: - Add newline in Makefile

[PATCH v2 08/15] habanalabs: add event queue and interrupts

2019-01-30 Thread Oded Gabbay
entry to the EQ, the control CPU will trigger its dedicated MSI-X entry to signal the driver that there is a new entry in the EQ. The driver will then read the entry and act accordingly. Signed-off-by: Oded Gabbay --- Changes in v2: - Replace /** with /* in all functions - Remove unused local

[PATCH v2 12/15] habanalabs: add virtual memory and MMU modules

2019-01-30 Thread Oded Gabbay
and freeing memory on the DDR upon user request. It also provides an interface to map and unmap DDR and Host memory to the device address space. Signed-off-by: Omer Shpigelman Signed-off-by: Oded Gabbay --- Changes in v2: - Replace /** with /* in all functions - Rename PTE_SIZE to HL_PTE_SIZE - Use

[PATCH v2 07/15] habanalabs: add h/w queues module

2019-01-30 Thread Oded Gabbay
that was given to it. The internal QMAN doesn't do that. Signed-off-by: Oded Gabbay --- Changes in v2: - Add goya_async_events.h in this patch - Add return of -ENOMEM in error path (was originally missing) - Replace /** with /* in all functions - Add comment about stopping QMANs - Better error

[PATCH v2 13/15] habanalabs: implement INFO IOCTL

2019-01-30 Thread Oded Gabbay
-by: Oded Gabbay --- Changes in v2: - Use generic function for testing disabled or in reset - Remove ioctl specific code for checking for hard reset pending drivers/misc/habanalabs/goya/goya.c| 6 + drivers/misc/habanalabs/habanalabs.h | 2 + drivers/misc/habanalabs

[PATCH v2 04/15] habanalabs: add context and ASID modules

2019-01-30 Thread Oded Gabbay
context. A "primary context" is created automatically when the user opens the device's file. Signed-off-by: Oded Gabbay --- Changes in v2: - Use fd_open_cnt to identify whether we have an open process on the device - Replace /** with /* in all functions - Rename device_open mutex to fd

[PATCH v2 05/15] habanalabs: add command buffer module

2019-01-30 Thread Oded Gabbay
is empty, the driver will go to the slow-path of allocating a new CB, i.e. calling dma_alloc_coherent. Signed-off-by: Oded Gabbay --- Changes in v2: - Add comment in hl_cb_alloc() about use of GFP_ATOMIC - Use dev_dbg when printing about empty cb pool - Simplify return of error code

[PATCH v2 03/15] habanalabs: add basic Goya support

2019-01-30 Thread Oded Gabbay
This patch adds a basic support for the Goya device. The code initializes the device's PCI controller and PCI bars. It also initializes various S/W structures and adds some basic helper functions. Signed-off-by: Oded Gabbay --- Changes in v2: - Replace /** with /* in all functions - Add

[PATCH v2 10/15] habanalabs: add device reset support

2019-01-30 Thread Oded Gabbay
will restore the max power attribute and in case of manual power management, the frequencies that were set. This patch also adds two entries to the sysfs, which allows the root user to initiate a soft or hard reset. Signed-off-by: Oded Gabbay --- Changes in v2: - Add soft reset code to hw_fini

[PATCH v2 09/15] habanalabs: add sysfs and hwmon support

2019-01-30 Thread Oded Gabbay
(operational, malfunction, in_reset) - How many processes are open on the device's file Signed-off-by: Oded Gabbay --- Changes in v2: - Replace /** with /* in all functions - Remove Authors: from comment at start of file - Remove bitfields in interface to F/W and use __le16/32/64 - Remove

Re: [PATCH 01/15] habanalabs: add skeleton driver

2019-01-25 Thread Oded Gabbay
On Wed, Jan 23, 2019 at 2:49 AM Joe Perches wrote: > > On Wed, 2019-01-23 at 02:00 +0200, Oded Gabbay wrote: > > This patch adds the habanalabs skeleton driver. The driver does nothing at > > this stage except very basic operations. It contains the minimal code to > > ins

Re: [PATCH 01/15] habanalabs: add skeleton driver

2019-01-25 Thread Oded Gabbay
On Wed, Jan 23, 2019 at 2:28 PM Mike Rapoport wrote: > > On Wed, Jan 23, 2019 at 02:00:43AM +0200, Oded Gabbay wrote: > > This patch adds the habanalabs skeleton driver. The driver does nothing at > > this stage except very basic operations. It contains the minimal code to &g

Re: [PATCH 01/15] habanalabs: add skeleton driver

2019-01-25 Thread Oded Gabbay
On Wed, Jan 23, 2019 at 2:55 PM Mike Rapoport wrote: > > On Wed, Jan 23, 2019 at 01:40:04PM +0100, Greg KH wrote: > > On Wed, Jan 23, 2019 at 02:28:05PM +0200, Mike Rapoport wrote: > > > On Wed, Jan 23, 2019 at 02:00:43AM +0200, Oded Gabbay wrote: > > > > +

Re: [PATCH 03/15] habanalabs: add basic Goya support

2019-01-25 Thread Oded Gabbay
On Wed, Jan 23, 2019 at 2:28 PM Mike Rapoport wrote: > > On Wed, Jan 23, 2019 at 02:00:45AM +0200, Oded Gabbay wrote: > > This patch adds a basic support for the Goya device. The code initializes > > the device's PCI controller and PCI bars. It also initializes various S/W >

Re: [PATCH 04/15] habanalabs: add context and ASID modules

2019-01-25 Thread Oded Gabbay
On Wed, Jan 23, 2019 at 2:28 PM Mike Rapoport wrote: > > On Wed, Jan 23, 2019 at 02:00:46AM +0200, Oded Gabbay wrote: > > This patch adds two modules - ASID and context. > > > > Each user process the opens a device's file must have at least one context > >

Re: [PATCH 05/15] habanalabs: add command buffer module

2019-01-25 Thread Oded Gabbay
On Wed, Jan 23, 2019 at 2:28 PM Mike Rapoport wrote: > > On Wed, Jan 23, 2019 at 02:00:47AM +0200, Oded Gabbay wrote: > > This patch adds the CB module, which allows the user to create and > > destroy CBs and to map them to the user's process address-space. > > Can y

Re: [PATCH 01/15] habanalabs: add skeleton driver

2019-01-26 Thread Oded Gabbay
On Sat, Jan 26, 2019 at 6:06 PM Arnd Bergmann wrote: > > On Wed, Jan 23, 2019 at 1:01 AM Oded Gabbay wrote: > > > diff --git a/drivers/misc/habanalabs/include/habanalabs_device_if.h > > b/drivers/misc/habanalabs/include/habanalabs_device_if.h > > new file mode 10

Re: [PATCH 01/15] habanalabs: add skeleton driver

2019-01-26 Thread Oded Gabbay
On Sat, Jan 26, 2019 at 11:14 PM Arnd Bergmann wrote: > > On Sat, Jan 26, 2019 at 5:25 PM Oded Gabbay wrote: > > > > On Sat, Jan 26, 2019 at 6:06 PM Arnd Bergmann wrote: > > > > > > On Wed, Jan 23, 2019 at 1:01 AM Oded Gabbay wrote: > > > > &g

Re: [PATCH v3 12/15] habanalabs: add virtual memory and MMU modules

2019-02-07 Thread Oded Gabbay
On Wed, Feb 6, 2019 at 5:14 PM Mike Rapoport wrote: > > On Mon, Feb 04, 2019 at 10:32:51PM +0200, Oded Gabbay wrote: > > From: Omer Shpigelman > > > > This patch adds the Virtual Memory and MMU modules. > > > > Goya has an internal MMU which provides proce

Re: [PATCH 2/8] drm/amdgpu: fix 32-bit build warning

2018-05-28 Thread Oded Gabbay
R_POLL_CNTL1), >get_queue_mask(adev, pipe_id, queue_id)); > } > -- > 2.9.0 > There is a change scheduled for the next merge window that will cause this file to not build anymore on 32-bit targets (because the amdkfd driver is not supported on 32 bit targets). Never the less I'm taking the patch for good measure. This patch is: Reviewed-by: Oded Gabbay

[PATCH] habanalabs: rename restore to ctx_switch when appropriate

2019-04-25 Thread Oded Gabbay
This patch only does renaming of certain variables and structure members, and their accompanied comments. This is done to better reflect the actions these variables and members represent. There is no functional change in this patch. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs

Re: [PATCH] habanalabs: fix debugfs code

2019-05-06 Thread Oded Gabbay
d values: disable, enable, suspend, resume, > cpu_timeout\n"; > + return simple_read_from_buffer(buf, count, ppos, help, strlen(help)); > } > > static ssize_t hl_device_write(struct file *f, const char __user *buf, > @@ -739,7 +715,7 @@ static ssize_t hl_device_write(struct file *f, const char > __user *buf, > { > struct hl_dbg_device_entry *entry = file_inode(f)->i_private; > struct hl_device *hdev = entry->hdev; > - char data[30]; > + char data[30] = {0}; > > /* don't allow partial writes */ > if (*ppos != 0) > -- > 2.21.0.1020.gf2820cf01a-goog > Thanks! Will be applied to my -next branch This patch is: Reviewed-by: Oded Gabbay

Re: [PATCH] habanalabs: fix debugfs code

2019-05-06 Thread Oded Gabbay
On Mon, May 6, 2019 at 1:15 PM Oded Gabbay wrote: > > On Sat, May 4, 2019 at 4:56 PM Jann Horn wrote: > > > > This fixes multiple things in the habanalabs debugfs code, in particular: > > > > - mmu_write() was unnecessarily verbose, copying around b

[PATCH] habanalabs: remove dead code in habanalabs_drv.c

2019-05-08 Thread Oded Gabbay
This patch removes some dead code that performs checks about variables with hard-coded values. The patch also moves the initialization of those variables to a separate function, that will possibly have different values per ASIC. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs

[PATCH] habanalabs: check to load F/W before boot status

2019-05-08 Thread Oded Gabbay
This patch changes the order of checks when initializing the device CPU. We want first to check if we need to load the F/W, and only if we need to, then we want to check the status of the CPU boot program. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 6 +++--- 1 file

[PATCH 1/3] habanalabs: remove redundant CB size adjustment

2019-05-09 Thread Oded Gabbay
-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c index ccf9d925b6ed..756921c52cf7 100644 --- a/drivers/misc/habanalabs/goya/goya.c +++ b

[PATCH 3/3] habanalabs: change polling functions to macros

2019-05-09 Thread Oded Gabbay
or timeout and for the (cond) in the calling function. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/command_submission.c | 10 +-- drivers/misc/habanalabs/device.c | 89 drivers/misc/habanalabs/firmware_if.c| 29 +++ drivers/misc/habanalabs/g

[PATCH 2/3] habanalabs: remove redundant memory clear

2019-05-09 Thread Oded Gabbay
The driver allocates memory for fence object with GFP_ZERO flag, so there is no need to explicitly write 0 to the allocated object after the allocation. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/misc

[PATCH] habanalabs: pass device pointer to asic-specific function

2019-05-12 Thread Oded Gabbay
This patch adds a new parameter that is passed to the add_end_of_cb_packets() asic-specific function. The parameter is the pointer to the driver's device structure. The function needs this pointer for future ASICs. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 4

[git pull] habanalabs fixes for 5.2-rc1/2

2019-05-12 Thread Oded Gabbay
is upstreamed in kernel 5.2, I think this is justified at this point because we won't be able to change the API later. Jann Horn (1): habanalabs: fix debugfs code Oded Gabbay (1): uapi/habanalabs: add opcode for enable/disable

[git pull] habanalabs next for 5.2

2019-04-19 Thread Oded Gabbay
): habanalabs: remove implicit include from header files Igor Grinberg (1): habanalabs: add new device CPU boot status Oded Gabbay (18): habanalabs: rename goya_non_fatal_events array to all events habanalabs: use EQ MSI/X ID per chip habanalabs: remove unused defines

[PATCH] habanalabs: Cancel pr_fmt() definition dependency on includes order

2019-04-20 Thread Oded Gabbay
to be prone to compilation errors. This patch cancels this dependency by defining the macro only in the few source files that use it. Signed-off-by: Tomer Tayar Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/device.c | 2 ++ drivers/misc/habanalabs/habanalabs.h | 2 -- drivers/misc

[PATCH 2/2] uapi/habanalabs: add missing fields in bmon params

2019-04-21 Thread Oded Gabbay
. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya_coresight.c | 16 include/uapi/misc/habanalabs.h| 9 ++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/misc/habanalabs/goya/goya_coresight.c b/drivers/misc/habanalabs

[PATCH 1/2] habanalabs: re-factor goya_parse_cb_no_ext_queue()

2019-04-21 Thread Oded Gabbay
This patch re-factors goya_parse_cb_no_ext_queue() to make it more readable by inverting the check inside the first if statement so the bulk of the function won't be inside an if statement. The patch also fixes a spelling error in the name of the function. Signed-off-by: Oded Gabbay

[PATCH] habanalabs: use ASIC functions interface for rreg/wreg

2019-04-22 Thread Oded Gabbay
of this macro in the simulator files. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 4 +++- drivers/misc/habanalabs/habanalabs.h | 32 ++-- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers

[PATCH] habanalabs: use ASIC functions interface for rreg/wreg

2019-04-22 Thread Oded Gabbay
of this macro in the simulator files. As a result from this change, more functions in goya.c are shared with the simulator and therefore, should not be defined as static. Signed-off-by: Oded Gabbay --- Changes in v2: - Remove static from some functions as goya.c as they are now called from

[PATCH v2] habanalabs: use ASIC functions interface for rreg/wreg

2019-04-22 Thread Oded Gabbay
of this macro in the simulator files. As a result from this change, more functions in goya.c are shared with the simulator and therefore, should not be defined as static. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 32 +++ drivers/misc/habanalabs/goya

[PATCH] habanalabs: use ASIC functions interface for rreg/wreg

2019-04-22 Thread Oded Gabbay
of this macro in the simulator files. As a result from this change, more functions in goya.c are shared with the simulator and therefore, should not be defined as static. Signed-off-by: Oded Gabbay --- Changes in v2: - Remove static from some functions as goya.c as they are now called from

[PATCH] habanalabs: Avoid using a non-initialized MMU cache mutex

2019-05-13 Thread Oded Gabbay
From: Tomer Tayar The MMU cache mutex is used in the ASIC hw_init() functions, but it is initialized only later in hl_mmu_init(). This patch prevents it by moving the initialization to the device_early_init() function. Signed-off-by: Tomer Tayar Signed-off-by: Oded Gabbay Cc: sta

[PATCH] habanalabs: increase PCI ELBI timeout for Palladium

2019-05-13 Thread Oded Gabbay
From: Omer Shpigelman This patch increases the timeout for PCI ELBI configuration to support low frequency Palladium images. Signed-off-by: Omer Shpigelman Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/habanalabs.h | 2 ++ drivers/misc/habanalabs/pci.c| 10 +- 2

[PATCH 2/2] habanalabs: rename functions to improve code readability

2019-05-01 Thread Oded Gabbay
This patch renames four functions in the ASIC-specific functions section, so it will be easier to differentiate them from the generic kernel functions with the same name. This will help in future code reviews, to make sure we don't use the kernel functions directly. Signed-off-by: Oded Gabbay

[PATCH 1/2] habanalabs: remove call to cs_parser()

2019-05-01 Thread Oded Gabbay
-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 27 +++ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c index 04e4ed8a0be6..9fc8b6e1369d 100644 --- a/drivers/misc

[PATCH] habanalabs: Manipulate DMA addresses in ASIC functions

2019-05-01 Thread Oded Gabbay
Tayar Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/firmware_if.c | 7 +-- drivers/misc/habanalabs/goya/goya.c | 90 +-- drivers/misc/habanalabs/habanalabs.h | 10 ++- drivers/misc/habanalabs/hw_queue.c| 6 +- drivers/misc/habanalabs/memory.c | 4

[PATCH 1/3] habanalabs: remove redundant member from parser struct

2019-05-01 Thread Oded Gabbay
-by: Dalit Ben Zoor Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/command_submission.c | 1 - drivers/misc/habanalabs/goya/goya.c | 2 +- drivers/misc/habanalabs/habanalabs.h | 3 --- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/misc/habanalabs

[PATCH 2/3] habanalabs: remove condition that is always true

2019-05-01 Thread Oded Gabbay
From: Dalit Ben Zoor After removing the parsing of the command submission when doing memset of the device memory, goya_validate_dma_pkt_host is never called by the kernel, so there is no need to check context id. Signed-off-by: Dalit Ben Zoor Signed-off-by: Oded Gabbay --- drivers/misc

[PATCH 3/3] habanalabs: increase timeout if working with simulator

2019-05-01 Thread Oded Gabbay
with simulator. Signed-off-by: Dalit Ben Zoor Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/device.c | 8 +++- drivers/misc/habanalabs/habanalabs.h | 7 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/misc/habanalabs/device.c b/drivers/misc/habanalabs

[PATCH] habanalabs: Update CPU DMA pool label name

2019-05-02 Thread Oded Gabbay
From: Tomer Tayar The CPU accessible DMA pool is general and not used only for PQ. Accordingly, this patch rename the "free_cpu_pq_pool" label with "free_cpu_accessible_dma_pool". Signed-off-by: Tomer Tayar Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goy

[git pull] habanalabs next second pull for 5.2

2019-05-03 Thread Oded Gabbay
that is always true habanalabs: increase timeout if working with simulator Oded Gabbay (6): habanalabs: re-factor goya_parse_cb_no_ext_queue() uapi/habanalabs: add missing fields in bmon params habanalabs: use ASIC functions interface for rreg/wreg habanalabs: rename restore

Re: [git pull] habanalabs next second pull for 5.2

2019-05-03 Thread Oded Gabbay
On Fri, May 3, 2019 at 10:51 AM Greg KH wrote: > > On Fri, May 03, 2019 at 10:36:21AM +0300, Oded Gabbay wrote: > > Hi Greg, > > > > This is the second pull request of habanalabs driver for kernel 5.2. > > > > As the tag describes, all of the changes a

[PATCH 2/2] uapi/habanalabs: add opcode for enable/disable device debug mode

2019-05-04 Thread Oded Gabbay
the driver currently does NOT support multiple users, the implementation of the restrictions is not required at this point. However, the interface definition is needed in order to avoid changing the user API later on. Signed-off-by: Oded Gabbay --- include/uapi/misc/habanalabs.h | 22

[PATCH 1/2] habanalabs: halt debug engines on user process close

2019-05-04 Thread Oded Gabbay
is also opposed to the general rule where nothing runs on the device after the user process closes. The patch stops the debug H/W engines upon process termination and thus makes sure nothing runs on the device after the process goes away. Signed-off-by: Omer Shpigelman Signed-off-by: Oded Gabbay

[PATCH 1/2] habanalabs: return old dram bar address upon change

2019-04-29 Thread Oded Gabbay
needed for easier support in future ASICs. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 60 +--- drivers/misc/habanalabs/habanalabs.h | 5 ++- drivers/misc/habanalabs/pci.c| 5 ++- 3 files changed, 35 insertions(+), 35 deletions(-) diff

[PATCH 2/2] habanalabs: Use single pool for CPU accessible host memory

2019-04-29 Thread Oded Gabbay
have the same MSBs starting at bit 40. This patch modifies the allocation of the PQ and EQ to be also from the dedicated pool, to ensure compliance with the limitation. Signed-off-by: Tomer Tayar Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/habanalabs.h | 12 +++ drivers/misc

[PATCH 1/2] habanalabs: support device memory memset > 4GB

2019-05-19 Thread Oded Gabbay
This patch adds support to the goya memset function to perform memset to device memory with size larger then 4GB. In this case, we need to use multiple LIN_DMA packets because a single packet supports up to 4GB. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 49

[PATCH 2/2] habanalabs: don't limit packet size for device CPU

2019-05-19 Thread Oded Gabbay
of the packets. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/firmware_if.c | 12 drivers/misc/habanalabs/goya/goya.c | 2 +- drivers/misc/habanalabs/habanalabs.h | 12 ++-- 3 files changed, 3 insertions(+), 23 deletions(-) diff --git a/drivers/misc/habanalabs

[PATCH 3/4] habanalabs: complete user context cleanup before hard reset

2019-03-16 Thread Oded Gabbay
during the MMU unmap. Hence adding a wait between killing the user process and the start of the reset flow. Signed-off-by: Omer Shpigelman Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/device.c | 24 +++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git

[PATCH 4/4] habanalabs: fix mapping with page size bigger than 4KB

2019-03-16 Thread Oded Gabbay
. As a result virtual addresses were mapped to wrong physical address. The fix is to apply the break down for the physical addresses as well in order to get correct mappings. Signed-off-by: Omer Shpigelman Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/mmu.c | 6 -- 1 file changed, 4 insertions

[PATCH 1/4] habanalabs: fix MMU number of pages calculation

2019-03-16 Thread Oded Gabbay
From: Omer Shpigelman The requested allocation size is 64bit, hence the number of requested pages and the total requested size should 64bit as well. This patch fixes all places where these are treated as 32bit. Signed-off-by: Omer Shpigelman Signed-off-by: Oded Gabbay --- drivers/misc

[PATCH 2/4] habanalabs: fix bug when mapping very large memory area

2019-03-16 Thread Oded Gabbay
with kmalloc, hence changing to kvmalloc. Signed-off-by: Omer Shpigelman Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/memory.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/misc/habanalabs/memory.c b/drivers/misc/habanalabs/memory.c index 4f8c968e441a

[PATCH 3/3] habanalabs: cast to expected type

2019-03-16 Thread Oded Gabbay
] * Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/habanalabs/goya/goya.c b/drivers/misc/habanalabs/goya/goya.c index 538d8d59d9dc..ea979ebd62fb 100644 --- a/drivers/misc/habanalabs/goya/goya.c +++ b

[PATCH 1/3] habanalabs: perform accounting for active CS

2019-03-16 Thread Oded Gabbay
to perform accounting on their number. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/command_submission.c | 6 ++ drivers/misc/habanalabs/device.c | 1 + drivers/misc/habanalabs/habanalabs.h | 13 - drivers/misc/habanalabs/hw_queue.c | 5

[PATCH 2/3] habanalabs: prevent host crash during suspend/resume

2019-03-16 Thread Oded Gabbay
was loaded. If the controller is not initialized and the device tries to access the device through the PCI bars, the host will crash with PCI completion timeout error. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/device.c| 46 +++-- drivers/misc/habanalabs/goya/goya.c

[PATCH 00/15] habanalabs: various improvements and updates

2019-03-17 Thread Oded Gabbay
): habanalabs: remove implicit include from header files Igor Grinberg (1): habanalabs: add new device CPU boot status Oded Gabbay (7): habanalabs: rename goya_non_fatal_events array to all events habanalabs: use EQ MSI/X ID per chip habanalabs: remove unused defines habanalabs: ratelimit

[PATCH 02/15] habanalabs: rename goya_non_fatal_events array to all events

2019-03-17 Thread Oded Gabbay
The goya_non_fatal_events array actually contains all the possible events the driver can receive from the F/W. Therefore, use a proper name for the array. The patch also adds missing event Ids to the goya_async_event_id enum. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c

[PATCH 08/15] habanalabs: Move PCI code into common file

2019-03-17 Thread Oded Gabbay
From: Tomer Tayar Move duplicated PCI-related code from ASIC-specific files into the common pci.c file. Signed-off-by: Tomer Tayar Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/Makefile | 2 +- drivers/misc/habanalabs/goya/goya.c | 272 + drivers

[PATCH 03/15] habanalabs: remove implicit include from header files

2019-03-17 Thread Oded Gabbay
From: Dotan Barak This will prevent unneeded include of header files, which may increase compilation time. Signed-off-by: Dotan Barak Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya_security.c | 1 + drivers/misc/habanalabs/include/goya/goya.h | 4 2 files changed, 1

[PATCH 05/15] habanalabs: use EQ MSI/X ID per chip

2019-03-17 Thread Oded Gabbay
The Event Queue MSI/X ID is different per ASIC. This patch renames the current define to have the GOYA_ prefix to mark it only for Goya. It also moves it from the common armcp_if.h file to the ASIC specific goya_fw_if.h file. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c

[PATCH 01/15] habanalabs: add new device CPU boot status

2019-03-17 Thread Oded Gabbay
From: Igor Grinberg This patch adds a definition of a new status in the device CPU boot stages and add the handling of the new status. Signed-off-by: Igor Grinberg Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 5 + drivers/misc/habanalabs/include

[PATCH 12/15] habanalabs: Allow accessing DRAM virtual addresses via debugfs

2019-03-17 Thread Oded Gabbay
From: Tomer Tayar The addr/data32 debugfs nodes currently permit the access to only physical addresses of a device. This patch extends it and allows accessing also device's DRAM virtual addresses. Signed-off-by: Tomer Tayar Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/debugfs.c

[PATCH 15/15] habanalabs: never fail hard reset of device

2019-03-17 Thread Oded Gabbay
Hard-reset of our device should never fail, due to dangers of permanent damage to the H/W. This patch removes the last place in the reset path where the driver might exit before doing the actual reset. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/device.c | 19 +-- 1

[PATCH 11/15] habanalabs: Add a printout with the name of a busy engine

2019-03-17 Thread Oded Gabbay
From: Tomer Tayar Print the name of a busy engine when checking if a device is idle. The change is done mainly to help a user to pinpoint problems in his topology's recipe. Signed-off-by: Tomer Tayar Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c| 24

[PATCH 09/15] habanalabs: Remove unneeded function pointers

2019-03-17 Thread Oded Gabbay
From: Tomer Tayar Remove pointers to ASIC-specific functions and instead call the functions explicitly as they are not accessed from outside the ASIC-specific files. Signed-off-by: Tomer Tayar Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 12 +++- drivers/misc

[PATCH 10/15] uapi/habanalabs: add some comments in habanalabs.h

2019-03-17 Thread Oded Gabbay
This patch adds two comments in uapi/habanalabs.h: - From which queue id the internal queues begin - Invalid values that can be returned in the seq field from the CS IOCTL Signed-off-by: Oded Gabbay --- include/uapi/misc/habanalabs.h | 7 +-- 1 file changed, 5 insertions(+), 2 deletions

[PATCH 07/15] habanalabs: ratelimit warnings at start of IOCTLs

2019-03-17 Thread Oded Gabbay
- in all the relevant IOCTLs. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/command_submission.c | 2 +- drivers/misc/habanalabs/habanalabs_ioctl.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/habanalabs/command_submission.c b/drivers/misc/habanalabs

[PATCH 13/15] habanalabs: add MMU shadow mapping

2019-03-17 Thread Oded Gabbay
of map/unmap flow, writings to the device are performed in order to sync the H/W page tables with the shadow ones. Signed-off-by: Omer Shpigelman Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/habanalabs.h | 24 +- .../include/hw_ip/mmu/mmu_general.h | 16 +- drivers

[PATCH 06/15] habanalabs: remove unused defines

2019-03-17 Thread Oded Gabbay
This patch removes some old defines which are not in use anymore. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goyaP.h | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/misc/habanalabs/goya/goyaP.h b/drivers/misc/habanalabs/goya/goyaP.h

[PATCH 04/15] habanalabs: Move device CPU code into common file

2019-03-17 Thread Oded Gabbay
From: Tomer Tayar This patch moves the code that is responsible of the communication vs. the F/W to a dedicated file. This will allow us to share the code between different ASICs. Signed-off-by: Tomer Tayar Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/Makefile | 2

[PATCH 14/15] habanalabs: keep track of the device's dma mask

2019-03-17 Thread Oded Gabbay
will be in a bus address which is lower then 39 bits. Later, Goya will try to increase that mask to 48 bits, but only if setting the mask to 39 bits was successful. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 32 drivers/misc/habanalabs/habanalabs.h | 5

Re: [git pull] habanalabs fixes for 5.1 rc2/3

2019-03-26 Thread Oded Gabbay
On Tue, Mar 26, 2019 at 9:53 AM Greg KH wrote: > > On Thu, Mar 21, 2019 at 05:28:16PM +0200, Oded Gabbay wrote: > > Hi Greg, > > > > A couple of important fixes for habanalabs driver: > > > > - Fix host crash upon resume after suspend > > - Fix MMU relate

[git pull v2] habanalabs fixes for 5.1-rc3

2019-03-26 Thread Oded Gabbay
stuck - Fix race between user context cleanup and hard-reset which results in host crash - Fix sparse warning Oded Gabbay (3): habanalabs: perform accounting for active CS habanalabs: prevent host crash during suspend

[PATCH] habanalabs: do not limit credits of DMA #0

2019-03-26 Thread Oded Gabbay
Because DMA #0 is now used by the user, remove the limitation of credits from this channel. Without this patch, this channel is pretty much unusable due to its very low bandwidth configuration. Signed-off-by: Oded Gabbay --- drivers/misc/habanalabs/goya/goya.c | 9 - 1 file changed, 4

[PATCH] habanalabs: add device status option to INFO IOCTL

2019-03-26 Thread Oded Gabbay
From: Dalit Ben Zoor This patch adds a new opcode to INFO IOCTL that returns the device status. This will allow users to query the device status in order to avoid sending command submissions while device is in reset. Signed-off-by: Dalit Ben Zoor Signed-off-by: Oded Gabbay --- drivers/misc

Re: [PATCH -next] habanalabs: goya: Make some functions static

2019-02-27 Thread Oded Gabbay
On Wed, Feb 27, 2019 at 9:05 AM Yue Haibing wrote: > > From: YueHaibing > > Fixes the following sparse warnings: > > drivers/misc/habanalabs/goya/goya.c:1233:5: warning: symbol > 'goya_init_cpu_queues' was not declared. Should it be static? > drivers/misc/habanalabs/goya/goya.c:2914:5: warning:

<    8   9   10   11   12   13   14   15   16   17   >