Commit graph

30 commits

Author SHA1 Message Date
John Hall f07b267d8c smartpqi: Change alignment for dma tags
Problem: Under certain I/O conditions, a program doing large block disk
reads can cause a controller to crash.

Root Cause: The SCSI read request and destination address in the BDMA
descriptor is incorrect, causing the BDMA engine in the controller to
assert.

Fix: Change the alignment for creating bus_dma_tags in the driver from
PAGE_SIZE (4k) to 1, which allows the controller to manage it's own
address range for BDMA transactions.

Risk: Medium

Exposure: This reverts a change first made to support NVMe drives on
Excalibur. At that time a 4k alignment was necessary. This no longer
seems to be the case.

PR: 259541
Reported by: Ka Ho Ng <khng@freebsd.org>
Reviewed by: imp
Differential Revision:	https://reviews.freebsd.org/D41619
2023-10-18 21:12:27 -06:00
John F. Carr b064a4c9ee smartpqi: Drop spinlock before freeing memory
pqisrc_free_device frees the device softc with the os spinlock
held. This causes crashes when devices are removed because the memory
free might sleep (which is prohibited with spin locks held). Drop the
spinlock before releasing the memory.

MFC After: 2 days
PR: 273289
Reviewed by: imp
2023-10-18 21:06:40 -06:00
Warner Losh 2f06449d64 smartpqi: Fix build issues highlighted by gcc12
Make inline functions defined in a header file as static inline.
Mark inline functions used only in the compilation unit they are
defined in as merely static (the compiler can figure out it these
days).

Sponsored by:		Netflix
2023-08-25 09:46:44 -06:00
John Hall 7ea28254ec smartpqi: update to version 4410.0.2005
This updates the smartpqi driver to Microsemi's latest code. This will
be the driver for FreeBSD 14 (with updates), but no MFC is planned.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D41550
2023-08-24 15:25:09 -06:00
Warner Losh 71625ec9ad sys: Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
2023-08-16 11:54:24 -06:00
Gordon Bergling d53e97bb54 smartpqi(4): Fix two typos in kernel error messages
- s/runnning/running/

MFC after:	2 weeks
2022-10-25 13:17:20 +02:00
Dimitry Andric fb1c21688c Adjust check_struct_sizes() definition to avoid clang 15 warning
With clang 15, the following -Werror warning is produced:

    sys/dev/smartpqi/smartpqi_helper.c:374:19: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    check_struct_sizes()
                      ^
                       void

This is because check_struct_sizes() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after:	3 days
2022-07-26 19:59:55 +02:00
Yuri f4497b9f77 smartpqi: Allocate DMA memory NOWAIT
We're not allowed to wait in this allocation path, so allocate the
memory NOWAIT instead of WAITOK. The code already copes with the
failures that may result, so no additional code is needed.

PR: 263008
Reviewed by: markj, Scott Benesh at Microsemi, imp
Differential Revision: https://reviews.freebsd.org/D35601
2022-06-27 11:06:31 -06:00
John Baldwin 07127ef86f smartpqi: Remove unused devclass argument to DRIVER_MODULE. 2022-05-06 15:46:59 -07:00
Gordon Bergling 882d3b24fe smartpqi(4): Fix a typo in a source code comment
- s/commmand/command/

MFC after:	3 days
2022-04-02 15:21:45 +02:00
Warner Losh 4f77349d57 Update smartqpi driver to vendor's latest submission
Newly added features & bug fixes

o Fixed an issue smartpqi debug log messages are flooding kernel logs.
o Fixed an issue where devices are shown as RAID 0 in display info.
o Feature: Changed 32 bit dma address to 64 bit address
o Added new controlller ids.

Submitted by:		Microsemi
Reviewed by:		Scott Benesh (Microsemi), imp
Differential Revision:	https://reviews.freebsd.org/D34469
MFC After:		3 days

Sponsored by:		Netflix
2022-03-08 17:05:36 -07:00
Scott Long e28289ca83 Fix "set but not used" in smartpqi. The PCI_MEM macros don't require a
physical/absolute address in FreeBSD, but it looks like the calling
code might be somewhat portable to other OS's that do require this.
Therefore, set the variables to __unused instead of removing the code
entirely.
2022-02-26 10:25:43 -07:00
Warner Losh 30f8afd027 cam: fix xpt_bus_register and xpt_bus_deregister return errno
xpt_bus_register and xpt_bus_deregister returns a hybrid error that's
neither a cam_status, nor an errno, but a mix of both.  Update
xpt_bus_register and xpt_bus_deregister to return an errno. The vast
majority of current users compare against zero, which can also be
spelled CAM_SUCCESS. Nobody uses CAM_FAILURE, so remove that symbol
to prevent comfusion (nothing returns it either).

Where the return value is saved, ensure that the variable 'error' is
used to store an errno and 'status' is used to store a cam_status where
it makes the code clearer (usually just in functions that already mix
and match). Where the return value isn't used at all, avoid storing it
at all.

Reviewed by:		scottl@, mav@ (earlier version)
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D30860
2021-06-28 16:13:03 -06:00
Warner Losh eae2ef5a01 smartpqi: Remove stray declaration
pqisrc_is_firmware_feature_enabled shouldn't be declared inline in a
header, and then static inline in the .c function. Remove this stray
declartion from the header. gcc6 complains, but clang does not.

Sponsored by:		Netflix
2021-06-03 17:45:27 -06:00
Edward Tomasz Napierala e20e60be50 smartpqi: clear CCBs allocated on the stack
Differential Revision:		https://reviews.freebsd.org/D30299

Sponsored by:		Netflix
2021-05-28 16:40:24 -06:00
PAPANI SRIKANTH 9fac68fc38 Newly added features and bug fixes in latest Microchip SmartPQI driver
It includes:

1)Newly added TMF feature.
2)Added newly Huawei & Inspur PCI ID's
3)Fixed smartpqi driver hangs in Z-Pool while running on FreeBSD12.1
4)Fixed flooding dmesg in kernel while the controller is offline during in ioctls.
5)Avoided unnecessary host memory allocation for rcb sg buffers.
6)Fixed race conditions while accessing internal rcb structure.
7)Fixed where Logical volumes exposing two different names to the OS it's due to the system memory is overwritten with DMA stale data.
8)Fixed dynamically unloading a smartpqi driver.
9)Added device_shutdown callback instead of deprecated shutdown_final kernel event in smartpqi driver.
10)Fixed where Os is crashed during physical drive hot removal during heavy IO.
11)Fixed OS crash during controller lockup/offline during heavy IO.
12)Fixed coverity issues in smartpqi driver
13)Fixed system crash while creating and deleting logical volume in a continuous loop.
14)Fixed where the volume size is not exposing to OS when it expands.
15)Added HC3 pci id's.

Reviewed by:		Scott Benesh (microsemi), Murthy Bhat (microsemi), imp
Differential Revision:	https://reviews.freebsd.org/D30182

Sponsored by:		Netflix
2021-05-28 16:40:23 -06:00
Edward Tomasz Napierala 3df3c40de4 smartpqi: don't bzero the new ccb; xpt_alloc_ccb_nowait() already does that.
Reviewed by:	imp
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D26838
2020-11-23 12:54:19 +00:00
Mateusz Guzik 7368632c18 smartpqi: clean up empty lines in .c and .h files 2020-09-01 21:53:21 +00:00
Ed Maste aeb665b538 remove extraneous double ;s in sys/ 2020-03-30 16:04:25 +00:00
Mark Johnston 958ff217e7 Decrease logging severity when adding a device or reading config table.
In PR 243056 a user reports some spam from smartpqi(4).  In particular,
the driver warns about an unrecognized PQI_CONF_TABLE_SECTION_SOFT_RESET
section (not yet defined in the driver, but handled in Linux), but this
doesn't cause any problems.  The Linux driver also does not warn about
unrecognized sections.

Also do not log a warning when a device is added, since this is routine.
Lower severity to DISC, to match pqisrc_remove_device().

PR:		243056
Reviewed by:	sbruno
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D23023
2020-01-07 16:07:30 +00:00
John Baldwin 9358cceb97 Use callout(9) instead of deprecated timeout(9).
Reviewed by:	imp
Tested by:	Scott Benesh
Differential Revision:	https://reviews.freebsd.org/D22598
2019-12-13 19:56:48 +00:00
Conrad Meyer e2e050c8ef Extract eventfilter declarations to sys/_eventfilter.h
This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h"
in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header
pollution substantially.

EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c
files into appropriate headers (e.g., sys/proc.h, powernv/opal.h).

As a side effect of reduced header pollution, many .c files and headers no
longer contain needed definitions.  The remainder of the patch addresses
adding appropriate includes to fix those files.

LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by
sys/mutex.h since r326106 (but silently protected by header pollution prior
to this change).

No functional change (intended).  Of course, any out of tree modules that
relied on header pollution for sys/eventhandler.h, sys/lock.h, or
sys/mutex.h inclusion need to be fixed.  __FreeBSD_version has been bumped.
2019-05-20 00:38:23 +00:00
Konstantin Belousov 7f755050f7 Remove single-use DEV_RESET() macro.
It conflicts with the sys/bus.h DEV_XXX namespace.

Reviewed by:	imp (previous version), jhb (previous version)
Sponsored by:	Mellanox Technologies
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D19646
2019-04-05 19:27:51 +00:00
Edward Tomasz Napierala 7000d321e8 Make smartpqi(4) behave better when running out of memory, by returning
CAM_RESRC_UNAVAIL instead of CAM_REQUEUE_REQ.  This makes CAM delay a bit
before retrying, so that the retries actually get a chance to succeed.

Reviewed by:	sbruno
MFC after:	2 weeks
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D19696
2019-03-26 15:47:13 +00:00
Edward Tomasz Napierala b39beab1b8 Fix smartpqi(4) malloc tag and description to match the driver name.
No functional changes.

Reviewed by:	sbruno
MFC after:	2 weeks
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D19625
2019-03-21 21:14:25 +00:00
Edward Tomasz Napierala 4f4463dfa3 Fix crash in low memory conditions. Usual backtrace looked
like this:

pqisrc_build_sgl() at pqisrc_build_sgl+0x8d/frame 0xfffffe009e8b7a00
pqisrc_build_raid_io() at pqisrc_build_raid_io+0x231/frame 0xfffffe009e8b7a40
pqisrc_build_send_io() at pqisrc_build_send_io+0x375/frame 0xfffffe009e8b7b00
pqi_request_map_helper() at pqi_request_map_helper+0x282/frame 0xfffffe009e8b7ba0
bus_dmamap_load_ccb() at bus_dmamap_load_ccb+0xd7/frame 0xfffffe009e8b7c00
pqi_map_request() at pqi_map_request+0x9b/frame 0xfffffe009e8b7c70
pqisrc_io_start() at pqisrc_io_start+0x55c/frame 0xfffffe009e8b7d50
smartpqi_cam_action() at smartpqi_cam_action+0xb8/frame 0xfffffe009e8b7de0
xpt_run_devq() at xpt_run_devq+0x30a/frame 0xfffffe009e8b7e40
xpt_action_default() at xpt_action_default+0x94b/frame 0xfffffe009e8b7e90
dastart() at dastart+0x33b/frame 0xfffffe009e8b7ee0
xpt_run_allocq() at xpt_run_allocq+0x1a2/frame 0xfffffe009e8b7f30
dastrategy() at dastrategy+0x71/frame 0xfffffe009e8b7f60
g_disk_start() at g_disk_start+0x351/frame 0xfffffe009e8b7fc0
g_io_request() at g_io_request+0x3cf/frame 0xfffffe009e8b8010
g_part_start() at g_part_start+0x120/frame 0xfffffe009e8b8090
g_io_request() at g_io_request+0x3cf/frame 0xfffffe009e8b80e0
zio_vdev_io_start() at zio_vdev_io_start+0x4b2/frame 0xfffffe009e8b8140
zio_execute() at zio_execute+0x17c/frame 0xfffffe009e8b8180
zio_nowait() at zio_nowait+0xc4/frame 0xfffffe009e8b81b0
vdev_queue_io_done() at vdev_queue_io_done+0x138/frame 0xfffffe009e8b81f0
zio_vdev_io_done() at zio_vdev_io_done+0x151/frame 0xfffffe009e8b8220
zio_execute() at zio_execute+0x17c/frame 0xfffffe009e8b8260
taskqueue_run_locked() at taskqueue_run_locked+0x10c/frame 0xfffffe009e8b82c0
taskqueue_thread_loop() at taskqueue_thread_loop+0x88/frame 0xfffffe009e8b82f0
fork_exit() at fork_exit+0x84/frame 0xfffffe009e8b8330
fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe009e8b8330

Reviewed by:	deepak.ukey_microsemi.com, sbruno
MFC after:	2 weeks
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D19470
2019-03-10 23:05:38 +00:00
Conrad Meyer 530a4c5af6 Re-unbreak smartpqi(4) GCC build
Like r333085, remove redundant declarations.

Redundant declarations were re-introduced in r336201.

Sponsored by:	Dell EMC Isilon
2018-07-13 22:49:48 +00:00
Sean Bruno b17f4335d2 smartpqi(4):
- Update to release "3"

Submitted by:	Deepak Ukey <deepak.ukey@microsemi.com>
Reviewed by:	mav
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D16060
2018-07-11 16:44:14 +00:00
Conrad Meyer 9cf21c2ee1 smartpqi(4): Unbreak GCC build
Remove redundant declarations.
2018-04-28 17:43:20 +00:00
Sean Bruno 1e66f787c8 martpqi(4):
- Microsemi SCSI driver for PQI controllers.
- Found on newer model HP servers.
- Restrict to AMD64 only as per developer request.

The driver provides support for the new generation of PQI controllers
from Microsemi. This driver is the first SCSI driver to implement the PQI
queuing model and it will replace the aacraid driver for Adaptec Series 9
controllers.  HARDWARE Controllers supported by the driver include:

    HPE Gen10 Smart Array Controller Family
    OEM Controllers based on the Microsemi Chipset.

Submitted by:   deepak.ukey@microsemi.com
Relnotes:       yes
Sponsored by:   Microsemi
Differential Revision:   https://reviews.freebsd.org/D14514
2018-04-26 16:59:06 +00:00