Thorsten Scherer [Wed, 16 Jun 2021 06:17:36 +0000 (08:17 +0200)]
siox: Simplify error handling via dev_err_probe()
commit
a787e5400a1c ("driver core: add device probe log helper")
introduced a helper for a common error checking pattern. Use it.
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thorsten Scherer <t.scherer@eckelmann.de>
Link: https://lore.kernel.org/r/20210616061736.3786173-2-t.scherer@eckelmann.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Moritz Fischer [Fri, 18 Jun 2021 22:46:18 +0000 (15:46 -0700)]
fpga: machxo2-spi: Address warning about unused variable
Address warning about unused variable in case CONFIG_OF is not set.
warning: unused variable 'of_match' [-Wunused-const-variable]
static const struct of_device_id of_match[] = {
Fixes:
88fb3a002330 ("fpga: lattice machxo2: Add Lattice MachXO2 support")
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Tom Rix <trix@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Moritz Fischer <mdf@kernel.org>
Link: https://lore.kernel.org/r/20210618224618.1487323-1-mdf@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Kees Cook [Wed, 23 Jun 2021 20:39:36 +0000 (13:39 -0700)]
lkdtm/heap: Add init_on_alloc tests
Add SLAB and page allocator tests for init_on_alloc. Testing for
init_on_free was already happening via the poisoning tests.
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210623203936.3151093-10-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Kees Cook [Wed, 23 Jun 2021 20:39:35 +0000 (13:39 -0700)]
selftests/lkdtm: Enable various testable CONFIGs
Add a handful of LKDTM-testable features that depend on certain CONFIGs
so that they are visible in logs for CI systems that run the selftests.
Others could be added, but may be seen as having too high a trade-off
for general testing.
Cc: kernelci@groups.io
Suggested-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210623203936.3151093-9-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Kees Cook [Wed, 23 Jun 2021 20:39:34 +0000 (13:39 -0700)]
lkdtm: Add CONFIG hints in errors where possible
For various failure conditions, try to include some details about where
to look for reasons about the failure.
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210623203936.3151093-8-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Kees Cook [Wed, 23 Jun 2021 20:39:33 +0000 (13:39 -0700)]
lkdtm: Enable DOUBLE_FAULT on all architectures
Where feasible, I prefer to have all tests visible on all architectures,
but to have them wired to XFAIL. DOUBLE_FAIL was set up to XFAIL, but
wasn't actually being added to the test list.
Fixes:
cea23efb4de2 ("lkdtm/bugs: Make double-fault test always available")
Cc: stable@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210623203936.3151093-7-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Kees Cook [Wed, 23 Jun 2021 20:39:32 +0000 (13:39 -0700)]
lkdtm/heap: Add vmalloc linear overflow test
Similar to the existing slab overflow and stack exhaustion tests, add
VMALLOC_LINEAR_OVERFLOW (and rename the slab test SLAB_LINEAR_OVERFLOW).
Additionally unmarks the test as destructive. (It should be safe in the
face of misbehavior.)
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210623203936.3151093-6-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Kees Cook [Wed, 23 Jun 2021 20:39:31 +0000 (13:39 -0700)]
lkdtm/bugs: XFAIL UNALIGNED_LOAD_STORE_WRITE
When built under CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS, this test is
expected to fail (i.e. not trip an exception).
Fixes:
46d1a0f03d66 ("selftests/lkdtm: Add tests for LKDTM targets")
Cc: stable@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210623203936.3151093-5-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Kees Cook [Wed, 23 Jun 2021 20:39:30 +0000 (13:39 -0700)]
selftests/lkdtm: Fix expected text for free poison
Freed memory poisoning can be tested a few ways, so update the expected
text to reflect the non-Oopsing alternative.
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210623203936.3151093-4-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Kees Cook [Wed, 23 Jun 2021 20:39:29 +0000 (13:39 -0700)]
selftests/lkdtm: Fix expected text for CR4 pinning
The error text for CR4 pinning changed. Update the test to match.
Fixes:
a13b9d0b9721 ("x86/cpu: Use pinning mask for CR4 bits needing to be 0")
Cc: stable@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210623203936.3151093-3-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Kees Cook [Wed, 23 Jun 2021 20:39:28 +0000 (13:39 -0700)]
selftests/lkdtm: Avoid needing explicit sub-shell
Some environments do not set $SHELL when running tests. There's no
need to use $SHELL here anyway, since "cat" can be used to receive any
delivered signals from the kernel. Additionally avoid using bash-isms
in the command, and record stderr for posterity.
Fixes:
46d1a0f03d66 ("selftests/lkdtm: Add tests for LKDTM targets")
Cc: stable@vger.kernel.org
Suggested-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Suggested-by: David Laight <David.Laight@ACULAB.COM>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210623203936.3151093-2-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Greg Kroah-Hartman [Wed, 23 Jun 2021 11:37:29 +0000 (13:37 +0200)]
Merge tag 'extcon-next-for-5.14' of git://git./linux/kernel/git/chanwoo/extcon into char-misc-next
Chanwoo writes:
Update extcon next for v5.14
Detailed description for this pull request:
1. Update extcon-sm5502 provider driver
- Convert devicetree binding document sytle with yaml
for extcon-sm5502.c and add support for SM5504 chip to extcon-sm5502.c.
- Use devm_regmap_add_irq_chip and probe_new for extcon-sm5502.c
2. Add missing modalias string for extcon-max8997.c.
3. Initialize the status data of extcon-intel-mrfld.c on probe time
in order to prevent the mismatch issue.
* tag 'extcon-next-for-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon:
extcon: sm5502: Add support for SM5504
extcon: sm5502: Refactor driver to use chip-specific struct
dt-bindings: extcon: sm5502: Document siliconmitus,sm5504-muic
dt-bindings: extcon: sm5502: Convert to DT schema
extcon: sm5502: Implement i2c_driver->probe_new()
extcon: sm5502: Use devm_regmap_add_irq_chip()
extcon: max8997: Add missing modalias string
extcon: sm5502: Drop invalid register write in sm5502_reg_data
extcon: intel-mrfld: Sync hardware and software state on init
Greg Kroah-Hartman [Wed, 23 Jun 2021 08:33:34 +0000 (10:33 +0200)]
Merge tag 'phy-for-5.14_v2' of git://git./linux/kernel/git/phy/linux-phy into char-misc-next
Vinod writes:
phy-for-5.14 version 2
- Updates:
- Yaml conversion for renesas,rcar-gen3 pcie phy and
rockchip-usb-phy bindings
- Support for devm_phy_get() taking NULL phy name
- New support:
- PCIe phy for Qualcomm IPQ60xx
- PCIe phy for Qualcomm SDX55
- USB phy for RK3308
- CAN transceivers phy for TI TCAN104x
- Innosilicon-based CSI dphy for rockchip
* tag 'phy-for-5.14_v2' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy: (36 commits)
phy: Revert "phy: ralink: Kconfig: convert mt7621-pci-phy into 'bool'"
phy: ti: dm816x: Fix the error handling path in 'dm816x_usb_phy_probe()
phy: uniphier-pcie: Fix updating phy parameters
phy/rockchip: add Innosilicon-based CSI dphy
dt-bindings: phy: add yaml binding for rockchip-inno-csi-dphy
phy: rockchip: remove redundant initialization of pointer cfg
phy: phy-can-transceiver: Add support for generic CAN transceiver driver
dt-bindings: phy: Add binding for TI TCAN104x CAN transceivers
phy: core: Reword the comment specifying the units of max_link_rate to be Mbps
phy: phy-mtk-hdmi: Remove redundant dev_err call in mtk_hdmi_phy_probe()
phy: phy-mtk-mipi-dsi: Remove redundant dev_err call in mtk_mipi_tx_probe()
phy: phy-mmp3-hsic: Remove redundant dev_err call in mmp3_hsic_phy_probe()
phy: bcm-ns-usb3: Remove redundant dev_err call in bcm_ns_usb3_mdio_probe()
MAINTAINERS: update marvell,armada-3700-utmi-phy.yaml reference
phy: phy-twl4030-usb: use DEVICE_ATTR_RO macro
dt-bindings: phy: convert rockchip-usb-phy.txt to YAML
phy: phy-rockchip-inno-usb2: add support for RK3308 USB phy
dt-bindings: phy: rockchip-inno-usb2: add compatible for rk3308 USB phy
phy: stm32: manage optional vbus regulator on phy_power_on/off
dt-bindings: phy: add vbus-supply optional property to phy-stm32-usbphyc
...
Vinod Koul [Wed, 23 Jun 2021 07:28:37 +0000 (12:58 +0530)]
phy: Revert "phy: ralink: Kconfig: convert mt7621-pci-phy into 'bool'"
This reverts commit
6eded551cefe ("phy: ralink: Kconfig: convert
mt7621-pci-phy into 'bool'") as we don't want drivers to be built in and
should be a module instead
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Greg Kroah-Hartman [Tue, 22 Jun 2021 20:03:25 +0000 (22:03 +0200)]
Merge tag 'icc-5.14-rc1' of git://git./linux/kernel/git/djakov/icc into char-misc-next
Georgi writes:
interconnect changes for 5.14
Here are changes for the 5.14-rc1 merge window consisting of interconnect
driver updates.
Driver changes:
- New driver for SC7280 platforms.
Signed-off-by: Georgi Djakov <djakov@kernel.org>
* tag 'icc-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/djakov/icc:
interconnect: qcom: Add SC7280 interconnect provider driver
dt-bindings: interconnect: Add Qualcomm SC7280 DT bindings
Tomas Winkler [Mon, 21 Jun 2021 19:37:56 +0000 (22:37 +0300)]
mei: revamp mei extension header structure layout.
The mei extension header was build as array of flexible structures
which will not work if actually more headers are added.
(Currently only vtag header was used).
Sparse reports:
drivers/misc/mei/hw.h:253:32: warning: array of flexible structures
Use basic type u8 for the variable sized extension.
Define explicitly mei_ext_hdr_vtag structure.
And also fix mei_ext_next() function to point correctly to the
end of the header.
Note: the headers are part of firmware interface and need to be __packed.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20210621193756.134027-2-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tamar Mashiah [Mon, 21 Jun 2021 19:37:55 +0000 (22:37 +0300)]
mei: fix kdoc in the driver
Over time the functions were renamed,
but this was not always reflected in kdoc, fix that.
Signed-off-by: Tamar Mashiah <tamar.mashiah@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20210621193756.134027-1-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Greg Kroah-Hartman [Tue, 22 Jun 2021 10:37:19 +0000 (12:37 +0200)]
Merge tag 'misc-habanalabs-next-2021-06-22' of https://git./linux/kernel/git/ogabbay/linux into char-misc-next
Oded writes:
This tag contains habanalabs driver changes for v5.14:
- Change communication protocol with f/w. The new protocl allows better
backward compatibility between different f/w versions and is more
stable.
- Send hard-reset cause to f/w after a hard-reset has happened.
- Move to indirection when generating interrupts to f/w.
- Better progress and error messages during the f/w load stage.
- Recognize that f/w is with enabled security according to device ID.
- Add validity check to event queue mechanism.
- Add new event from f/w that will indicate a daemon has been terminated
inside the f/w.
- Move to TLB cache range invalidation in the device's MMU.
- Disable memory scrubbing by default for performance.
- Many fixes for sparse/smatch reported errors.
- Enable by default stop-on-err in the ASIC.
- Move to ASYNC device probing to speedup loading of driver in server
with multiple devices.
- Fix to stop using disabled NIC ports when doing collective operation.
- Use standard error codes instead of positive values.
- Add support for resetting device after user has finished using it.
- Add debugfs option to avoid reset when a CS has got stuck.
- Add print of the last 8 CS pointers in case of error in QMANs.
- Add statistics on opening of the FD of a device.
* tag 'misc-habanalabs-next-2021-06-22' of https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux: (72 commits)
habanalabs/gaudi: refactor hard-reset related code
habanalabs/gaudi: add support for NIC DERR
habanalabs: add validity check for signal cs
habanalabs: get lower/upper 32 bits via masking
habanalabs: allow reset upon device release
debugfs: add skip_reset_on_timeout option
habanalabs: fix typo
habanalabs/gaudi: correct driver events numbering
habanalabs: remove a rogue #ifdef
habanalabs/gaudi: print last QM PQEs on error
habanalabs/goya: add '__force' attribute to suppress false alarm
habanalabs: added open_stats info ioctl
habanalabs/gaudi: set the correct rc in case of err
habanalabs/gaudi: update coresight configuration
habanalabs: remove node from list before freeing the node
habanalabs: set rc as 'valid' in case of intentional func exit
habanalabs: zero complex structures using memset
habanalabs: print more info when failing to pin user memory
habanalabs: Fix an error handling path in 'hl_pci_probe()'
habanalabs: print firmware versions
...
Greg Kroah-Hartman [Tue, 22 Jun 2021 10:36:29 +0000 (12:36 +0200)]
Merge tag 'soundwire-5.14-rc1' of git://git./linux/kernel/git/vkoul/soundwire into char-misc-next
Vinod writes:
soundwire updates for 5.14-rc1
Updates for v5.14-rc1 are:
- Core has odd updates including improving clock stop codes, write api,
handling ENODATA etc
- Drivers has Big move of Intel driver to be aux dev and minor updates
to Intel/cadence driver
* tag 'soundwire-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire:
soundwire: stream: Fix test for DP prepare complete
soundwire: bus: Make sdw_nwrite() data pointer argument const
soundwire: intel: move to auxiliary bus
soundwire: cadence: remove the repeated declaration
soundwire: dmi-quirks: remove duplicate initialization
soundwire: cadence_master: always set CMD_ACCEPT
soundwire: bus: add missing \n in dynamic debug
soundwire: bus: handle -ENODATA errors in clock stop/start sequences
soundwire: add missing kernel-doc description
soundwire: bus: only use CLOCK_STOP_MODE0 and fix confusions
soundwire: bandwidth allocation: improve error messages
soundwire/ASoC: add leading zeroes in peripheral device name
Stephan Gerhold [Thu, 3 Jun 2021 08:52:22 +0000 (10:52 +0200)]
extcon: sm5502: Add support for SM5504
SM5504 is another MUIC from Silicon Mitus that is fairly similar
to SM5502. They seem to use the same register set, but:
- SM5504 has some additional bits in SM5502_REG_CONTROL
- SM5504 has a quite different set of interrupts
- SM5504 reports USB OTG as dev_type1 = BIT(0) instead of BIT(7)
Overall it's minor and we can support this by defining a separate
struct sm5502_type for SM5504.
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Stephan Gerhold [Thu, 3 Jun 2021 08:52:21 +0000 (10:52 +0200)]
extcon: sm5502: Refactor driver to use chip-specific struct
Prepare for supporting SM5504 in the extcon-sm5502 driver by replacing
enum sm5504_types with a struct sm5504_type that stores the chip-specific
definitions. This struct can then be defined separately for SM5504
without having to add if (type == TYPE_SM5504) everywhere in the code.
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Stephan Gerhold [Fri, 4 Jun 2021 02:01:40 +0000 (11:01 +0900)]
dt-bindings: extcon: sm5502: Document siliconmitus,sm5504-muic
Document support for SM5504 with the new siliconmitus,sm5504-muic
compatible.
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Stephan Gerhold [Mon, 31 May 2021 13:34:36 +0000 (15:34 +0200)]
dt-bindings: extcon: sm5502: Convert to DT schema
Convert the extcon-sm5502 device tree bindings to DT schema.
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Stephan Gerhold [Mon, 31 May 2021 13:34:34 +0000 (15:34 +0200)]
extcon: sm5502: Implement i2c_driver->probe_new()
sm5022_muic_i2c_probe() does not use the i2c_device_id,
so implement i2c_driver->probe_new() instead of probe().
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Stephan Gerhold [Mon, 31 May 2021 13:34:33 +0000 (15:34 +0200)]
extcon: sm5502: Use devm_regmap_add_irq_chip()
Use devm_regmap_add_irq_chip() to avoid having to remove the
irqchip explicitly in sm5502_muic_i2c_remove().
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Marek Szyprowski [Fri, 23 Apr 2021 20:46:24 +0000 (22:46 +0200)]
extcon: max8997: Add missing modalias string
The platform device driver name is "max8997-muic", so advertise it
properly in the modalias string. This fixes automated module loading when
this driver is compiled as a module.
Fixes:
b76668ba8a77 ("Extcon: add MAX8997 extcon driver")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Stephan Gerhold [Mon, 31 May 2021 13:34:35 +0000 (15:34 +0200)]
extcon: sm5502: Drop invalid register write in sm5502_reg_data
When sm5502_init_dev_type() iterates over sm5502_reg_data to
initialize the registers it is limited by ARRAY_SIZE(sm5502_reg_data).
There is no need to add another empty element to sm5502_reg_data.
Having the additional empty element in sm5502_reg_data will just
result in writing 0xff to register 0x00, which does not really
make sense.
Fixes:
914b881f9452 ("extcon: sm5502: Add support new SM5502 extcon device driver")
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Ferry Toth [Tue, 18 May 2021 21:27:09 +0000 (23:27 +0200)]
extcon: intel-mrfld: Sync hardware and software state on init
extcon driver for Basin Cove PMIC shadows the switch status used for dwc3
DRD to detect a change in the switch position. This change initializes the
status at probe time.
Cc: stable@vger.kernel.org
Fixes:
492929c54791 ("extcon: mrfld: Introduce extcon driver for Basin Cove PMIC")
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Ferry Toth <ftoth@exalondelft.nl>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Koby Elbaz [Tue, 15 Jun 2021 14:07:02 +0000 (17:07 +0300)]
habanalabs/gaudi: refactor hard-reset related code
There is code related to hard-reset, which is done in gaudi specific
code. However, this code can be used by future ASICs and therefore it
is better to move it to the common code section.
Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ofir Bitton [Thu, 17 Jun 2021 06:52:55 +0000 (09:52 +0300)]
habanalabs/gaudi: add support for NIC DERR
We add support for NIC DERR ECC error events, in case this error
is received a device reset will be performed.
Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
farah kassabri [Tue, 1 Jun 2021 13:44:28 +0000 (16:44 +0300)]
habanalabs: add validity check for signal cs
In preparation for a new feature that allows the user to reserve
signals ahead of submissions, we need to change a current assumption
in the code.
Currently, the driver uses 2 SOBs to support signal CS. When the first
SOB reaches max value, the driver switches to the other one and assumes
that when it will need to switch back to the first one, all of the
signals have already been handled.
This assumption won't hold when the new feature will be added, because
using signal reservation, the driver can reach the max SOB value very
fast.
The change is to add a validity check when submitting a signal CS, to
make sure the previous SOB is available (all the signals attached to
it indeed finished).
Signed-off-by: farah kassabri <fkassabri@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Koby Elbaz [Thu, 17 Jun 2021 14:04:16 +0000 (17:04 +0300)]
habanalabs: get lower/upper 32 bits via masking
fix multiple similar occurrences of the following sparse warning:
'warning: cast truncates bits from constant value
(
7ffc113000 becomes
fc113000)'
Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ofir Bitton [Tue, 8 Jun 2021 14:24:52 +0000 (17:24 +0300)]
habanalabs: allow reset upon device release
We introduce a new type of reset which is reset upon device release.
This reset is very similar to soft reset except the fact it is
performed only upon device release and not upon user sysfs request
nor TDR.
The purpose of this reset is to make sure the device is returned to
IDLE state after the current user has finished working with 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>
Christophe JAILLET [Sat, 5 Jun 2021 13:17:43 +0000 (15:17 +0200)]
phy: ti: dm816x: Fix the error handling path in 'dm816x_usb_phy_probe()
Add an error handling path in the probe to release some resources, as
already done in the remove function.
Fixes:
609adde838f4 ("phy: Add a driver for dm816x USB PHY")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/ac5136881f6bdec50be19b3bf73b3bc1b15ef1f1.1622898974.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Kunihiko Hayashi [Mon, 7 Jun 2021 03:50:42 +0000 (12:50 +0900)]
phy: uniphier-pcie: Fix updating phy parameters
The current driver uses a value from register TEST_O as the original
value for register TEST_I, though, the value is overwritten by "param",
so there is a bug that the original value isn't no longer used.
The value of TEST_O[7:0] should be masked with "mask", replaced with
"param", and placed in the bitfield TESTI_DAT_MASK as new TEST_I value.
Fixes:
c6d9b1324159 ("phy: socionext: add PCIe PHY driver support")
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Link: https://lore.kernel.org/r/1623037842-19363-1-git-send-email-hayashi.kunihiko@socionext.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Heiko Stuebner [Thu, 10 Jun 2021 21:29:35 +0000 (23:29 +0200)]
phy/rockchip: add Innosilicon-based CSI dphy
The CSI dphy found for example on the rk3326/px30 and rk3368 is based
on an IP design from Innosilicon. Add a driver for it.
Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Link: https://lore.kernel.org/r/20210610212935.3520341-3-heiko@sntech.de
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Heiko Stuebner [Thu, 10 Jun 2021 21:29:34 +0000 (23:29 +0200)]
dt-bindings: phy: add yaml binding for rockchip-inno-csi-dphy
Some Rockchip SoCs like the rk3368, rk3326, px30 use a CSI dphy
based on an Innosilicon IP. Add a binding for them.
Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210610212935.3520341-2-heiko@sntech.de
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Colin Ian King [Wed, 9 Jun 2021 11:39:01 +0000 (12:39 +0100)]
phy: rockchip: remove redundant initialization of pointer cfg
The pointer cfg is being initialized with a value that is never read and
it is being updated later with a new value. The initialization is
redundant and can be removed.
Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210609113901.185230-1-colin.king@canonical.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Richard Fitzgerald [Fri, 18 Jun 2021 14:47:45 +0000 (15:47 +0100)]
soundwire: stream: Fix test for DP prepare complete
In sdw_prep_deprep_slave_ports(), after the wait_for_completion()
the DP prepare status register is read. If this indicates that the
port is now prepared, the code should continue with the port setup.
It is irrelevant whether the wait_for_completion() timed out if the
port is now ready.
The previous implementation would always fail if the
wait_for_completion() timed out, even if the port was reporting
successful prepare.
This patch also fixes a minor bug where the return from sdw_read()
was not checked for error - any error code with LSBits clear could
be misinterpreted as a successful port prepare.
Fixes:
79df15b7d37c ("soundwire: Add helpers for ports operations")
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210618144745.30629-1-rf@opensource.cirrus.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Richard Fitzgerald [Wed, 16 Jun 2021 14:59:01 +0000 (15:59 +0100)]
soundwire: bus: Make sdw_nwrite() data pointer argument const
Idiomatically, write functions should take const pointers to the
data buffer, as they don't change the data. They are also likely
to be called from functions that receive a const data pointer.
Internally the pointer is passed to function/structs shared with
the read functions, requiring a cast, but this is an implementation
detail that should be hidden by the public API.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210616145901.29402-1-rf@opensource.cirrus.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Yuri Nudelman [Sun, 13 Jun 2021 06:22:20 +0000 (09:22 +0300)]
debugfs: add skip_reset_on_timeout option
To be able to debug long-running CS better, without changing the
userspace code, we are adding a new option through debugfs interface
to skip the reset of the device in case of CS timeout.
Signed-off-by: Yuri Nudelman <ynudelman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Zvika Yehudai [Tue, 15 Jun 2021 11:12:20 +0000 (14:12 +0300)]
habanalabs: fix typo
fix a spelling error in comment
Signed-off-by: Zvika Yehudai <zyehudai@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ofir Bitton [Mon, 7 Jun 2021 12:22:56 +0000 (15:22 +0300)]
habanalabs/gaudi: correct driver events numbering
Currently driver sends fc interrupt id to FW instead of using
cpu interrupt id. We intend to fix that and keep backward
compatibility by using the same interrupt values.
Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Oded Gabbay [Tue, 15 Jun 2021 09:00:38 +0000 (12:00 +0300)]
habanalabs: remove a rogue #ifdef
There was a rogue #ifdef that crept into the upstream code for
backwards compatibility which isn't needed of course.
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ohad Sharabi [Mon, 24 May 2021 06:59:31 +0000 (09:59 +0300)]
habanalabs/gaudi: print last QM PQEs on error
In case QMAN has an error and stop_on_err is true, print specific
information of the "offending" command buffer batch.
If the error occurred on one of the higher CPs, the CQ pointer and size
will be printed along with (up to) last 8 PQEs of the stream.
If the error occurred in the lower CP, the CQ pointer and size will be
printed along with (up to) last 8 PQEs of ALL upper CPs as we have no
way to know which upper CP sent the job there.
This is done so higher SW levels will be able to debug their CS by
extracting the raw data of the offending command buffer batch and
examine those offline to detect the issue.
Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Koby Elbaz [Mon, 14 Jun 2021 05:06:15 +0000 (08:06 +0300)]
habanalabs/goya: add '__force' attribute to suppress false alarm
fix (suppress) the following sparse warnings:
'warning: cast removes address space of expression'
Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Yuri Nudelman [Mon, 24 May 2021 08:25:21 +0000 (11:25 +0300)]
habanalabs: added open_stats info ioctl
In a system with multiple ASICs, there is a need to provide monitoring
tools with information on how long a device was opened and how many
times a device was opened.
Therefore, we add a new opcode to the INFO ioctl to provide that
information.
Signed-off-by: Yuri Nudelman <ynudelman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Koby Elbaz [Thu, 10 Jun 2021 06:14:43 +0000 (09:14 +0300)]
habanalabs/gaudi: set the correct rc in case of err
fix the following smatch warnings:
gaudi_internal_cb_pool_init() warn: missing error code 'rc'
Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Tal Albo [Thu, 10 Jun 2021 09:18:37 +0000 (12:18 +0300)]
habanalabs/gaudi: update coresight configuration
Update STMTCSR and STMSYNCR values in order to reduce amount of sync
packets
Signed-off-by: Tal Albo <talbo@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Koby Elbaz [Wed, 9 Jun 2021 18:43:52 +0000 (21:43 +0300)]
habanalabs: remove node from list before freeing the node
fix the following smatch warnings:
goya_pin_memory_before_cs()
warn: '&userptr->job_node' not removed from list
gaudi_pin_memory_before_cs()
warn: '&userptr->job_node' not removed from list
Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Koby Elbaz [Thu, 10 Jun 2021 06:01:57 +0000 (09:01 +0300)]
habanalabs: set rc as 'valid' in case of intentional func exit
fix the following smatch warnings:
hl_fw_static_init_cpu() warn: missing error code 'rc'
Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Koby Elbaz [Thu, 10 Jun 2021 12:09:54 +0000 (15:09 +0300)]
habanalabs: zero complex structures using memset
fix the following sparse warnings:
'warning: Using plain integer as NULL pointer'
'warning: missing braces around initializer'
Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Tomer Tayar [Thu, 10 Jun 2021 17:48:39 +0000 (20:48 +0300)]
habanalabs: print more info when failing to pin user memory
pin_user_pages_fast() might fail and return a negative number, or pin
less pages than requested and return the number of the pages that were
pinned.
For the latter, it is informative to print also the memory size and the
number of requested pages.
Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Christophe JAILLET [Sat, 12 Jun 2021 05:39:51 +0000 (07:39 +0200)]
habanalabs: Fix an error handling path in 'hl_pci_probe()'
If an error occurs after a 'pci_enable_pcie_error_reporting()' call, it
must be undone by a corresponding 'pci_disable_pcie_error_reporting()'
call, as already done in the remove function.
Fixes:
2e5eda4681f9 ("habanalabs: PCIe Advanced Error Reporting support")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Oded Gabbay [Wed, 9 Jun 2021 07:04:35 +0000 (10:04 +0300)]
habanalabs: print firmware versions
Firmware in habanalabs devices is composed of several components.
During device initialization, we read these versions from the device.
Print them during device initialization to allow better visibility in
automated systems.
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Omer Shpigelman [Wed, 9 Jun 2021 07:17:49 +0000 (10:17 +0300)]
habanalabs: add hard reset timeout for PLDM
Hard reset flow on PLDM might take more than 2 minutes.
Hence add a dedicated hard reset timeout of 6 minutes for PLDM.
Signed-off-by: Omer Shpigelman <oshpigelman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Bharat Jauhari [Fri, 28 May 2021 10:14:34 +0000 (13:14 +0300)]
habanalabs: enable dram scramble before linux f/w
In current code, for dynamic f/w loading flow, DRAM scrambling is
enabled post Linux fit image is loaded to the card. This can cause the
device CPU to go into reset state.
The correct sequence should be:
1. Load boot fit image
2. Enable scrambling
3. Load Linux fit image
This commit aligns the DRAM scrambling enabling with the static f/w load
flow.
Signed-off-by: Bharat Jauhari <bjauhari@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ofir Bitton [Thu, 11 Feb 2021 09:09:12 +0000 (11:09 +0200)]
habanalabs: enable stop on error for all QMANs and engines
If there is an error in the QMAN/engine, there is no point of trying
to continue running the workload. It is better to stop to allow the
user to debug the program.
Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ohad Sharabi [Sun, 6 Jun 2021 19:38:23 +0000 (22:38 +0300)]
habanalabs: report EQ fault during heartbeat
In case we have EQ fault we would like to know about it.
For this, a status bitmask was added in which EQ_FAULT bit is
set by FW in case of EQ fault.
Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Koby Elbaz [Thu, 3 Jun 2021 10:18:20 +0000 (13:18 +0300)]
habanalabs: small code refactoring
Use datatype defines instead of hard coded values,
and rename set_fixed_properties function.
Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Oded Gabbay [Sun, 6 Jun 2021 08:38:12 +0000 (11:38 +0300)]
habanalabs/gaudi: use standard error codes
When there is an ECC error in the HBM, return a standard error code,
-EIO in this case, and not a positive value.
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ohad Sharabi [Wed, 2 Jun 2021 21:24:32 +0000 (00:24 +0300)]
habanalabs: fix mask to obtain page offset
When converting virtual address to physical we need to add correct
offset to the physical page.
For this we need to use mask that include ALL bits of page offset.
Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ohad Sharabi [Sat, 29 May 2021 20:26:10 +0000 (23:26 +0300)]
habanalabs: skip valid test for boot_dev_sts regs
Get rid of the need to check if boot_dev_sts is valid on every access
to value read from these registers.
This is done by storing the register value in hdev props ONLY if
register is enabled.
This way if register is NOT enabled all capability bits will not be set.
Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ofir Bitton [Thu, 20 May 2021 10:30:31 +0000 (13:30 +0300)]
habanalabs: reset device upon FD close if not idle
If device is not idle after user closes the FD we must reset device
as next user that will try to open FD will encounter a non-functional
device.
Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Yuri Nudelman [Tue, 25 May 2021 11:49:52 +0000 (14:49 +0300)]
habanalabs: add debug flag to prevent failure on timeout
Sometimes it is useful to allow the command to continue running despite
the timeout occurred, to differentiate between really stuck or just very
time consuming commands. This can be achieved by passing a new debug
flag alongside the cs, HL_CS_FLAGS_SKIP_RESET_ON_TIMEOUT.
Anyway, if the timeout occurred, a warning print shall be issued,
however this shall not fail the submission.
Signed-off-by: Yuri Nudelman <ynudelman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ofir Bitton [Wed, 2 Jun 2021 08:56:31 +0000 (11:56 +0300)]
habanalabs/gaudi: add FW alive event support
In order for driver to be aware of process or thread crashes inside
GAUDI's CPU, we introduce a new event which contains all relevant
information. Upon event reception, driver will dump information and
will reset 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>
Ofir Bitton [Mon, 24 May 2021 19:58:44 +0000 (22:58 +0300)]
habanalabs/gaudi: don't use disabled ports in collective wait
In the collective wait, we put jobs on the QMANs of all the NICs. The
code takes into account if a port is disabled only in case of PCI card.
When this info arrives from the f/w, the code doesn't take it into
account, and it tries to schedule jobs on NICs that aren't enabled and
thats a bug.
To fix this, after the f/w sends us the list of disabled ports, we
update the state of the QMANs according to that list. In addition,
we need to update the HW_CAP bits so the collective wait operation
will not try to use those QMANs. We also need to update the collective
master monitor mask.
Moreover, we need to add a protection for such future cases and in case
the user will try to submit work to those QMANs.
Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Oded Gabbay [Mon, 31 May 2021 14:01:43 +0000 (17:01 +0300)]
habanalabs/gaudi: update to latest f/w specs
Update the firmware interface files to their latest version.
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ofir Bitton [Tue, 25 May 2021 19:09:13 +0000 (22:09 +0300)]
habanalabs/gaudi: split host irq interfaces towards FW
Current implementation uses a single interrupt interface towards
FW, this interface is causing races between interrupt types.
We split this interface to interface per interrupt type.
Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Oded Gabbay [Wed, 26 May 2021 08:14:21 +0000 (11:14 +0300)]
habanalabs: prefer ASYNC device probing
There is no dependency when probing multiple devices so indicate to the
kernel that it can probe our devices in ASYNC fashion.
This shortens insmod of the driver from ~2 minutes to 20 seconds on
a system with 8 devices.
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Tomer Tayar [Mon, 24 May 2021 19:35:06 +0000 (22:35 +0300)]
habanalabs/gaudi: add ARB to QM stop on error masks
Update the QM stop on error masks to also stop on ARB errors.
Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Oded Gabbay [Tue, 25 May 2021 18:35:13 +0000 (21:35 +0300)]
habanalabs/gaudi: don't use nic_ports_mask in compute
nic_ports_mask is used by the networking part of the driver.
In the compute part, we use the HW_CAP bits to select what is active
and what is not.
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Koby Elbaz [Wed, 19 May 2021 12:16:52 +0000 (15:16 +0300)]
habanalabs/gaudi: set the correct cpu_id on MME2_QM failure
This fix was applied since there was an incorrect reported CPU ID to GIC
such that an error in MME2 QMAN aliased to be an arriving from DMA0_QM.
Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Oded Gabbay [Sun, 23 May 2021 16:00:49 +0000 (19:00 +0300)]
habanalabs/gaudi: refactor reset code
After all the latest changes to the reset code, there were some
redundancy and errors in the flows.
If the Linux FIT is loaded to the ASIC CPU, we need to communicate
with it only via GIC. If it is not loaded, we need to either use
COMMS protocol (for newer f/w) or MSG_TO_CPU register (for older f/w).
In addition, if we halted the device CPU then we need to mark that
the driver will do the reset, regardless of the capabilities.
Also, to prevent false errors, we need to keep track whether the
device CPU was already halted. If so, we shouldn't try to halt it
again.
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ohad Sharabi [Thu, 20 May 2021 06:09:03 +0000 (09:09 +0300)]
habanalabs: track security status using positive logic
Using negative logic (i.e. fw_security_disabled) is confusing.
Modify the flag to use positive logic (fw_security_enabled).
Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Koby Elbaz [Thu, 20 May 2021 09:45:58 +0000 (12:45 +0300)]
habanalabs/gaudi: use COMMS to reset device / halt CPU
This is needed because legacy FW 'communication' protocol will soon
become obsolete.
Because COMMS is a boot protocol, communicating through it is supported
only until Linux is loaded to the device CPU, where in that case we
will fallback to the former implementation.
Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Koby Elbaz [Tue, 18 May 2021 12:43:47 +0000 (15:43 +0300)]
habanalabs/gaudi: disable GIC usage if security is enabled
Security is set based on PCI ID, and after reading preboot status bits.
GIC usage is set in both scenarios since GIC can't be used when security
is enabled.
Moreover, writing to GIC/SP is enabled only after Linux is fully loaded.
Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Koby Elbaz [Tue, 18 May 2021 12:05:35 +0000 (15:05 +0300)]
habanalabs: read preboot status bits in an earlier stage
On newer releases, host won't be able to trigger an interrupt directly
to the ASIC GIC controller.
To be able to decide whether GIC can/not be used, we must read device's
preboot status bits in a stage that precedes the possible first use of
GIC (when device is in dirty state).
Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Oded Gabbay [Wed, 19 May 2021 11:52:14 +0000 (14:52 +0300)]
habanalabs: check running index in eqe control
To harden the event queue mechanism, we add a running index to the
control header of the entry.
The firmware writes the index in each entry and the driver verifies
that the index of the current entry is larger by 1 of the index of
the previous entry.
In case it isn't, the driver will treat the entry as if it wasn't
valid (it won't process it but won't skip it).
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Oded Gabbay [Wed, 12 May 2021 17:46:12 +0000 (20:46 +0300)]
habanalabs: set memory scrubbing to disabled by default
Scrubbing memory after every unmap is very costly in terms of
performance. If a user wants it he can enable it but the default
should prioritize performance.
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ofir Bitton [Wed, 12 May 2021 06:07:39 +0000 (09:07 +0300)]
habanalabs/gaudi: do not move HBM bar if iATU done by FW
As iATU configuration is done by FW, driver should not try and
move HBM bar.
Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Koby Elbaz [Wed, 12 May 2021 15:05:46 +0000 (18:05 +0300)]
habanalabs/gaudi: read GIC sts after FW is loaded
Reading of GIC privileged status will be done after F/W is loaded,
because privileged GIC capability is only available with the correct
ARMCP version, and after it's loaded.
Such versions necessarily support COMMS, so GIC alternatives (SP regs)
will be read directly from dynamic regs.
As well, initiation of DMA QMANs will occur after F/W is loaded
since it depends on GIC configuration.
In case F/W isn't loaded there's no problem since either way
there won't be any GIC IRQ handling.
Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ohad Sharabi [Tue, 11 May 2021 13:02:41 +0000 (16:02 +0300)]
habanalabs: check if asic secured with asic type
Fix issue in which the input to the function is_asic_secured was device
PCI_IDS number instead of the asic_type enumeration.
Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Koby Elbaz [Tue, 4 May 2021 17:10:47 +0000 (20:10 +0300)]
habanalabs/gaudi: send hard reset cause to preboot
LKD should provide hard reset cause to preboot prior to
loading any FW components (in case needed).
Current implementation is based on the new FW 'COMMS' protocol
In cased 'COMMS' is disabled - reset cause won't be sent.
Currently, only 2 reset causes are shared: HEARTBEAT & TDR.
Sending the reset cause will provide the missing watchdog
info that the firmware needs to provide to the BMC.
Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Oded Gabbay [Sun, 9 May 2021 06:49:36 +0000 (09:49 +0300)]
habanalabs: notify before f/w loading
An information print notifying on starting to load the f/w was removed
by mistake when moving to the new dynamic f/w loading mechanism.
Restore that print as the F/W loading usually takes between 10 to 20
seconds and this print helps the user know the status of the driver
load.
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Koby Elbaz [Mon, 3 May 2021 20:03:15 +0000 (23:03 +0300)]
habanalabs/gaudi: use scratchpad regs instead of GIC controller
Due to new security restrictions, GIC controller can no
longer be accessed from user/kernel.
To monitor that, a new status bit will be read from preboot
caps, indicating whether direct access to GIC is blocked.
In case it is blocked, driver will use scratchpad registers
instead of using GIC interface on two main scenarios:
The first of which LKD triggers interrupts to F/W through GIC,
and the second of when LKD configures all engines/QMANs
to write to GIC when they want to report an error.
From F/W perspective, it will poll on all SPs, and once IRQ
number is retrieved, SP register is cleared, and it will perform the
write to the GIC to trigger the IRQ handler.
Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ohad Sharabi [Sun, 2 May 2021 12:45:21 +0000 (15:45 +0300)]
habanalabs: read f/w's 2-nd sts and err registers
Maintain both STS1 and ERR1 registers used for status communication
with F/W.
Those are not maintained as we currently have less than 31
statuses/error defined and so LKD did not refer to those register.
The reason to read them now is to try to support future f/w versions
with current driver.
Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ohad Sharabi [Mon, 3 May 2021 06:44:22 +0000 (09:44 +0300)]
habanalabs: avoid using uninitialized pointer
When attempting to read FW component's version we should break if input
FW component is invalid in order to avoid using uninitialized
destination pointer.
Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ohad Sharabi [Sun, 2 May 2021 06:56:51 +0000 (09:56 +0300)]
habanalabs: set dma mask from fw once fw done iatu config
When setting "DMA mask from FW" we are reading PSOC_GLOBAL_CONF register
which is allowed only once FW has done it's iATU configuration.
Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Oded Gabbay [Sun, 2 May 2021 09:28:48 +0000 (12:28 +0300)]
habanalabs: better error print for pin failure
Print the user given pointer and error code on failure to get user
pages for easier debugging.
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Omer Shpigelman [Thu, 29 Apr 2021 19:29:29 +0000 (22:29 +0300)]
habanalabs: add missing space after casting
Change casting code according to kernel coding style.
Signed-off-by: Omer Shpigelman <oshpigelman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Oded Gabbay [Thu, 29 Apr 2021 13:50:05 +0000 (16:50 +0300)]
habanalabs: ignore device unusable status
Some users might want to implement their own policy of when the device
is unusable so we need to ignore this status in the driver and continue
loading as normal.
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ohad Sharabi [Thu, 22 Apr 2021 07:01:22 +0000 (10:01 +0300)]
habanalabs: load linux image to device
Implementing dynamic linux image load to the device.
This patch also implements the FW communication steps during the
boot-fit.
This patch also enables the dynamic protocol based on the compatibility
flag.
Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ohad Sharabi [Sun, 11 Apr 2021 07:32:18 +0000 (10:32 +0300)]
habanalabs: load boot fit to device
Implementing dynamic boot fit image load to the device.
Note that some necessary adjustment were added to the static loader as
well so that both loaders can co-exist.
as this is not the final FW load stage the dynamic FW load is still
forced to be non functional.
Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Oded Gabbay [Mon, 26 Apr 2021 15:32:25 +0000 (18:32 +0300)]
habanalabs: use dev_dbg upon hint address failure
Hint address failure that results in a valid mapping with an address
that was allocated by the driver is not a real failure.
Therefore, the driver shouldn't notify about this in kernel log. The
user is responsible to check the returned address.
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Guy Nisan [Wed, 7 Apr 2021 15:31:29 +0000 (18:31 +0300)]
habanalabs: modify progress status messages
Indicate "progress" instead of "error" when reporting progress status.
Change "u-boot stopped by user" to "Cannot boot" message as
CPU_BOOT_STATUS_UBOOT_NOT_READY may indicate a fatal error that prevent
u-boot from loading firmware.
Signed-off-by: Guy Nisan <gnisan@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ofir Bitton [Tue, 20 Apr 2021 07:15:25 +0000 (10:15 +0300)]
habanalabs: give FW a grace time for configuring iATU
iATU (internal Address Translation Unit of the PCI controller)
configuration is being done by FW right after driver enables
the PCI device. Hence, driver must add a minor sleep afterwards
in order to make sure FW finishes configuring iATU regions.
Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Oded Gabbay [Fri, 23 Apr 2021 12:57:39 +0000 (15:57 +0300)]
habanalabs: update to latest f/w headers
Update the common and GAUDI firmware header files to the latest version.
The latest version use the correct endianness types so this commit also
contains minor changes to the code to use the correct conversions when
reading/writing to the firmware structures.
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ohad Sharabi [Wed, 21 Apr 2021 10:03:21 +0000 (13:03 +0300)]
habanalabs: expose ASIC specific PCI info to common code
LKD has interfaces in which it receives device address.
For instance the debugfs_read/write variants receives device address for
CFG/SRAM/DRAM for read/write and need to translate to the mapped PCI BAR
address.
In addition, the dynamic FW load protocol dictates that the address to
which the LKD will copy the image for the next FW component will be
received as a device address and can be placed either in SRAM or DRAM.
We need to distinguish those regions as the access methods to those
regions are different (in DRAM we possibly need to set the BAR base).
Looking forward this code will be used to remove duplicated code in the
debugfs_read/write that search the memory region for the input device
address.
Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Ohad Sharabi [Thu, 8 Apr 2021 10:42:00 +0000 (13:42 +0300)]
habanalabs: dynamic fw load reset protocol
First stage of the dynamic FW load protocol is to reset the protocol to
avoid residues from former load cycles.
Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>