platform/kernel/linux-starfive.git
22 months agofirmware: google: Test spinlock on panic path to avoid lockups
Guilherme G. Piccoli [Fri, 9 Sep 2022 20:07:55 +0000 (17:07 -0300)]
firmware: google: Test spinlock on panic path to avoid lockups

Currently the gsmi driver registers a panic notifier as well as
reboot and die notifiers. The callbacks registered are called in
atomic and very limited context - for instance, panic disables
preemption and local IRQs, also all secondary CPUs (not executing
the panic path) are shutdown.

With that said, taking a spinlock in this scenario is a dangerous
invitation for lockup scenarios. So, fix that by checking if the
spinlock is free to acquire in the panic notifier callback - if not,
bail-out and avoid a potential hang.

Fixes: 74c5b31c6618 ("driver: Google EFI SMI")
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: David Gow <davidgow@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Julius Werner <jwerner@chromium.org>
Cc: Petr Mladek <pmladek@suse.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
Link: https://lore.kernel.org/r/20220909200755.189679-1-gpiccoli@igalia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agobus: mvebu-mbus: use DEFINE_SHOW_ATTRIBUTE to simplify mvebu_{sdram/devs}_debug
Liu Shixin [Fri, 16 Sep 2022 14:12:44 +0000 (22:12 +0800)]
bus: mvebu-mbus: use DEFINE_SHOW_ATTRIBUTE to simplify mvebu_{sdram/devs}_debug

Use DEFINE_SHOW_ATTRIBUTE helper macro to simplify the code.

Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Link: https://lore.kernel.org/r/20220916141244.2174005-1-liushixin2@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoMAINTAINERS: Add header files under VMWARE VMCI DRIVER
Vishnu Dasa [Thu, 15 Sep 2022 03:13:21 +0000 (20:13 -0700)]
MAINTAINERS: Add header files under VMWARE VMCI DRIVER

Add include/linux/vmw_vmci* files under VMWARE VMCI DRIVER.

Suggested-by: Stefano Garzarella <sgarzare@redhat.com>
Acked-by: Bryan Tan <bryantan@vmware.com>
Acked-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Vishnu Dasa <vdasa@vmware.com>
Link: https://lore.kernel.org/r/20220915031321.1121-1-vdasa@vmware.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomei: gsc: Remove redundant dev_err call
Shang XiaoJing [Fri, 23 Sep 2022 10:08:41 +0000 (18:08 +0800)]
mei: gsc: Remove redundant dev_err call

devm_ioremap_resource() prints error message in itself. Remove the
dev_err call to avoid redundant error message.

Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
Link: https://lore.kernel.org/r/20220923100841.17719-1-shangxiaojing@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomei: fix repeated words in comments
Jilin Yuan [Sun, 18 Sep 2022 10:04:31 +0000 (18:04 +0800)]
mei: fix repeated words in comments

Delete the redundant word 'from'.

Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Jilin Yuan <yuanjilin@cdjrlc.com>
Link: https://lore.kernel.org/r/20220918100431.28381-1-yuanjilin@cdjrlc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agodrivers/misc/sgi-xp: Remove orphan declarations from drivers/misc/sgi-xp/xp.h
Gaosheng Cui [Tue, 13 Sep 2022 11:03:56 +0000 (19:03 +0800)]
drivers/misc/sgi-xp: Remove orphan declarations from drivers/misc/sgi-xp/xp.h

Remove the following orphan declarations from drivers/misc/sgi-xp/xp.h:
1. xp_nofault_PIOR_target
2. xp_error_PIOR
3. xp_nofault_PIOR

They have been removed since commit 9726bfcdb977 ("misc/sgi-xp:
remove SGI SN2 support"), so remove them.

Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Link: https://lore.kernel.org/r/20220913110356.764711-1-cuigaosheng1@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agonvmem: u-boot-env: fix crc32 casting type
Rafał Miłecki [Fri, 16 Sep 2022 12:21:00 +0000 (13:21 +0100)]
nvmem: u-boot-env: fix crc32 casting type

This fixes:
drivers/nvmem/u-boot-env.c:141:17: sparse: sparse: cast to restricted __le32

Fixes: d5542923f200 ("nvmem: add driver handling U-Boot environment variables")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-14-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agonvmem: lan9662-otp: add support
Horatiu Vultur [Fri, 16 Sep 2022 12:20:59 +0000 (13:20 +0100)]
nvmem: lan9662-otp: add support

Add support for OTP controller available on LAN9662. The OTPC controls
the access to a non-volatile memory. The size of the memory is 8KB.
The OTPC can access the memory based on an offset.
Implement both the read and the write functionality.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-13-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agodt-bindings: lan9662-otpc: document Lan9662 OTPC
Horatiu Vultur [Fri, 16 Sep 2022 12:20:58 +0000 (13:20 +0100)]
dt-bindings: lan9662-otpc: document Lan9662 OTPC

Document Lan9662 OTP controller.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-12-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agonvmem: u-boot-env: find Device Tree nodes for NVMEM cells
Rafał Miłecki [Fri, 16 Sep 2022 12:20:57 +0000 (13:20 +0100)]
nvmem: u-boot-env: find Device Tree nodes for NVMEM cells

DT binding allows specifying NVMEM cells as NVMEM device (provider)
subnodes. Looks for such subnodes when building NVMEM cells.

This allows NVMEM consumers to use U-Boot environment variables.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-11-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agodt-bindings: nvmem: Add SoC compatible for sm6115
Iskren Chernev [Fri, 16 Sep 2022 12:20:56 +0000 (13:20 +0100)]
dt-bindings: nvmem: Add SoC compatible for sm6115

Document SoC compatible for sm6115.

Reviewed-by: Caleb Connolly <caleb@connolly.tech>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Iskren Chernev <iskren.chernev@gmail.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-10-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agonvmem: sort config symbols alphabetically
Rafał Miłecki [Fri, 16 Sep 2022 12:20:55 +0000 (13:20 +0100)]
nvmem: sort config symbols alphabetically

1. Match what most subsystems do
2. Simplify maintenance a bit
3. Reduce amount of conflicts for new drivers patches

While at it unify indent level in Makefile.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-9-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agonvmem: prefix all symbols with NVMEM_
Rafał Miłecki [Fri, 16 Sep 2022 12:20:54 +0000 (13:20 +0100)]
nvmem: prefix all symbols with NVMEM_

This unifies all NVMEM symbols. They follow one style now.

Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-8-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agodt-bindings: nvmem: qfprom: add IPQ8064 and SDM630 compatibles
Krzysztof Kozlowski [Fri, 16 Sep 2022 12:20:53 +0000 (13:20 +0100)]
dt-bindings: nvmem: qfprom: add IPQ8064 and SDM630 compatibles

Document compatibles for QFPROM used on IPQ8064 and SDM630.  They are
compatible with generic QFPROM fallback.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-7-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agonvmem: brcm_nvram: Use kzalloc for allocating only one element
Kenneth Lee [Fri, 16 Sep 2022 12:20:52 +0000 (13:20 +0100)]
nvmem: brcm_nvram: Use kzalloc for allocating only one element

Use kzalloc(...) rather than kcalloc(1, ...) because the number of
elements we are specifying in this case is 1, so kzalloc would
accomplish the same thing and we can simplify.

Signed-off-by: Kenneth Lee <klee33@uw.edu>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-6-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agodt-bindings: nvmem: mediatek: efuse: Add support for MT8188
Johnson Wang [Fri, 16 Sep 2022 12:20:51 +0000 (13:20 +0100)]
dt-bindings: nvmem: mediatek: efuse: Add support for MT8188

Add compatible for MT8188 SoC.

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Johnson Wang <johnson.wang@mediatek.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-5-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agonvmem: core: add error handling for dev_set_name
Gaosheng Cui [Fri, 16 Sep 2022 12:20:50 +0000 (13:20 +0100)]
nvmem: core: add error handling for dev_set_name

The type of return value of dev_set_name is int, which may return
wrong result, so we add error handling for it to reclaim memory
of nvmem resource, and return early when an error occurs.

Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-4-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomtd: allow getting MTD device associated with a specific DT node
Rafał Miłecki [Fri, 16 Sep 2022 12:20:49 +0000 (13:20 +0100)]
mtd: allow getting MTD device associated with a specific DT node

MTD subsystem API allows interacting with MTD devices (e.g. reading,
writing, handling bad blocks). So far a random driver could get MTD
device only by its name (get_mtd_device_nm()). This change allows
getting them also by a DT node.

This API is required for drivers handling DT defined MTD partitions in a
specific way (e.g. U-Boot (sub)partition with environment variables).

Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agonvmem: add driver handling U-Boot environment variables
Rafał Miłecki [Fri, 16 Sep 2022 12:20:48 +0000 (13:20 +0100)]
nvmem: add driver handling U-Boot environment variables

U-Boot stores its setup as environment variables. It's a list of
key-value pairs stored on flash device with a custom header.

This commit adds an NVMEM driver that:
1. Provides NVMEM access to environment vars binary data
2. Extracts variables as NVMEM cells

Current Linux's NVMEM sysfs API allows reading whole NVMEM data block.
It can be used by user-space tools for reading U-Boot env vars block
without the hassle of finding its location. Parsing will still need to
be re-done there.

Kernel-parsed NVMEM cells can be read however by Linux drivers. This may
be useful for Ethernet drivers for reading device MAC address which is
often stored as U-Boot env variable.

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122100.170016-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoslimbus: qcom-ngd: Add error handling in of_qcom_slim_ngd_register
Lin Yujun [Wed, 14 Sep 2022 03:19:53 +0000 (11:19 +0800)]
slimbus: qcom-ngd: Add error handling in of_qcom_slim_ngd_register

No error handling is performed when platform_device_add()
return fails. Refer to the error handling of driver_set_override(),
add error handling for platform_device_add().

Fixes: 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver")
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Lin Yujun <linyujun809@huawei.com>
Link: https://lore.kernel.org/r/20220914031953.94061-1-linyujun809@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agonvmem: core: Fix memleak in nvmem_register()
Gaosheng Cui [Fri, 16 Sep 2022 12:04:02 +0000 (13:04 +0100)]
nvmem: core: Fix memleak in nvmem_register()

dev_set_name will alloc memory for nvmem->dev.kobj.name in
nvmem_register, when nvmem_validate_keepouts failed, nvmem's
memory will be freed and return, but nobody will free memory
for nvmem->dev.kobj.name, there will be memleak, so moving
nvmem_validate_keepouts() after device_register() and let
the device core deal with cleaning name in error cases.

Fixes: de0534df9347 ("nvmem: core: fix error handling while validating keepout regions")
Cc: stable@vger.kernel.org
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916120402.38753-1-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoslimbus: qcom-ngd-ctrl: allow compile testing without QCOM_RPROC_COMMON
Krzysztof Kozlowski [Fri, 16 Sep 2022 12:29:10 +0000 (13:29 +0100)]
slimbus: qcom-ngd-ctrl: allow compile testing without QCOM_RPROC_COMMON

The Qualcomm common remote-proc code (CONFIG_QCOM_RPROC_COMMON) has
necessary stubs, so it is not needed for compile testing.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122910.170730-5-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoslimbus: qcom-ngd: simplify error paths with dev_err_probe
Krzysztof Kozlowski [Fri, 16 Sep 2022 12:29:09 +0000 (13:29 +0100)]
slimbus: qcom-ngd: simplify error paths with dev_err_probe

Use dev_err_probe to skip printing of deferred probe errors and to
simplify error paths.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122910.170730-4-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoslimbus: qcom-ngd: cleanup in probe error path
Krzysztof Kozlowski [Fri, 16 Sep 2022 12:29:08 +0000 (13:29 +0100)]
slimbus: qcom-ngd: cleanup in probe error path

Add proper error path in probe() to cleanup resources previously
acquired/allocated to fix warnings visible during probe deferral:

  notifier callback qcom_slim_ngd_ssr_notify already registered
  WARNING: CPU: 6 PID: 70 at kernel/notifier.c:28 notifier_chain_register+0x5c/0x90
  Modules linked in:
  CPU: 6 PID: 70 Comm: kworker/u16:1 Not tainted 6.0.0-rc3-next-20220830 #380
  Call trace:
   notifier_chain_register+0x5c/0x90
   srcu_notifier_chain_register+0x44/0x90
   qcom_register_ssr_notifier+0x38/0x4c
   qcom_slim_ngd_ctrl_probe+0xd8/0x400
   platform_probe+0x6c/0xe0
   really_probe+0xbc/0x2d4
   __driver_probe_device+0x78/0xe0
   driver_probe_device+0x3c/0x12c
   __device_attach_driver+0xb8/0x120
   bus_for_each_drv+0x78/0xd0
   __device_attach+0xa8/0x1c0
   device_initial_probe+0x18/0x24
   bus_probe_device+0xa0/0xac
   deferred_probe_work_func+0x88/0xc0
   process_one_work+0x1d4/0x320
   worker_thread+0x2cc/0x44c
   kthread+0x110/0x114
   ret_from_fork+0x10/0x20

Fixes: e1ae85e1830e ("slimbus: qcom-ngd-ctrl: add Protection Domain Restart Support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122910.170730-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoslimbus: qcom-ngd: use correct error in message of pdr_add_lookup() failure
Krzysztof Kozlowski [Fri, 16 Sep 2022 12:29:07 +0000 (13:29 +0100)]
slimbus: qcom-ngd: use correct error in message of pdr_add_lookup() failure

Use correct error code, instead of previous 'ret' value, when printing
error from pdr_add_lookup() failure.

Fixes: e1ae85e1830e ("slimbus: qcom-ngd-ctrl: add Protection Domain Restart Support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220916122910.170730-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomisc: microchip: pci1xxxx: Fix a memory leak in the error handling of gp_aux_bus_probe()
Christophe JAILLET [Sun, 18 Sep 2022 06:27:33 +0000 (08:27 +0200)]
misc: microchip: pci1xxxx: Fix a memory leak in the error handling of gp_aux_bus_probe()

'aux_bus' is freed in the remove function but not in the error handling
path of the probe.

Use devm_kzalloc() to simplify the remove function and fix the leak in the
probe.

Fixes: 393fc2f5948f ("misc: microchip: pci1xxxx: load auxiliary bus driver for the PIO function in the multi-function endpoint of pci1xxxx device.")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/17e19926669a1654e5f2495bf3b289581183d02e.1663482259.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomisc: microchip: pci1xxxx: Do not disable the pci device twice in gp_aux_bus_remove()
Christophe JAILLET [Sun, 18 Sep 2022 06:27:24 +0000 (08:27 +0200)]
misc: microchip: pci1xxxx: Do not disable the pci device twice in gp_aux_bus_remove()

gp_aux_bus_probe() uses pcim_enable_device(), so there is no point in
calling pci_disable_device() explicitly in the remove function.

Fixes: 393fc2f5948f ("misc: microchip: pci1xxxx: load auxiliary bus driver for the PIO function in the multi-function endpoint of pci1xxxx device.")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/8a3a385b3ae15ee7497469ec3250302b626a018b.1663482259.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomisc: microchip: pci1xxxx: use DEFINE_SIMPLE_DEV_PM_OPS() in place of the SIMPLE_DEV_...
Kumaravel Thiagarajan [Thu, 15 Sep 2022 09:47:29 +0000 (15:17 +0530)]
misc: microchip: pci1xxxx: use DEFINE_SIMPLE_DEV_PM_OPS() in place of the SIMPLE_DEV_PM_OPS() in pci1xxxx's gpio driver

build errors listed below and reported by Sudip Mukherjee
<sudipm.mukherjee@gmail.com> for the builds of
riscv, s390, csky, alpha and loongarch allmodconfig are fixed in
this patch.

drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c:311:12: error: 'pci1xxxx_gpio_resume' defined but not used [-Werror=unused-function]
  311 | static int pci1xxxx_gpio_resume(struct device *dev)
      |            ^~~~~~~~~~~~~~~~~~~~
drivers/misc/mchp_pci1xxxx/mchp_pci1xxxx_gpio.c:295:12: error: 'pci1xxxx_gpio_suspend' defined but not used [-Werror=unused-function]
  295 | static int pci1xxxx_gpio_suspend(struct device *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~

Fixes: 4ec7ac90ff39 ("misc: microchip: pci1xxxx: Add power management functions - suspend & resume handlers.")
Reported-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com>
Link: https://lore.kernel.org/r/20220915094729.646185-1-kumaravel.thiagarajan@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agomisc: microchip: pci1xxxx: Remove duplicate include
Yihao Han [Tue, 13 Sep 2022 03:02:57 +0000 (20:02 -0700)]
misc: microchip: pci1xxxx: Remove duplicate include

Remove duplicate include in mchp_pci1xxxx_gpio.c

Fixes: 7d3e4d807df2 ("misc: microchip: pci1xxxx: load gpio driver for the gpio controller auxiliary device enumerated by the auxiliary bus driver.")
Reviewed-by: Kumaravel Thiagarajan <kumaravel.thiagarajan@microchip.com>
Signed-off-by: Yihao Han <hanyihao@vivo.com>
Link: https://lore.kernel.org/r/20220913030257.22352-1-hanyihao@vivo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoMerge tag 'gnss-6.1-rc1' of https://git.kernel.org/pub/scm/linux/kernel/git/johan...
Greg Kroah-Hartman [Thu, 22 Sep 2022 14:38:58 +0000 (16:38 +0200)]
Merge tag 'gnss-6.1-rc1' of https://git./linux/kernel/git/johan/gnss into char-misc-next

Johan writes:
  "GNSS updates for 6.1-rc1

   Here are the GNSS updates for 6.1-rc1, which includes a single IDA API
   cleanup.

   Everything has been in linux-next with no reported issues."

* tag 'gnss-6.1-rc1' of https://git.kernel.org/pub/scm/linux/kernel/git/johan/gnss:
  gnss: replace ida_simple API

22 months agocounter: Realign counter_comp comment block to 80 characters
William Breathitt Gray [Thu, 22 Sep 2022 11:20:57 +0000 (07:20 -0400)]
counter: Realign counter_comp comment block to 80 characters

The member documentation comment lines for struct counter_comp extend
past the 80-characters column boundary due to extra identation at the
start of each section. This patch realigns the comment block within the
80-characters boundary by removing these superfluous indents.

Reviewed-by: Yanteng Si <siyanteng@loongson.cn>
Link: https://lore.kernel.org/r/20220902120839.4260-1-william.gray@linaro.org/
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Link: https://lore.kernel.org/r/8294b04153c33602e9c3dd21ac90c1e99bd0fdaf.1663844776.git.william.gray@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 months agoMerge tag 'misc-habanalabs-next-2022-09-21' of https://git.kernel.org/pub/scm/linux...
Greg Kroah-Hartman [Wed, 21 Sep 2022 14:21:19 +0000 (16:21 +0200)]
Merge tag 'misc-habanalabs-next-2022-09-21' of https://git./linux/kernel/git/ogabbay/linux into char-misc-next

Oded writes:

  "This tag contains habanalabs driver changes for v6.1:

   - Support new notifier event for device state change through eventfd.
   - Add uAPI to retrieve device attestation information for Gaudi2.
   - Add uAPI to retrieve the h/w status of all h/w blocks.
   - Add uAPI to control the running mode of the engine cores in Gaudi2.
   - Expose whether the device runs with secured firmware through the INFO ioctl
     and sysfs.
   - Support trace events in DMA allocations and MMU map/unmap operations.
   - Notify firmware when the device was acquired by a user process and when it
     was released. This is done as part of the RAS that the f/w performs.
   - Multiple bug fixes, refactors and renames.
   - Cleanup of error messages, moving some to debug level.
   - Enhance log prints in case of h/w error events for Gaudi2."

* tag 'misc-habanalabs-next-2022-09-21' of https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux: (68 commits)
  habanalabs: eliminate aggregate use warning
  habanalabs/gaudi: use 8KB aligned address for TPC kernels
  habanalabs: remove some f/w descriptor validations
  habanalabs: build ASICs from new to old
  habanalabs/gaudi2: allow user to flush PCIE by read
  habanalabs: failure to open device due to reset is debug level
  habanalabs/gaudi2: Remove unnecessary (void*) conversions
  habanalabs/gaudi2: add secured attestation info uapi
  habanalabs/gaudi2: add handling to pmmu events in eqe handler
  habanalabs/gaudi: change TPC Assert to use TPC DEC instead of QMAN err
  habanalabs: rename error info structure
  habanalabs/gaudi2: get f/w reset status register dynamically
  habanalabs/gaudi2: increase hard-reset sleep time to 2 sec
  habanalabs/gaudi2: print RAZWI info upon PCIe access error
  habanalabs: MMU invalidation h/w is per device
  habanalabs: new notifier events for device state
  habanalabs/gaudi2: free event irq if init fails
  habanalabs: fix resetting the DRAM BAR
  habanalabs: add support for new cpucp return codes
  habanalabs/gaudi2: read F/W security indication after hard reset
  ...

22 months agoMerge tag 'coresight-next-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git...
Greg Kroah-Hartman [Wed, 21 Sep 2022 14:16:03 +0000 (16:16 +0200)]
Merge tag 'coresight-next-v6.1' of git://git./linux/kernel/git/coresight/linux into char-misc-next

Suzuki writes:
  "coresight: Changes for v6.1

   Coresight trace subsystem updates for v6.1 includes:
     - Support for HiSilicon PTT trace
     - Coresight cleanup of sysfs accessor functions, reduced
       code size.
     - Expose coresight timestamp source for ETMv4+
     - DT binding updates to include missing properties
     - Minor documentation, Kconfig text fixes.

Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>"
* tag 'coresight-next-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/coresight/linux:
  hwtracing: hisi_ptt: Fix up for "iommu/dma: Make header private"
  MAINTAINERS: Add maintainer for HiSilicon PTT driver
  docs: trace: Add HiSilicon PTT device driver documentation
  hwtracing: hisi_ptt: Add tune function support for HiSilicon PCIe Tune and Trace device
  hwtracing: hisi_ptt: Add trace function support for HiSilicon PCIe Tune and Trace device
  iommu/arm-smmu-v3: Make default domain type of HiSilicon PTT device to identity
  coresight: cti-sysfs: Mark coresight_cti_reg_store() as __maybe_unused
  coresight: Make new csdev_access offsets unsigned
  coresight: cti-sysfs: Re-use same functions for similar sysfs register accessors
  coresight: Re-use same function for similar sysfs register accessors
  coresight: Simplify sysfs accessors by using csdev_access abstraction
  coresight: Remove unused function parameter
  coresight: etm4x: docs: Add documentation for 'ts_source' sysfs interface
  coresight: etm4x: Expose default timestamp source in sysfs
  dt-bindings: arm: coresight-tmc: Add 'iommu' property
  dt-bindings: arm: coresight: Add 'power-domains' property
  coresight: docs: Fix a broken reference
  coresight: trbe: fix Kconfig "its" grammar

22 months agoMerge tag 'iio-for-6.1a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Wed, 21 Sep 2022 14:04:24 +0000 (16:04 +0200)]
Merge tag 'iio-for-6.1a' of https://git./linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

1st set of IIO new device support, features and cleanup for 6.1

This includes Nuno Sa's work to move the IIO core over to generic firmware
properties rather than having DT specific code paths. Combined with Andy
Shevchenko's long term work on drivers, this leaves IIO in a good state for
handling other firmware types.

New device support
- liteon,ltrf216a
  * New driver and dt bindings to support this Light sensor.
- maxim,max11205
  * New driver for this 16bit single channel ADC.
- memsensing,msa311
  * New driver for this accelerometer. Includes a string helper for read/write.
- richtek,rtq6056
  * New driver and dt binding to support this current monitor used to measure
    power usage.
- yamaha,yas530
  * Support the YAS537 variant (series includes several fixes for other parts
    and new driver features).

Staging graduation
- adi,ad7746 CDC. Cleanup conducted against set of roadtest tests using
  the posted RFC of that framework.

Features
- core
  * Large rework to make all the core IIO code use generic firmware properties.
    Includes switching some drivers over as well using newly provided
    generic interfaces and allowing removal of DT specific ones.
  * Support for gesture event types for single and double tap. Used in
    bosch,bma400.
- atmel,at91-sama5d2
  * Add support for temperature sensor which uses two muxed inputs to estimate
    the temperature.
  * Handle trackx bits of EMR register to improve temp sampling accuracy.
  * Runtime PM support.
- liteon,ltrf216a
  * Add a _raw channel output to allow working around an issue with
    differing conversions equations that breaks some user space controls.
- mexelis,mlx90632
  * Support regulator control.
- ti,tsc2046
  * External reference voltage support.

Clean up and minor fixes
- Tree-wide
  * devm_clk_get_enabled() replacements of opencoded equivalent.
  * Remaining IIO_DMA_MINALIGN conversions (the staging/iio drivers).
  * Various minor warning and similar cleanup such as missing static
    markings.
  * strlcpy() to strscpy() for cases where return value not checked.
  * provide units.h entries for more HZ units and use them in drivers.
- dt-bindings cleanup
  * Drop maintainers listss where the email address is bouncing.
  * Switch spi devices over to using spi-peripheral.yaml
  * Add some missing unevaluatedProperties / additionalProperties: false
    entries.
- ABI docs
  * Add some missing channel type specific sampling frequency entries.
  * Add parameter names for callback parameters.
- MAINTAINERS
  * Fix wrong ADI forum links.
- core
  * lockdep class per device, to avoid an issue with nest when one IIO
    device is the consumer of another.
  * White space tweaks.
- asc,dlhl60d
  * Use get_unaligned_be24 to avoid some unusual data manipulation and masking.
- atmel,at91-sama5d2
  * Fix wrong max value.
  * Improve error handling when measuring pressure and touch.
  * Add locks to remove races on updating oversampling / sampling freq.
  * Add missing calls in suspend and resume path to ensure state is correctly
    brought up if buffered capture was in use when suspend happened.
  * Error out of write_raw() callback if buffered capture enabled to avoid
    unpredictable behavior.
  * Handle different versions having different oversampling ratio support and
    drop excess error checking.
  * Cleanup magic value defines where the name is just the value and hence
    hurts readability.
  * Use read_avail() callback to provide info on possible oversampling ratios.
  * Correctly handle variable bit depth when doing oversampling on different
    supported parts. Also handle higher oversampling ratios.
- fsl,imx8qxp
  * Don't ignore errors from regulator_get_voltage() so as to avoid some
    very surprising scaling.
- invensense,icp10100
  * Switch from UNIVERSAL to DEFINE_RUNTIME_DEV_PM_OPS. UNIVERSAL rarely made
    sense and is now deprecated. In this driver we just avoid double disabling
    in some paths.
- maxim,max1363
  * Drop consumer channel map provision by platform data. There have been
    better ways of doing this for years and there are no in tree users.
- microchip,mcp3911
  * Update status to maintained.
- qcom,spmi-adc5
  * Support measurement of LDO output voltage.
- qcom,spmi-adc
  * Add missing channel available on SM6125 SoC.
- st,stmpe
  * Drop requirement on node name in binding now that driver correctly
    doesn't enforce it.
- stx104
  * Move to more appropriate addac directory
- ti,am335x
  * Document ti,am654-adc compatible already in use in tree.
- ti,hmc5843
  * Move dev_pm_ops out of header and use new pm macros to handle export.
- yamaha,yas530
  * Minor cleanups.

* tag 'iio-for-6.1a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (142 commits)
  iio: pressure: icp10100: Switch from UNIVERSAL to DEFINE_RUNTIME_DEV_PM_OPS().
  iio: adc: max1363: Drop provision to provide an IIO channel map via platform data
  iio: accel: bma400: Add support for single and double tap events
  iio: Add new event type gesture and use direction for single and double tap
  iio: Use per-device lockdep class for mlock
  iio: adc: add max11205 adc driver
  dt-bindings: iio: adc: Add max11205 documentation file
  iio: magnetometer: yamaha-yas530: Use dev_err_probe()
  iio: magnetometer: yamaha-yas530: Make strings const in chip info
  iio: magnetometer: yamaha-yas530: Use pointers as driver data
  iio: adc: tsc2046: silent spi_device_id warning
  iio: adc: tsc2046: add vref support
  dt-bindings: iio: adc: ti,tsc2046: add vref-supply property
  iio: light: ltrf216a: Add raw attribute
  dt-bindings: iio: Add missing (unevaluated|additional)Properties on child nodes
  MAINTAINERS: fix Analog Devices forum links
  iio/accel: fix repeated words in comments
  dt-bindings: iio: accel: add dt-binding schema for msa311 accel driver
  iio: add MEMSensing MSA311 3-axis accelerometer driver
  dt-bindings: vendor-prefixes: add MEMSensing Microsystems Co., Ltd.
  ...

22 months agoMerge tag 'mhi-for-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi...
Greg Kroah-Hartman [Wed, 21 Sep 2022 13:43:35 +0000 (15:43 +0200)]
Merge tag 'mhi-for-v6.1' of git://git./linux/kernel/git/mani/mhi into char-misc-next

Manivannan writes:
  "MHI Host
   --------

   - Print the modem name while probing the MHI host pci-generic driver. This has
     been exposed as a debug information so far but on a low storate embedded
     devices such as OpenWRT based products, this helps in identifying the
     attached modem without enabling the debug logs."

* tag 'mhi-for-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi:
  bus: mhi: host: always print detected modem name

22 months agoMerge tag 'fpga-for-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/fpga...
Greg Kroah-Hartman [Wed, 21 Sep 2022 13:42:42 +0000 (15:42 +0200)]
Merge tag 'fpga-for-6.1-rc1' of git://git./linux/kernel/git/fpga/linux-fpga into char-misc-next

Xu writes:

FPGA Manager changes for 6.1-rc1

DFL

- Matthew's change adds new device IDs supported by DFL.
- Dan's change uses array_size() for memory allocation to prevent
potential overflow

Microchip

- Conor's change adds MODULE_AUTHOR entry for microchip-spi driver
- Krzysztof's change refines dt-bindings

Intel m10 bmc secure update

- Russ's change adds new device ID supported by the driver

All patches have been reviewed on the mailing list, and have been in the
last linux-next releases (as part of our for-next branch).

Signed-off-by: Xu Yilun <yilun.xu@intel.com>
* tag 'fpga-for-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/fpga/linux-fpga:
  fpga: m10bmc-sec: d5005 bmc secure update driver
  fpga: prevent integer overflow in dfl_feature_ioctl_set_irq()
  dt-bindings: fpga: microchip,mpf-spi-fpga-mgr: use spi-peripheral-props.yaml
  fpga: microchip-spi: add missing module author entry
  fpga: dfl-pci: Add IDs for Intel N6000, N6001 and C6100 cards

22 months agohabanalabs: eliminate aggregate use warning
Oded Gabbay [Mon, 19 Sep 2022 21:08:40 +0000 (00:08 +0300)]
habanalabs: eliminate aggregate use warning

When doing sizeof() and giving as argument a dereference of
a pointer-to-a-pointer object, clang will issue a warning.

Eliminate the warning by passing struct <name>*

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi: use 8KB aligned address for TPC kernels
Tomer Tayar [Mon, 19 Sep 2022 15:46:03 +0000 (18:46 +0300)]
habanalabs/gaudi: use 8KB aligned address for TPC kernels

I$ prefetch is enabled when sending a TPC kernel to initialize the TPC
memory, and it has a restriction that the base address will be aligned
to 8KB.
Currently the base address is 128 bytes from the start address of the
device SRAM, so prefetching will start 128 bytes before the actual
kernel memory.
Modify the kernel address to be 8KB aligned.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: remove some f/w descriptor validations
farah kassabri [Tue, 30 Aug 2022 10:01:03 +0000 (13:01 +0300)]
habanalabs: remove some f/w descriptor validations

To be forward-backward compatible with the firmware in the initial
communication during preboot, we need to remove the validation of the
header size. This will allow us to add more fields to the
lkd_fw_comms_desc structure.

Instead of the validation of the header size, we just print warning
when some mismatch in descriptor has been revealed, and we calculate
the CRC base on descriptor size reported by the firmware instead of
calculating it ourselves.

Signed-off-by: farah kassabri <fkassabri@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: build ASICs from new to old
Ohad Sharabi [Thu, 15 Sep 2022 06:19:03 +0000 (09:19 +0300)]
habanalabs: build ASICs from new to old

Newer ASICs code changes more often, has more chance to fail
compilation. So, let's compile them first so errors in those files
will fail compilation sooner.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi2: allow user to flush PCIE by read
Ofir Bitton [Thu, 15 Sep 2022 08:10:56 +0000 (11:10 +0300)]
habanalabs/gaudi2: allow user to flush PCIE by read

In order for the user to flush PCIE he needs to read some register
from PCIE block. The chosen register is SPECIAL_GLBL_SPARE_0 and
hence needs to be unsecured.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: failure to open device due to reset is debug level
Oded Gabbay [Mon, 19 Sep 2022 08:30:03 +0000 (11:30 +0300)]
habanalabs: failure to open device due to reset is debug level

If the user wants to open the device, and the device is currently in
reset, the user will get an error from the open().

We don't need to display an error in the dmesg for that as it is
not a real error and we can spam the kernel log with this message.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi2: Remove unnecessary (void*) conversions
Li zeming [Mon, 19 Sep 2022 02:20:54 +0000 (10:20 +0800)]
habanalabs/gaudi2: Remove unnecessary (void*) conversions

The void pointer object can be directly assigned to different structure
objects, it does not need to be cast.

Signed-off-by: Li zeming <zeming@nfschina.com>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi2: add secured attestation info uapi
Dani Liberman [Mon, 1 Aug 2022 12:23:44 +0000 (15:23 +0300)]
habanalabs/gaudi2: add secured attestation info uapi

User will provide a nonce via the ioctl, and will retrieve
secured attestation data of the boot, generated using given
nonce.

Signed-off-by: Dani Liberman <dliberman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi2: add handling to pmmu events in eqe handler
Dani Liberman [Thu, 8 Sep 2022 15:24:41 +0000 (18:24 +0300)]
habanalabs/gaudi2: add handling to pmmu events in eqe handler

In order to get the error cause and the captured address in case of
page fault, added pmmu events to eqe handler.

Signed-off-by: Dani Liberman <dliberman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi: change TPC Assert to use TPC DEC instead of QMAN err
Tal Cohen [Wed, 17 Aug 2022 09:46:07 +0000 (12:46 +0300)]
habanalabs/gaudi: change TPC Assert to use TPC DEC instead of QMAN err

This change is done while there is a problem to use QMAN error for
TPC assert async. The problem involves security limitation that exists
to generate the assert via QMAN error.

Signed-off-by: Tal Cohen <talcohen@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: rename error info structure
Dani Liberman [Wed, 7 Sep 2022 13:15:39 +0000 (16:15 +0300)]
habanalabs: rename error info structure

As a preparation for adding more errors to it,
change to more suitable name.

Signed-off-by: Dani Liberman <dliberman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi2: get f/w reset status register dynamically
farah kassabri [Mon, 29 Aug 2022 13:56:28 +0000 (16:56 +0300)]
habanalabs/gaudi2: get f/w reset status register dynamically

Get the firmware reset status address from the dynamic registers
we read from the firmware instead of using a define.

Signed-off-by: farah kassabri <fkassabri@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi2: increase hard-reset sleep time to 2 sec
Tomer Tayar [Tue, 6 Sep 2022 13:37:14 +0000 (16:37 +0300)]
habanalabs/gaudi2: increase hard-reset sleep time to 2 sec

The access to the device registers is blocked during hard reset, until
preboot runs and allows the access to specific registers, including the
PSOC BTM_FSM register which is used to know when the reset is done.
Between the reset request and until this register is polled there is a
small delay of 500 msec which is not enough for F/W to process the reset
and for preboot to run, so the register might be accessed while it is
blocked.
To avoid it, increase the delay to 2 sec.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi2: print RAZWI info upon PCIe access error
Tomer Tayar [Mon, 5 Sep 2022 13:24:21 +0000 (16:24 +0300)]
habanalabs/gaudi2: print RAZWI info upon PCIe access error

Add the dump of the RAZWI information when a PCIe access is blocked by
RR.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: MMU invalidation h/w is per device
Oded Gabbay [Mon, 5 Sep 2022 14:14:45 +0000 (17:14 +0300)]
habanalabs: MMU invalidation h/w is per device

The code used the mmu mutex to protect access to the context's page
tables and invalidation of the MMU cache. Because pgt are per
context, the mmu mutex was a member of the context object.

The problem is that the device has a single MMU invalidation h/w
(per MMU). Therefore, the mmu mutex should not be a property of the
context but a property of the device.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: new notifier events for device state
Tal Cohen [Thu, 18 Aug 2022 09:54:23 +0000 (12:54 +0300)]
habanalabs: new notifier events for device state

Add new notifier events that inform several device states.
General H/W error raised on device general H/W error occurs.
User engine error is raised when a device engine informs of an error.

Signed-off-by: Tal Cohen <talcohen@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi2: free event irq if init fails
Oded Gabbay [Sun, 4 Sep 2022 07:39:27 +0000 (10:39 +0300)]
habanalabs/gaudi2: free event irq if init fails

In case initialization fails after event irq was requested, we need to
release that irq.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: fix resetting the DRAM BAR
Ohad Sharabi [Thu, 1 Sep 2022 13:37:08 +0000 (16:37 +0300)]
habanalabs: fix resetting the DRAM BAR

Current code does not takes into account the new DRAM region base
and so calculated address is wrong and can lead to crush.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: add support for new cpucp return codes
Ofir Bitton [Tue, 23 Aug 2022 13:58:38 +0000 (16:58 +0300)]
habanalabs: add support for new cpucp return codes

Firmware now responds with a more detailed cpucp return codes.
Driver can now distinguish between error and debug return codes.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi2: read F/W security indication after hard reset
Tomer Tayar [Thu, 1 Sep 2022 11:12:56 +0000 (14:12 +0300)]
habanalabs/gaudi2: read F/W security indication after hard reset

F/W security status might change after every reset.

Add the reading of the preboot status to the hard reset sequence, which
among others reads this security indication.

As this preboot status reading includes the waiting for the preboot to
be ready, it can be removed from the CPU init which is done in a later
stage.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi: rename mme cfg error response print
Ofir Bitton [Tue, 30 Aug 2022 12:07:51 +0000 (15:07 +0300)]
habanalabs/gaudi: rename mme cfg error response print

Current description is misleading hence we rename it to a more
suitable error description.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: fix possible hole in device va
farah kassabri [Tue, 23 Aug 2022 11:32:42 +0000 (14:32 +0300)]
habanalabs: fix possible hole in device va

cb_map_mem() uses gen_pool_alloc() to get virtual address for
mapping a CB.
The mapping is done in chunks of page size, so if the CB size is
larger, it is possible that the allocated virtual addresses won't
be consecutive.
User retrieves this device VA which returns the virtual address
in the first va_block. If there is a "hole" in the virtual addresses,
user can configure a HW block with a bad device VA.

Signed-off-by: farah kassabri <fkassabri@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: send device activity in a proper context
Ofir Bitton [Sun, 28 Aug 2022 09:46:27 +0000 (12:46 +0300)]
habanalabs: send device activity in a proper context

'Device activity open packet' should be sent outside of mutex as
there is no real necessity for a lock.
In addition 'device activity close packet' should be sent upon an
actual release of the device.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: send device active message to f/w
farah kassabri [Wed, 17 Aug 2022 14:43:43 +0000 (17:43 +0300)]
habanalabs: send device active message to f/w

As part of the RAS that is done by the f/w, we should send a message
to the f/w when a user either acquires or releases the device.

Signed-off-by: farah kassabri <fkassabri@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi2: dump detailed information upon RAZWI
Ofir Bitton [Sun, 21 Aug 2022 10:50:51 +0000 (13:50 +0300)]
habanalabs/gaudi2: dump detailed information upon RAZWI

In order to improve debuggability, we add all available information
when a RAZWI event occur.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi2: log critical events with no rate limit
farah kassabri [Tue, 23 Aug 2022 14:41:52 +0000 (17:41 +0300)]
habanalabs/gaudi2: log critical events with no rate limit

When we have a storm of errors of HBM ECC SERR we can reach a situation
where driver start hard reset flow without logging the error cause
that caused the hard reset due to logs rate limiting.

Signed-off-by: farah kassabri <fkassabri@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: ignore EEPROM errors during boot
Ofir Bitton [Tue, 23 Aug 2022 13:23:56 +0000 (16:23 +0300)]
habanalabs: ignore EEPROM errors during boot

EEPROM errors reported by firmware are basically warnings and
should not fail the boot process.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: perform context switch flow only if needed
Ofir Bitton [Mon, 22 Aug 2022 07:59:34 +0000 (10:59 +0300)]
habanalabs: perform context switch flow only if needed

Except Goya, none of our ASICs require context switch flow, hence we
enable this flow only where it is needed.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: set command buffer host VA dynamically
Dafna Hirschfeld [Mon, 23 May 2022 05:59:19 +0000 (08:59 +0300)]
habanalabs: set command buffer host VA dynamically

Set the addresses for userspace command buffer dynamically
instead of hard-coded. There is no reason for it to
be hard-coded.

Signed-off-by: Dafna Hirschfeld <dhirschfeld@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: trace DMA allocations
Ohad Sharabi [Sun, 12 Jun 2022 12:00:29 +0000 (15:00 +0300)]
habanalabs: trace DMA allocations

This patch add tracepoints in the code for DMA allocation.
The main purpose is to be able to cross data with the map operations and
determine whether memory violation occurred, for example free DMA
allocation before unmapping it from device memory.

To achieve this the DMA alloc/free code flows were refactored so that a
single DMA tracepoint will catch many flows.

To get better understanding of what happened in the DMA allocations
the real allocating function is added to the trace as well.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: trace MMU map/unmap page
Ohad Sharabi [Wed, 8 Jun 2022 07:27:59 +0000 (10:27 +0300)]
habanalabs: trace MMU map/unmap page

This patch utilize the defined tracepoint to trace the MMU's pages
map/unmap operations.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: define trace events
Ohad Sharabi [Wed, 8 Jun 2022 06:58:59 +0000 (09:58 +0300)]
habanalabs: define trace events

This patch adds trace events for habanalabs driver to gain all the
benefits such an infrastructure can supply.

The following events were added:
- MMU map/unmap: to be able to track driver's memory allocations
- DMA alloc/free: to track our DMA allocation

the above trace points in conjunction will help us map the device memory
usage as well as to be able to track memory violations.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Acked-by: Oded Gabbay <ogabbay@kernel.org>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi2: assigning PQFs for ARC f/w in PDMA
Rajarama Manjukody Bhat [Fri, 12 Aug 2022 06:28:20 +0000 (09:28 +0300)]
habanalabs/gaudi2: assigning PQFs for ARC f/w in PDMA

Assigning 3 PQFs in PDMA1 and 2 PQFs in PDMA0 for ARC firmware usage.

Signed-off-by: Rajarama Manjukody Bhat <rmbhat@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: fix calculation of DRAM base address in PCIe BAR
Tomer Tayar [Mon, 15 Aug 2022 17:13:30 +0000 (20:13 +0300)]
habanalabs: fix calculation of DRAM base address in PCIe BAR

The calculation of the device DRAM base address before setting the
relevant PCIe BAR to point at it, has an assumption that this BAR is
used to access only the DRAM, and thus the covered DRAM size is a power
of 2.
In future ASICs it is not necessarily true, so need to update the
calculation to support also a non-power-of-2 size.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: if map page fails don't try to unmap it
Dafna Hirschfeld [Mon, 15 Aug 2022 08:40:55 +0000 (11:40 +0300)]
habanalabs: if map page fails don't try to unmap it

The original code tried to unmap a page that was not mapped as part of
the map page error path.

Signed-off-by: Dafna Hirschfeld <dhirschfeld@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: select FW_LOADER in Kconfig
Oded Gabbay [Mon, 15 Aug 2022 10:59:14 +0000 (13:59 +0300)]
habanalabs: select FW_LOADER in Kconfig

The driver is loading firmware to the device and we use the firmware
loading functions from the FW_LOADER module.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: add cdev index data member
Omer Shpigelman [Thu, 4 Aug 2022 14:32:30 +0000 (17:32 +0300)]
habanalabs: add cdev index data member

Instead of recalculating the cdev index, store it in a dedicated data
member. This data member is intended to be passed to other drivers using
the auxiliary bus infra and hence this new data member is necessary in
case that the calculation is changed in the future.

Signed-off-by: Omer Shpigelman <oshpigelman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: fix missing info in sysfs documentation
Oded Gabbay [Wed, 10 Aug 2022 12:39:20 +0000 (15:39 +0300)]
habanalabs: fix missing info in sysfs documentation

The kernel version field wasn't updated when a few entries were
upstreamed.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: fix bug when setting va block size
Dafna Hirschfeld [Mon, 8 Aug 2022 11:03:44 +0000 (14:03 +0300)]
habanalabs: fix bug when setting va block size

the size of a block is always 'block->end - block->start + 1'

Signed-off-by: Dafna Hirschfeld <dhirschfeld@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: expose device security status using info ioctl
Ofir Bitton [Wed, 3 Aug 2022 14:25:33 +0000 (17:25 +0300)]
habanalabs: expose device security status using info ioctl

In order for the user to know if he is running on a secured device
or not, we add it also to the hw_ip info ioctl.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: expose device security status through sysfs
Ofir Bitton [Wed, 3 Aug 2022 14:16:56 +0000 (17:16 +0300)]
habanalabs: expose device security status through sysfs

In order for the user to know if he is running on a secured device
or not, a sysfs node is added.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: remove secured PCI IDs
Ofir Bitton [Wed, 3 Aug 2022 08:59:19 +0000 (11:59 +0300)]
habanalabs: remove secured PCI IDs

Secured PCI ID will not be supported in new asics because the
security status can always be read from the f/w.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: fix H/W block handling for partial unmappings
Tomer Tayar [Wed, 3 Aug 2022 13:36:02 +0000 (16:36 +0300)]
habanalabs: fix H/W block handling for partial unmappings

Several munmap() calls can be done or a mapped H/W block that has a
larger size than a page size.
Releasing the object should be done only when all mapped range is
unmapped.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: unify hwmon resources clean up
Dani Liberman [Mon, 27 Jun 2022 19:06:51 +0000 (22:06 +0300)]
habanalabs: unify hwmon resources clean up

Since hwmon fini code is common for all asics, unified it to common
function.

Signed-off-by: Dani Liberman <dliberman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi2: new API to control engine cores running mode
Tal Cohen [Thu, 7 Jul 2022 15:42:47 +0000 (18:42 +0300)]
habanalabs/gaudi2: new API to control engine cores running mode

The current flow of halting the engine cores is implemented by command
buffers built by the user space and sent towards the Driver.

This current flow is broken since the user space does not know when
the cores actually halt as sending a workload is async op.

Therefore the application can not free the memory that is mapped
to the engine cores.

This new API allows the user space to control the running mode. The
API call is sync (returns after the cores are set to the
requested mode).

Signed-off-by: Tal Cohen <talcohen@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: remove left-over code from bring-up
Oded Gabbay [Sun, 7 Aug 2022 13:36:30 +0000 (16:36 +0300)]
habanalabs: remove left-over code from bring-up

There is some left-over code from the gaudi2 bring-up that wasn't
removed so far.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi2: change device f/w security check
farah kassabri [Wed, 20 Jul 2022 10:53:37 +0000 (13:53 +0300)]
habanalabs/gaudi2: change device f/w security check

On Gaudi2 the f/w always configures the PCIe iATU and allows access to
scratchpad registers. Therefore, we can know if the f/w is secured
by reading a status bit from the f/w registers.

Signed-off-by: farah kassabri <fkassabri@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: move common function out of debugfs.c
Oded Gabbay [Sun, 31 Jul 2022 06:10:24 +0000 (09:10 +0300)]
habanalabs: move common function out of debugfs.c

A common function that is called from multiple places can't be
located in degugfs.c because that file is only compiled if
debugfs is enabled in the kernel config file.

This can lead to undefined symbol compilation error.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/uapi: move defines to better place inside file
Oded Gabbay [Sun, 31 Jul 2022 05:27:36 +0000 (08:27 +0300)]
habanalabs/uapi: move defines to better place inside file

Cosmetic change to move the eventfd events defines to a better
location in the file, closer to other INFO IOCTL defines.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: add a missing lock for in_reset indication
Tomer Tayar [Tue, 19 Jul 2022 06:01:53 +0000 (09:01 +0300)]
habanalabs: add a missing lock for in_reset indication

Add a missing lock in hl_device_resume() when it assigns a value to the
'in_reset' indication.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: fix vma fields assignments order in hl_hw_block_mmap()
Tomer Tayar [Fri, 29 Jul 2022 13:30:48 +0000 (16:30 +0300)]
habanalabs: fix vma fields assignments order in hl_hw_block_mmap()

In hl_hw_block_mmap(), the vma's 'vm_private_data' and 'vm_ops' fields
are assigned before filling the content of the private data.
In between there is a call to the ASIC hw_block_mmap() function, and if
it fails, the vma close function will be called with a bad private data
value.
Fix the order of assignments to avoid this issue.

In hl_hw_block_mmap() the vma's 'vm_private_data and vm_ops are assigned
before setting the

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: avoid returning a valid handle if map_block() fails
Tomer Tayar [Wed, 27 Jul 2022 06:04:13 +0000 (09:04 +0300)]
habanalabs: avoid returning a valid handle if map_block() fails

map_block() sets the block id handle even if get_hw_block_id() fails,
and in this case it uses block id 0 which might be a valid id.
Modify it to set the handle only if get_hw_block_id() succeeds.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: fix command submission sanity check
Tal Cohen [Sun, 24 Jul 2022 14:40:23 +0000 (17:40 +0300)]
habanalabs: fix command submission sanity check

When a CS is submitted, the ioctl handler checks the CS
flags and performs a sanity check, according to its value.
As new CS flags are added, the sanity check needs to be updated
according to the new flags.

Signed-off-by: Tal Cohen <talcohen@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi: read div_sel value from firmware
Ohad Sharabi [Sun, 24 Jul 2022 07:23:05 +0000 (10:23 +0300)]
habanalabs/gaudi: read div_sel value from firmware

Even when running with unsecured f/w, we should read the PLL div_sel
value from the f/w as this register is always privileged.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi: fix print format for div_sel
Ohad Sharabi [Sun, 24 Jul 2022 05:45:34 +0000 (08:45 +0300)]
habanalabs/gaudi: fix print format for div_sel

Print format was for int (%d) while variable is u32.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi2: mark PCIE access error as fatal
Tomer Tayar [Wed, 20 Jul 2022 17:02:20 +0000 (20:02 +0300)]
habanalabs/gaudi2: mark PCIE access error as fatal

F/W events are enabled in a late phase of the device init, so an event
for a PCIE access error during the init, can be received after the init
is already done and considered as successful.
A resulting device reset, which does the same H/W init, can end
similarly with this event right after the reset is done and considered
as successful, and a loop of this sequence can continue.

To avoid it mark the PCIE access error as a fatal event, so after 2
consecutive events no more resets will be done.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: add uapi to retrieve engines status
Dani Liberman [Sat, 9 Jul 2022 09:34:17 +0000 (12:34 +0300)]
habanalabs: add uapi to retrieve engines status

Currently, to get engines status, user needed to read debugfs file
with root permissions.

This new uapi allows user apace apps retrieve status, so for example,
in case of failure, status can be retrieved immediately by the
application itself which runs without root permissions.

Signed-off-by: Dani Liberman <dliberman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: remove all kdma locks
Oded Gabbay [Tue, 19 Jul 2022 09:16:01 +0000 (12:16 +0300)]
habanalabs: remove all kdma locks

We don't use KDMA concurrently in the driver. The only use is through
debugfs and we don't protect concurrent access through it.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: wrap macro arg with parentheses
Ohad Sharabi [Mon, 18 Jul 2022 19:02:13 +0000 (22:02 +0300)]
habanalabs: wrap macro arg with parentheses

The macro argument <val> is cast-ed to u32 in some of the places.
Because this arg can be some arithmetic computation (e.g. address +
offset) the cast should be on the whole expression.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: fix spelling mistakes
Bharat Jauhari [Wed, 1 Jun 2022 12:18:47 +0000 (15:18 +0300)]
habanalabs: fix spelling mistakes

Cosmetic commit, no logical changes. It just fixes the spelling
mistakes.

Signed-off-by: Bharat Jauhari <bjauhari@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi2: remove old interrupt mappings
Ofir Bitton [Mon, 18 Jul 2022 18:02:34 +0000 (21:02 +0300)]
habanalabs/gaudi2: remove old interrupt mappings

Interrupt enumration has changed some time ago but the old mapping
was accidentally left in the driver.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi: increase default cs timeout to 10 minutes
Oded Gabbay [Wed, 6 Apr 2022 09:07:19 +0000 (12:07 +0300)]
habanalabs/gaudi: increase default cs timeout to 10 minutes

In order to improve scalability and reduce host overhead, it is better
to increase the default TDR timeout of Gaudi1 from 30 seconds to
10 minutes.

This will allow the DL Framework (e.g. PyTorch, TensorFlow) to remove
the host sync they are using now and improve overall performance on
scaleout training.

Note that one can always set the timeout to a custom value via
a kernel module parameter given during driver load.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs: add return code field to module iterator
Ohad Sharabi [Wed, 13 Jul 2022 10:47:23 +0000 (13:47 +0300)]
habanalabs: add return code field to module iterator

Up until now the module iterator called void callback functions
and so caller activating callback that may fail suffered from 2 issues:
1. The need to "plant" return called in the private data. This is a
   drawback since the iterator itself should not be aware of the private
   data of the caller.
2. Due to 1 even in a failure the iterator would keep iterating instead
   of break upon error.

To overcome this an optional rc field added to the iterator context.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
22 months agohabanalabs/gaudi2: enable all MMU SPI/SEI interrupts
Tomer Tayar [Tue, 12 Jul 2022 15:19:11 +0000 (18:19 +0300)]
habanalabs/gaudi2: enable all MMU SPI/SEI interrupts

Currently only part of the MMU SPI/SEI interrupts are enabled, although
there is no real reason to not enable all.
The only exception is "burst_fifo_full" which is expected for PMMU
because it has a 2 entries FIFO, and thus is it not enabled for it.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>