mpi3mr: Host diag buffer support
Subsystems (2)
v5 cover mpi3mr: Host diag buffer support
The controllers managed by mpi3mr driver requires system memory to save hardware and firmware diagnostic information, this patch set enhances the drivers to provide host memory to the controller for diagnostic information. This patch set also provides driver changes to push kernel messages into the diagnostic buffers reserved for the driver, so that the information will be available as part of debug data fetched from the controller. In addition, support for configuring automatic diagnostic information is added in the driver.
Change since v1:
- Fixed test robot build warnings
Change since v2:
- Fixed test robot build warnings
Change since v3:
- Dropped mpi3mr-Dump-driver-and-dmesg-logs-into-driver-dia.patch based on Martin Petersen comment
Change since v4:
- Dropped mpi3mr-Driver-buffer-allocation-and-posting.patch
Ranjan Kumar (4):
mpi3mr: HDB allocation and posting for hardware and Firmware buffers
mpi3mr: Trigger support
mpi3mr: Ioctl support for HDB
mpi3mr: Update driver version to 8.9.1.0.50
drivers/scsi/mpi3mr/mpi/mpi30_tool.h | 44 ++ drivers/scsi/mpi3mr/mpi3mr.h | 133 +++- drivers/scsi/mpi3mr/mpi3mr_app.c | 1080 ++++++++++++++++++++++++++ drivers/scsi/mpi3mr/mpi3mr_fw.c | 272 ++++++- drivers/scsi/mpi3mr/mpi3mr_os.c | 113 +++ include/uapi/scsi/scsi_bsg_mpi3mr.h | 3 +- 6 files changed, 1634 insertions(+), 11 deletions(-) create mode 100644 drivers/scsi/mpi3mr/mpi/mpi30_tool.h
Signature · 1 line
2.31.1
PATCH v5 1/4 mpi3mr: HDB allocation and posting for hardware and Firmware buffers
This patch adds functions require to allocate and post firmware and hardware diagnostic buffers to the controller and to setup automatic diagnostic capture triggers
--- drivers/scsi/mpi3mr/mpi/mpi30_tool.h | 44 +++ drivers/scsi/mpi3mr/mpi3mr.h | 74 +++++ drivers/scsi/mpi3mr/mpi3mr_app.c | 480 +++++++++++++++++++++++++++ drivers/scsi/mpi3mr/mpi3mr_fw.c | 193 ++++++++++- 4 files changed, 790 insertions(+), 1 deletion(-) create mode 100644 drivers/scsi/mpi3mr/mpi/mpi30_tool.h
drivers/scsi/mpi3mr/mpi/mpi30_tool.h new file +44 -0
@@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Copyright 2016-2024 Broadcom Inc. All rights reserved. +*/ +#ifndef MPI30_TOOL_H +#define MPI30_TOOL_H 1 + +#define MPI3_DIAG_BUFFER_TYPE_TRACE (0x01) +#define MPI3_DIAG_BUFFER_TYPE_FW (0x02) +#define MPI3_DIAG_BUFFER_ACTION_RELEASE (0x01) + +struct mpi3_diag_buffer_post_request { +__le16 host_tag; +u8 ioc_use_only02; +u8 function; +__le16 ioc_use_only04; +u8 ioc_use_only06; +u8 msg_flags; +__le16 change_count; +__le16 reserved0a; +u8 type; +u8 reserved0d; +__le16 reserved0e; +__le64 address; +__le32 length; +__le32 reserved1c; +}; + +struct mpi3_diag_buffer_manage_request { +__le16 host_tag; +u8 ioc_use_only02; +u8 function; +__le16 ioc_use_only04; +u8 ioc_use_only06; +u8 msg_flags; +__le16 change_count; +__le16 reserved0a; +u8 type; +u8 action; +__le16 reserved0e; +}; + + +#endif
drivers/scsi/mpi3mr/mpi3mr.h +74 -0
132 lines not on this page · raw message
drivers/scsi/mpi3mr/mpi3mr_app.c +480 -0
486 lines not on this page · raw message
drivers/scsi/mpi3mr/mpi3mr_fw.c +192 -1
247 lines not on this page · raw message
Signature · 1 line
2.31.1
PATCH v5 2/4 mpi3mr: Trigger support
In reply to Ranjan KumarThis patch adds functions to process automatic diag triggers and if a condition defined in the triggers is met the driver will call appropriate controller functions to save the diagnostic information.
--- drivers/scsi/mpi3mr/mpi3mr.h | 43 ++++ drivers/scsi/mpi3mr/mpi3mr_app.c | 337 ++++++++++++++++++++++++++++++- drivers/scsi/mpi3mr/mpi3mr_fw.c | 79 +++++++- drivers/scsi/mpi3mr/mpi3mr_os.c | 113 +++++++++++ 4 files changed, 564 insertions(+), 8 deletions(-)
drivers/scsi/mpi3mr/mpi3mr.h +43 -0
@@ -193,7 +193,12 @@ extern atomic64_t event_counter;#define MPI3MR_DEFAULT_HDB_MIN_SZ (2 * 1024 * 1024)#define MPI3MR_MAX_NUM_HDB 2 +#define MPI3MR_HDB_TRIGGER_TYPE_UNKNOWN 0 +#define MPI3MR_HDB_TRIGGER_TYPE_FAULT 1 +#define MPI3MR_HDB_TRIGGER_TYPE_ELEMENT 2#define MPI3MR_HDB_TRIGGER_TYPE_GLOBAL 3 +#define MPI3MR_HDB_TRIGGER_TYPE_SOFT_RESET 4 +#define MPI3MR_HDB_TRIGGER_TYPE_FW_RELEASED 5/* SGE Flag definition */ #define MPI3MR_SGEFLAGS_SYSTEM_SIMPLE_END_OF_LIST \
@@ -218,6 +223,7 @@ extern atomic64_t event_counter;#define MPI3MR_WRITE_SAME_MAX_LEN_256_BLKS 256#define MPI3MR_WRITE_SAME_MAX_LEN_2048_BLKS 2048 +#define MPI3MR_DRIVER_EVENT_PROCESS_TRIGGER (0xFFFD)/** * struct mpi3mr_nvme_pt_sge - Structure to store SGEs for NVMe
@@ -303,6 +309,7 @@ enum mpi3mr_reset_reason {MPI3MR_RESET_FROM_FIRMWARE =27 ,MPI3MR_RESET_FROM_CFG_REQ_TIMEOUT =29 ,MPI3MR_RESET_FROM_SAS_TRANSPORT_TIMEOUT =30 , + MPI3MR_RESET_FROM_TRIGGER = 31, };#define MPI3MR_RESET_REASON_OSTYPE_LINUX 1
@@ -878,6 +885,24 @@ union mpi3mr_trigger_data {union mpi3_driver2_trigger_element element; }; +/** +* struct trigger_event_data - store trigger related +* information. +* +* @trace_hdb: Trace diag buffer descriptor reference +* @fw_hdb: FW diag buffer descriptor reference +* @trigger_type: Trigger type +* @trigger_specific_data: Trigger specific data +* @snapdump: Snapdump enable or disable flag +*/ +struct trigger_event_data { +struct diag_buffer_desc *trace_hdb; +struct diag_buffer_desc *fw_hdb; +u8 trigger_type; +union mpi3mr_trigger_data trigger_specific_data; +bool snapdump; +}; +/** * struct diag_buffer_desc - memory descriptor structure to * store virtual, dma addresses, size, buffer status for host
@@ -1113,6 +1138,9 @@ struct scmd_priv {* @ioctl_chain_sge: DMA buffer descriptor for IOCTL chain * @ioctl_resp_sge: DMA buffer descriptor for Mgmt cmd response * @ioctl_sges_allocated: Flag for IOCTL SGEs allocated or not +* @trace_release_trigger_active: Trace trigger active flag +* @fw_release_trigger_active: Fw release trigger active flag +* @snapdump_trigger_active: Snapdump trigger active flag */ struct mpi3mr_ioc {struct list_head list;
@@ -1310,6 +1338,9 @@ struct mpi3mr_ioc {struct diag_buffer_desc diag_buffers[MPI3MR_MAX_NUM_HDB ];struct mpi3_driver_page2 *driver_pg2;spinlock_t trigger_lock; +bool snapdump_trigger_active; +bool trace_release_trigger_active; +bool fw_release_trigger_active; };/**
@@ -1513,4 +1544,16 @@ struct diag_buffer_desc *mpi3mr_diag_buffer_for_type(struct mpi3mr_ioc *mrioc, u8 buf_type);int mpi3mr_issue_diag_buf_post (struct mpi3mr_ioc *mrioc,struct diag_buffer_desc *diag_buffer); +void mpi3mr_set_trigger_data_in_all_hdb (struct mpi3mr_ioc *mrioc, +u8 type,union mpi3mr_trigger_data *trigger_data,bool force); +void mpi3mr_reply_trigger (struct mpi3mr_ioc *mrioc,u16 iocstatus, +u32 iocloginfo); +void mpi3mr_hdb_trigger_data_event (struct mpi3mr_ioc *mrioc, +struct trigger_event_data *event_data); +void mpi3mr_scsisense_trigger (struct mpi3mr_ioc *mrioc,u8 senseky,u8 asc, +u8 ascq); +void mpi3mr_event_trigger (struct mpi3mr_ioc *mrioc,u8 event); +void mpi3mr_global_trigger (struct mpi3mr_ioc *mrioc,u64 trigger_data); +void mpi3mr_hdbstatuschg_evt_th (struct mpi3mr_ioc *mrioc, +struct mpi3_event_notification_reply *event_reply);#endif /*MPI3MR_H_INCLUDED*/
drivers/scsi/mpi3mr/mpi3mr_app.c +336 -1
355 lines not on this page · raw message
drivers/scsi/mpi3mr/mpi3mr_fw.c +72 -7
207 lines not on this page · raw message
drivers/scsi/mpi3mr/mpi3mr_os.c +113 -0
167 lines not on this page · raw message
Signature · 1 line
2.31.1
PATCH v5 3/4 mpi3mr: Ioctl support for HDB
In reply to Ranjan KumarThis patch provides interfaces for applications
to manage the host diagnostic buffers and update the automatic diag buffer capture triggers.
--- drivers/scsi/mpi3mr/mpi3mr.h | 12 ++ drivers/scsi/mpi3mr/mpi3mr_app.c | 265 ++++++++++++++++++++++++++++ include/uapi/scsi/scsi_bsg_mpi3mr.h | 3 +- 3 files changed, 279 insertions(+), 1 deletion(-)
drivers/scsi/mpi3mr/mpi3mr.h +12 -0
@@ -200,6 +200,18 @@ extern atomic64_t event_counter;#define MPI3MR_HDB_TRIGGER_TYPE_SOFT_RESET 4#define MPI3MR_HDB_TRIGGER_TYPE_FW_RELEASED 5 +#define MPI3MR_HDB_REFRESH_TYPE_RESERVED 0 +#define MPI3MR_HDB_REFRESH_TYPE_CURRENT 1 +#define MPI3MR_HDB_REFRESH_TYPE_DEFAULT 2 +#define MPI3MR_HDB_HDB_REFRESH_TYPE_PERSISTENT 3 + +#define MPI3MR_DEFAULT_HDB_SZ (4 * 1024 * 1024) +#define MPI3MR_MAX_NUM_HDB 2 + +#define MPI3MR_HDB_QUERY_ELEMENT_TRIGGER_FORMAT_INDEX 0 +#define MPI3MR_HDB_QUERY_ELEMENT_TRIGGER_FORMAT_DATA 1 + +/* SGE Flag definition */ #define MPI3MR_SGEFLAGS_SYSTEM_SIMPLE_END_OF_LIST \ (MPI3_SGE_FLAGS_ELEMENT_TYPE_SIMPLE | MPI3_SGE_FLAGS_DLAS_SYSTEM | \
drivers/scsi/mpi3mr/mpi3mr_app.c +265 -0
277 lines not on this page · raw message
include/uapi/scsi/scsi_bsg_mpi3mr.h +2 -1
@@ -296,6 +296,7 @@ struct mpi3mr_hdb_entry {* multiple hdb entries. * * @num_hdb_types: Number of host diag buffer types supported +* @element_trigger_format: Element trigger format * @rsvd1: Reserved * @rsvd2: Reserved * @rsvd3: Reserved
@@ -303,7 +304,7 @@ struct mpi3mr_hdb_entry {*/ struct mpi3mr_bsg_in_hdb_status {__u8 num_hdb_types; -__u8 rsvd1; +__u8 element_trigger_format;__u16 rsvd2;__u32 rsvd3;struct mpi3mr_hdb_entry entry[1 ];
Signature · 1 line
2.31.1
PATCH v5 4/4 mpi3mr: Update driver version to 8.9.1.0.50
In reply to Ranjan KumarUpdate driver version to 8.9.1.0.50
--- drivers/scsi/mpi3mr/mpi3mr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/mpi3mr/mpi3mr.h +2 -2
@@ -56,8 +56,8 @@ extern struct list_head mrioc_list;extern int prot_mask;extern atomic64_t event_counter; -#define MPI3MR_DRIVER_VERSION "8.8.1.0.50" -#define MPI3MR_DRIVER_RELDATE "5-March-2024" +#define MPI3MR_DRIVER_VERSION "8.9.1.0.50" +#define MPI3MR_DRIVER_RELDATE "14-May-2024"#define MPI3MR_DRIVER_NAME "mpi3mr"#define MPI3MR_DRIVER_LICENSE "GPL"
Signature · 1 line
2.31.1