Commit Graph

25003 Commits

Author SHA1 Message Date
Linus Torvalds
a1d1eb2f57 SCSI misc on 20240919
Updates to the usual drivers (ufs, smartpqi, NCR5380, mac_scsi, lpfc,
 mpi3mr).  There are no user visible core changes and a whole series of
 minor updates and fixes.  The largest core change is probably the
 simplification of the workqueue allocation path.
 
 Signed-off-by: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
 -----BEGIN PGP SIGNATURE-----
 
 iJwEABMIAEQWIQTnYEDbdso9F2cI+arnQslM7pishQUCZuvd5yYcamFtZXMuYm90
 dG9tbGV5QGhhbnNlbnBhcnRuZXJzaGlwLmNvbQAKCRDnQslM7pishV7dAQC+TSlv
 BeNm8W4yAFCXLCwnJh8rT6ZzuBsjsIHH1DPP3wD+IXuIOFf5gVRJGpCNJc/dI082
 /ehSrIdeJxwaNoOOt+Y=
 =SXZD
 -----END PGP SIGNATURE-----

Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI updates from James Bottomley:
 "Updates to the usual drivers (ufs, smartpqi, NCR5380, mac_scsi, lpfc,
  mpi3mr).

  There are no user visible core changes and a whole series of minor
  updates and fixes. The largest core change is probably the
  simplification of the workqueue allocation path"

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (86 commits)
  scsi: smartpqi: update driver version to 2.1.30-031
  scsi: smartpqi: fix volume size updates
  scsi: smartpqi: fix rare system hang during LUN reset
  scsi: smartpqi: add new controller PCI IDs
  scsi: smartpqi: add counter for parity write stream requests
  scsi: smartpqi: correct stream detection
  scsi: smartpqi: Add fw log to kdump
  scsi: bnx2fc: Remove some unused fields in struct bnx2fc_rport
  scsi: qla2xxx: Remove the unused 'del_list_entry' field in struct fc_port
  scsi: ufs: core: Remove ufshcd_urgent_bkops()
  scsi: core: Remove obsoleted declaration for scsi_driverbyte_string()
  scsi: bnx2i: Remove unused declarations
  scsi: core: Simplify an alloc_workqueue() invocation
  scsi: ufs: Simplify alloc*_workqueue() invocation
  scsi: stex: Simplify an alloc_ordered_workqueue() invocation
  scsi: scsi_transport_fc: Simplify alloc_workqueue() invocations
  scsi: snic: Simplify alloc_workqueue() invocations
  scsi: qedi: Simplify an alloc_workqueue() invocation
  scsi: qedf: Simplify alloc_workqueue() invocations
  scsi: myrs: Simplify an alloc_ordered_workqueue() invocation
  ...
2024-09-19 11:28:51 +02:00
Linus Torvalds
726e2d0cf2 dma-mapping updates for linux 6.12
- support DMA zones for arm64 systems where memory starts at > 4GB
    (Baruch Siach, Catalin Marinas)
  - support direct calls into dma-iommu and thus obsolete dma_map_ops for
    many common configurations (Leon Romanovsky)
  - add DMA-API tracing (Sean Anderson)
  - remove the not very useful return value from various dma_set_* APIs
    (Christoph Hellwig)
  - misc cleanups and minor optimizations (Chen Y, Yosry Ahmed,
    Christoph Hellwig)
 -----BEGIN PGP SIGNATURE-----
 
 iQI/BAABCgApFiEEgdbnc3r/njty3Iq9D55TZVIEUYMFAmbr2BALHGhjaEBsc3Qu
 ZGUACgkQD55TZVIEUYNheA/6A453SQy2kFvspFRvEp8ztEqtvxwxGLAUMIyvmU+a
 9b37KlMwUnpbMsXK5+KtYdTLRoIvtl89uIkdZq7pYYKj0uoPZvF9QVnKtrJWAvqK
 fFuauokZznuD3ZSd6v6uY4ijb29ImGfx5kZopQf1zWoYLENxM7mWqRU+eqxDozev
 FbyfYhJzMBhpHveen9+Q7PEfi/90ZdEqtJhSK2AOzuV9ZvbYiSFCrcnT/4wM30DS
 2OxjGa8tKcGYZ9ah0rF2V5hboaRuYedTFgXoKfUSJINJkzmBlTXdxVx5Xr3kQtyC
 7S/xv2y79CXkDKck2+IY7xkhwwBsXPrTAyTzWAIJqOEmaMJ4KqEW54JOsK+VHfmO
 29UKBnASOK0xvfCzakm2631iOzEZF743RgpQiOGeMcnph789Mwu8EUCcqeEW/fJy
 Xh7B0z3/XgJz8BtTG/64IhmqO63Cwa/o7DSQdLr9dh5F/mPBzqrnRov97KL7mH1q
 VSO0Z7+8J0x9ALcYutpth/IzG/lXtXn/pfR1sj6dBHvjf5SwjuT8MKUHgh0l6N+C
 BWZn8swwrZaJ2Li2Gv3CpnCzVQZCkL6ns9VqAWiWq7VfGhDLndMqfi/jHCyGH83i
 E3dMtqf81XaQ7JRDPCs7Jx/4Zkn/iNkkZe8IQsByMc1BY4oeD7/Z2s8mkK8MbNla
 /CA=
 =DZVc
 -----END PGP SIGNATURE-----

Merge tag 'dma-mapping-6.12-2024-09-19' of git://git.infradead.org/users/hch/dma-mapping

Pull dma-mapping updates from Christoph Hellwig:

 - support DMA zones for arm64 systems where memory starts at > 4GB
   (Baruch Siach, Catalin Marinas)

 - support direct calls into dma-iommu and thus obsolete dma_map_ops for
   many common configurations (Leon Romanovsky)

 - add DMA-API tracing (Sean Anderson)

 - remove the not very useful return value from various dma_set_* APIs
   (Christoph Hellwig)

 - misc cleanups and minor optimizations (Chen Y, Yosry Ahmed, Christoph
   Hellwig)

* tag 'dma-mapping-6.12-2024-09-19' of git://git.infradead.org/users/hch/dma-mapping:
  dma-mapping: reflow dma_supported
  dma-mapping: reliably inform about DMA support for IOMMU
  dma-mapping: add tracing for dma-mapping API calls
  dma-mapping: use IOMMU DMA calls for common alloc/free page calls
  dma-direct: optimize page freeing when it is not addressable
  dma-mapping: clearly mark DMA ops as an architecture feature
  vdpa_sim: don't select DMA_OPS
  arm64: mm: keep low RAM dma zone
  dma-mapping: don't return errors from dma_set_max_seg_size
  dma-mapping: don't return errors from dma_set_seg_boundary
  dma-mapping: don't return errors from dma_set_min_align_mask
  scsi: check that busses support the DMA API before setting dma parameters
  arm64: mm: fix DMA zone when dma-ranges is missing
  dma-mapping: direct calls for dma-iommu
  dma-mapping: call ->unmap_page and ->unmap_sg unconditionally
  arm64: support DMA zone above 4GB
  dma-mapping: replace zone_dma_bits by zone_dma_limit
  dma-mapping: use bit masking to check VM_DMA_COHERENT
2024-09-19 11:12:49 +02:00
Linus Torvalds
176000734e ata changes for 6.12
- Convert the qcom AHCI controller DT bindings to DT schema (from
    Rayyan)
 
  - Cleanup of libata core and drivers code handling controller and
    device quirks to rename "blacklist" to the more neutral "quirk" and
    to replace the rarely used "horkage" term with the more common
    "quirk" naming (from me)
 
  - Add libata-core message to print the quirks applied to a controller
    or device (from me)
 
  - Remove the not-so-useful function ata_noop_qc_prep() from libata core
    (from me)
 
  - ahci_imx driver cleanup, improvements and DT bindings compatible
    strings update (from Richard and Dan)
 
  - libahci_platform improvements (from Zhang)
 
  - Remove obsolete functions declarations from libata header files (from
    Gaosheng)
 
  - Improve teh ahci_brcm driver using managed device resources funetions
    (from Zhang)
 
  - Introduce new helper function to improve libata EH code readability
    (from Niklas)
 
  - Enable module autoloading for the pata_ftide010, pata_ixp4xx and
    sata_gemini drivers (from Liao)
 
  - Move SATA related functions and data declaraions from libata-core to
    libata-sata (from me)
 
  - Rename the function handling the sense data for successful NCQ
    commands log to better reflect that function actions (from me)
 
  - Reduce libata memory usage by moving port resources to struct
    ata_device and by optimizing the management of resources for CDL
    capable devices (from me)
 
  - Improve libata-eh handling of failed ATA passthrough commands (from
    Niklas)
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQSRPv8tYSvhwAzJdzjdoc3SxdoYdgUCZuvJ2wAKCRDdoc3SxdoY
 dhVhAP9Zctzd9Ylb17eO7vVDwA0p7nzqyDxwxWPL8p3FtSm8PQD+PWQaLAPfWmKD
 X8RqWv9WDGvCGUTEBBSjiZslEp7ccwk=
 =68kF
 -----END PGP SIGNATURE-----

Merge tag 'ata-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux

Pull ata updates from Damien Le Moal:

 - Convert the qcom AHCI controller DT bindings to DT schema (from
   Rayyan)

 - Cleanup of libata core and drivers code handling controller and
   device quirks to rename "blacklist" to the more neutral "quirk" and
   to replace the rarely used "horkage" term with the more common
   "quirk" naming (me)

 - Add libata-core message to print the quirks applied to a controller
   or device (me)

 - Remove the not-so-useful function ata_noop_qc_prep() from libata core
   (me)

 - ahci_imx driver cleanup, improvements and DT bindings compatible
   strings update (Richard and Dan)

 - libahci_platform improvements (Zhang)

 - Remove obsolete functions declarations from libata header files (from
   Gaosheng)

 - Improve teh ahci_brcm driver using managed device resources funetions
   (Zhang)

 - Introduce new helper function to improve libata EH code readability
   (Niklas)

 - Enable module autoloading for the pata_ftide010, pata_ixp4xx and
   sata_gemini drivers (Liao)

 - Move SATA related functions and data declaraions from libata-core to
   libata-sata (me)

 - Rename the function handling the sense data for successful NCQ
   commands log to better reflect that function actions (me)

 - Reduce libata memory usage by moving port resources to struct
   ata_device and by optimizing the management of resources for CDL
   capable devices (me)

 - Improve libata-eh handling of failed ATA passthrough commands
   (Niklas)

* tag 'ata-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux: (39 commits)
  ata: libata: Clear DID_TIME_OUT for ATA PT commands with sense data
  ata: libata: Fix W=1 compilation warning
  ata: libata: Improve CDL resource management
  ata: libata: Introduce ata_dev_free_resources
  ata: libata: Move sector_buf from struct ata_port to struct ata_device
  ata: libata: Rename ata_eh_read_sense_success_ncq_log()
  ata: libata: Move sata_std_hardreset() definition to libata-sata.c
  ata: libata: Move sata_down_spd_limit() to libata-sata.c
  ata: libata: Improve __ata_qc_complete()
  ata: libata-scsi: Improve ata_scsi_handle_link_detach()
  ata: libata: Cleanup libata-transport
  ata: sata_gemini: Enable module autoloading
  ata: pata_ixp4xx: Enable module autoloading
  ata: pata_ftide010: Enable module autoloading
  ata: libata: Add helper ata_eh_decide_disposition()
  ata: ahci_brcm: Use devm_platform_ioremap_resource_byname() helper function
  ata: libata: Remove obsolete function declarations
  ata: ahci_imx: Fix error code in probe()
  ata: libahci_platform: Simplify code with for_each_child_of_node_scoped()
  ata: ahci_imx: Correct the email address
  ...
2024-09-19 09:49:10 +02:00
Jakub Kicinski
502cc061de Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Cross-merge networking fixes after downstream PR.

Conflicts:

drivers/net/phy/phy_device.c
  2560db6ede ("net: phy: Fix missing of_node_put() for leds")
  1dce520abd ("net: phy: Use for_each_available_child_of_node_scoped()")
https://lore.kernel.org/20240904115823.74333648@canb.auug.org.au

Adjacent changes:

drivers/net/ethernet/xilinx/xilinx_axienet.h
drivers/net/ethernet/xilinx/xilinx_axienet_main.c
  858430db28 ("net: xilinx: axienet: Fix race in axienet_stop")
  76abb5d675 ("net: xilinx: axienet: Add statistics support")

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-09-05 20:37:20 -07:00
Alexander Lobakin
782dbbf589 netdev_features: convert NETIF_F_FCOE_MTU to dev->fcoe_mtu
Ability to handle maximum FCoE frames of 2158 bytes can never be changed
and thus more of an attribute, not a toggleable feature.
Move it from netdev_features_t to "cold" priv flags (bitfield bool) and
free yet another feature bit.

Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2024-09-03 11:36:43 +02:00
Linus Torvalds
770b0ffe28 SCSI fixes on 20240831
Minor fixes only.  The sd.c one ignores a sync cache request if format
 is in progress which can happen if formatting a drive across
 suspend/resume.
 
 Signed-off-by: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
 -----BEGIN PGP SIGNATURE-----
 
 iJwEABMIAEQWIQTnYEDbdso9F2cI+arnQslM7pishQUCZtM61CYcamFtZXMuYm90
 dG9tbGV5QGhhbnNlbnBhcnRuZXJzaGlwLmNvbQAKCRDnQslM7pishZ+yAQDz47pp
 ZEr9bOMueiIYs+ZpmK1KRBHviFApXr9JJGzoHAD/WsUN43+5+y12QhGWSA0/M4qo
 Tog2K3HXvb4kIsDoXEg=
 =n2gm
 -----END PGP SIGNATURE-----

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "Minor fixes only.

  The sd.c one ignores a sync cache request if format is in progress
  which can happen if formatting a drive across suspend/resume"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: sd: Ignore command SYNCHRONIZE CACHE error if format in progress
  scsi: aacraid: Fix double-free on probe failure
  scsi: lpfc: Fix overflow build issue
2024-09-01 07:00:38 +12:00
Christoph Hellwig
334304ac2b dma-mapping: don't return errors from dma_set_max_seg_size
A NULL dev->dma_parms indicates either a bus that is not DMA capable or
grave bug in the implementation of the bus code.

There isn't much the driver can do in terms of error handling for either
case, so just warn and continue as DMA operations will fail anyway.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # For MMC
2024-08-29 07:22:49 +03:00
Christoph Hellwig
b5a73bf4d1 scsi: check that busses support the DMA API before setting dma parameters
We'll start throwing warnings soon when dma_set_seg_boundary and
dma_set_max_seg_size are called on devices for buses that don't fully
support the DMA API.  Prepare for that by making the calls in the SCSI
midlayer conditional.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-29 07:22:12 +03:00
Martin K. Petersen
cff06a799d Merge patch series "smartpqi updates"
Don Brace <don.brace@microchip.com> says:

These patches are based on Martin Petersen's 6.12/scsi-queue tree
  https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git
  6.12/scsi-queue

There are two functional changes:
    smartpqi-add-fw-log-to-kdump
    smartpqi-add-counter-for-parity-write-stream-requests

There are three minor bug fixes:
    smartpqi-fix-stream-detection
    smartpqi-fix-rare-system-hang-during-LUN-reset
    smartpqi-fix-volume-size-updates

The other two patches add PCI-IDs for new controllers and change the
driver version.

This set of changes consists of:
* smartpqi-add-fw-log-to-kdump

  During a kdump, the driver tells the controller to copy its logging
  information to some pre-allocated buffers that can be analyzed
  later.

  This is a "feature" driven capability and is backward compatible
  with existing controller FW.

  This patch renames some prefixes for OFA (Online-Firmware Activation
  ofa_*) buffers to host_memory_*. So, not a lot of actual functional
  changes to smartpqi_init.c, mainly determining the memory size
  allocation.

  We added a function to notify the controller to copy debug data into
  host memory before continuing kdump.

  Most of the functional changes are in smartpqi_sis.c where the
  actual handshaking is done.

* smartpqi-fix-stream-detection

  Correct some false write-stream detections. The data structure used
  to check for write-streams was not initialized to all 0's causing
  some false write stream detections. The driver sends down streamed
  requests to the raid engine instead of using AIO bypass for some
  extra performance.  (Potential full-stripe write verses Read Modify
  Write).

  False detections have not caused any data corruption.  Found by
  internal testing. No known externally reported bugs.

* smartpqi-add-counter-for-parity-write-stream-requests

  Adding some counters for raid_bypass and write streams. These two
  counters are related because write stream detection is only checked
  if an I/O request is eligible for bypass (AIO).

  The bypass counter (raid_bypass_cnt) was moved into a common
  structure (pqi_raid_io_stats) and changed to type __percpu. The
  write stream counter is (write_stream_cnt) has been added to this
  same structure.

  These counters are __percpu counters for performance. We added a
  sysfs entry to show the write stream count. The raid bypass counter
  sysfs entry already exists.

  Useful for checking streaming writes. The change in the sysfs entry
  write_stream_cnt can be checked during AIO eligible write
  operations.

* smartpqi-add-new-controller-PCI-IDs

  Adding support for new controller HW.  No functional changes.

* smartpqi-fix-rare-system-hang-during-LUN-reset

  We found a rare race condition that can occur during a LUN reset. We
  were not emptying our internal queue completely.

  There have been some rare conditions where our internal request
  queue has requests for multiple LUNs and a reset comes in for one of
  the LUNs. The driver waits for this internal queue to empty. We were
  only clearing out the requests for the LUN being reset so the
  request queue was never empty causing a hang.

  The Fix:

     For all requests in our internal request queue:

        Complete requests with DID_RESET for queued requests for the
        device undergoing a reset.

        Complete requests with DID_REQUEUE for all other queued requests.

  Found by internal testing. No known externally reported bugs.

* smartpqi-fix-volume-size-updates

  The current code only checks for a size change if there is also a
  queue depth change.  We are separating the check for queue depth and
  the size changes.

  Found by internal testing. No known bugs were filed.

* smartpqi-update-version-to-2.1.30-031
  No functional changes.

Link: https://lore.kernel.org/r/20240827185501.692804-1-don.brace@microchip.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-28 22:16:33 -04:00
Don Brace
bda1c931e2 scsi: smartpqi: update driver version to 2.1.30-031
Update driver version to 2.1.30-031.

Reviewed-by: David Strahan <david.strahan@microchip.com>
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Reviewed-by: Gerry Morong <gerry.morong@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Link: https://lore.kernel.org/r/20240827185501.692804-8-don.brace@microchip.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-28 22:10:35 -04:00
Don Brace
07dde72ff1 scsi: smartpqi: fix volume size updates
Correct logical volume size changes by moving the check for a volume rescan
outside of the check for a queue depth change.

Signed-off-by: Don Brace <don.brace@microchip.com>
Link: https://lore.kernel.org/r/20240827185501.692804-7-don.brace@microchip.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-28 22:10:34 -04:00
Murthy Bhat
4e0a51716d scsi: smartpqi: fix rare system hang during LUN reset
Correct a rare case where in a LUN reset occurs on a device and I/O
requests for other devices persist in the driver's internal request queue.

Part of a LUN reset involves waiting for our internal request queue to
empty before proceeding. The internal request queue contains requests not
yet sent down to the controller.

We were clearing the requests queued for the LUN undergoing a reset, but
not all of the queued requests. Causing a hang.

For all requests in our internal request queue:

   Complete requests with DID_RESET for queued requests for the device
   undergoing a reset.

   Complete requests with DID_REQUEUE for all other queued requests.

Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Signed-off-by: Murthy Bhat <Murthy.Bhat@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Link: https://lore.kernel.org/r/20240827185501.692804-6-don.brace@microchip.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-28 22:10:34 -04:00
David Strahan
dbc39b8454 scsi: smartpqi: add new controller PCI IDs
All PCI ID entries in Hex.

Add new cisco pci ids:
                                             VID  / DID  / SVID / SDID
                                             ----   ----   ----   ----
                                             9005   028f   1137   02fe
                                             9005   028f   1137   02ff
                                             9005   028f   1137   0300

Add new h3c pci ids:
                                             VID  / DID  / SVID / SDID
                                             ----   ----   ----   ----
                                             9005   028f   193d   0462
                                             9005   028f   193d   8462

Add new ieit pci ids:
                                             VID  / DID  / SVID / SDID
                                             ----   ----   ----   ----
                                             9005   028f   1ff9   00a3

Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Signed-off-by: David Strahan <David.Strahan@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Link: https://lore.kernel.org/r/20240827185501.692804-5-don.brace@microchip.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-28 22:10:34 -04:00
Mahesh Rajashekhara
283dcc1b14 scsi: smartpqi: add counter for parity write stream requests
Add sysfs entry to check for write stream requests.

Move existing raid_bypass_cnt into a structure named pqi_raid_io_stats and
add member write_stream_cnt. These two counters are related because write
stream detection is only checked if an I/O request is eligible for bypass
(AIO).

Example usage:

lsscsi
[15:1:0:0]   disk    Adaptec  LOGICAL VOLUME   0129  /dev/sdae

cat /sys/block/sdae/device/ssd_smart_path_enabled
1
^
|
+---- NOTE: here bypass has been enabled on device sdae

To read the counter for parity write stream requests:

cat /sys/block/sdae/device/write_stream_cnt
0x60cd507

Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Signed-off-by: Mahesh Rajashekhara <mahesh.rajashekhara@microchip.com>
Co-developed-by: Kevin Barnett <kevin.barnett@microchip.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Link: https://lore.kernel.org/r/20240827185501.692804-4-don.brace@microchip.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-28 22:10:34 -04:00
Mahesh Rajashekhara
4c76114932 scsi: smartpqi: correct stream detection
Correct stream detection by initializing the structure
pqi_scsi_dev_raid_map_data to 0s.

When the OS issues SCSI READ commands, the driver erroneously considers
them as SCSI WRITES. If they are identified as sequential IOs, the driver
then submits those requests via the RAID path instead of the AIO path.

The 'is_write' flag might be set for SCSI READ commands also.  The driver
may interpret SCSI READ commands as SCSI WRITE commands, resulting in IOs
being submitted through the RAID path.

Note: This does not cause data corruption.

Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Signed-off-by: Mahesh Rajashekhara <mahesh.rajashekhara@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Link: https://lore.kernel.org/r/20240827185501.692804-3-don.brace@microchip.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-28 22:10:34 -04:00
Murthy Bhat
058311b72f scsi: smartpqi: Add fw log to kdump
Add controller logs to kdump.

Driver allocates DMA memory and communicates this address to FW.  In the
event of system crash, host driver notifies the firmware about the crash
and firmware posts all the necessary logs in the pre-allocated host buffer
for firmware debugging.

Once firmware notifies the completion of the log uploading to the host
memory and host continues with the OS crash dump saving.

This is a "feature" driven capability and is backward compatible with
existing controller FW.

Rename some prefixes for OFA (Online-Firmware Activation ofa_*) buffers to
host_memory_*. So, not a lot of actual functional changes to
smartpqi_init.c, mainly determining the memory size allocation.

Added a function to notify the controller to copy debug data into host
memory before continuing kdump.

Most of the functional changes are in smartpqi_sis.c where the actual
handshaking is done.

Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Reviewed-by: Mike McGowen <mike.mcgowen@microchip.com>
Signed-off-by: Murthy Bhat <Murthy.Bhat@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Link: https://lore.kernel.org/r/20240827185501.692804-2-don.brace@microchip.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-28 22:10:34 -04:00
Christophe JAILLET
d5a4b0d642 scsi: bnx2fc: Remove some unused fields in struct bnx2fc_rport
Some fields are unused in struct bnx2fc_rport.  Remove them in order to
save 96 bytes on a x86_64.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/42e20b159f3bbb12da7796463a521ca051bd5274.1724399924.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-28 21:33:21 -04:00
Christophe JAILLET
e59f43fb64 scsi: qla2xxx: Remove the unused 'del_list_entry' field in struct fc_port
The 'del_list_entry' field in "struct fc_port" is unused.

The field was introduced in commit 2d70c103fd ("[SCSI] qla2xxx: Add LLD
target-mode infrastructure for >= 24xx series") in 2012-05 and the last
user was removed in commit 726b854870 ("qla2xxx: Add framework for async
fabric discovery") in 2017-02.

Remove this unused field.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/69155321ab26c1f4d473d5bb6cd44b59b9b6a020.1724094686.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-28 21:31:59 -04:00
Yue Haibing
adedd0f46c scsi: bnx2i: Remove unused declarations
Commit cf4e636385 ("[SCSI] bnx2i: Add bnx2i iSCSI driver.") declared but
never implemented these.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20240824084724.3647307-1-yuehaibing@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-28 20:58:47 -04:00
Linus Torvalds
891e811ad6 SCSI fixes on 20240824
The important core fix is another tweak to our discard discovery
 issues.  The off by 512 in logical block count seems bad, but in fact
 the inline was only ever used in debug prints, which is why no-one
 noticed.
 
 Signed-off-by: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
 -----BEGIN PGP SIGNATURE-----
 
 iJwEABMIAEQWIQTnYEDbdso9F2cI+arnQslM7pishQUCZsmoJyYcamFtZXMuYm90
 dG9tbGV5QGhhbnNlbnBhcnRuZXJzaGlwLmNvbQAKCRDnQslM7pishUp5AQCe8tyb
 L0iMWG8/9SeQ5Eyj6EN4iy+6nGxFx+c86XtP2wEA7du6y4of9+rOPVHLn8NyLALH
 WkJ6K1876z7qsbYhKqA=
 =TXd7
 -----END PGP SIGNATURE-----

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "The important core fix is another tweak to our discard discovery
  issues. The off by 512 in logical block count seems bad, but in fact
  the inline was only ever used in debug prints, which is why no-one
  noticed"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: sd: Do not attempt to configure discard unless LBPME is set
  scsi: MAINTAINERS: Add header files to SCSI SUBSYSTEM
  scsi: ufs: qcom: Add UFSHCD_QUIRK_BROKEN_LSDBS_CAP for SM8550 SoC
  scsi: ufs: core: Add a quirk for handling broken LSDBS field in controller capabilities register
  scsi: core: Fix the return value of scsi_logical_block_count()
  scsi: MAINTAINERS: Update HiSilicon SAS controller driver maintainer
2024-08-25 12:00:16 +12:00
Martin K. Petersen
70302fc7ad Merge patch series "Simplify multiple create*_workqueue() invocations"
Bart Van Assche <bvanassche@acm.org> says:

Hi Martin,

Multiple SCSI drivers use snprintf() to format a workqueue name before
invoking one of the create*_workqueue() macros. This patch series
simplifies such code by passing the format string and arguments to
alloc_workqueue(). Additionally, the structure members that are only
used as a temporary buffer for formatting workqueue names are
removed. Please consider this patch series for the next merge window.

Thanks,

Bart.

Link: https://lore.kernel.org/r/20240822195944.654691-1-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 21:30:06 -04:00
Bart Van Assche
ba52850cb6 scsi: core: Simplify an alloc_workqueue() invocation
Let alloc_workqueue() format the workqueue name. Remove the
work_q_name[] member from struct Scsi_Host because it is no longer
used by any SCSI driver nor by the SCSI core.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240822195944.654691-19-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 21:28:57 -04:00
Bart Van Assche
0ef9b0186d scsi: stex: Simplify an alloc_ordered_workqueue() invocation
Let alloc_ordered_workqueue() format the workqueue name instead of calling
snprintf() explicitly.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240822195944.654691-17-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 21:28:57 -04:00
Bart Van Assche
06d5378976 scsi: scsi_transport_fc: Simplify alloc_workqueue() invocations
Let alloc_workqueue() format the workqueue name instead of calling
snprintf() explicitly.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240822195944.654691-16-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 21:28:57 -04:00
Bart Van Assche
6411307b63 scsi: snic: Simplify alloc_workqueue() invocations
Let alloc_workqueue() format the workqueue name instead of calling
snprintf() explicitly. Not setting shost->work_q_name is safe because
there is no code that reads the value set by the removed code.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240822195944.654691-15-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 21:28:56 -04:00
Bart Van Assche
19d7cda1c6 scsi: qedi: Simplify an alloc_workqueue() invocation
Let alloc_workqueue() format the workqueue name instead of calling
snprintf() explicitly.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240822195944.654691-14-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 21:28:56 -04:00
Bart Van Assche
8bbe60bbd4 scsi: qedf: Simplify alloc_workqueue() invocations
Let alloc_workqueue() format the workqueue name instead of calling
snprintf() explicitly.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240822195944.654691-13-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 21:28:56 -04:00
Bart Van Assche
f306791662 scsi: myrs: Simplify an alloc_ordered_workqueue() invocation
Let alloc_ordered_workqueue() format the workqueue name instead of calling
snprintf() explicitly.

Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240822195944.654691-12-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 21:28:56 -04:00
Bart Van Assche
c57a617fd5 scsi: myrb: Simplify an alloc_ordered_workqueue() invocation
Let alloc_ordered_workqueue() format the workqueue name instead of calling
snprintf() explicitly.

Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240822195944.654691-11-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 21:28:56 -04:00
Bart Van Assche
b3b359ac72 scsi: mpt3sas: Simplify an alloc_ordered_workqueue() invocation
Let alloc_ordered_workqueue() format the workqueue name instead of calling
snprintf() explicitly.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240822195944.654691-10-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 21:28:56 -04:00
Bart Van Assche
1bd289620e scsi: mpi3mr: Simplify an alloc_ordered_workqueue() invocation
Let alloc_ordered_workqueue() format the workqueue name instead of calling
snprintf() explicitly.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240822195944.654691-9-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 21:28:56 -04:00
Bart Van Assche
5615cfb3cb scsi: ibmvscsi_tgt: Simplify an alloc_workqueue() invocation
Let alloc_workqueue() format the workqueue name instead of calling
snprintf() explicitly.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240822195944.654691-8-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 21:28:56 -04:00
Bart Van Assche
d77381c2f6 scsi: fcoe: Simplify alloc_ordered_workqueue() invocations
Let alloc_ordered_workqueue() format the workqueue name instead of calling
snprintf() explicitly.

Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240822195944.654691-7-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 21:28:56 -04:00
Bart Van Assche
4cb1b41a5e scsi: esas2r: Simplify an alloc_ordered_workqueue() invocation
Let alloc_ordered_workqueue() format the workqueue name instead of calling
snprintf() explicitly.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240822195944.654691-6-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 21:28:55 -04:00
Bart Van Assche
70fbb7c115 scsi: bfa: Simplify an alloc_ordered_workqueue() invocation
Let alloc_ordered_workqueue() format the workqueue name instead of
calling snprintf() explicitly.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240822195944.654691-5-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 21:28:55 -04:00
Bart Van Assche
66088e7b91 scsi: be2iscsi: Simplify an alloc_workqueue() invocation
Let alloc_workqueue() format the workqueue name instead of calling
snprintf() explicitly.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240822195944.654691-4-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 21:28:55 -04:00
Bart Van Assche
b97c0741c7 scsi: Expand all create*_workqueue() invocations
The workqueue maintainer wants to remove the create*_workqueue() macros
because these macros always set the WQ_MEM_RECLAIM flag and because these
only support literal workqueue names. Hence this patch that replaces the
create*_workqueue() invocations with the definition of this macro. The
WQ_MEM_RECLAIM flag has been retained because I think that flag is necessary
for workqueues created by storage drivers. This patch has been generated by
running spatch and git clang-format. spatch has been invoked as follows:

spatch --in-place --sp-file expand-create-workqueue.spatch $(git grep -lEw 'create_(freezable_|singlethread_|)workqueue' */scsi */ufs)

The contents of the expand-create-workqueue.spatch file is as follows:

@@
expression name;
@@
-create_workqueue(name)
+alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, name)
@@
expression name;
@@
-create_freezable_workqueue(name)
+alloc_workqueue("%s", WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, 1, name)
@@
expression name;
@@
-create_singlethread_workqueue(name)
+alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM, name)

Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20240822195944.654691-2-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 21:28:55 -04:00
Yihang Li
4f9eedfa27 scsi: sd: Ignore command SYNCHRONIZE CACHE error if format in progress
If formatting a suspended disk (such as formatting with different DIF
type), the disk will be resuming first, and then the format command will
submit to the disk through SG_IO ioctl.

When the disk is processing the format command, the system does not
submit other commands to the disk. Therefore, the system attempts to
suspend the disk again and sends the SYNCHRONIZE CACHE command. However,
the SYNCHRONIZE CACHE command will fail because the disk is in the
formatting process. This will cause the runtime_status of the disk to
error and it is difficult for user to recover it. Error info like:

[  669.925325] sd 6:0:6:0: [sdg] Synchronizing SCSI cache
[  670.202371] sd 6:0:6:0: [sdg] Synchronize Cache(10) failed: Result: hostbyte=0x00 driverbyte=DRIVER_OK
[  670.216300] sd 6:0:6:0: [sdg] Sense Key : 0x2 [current]
[  670.221860] sd 6:0:6:0: [sdg] ASC=0x4 ASCQ=0x4

To solve the issue, ignore the error and return success/0 when format is
in progress.

Cc: stable@vger.kernel.org
Signed-off-by: Yihang Li <liyihang9@huawei.com>
Link: https://lore.kernel.org/r/20240819090934.2130592-1-liyihang9@huawei.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 21:23:21 -04:00
Dan Carpenter
2e4b02fad0 scsi: elx: libefc: Fix potential use after free in efc_nport_vport_del()
The kref_put() function will call nport->release if the refcount drops to
zero.  The nport->release release function is _efc_nport_free() which frees
"nport".  But then we dereference "nport" on the next line which is a use
after free.  Re-order these lines to avoid the use after free.

Fixes: fcd427303e ("scsi: elx: libefc: SLI and FC PORT state machine interfaces")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/b666ab26-6581-4213-9a3d-32a9147f0399@stanley.mountain
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 21:08:44 -04:00
Ben Hutchings
919ddf8336 scsi: aacraid: Fix double-free on probe failure
aac_probe_one() calls hardware-specific init functions through the
aac_driver_ident::init pointer, all of which eventually call down to
aac_init_adapter().

If aac_init_adapter() fails after allocating memory for aac_dev::queues,
it frees the memory but does not clear that member.

After the hardware-specific init function returns an error,
aac_probe_one() goes down an error path that frees the memory pointed to
by aac_dev::queues, resulting.in a double-free.

Reported-by: Michael Gordon <m.gordon.zelenoborsky@gmail.com>
Link: https://bugs.debian.org/1075855
Fixes: 8e0c5ebde8 ("[SCSI] aacraid: Newer adapter communication iterface support")
Signed-off-by: Ben Hutchings <benh@debian.org>
Link: https://lore.kernel.org/r/ZsZvfqlQMveoL5KQ@decadent.org.uk
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 21:04:12 -04:00
Sherry Yang
3417c9574e scsi: lpfc: Fix overflow build issue
Build failed while enabling "CONFIG_GCOV_KERNEL=y" and
"CONFIG_GCOV_PROFILE_ALL=y" with following error:

BUILDSTDERR: drivers/scsi/lpfc/lpfc_bsg.c: In function 'lpfc_get_cgnbuf_info':
BUILDSTDERR: ./include/linux/fortify-string.h:114:33: error: '__builtin_memcpy' accessing 18446744073709551615 bytes at offsets 0 and 0 overlaps 9223372036854775807 bytes at offset -9223372036854775808 [-Werror=restrict]
BUILDSTDERR:   114 | #define __underlying_memcpy     __builtin_memcpy
BUILDSTDERR:       |                                 ^
BUILDSTDERR: ./include/linux/fortify-string.h:637:9: note: in expansion of macro '__underlying_memcpy'
BUILDSTDERR:   637 |         __underlying_##op(p, q, __fortify_size);                        \
BUILDSTDERR:       |         ^~~~~~~~~~~~~
BUILDSTDERR: ./include/linux/fortify-string.h:682:26: note: in expansion of macro '__fortify_memcpy_chk'
BUILDSTDERR:   682 | #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
BUILDSTDERR:       |                          ^~~~~~~~~~~~~~~~~~~~
BUILDSTDERR: drivers/scsi/lpfc/lpfc_bsg.c:5468:9: note: in expansion of macro 'memcpy'
BUILDSTDERR:  5468 |         memcpy(cgn_buff, cp, cinfosz);
BUILDSTDERR:       |         ^~~~~~

This happens from the commit 06bb7fc0fe ("kbuild: turn on -Wrestrict by
default"). Address this issue by using size_t type.

Signed-off-by: Sherry Yang <sherry.yang@oracle.com>
Link: https://lore.kernel.org/r/20240821065131.1180791-1-sherry.yang@oracle.com
Reviewed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-22 20:57:41 -04:00
Linus Torvalds
df6cbc62cc SCSI fixes on 20240817
Two small fixes to the mpi3mr driver.  One to avoid oversize
 allocations in tracing and the other to fix an uninitialized spinlock
 in the user to driver feature request code (used to trigger dumps and
 the like).
 
 Signed-off-by: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
 -----BEGIN PGP SIGNATURE-----
 
 iJwEABMIAEQWIQTnYEDbdso9F2cI+arnQslM7pishQUCZsBQwyYcamFtZXMuYm90
 dG9tbGV5QGhhbnNlbnBhcnRuZXJzaGlwLmNvbQAKCRDnQslM7pisheu1AQCI/XZH
 BpmXjjiQXGXTS7f2M6qzL0u3atQe3mN4+KIIbgEA+7WlNAiPa6rw2wjcXhOfQNs8
 BHhU85KzlrzVuQY/b18=
 =YODS
 -----END PGP SIGNATURE-----

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "Two small fixes to the mpi3mr driver. One to avoid oversize
  allocations in tracing and the other to fix an uninitialized spinlock
  in the user to driver feature request code (used to trigger dumps and
  the like)"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: mpi3mr: Avoid MAX_PAGE_ORDER WARNING for buffer allocations
  scsi: mpi3mr: Add missing spin_lock_init() for mrioc->trigger_lock
2024-08-17 10:04:01 -07:00
Martin K. Petersen
cbaac68987 scsi: sd: Do not attempt to configure discard unless LBPME is set
Commit f874d7210d ("scsi: sd: Keep the discard mode stable") attempted
to address an issue where one mode of discard operation got configured
prior to the device completing full discovery.  Unfortunately this
change assumed discard was always enabled on the device.

Do not attempt to configure discard unless LBPME is enabled.

Link: https://lore.kernel.org/r/20240817005325.3319384-1-martin.petersen@oracle.com
Fixes: f874d7210d ("scsi: sd: Keep the discard mode stable")
Reported-by: Chris Bainbridge <chris.bainbridge@gmail.com>
Tested-by: Chris Bainbridge <chris.bainbridge@gmail.com>
Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tested-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-16 21:16:49 -04:00
Martin K. Petersen
992f988462 Merge patch series "NCR5380: Bug fixes and other improvements"
Finn Thain <fthain@linux-m68k.org> says:

This series begins with some work on the mac_scsi driver to improve
compatibility with SCSI2SD v5 devices. Better error handling is needed
there because the PDMA hardware does not tolerate the write latency
spikes which SD cards can produce.

A bug is fixed in the 5380 core driver so that scatter/gather can be
enabled in mac_scsi.

Several patches at the end of this series improve robustness and
correctness in the core driver.

This series has been tested on a variety of mac_scsi hosts. A variety
of SCSI targets was also tested, including Quantum HDD, Fujitsu HDD,
Iomega FDD, Ricoh CD-RW, Matsushita CD-ROM, SCSI2SD and BlueSCSI.

Link: https://lore.kernel.org/r/cover.1723001788.git.fthain@linux-m68k.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-12 22:06:39 -04:00
Finn Thain
a8ebca904f scsi: NCR5380: Clean up indentation
Tidy up a few indentation annoyances. No functional change.

Signed-off-by: Finn Thain <fthain@linux-m68k.org>
Link: https://lore.kernel.org/r/8541ea096fde9f8716b79e4f0707aed916a8c58d.1723001788.git.fthain@linux-m68k.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-12 22:05:50 -04:00
Finn Thain
c331df3d4a scsi: NCR5380: Remove obsolete comment
This comment should have been removed in commit e7734ef14e ("scsi:
NCR5380: Remove context check") when the irqs_disabled() conditional was
removed.

Signed-off-by: Finn Thain <fthain@linux-m68k.org>
Link: https://lore.kernel.org/r/c54aff198b5a60be8ecfd50df0a9a77850730501.1723001788.git.fthain@linux-m68k.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-12 22:05:49 -04:00
Finn Thain
8663cadefd scsi: NCR5380: Remove redundant result calculation from NCR5380_transfer_pio()
NCR5380_transfer_pio() returns an ambiguous value which is ignored by
callers. Make it void and remove the redundant calculation. Adopt
kernel-doc format for the updated description.

Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
Link: https://lore.kernel.org/r/c07a52d0d7610b4b9969d6dd4fc9a62458fe15de.1723001788.git.fthain@linux-m68k.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-12 22:05:49 -04:00
Finn Thain
476f8c82e2 scsi: NCR5380: Drop redundant member from struct NCR5380_cmd
The 'message' member is stored but never loaded so just remove it.

Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
Link: https://lore.kernel.org/r/4dc903a95a814d0c9b09656f3651a1bd798fcbbb.1723001788.git.fthain@linux-m68k.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-12 22:05:49 -04:00
Finn Thain
086c4802cf scsi: NCR5380: Handle BSY signal loss during information transfer phases
Improve robustness by checking for a lost BSY signal during the information
transfer loop. The status register is being polled anyway, so a BSY check
costs nothing. BSY signal loss could be caused by a target error or a
kicked plug etc. A bus reset is another possibility but that is already
handled and hostdata->connected would be NULL.

Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
Link: https://lore.kernel.org/r/d253dddaf4d9bc17b8ee02ea2b731d92f25b16f1.1723001788.git.fthain@linux-m68k.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-12 22:05:49 -04:00
Finn Thain
1c71065df2 scsi: NCR5380: Initialize buffer for MSG IN and STATUS transfers
Following an incomplete transfer in MSG IN phase, the driver would not
notice the problem and would make use of invalid data. Initialize 'tmp'
appropriately and bail out if no message was received. For STATUS phase,
preserve the existing status code unless a new value was transferred.

Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
Link: https://lore.kernel.org/r/52e02a8812ae1a2d810d7f9f7fd800c3ccc320c4.1723001788.git.fthain@linux-m68k.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2024-08-12 22:05:49 -04:00