scsi: Add LeapRAID driver support
Subsystems (3)
Dongdong Hao
maintainerv5 cover scsi: Add LeapRAID driver support
This series adds the LeapRAID driver and its documentation.
This version addresses issues reported by Sashiko and the kernel test robot, as well as issues identified through internal testing. Because [PATCH v4 1/2] exceeded the line-count limit of the public Sashiko service, it was not analyzed. We therefore deployed Sashiko locally with an increased line-count limit to complete the analysis and have fixed all identified issues.
Changes in v5:
[PATCH v5 1/2] scsi: leapraid: Add new SCSI driver
- Fix /dev/leapraid_ctl adapter lifetime races during concurrent probe and removal.
- Fix firmware log mmap teardown by tracking active VMAs.
- Fix passthrough data_sge_offset validation to prevent overwrites.
- Validate asynchronous firmware event lengths to prevent out-of-bounds accesses.
- Fix SMP passthrough payload validation to prevent size_t underflow.
- Fix teardown races among event queuing, host removal, and IRQ handling.
- Fix MSI-X CPU mapping for sparse CPU IDs by using nr_cpu_ids.
- Make host-memory cleanup idempotent to prevent double cleanup.
- Initialize the internal SCSI command mutex earlier to ensure safe error-path cleanup.
- Fix Clang -Wunaligned-access warnings for packed SGE structures and related cases.
- Add the missing unwind path in leapraid_request_host_memory() and fix related error-path issues.
- Prevent nested hard resets during asynchronous recovery to avoid deadlocks.
- Remove periodic timestamp synchronization.
[PATCH v5 2/2] scsi: leapraid: Add documentation
- Document the actual enable_mp module parameter instead of enable_mpio.
- Drop SMART polling, which remains available only in the vendor driver.
- Remove the custom sas_address sysfs attribute, as it is provided by the SAS transport class.
- Drop the user-selectable interrupt_mode and msix_disable parameters.
- Rename the NCQ parameter to ncq_cmd_prio_enable for clarity.
Review tags collected
=====================
1/2 Reviewed-by: Damien Le Moal [email protected] (given on v2) Reviewed-by: Hannes Reinecke [email protected] (given on v5) 2/2 Reviewed-by: Damien Le Moal [email protected] (given on v2) Reviewed-by: Hannes Reinecke [email protected] (given on v5)
Dongdong Hao (2):
scsi: leapraid: Add new SCSI driver
scsi: leapraid: Add driver documentation
Documentation/scsi/index.rst | 1 + Documentation/scsi/leapraid.rst | 110 + MAINTAINERS | 7 + drivers/scsi/Kconfig | 1 + drivers/scsi/Makefile | 1 + drivers/scsi/leapraid/Kconfig | 14 + drivers/scsi/leapraid/Makefile | 10 + drivers/scsi/leapraid/leapraid.h | 2048 +++++ drivers/scsi/leapraid/leapraid_app.c | 803 ++ drivers/scsi/leapraid/leapraid_func.c | 8626 ++++++++++++++++++++ drivers/scsi/leapraid/leapraid_func.h | 1486 ++++ drivers/scsi/leapraid/leapraid_os.c | 2468 ++++++ drivers/scsi/leapraid/leapraid_transport.c | 1403 ++++ 13 files changed, 16978 insertions(+) create mode 100644 Documentation/scsi/leapraid.rst create mode 100644 drivers/scsi/leapraid/Kconfig create mode 100644 drivers/scsi/leapraid/Makefile create mode 100644 drivers/scsi/leapraid/leapraid.h create mode 100644 drivers/scsi/leapraid/leapraid_app.c create mode 100644 drivers/scsi/leapraid/leapraid_func.c create mode 100644 drivers/scsi/leapraid/leapraid_func.h create mode 100644 drivers/scsi/leapraid/leapraid_os.c create mode 100644 drivers/scsi/leapraid/leapraid_transport.c
Signature · 1 line
2.25.1
Dongdong Hao
maintainerPATCH v5 1/2 scsi: leapraid: Add new SCSI driver
The LeapRAID driver provides support for LeapRAID PCIe RAID controllers, enabling communication between the host operating system, firmware, and hardware for efficient storage management.
The driver is organized into several logical modules, each with a clear responsibility:
leapraid_os.c: Integrates with the Linux SCSI subsystem, handling host template callbacks, PCIe device probing, and initialization.
leapraid_func.c: Contains low-level routines for firmware/hardware interaction, interrupt handling, and reset logic.
leapraid_app.c: Provides the ioctl interface for user-space tools.
leapraid_transport.c: Manages interactions with the SCSI transport layer for SAS PHYs and ports.
leapraid_func.h: Contains internal definitions shared among driver modules.
leapraid.h: Contains low-level hardware definitions for driver/firmware interaction.
The leapraid_probe() function orchestrates the setup: it allocates the adapter structure and SCSI host, configures hardware interfaces, and registers it with the SCSI mid-layer. Following registration, scsi_scan_host() is invoked to initiate device discovery, with firmware reporting devices via interrupt-driven events.
This initial commit provides the necessary infrastructure for subsequent development of full I/O path handling, error recovery, and advanced management features.
--- MAINTAINERS | 7 + drivers/scsi/Kconfig | 1 + drivers/scsi/Makefile | 1 + drivers/scsi/leapraid/Kconfig | 14 + drivers/scsi/leapraid/Makefile | 10 + drivers/scsi/leapraid/leapraid.h | 2048 +++++ drivers/scsi/leapraid/leapraid_app.c | 803 ++ drivers/scsi/leapraid/leapraid_func.c | 8626 ++++++++++++++++++++ drivers/scsi/leapraid/leapraid_func.h | 1486 ++++ drivers/scsi/leapraid/leapraid_os.c | 2468 ++++++ drivers/scsi/leapraid/leapraid_transport.c | 1403 ++++ 11 files changed, 16867 insertions(+) create mode 100644 drivers/scsi/leapraid/Kconfig create mode 100644 drivers/scsi/leapraid/Makefile create mode 100644 drivers/scsi/leapraid/leapraid.h create mode 100644 drivers/scsi/leapraid/leapraid_app.c create mode 100644 drivers/scsi/leapraid/leapraid_func.c create mode 100644 drivers/scsi/leapraid/leapraid_func.h create mode 100644 drivers/scsi/leapraid/leapraid_os.c create mode 100644 drivers/scsi/leapraid/leapraid_transport.c
MAINTAINERS +7 -0
@@ -14650,6 +14650,13 @@ S: Maintained T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening F: scripts/leaking_addresses.pl +LEAPIO SCSI RAID DRIVER +M: Dongdong Hao <[email protected]> +L: [email protected] +S: Supported +F: Documentation/scsi/leapraid.rst +F: drivers/scsi/leapraid/ + LED SUBSYSTEM M: Lee Jones <[email protected]> M: Pavel Machek <[email protected]>
drivers/scsi/Kconfig +1 -0
@@ -499,6 +499,7 @@ source "drivers/scsi/esas2r/Kconfig" source "drivers/scsi/megaraid/Kconfig.megaraid" source "drivers/scsi/mpt3sas/Kconfig" source "drivers/scsi/mpi3mr/Kconfig" +source "drivers/scsi/leapraid/Kconfig" source "drivers/scsi/smartpqi/Kconfig" config SCSI_HPTIOP
drivers/scsi/Makefile +1 -0
@@ -91,6 +91,7 @@ obj-$(CONFIG_SCSI_BFA_FC) += bfa/ obj-$(CONFIG_SCSI_CHELSIO_FCOE) += csiostor/ obj-$(CONFIG_SCSI_DMX3191D) += dmx3191d.o obj-$(CONFIG_SCSI_HPSA) += hpsa.o +obj-$(CONFIG_SCSI_LEAPRAID) += leapraid/ obj-$(CONFIG_SCSI_SMARTPQI) += smartpqi/ obj-$(CONFIG_SCSI_SYM53C8XX_2) += sym53c8xx_2/ obj-$(CONFIG_SCSI_ZALON) += zalon7xx.o
drivers/scsi/leapraid/Kconfig new file +14 -0
@@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +config SCSI_LEAPRAID + tristate "LeapIO RAID Adapter" + depends on PCI && SCSI + select SCSI_SAS_ATTRS + help + This driver supports LeapIO PCIe-based storage + and RAID controllers. + + <http://www.leap-io.com> + + To compile this driver as a module, choose M here: the + resulting kernel module will be named leapraid.
drivers/scsi/leapraid/Makefile new file +10 -0
@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for the LEAPRAID drivers. +# + +obj-$(CONFIG_SCSI_LEAPRAID) += leapraid.o +leapraid-objs += leapraid_func.o \ + leapraid_os.o \ + leapraid_transport.o \ + leapraid_app.o
drivers/scsi/leapraid/leapraid.h new file +2048 -0
2,048 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_app.c new file +803 -0
803 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_func.c new file +8626 -0
98 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_func.h new file +1486 -0
1,486 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_os.c new file +2468 -0
2,468 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_transport.c new file +1403 -0
1,403 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.25.1
Part of the diff is not shown here. View the raw message.
Dongdong Hao
maintainerPATCH v5 2/2 scsi: leapraid: Add driver documentation
In reply to Dongdong HaoThis patch adds the necessary documentation for the LeapRAID SCSI driver to the kernel's documentation tree.
--- Documentation/scsi/index.rst | 1 + Documentation/scsi/leapraid.rst | 110 ++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 Documentation/scsi/leapraid.rst
Documentation/scsi/index.rst +1 -0
@@ -56,6 +56,7 @@ SCSI host adapter drivers g_NCR5380 hpsa hptiop + leapraid libsas lpfc megaraid
Documentation/scsi/leapraid.rst new file +110 -0
110 lines not on this page · raw message
Signature · 1 line
2.25.1
[email protected]
AI reviewRe: [PATCH v5 2/2] scsi: leapraid: Add driver documentation
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] The driver introduces a non-standard sysfs attribute `ncq_cmd_prio_enable` for NCQ priority…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The driver introduces a non-standard sysfs attribute ncq_cmd_prio_enable for NCQ priority configuration, causing ABI fragmentation.
- [Low] Missing required blank lines after section title underlines in reStructuredText documentation.
--
--- Patch [2]: [PATCH v5 2/2] scsi: leapraid: Add driver documentation --- commit 630ad4ee0c14f18c620eec6823a389cf9f5654aa
Author: Dongdong Hao <[email protected]>
scsi: leapraid: Add driver documentation
This patch adds the necessary documentation for the LeapRAID SCSI driver to the kernel's documentation tree.
Quoted 6 lines
Documentation/scsi/leapraid.rst new file +0
-0@@ -0,0 +1,110 @@
[ ... ]
Documentation/scsi/leapraid.rst line 24
Quoted 7 lines
Documentation/scsi/leapraid.rst new file +7
-0+Supported devices +================= + +- LeapHBA-8200C + +Features +========
[Severity: Low]
Are we missing a blank line here?
In reStructuredText, a section title's underline needs to be followed by a blank line. Failing to provide this blank line causes Sphinx documentation build warnings.
Quoted 2 lines
+- PCIe Gen4 x8 host interface +- Support for SAS and SATA devices
[ ... ]
Documentation/scsi/leapraid.rst line 54
Quoted 7 lines
Documentation/scsi/leapraid.rst new file +7
-0+LeapRAID specific disk attributes +================================= + +:: + + /sys/class/scsi_disk/host:bus:target:lun/device/sas_device_handle + /sys/class/scsi_disk/host:bus:target:lun/device/ncq_cmd_prio_enable
[Severity: Medium]
Does this driver introduce a non-standard sysfs attribute for NCQ priority configuration?
Using ncq_cmd_prio_enable instead of the standard sas_ncq_prio_enable or ncq_prio_enable defined in Documentation/ABI/testing/sysfs-block-device can break userspace compatibility. When a user attempts to configure NCQ priority via sysfs using generic scripts or udev rules, it might fail for this driver.
Quoted 3 lines
Documentation/scsi/leapraid.rst new file +3
-0+ +The read-only attribute "sas_device_handle" represents the disk's device +handle, which is a unique identifier maintained by the firmware.
[ ... ]
Documentation/scsi/leapraid.rst line 102
Quoted 8 lines
+4.
poll_queues
+--------------Documentation/scsi/leapraid.rst new file +6
-0+ +This parameter specifies the number of I/O queues to be used when operating +in io_uring poll mode. The default value is 0. + +File Location +=============
[Severity: Low]
Is a blank line missing after this section underline as well?
Quoted 3 lines
Documentation/scsi/leapraid.rst new file +3
-0+The driver source is located at: + +``drivers/scsi/leapraid/``
[ ... ]
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Dongdong,
Quoted 1 line
This series adds the LeapRAID driver and its documentation.
Applied to 7.3/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen
Hao Dongdong
maintainerQuoted 7 lines · Martin K. Petersen (Oracle)
Dongdong,
Quoted 1 line
This series adds the LeapRAID driver and its documentation.
Applied to 7.3/scsi-staging, thanks!
Hi Martin,
Thank you for applying the series!
I would also like to thank Damien and Hannes for their careful reviews and valuable feedback.
Sashiko subsequently reported two minor issues in the documentation and sysfs interface. We will address them in follow-up patches once the tree has settled.
Best regards,
Dongdong