From: Nilesh Javali <njavali@marvell.com>
To: <martin.petersen@oracle.com>
Cc: <linux-scsi@vger.kernel.org>,
<GR-QLogic-Storage-Upstream@marvell.com>,
<agurumurthy@marvell.com>, <sdeodhar@marvell.com>,
<emilne@redhat.com>, <jmeneghi@redhat.com>
Subject: [PATCH v2 04/12] qla2xxx: Validate MCU signature before executing MBC 03h
Date: Thu, 4 Dec 2025 20:47:43 +0530 [thread overview]
Message-ID: <20251204151751.2321801-5-njavali@marvell.com> (raw)
In-Reply-To: <20251204151751.2321801-1-njavali@marvell.com>
From: Manish Rangankar <mrangankar@marvell.com>
FC firmware does not come online during on-the-fly
upgrade i.e. on soft reset.
To limit Load flash firmware i.e. mbc 3 changes validate
MCU signature before executing MBC 03h
Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Himanshu Madhani <hmadhani2024@gmail.com>
---
drivers/scsi/qla2xxx/qla_def.h | 3 +++
drivers/scsi/qla2xxx/qla_init.c | 2 +-
drivers/scsi/qla2xxx/qla_nx.h | 1 +
drivers/scsi/qla2xxx/qla_sup.c | 29 +++++++++++++++++++++++++++++
4 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 184a66b8633e..cac4745b012e 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -4151,6 +4151,7 @@ struct qla_hw_data {
uint32_t eeh_flush:2;
#define EEH_FLUSH_RDY 1
#define EEH_FLUSH_DONE 2
+ uint32_t secure_mcu:1;
} flags;
uint16_t max_exchg;
@@ -4416,6 +4417,8 @@ struct qla_hw_data {
((IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) &&\
(ha->zio_mode == QLA_ZIO_MODE_6))
+#define IS_QLA28XX_SECURED(ha) (IS_QLA28XX(ha) && ha->flags.secure_mcu)
+
/* HBA serial number */
uint8_t serial0;
uint8_t serial1;
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 82879fb8b565..4582a92c742a 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -9058,7 +9058,7 @@ qla81xx_load_risc(scsi_qla_host_t *vha, uint32_t *srisc_addr)
qla27xx_get_active_image(vha, &active_regions);
/* For 28XXX, always load the flash firmware using rom mbx */
- if (IS_QLA28XX(ha)) {
+ if (IS_QLA28XX_SECURED(ha)) {
rval = qla28xx_load_flash_firmware(vha);
if (rval != QLA_SUCCESS) {
ql_log(ql_log_fatal, vha, 0x019e,
diff --git a/drivers/scsi/qla2xxx/qla_nx.h b/drivers/scsi/qla2xxx/qla_nx.h
index 5d1bdc15b75c..8e7a7f5f0adb 100644
--- a/drivers/scsi/qla2xxx/qla_nx.h
+++ b/drivers/scsi/qla2xxx/qla_nx.h
@@ -892,6 +892,7 @@ struct ct6_dsd {
#define FA_VPD_SIZE_82XX 0x400
#define FA_FLASH_LAYOUT_ADDR_82 0xFC400
+#define FA_FLASH_MCU_OFF 0x13000
/******************************************************************************
*
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
index 9e7a407ba1b9..b6c36a8a2d60 100644
--- a/drivers/scsi/qla2xxx/qla_sup.c
+++ b/drivers/scsi/qla2xxx/qla_sup.c
@@ -1084,6 +1084,32 @@ qla2xxx_get_idc_param(scsi_qla_host_t *vha)
return;
}
+static int qla28xx_validate_mcu_signature(scsi_qla_host_t *vha)
+{
+ struct qla_hw_data *ha = vha->hw;
+ struct req_que *req = ha->req_q_map[0];
+ uint32_t *dcode = (uint32_t *)req->ring;
+ uint32_t signature[2] = {0x000c0000, 0x00050000};
+ int ret = QLA_SUCCESS;
+
+ ret = qla24xx_read_flash_data(vha, dcode, FA_FLASH_MCU_OFF >> 2, 2);
+ if (ret) {
+ ql_log(ql_log_fatal, vha, 0x01ab,
+ "-> Failed to read flash mcu signature.\n");
+ ret = QLA_FUNCTION_FAILED;
+ goto done;
+ }
+
+ ql_dbg(ql_dbg_init, vha, 0x01ac,
+ "Flash data 0x%08x 0x%08x.\n", dcode[0], dcode[1]);
+
+ if (!(dcode[0] == signature[0] && dcode[1] == signature[1]))
+ ret = QLA_FUNCTION_FAILED;
+
+done:
+ return ret;
+}
+
int
qla2xxx_get_flash_info(scsi_qla_host_t *vha)
{
@@ -1096,6 +1122,9 @@ qla2xxx_get_flash_info(scsi_qla_host_t *vha)
!IS_QLA27XX(ha) && !IS_QLA28XX(ha))
return QLA_SUCCESS;
+ if (IS_QLA28XX(ha) && !qla28xx_validate_mcu_signature(vha))
+ ha->flags.secure_mcu = 1;
+
ret = qla2xxx_find_flt_start(vha, &flt_addr);
if (ret != QLA_SUCCESS)
return ret;
--
2.23.1
next prev parent reply other threads:[~2025-12-04 15:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-04 15:17 [PATCH v2 00/12] qla2xxx: Misc feature and bug fixes Nilesh Javali
2025-12-04 15:17 ` [PATCH v2 01/12] qla2xxx: Add Speed in SFP print information Nilesh Javali
2025-12-04 15:17 ` [PATCH v2 02/12] qla2xxx: Add support for 64G SFP speed Nilesh Javali
2025-12-04 15:17 ` [PATCH v2 03/12] qla2xxx: Add load flash firmware mailbox support for 28xxx Nilesh Javali
2025-12-04 15:17 ` Nilesh Javali [this message]
2025-12-04 15:17 ` [PATCH v2 05/12] qla2xxx: Add bsg interface to support firmware img validation Nilesh Javali
2025-12-04 15:17 ` [PATCH v2 06/12] qla2xxx: Allow recovery for tape devices Nilesh Javali
2025-12-04 15:17 ` [PATCH v2 07/12] qla2xxx: Delay module unload while fabric scan in progress Nilesh Javali
2025-12-09 8:14 ` Dan Carpenter
2025-12-04 15:17 ` [PATCH v2 08/12] qla2xxx: free sp in error path to fix system crash Nilesh Javali
2025-12-04 15:17 ` [PATCH v2 09/12] qla2xxx: validate sp before freeing associated memory Nilesh Javali
2025-12-04 15:17 ` [PATCH v2 10/12] qla2xxx: Query FW again before proceeding with login Nilesh Javali
2025-12-04 15:17 ` [PATCH v2 11/12] qla2xxx: fix bsg_done causing double free Nilesh Javali
2025-12-04 15:17 ` [PATCH v2 12/12] qla2xxx: Update version to 10.02.10.100-k Nilesh Javali
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=20251204151751.2321801-5-njavali@marvell.com \
--to=njavali@marvell.com \
--cc=GR-QLogic-Storage-Upstream@marvell.com \
--cc=agurumurthy@marvell.com \
--cc=emilne@redhat.com \
--cc=jmeneghi@redhat.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=sdeodhar@marvell.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