From: Salomon Dushimirimana <salomondush@google.com>
To: Sathya Prakash Veerichetty <sathya.prakash@broadcom.com>,
Kashyap Desai <kashyap.desai@broadcom.com>,
Sumit Saxena <sumit.saxena@broadcom.com>,
Sreekanth Reddy <sreekanth.reddy@broadcom.com>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: mpi3mr-linuxdrv.pdl@broadcom.com, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org,
Salomon Dushimirimana <salomondush@google.com>
Subject: [PATCH] scsi: mpi3mr: Emit uevent on controller diagnostic fault
Date: Wed, 16 Jul 2025 01:31:03 +0000 [thread overview]
Message-ID: <20250716013103.1571029-1-salomondush@google.com> (raw)
Introduces a uevent mechanism to notify userspace when the controller
undergoes a reset due to a diagnostic fault. A new function,
mpi3mr_fault_event_emit(), is added and called from the reset path. This
function filters for a diagnostic fault type
(MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT) and generates a uevent
containing details about the event:
- DRIVER: mpi3mr in this case
- HBA_NUM: scsi host id
- EVENT_TYPE: indicates fatal error
- RESET_TYPE: type of reset that has occurred
- RESET_REASON: specific reason for the reset
This will allow userspace tools to subscribe to these events and take
appropriate action.
Signed-off-by: Salomon Dushimirimana <salomondush@google.com>
---
drivers/scsi/mpi3mr/mpi3mr_fw.c | 42 +++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c
index 1d7901a8f0e40..9c90569754305 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_fw.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c
@@ -1623,6 +1623,47 @@ static inline void mpi3mr_set_diagsave(struct mpi3mr_ioc *mrioc)
writel(ioc_config, &mrioc->sysif_regs->ioc_configuration);
}
+/**
+ * mpi3mr_fault_uevent_emit - Emit a uevent for a controller diagnostic fault
+ * @mrioc: Pointer to the mpi3mr_ioc structure for the controller instance
+ * @reset_type: The type of reset that has occurred
+ * @reset_reason: The specific reason code for the reset
+ *
+ * This function is invoked when the controller undergoes a reset. It specifically
+ * filters for MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT) and ignores other
+ * reset types, such as soft resets.
+ */
+static void mpi3mr_fault_uevent_emit(struct mpi3mr_ioc *mrioc, u16 reset_type,
+ u16 reset_reason)
+{
+ struct kobj_uevent_env *env;
+
+ if (reset_type != MPI3_SYSIF_HOST_DIAG_RESET_ACTION_DIAG_FAULT)
+ return;
+
+ ioc_info(mrioc, "emitting fault exception uevent");
+
+ env = kzalloc(sizeof(struct kobj_uevent_env), GFP_KERNEL);
+ if (!env)
+ return;
+
+ if (add_uevent_var(env, "DRIVER=%s", mrioc->driver_name))
+ goto exit;
+ if (add_uevent_var(env, "HBA_NUM=%u", mrioc->id))
+ goto exit;
+ if (add_uevent_var(env, "EVENT_TYPE=FATAL_ERROR"))
+ goto exit;
+ if (add_uevent_var(env, "RESET_TYPE=%s", mpi3mr_reset_type_name(reset_type)))
+ goto exit;
+ if (add_uevent_var(env, "RESET_REASON=%s", mpi3mr_reset_rc_name(reset_reason)))
+ goto exit;
+
+ kobject_uevent_env(&mrioc->shost->shost_gendev.kobj, KOBJ_CHANGE, env->envp);
+
+exit:
+ kfree(env);
+}
+
/**
* mpi3mr_issue_reset - Issue reset to the controller
* @mrioc: Adapter reference
@@ -1741,6 +1782,7 @@ static int mpi3mr_issue_reset(struct mpi3mr_ioc *mrioc, u16 reset_type,
ioc_config);
if (retval)
mrioc->unrecoverable = 1;
+ mpi3mr_fault_uevent_emit(mrioc, reset_type, reset_reason);
return retval;
}
--
2.50.0.727.gbf7dc18ff4-goog
next reply other threads:[~2025-07-16 1:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-16 1:31 Salomon Dushimirimana [this message]
2025-07-16 15:51 ` Bart Van Assche
2025-07-17 19:40 ` [PATCH v2] " Salomon Dushimirimana
2025-07-18 15:43 ` Sathya Prakash Veerichetty
2025-07-18 23:31 ` Salomon Dushimirimana
2025-07-21 15:45 ` Sathya Prakash Veerichetty
2025-07-31 15:45 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250716013103.1571029-1-salomondush@google.com \
--to=salomondush@google.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=kashyap.desai@broadcom.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=mpi3mr-linuxdrv.pdl@broadcom.com \
--cc=sathya.prakash@broadcom.com \
--cc=sreekanth.reddy@broadcom.com \
--cc=sumit.saxena@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®