Skip to contentSkip to conversation

mpi3mr: Enhancements for mpi3mr

PATCH Applied Ranjan Kumar 2 participants 11 messages Jan 16 – Feb 4

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover mpi3mr: Enhancements for mpi3mr

Enhancements for mpi3mr driver

Changes since v1:
- Fixed test robot build warning
- Fixed W=1 warning
- Addressed review comments from Damien Le Moal

Ranjan Kumar (8):
mpi3mr: Add module parameter to control threaded IRQ polling
mpi3mr: Rename log data save helper to reflect threaded/BH context
mpi3mr: Avoid redundant diag-fault resets
mpi3mr: Use negotiated link rate from DevicePage0
mpi3mr: Update MPI Headers to revision 39
mpi3mr: Record and report controller firmware faults
mpi3mr: Fixed the W=1 compilation warning
mpi3mr: Driver version update to 8.17.0.3.50

 drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h      |  92 ++++++++++++++-
 drivers/scsi/mpi3mr/mpi/mpi30_image.h     | 102 ++++++++++++++++-
 drivers/scsi/mpi3mr/mpi/mpi30_init.h      |   2 +-
 drivers/scsi/mpi3mr/mpi/mpi30_ioc.h       |   1 +
 drivers/scsi/mpi3mr/mpi/mpi30_pci.h       |   2 +-
 drivers/scsi/mpi3mr/mpi/mpi30_sas.h       |   2 +-
 drivers/scsi/mpi3mr/mpi/mpi30_tool.h      |   6 +-
 drivers/scsi/mpi3mr/mpi/mpi30_transport.h |   4 +-
 drivers/scsi/mpi3mr/mpi3mr.h              |  16 ++-
 drivers/scsi/mpi3mr/mpi3mr_app.c          |  28 ++++-
 drivers/scsi/mpi3mr/mpi3mr_fw.c           | 131 ++++++++++++++++++++--
 drivers/scsi/mpi3mr/mpi3mr_os.c           | 102 ++++++++++++++++-
 drivers/scsi/mpi3mr/mpi3mr_transport.c    |  30 +++--
 13 files changed, 478 insertions(+), 40 deletions(-)
Signature · 1 line
2.47.3
#1 lore raw

PATCH v2 1/8 mpi3mr: Add module parameter to control threaded IRQ polling

Add a module parameter to enable or disable threaded IRQ polling in the driver. The default behavior remains unchanged with polling enabled.

When disabled, completion processing is kept entirely in the hard IRQ context, avoiding the threaded polling path.

---
 drivers/scsi/mpi3mr/mpi3mr_fw.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/scsi/mpi3mr/mpi3mr_fw.c +7 -2
index b564fe5980a6..1300f9af4c74 100644
@@ -21,6 +21,10 @@ static int mpi3mr_check_op_admin_proc(struct mpi3mr_ioc *mrioc);
 static int poll_queues;
 module_param(poll_queues, int, 0444);
 MODULE_PARM_DESC(poll_queues, "Number of queues for io_uring poll mode. (Range 1 - 126)");
+static bool threaded_isr_poll = true;
+module_param(threaded_isr_poll, bool, 0444);
+MODULE_PARM_DESC(threaded_isr_poll,
+			"Enablement of IRQ polling thread (default=true)");
 
 #if defined(writeq) && defined(CONFIG_64BIT)
 static inline void mpi3mr_writeq(__u64 b, void __iomem *addr,
@@ -595,7 +599,8 @@ int mpi3mr_process_op_reply_q(struct mpi3mr_ioc *mrioc,
 		 * Exit completion loop to avoid CPU lockup
 		 * Ensure remaining completion happens from threaded ISR.
 		 */
-		if (num_op_reply > mrioc->max_host_ios) {
+		if ((num_op_reply > mrioc->max_host_ios) &&
+			(threaded_isr_poll == true)) {
 			op_reply_q->enable_irq_poll = true;
 			break;
 		}
@@ -692,7 +697,7 @@ static irqreturn_t mpi3mr_isr(int irq, void *privdata)
 	 * If more IOs are expected, schedule IRQ polling thread.
 	 * Otherwise exit from ISR.
 	 */
-	if (!intr_info->op_reply_q)
+	if ((threaded_isr_poll == false) || !intr_info->op_reply_q)
 		return ret;
 
 	if (!intr_info->op_reply_q->enable_irq_poll ||
Signature · 1 line
2.47.3
#2 lore raw

PATCH v2 2/8 mpi3mr: Rename log data save helper to reflect threaded/BH context

In reply to Ranjan Kumar

Log data events can be processed from BH and threaded contexts. Rename the save helper to document its intended usage and improve readability of the event handling flow.

---
 drivers/scsi/mpi3mr/mpi3mr.h     | 2 +-
 drivers/scsi/mpi3mr/mpi3mr_app.c | 4 ++--
 drivers/scsi/mpi3mr/mpi3mr_os.c  | 7 ++++++-
 3 files changed, 9 insertions(+), 4 deletions(-)
drivers/scsi/mpi3mr/mpi3mr.h +1 -1
index 82f4ae87d6bc..711f2aa11294 100644
@@ -1506,7 +1506,7 @@ void mpi3mr_pel_get_seqnum_complete(struct mpi3mr_ioc *mrioc,
 	struct mpi3mr_drv_cmd *drv_cmd);
 int mpi3mr_pel_get_seqnum_post(struct mpi3mr_ioc *mrioc,
 	struct mpi3mr_drv_cmd *drv_cmd);
-void mpi3mr_app_save_logdata(struct mpi3mr_ioc *mrioc, char *event_data,
+void mpi3mr_app_save_logdata_th(struct mpi3mr_ioc *mrioc, char *event_data,
 	u16 event_data_size);
 struct mpi3mr_enclosure_node *mpi3mr_enclosure_find_by_handle(
 	struct mpi3mr_ioc *mrioc, u16 handle);
drivers/scsi/mpi3mr/mpi3mr_app.c +2 -2
index 0e5478d62580..37cca0573ddc 100644
@@ -2920,7 +2920,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)
 }
 
 /**
- * mpi3mr_app_save_logdata - Save Log Data events
+ * mpi3mr_app_save_logdata_th - Save Log Data events
  * @mrioc: Adapter instance reference
  * @event_data: event data associated with log data event
  * @event_data_size: event data size to copy
@@ -2932,7 +2932,7 @@ static long mpi3mr_bsg_process_mpt_cmds(struct bsg_job *job)
  *
  * Return:Nothing
  */
-void mpi3mr_app_save_logdata(struct mpi3mr_ioc *mrioc, char *event_data,
+void mpi3mr_app_save_logdata_th(struct mpi3mr_ioc *mrioc, char *event_data,
 	u16 event_data_size)
 {
 	u32 index = mrioc->logdata_buf_idx, sz;
drivers/scsi/mpi3mr/mpi3mr_os.c +6 -1
index d4ca878d0886..028a3a1a6be0 100644
@@ -1962,7 +1962,7 @@ static void mpi3mr_pcietopochg_evt_bh(struct mpi3mr_ioc *mrioc,
 static void mpi3mr_logdata_evt_bh(struct mpi3mr_ioc *mrioc,
 	struct mpi3mr_fwevt *fwevt)
 {
-	mpi3mr_app_save_logdata(mrioc, fwevt->event_data,
+	mpi3mr_app_save_logdata_th(mrioc, fwevt->event_data,
 	    fwevt->event_data_size);
 }
 
@@ -3058,6 +3058,11 @@ void mpi3mr_os_handle_events(struct mpi3mr_ioc *mrioc,
 	}
 	case MPI3_EVENT_DEVICE_INFO_CHANGED:
 	case MPI3_EVENT_LOG_DATA:
+
+		sz = event_reply->event_data_length * 4;
+		mpi3mr_app_save_logdata_th(mrioc,
+			(char *)event_reply->event_data, sz);
+		break;
 	case MPI3_EVENT_ENCL_DEVICE_STATUS_CHANGE:
 	case MPI3_EVENT_ENCL_DEVICE_ADDED:
 	{
Signature · 1 line
2.47.3
#3 lore raw

PATCH v2 3/8 mpi3mr: Avoid redundant diag-fault resets

In reply to Ranjan Kumar

Update reset handling to invoke diag-save only for diag-fault resets. Skip issuing a diagnostic reset if the IOC is already in FAULT state, preventing repeated fault handling and improving reset stability.

---
 drivers/scsi/mpi3mr/mpi3mr_fw.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/scsi/mpi3mr/mpi3mr_fw.c +10 -3
index 1300f9af4c74..6debe81a1e5b 100644
@@ -1707,6 +1707,8 @@ static int mpi3mr_issue_reset(struct mpi3mr_ioc *mrioc, u16 reset_type,
 	    MPI3MR_RESET_REASON_OSTYPE_SHIFT) | (mrioc->facts.ioc_num <<
 	    MPI3MR_RESET_REASON_IOCNUM_SHIFT) | reset_reason);
 	writel(reset_reason, &mrioc->sysif_regs->scratchpad[0]);
+	if (reset_type == MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT)
+		mpi3mr_set_diagsave(mrioc);
 	writel(host_diagnostic | reset_type,
 	    &mrioc->sysif_regs->host_diagnostic);
 	switch (reset_type) {
@@ -5401,6 +5403,7 @@ int mpi3mr_soft_reset_handler(struct mpi3mr_ioc *mrioc,
 {
 	int retval = 0, i;
 	unsigned long flags;
+	enum mpi3mr_iocstate ioc_state;
 	u32 host_diagnostic, timeout = MPI3_SYSIF_DIAG_SAVE_TIMEOUT * 10;
 	union mpi3mr_trigger_data trigger_data;
 
@@ -5459,7 +5462,6 @@ int mpi3mr_soft_reset_handler(struct mpi3mr_ioc *mrioc,
 	mrioc->io_admin_reset_sync = 1;
 
 	if (snapdump) {
-		mpi3mr_set_diagsave(mrioc);
 		retval = mpi3mr_issue_reset(mrioc,
 		    MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT, reset_reason);
 		if (!retval) {
@@ -5561,8 +5563,13 @@ int mpi3mr_soft_reset_handler(struct mpi3mr_ioc *mrioc,
 		if (mrioc->pel_enabled)
 			atomic64_inc(&event_counter);
 	} else {
-		mpi3mr_issue_reset(mrioc,
-		    MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT, reset_reason);
+		dprint_reset(mrioc,
+			"soft_reset_handler failed, marking controller as unrecoverable\n");
+		ioc_state = mpi3mr_get_iocstate(mrioc);
+
+		if (ioc_state != MRIOC_STATE_FAULT)
+			mpi3mr_issue_reset(mrioc,
+				MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT, reset_reason);
 		mrioc->device_refresh_on = 0;
 		mrioc->unrecoverable = 1;
 		mrioc->reset_in_progress = 0;
Signature · 1 line
2.47.3
#4 lore raw

PATCH v2 4/8 mpi3mr: Use negotiated link rate from DevicePage0

In reply to Ranjan Kumar

Firmware populates the negotiated SAS link rate in DevicePage0 during device discovery. Update mpi3mr to cache this value while initializing the target device.

When available, the cached link rate is used instead of issuing additional SAS PHY or expander PHY page reads.
If the DevicePage0 value is missing or invalid, the driver falls back to the existing PHY-based mechanism.

---
 drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h   |  2 +
 drivers/scsi/mpi3mr/mpi3mr.h           |  2 +
 drivers/scsi/mpi3mr/mpi3mr_os.c        | 89 ++++++++++++++++++++++++++
 drivers/scsi/mpi3mr/mpi3mr_transport.c | 30 +++++----
 4 files changed, 111 insertions(+), 12 deletions(-)
drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h +2 -0
index 8c8bfbbdd34e..67d72b82cbe0 100644
@@ -2314,6 +2314,8 @@ struct mpi3_device0_sas_sata_format {
 	u8         attached_phy_identifier;
 	u8         max_port_connections;
 	u8         zone_group;
+	u8         reserved10[3];
+	u8         negotiated_link_rate;
 };
 
 #define MPI3_DEVICE0_SASSATA_FLAGS_WRITE_SAME_UNMAP_NCQ (0x0400)
drivers/scsi/mpi3mr/mpi3mr.h +2 -0
index 711f2aa11294..eee6cb40a960 100644
@@ -643,6 +643,7 @@ struct mpi3mr_enclosure_node {
  * @dev_info: Device information bits
  * @phy_id: Phy identifier provided in device page 0
  * @attached_phy_id: Attached phy identifier provided in device page 0
+ * @negotiated_link_rate: Negotiated link rate from device page 0
  * @sas_transport_attached: Is this device exposed to transport
  * @pend_sas_rphy_add: Flag to check device is in process of add
  * @hba_port: HBA port entry
@@ -654,6 +655,7 @@ struct tgt_dev_sas_sata {
 	u16 dev_info;
 	u8 phy_id;
 	u8 attached_phy_id;
+	u8 negotiated_link_rate;
 	u8 sas_transport_attached;
 	u8 pend_sas_rphy_add;
 	struct mpi3mr_hba_port *hba_port;
drivers/scsi/mpi3mr/mpi3mr_os.c +89 -0

107 lines not on this page · raw message

drivers/scsi/mpi3mr/mpi3mr_transport.c +18 -12
index d70f002d6487..101161554ef1 100644
@@ -2284,11 +2284,11 @@ void mpi3mr_expander_remove(struct mpi3mr_ioc *mrioc, u64 sas_address,
  * @mrioc: Adapter instance reference
  * @tgtdev: Target device
  *
- * This function identifies whether the target device is
- * attached directly or through expander and issues sas phy
- * page0 or expander phy page1 and gets the link rate, if there
- * is any failure in reading the pages then this returns link
- * rate of 1.5.
+ * This function first tries to use the link rate from DevicePage0
+ * (populated by firmware during device discovery). If the cached
+ * value is not available or invalid, it falls back to reading from
+ * sas phy page0 or expander phy page1.
+ *
  *
  * Return: logical link rate.
  */
@@ -2301,6 +2301,14 @@ static u8 mpi3mr_get_sas_negotiated_logical_linkrate(struct mpi3mr_ioc *mrioc,
 	u32 phynum_handle;
 	u16 ioc_status;
 
+	/* First, try to use link rate from DevicePage0 (populated by firmware) */
+	if (tgtdev->dev_spec.sas_sata_inf.negotiated_link_rate >=
+	    MPI3_SAS_NEG_LINK_RATE_1_5) {
+		link_rate = tgtdev->dev_spec.sas_sata_inf.negotiated_link_rate;
+		goto out;
+	}
+
+	/* Fallback to reading from phy pages if DevicePage0 value not available */
 	phy_number = tgtdev->dev_spec.sas_sata_inf.phy_id;
 	if (!(tgtdev->devpg0_flag & MPI3_DEVICE0_FLAGS_ATT_METHOD_DIR_ATTACHED)) {
 		phynum_handle = ((phy_number<<MPI3_SAS_EXPAND_PGAD_PHYNUM_SHIFT)
@@ -2318,9 +2326,7 @@ static u8 mpi3mr_get_sas_negotiated_logical_linkrate(struct mpi3mr_ioc *mrioc,
 			    __FILE__, __LINE__, __func__);
 			goto out;
 		}
-		link_rate = (expander_pg1.negotiated_link_rate &
-			     MPI3_SAS_NEG_LINK_RATE_LOGICAL_MASK) >>
-			MPI3_SAS_NEG_LINK_RATE_LOGICAL_SHIFT;
+		link_rate = expander_pg1.negotiated_link_rate;
 		goto out;
 	}
 	if (mpi3mr_cfg_get_sas_phy_pg0(mrioc, &ioc_status, &phy_pg0,
@@ -2335,11 +2341,11 @@ static u8 mpi3mr_get_sas_negotiated_logical_linkrate(struct mpi3mr_ioc *mrioc,
 		    __FILE__, __LINE__, __func__);
 		goto out;
 	}
-	link_rate = (phy_pg0.negotiated_link_rate &
-		     MPI3_SAS_NEG_LINK_RATE_LOGICAL_MASK) >>
-		MPI3_SAS_NEG_LINK_RATE_LOGICAL_SHIFT;
+	link_rate = phy_pg0.negotiated_link_rate;
+
 out:
-	return link_rate;
+	return ((link_rate & MPI3_SAS_NEG_LINK_RATE_LOGICAL_MASK) >>
+		MPI3_SAS_NEG_LINK_RATE_LOGICAL_SHIFT);
 }
 
 /**
Signature · 1 line
2.47.3
#5 lore raw

PATCH v2 5/8 mpi3mr: Update MPI Headers to revision 39

In reply to Ranjan Kumar

Update MPI Headers to revision 39

---
 drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h      |  90 ++++++++++++++++++-
 drivers/scsi/mpi3mr/mpi/mpi30_image.h     | 102 +++++++++++++++++++++-
 drivers/scsi/mpi3mr/mpi/mpi30_init.h      |   2 +-
 drivers/scsi/mpi3mr/mpi/mpi30_ioc.h       |   1 +
 drivers/scsi/mpi3mr/mpi/mpi30_pci.h       |   2 +-
 drivers/scsi/mpi3mr/mpi/mpi30_sas.h       |   2 +-
 drivers/scsi/mpi3mr/mpi/mpi30_tool.h      |   6 +-
 drivers/scsi/mpi3mr/mpi/mpi30_transport.h |   4 +-
 8 files changed, 197 insertions(+), 12 deletions(-)
drivers/scsi/mpi3mr/mpi/mpi30_cnfg.h +87 -3
index 67d72b82cbe0..33dd303c97bb 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
- *  Copyright 2017-2023 Broadcom Inc. All rights reserved.
+ *  Copyright 2017-2026 Broadcom Inc. All rights reserved.
  */
 #ifndef MPI30_CNFG_H
 #define MPI30_CNFG_H     1
@@ -1037,6 +1037,7 @@ struct mpi3_io_unit_page5 {
 #define MPI3_IOUNIT5_DEVICE_SHUTDOWN_SATA_SSD_SHIFT        (2)
 #define MPI3_IOUNIT5_DEVICE_SHUTDOWN_SAS_SSD_MASK          (0x0003)
 #define MPI3_IOUNIT5_DEVICE_SHUTDOWN_SAS_SSD_SHIFT         (0)
+#define MPI3_IOUNIT5_DEVICE_SHUTDOWN_HDD_SPINDOWN_ENABLE    (0x8000)
 #define MPI3_IOUNIT5_FLAGS_SATAPUIS_MASK                   (0x0c)
 #define MPI3_IOUNIT5_FLAGS_SATAPUIS_NOT_SUPPORTED          (0x00)
 #define MPI3_IOUNIT5_FLAGS_SATAPUIS_OS_CONTROLLED          (0x04)
@@ -1074,7 +1075,8 @@ struct mpi3_io_unit_page8 {
 	u8                                 current_key_encryption_algo;
 	u8                                 key_digest_hash_algo;
 	union mpi3_version_union              current_svn;
-	__le32                             reserved14;
+	__le16                             pending_svn_time;
+	__le16                             reserved16;
 	__le32                             current_key[128];
 	union mpi3_iounit8_digest             digest[MPI3_IOUNIT8_DIGEST_MAX];
 };
@@ -1406,6 +1408,7 @@ struct mpi3_driver_page1 {
 };
 
 #define MPI3_DRIVER1_PAGEVERSION               (0x00)
+#define MPI3_DRIVER1_FLAGS_DEVICE_SHUTDOWN_ON_UNLOAD_DISABLE		(0x0001)
 #ifndef MPI3_DRIVER2_TRIGGER_MAX
 #define MPI3_DRIVER2_TRIGGER_MAX           (1)
 #endif
@@ -1561,7 +1564,9 @@ struct mpi3_security1_key_record {
 	u8                                 consumer;
 	__le16                             key_data_size;
 	__le32                             additional_key_data;
-	__le32                             reserved08[2];
+	u8                                 library_version;
+	u8                                 reserved09[3];
+	__le32                             reserved0c;
 	union mpi3_security1_key_data         key_data;
 };
 
@@ -1614,6 +1619,85 @@ struct mpi3_security_page2 {
 	u8                                 reserved9d[3];
 	struct mpi3_security2_trusted_root     trusted_root[MPI3_SECURITY2_TRUSTED_ROOT_MAX];
 };
+
+struct mpi3_security_page3 {
+	struct mpi3_config_page_header         header;
+	__le16                             key_data_length;
+	__le16                             reserved0a;
+	u8                                 key_number;
+	u8                                 reserved0d[3];
+	union mpi3_security_mac               mac;
+	union mpi3_security_nonce             nonce;
+	__le32                             reserved90[12];
+	u8                                 flags;
+	u8                                 consumer;
+	__le16                             key_data_size;
+	__le32                             additional_key_data;
+	u8                                 library_version;
+	u8                                 reserved_c9[3];
+	__le32                             reserved_cc;
+	u8                                 key_data[];
+};
+
+#define MPI3_SECURITY3_PAGEVERSION               (0x00)
+#define MPI3_SECURITY3_FLAGS_TYPE_MASK           (0x0f)
+#define MPI3_SECURITY3_FLAGS_TYPE_SHIFT          (0)
+#define MPI3_SECURITY3_FLAGS_TYPE_NOT_VALID      (0)
+#define MPI3_SECURITY3_FLAGS_TYPE_MLDSA_PRIVATE  (1)
+#define MPI3_SECURITY3_FLAGS_TYPE_MLDSA_PUBLIC   (2)
+struct mpi3_security_page10 {
+	struct mpi3_config_page_header         header;
+	__le32                             reserved08[2];
+	union mpi3_security_mac               mac;
+	union mpi3_security_nonce             nonce;
+	__le64                             current_token_nonce;
+	__le64                             previous_token_nonce;
+	__le32                             reserved_a0[8];
+	u8                                 diagnostic_auth_id[64];
+};
+#define MPI3_SECURITY10_PAGEVERSION               (0x00)
+
+struct mpi3_security_page11 {
+	struct mpi3_config_page_header         header;
+	u8                                 flags;
+	u8                                 reserved09[3];
+	__le32                             reserved0c;
+	__le32                             diagnostic_token_length;
+	__le32                             reserved14[3];
+	u8                                 diagnostic_token[];
+};
+#define MPI3_SECURITY11_PAGEVERSION               (0x00)
+#define MPI3_SECURITY11_FLAGS_TOKEN_ENABLED       (0x01)
+
+struct mpi3_security12_diag_feature {
+	__le32                             feature_identifier;
+	u8                                 feature_size;
+	u8                                 feature_type;
+	__le16                             reserved06;
+	u8                                 status;
+	u8                                 section;
+	__le16                             reserved0a;
+	__le32                             reserved0c;
+	u8                                 feature_data[64];
+};
+#define MPI3_SECURITY12_DIAG_FEATURE_STATUS_MASK                 (0x03)
+#define MPI3_SECURITY12_DIAG_FEATURE_STATUS_SHIFT                (0)
+#define MPI3_SECURITY12_DIAG_FEATURE_STATUS_UNKNOWN              (0x00)
+#define MPI3_SECURITY12_DIAG_FEATURE_STATUS_DISABLED             (0x01)
+#define MPI3_SECURITY12_DIAG_FEATURE_STATUS_ENABLED              (0x02)
+#define MPI3_SECURITY12_DIAG_FEATURE_SECTION_PROTECTED           (0x00)
+#define MPI3_SECURITY12_DIAG_FEATURE_SECTION_UNPROTECTED         (0x01)
+#define MPI3_SECURITY12_DIAG_FEATURE_SECTION_PAYLOAD             (0x02)
+#define MPI3_SECURITY12_DIAG_FEATURE_SECTION_SIGNATURE           (0x03)
+struct mpi3_security_page12 {
+	struct mpi3_config_page_header         header;
+	__le32                             reserved08[2];
+	u8                                 num_diag_features;
+	u8                                 reserved11[3];
+	__le32                             reserved14[3];
+	struct mpi3_security12_diag_feature    diag_feature[];
+};
+
 #define MPI3_SECURITY2_PAGEVERSION               (0x00)
 struct mpi3_sas_io_unit0_phy_data {
 	u8                 io_unit_port;
drivers/scsi/mpi3mr/mpi/mpi30_image.h +99 -3

128 lines not on this page · raw message

drivers/scsi/mpi3mr/mpi/mpi30_init.h +1 -1
index bbef5bac92ed..745e1101ebf4 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
- *  Copyright 2016-2023 Broadcom Inc. All rights reserved.
+ *  Copyright 2016-2026 Broadcom Inc. All rights reserved.
  */
 #ifndef MPI30_INIT_H
 #define MPI30_INIT_H     1
drivers/scsi/mpi3mr/mpi/mpi30_ioc.h +1 -0
index b42933fcd423..76dc18684be1 100644
@@ -661,6 +661,7 @@ struct mpi3_event_data_diag_buffer_status_change {
 #define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_RELEASED             (0x01)
 #define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_PAUSED               (0x02)
 #define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_RESUMED              (0x03)
+#define MPI3_EVENT_DIAG_BUFFER_STATUS_CHANGE_RC_CLEARED (0x04)
 #define MPI3_PEL_LOCALE_FLAGS_NON_BLOCKING_BOOT_EVENT   (0x0200)
 #define MPI3_PEL_LOCALE_FLAGS_BLOCKING_BOOT_EVENT       (0x0100)
 #define MPI3_PEL_LOCALE_FLAGS_PCIE                      (0x0080)
drivers/scsi/mpi3mr/mpi/mpi30_pci.h +1 -1
index 4eeb11c3c73e..3092dfe6d952 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
- *  Copyright 2016-2023 Broadcom Inc. All rights reserved.
+ *  Copyright 2016-2026 Broadcom Inc. All rights reserved.
  *
  */
 #ifndef MPI30_PCI_H
drivers/scsi/mpi3mr/mpi/mpi30_sas.h +1 -1
index 190b06508b00..f86da445df1e 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
- *  Copyright 2016-2023 Broadcom Inc. All rights reserved.
+ *  Copyright 2016-2026 Broadcom Inc. All rights reserved.
  */
 #ifndef MPI30_SAS_H
 #define MPI30_SAS_H     1
drivers/scsi/mpi3mr/mpi/mpi30_tool.h +5 -1
index 50a65b16a818..72d3e6bc52ec 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
- *  Copyright 2016-2024 Broadcom Inc. All rights reserved.
+ *  Copyright 2016-2026 Broadcom Inc. All rights reserved.
  */
 #ifndef MPI30_TOOL_H
 #define MPI30_TOOL_H     1
@@ -8,6 +8,10 @@
 #define MPI3_DIAG_BUFFER_TYPE_TRACE	(0x01)
 #define MPI3_DIAG_BUFFER_TYPE_FW	(0x02)
 #define MPI3_DIAG_BUFFER_ACTION_RELEASE	(0x01)
+#define MPI3_DIAG_BUFFER_ACTION_PAUSE	(0x02)
+#define MPI3_DIAG_BUFFER_ACTION_RESUME	(0x03)
+#define MPI3_DIAG_BUFFER_ACTION_CLEAR	(0x04)
+
 
 #define MPI3_DIAG_BUFFER_POST_MSGFLAGS_SEGMENTED	(0x01)
 struct mpi3_diag_buffer_post_request {
drivers/scsi/mpi3mr/mpi/mpi30_transport.h +2 -2
index 28ab2efb3baa..290a1f5c2924 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
- *  Copyright 2016-2023 Broadcom Inc. All rights reserved.
+ *  Copyright 2016-2026 Broadcom Inc. All rights reserved.
  */
 #ifndef MPI30_TRANSPORT_H
 #define MPI30_TRANSPORT_H     1
@@ -18,7 +18,7 @@ union mpi3_version_union {
 
 #define MPI3_VERSION_MAJOR                                              (3)
 #define MPI3_VERSION_MINOR                                              (0)
-#define MPI3_VERSION_UNIT                                               (37)
+#define MPI3_VERSION_UNIT                                               (39)
 #define MPI3_VERSION_DEV                                                (0)
 #define MPI3_DEVHANDLE_INVALID                                          (0xffff)
 struct mpi3_sysif_oper_queue_indexes {
Signature · 1 line
2.47.3
#6 lore raw

PATCH v2 6/8 mpi3mr: Record and report controller firmware faults

In reply to Ranjan Kumar

Capture and retain firmware fault codes and extended fault information whenever the controller enters a fault state.

Maintain a persistent firmware fault counter, expose it via sysfs, and generate uevents to aid userspace diagnostics and failure analysis.

---
 drivers/scsi/mpi3mr/mpi3mr.h     |   8 +++
 drivers/scsi/mpi3mr/mpi3mr_app.c |  24 +++++++
 drivers/scsi/mpi3mr/mpi3mr_fw.c  | 103 +++++++++++++++++++++++++++++++
 3 files changed, 135 insertions(+)
drivers/scsi/mpi3mr/mpi3mr.h +8 -0
index eee6cb40a960..6a0291708113 100644
@@ -1136,6 +1136,10 @@ struct scmd_priv {
  * @default_qcount: Total Default queues
  * @active_poll_qcount: Currently active poll queue count
  * @requested_poll_qcount: User requested poll queue count
+ * @fault_during_init: Indicates a firmware fault occurred during initialization
+ * @saved_fault_code: Firmware fault code captured at the time of failure
+ * @saved_fault_info: Additional firmware-provided fault information
+ * @fwfault_counter: Count of firmware faults detected by the driver
  * @bsg_dev: BSG device structure
  * @bsg_queue: Request queue for BSG device
  * @stop_bsgs: Stop BSG request flag
@@ -1338,6 +1342,10 @@ struct mpi3mr_ioc {
 	u16 default_qcount;
 	u16 active_poll_qcount;
 	u16 requested_poll_qcount;
+	u8 fault_during_init;
+	u32 saved_fault_code;
+	u32 saved_fault_info[3];
+	u64 fwfault_counter;
 
 	struct device bsg_dev;
 	struct request_queue *bsg_queue;
drivers/scsi/mpi3mr/mpi3mr_app.c +24 -0
index 37cca0573ddc..1353a8ff9c85 100644
@@ -3255,6 +3255,29 @@ adp_state_show(struct device *dev, struct device_attribute *attr,
 
 static DEVICE_ATTR_RO(adp_state);
 
+/**
+ * fwfault_count_show() - SysFS callback to show firmware fault count
+ * @dev: class device
+ * @attr: Device attribute
+ * @buf: Buffer to copy data into
+ *
+ * Displays the total number of firmware faults detected by the driver
+ * since the controller was initialized.
+ *
+ * Return: Number of bytes written to @buf
+ */
+
+static ssize_t
+fwfault_count_show(struct device *dev, struct device_attribute *attr,
+	char *buf)
+{
+	struct Scsi_Host *shost = class_to_shost(dev);
+	struct mpi3mr_ioc *mrioc = shost_priv(shost);
+
+	return snprintf(buf, PAGE_SIZE, "%llu\n", mrioc->fwfault_counter);
+}
+static DEVICE_ATTR_RO(fwfault_count);
+
 static struct attribute *mpi3mr_host_attrs[] = {
 	&dev_attr_version_fw.attr,
 	&dev_attr_fw_queue_depth.attr,
@@ -3263,6 +3286,7 @@ static struct attribute *mpi3mr_host_attrs[] = {
 	&dev_attr_reply_qfull_count.attr,
 	&dev_attr_logging_level.attr,
 	&dev_attr_adp_state.attr,
+	&dev_attr_fwfault_count.attr,
 	NULL,
 };
 
drivers/scsi/mpi3mr/mpi3mr_fw.c +103 -0

151 lines not on this page · raw message

Signature · 1 line
2.47.3
#7 lore raw

PATCH v2 7/8 mpi3mr: Fixed the W=1 compilation warning

In reply to Ranjan Kumar

Fixed W=1 compilation warnings

---
 drivers/scsi/mpi3mr/mpi3mr_fw.c | 6 +++---
 drivers/scsi/mpi3mr/mpi3mr_os.c | 6 ++++--
 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/scsi/mpi3mr/mpi3mr_fw.c +3 -3
index 2abf87c4e76b..1cfbdb773353 100644
@@ -776,8 +776,8 @@ static inline int mpi3mr_request_irq(struct mpi3mr_ioc *mrioc, u16 index)
 	intr_info->msix_index = index;
 	intr_info->op_reply_q = NULL;
 
-	snprintf(intr_info->name, MPI3MR_NAME_LENGTH, "%s%d-msix%d",
-	    mrioc->driver_name, mrioc->id, index);
+	scnprintf(intr_info->name, MPI3MR_NAME_LENGTH,
+	    "%.32s%d-msix%u", mrioc->driver_name, mrioc->id, index);
 
 #ifndef CONFIG_PREEMPT_RT
 	retval = request_threaded_irq(pci_irq_vector(pdev, index), mpi3mr_isr,
@@ -1789,7 +1789,7 @@ static int mpi3mr_issue_reset(struct mpi3mr_ioc *mrioc, u16 reset_type,
 	scratch_pad0 = ((MPI3MR_RESET_REASON_OSTYPE_LINUX <<
 	    MPI3MR_RESET_REASON_OSTYPE_SHIFT) | (mrioc->facts.ioc_num <<
 	    MPI3MR_RESET_REASON_IOCNUM_SHIFT) | reset_reason);
-	writel(reset_reason, &mrioc->sysif_regs->scratchpad[0]);
+	writel(scratch_pad0, &mrioc->sysif_regs->scratchpad[0]);
 	if (reset_type == MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT)
 		mpi3mr_set_diagsave(mrioc);
 	writel(host_diagnostic | reset_type,
drivers/scsi/mpi3mr/mpi3mr_os.c +4 -2
index 2fce5bfb7204..3b46275788c6 100644
@@ -5475,8 +5475,10 @@ mpi3mr_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	if (retval < 0)
 		goto id_alloc_failed;
 	mrioc->id = (u8)retval;
-	sprintf(mrioc->driver_name, "%s", MPI3MR_DRIVER_NAME);
-	sprintf(mrioc->name, "%s%d", mrioc->driver_name, mrioc->id);
+	strscpy(mrioc->driver_name, MPI3MR_DRIVER_NAME,
+	    sizeof(mrioc->driver_name));
+	scnprintf(mrioc->name, sizeof(mrioc->name),
+	    "%s%u", mrioc->driver_name, mrioc->id);
 	INIT_LIST_HEAD(&mrioc->list);
 	spin_lock(&mrioc_list_lock);
 	list_add_tail(&mrioc->list, &mrioc_list);
Signature · 1 line
2.47.3
#8 lore raw

PATCH v2 8/8 mpi3mr: Driver version update to 8.17.0.3.50

In reply to Ranjan Kumar

Update driver version to 8.17.0.3.50

---
 drivers/scsi/mpi3mr/mpi3mr.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/mpi3mr/mpi3mr.h +2 -2
index 6a0291708113..6e962092577d 100644
@@ -56,8 +56,8 @@ extern struct list_head mrioc_list;
 extern int prot_mask;
 extern atomic64_t event_counter;
 
-#define MPI3MR_DRIVER_VERSION	"8.15.0.5.51"
-#define MPI3MR_DRIVER_RELDATE	"18-November-2025"
+#define MPI3MR_DRIVER_VERSION	"8.17.0.3.50"
+#define MPI3MR_DRIVER_RELDATE	"09-January-2026"
 
 #define MPI3MR_DRIVER_NAME	"mpi3mr"
 #define MPI3MR_DRIVER_LICENSE	"GPL"
Signature · 1 line
2.47.3
#10 lore raw
In reply to Ranjan Kumar
Quoted 8 lines · Ranjan Kumar

Enhancements for mpi3mr driver

Changes since v1:
- Fixed test robot build warning
- Fixed W=1 warning
- Addressed review comments from Damien Le Moal

[...]

Applied to 6.20/scsi-queue, thanks!

[1/8] mpi3mr: Add module parameter to control threaded IRQ polling

      https://git.kernel.org/mkp/scsi/c/24de8b1d243b
[2/8] mpi3mr: Rename log data save helper to reflect threaded/BH context
      https://git.kernel.org/mkp/scsi/c/d0d19250ed81
[3/8] mpi3mr: Avoid redundant diag-fault resets
      https://git.kernel.org/mkp/scsi/c/7a67d9262288
[4/8] mpi3mr: Use negotiated link rate from DevicePage0
      https://git.kernel.org/mkp/scsi/c/c273c14b0294
[5/8] mpi3mr: Update MPI Headers to revision 39
      https://git.kernel.org/mkp/scsi/c/d0654335d900
[6/8] mpi3mr: Record and report controller firmware faults
      https://git.kernel.org/mkp/scsi/c/ec54b348f274
[7/8] mpi3mr: Fixed the W=1 compilation warning
      https://git.kernel.org/mkp/scsi/c/8612d94348f4
[8/8] mpi3mr: Driver version update to 8.17.0.3.50
      https://git.kernel.org/mkp/scsi/c/943e9049e84a
Signature · 1 line
Martin K. Petersen