diff mbox series

[14/16] qla2xxx: Add devid's and conditionals for 28xx

Message ID 20211224070712.17905-15-njavali@marvell.com
State New
Headers show
Series qla2xxx misc bug fixes and features | expand

Commit Message

Nilesh Javali Dec. 24, 2021, 7:07 a.m. UTC
From: Arun Easi <aeasi@marvell.com>

28XX adapters are capable of detecting both T10 PI tag escape values
as well as IP guard. This was missed due to the adapter type missed
in the corresponding macros. Fix this by adding support for 28xx in
those macros.

Cc: stable@vger.kernel.org
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
---
 drivers/scsi/qla2xxx/qla_attr.c   |  7 ++-----
 drivers/scsi/qla2xxx/qla_init.c   | 17 +++++++++++------
 drivers/scsi/qla2xxx/qla_mbx.c    | 17 ++++++++++++++---
 drivers/scsi/qla2xxx/qla_os.c     |  3 +--
 drivers/scsi/qla2xxx/qla_sup.c    |  4 ++--
 drivers/scsi/qla2xxx/qla_target.c |  3 +--
 6 files changed, 31 insertions(+), 20 deletions(-)

Comments

Himanshu Madhani Jan. 3, 2022, 12:52 a.m. UTC | #1
> On Dec 23, 2021, at 11:07 PM, Nilesh Javali <njavali@marvell.com> wrote:
> 
> From: Arun Easi <aeasi@marvell.com>
> 
> 28XX adapters are capable of detecting both T10 PI tag escape values
> as well as IP guard. This was missed due to the adapter type missed
> in the corresponding macros. Fix this by adding support for 28xx in
> those macros.
> 

This patch seems to fix more than just IP guard macros. 
Can you please seperate T10 PI fix with other fixes from this patch.

> Cc: stable@vger.kernel.org
> Signed-off-by: Arun Easi <aeasi@marvell.com>
> Signed-off-by: Nilesh Javali <njavali@marvell.com>
> ---
> drivers/scsi/qla2xxx/qla_attr.c   |  7 ++-----
> drivers/scsi/qla2xxx/qla_init.c   | 17 +++++++++++------
> drivers/scsi/qla2xxx/qla_mbx.c    | 17 ++++++++++++++---
> drivers/scsi/qla2xxx/qla_os.c     |  3 +--
> drivers/scsi/qla2xxx/qla_sup.c    |  4 ++--
> drivers/scsi/qla2xxx/qla_target.c |  3 +--
> 6 files changed, 31 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
> index db55737000ab..3b3e4234f37a 100644
> --- a/drivers/scsi/qla2xxx/qla_attr.c
> +++ b/drivers/scsi/qla2xxx/qla_attr.c
> @@ -555,7 +555,7 @@ qla2x00_sysfs_read_vpd(struct file *filp, struct kobject *kobj,
> 	if (!capable(CAP_SYS_ADMIN))
> 		return -EINVAL;
> 
> -	if (IS_NOCACHE_VPD_TYPE(ha))
> +	if (!IS_NOCACHE_VPD_TYPE(ha))
> 		goto skip;
> 
> 	faddr = ha->flt_region_vpd << 2;
> @@ -745,7 +745,7 @@ qla2x00_sysfs_write_reset(struct file *filp, struct kobject *kobj,
> 		ql_log(ql_log_info, vha, 0x706f,
> 		    "Issuing MPI reset.\n");
> 
> -		if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) {
> +		if (IS_QLA83XX(ha)) {
> 			uint32_t idc_control;
> 
> 			qla83xx_idc_lock(vha, 0);
> @@ -1056,9 +1056,6 @@ qla2x00_free_sysfs_attr(scsi_qla_host_t *vha, bool stop_beacon)
> 			continue;
> 		if (iter->type == 3 && !(IS_CNA_CAPABLE(ha)))
> 			continue;
> -		if (iter->type == 0x27 &&
> -		    (!IS_QLA27XX(ha) || !IS_QLA28XX(ha)))
> -			continue;
> 
> 		sysfs_remove_bin_file(&host->shost_gendev.kobj,
> 		    iter->attr);
> diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
> index 24322eb01571..87382477ff85 100644
> --- a/drivers/scsi/qla2xxx/qla_init.c
> +++ b/drivers/scsi/qla2xxx/qla_init.c
> @@ -3482,6 +3482,14 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
> 	struct rsp_que *rsp = ha->rsp_q_map[0];
> 	struct qla2xxx_fw_dump *fw_dump;
> 
> +	if (ha->fw_dump) {
> +		ql_dbg(ql_dbg_init, vha, 0x00bd,
> +		    "Firmware dump already allocated.\n");
> +		return;
> +	}
> +
> +	ha->fw_dumped = 0;
> +	ha->fw_dump_cap_flags = 0;
> 	dump_size = fixed_size = mem_size = eft_size = fce_size = mq_size = 0;
> 	req_q_size = rsp_q_size = 0;
> 
> @@ -3492,7 +3500,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
> 		mem_size = (ha->fw_memory_size - 0x11000 + 1) *
> 		    sizeof(uint16_t);
> 	} else if (IS_FWI2_CAPABLE(ha)) {
> -		if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha))
> +		if (IS_QLA83XX(ha))
> 			fixed_size = offsetof(struct qla83xx_fw_dump, ext_mem);
> 		else if (IS_QLA81XX(ha))
> 			fixed_size = offsetof(struct qla81xx_fw_dump, ext_mem);
> @@ -3504,8 +3512,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
> 		mem_size = (ha->fw_memory_size - 0x100000 + 1) *
> 		    sizeof(uint32_t);
> 		if (ha->mqenable) {
> -			if (!IS_QLA83XX(ha) && !IS_QLA27XX(ha) &&
> -			    !IS_QLA28XX(ha))
> +			if (!IS_QLA83XX(ha))
> 				mq_size = sizeof(struct qla2xxx_mq_chain);
> 			/*
> 			 * Allocate maximum buffer size for all queues - Q0.
> @@ -4065,9 +4072,7 @@ qla2x00_setup_chip(scsi_qla_host_t *vha)
> 			    "Unsupported FAC firmware (%d.%02d.%02d).\n",
> 			    ha->fw_major_version, ha->fw_minor_version,
> 			    ha->fw_subminor_version);
> -
> -			if (IS_QLA83XX(ha) || IS_QLA27XX(ha) ||
> -			    IS_QLA28XX(ha)) {
> +			if (IS_QLA83XX(ha)) {
> 				ha->flags.fac_supported = 0;
> 				rval = QLA_SUCCESS;
> 			}
> diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
> index c4bd8a16d78c..826303f53f77 100644
> --- a/drivers/scsi/qla2xxx/qla_mbx.c
> +++ b/drivers/scsi/qla2xxx/qla_mbx.c
> @@ -9,6 +9,12 @@
> #include <linux/delay.h>
> #include <linux/gfp.h>
> 
> +#ifdef CONFIG_PPC
> +#define IS_PPCARCH      true
> +#else
> +#define IS_PPCARCH      false
> +#endif
> +
> static struct mb_cmd_name {
> 	uint16_t cmd;
> 	const char *str;
> @@ -728,6 +734,12 @@ qla2x00_execute_fw(scsi_qla_host_t *vha, uint32_t risc_addr)
> 				vha->min_supported_speed =
> 				    nv->min_supported_speed;
> 			}
> +
> +			if (IS_PPCARCH)
> +				mcp->mb[11] |= BIT_4;
> +
> +			if (ql2xnvmeenable)
> +				mcp->mb[4] |= NVME_ENABLE_FLAG;
> 		}
> 
> 		if (ha->flags.exlogins_enabled)
> @@ -3035,8 +3047,7 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *vha)
> 		ha->orig_fw_iocb_count = mcp->mb[10];
> 		if (ha->flags.npiv_supported)
> 			ha->max_npiv_vports = mcp->mb[11];
> -		if (IS_QLA81XX(ha) || IS_QLA83XX(ha) || IS_QLA27XX(ha) ||
> -		    IS_QLA28XX(ha))
> +		if (IS_QLA81XX(ha) || IS_QLA83XX(ha))
> 			ha->fw_max_fcf_count = mcp->mb[12];
> 	}
> 
> @@ -5627,7 +5638,7 @@ qla2x00_get_data_rate(scsi_qla_host_t *vha)
> 	mcp->out_mb = MBX_1|MBX_0;
> 	mcp->in_mb = MBX_2|MBX_1|MBX_0;
> 	if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha))
> -		mcp->in_mb |= MBX_3;
> +		mcp->in_mb |= MBX_4|MBX_3;
> 	mcp->tov = MBX_TOV_SECONDS;
> 	mcp->flags = 0;
> 	rval = qla2x00_mailbox_command(vha, mcp);
> diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
> index 88bff825aa5e..cff5e4a710d1 100644
> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -3762,8 +3762,7 @@ qla2x00_unmap_iobases(struct qla_hw_data *ha)
> 		if (ha->mqiobase)
> 			iounmap(ha->mqiobase);
> 
> -		if ((IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) &&
> -		    ha->msixbase)
> +		if (ha->msixbase)
> 			iounmap(ha->msixbase);
> 	}
> }
> diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
> index a0aeba69513d..c092a6b1ced4 100644
> --- a/drivers/scsi/qla2xxx/qla_sup.c
> +++ b/drivers/scsi/qla2xxx/qla_sup.c
> @@ -844,7 +844,7 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
> 				ha->flt_region_nvram = start;
> 			break;
> 		case FLT_REG_IMG_PRI_27XX:
> -			if (IS_QLA27XX(ha) && !IS_QLA28XX(ha))
> +			if (IS_QLA27XX(ha) || IS_QLA28XX(ha))
> 				ha->flt_region_img_status_pri = start;
> 			break;
> 		case FLT_REG_IMG_SEC_27XX:
> @@ -1356,7 +1356,7 @@ qla24xx_write_flash_data(scsi_qla_host_t *vha, __le32 *dwptr, uint32_t faddr,
> 		    flash_data_addr(ha, faddr), le32_to_cpu(*dwptr));
> 		if (ret) {
> 			ql_dbg(ql_dbg_user, vha, 0x7006,
> -			    "Failed slopw write %x (%x)\n", faddr, *dwptr);
> +			    "Failed slow write %x (%x)\n", faddr, *dwptr);
> 			break;
> 		}
> 	}
> diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
> index feb054c688a3..b109716d44fb 100644
> --- a/drivers/scsi/qla2xxx/qla_target.c
> +++ b/drivers/scsi/qla2xxx/qla_target.c
> @@ -7220,8 +7220,7 @@ qlt_probe_one_stage1(struct scsi_qla_host *base_vha, struct qla_hw_data *ha)
> 	if (!QLA_TGT_MODE_ENABLED())
> 		return;
> 
> -	if  ((ql2xenablemsix == 0) || IS_QLA83XX(ha) || IS_QLA27XX(ha) ||
> -	    IS_QLA28XX(ha)) {
> +	if  (ha->mqenable || IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) {
> 		ISP_ATIO_Q_IN(base_vha) = &ha->mqiobase->isp25mq.atio_q_in;
> 		ISP_ATIO_Q_OUT(base_vha) = &ha->mqiobase->isp25mq.atio_q_out;
> 	} else {
> -- 
> 2.23.1
> 

--
Himanshu Madhani	 Oracle Linux Engineering
Nilesh Javali Jan. 3, 2022, 4:02 p.m. UTC | #2
Himanshu,

> -----Original Message-----
> From: Himanshu Madhani <himanshu.madhani@oracle.com>
> Sent: Monday, January 3, 2022 6:22 AM
> To: Nilesh Javali <njavali@marvell.com>
> Cc: Martin Petersen <martin.petersen@oracle.com>; linux-scsi <linux-
> scsi@vger.kernel.org>; GR-QLogic-Storage-Upstream <GR-QLogic-Storage-
> Upstream@marvell.com>
> Subject: [EXT] Re: [PATCH 14/16] qla2xxx: Add devid's and conditionals for
> 28xx
> 
> External Email
> 
> ----------------------------------------------------------------------
> 
> 
> > On Dec 23, 2021, at 11:07 PM, Nilesh Javali <njavali@marvell.com> wrote:
> >
> > From: Arun Easi <aeasi@marvell.com>
> >
> > 28XX adapters are capable of detecting both T10 PI tag escape values
> > as well as IP guard. This was missed due to the adapter type missed
> > in the corresponding macros. Fix this by adding support for 28xx in
> > those macros.
> >
> 
> This patch seems to fix more than just IP guard macros.
> Can you please seperate T10 PI fix with other fixes from this patch.
> 

Thanks for reviewing all the patches.
I'll separate out the changes as part of new series.

Thanks,
Nilesh
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index db55737000ab..3b3e4234f37a 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -555,7 +555,7 @@  qla2x00_sysfs_read_vpd(struct file *filp, struct kobject *kobj,
 	if (!capable(CAP_SYS_ADMIN))
 		return -EINVAL;
 
-	if (IS_NOCACHE_VPD_TYPE(ha))
+	if (!IS_NOCACHE_VPD_TYPE(ha))
 		goto skip;
 
 	faddr = ha->flt_region_vpd << 2;
@@ -745,7 +745,7 @@  qla2x00_sysfs_write_reset(struct file *filp, struct kobject *kobj,
 		ql_log(ql_log_info, vha, 0x706f,
 		    "Issuing MPI reset.\n");
 
-		if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) {
+		if (IS_QLA83XX(ha)) {
 			uint32_t idc_control;
 
 			qla83xx_idc_lock(vha, 0);
@@ -1056,9 +1056,6 @@  qla2x00_free_sysfs_attr(scsi_qla_host_t *vha, bool stop_beacon)
 			continue;
 		if (iter->type == 3 && !(IS_CNA_CAPABLE(ha)))
 			continue;
-		if (iter->type == 0x27 &&
-		    (!IS_QLA27XX(ha) || !IS_QLA28XX(ha)))
-			continue;
 
 		sysfs_remove_bin_file(&host->shost_gendev.kobj,
 		    iter->attr);
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 24322eb01571..87382477ff85 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -3482,6 +3482,14 @@  qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
 	struct rsp_que *rsp = ha->rsp_q_map[0];
 	struct qla2xxx_fw_dump *fw_dump;
 
+	if (ha->fw_dump) {
+		ql_dbg(ql_dbg_init, vha, 0x00bd,
+		    "Firmware dump already allocated.\n");
+		return;
+	}
+
+	ha->fw_dumped = 0;
+	ha->fw_dump_cap_flags = 0;
 	dump_size = fixed_size = mem_size = eft_size = fce_size = mq_size = 0;
 	req_q_size = rsp_q_size = 0;
 
@@ -3492,7 +3500,7 @@  qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
 		mem_size = (ha->fw_memory_size - 0x11000 + 1) *
 		    sizeof(uint16_t);
 	} else if (IS_FWI2_CAPABLE(ha)) {
-		if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha))
+		if (IS_QLA83XX(ha))
 			fixed_size = offsetof(struct qla83xx_fw_dump, ext_mem);
 		else if (IS_QLA81XX(ha))
 			fixed_size = offsetof(struct qla81xx_fw_dump, ext_mem);
@@ -3504,8 +3512,7 @@  qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
 		mem_size = (ha->fw_memory_size - 0x100000 + 1) *
 		    sizeof(uint32_t);
 		if (ha->mqenable) {
-			if (!IS_QLA83XX(ha) && !IS_QLA27XX(ha) &&
-			    !IS_QLA28XX(ha))
+			if (!IS_QLA83XX(ha))
 				mq_size = sizeof(struct qla2xxx_mq_chain);
 			/*
 			 * Allocate maximum buffer size for all queues - Q0.
@@ -4065,9 +4072,7 @@  qla2x00_setup_chip(scsi_qla_host_t *vha)
 			    "Unsupported FAC firmware (%d.%02d.%02d).\n",
 			    ha->fw_major_version, ha->fw_minor_version,
 			    ha->fw_subminor_version);
-
-			if (IS_QLA83XX(ha) || IS_QLA27XX(ha) ||
-			    IS_QLA28XX(ha)) {
+			if (IS_QLA83XX(ha)) {
 				ha->flags.fac_supported = 0;
 				rval = QLA_SUCCESS;
 			}
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index c4bd8a16d78c..826303f53f77 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -9,6 +9,12 @@ 
 #include <linux/delay.h>
 #include <linux/gfp.h>
 
+#ifdef CONFIG_PPC
+#define IS_PPCARCH      true
+#else
+#define IS_PPCARCH      false
+#endif
+
 static struct mb_cmd_name {
 	uint16_t cmd;
 	const char *str;
@@ -728,6 +734,12 @@  qla2x00_execute_fw(scsi_qla_host_t *vha, uint32_t risc_addr)
 				vha->min_supported_speed =
 				    nv->min_supported_speed;
 			}
+
+			if (IS_PPCARCH)
+				mcp->mb[11] |= BIT_4;
+
+			if (ql2xnvmeenable)
+				mcp->mb[4] |= NVME_ENABLE_FLAG;
 		}
 
 		if (ha->flags.exlogins_enabled)
@@ -3035,8 +3047,7 @@  qla2x00_get_resource_cnts(scsi_qla_host_t *vha)
 		ha->orig_fw_iocb_count = mcp->mb[10];
 		if (ha->flags.npiv_supported)
 			ha->max_npiv_vports = mcp->mb[11];
-		if (IS_QLA81XX(ha) || IS_QLA83XX(ha) || IS_QLA27XX(ha) ||
-		    IS_QLA28XX(ha))
+		if (IS_QLA81XX(ha) || IS_QLA83XX(ha))
 			ha->fw_max_fcf_count = mcp->mb[12];
 	}
 
@@ -5627,7 +5638,7 @@  qla2x00_get_data_rate(scsi_qla_host_t *vha)
 	mcp->out_mb = MBX_1|MBX_0;
 	mcp->in_mb = MBX_2|MBX_1|MBX_0;
 	if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha))
-		mcp->in_mb |= MBX_3;
+		mcp->in_mb |= MBX_4|MBX_3;
 	mcp->tov = MBX_TOV_SECONDS;
 	mcp->flags = 0;
 	rval = qla2x00_mailbox_command(vha, mcp);
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 88bff825aa5e..cff5e4a710d1 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -3762,8 +3762,7 @@  qla2x00_unmap_iobases(struct qla_hw_data *ha)
 		if (ha->mqiobase)
 			iounmap(ha->mqiobase);
 
-		if ((IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) &&
-		    ha->msixbase)
+		if (ha->msixbase)
 			iounmap(ha->msixbase);
 	}
 }
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
index a0aeba69513d..c092a6b1ced4 100644
--- a/drivers/scsi/qla2xxx/qla_sup.c
+++ b/drivers/scsi/qla2xxx/qla_sup.c
@@ -844,7 +844,7 @@  qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
 				ha->flt_region_nvram = start;
 			break;
 		case FLT_REG_IMG_PRI_27XX:
-			if (IS_QLA27XX(ha) && !IS_QLA28XX(ha))
+			if (IS_QLA27XX(ha) || IS_QLA28XX(ha))
 				ha->flt_region_img_status_pri = start;
 			break;
 		case FLT_REG_IMG_SEC_27XX:
@@ -1356,7 +1356,7 @@  qla24xx_write_flash_data(scsi_qla_host_t *vha, __le32 *dwptr, uint32_t faddr,
 		    flash_data_addr(ha, faddr), le32_to_cpu(*dwptr));
 		if (ret) {
 			ql_dbg(ql_dbg_user, vha, 0x7006,
-			    "Failed slopw write %x (%x)\n", faddr, *dwptr);
+			    "Failed slow write %x (%x)\n", faddr, *dwptr);
 			break;
 		}
 	}
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index feb054c688a3..b109716d44fb 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -7220,8 +7220,7 @@  qlt_probe_one_stage1(struct scsi_qla_host *base_vha, struct qla_hw_data *ha)
 	if (!QLA_TGT_MODE_ENABLED())
 		return;
 
-	if  ((ql2xenablemsix == 0) || IS_QLA83XX(ha) || IS_QLA27XX(ha) ||
-	    IS_QLA28XX(ha)) {
+	if  (ha->mqenable || IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) {
 		ISP_ATIO_Q_IN(base_vha) = &ha->mqiobase->isp25mq.atio_q_in;
 		ISP_ATIO_Q_OUT(base_vha) = &ha->mqiobase->isp25mq.atio_q_out;
 	} else {