scsi: leapraid: Add new scsi driver
Subsystems (3)
doubled
maintainerPATCH 1/1 scsi: leapraid: Add new scsi driver
This commit adds support for the LeapIO
RAID controller. It supports RAID levels
0, 1, 5, 6, 10, 50, and 60, and works with
both SAS and SATA HDDs/SSDs.
--- Documentation/scsi/index.rst | 1 + Documentation/scsi/leapraid.rst | 35 + MAINTAINERS | 7 + drivers/scsi/Kconfig | 1 + drivers/scsi/Makefile | 1 + drivers/scsi/leapraid/Kconfig | 11 + drivers/scsi/leapraid/Makefile | 10 + drivers/scsi/leapraid/leapraid.h | 1062 +++ drivers/scsi/leapraid/leapraid_app.c | 710 ++ drivers/scsi/leapraid/leapraid_func.c | 8616 ++++++++++++++++++++ drivers/scsi/leapraid/leapraid_func.h | 1348 +++ drivers/scsi/leapraid/leapraid_os.c | 2388 ++++++ drivers/scsi/leapraid/leapraid_transport.c | 1235 +++ 13 files changed, 15425 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
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 +35 -0
@@ -0,0 +1,35 @@ +.. SPDX-License-Identifier: GPL-2.0 + +========================= +LeapRaid Driver for Linux +========================= + +Introduction +============ + +LeapRaid is a storage RAID controller driver developed by LeapIO Tech. +The controller targets enterprise storage, cloud infrastructure, high +performance computing (HPC), and AI workloads. + +It provides high-performance storage virtualization over PCI Express +Gen4 and supports both SAS and SATA HDDs and SSDs. It offers both Host +Bus Adapter (HBA) and RAID modes to meet diverse deployment requirements. + +Features +======== +- PCIe Gen4 x8 host interface +- Support for SAS and SATA devices +- RAID levels: 0, 1, 10, 5, 50, 6, 60 +- Advanced error handling and end-to-end data integrity +- NVMe/SATA/SAS tri-mode connectivity (future roadmap) + +File Location +============= +The driver source is located at: + +``drivers/scsi/leapraid/`` + +.. note:: + + This document is intended for kernel developers and system + integrators who need to build, test, and deploy the LeapRaid driver.
MAINTAINERS +7 -0
@@ -13837,6 +13837,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: doubled <[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
@@ -462,6 +462,7 @@ source "drivers/scsi/aic7xxx/Kconfig.aic79xx" source "drivers/scsi/aic94xx/Kconfig" source "drivers/scsi/hisi_sas/Kconfig" source "drivers/scsi/mvsas/Kconfig" +source "drivers/scsi/leapraid/Kconfig" config SCSI_MVUMI tristate "Marvell UMI driver"
drivers/scsi/Makefile +1 -0
@@ -152,6 +152,7 @@ obj-$(CONFIG_CHR_DEV_SCH) += ch.o obj-$(CONFIG_SCSI_ENCLOSURE) += ses.o obj-$(CONFIG_SCSI_HISI_SAS) += hisi_sas/ +obj-$(CONFIG_SCSI_LEAPRAID) += leapraid/ # This goes last, so that "real" scsi devices probe earlier obj-$(CONFIG_SCSI_DEBUG) += scsi_debug.o
drivers/scsi/leapraid/Kconfig new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +config SCSI_LEAPRAID + tristate "LeapIO RAID Adapter" + depends on PCI && SCSI + select SCSI_SAS_ATTRS + help + Driver for LeapIO Storage & RAID + Controllers. + To compile this driver as a module, choose M here: the + module will be called 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 +1062 -0
1,062 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_app.c new file +710 -0
710 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_func.c new file +8616 -0
1,137 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_func.h new file +1348 -0
1,348 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_os.c new file +2388 -0
2,388 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_transport.c new file +1235 -0
1,235 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.
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi doubled,
kernel test robot noticed the following build warnings:
[auto build test WARNING on jejb-scsi/for-next]
[also build test WARNING on mkp-scsi/for-next linus/master v6.17-rc6 next-20250919] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/doubled/scsi-leapraid-Add-new-scsi-driver/20250919-202535 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next patch link: https://lore.kernel.org/r/20250919100032.3931476-1-doubled%40leap-io-kernel.com patch subject: [PATCH] scsi: leapraid: Add new scsi driver config: i386-randconfig-002-20250920 (https://download.01.org/0day-ci/archive/20250920/[email protected]/config) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250920/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/scsi/leapraid/leapraid_func.c:7478:6: warning: variable 'adapter_state' set but not used [-Wunused-but-set-variable]
7478 | u32 adapter_state;
| ^
drivers/scsi/leapraid/leapraid_func.c:93:1: warning: unused function 'leapraid_writeq' [-Wunused-function]
93 | leapraid_writeq(__u64 info, void __iomem *addr,
| ^~~~~~~~~~~~~~~
2 warnings generated.
--
>> Warning: drivers/scsi/leapraid/leapraid_app.c:112 struct member 'r0' not described in 'leapraid_ioctl_adapter_info'
>> Warning: drivers/scsi/leapraid/leapraid_app.c:112 struct member 'r1' not described in 'leapraid_ioctl_adapter_info'
>> Warning: drivers/scsi/leapraid/leapraid_app.c:112 struct member 'r2' not described in 'leapraid_ioctl_adapter_info'vim +/adapter_state +7478 drivers/scsi/leapraid/leapraid_func.c
7473
7474 static int
7475 leapraid_adapter_unit_reset(
7476 struct leapraid_adapter *adapter)
7477 {
> 7478 u32 adapter_state;
7479 unsigned long flags;
7480 int rc = 0;
7481
7482 if (!(adapter->adapter_attr.features.adapter_caps &
7483 LEAPRAID_ADAPTER_FEATURES_CAP_EVENT_REPLAY))
7484 return -EFAULT;
7485
7486 dev_info(&adapter->pdev->dev, "fire unit reset\n");
7487 writel(LEAPRAID_FUNC_ADAPTER_UNIT_RESET << LEAPRAID_DB_FUNC_SHIFT,
7488 &adapter->iomem_base->db);
7489 if (leapraid_db_wait_ack_and_clear_int(adapter))
7490 rc = -EFAULT;
7491
7492 adapter_state = leapraid_get_adapter_state(adapter);
7493 spin_lock_irqsave(&adapter->reset_desc.adapter_reset_lock,
7494 flags);
7495 spin_unlock_irqrestore(&adapter->reset_desc.adapter_reset_lock,
7496 flags);
7497
7498 if (!leapraid_wait_adapter_ready(adapter)) {
7499 rc = -EFAULT;
7500 goto out;
7501 }
7502 out:
7503 dev_info(&adapter->pdev->dev, "unit reset: %s\n",
7504 ((rc == 0) ? "SUCCESS" : "FAILED"));
7505 return rc;
7506 }
7507
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi doubled,
kernel test robot noticed the following build warnings:
[auto build test WARNING on jejb-scsi/for-next]
[also build test WARNING on mkp-scsi/for-next linus/master v6.17-rc7 next-20250923] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/doubled/scsi-leapraid-Add-new-scsi-driver/20250919-202535 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next patch link: https://lore.kernel.org/r/20250919100032.3931476-1-doubled%40leap-io-kernel.com patch subject: [PATCH] scsi: leapraid: Add new scsi driver config: sparc64-randconfig-r072-20250922 (https://download.01.org/0day-ci/archive/20250924/[email protected]/config) compiler: sparc64-linux-gcc (GCC) 12.5.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
smatch warnings:drivers/scsi/leapraid/leapraid_func.c:7225 leapraid_set_msix() warn: inconsistent indenting drivers/scsi/leapraid/leapraid_func.c:7797 leapraid_request_host_memory() warn: missing unwind goto? drivers/scsi/leapraid/leapraid_func.c:7797 leapraid_request_host_memory() warn: missing unwind goto? drivers/scsi/leapraid/leapraid_func.c:8271 leapraid_cfg_pages() warn: missing error code? 'rc' drivers/scsi/leapraid/leapraid_func.c:8530 leapraid_make_adapter_available() warn: missing error code? 'rc'
vim +7225 drivers/scsi/leapraid/leapraid_func.c
7166
7167 static int
7168 leapraid_set_msix(struct leapraid_adapter *adapter)
7169 {
7170 int iopoll_qcnt = 0;
7171 int msix_cnt, i, rc;
7172
7173 if (msix_disable == 1)
7174 goto legacy_int;
7175
7176 msix_cnt = leapraid_msix_cnt(adapter->pdev);
7177 if (msix_cnt <= 0) {
7178 dev_info(&adapter->pdev->dev,
7179 "msix unsupported!\n");
7180 goto legacy_int;
7181 }
7182
7183 if (reset_devices)
7184 adapter->adapter_attr.rq_cnt = 1;
7185 else
7186 adapter->adapter_attr.rq_cnt = min_t(int,
7187 num_online_cpus(), msix_cnt);
7188
7189 if (max_msix_vectors > 0)
7190 adapter->adapter_attr.rq_cnt = min_t(int, max_msix_vectors,
7191 adapter->adapter_attr.rq_cnt);
7192
7193 if (adapter->adapter_attr.rq_cnt <= 1)
7194 adapter->shost->host_tagset = 0;
7195 if (adapter->shost->host_tagset) {
7196 iopoll_qcnt = poll_queues;
7197 if (iopoll_qcnt >= adapter->adapter_attr.rq_cnt)
7198 iopoll_qcnt = 0;
7199 }
7200
7201 if (iopoll_qcnt) {
7202 adapter->notification_desc.blk_mq_poll_rqs =
7203 kcalloc(iopoll_qcnt,
7204 sizeof(struct leapraid_blk_mq_poll_rq), GFP_KERNEL);
7205 if (!adapter->notification_desc.blk_mq_poll_rqs)
7206 return -ENOMEM;
7207 adapter->adapter_attr.rq_cnt =
7208 min(adapter->adapter_attr.rq_cnt +
7209 iopoll_qcnt, msix_cnt);
7210 }
7211
7212 adapter->notification_desc.iopoll_qdex =
7213 adapter->adapter_attr.rq_cnt - iopoll_qcnt;
7214
7215 adapter->notification_desc.iopoll_qcnt = iopoll_qcnt;
7216 dev_info(&adapter->pdev->dev,
7217 "MSIx: req queue cnt=%d, intr=%d/poll=%d rep queues!\n",
7218 adapter->adapter_attr.rq_cnt,
7219 adapter->notification_desc.iopoll_qdex,
7220 adapter->notification_desc.iopoll_qcnt);
7221
7222 adapter->notification_desc.int_rqs =
7223 kcalloc(adapter->notification_desc.iopoll_qdex,
7224 sizeof(struct leapraid_int_rq), GFP_KERNEL);
> 7225 if (!adapter->notification_desc.int_rqs) { 7226 dev_err(&adapter->pdev->dev,
7227 "MSIx: allocate %d interrupt reply queues failed!\n",
7228 adapter->notification_desc.iopoll_qdex);
7229 return -ENOMEM;
7230 }
7231
7232 for (i = 0; i < adapter->notification_desc.iopoll_qcnt; i++) {
7233 adapter->notification_desc.blk_mq_poll_rqs[i].rq.adapter
7234 = adapter;
7235 adapter->notification_desc.blk_mq_poll_rqs[i].rq.msix_idx =
7236 i + adapter->notification_desc.iopoll_qdex;
7237 atomic_set(
7238 &adapter->notification_desc.blk_mq_poll_rqs[i].rq.busy,
7239 0);
7240 snprintf(adapter->notification_desc.blk_mq_poll_rqs[i].rq.name,
7241 LEAPRAID_NAME_LENGTH,
7242 "%s%u-MQ-Poll%u", LEAPRAID_DRIVER_NAME,
7243 adapter->adapter_attr.id, i);
7244 atomic_set(&adapter->notification_desc.blk_mq_poll_rqs[i].busy,
7245 0);
7246 atomic_set(
7247 &adapter->notification_desc.blk_mq_poll_rqs[i].pause,
7248 0);
7249 }
7250
7251 adapter->notification_desc.msix_cpu_map_sz =
7252 num_online_cpus();
7253 adapter->notification_desc.msix_cpu_map =
7254 kzalloc(adapter->notification_desc.msix_cpu_map_sz,
7255 GFP_KERNEL);
7256 if (!adapter->notification_desc.msix_cpu_map)
7257 return -ENOMEM;
7258 memset(adapter->notification_desc.msix_cpu_map, 0,
7259 adapter->notification_desc.msix_cpu_map_sz);
7260
7261 adapter->notification_desc.msix_enable = true;
7262 rc = leapraid_setup_irqs(adapter);
7263 if (rc) {
7264 leapraid_free_irq(adapter);
7265 adapter->notification_desc.msix_enable = false;
7266 goto legacy_int;
7267 }
7268
7269 return 0;
7270
7271 legacy_int:
7272 rc = leapraid_set_legacy_int(adapter);
7273
7274 return rc;
7275 }
7276
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
doubled
maintainerPATCH v2 1/1 scsi: leapraid: Add new scsi driver
In reply to doubledThis commit adds support for the LeapIO
RAID controller. It supports RAID levels
0, 1, 5, 6, 10, 50, and 60, and works with
both SAS and SATA HDDs/SSDs.
---
Changes in v2:
- fix unused variable and undocumented struct member warnings.
- refactor volume event handling and drive hotplug logic
v1:
- Link: https://lore.kernel.org/all/[email protected]/
--- Documentation/scsi/index.rst | 1 + Documentation/scsi/leapraid.rst | 35 + MAINTAINERS | 7 + drivers/scsi/Kconfig | 1 + drivers/scsi/Makefile | 1 + drivers/scsi/leapraid/Kconfig | 11 + drivers/scsi/leapraid/Makefile | 10 + drivers/scsi/leapraid/leapraid.h | 1131 +++ drivers/scsi/leapraid/leapraid_app.c | 713 ++ drivers/scsi/leapraid/leapraid_func.c | 8355 ++++++++++++++++++++ drivers/scsi/leapraid/leapraid_func.h | 1347 ++++ drivers/scsi/leapraid/leapraid_os.c | 2390 ++++++ drivers/scsi/leapraid/leapraid_transport.c | 1235 +++ 13 files changed, 15237 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
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 +35 -0
@@ -0,0 +1,35 @@ +.. SPDX-License-Identifier: GPL-2.0 + +========================= +LeapRaid Driver for Linux +========================= + +Introduction +============ + +LeapRaid is a storage RAID controller driver developed by LeapIO Tech. +The controller targets enterprise storage, cloud infrastructure, high +performance computing (HPC), and AI workloads. + +It provides high-performance storage virtualization over PCI Express +Gen4 and supports both SAS and SATA HDDs and SSDs. It offers both Host +Bus Adapter (HBA) and RAID modes to meet diverse deployment requirements. + +Features +======== +- PCIe Gen4 x8 host interface +- Support for SAS and SATA devices +- RAID levels: 0, 1, 10, 5, 50, 6, 60 +- Advanced error handling and end-to-end data integrity +- NVMe/SATA/SAS tri-mode connectivity (future roadmap) + +File Location +============= +The driver source is located at: + +``drivers/scsi/leapraid/`` + +.. note:: + + This document is intended for kernel developers and system + integrators who need to build, test, and deploy the LeapRaid driver.
MAINTAINERS +7 -0
@@ -13836,6 +13836,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: doubled <[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
@@ -462,6 +462,7 @@ source "drivers/scsi/aic7xxx/Kconfig.aic79xx" source "drivers/scsi/aic94xx/Kconfig" source "drivers/scsi/hisi_sas/Kconfig" source "drivers/scsi/mvsas/Kconfig" +source "drivers/scsi/leapraid/Kconfig" config SCSI_MVUMI tristate "Marvell UMI driver"
drivers/scsi/Makefile +1 -0
@@ -152,6 +152,7 @@ obj-$(CONFIG_CHR_DEV_SCH) += ch.o obj-$(CONFIG_SCSI_ENCLOSURE) += ses.o obj-$(CONFIG_SCSI_HISI_SAS) += hisi_sas/ +obj-$(CONFIG_SCSI_LEAPRAID) += leapraid/ # This goes last, so that "real" scsi devices probe earlier obj-$(CONFIG_SCSI_DEBUG) += scsi_debug.o
drivers/scsi/leapraid/Kconfig new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +config SCSI_LEAPRAID + tristate "LeapIO RAID Adapter" + depends on PCI && SCSI + select SCSI_SAS_ATTRS + help + Driver for LeapIO Storage & RAID + Controllers. + To compile this driver as a module, choose M here: the + module will be called 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 +1131 -0
1,131 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_app.c new file +713 -0
713 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_func.c new file +8355 -0
1,065 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_func.h new file +1347 -0
1,347 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_os.c new file +2390 -0
2,390 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_transport.c new file +1235 -0
1,235 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.
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi doubled,
kernel test robot noticed the following build warnings:
[auto build test WARNING on jejb-scsi/for-next]
[also build test WARNING on next-20251017]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/doubled/scsi-leapraid-Add-new-scsi-driver/20251017-153514 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next patch link: https://lore.kernel.org/r/20251017072807.3327789-1-doubled%40leap-io-kernel.com patch subject: [PATCH v2] scsi: leapraid: Add new scsi driver config: csky-randconfig-r112-20251020 (https://download.01.org/0day-ci/archive/20251020/[email protected]/config) compiler: csky-linux-gcc (GCC) 10.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251020/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
>> drivers/scsi/leapraid/leapraid_func.c:535:9: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
drivers/scsi/leapraid/leapraid_func.c:535:9: sparse: expected unsigned int [usertype] value
drivers/scsi/leapraid/leapraid_func.c:535:9: sparse: got restricted __le32 [usertype]
drivers/scsi/leapraid/leapraid_func.c:549:9: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
drivers/scsi/leapraid/leapraid_func.c:549:9: sparse: expected unsigned int [usertype] value
drivers/scsi/leapraid/leapraid_func.c:549:9: sparse: got restricted __le32 [usertype]
drivers/scsi/leapraid/leapraid_func.c:564:9: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
drivers/scsi/leapraid/leapraid_func.c:564:9: sparse: expected unsigned int [usertype] value
drivers/scsi/leapraid/leapraid_func.c:564:9: sparse: got restricted __le32 [usertype]
vim +535 drivers/scsi/leapraid/leapraid_func.c
523
524 void
525 leapraid_fire_scsi_io(struct leapraid_adapter *adapter,
526 u16 taskid, u16 handle)
527 {
528 struct leapraid_atomic_req_desc desc;
529
530 desc.flg = LEAPRAID_REQ_DESC_FLG_SCSI_IO;
531 desc.msix_idx
532 = leapraid_get_and_set_msix_idx_from_taskid(adapter,
533 taskid);
534 desc.taskid = cpu_to_le16(taskid);
> 535 writel(cpu_to_le32(*((u32 *)&desc)),
536 &adapter->iomem_base->atomic_req_desc_post);
537 }
538
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
doubled
maintainerPATCH v3 1/1 scsi: leapraid: Add new scsi driver
In reply to doubledThis commit adds support for the LeapIO
RAID controller. It supports RAID levels
0, 1, 5, 6, 10, 50, and 60, and works with
both SAS and SATA HDDs/SSDs.
---
Changes in v3:
- fix sparse warnings for writel() argument type mismatch
- Link to v2: https://lore.kernel.org/all/[email protected]/
Changes in v2:
- fix unused variable and undocumented struct member warnings
- refactor volume event handling and drive hotplug logic
- Link to v1: https://lore.kernel.org/all/[email protected]/
--- Documentation/scsi/index.rst | 1 + Documentation/scsi/leapraid.rst | 35 + MAINTAINERS | 7 + drivers/scsi/Kconfig | 1 + drivers/scsi/Makefile | 1 + drivers/scsi/leapraid/Kconfig | 11 + drivers/scsi/leapraid/Makefile | 10 + drivers/scsi/leapraid/leapraid.h | 1128 +++ drivers/scsi/leapraid/leapraid_app.c | 713 ++ drivers/scsi/leapraid/leapraid_func.c | 8355 ++++++++++++++++++++ drivers/scsi/leapraid/leapraid_func.h | 1347 ++++ drivers/scsi/leapraid/leapraid_os.c | 2390 ++++++ drivers/scsi/leapraid/leapraid_transport.c | 1235 +++ 13 files changed, 15234 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
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 +35 -0
@@ -0,0 +1,35 @@ +.. SPDX-License-Identifier: GPL-2.0 + +========================= +LeapRaid Driver for Linux +========================= + +Introduction +============ + +LeapRaid is a storage RAID controller driver developed by LeapIO Tech. +The controller targets enterprise storage, cloud infrastructure, high +performance computing (HPC), and AI workloads. + +It provides high-performance storage virtualization over PCI Express +Gen4 and supports both SAS and SATA HDDs and SSDs. It offers both Host +Bus Adapter (HBA) and RAID modes to meet diverse deployment requirements. + +Features +======== +- PCIe Gen4 x8 host interface +- Support for SAS and SATA devices +- RAID levels: 0, 1, 10, 5, 50, 6, 60 +- Advanced error handling and end-to-end data integrity +- NVMe/SATA/SAS tri-mode connectivity (future roadmap) + +File Location +============= +The driver source is located at: + +``drivers/scsi/leapraid/`` + +.. note:: + + This document is intended for kernel developers and system + integrators who need to build, test, and deploy the LeapRaid driver.
MAINTAINERS +7 -0
@@ -13836,6 +13836,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: doubled <[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
@@ -462,6 +462,7 @@ source "drivers/scsi/aic7xxx/Kconfig.aic79xx" source "drivers/scsi/aic94xx/Kconfig" source "drivers/scsi/hisi_sas/Kconfig" source "drivers/scsi/mvsas/Kconfig" +source "drivers/scsi/leapraid/Kconfig" config SCSI_MVUMI tristate "Marvell UMI driver"
drivers/scsi/Makefile +1 -0
@@ -152,6 +152,7 @@ obj-$(CONFIG_CHR_DEV_SCH) += ch.o obj-$(CONFIG_SCSI_ENCLOSURE) += ses.o obj-$(CONFIG_SCSI_HISI_SAS) += hisi_sas/ +obj-$(CONFIG_SCSI_LEAPRAID) += leapraid/ # This goes last, so that "real" scsi devices probe earlier obj-$(CONFIG_SCSI_DEBUG) += scsi_debug.o
drivers/scsi/leapraid/Kconfig new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +config SCSI_LEAPRAID + tristate "LeapIO RAID Adapter" + depends on PCI && SCSI + select SCSI_SAS_ATTRS + help + Driver for LeapIO Storage & RAID + Controllers. + To compile this driver as a module, choose M here: the + module will be called 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 +1128 -0
1,128 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_app.c new file +713 -0
713 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_func.c new file +8355 -0
1,068 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_func.h new file +1347 -0
1,347 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_os.c new file +2390 -0
2,390 lines not on this page · raw message
drivers/scsi/leapraid/leapraid_transport.c new file +1235 -0
1,235 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.
Quoted 4 lines · doubled
This commit adds support for the LeapIO
RAID controller. It supports RAID levels
0, 1, 5, 6, 10, 50, and 60, and works with
both SAS and SATA HDDs/SSDs.
Please format your commit message to use up to 72 chars per line. Also, given the size of this patch, a little more explanation regarding the structure of the driver would be welcome here.
Quoted 1 line
Signed-off-by doubled <[email protected]>
Is "doubled" the name of a real person ? If yes, please capitalize it. But I doubt it is, and we need a real person name here. The author(s).
Quoted 11 lines
---
Changes in v3:
- fix sparse warnings forwritel()argument type mismatch
- Link to v2: https://lore.kernel.org/all/[email protected]/Changes in v2:
- fix unused variable and undocumented struct member warnings
- refactor volume event handling and drive hotplug logic
- Link to v1: https://lore.kernel.org/all/[email protected]/Signed-off-by doubled <[email protected]>
No need for the SoB here.
Quoted 1 line
---
Odd format. That separator is not needed.
Quoted 56 lines
Documentation/scsi/index.rst | 1 + Documentation/scsi/leapraid.rst | 35 + MAINTAINERS | 7 + drivers/scsi/Kconfig | 1 + drivers/scsi/Makefile | 1 + drivers/scsi/leapraid/Kconfig | 11 + drivers/scsi/leapraid/Makefile | 10 + drivers/scsi/leapraid/leapraid.h | 1128 +++ drivers/scsi/leapraid/leapraid_app.c | 713 ++ drivers/scsi/leapraid/leapraid_func.c | 8355 ++++++++++++++++++++ drivers/scsi/leapraid/leapraid_func.h | 1347 ++++ drivers/scsi/leapraid/leapraid_os.c | 2390 ++++++ drivers/scsi/leapraid/leapraid_transport.c | 1235 +++ 13 files changed, 15234 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.cDocumentation/scsi/index.rst +1
-0@@ -56,6 +56,7 @@ SCSI host adapter drivers g_NCR5380 hpsa hptiop + leapraid libsas lpfc megaraidDocumentation/scsi/leapraid.rst new file +14
-0@@ -0,0 +1,35 @@ +.. SPDX-License-Identifier: GPL-2.0 + +========================= +LeapRaid Driver for Linux +========================= + +Introduction +============ + +LeapRaid is a storage RAID controller driver developed by LeapIO Tech. +The controller targets enterprise storage, cloud infrastructure, high +performance computing (HPC), and AI workloads. + +It provides high-performance storage virtualization over PCI Express
Documentation/scsi/leapraid.rst line 24
Quoted 10 lines
Documentation/scsi/leapraid.rst new file +10
-0+Gen4 and supports both SAS and SATA HDDs and SSDs. It offers both Host +Bus Adapter (HBA) and RAID modes to meet diverse deployment requirements. + +Features +======== +- PCIe Gen4 x8 host interface +- Support for SAS and SATA devices +- RAID levels: 0, 1, 10, 5, 50, 6, 60 +- Advanced error handling and end-to-end data integrity +- NVMe/SATA/SAS tri-mode connectivity (future roadmap)
If that is not supported now, then please remove that and add it back only once you have models that do support it.
Documentation/scsi/leapraid.rst line 35
Quoted 11 lines
Documentation/scsi/leapraid.rst new file +11
-0+ +File Location +============= +The driver source is located at: + +``drivers/scsi/leapraid/`` + +.. note:: + + This document is intended for kernel developers and system + integrators who need to build, test, and deploy the LeapRaid driver.
Not much help is provided in this file at all. Building will be through the regular config+make. Rather, this document should describe (if any) the kernel module arguments and setup procedure if anything special is needed.
MAINTAINERS S: Maintained · line 13840
Quoted 11 lines
\ No newline at end of file
MAINTAINERS +2
-0@@ -13836,6 +13836,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: doubled <[email protected]>
Same as for the signed-off tag: we need a person name here.
Quoted 12 lines
MAINTAINERS +5
-0+L: [email protected] +S: Supported +F: Documentation/scsi/leapraid.rst +F: drivers/scsi/leapraid/ +drivers/scsi/leapraid/Kconfig new file +0
-0
drivers/scsi/leapraid/Kconfig line 9
Quoted 9 lines
drivers/scsi/leapraid/Kconfig new file +9
-0@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +config SCSI_LEAPRAID + tristate "LeapIO RAID Adapter" + depends on PCI && SCSI + select SCSI_SAS_ATTRS + help + Driver for LeapIO Storage & RAID + Controllers.
Why the early line split here ?
Quoted 10 lines
drivers/scsi/leapraid/Kconfig new file +2
-0+ To compile this driver as a module, choose M here: the + module will be called leapraid.drivers/scsi/leapraid/leapraid.h new file +0
-0
drivers/scsi/leapraid/leapraid.h line 9
Quoted 9 lines
drivers/scsi/leapraid/leapraid.h new file +9
-0@@ -0,0 +1,1128 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2025 LeapIO Tech Inc. +*/ + +#ifndef LEAPRAID_H +#define LEAPRAID_H + +#define REP_POST_HOST_IDX_REG_CNT (16)
The parenthesis around the value are not needed. Same comment applies to all the definitions below.
drivers/scsi/leapraid/leapraid.h line 14
Quoted 5 lines
drivers/scsi/leapraid/leapraid.h new file +5
-0+#define LEAPRAID_DB_RESET (0x00000000) +#define LEAPRAID_DB_READY (0x10000000) +#define LEAPRAID_DB_OPERATIONAL (0x20000000) +#define LEAPRAID_DB_FAULT (0x40000000) +#define LEAPRAID_DB_MASK (0xF0000000)
[...]
A comment describing what this structure represent would be nice. Same for the following struct definitions.
And the same applies to the macro definitions before. Commenting groups of macros to describe what they are would be nice.
Quoted 55 lines
drivers/scsi/leapraid/leapraid.h new file +23
-0+struct leapraid_reg_base { +__le32 db; +__le32 ws; +__le32 host_diag; +__le32 r1[9 ]; +__le32 host_int_status; +__le32 host_int_mask; +__le32 r2[4 ]; +__le32 rep_msg_host_idx; +__le32 r3[29 ]; +__le32 r4[2 ]; +__le32 atomic_req_desc_post; +__le32 adapter_log_buf_pos; +__le32 host_log_buf_pos; +__le32 r5[142 ]; +struct leapraid_rep_post_reg_idx { +__le32 idx; +__le32 r1; +__le32 r2; +__le32 r3; + } rep_post_reg_idx[REP_POST_HOST_IDX_REG_CNT ]; +} __packed; +drivers/scsi/leapraid/leapraid_app.c new file +25
-0@@ -0,0 +1,713 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2025 LeapIO Tech Inc. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* NO WARRANTY +* THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES +* OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, +* WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, +* NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR +* PURPOSE. Each Recipient is solely responsible for determining +* the appropriateness of using and distributing the Program and +* assumes all risks associated with its exercise of rights under +* this Agreement, including but not limited to the risks and costs +* of program errors, damage to or loss of data, programs or equipment, +* and unavailability or interruption of operations.
drivers/scsi/leapraid/leapraid_app.c line 35
Quoted 10 lines
drivers/scsi/leapraid/leapraid_app.c new file +10
-0+ +* DISCLAIMER OF LIABILITY +* NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), +* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR +* THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF +* THE POSSIBILITY OF SUCH DAMAGES
No need for all this text. The SPDX header implies it.
[...]
drivers/scsi/leapraid/leapraid_app.c line 156
Quoted 9 lines
drivers/scsi/leapraid/leapraid_app.c new file +9
-0+struct leapraid_ioctl_locate { +struct leapraid_ioctl_header hdr; +uint32_t id; +uint32_t bus; +uint16_t hdl; +uint16_t r0; +}; + +
Double whiteline not needed.
drivers/scsi/leapraid/leapraid_app.c line 158
Quoted 2 lines
drivers/scsi/leapraid/leapraid_app.c new file +2
-0+static struct leapraid_adapter * +leapraid_ctl_lookup_adapter (int adapter_number)
s/adapter_number/adapter_id ?
Quoted 6 lines
drivers/scsi/leapraid/leapraid_app.c new file +6
-0+{ +struct leapraid_adapter *adapter; + +spin_lock (&leapraid_adapter_lock); +list_for_each_entry (adapter, &leapraid_adapter_list, list) { +if (adapter->adapter_attr.id == adapter_number) {
drivers/scsi/leapraid/leapraid_app.c line 174
Quoted 10 lines
drivers/scsi/leapraid/leapraid_app.c new file +10
-0+spin_unlock (&leapraid_adapter_lock); +return adapter; + } + } +spin_unlock (&leapraid_adapter_lock); + +return NULL ; +} + +static void
Why the line break here ? This is not the usual kernel code style.
drivers/scsi/leapraid/leapraid_app.c line 179
Quoted 5 lines
drivers/scsi/leapraid/leapraid_app.c new file +5
-0+leapraid_cli_scsiio_cmd(struct leapraid_adapter *adapter, + struct leapraid_req *ctl_sp_mpi_req, u16 taskid, + dma_addr_t h2c_dma_addr, size_t h2c_size, + dma_addr_t c2h_dma_addr, size_t c2h_size, + u16 dev_hdl, void *psge)
The one tab identation of the arguments makes reading harder as they align with the code. Please use at least 2 tabs or align them with the function "(".
This comment and the one before apply to all other functions it seems.
Quoted 26 lines
drivers/scsi/leapraid/leapraid_app.c new file +26
-0+{ +struct leapraid_mpi_scsiio_req *scsiio_request + = (struct leapraid_mpi_scsiio_req *) ctl_sp_mpi_req; + + scsiio_request->sense_buffer_len =SCSI_SENSE_BUFFERSIZE ; + scsiio_request->sense_buffer_low_add = +leapraid_get_sense_buffer_dma (adapter, taskid); +memset ((void *)(&adapter->driver_cmds.ctl_cmd.sense), +0 ,SCSI_SENSE_BUFFERSIZE ); +leapraid_build_ieee_sg (adapter, psge, h2c_dma_addr, + h2c_size, c2h_dma_addr, c2h_size); +if (scsiio_request->func ==LEAPRAID_FUNC_SCSIIO_REQ ) +leapraid_fire_scsi_io (adapter, taskid, dev_hdl); +else +leapraid_fire_task (adapter, taskid); +} + +static void +leapraid_ctl_smp_passthrough_cmd (struct leapraid_adapter *adapter, +struct leapraid_req *ctl_sp_mpi_req,u16 taskid, +dma_addr_t h2c_dma_addr,size_t h2c_size, +dma_addr_t c2h_dma_addr,size_t c2h_size, +void *psge,void *h2c) +{ +struct leapraid_smp_passthrough_req *smp_pt_req = + (struct leapraid_smp_passthrough_req *) ctl_sp_mpi_req;
drivers/scsi/leapraid/leapraid_app.c line 215
Quoted 10 lines
drivers/scsi/leapraid/leapraid_app.c new file +10
-0+u8 *data; + +if (!adapter->adapter_attr.enable_mp) + smp_pt_req->physical_port =LEAPRAID_DISABLE_MP_PORT_ID ; +if (smp_pt_req->passthrough_flg &0x80 ) + data = (u8 *) &smp_pt_req->sgl; +else + data = h2c; + +if (data[1 ] ==0x91 && (data[10 ] ==1 || data[10 ] ==2 ))
What are these magic numbers ? Using a macro definition for them would make things more intelligible.
Quoted 4 lines
drivers/scsi/leapraid/leapraid_app.c new file +4
-0+ adapter->reset_desc.adapter_link_resetting = true; +leapraid_build_ieee_sg (adapter, psge, h2c_dma_addr, + h2c_size, c2h_dma_addr, c2h_size); +leapraid_fire_task (adapter, taskid);
drivers/scsi/leapraid/leapraid_app.c line 229
Quoted 10 lines
drivers/scsi/leapraid/leapraid_app.c new file +10
-0+} + +static void +leapraid_ctl_fire_ieee_cmd (struct leapraid_adapter *adapter, +dma_addr_t h2c_dma_addr,size_t h2c_size, +dma_addr_t c2h_dma_addr,size_t c2h_size, +void *psge,u16 taskid) +{ +leapraid_build_ieee_sg (adapter, psge, h2c_dma_addr, h2c_size, + c2h_dma_addr, c2h_size);
Odd alignment. Please align with "adapter" on the previous line.
Quoted 26 lines
drivers/scsi/leapraid/leapraid_app.c new file +24
-0+leapraid_fire_task (adapter, taskid); +} +static long +leapraid_ctl_do_command (struct leapraid_adapter *adapter, +struct leapraid_ioctl_command *karg,void __user *mf) +{ +struct leapraid_req *leap_mpi_req =NULL ; +struct leapraid_req *ctl_sp_mpi_req =NULL ; +u16 taskid; +void *h2c =NULL ; +size_t h2c_size =0 ; +dma_addr_t h2c_dma_addr =0 ; +void *c2h =NULL ; +size_t c2h_size =0 ; +dma_addr_t c2h_dma_addr =0 ; +void *psge; +unsigned long timeout; +u16 dev_hdl =LEAPRAID_INVALID_DEV_HANDLE ; +bool issue_reset = false; +u32 sz; +long rc =0 ; + + rc =leapraid_check_adapter_is_op (adapter); +if (rc)
drivers/scsi/leapraid/leapraid_app.c line 312
Quoted 10 lines
drivers/scsi/leapraid/leapraid_app.c new file +10
-0+ goto out; + + leap_mpi_req =kzalloc (LEAPRAID_REQUEST_SIZE ,GFP_KERNEL ); +if (!leap_mpi_req) { + rc = -ENOMEM ; + goto out; + } + +if (karg->data_sge_offset *4 >LEAPRAID_REQUEST_SIZE + || karg->data_sge_offset > ((~0U ) /4 )) {
Code style: "||" should be on the previous line. And align with the if "(". Same code style problems below.
~0U is UINT_MAX.
drivers/scsi/leapraid/leapraid_app.c line 315
Quoted 3 lines
drivers/scsi/leapraid/leapraid_app.c new file +3
-0+ rc = -EINVAL ; + goto out; + }
I stop here. This patch is too long. Scanning it, I see the same code style issues all over it:
- Lots of double blank lines.
- Odd line breaks and parameter alignments
- if conditions formatting
Signature · 2 lines
Damien Le Moal Western Digital Research
A message that is not in the archive (sent off-list or not yet received): aG1haWxfaXNfbm9fMQ.287b84c7-7efb-4386-9d8a-accf3c18c497@kernel.org
Hao Dongdong
maintainerQuoted 10 lines · Damien Le Moal
Quoted 4 lines · doubled
This commit adds support for the LeapIO
RAID controller. It supports RAID levels
0, 1, 5, 6, 10, 50, and 60, and works with
both SAS and SATA HDDs/SSDs.Please format your commit message to use up to 72 chars per line. Also, given the size of this patch, a little more explanation regarding the structure of the driver would be welcome here.
Thank you very much for reviewing our patches and for your time.
I should have replied to your comments promptly and provided an estimated completion time — that was my mistake.
We have now submitted v4, which resolves all the issues you pointed out during the review.
In the new commit message, we included an introduction to the driver’s file structure and their corresponding functionalities, as well as a description of the core data structures.
Quoted 5 lines
Quoted 1 line
Signed-off-by doubled <[email protected]>Is "doubled" the name of a real person ? If yes, please capitalize it. But I doubt it is, and we need a real person name here. The author(s).
My name is Hao Dongdong, and I initially thought that “doubled” would be an acceptable handle in the community. However, I realize now that it was not appropriate. In future submissions, I have replaced all instances of “doubled” with Hao Dongdong. Thank you very much for your reminder.
Quoted 10 lines
Quoted 10 lines
---
Changes in v3:
- fix sparse warnings forwritel()argument type mismatch
- Link to v2: https://lore.kernel.org/all/[email protected]/Changes in v2:
- fix unused variable and undocumented struct member warnings
- refactor volume event handling and drive hotplug logic
- Link to v1: https://lore.kernel.org/all/[email protected]/
Quoted 8 lines
Quoted 1 line
Signed-off-by doubled <[email protected]>No need for the SoB here.
Quoted 1 line
---
Odd format. That separator is not needed.
We have removed the separator in v4.
Quoted 61 lines
Quoted 61 lines
Documentation/scsi/index.rst | 1 + Documentation/scsi/leapraid.rst | 35 + MAINTAINERS | 7 + drivers/scsi/Kconfig | 1 + drivers/scsi/Makefile | 1 + drivers/scsi/leapraid/Kconfig | 11 + drivers/scsi/leapraid/Makefile | 10 + drivers/scsi/leapraid/leapraid.h | 1128 +++ drivers/scsi/leapraid/leapraid_app.c | 713 ++ drivers/scsi/leapraid/leapraid_func.c | 8355 ++++++++++++++++++++ drivers/scsi/leapraid/leapraid_func.h | 1347 ++++ drivers/scsi/leapraid/leapraid_os.c | 2390 ++++++ drivers/scsi/leapraid/leapraid_transport.c | 1235 +++ 13 files changed, 15234 insertions(+)create mode 100644
Documentation/scsi/leapraid.rstcreate mode 100644drivers/scsi/leapraid/Kconfigcreate mode 100644drivers/scsi/leapraid/Makefilecreate mode 100644drivers/scsi/leapraid/leapraid.hcreate mode 100644drivers/scsi/leapraid/leapraid_app.ccreate mode 100644drivers/scsi/leapraid/leapraid_func.ccreate mode 100644drivers/scsi/leapraid/leapraid_func.hcreate mode 100644drivers/scsi/leapraid/leapraid_os.ccreate mode 100644drivers/scsi/leapraid/leapraid_transport.cDocumentation/scsi/index.rst +1
-0@@ -56,6 +56,7 @@ SCSI host adapter drivers g_NCR5380 hpsa hptiop + leapraid libsas lpfc megaraidDocumentation/scsi/leapraid.rst new file +19
-0@@ -0,0 +1,35 @@ +.. SPDX-License-Identifier: GPL-2.0 + +========================= +LeapRaid Driver for Linux +========================= + +Introduction +============ + +LeapRaid is a storage RAID controller driver developed by LeapIO Tech. +The controller targets enterprise storage, cloud infrastructure, high +performance computing (HPC), and AI workloads. + +It provides high-performance storage virtualization over PCI Express +Gen4 and supports both SAS and SATA HDDs and SSDs. It offers both Host +Bus Adapter (HBA) and RAID modes to meet diverse deployment requirements. + +Features +========
Quoted 9 lines
Documentation/scsi/leapraid.rst line 24
Quoted 5 lines
Documentation/scsi/leapraid.rst new file +5
-0+- PCIe Gen4 x8 host interface +- Support for SAS and SATA devices +- RAID levels: 0, 1, 10, 5, 50, 6, 60 +- Advanced error handling and end-to-end data integrity +- NVMe/SATA/SAS tri-mode connectivity (future roadmap)If that is not supported now, then please remove that and add it back only once you have models that do support it.
We have already made the corresponding removal in v4.
Quoted 7 lines
Quoted 7 lines
Documentation/scsi/leapraid.rst new file +7
-0+ +File Location +============= +The driver source is located at: + +``drivers/scsi/leapraid/`` +
Quoted 9 lines
Documentation/scsi/leapraid.rst line 35
Quoted 4 lines
Documentation/scsi/leapraid.rst new file +4
-0+.. note:: + + This document is intended for kernel developers and system + integrators who need to build, test, and deploy the LeapRaid driver.Not much help is provided in this file at all. Building will be through the regular config+make. Rather, this document should describe (if any) the kernel module arguments and setup procedure if anything special is needed.
In the next revision (v4), we not only include a description of the kernel module parameters, but also document the new attributes added under the sysfs directory. Thank you for the suggestion.
Quoted 9 lines
Quoted 9 lines
\ No newline at end of file
MAINTAINERS +0
-0@@ -13836,6 +13836,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
Quoted 5 lines
MAINTAINERS S: Maintained · line 13840
Quoted 2 lines
MAINTAINERS +2
-0+LEAPIO SCSI RAID DRIVER +M: doubled <[email protected]>Same as for the signed-off tag: we need a person name here.
doubled to Hao Dongdong here.
Quoted 15 lines
Quoted 15 lines
MAINTAINERS +5
-0+L: [email protected] +S: Supported +F: Documentation/scsi/leapraid.rst +F: drivers/scsi/leapraid/ +drivers/scsi/leapraid/Kconfig new file +3
-0@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +config SCSI_LEAPRAID
Quoted 8 lines
drivers/scsi/leapraid/Kconfig line 9
Quoted 6 lines
drivers/scsi/leapraid/Kconfig new file +6
-0+ tristate "LeapIO RAID Adapter" + depends on PCI && SCSI + select SCSI_SAS_ATTRS + help + Driver for LeapIO Storage & RAID + Controllers.Why the early line split here ?
It was my fault. This has been fixed in v4.
Quoted 32 lines
Quoted 11 lines
drivers/scsi/leapraid/Kconfig new file +2
-0+ To compile this driver as a module, choose M here: the + module will be called leapraid.drivers/scsi/leapraid/leapraid.h new file +0
-0drivers/scsi/leapraid/leapraid.h line 9
Quoted 9 lines
drivers/scsi/leapraid/leapraid.h new file +9
-0@@ -0,0 +1,1128 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2025 LeapIO Tech Inc. +*/ + +#ifndef LEAPRAID_H +#define LEAPRAID_H + +#define REP_POST_HOST_IDX_REG_CNT (16)The parenthesis around the value are not needed. Same comment applies to all the definitions below.
Quoted 5 lines
drivers/scsi/leapraid/leapraid.h new file +5
-0+#define LEAPRAID_DB_RESET (0x00000000) +#define LEAPRAID_DB_READY (0x10000000) +#define LEAPRAID_DB_OPERATIONAL (0x20000000) +#define LEAPRAID_DB_FAULT (0x40000000) +#define LEAPRAID_DB_MASK (0xF0000000)[...]
Quoted 6 lines
A comment describing what this structure represent would be nice. Same for the following struct definitions.
And the same applies to the macro definitions before. Commenting groups of macros to describe what they are would be nice.
we have fixed them in v4. Thanks.
Quoted 68 lines
Quoted 55 lines
drivers/scsi/leapraid/leapraid.h new file +23
-0+struct leapraid_reg_base { +__le32 db; +__le32 ws; +__le32 host_diag; +__le32 r1[9 ]; +__le32 host_int_status; +__le32 host_int_mask; +__le32 r2[4 ]; +__le32 rep_msg_host_idx; +__le32 r3[29 ]; +__le32 r4[2 ]; +__le32 atomic_req_desc_post; +__le32 adapter_log_buf_pos; +__le32 host_log_buf_pos; +__le32 r5[142 ]; +struct leapraid_rep_post_reg_idx { +__le32 idx; +__le32 r1; +__le32 r2; +__le32 r3; + } rep_post_reg_idx[REP_POST_HOST_IDX_REG_CNT ]; +} __packed; +drivers/scsi/leapraid/leapraid_app.c new file +25
-0@@ -0,0 +1,713 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (C) 2025 LeapIO Tech Inc. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* NO WARRANTY +* THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES +* OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, +* WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, +* NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR +* PURPOSE. Each Recipient is solely responsible for determining +* the appropriateness of using and distributing the Program and +* assumes all risks associated with its exercise of rights under +* this Agreement, including but not limited to the risks and costs +* of program errors, damage to or loss of data, programs or equipment, +* and unavailability or interruption of operations. drivers/scsi/leapraid/leapraid_app.c line 35
Quoted 10 lines
drivers/scsi/leapraid/leapraid_app.c new file +10
-0+ +* DISCLAIMER OF LIABILITY +* NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), +* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR +* THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF +* THE POSSIBILITY OF SUCH DAMAGES No need for all this text. The SPDX header implies it.
Quoted 2 lines
[...]
we have removed it in v4. Thanks.
Quoted 12 lines
drivers/scsi/leapraid/leapraid_app.c line 156
Quoted 9 lines
drivers/scsi/leapraid/leapraid_app.c new file +9
-0+struct leapraid_ioctl_locate { +struct leapraid_ioctl_header hdr; +uint32_t id; +uint32_t bus; +uint16_t hdl; +uint16_t r0; +}; + +Double whiteline not needed.
The issue was introduced by our code-processing script. We have corrected the script’s logic to prevent this from happening again.
Quoted 5 lines
drivers/scsi/leapraid/leapraid_app.c line 158
Quoted 2 lines
drivers/scsi/leapraid/leapraid_app.c new file +2
-0+static struct leapraid_adapter * +leapraid_ctl_lookup_adapter (int adapter_number)s/adapter_number/adapter_id ?
Indeed, adapter_id is a better choice.
Quoted 10 lines
Quoted 10 lines
drivers/scsi/leapraid/leapraid_app.c new file +10
-0+{ +struct leapraid_adapter *adapter; + +spin_lock (&leapraid_adapter_lock); +list_for_each_entry (adapter, &leapraid_adapter_list, list) { +if (adapter->adapter_attr.id == adapter_number) { +spin_unlock (&leapraid_adapter_lock); +return adapter; + } + }
Quoted 9 lines
drivers/scsi/leapraid/leapraid_app.c line 174
Quoted 6 lines
drivers/scsi/leapraid/leapraid_app.c new file +6
-0+spin_unlock (&leapraid_adapter_lock); + +return NULL ; +} + +static voidWhy the line break here ? This is not the usual kernel code style.
Emmm, our understanding has been wrong all along, influenced by my personal bias. It has been fixed in the next version.
Quoted 11 lines
drivers/scsi/leapraid/leapraid_app.c line 179
Quoted 5 lines
drivers/scsi/leapraid/leapraid_app.c new file +5
-0+leapraid_cli_scsiio_cmd(struct leapraid_adapter *adapter, + struct leapraid_req *ctl_sp_mpi_req, u16 taskid, + dma_addr_t h2c_dma_addr, size_t h2c_size, + dma_addr_t c2h_dma_addr, size_t c2h_size, + u16 dev_hdl, void *psge)The one tab identation of the arguments makes reading harder as they align with the code. Please use at least 2 tabs or align them with the function "(".
This comment and the one before apply to all other functions it seems.
we have fixed in v4. Thanks.
Quoted 31 lines
Quoted 31 lines
drivers/scsi/leapraid/leapraid_app.c new file +31
-0+{ +struct leapraid_mpi_scsiio_req *scsiio_request + = (struct leapraid_mpi_scsiio_req *) ctl_sp_mpi_req; + + scsiio_request->sense_buffer_len =SCSI_SENSE_BUFFERSIZE ; + scsiio_request->sense_buffer_low_add = +leapraid_get_sense_buffer_dma (adapter, taskid); +memset ((void *)(&adapter->driver_cmds.ctl_cmd.sense), +0 ,SCSI_SENSE_BUFFERSIZE ); +leapraid_build_ieee_sg (adapter, psge, h2c_dma_addr, + h2c_size, c2h_dma_addr, c2h_size); +if (scsiio_request->func ==LEAPRAID_FUNC_SCSIIO_REQ ) +leapraid_fire_scsi_io (adapter, taskid, dev_hdl); +else +leapraid_fire_task (adapter, taskid); +} + +static void +leapraid_ctl_smp_passthrough_cmd (struct leapraid_adapter *adapter, +struct leapraid_req *ctl_sp_mpi_req,u16 taskid, +dma_addr_t h2c_dma_addr,size_t h2c_size, +dma_addr_t c2h_dma_addr,size_t c2h_size, +void *psge,void *h2c) +{ +struct leapraid_smp_passthrough_req *smp_pt_req = + (struct leapraid_smp_passthrough_req *) ctl_sp_mpi_req; +u8 *data; + +if (!adapter->adapter_attr.enable_mp) + smp_pt_req->physical_port =LEAPRAID_DISABLE_MP_PORT_ID ; +if (smp_pt_req->passthrough_flg &0x80 )
Quoted 9 lines
drivers/scsi/leapraid/leapraid_app.c line 215
Quoted 5 lines
drivers/scsi/leapraid/leapraid_app.c new file +5
-0+ data = (u8 *) &smp_pt_req->sgl; + else + data = h2c; + +if (data[1 ] ==0x91 && (data[10 ] ==1 || data[10 ] ==2 ))What are these magic numbers ? Using a macro definition for them would make things more intelligible.
We have reviewed all magic numbers and replaced them with standardized macros.
Quoted 8 lines
Quoted 8 lines
drivers/scsi/leapraid/leapraid_app.c new file +8
-0+ adapter->reset_desc.adapter_link_resetting = true; +leapraid_build_ieee_sg (adapter, psge, h2c_dma_addr, + h2c_size, c2h_dma_addr, c2h_size); +leapraid_fire_task (adapter, taskid); +} + +static void +leapraid_ctl_fire_ieee_cmd(struct leapraid_adapter *adapter,
Quoted 9 lines
drivers/scsi/leapraid/leapraid_app.c line 229
Quoted 6 lines
drivers/scsi/leapraid/leapraid_app.c new file +6
-0+ dma_addr_t h2c_dma_addr, size_t h2c_size, + dma_addr_t c2h_dma_addr, size_t c2h_size, + void *psge, u16 taskid) +{ +leapraid_build_ieee_sg (adapter ,psge ,h2c_dma_addr ,h2c_size , +c2h_dma_addr ,c2h_size );Odd alignment. Please align with "adapter" on the previous line.
Get! We have fixed in next version V4.
Quoted 31 lines
Quoted 31 lines
drivers/scsi/leapraid/leapraid_app.c new file +29
-0+leapraid_fire_task (adapter, taskid); +} +static long +leapraid_ctl_do_command (struct leapraid_adapter *adapter, +struct leapraid_ioctl_command *karg,void __user *mf) +{ +struct leapraid_req *leap_mpi_req =NULL ; +struct leapraid_req *ctl_sp_mpi_req =NULL ; +u16 taskid; +void *h2c =NULL ; +size_t h2c_size =0 ; +dma_addr_t h2c_dma_addr =0 ; +void *c2h =NULL ; +size_t c2h_size =0 ; +dma_addr_t c2h_dma_addr =0 ; +void *psge; +unsigned long timeout; +u16 dev_hdl =LEAPRAID_INVALID_DEV_HANDLE ; +bool issue_reset = false; +u32 sz; +long rc =0 ; + + rc =leapraid_check_adapter_is_op (adapter); +if (rc) + goto out; + + leap_mpi_req =kzalloc (LEAPRAID_REQUEST_SIZE ,GFP_KERNEL ); +if (!leap_mpi_req) { + rc = -ENOMEM ;
Quoted 9 lines
drivers/scsi/leapraid/leapraid_app.c line 312
Quoted 5 lines
drivers/scsi/leapraid/leapraid_app.c new file +5
-0+ goto out; + } + +if (karg->data_sge_offset *4 >LEAPRAID_REQUEST_SIZE + || karg->data_sge_offset > ((~0U ) /4 )) {Code style: "||" should be on the previous line. And align with the if "(". Same code style problems below.
We have reviewed all similar issues and completed the fixes in v4.
Quoted 2 lines
~0U is
UINT_MAX.
fixed!
Quoted 11 lines
drivers/scsi/leapraid/leapraid_app.c line 315
Quoted 3 lines
drivers/scsi/leapraid/leapraid_app.c new file +3
-0+ rc = -EINVAL ; + goto out; + }I stop here. This patch is too long. Scanning it, I see the same code style issues all over it:
- Lots of double blank lines.
- Odd line breaks and parameter alignments
- if conditions formatting
Consistent with the common issues described earlier, we have completed the corresponding fixes in V4.
Thank you again for reviewing our code.
Best regards,
Haodongdong