Skip to contentSkip to conversation

mpi3mr: Host diag buffer support

PATCH Superseded Ranjan Kumar 2 participants 10 messages May 14, 2024 – May 15, 2024

Subsystems (2)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

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.

Ranjan Kumar (6):
mpi3mr: HDB allocation and posting for hardware and Firmware buffers
mpi3mr: Driver buffer allocation and posting
mpi3mr: Dump driver and dmesg logs into driver diag buffer
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 |   59 ++
 drivers/scsi/mpi3mr/mpi3mr.h         |  162 +++-
 drivers/scsi/mpi3mr/mpi3mr_app.c     | 1078 ++++++++++++++++++++++++++
 drivers/scsi/mpi3mr/mpi3mr_fw.c      |  552 ++++++++++++-
 drivers/scsi/mpi3mr/mpi3mr_os.c      |  113 +++
 include/uapi/scsi/scsi_bsg_mpi3mr.h  |    3 +-
 6 files changed, 1956 insertions(+), 11 deletions(-)
 create mode 100644 drivers/scsi/mpi3mr/mpi/mpi30_tool.h
Signature · 1 line
2.31.1
#1 lore raw

PATCH 1/6 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     | 479 +++++++++++++++++++++++++++
 drivers/scsi/mpi3mr/mpi3mr_fw.c      | 193 ++++++++++-
 4 files changed, 789 insertions(+), 1 deletion(-)
 create mode 100644 drivers/scsi/mpi3mr/mpi/mpi30_tool.h
drivers/scsi/mpi3mr/mpi/mpi30_tool.h new file +44 -0
new file mode 100644
index 000000000000..3b960893870f
@@ -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 +479 -0

485 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
#2 lore raw

Re: [PATCH v1 1/6] mpi3mr: HDB allocation and posting for hardware and Firmware buffers

kernel test robot noticed the following build warnings:

Hi Ranjan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on jejb-scsi/for-next linus/master v6.9 next-20240515] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ranjan-Kumar/mpi3mr-HDB-allocation-and-posting-for-hardware-and-Firmware-buffers/20240514-223346
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
patch link:    https://lore.kernel.org/r/20240514142858.51992-2-ranjan.kumar%40broadcom.com
patch subject: [PATCH v1 1/6] mpi3mr: HDB allocation and posting for hardware and Firmware buffers
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20240515/[email protected]/config)
compiler: alpha-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240515/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> drivers/scsi/mpi3mr/mpi3mr_app.c:460: warning: Function parameter or struct member 'trigger_data' not described in 'mpi3mr_set_trigger_data_in_hdb'
>> drivers/scsi/mpi3mr/mpi3mr_app.c:460: warning: Excess function parameter 'data' description in 'mpi3mr_set_trigger_data_in_hdb'

vim +460 drivers/scsi/mpi3mr/mpi3mr_app.c

443
444 /**
445 * mpi3mr_set_trigger_data_in_hdb - Updates HDB trigger type and
446 * trigger data
447 *
448 * @hdb: HDB pointer
449 * @type: Trigger type
450 * @data: Trigger data
451 * @force: Trigger overwrite flag
452 *
453 * Updates trigger type and trigger data based on parameter
454 * passed to this function
455 *
456 * Return: Nothing
457 */
458 void mpi3mr_set_trigger_data_in_hdb(struct diag_buffer_desc *hdb,
459 u8 type, union mpi3mr_trigger_data *trigger_data, bool force)

 > 460	{

461 if ((!force) && (hdb->trigger_type != MPI3MR_HDB_TRIGGER_TYPE_UNKNOWN))
462 return;
463 hdb->trigger_type = type;
464 if (!trigger_data)
465 memset(&hdb->trigger_data, 0, sizeof(*trigger_data));
466 else
467 memcpy(&hdb->trigger_data, trigger_data, sizeof(*trigger_data));
468 }
469

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#3 lore raw

PATCH 2/6 mpi3mr: Driver buffer allocation and posting

In reply to Ranjan Kumar

This patch adds support for allocating a driver diagnostic buffer and posting it to the firmware for capturing the driver logs in the controller for further debugging.

---
 drivers/scsi/mpi3mr/mpi/mpi30_tool.h |  13 +++
 drivers/scsi/mpi3mr/mpi3mr.h         |  21 ++++
 drivers/scsi/mpi3mr/mpi3mr_fw.c      | 154 +++++++++++++++++++++++++++
 3 files changed, 188 insertions(+)
drivers/scsi/mpi3mr/mpi/mpi30_tool.h +13 -0
index 3b960893870f..495933856006 100644
@@ -7,6 +7,7 @@
 
 #define MPI3_DIAG_BUFFER_TYPE_TRACE	(0x01)
 #define MPI3_DIAG_BUFFER_TYPE_FW	(0x02)
+#define MPI3_DIAG_BUFFER_TYPE_DRIVER	(0x10)
 #define MPI3_DIAG_BUFFER_ACTION_RELEASE	(0x01)
 
 struct mpi3_diag_buffer_post_request {
@@ -40,5 +41,17 @@ struct mpi3_diag_buffer_manage_request {
 	__le16                     reserved0e;
 };
 
+struct mpi3_driver_buffer_header {
+	__le32                     signature;
+	__le16                     header_size;
+	__le16                     rtt_file_header_offset;
+	__le32                     flags;
+	__le32                     circular_buffer_size;
+	__le32                     logical_buffer_end;
+	__le32                     logical_buffer_start;
+	__le32                     ioc_use_only18[2];
+	__le32                     reserved20[760];
+	__le32                     reserved_rttrace[256];
+};
 
 #endif
drivers/scsi/mpi3mr/mpi3mr.h +21 -0
index 4ef96c39c832..dc7e8f461826 100644
@@ -37,6 +37,7 @@
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_tcq.h>
+#include <linux/kmsg_dump.h>
 #include <uapi/scsi/scsi_bsg_mpi3mr.h>
 #include <scsi/scsi_transport_sas.h>
 
@@ -195,6 +196,13 @@ extern atomic64_t event_counter;
 
 #define MPI3MR_HDB_TRIGGER_TYPE_GLOBAL          3
 
+/* Driver Host Diag Buffer (drv_db) */
+#define MPI3MR_MIN_DIAG_HOST_BUFFER_SZ		((32 * 1024) + \
+	sizeof(struct mpi3_driver_buffer_header))
+#define MPI3MR_DEFAULT_DIAG_HOST_BUFFER_SZ	((512 * 1024) + \
+	sizeof(struct mpi3_driver_buffer_header))
+#define MPI3MR_UEFI_DIAG_HOST_BUFFER_OFFSET	(16 * 1024)
+
 /* SGE Flag definition */
 #define MPI3MR_SGEFLAGS_SYSTEM_SIMPLE_END_OF_LIST \
 	(MPI3_SGE_FLAGS_ELEMENT_TYPE_SIMPLE | MPI3_SGE_FLAGS_DLAS_SYSTEM | \
@@ -218,6 +226,12 @@ extern atomic64_t event_counter;
 #define MPI3MR_WRITE_SAME_MAX_LEN_256_BLKS 256
 #define MPI3MR_WRITE_SAME_MAX_LEN_2048_BLKS 2048
 
+/* Driver diag buffer levels */
+enum mpi3mr_drv_db_level {
+	MRIOC_DRV_DB_DISABLED = 0,
+	MRIOC_DRV_DB_MINI = 1,
+	MRIOC_DRV_DB_FULL = 2,
+};
 
 /**
  * struct mpi3mr_nvme_pt_sge -  Structure to store SGEs for NVMe
@@ -1113,6 +1127,10 @@ 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
+ * @drv_diag_buffer: Diagnostic host buffer virtual address
+ * @drv_diag_buffer_dma: Diagnostic host buffer DMA address
+ * @drv_diag_buffer_sz: Diagnostic host buffer size
+ *
  */
 struct mpi3mr_ioc {
 	struct list_head list;
@@ -1310,6 +1328,9 @@ struct mpi3mr_ioc {
 	struct diag_buffer_desc diag_buffers[MPI3MR_MAX_NUM_HDB];
 	struct mpi3_driver_page2 *driver_pg2;
 	spinlock_t trigger_lock;
+	void *drv_diag_buffer;
+	dma_addr_t drv_diag_buffer_dma;
+	u32 drv_diag_buffer_sz;
 };
 
 /**
drivers/scsi/mpi3mr/mpi3mr_fw.c +154 -0

190 lines not on this page · raw message

Signature · 1 line
2.31.1
#4 lore raw

PATCH 3/6 mpi3mr: Dump driver and dmesg logs into driver diag buffer

In reply to Ranjan Kumar

This patch adds support for collecting the kernel messages based on the driver buffer capture level set in the module parameter and copy the pertinent information to the driver diagnostic buffer posted to the controller. The buffer capture and copy will be executed when the driver detected the controller in the fault state.

---
 drivers/scsi/mpi3mr/mpi/mpi30_tool.h |   2 +
 drivers/scsi/mpi3mr/mpi3mr.h         |   5 ++
 drivers/scsi/mpi3mr/mpi3mr_fw.c      | 126 +++++++++++++++++++++++++++
 3 files changed, 133 insertions(+)
drivers/scsi/mpi3mr/mpi/mpi30_tool.h +2 -0
index 495933856006..8b8b6ba00c7b 100644
@@ -10,6 +10,8 @@
 #define MPI3_DIAG_BUFFER_TYPE_DRIVER	(0x10)
 #define MPI3_DIAG_BUFFER_ACTION_RELEASE	(0x01)
 
+#define MPI3_DRIVER_DIAG_BUFFER_HEADER_FLAGS_CIRCULAR_BUF_FORMAT_ASCII	(0x00000000)
+
 struct mpi3_diag_buffer_post_request {
 	__le16                     host_tag;
 	u8                         ioc_use_only02;
drivers/scsi/mpi3mr/mpi3mr.h +5 -0
index dc7e8f461826..b6030a665ec8 100644
@@ -226,6 +226,10 @@ extern atomic64_t event_counter;
 #define MPI3MR_WRITE_SAME_MAX_LEN_256_BLKS 256
 #define MPI3MR_WRITE_SAME_MAX_LEN_2048_BLKS 2048
 
+struct mpi3mr_kmsg_dumper {
+	struct kmsg_dump_iter kdumper;
+};
+
 /* Driver diag buffer levels */
 enum mpi3mr_drv_db_level {
 	MRIOC_DRV_DB_DISABLED = 0,
@@ -1331,6 +1335,7 @@ struct mpi3mr_ioc {
 	void *drv_diag_buffer;
 	dma_addr_t drv_diag_buffer_dma;
 	u32 drv_diag_buffer_sz;
+	struct mpi3mr_kmsg_dumper dump;
 };
 
 /**
drivers/scsi/mpi3mr/mpi3mr_fw.c +126 -0

144 lines not on this page · raw message

Signature · 1 line
2.31.1
#5 lore raw

Re: [PATCH v1 3/6] mpi3mr: Dump driver and dmesg logs into driver diag buffer

kernel test robot noticed the following build warnings:

Hi Ranjan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on jejb-scsi/for-next linus/master v6.9 next-20240515] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ranjan-Kumar/mpi3mr-HDB-allocation-and-posting-for-hardware-and-Firmware-buffers/20240514-223346
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
patch link:    https://lore.kernel.org/r/20240514142858.51992-4-ranjan.kumar%40broadcom.com
patch subject: [PATCH v1 3/6] mpi3mr: Dump driver and dmesg logs into driver diag buffer
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20240515/[email protected]/config)
compiler: alpha-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240515/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> drivers/scsi/mpi3mr/mpi3mr_fw.c:1214: warning: Excess function parameter 'prev_offset' description in 'mpi3mr_do_mini_dump'

vim +1214 drivers/scsi/mpi3mr/mpi3mr_fw.c

1202
1203 /**
1204 * mpi3mr_do_mini_dump - copy system logs associated with mrioc.
1205 * @mrioc: Adapter instance reference
1206 * @prev_offset: offset returned from previous operation
1207 *
1208 * Read system logs and search for pattern mpi3mr%d and copy the lines
1209 * into driver diag buffer
1210 *
1211 * Return: next available location in driver diag buffer.
1212 */
1213 static int mpi3mr_do_mini_dump(struct mpi3mr_ioc *mrioc)

> 1214	{
  1215		int n = 0, lines, pos_mini_dump = 0;
  1216		struct mpi3mr_kmsg_dumper dumper;
  1217		size_t len;
  1218		char buf[201];
  1219		char *mini_start = "<6> Minidump start\n";
  1220		char *mini_end = "<6> Minidump end\n";
  1221	
  1222		struct mpi3_driver_buffer_header *drv_buff_header = NULL;
  1223	
  1224		dumper = mrioc->dump;
  1225	
  1226		kmsg_dump_rewind(&dumper.kdumper);
  1227		while (kmsg_dump_get_line(&dumper.kdumper, 1, NULL, 0, NULL))
  1228			n++;
  1229	
  1230		lines = n;
  1231		kmsg_dump_rewind(&dumper.kdumper);
  1232	
  1233		drv_buff_header = (struct mpi3_driver_buffer_header *)mrioc->drv_diag_buffer;
  1234		drv_buff_header->signature = 0x43495243;
  1235		drv_buff_header->logical_buffer_start = 0;
  1236		drv_buff_header->circular_buffer_size =
  1237			mrioc->drv_diag_buffer_sz - sizeof(struct mpi3_driver_buffer_header);
  1238		drv_buff_header->flags =
  1239			MPI3_DRIVER_DIAG_BUFFER_HEADER_FLAGS_CIRCULAR_BUF_FORMAT_ASCII;
  1240	
  1241		if ((pos_mini_dump + strlen(mini_start)
  1242				    < mrioc->drv_diag_buffer_sz)) {
  1243			sprintf((char *)mrioc->drv_diag_buffer + pos_mini_dump,
  1244				"%s\n", mini_start);
  1245			pos_mini_dump += strlen(mini_start);
  1246		} else {
  1247			ioc_info(mrioc, "driver diag buffer is full. minidump is not started\n");
  1248			goto out;
  1249		}
  1250	
  1251		while (kmsg_dump_get_line(&dumper.kdumper, 1, buf, sizeof(buf), &len)) {
  1252			if (!lines--)
  1253				break;
  1254			if (strstr(buf, mrioc->name) &&
  1255				((pos_mini_dump + len + strlen(mini_end))
  1256				    < mrioc->drv_diag_buffer_sz)) {
  1257				sprintf((char *)mrioc->drv_diag_buffer
  1258				    + pos_mini_dump, "%s", buf);
  1259				pos_mini_dump += len;
  1260			}
  1261		}
  1262	
  1263		if ((pos_mini_dump + strlen(mini_end)
  1264				    < mrioc->drv_diag_buffer_sz)) {
  1265			sprintf((char *)mrioc->drv_diag_buffer + pos_mini_dump,
  1266				"%s\n", mini_end);
  1267			pos_mini_dump += strlen(mini_end);
  1268		}
  1269	
  1270	out:
  1271		drv_buff_header->logical_buffer_end =
  1272			pos_mini_dump - sizeof(struct mpi3_driver_buffer_header);
  1273	
  1274		ioc_info(mrioc, "driver diag buffer base_address(including 4K header) 0x%016llx, end_address 0x%016llx\n",
  1275		    (unsigned long long)mrioc->drv_diag_buffer_dma,
  1276		    (unsigned long long)mrioc->drv_diag_buffer_dma +
  1277		    mrioc->drv_diag_buffer_sz);
  1278		ioc_info(mrioc, "logical_buffer end_address 0x%016llx, logical_buffer_end 0x%08x\n",
  1279		    (unsigned long long)mrioc->drv_diag_buffer_dma +
  1280		    drv_buff_header->logical_buffer_end,
  1281		    drv_buff_header->logical_buffer_end);

1282
1283 return pos_mini_dump;
1284 }
1285

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#6 lore raw

PATCH 4/6 mpi3mr: Trigger support

In reply to Ranjan Kumar

This 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     |  44 ++++
 drivers/scsi/mpi3mr/mpi3mr_app.c | 334 +++++++++++++++++++++++++++++++
 drivers/scsi/mpi3mr/mpi3mr_fw.c  |  79 +++++++-
 drivers/scsi/mpi3mr/mpi3mr_os.c  | 113 +++++++++++
 4 files changed, 563 insertions(+), 7 deletions(-)
drivers/scsi/mpi3mr/mpi3mr.h +44 -0
index b6030a665ec8..259f58b347fd 100644
@@ -194,7 +194,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
 
 /* Driver Host Diag Buffer (drv_db) */
 #define MPI3MR_MIN_DIAG_HOST_BUFFER_SZ		((32 * 1024) + \
@@ -226,6 +231,8 @@ 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_kmsg_dumper {
 	struct kmsg_dump_iter kdumper;
 };
@@ -321,6 +328,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
@@ -896,6 +904,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
@@ -1134,6 +1160,9 @@ struct scmd_priv {
  * @drv_diag_buffer: Diagnostic host buffer virtual address
  * @drv_diag_buffer_dma: Diagnostic host buffer DMA address
  * @drv_diag_buffer_sz: Diagnostic host buffer size
+ * @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 {
@@ -1336,6 +1365,9 @@ struct mpi3mr_ioc {
 	dma_addr_t drv_diag_buffer_dma;
 	u32 drv_diag_buffer_sz;
 	struct mpi3mr_kmsg_dumper dump;
+	bool snapdump_trigger_active;
+	bool trace_release_trigger_active;
+	bool fw_release_trigger_active;
 };
 
 /**
@@ -1540,4 +1572,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 +334 -0

346 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
#7 lore raw

Re: [PATCH v1 4/6] mpi3mr: Trigger support

kernel test robot noticed the following build warnings:

Hi Ranjan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on jejb-scsi/for-next linus/master next-20240515] [cannot apply to v6.9]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Ranjan-Kumar/mpi3mr-HDB-allocation-and-posting-for-hardware-and-Firmware-buffers/20240514-223346
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
patch link:    https://lore.kernel.org/r/20240514142858.51992-5-ranjan.kumar%40broadcom.com
patch subject: [PATCH v1 4/6] mpi3mr: Trigger support
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20240515/[email protected]/config)
compiler: alpha-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240515/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/scsi/mpi3mr/mpi3mr_app.c:717: warning: Function parameter or struct member 'trigger_data' not described in 'mpi3mr_set_trigger_data_in_hdb' drivers/scsi/mpi3mr/mpi3mr_app.c:717: warning: Excess function parameter 'data' description in 'mpi3mr_set_trigger_data_in_hdb'

>> drivers/scsi/mpi3mr/mpi3mr_app.c:743: warning: Function parameter or struct member 'trigger_data' not described in 'mpi3mr_set_trigger_data_in_all_hdb'
>> drivers/scsi/mpi3mr/mpi3mr_app.c:743: warning: Excess function parameter 'data' description in 'mpi3mr_set_trigger_data_in_all_hdb'

vim +743 drivers/scsi/mpi3mr/mpi3mr_app.c

726
727 /**
728 * mpi3mr_set_trigger_data_in_all_hdb - Updates HDB trigger type
729 * and trigger data for all HDB
730 *
731 * @mrioc: Adapter instance reference
732 * @type: Trigger type
733 * @data: Trigger data
734 * @force: Trigger overwrite flag
735 *
736 * Updates trigger type and trigger data based on parameter
737 * passed to this function
738 *
739 * Return: Nothing
740 */
741 void mpi3mr_set_trigger_data_in_all_hdb(struct mpi3mr_ioc *mrioc,
742 u8 type, union mpi3mr_trigger_data *trigger_data, bool force)

 > 743	{

744 struct diag_buffer_desc *hdb = NULL;
745
746 hdb = mpi3mr_diag_buffer_for_type(mrioc, MPI3_DIAG_BUFFER_TYPE_TRACE);
747 if (hdb)
748 mpi3mr_set_trigger_data_in_hdb(hdb, type, trigger_data, force);
749 hdb = mpi3mr_diag_buffer_for_type(mrioc, MPI3_DIAG_BUFFER_TYPE_FW);
750 if (hdb)
751 mpi3mr_set_trigger_data_in_hdb(hdb, type, trigger_data, force);
752 }
753

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#8 lore raw

PATCH 5/6 mpi3mr: Ioctl support for HDB

In reply to Ranjan Kumar

This patch provides interfaces for applications
to manage the host diagnostic buffers and update the automatic diag buffer capture triggers.

---
 drivers/scsi/mpi3mr/mpi3mr.h        |  14 ++
 drivers/scsi/mpi3mr/mpi3mr_app.c    | 265 ++++++++++++++++++++++++++++
 include/uapi/scsi/scsi_bsg_mpi3mr.h |   3 +-
 3 files changed, 281 insertions(+), 1 deletion(-)
drivers/scsi/mpi3mr/mpi3mr.h +14 -0
index 259f58b347fd..e27e37650f92 100644
@@ -201,6 +201,20 @@ 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
+
+
+
+
 /* Driver Host Diag Buffer (drv_db) */
 #define MPI3MR_MIN_DIAG_HOST_BUFFER_SZ		((32 * 1024) + \
 	sizeof(struct mpi3_driver_buffer_header))
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
index c72ce387286a..92a0eb190e1c 100644
@@ -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
#9 lore raw

PATCH 6/6 mpi3mr: Update driver version to 8.9.1.0.50

In reply to Ranjan Kumar

Update 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
index e27e37650f92..0762e8a9e6bd 100644
@@ -57,8 +57,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