Skip to content

Commit

Permalink
Merge branch '5.16/scsi-fixes' into 5.17/scsi-staging
Browse files Browse the repository at this point in the history
Pull in the 5.16 fixes branch to resolve a conflict in the UFS driver
core.

Conflicts:
	drivers/scsi/ufs/ufshcd.c

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Martin K. Petersen committed Dec 17, 2021
2 parents 8c2d045 + 69002c8 commit 87f77d3
Show file tree
Hide file tree
Showing 20 changed files with 175 additions and 99 deletions.
9 changes: 2 additions & 7 deletions drivers/scsi/lpfc/lpfc_els.c
Original file line number Diff line number Diff line change
Expand Up @@ -5090,14 +5090,9 @@ lpfc_cmpl_els_logo_acc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
/* NPort Recovery mode or node is just allocated */
if (!lpfc_nlp_not_used(ndlp)) {
/* A LOGO is completing and the node is in NPR state.
* If this a fabric node that cleared its transport
* registration, release the rpi.
* Just unregister the RPI because the node is still
* required.
*/
spin_lock_irq(&ndlp->lock);
ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
if (phba->sli_rev == LPFC_SLI_REV4)
ndlp->nlp_flag |= NLP_RELEASE_RPI;
spin_unlock_irq(&ndlp->lock);
lpfc_unreg_rpi(vport, ndlp);
} else {
/* Indicate the node has already released, should
Expand Down
4 changes: 2 additions & 2 deletions drivers/scsi/mpt3sas/mpt3sas_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,8 @@ static void _base_sync_drv_fw_timestamp(struct MPT3SAS_ADAPTER *ioc)
mpi_request->IOCParameter = MPI26_SET_IOC_PARAMETER_SYNC_TIMESTAMP;
current_time = ktime_get_real();
TimeStamp = ktime_to_ms(current_time);
mpi_request->Reserved7 = cpu_to_le32(TimeStamp & 0xFFFFFFFF);
mpi_request->IOCParameterValue = cpu_to_le32(TimeStamp >> 32);
mpi_request->Reserved7 = cpu_to_le32(TimeStamp >> 32);
mpi_request->IOCParameterValue = cpu_to_le32(TimeStamp & 0xFFFFFFFF);
init_completion(&ioc->scsih_cmds.done);
ioc->put_smid_default(ioc, smid);
dinitprintk(ioc, ioc_info(ioc,
Expand Down
4 changes: 4 additions & 0 deletions drivers/scsi/mpt3sas/mpt3sas_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@

#define MPT_MAX_CALLBACKS 32

#define MPT_MAX_HBA_NUM_PHYS 32

#define INTERNAL_CMDS_COUNT 10 /* reserved cmds */
/* reserved for issuing internally framed scsi io cmds */
#define INTERNAL_SCSIIO_CMDS_COUNT 3
Expand Down Expand Up @@ -798,6 +800,7 @@ struct _sas_phy {
* @enclosure_handle: handle for this a member of an enclosure
* @device_info: bitwise defining capabilities of this sas_host/expander
* @responding: used in _scsih_expander_device_mark_responding
* @nr_phys_allocated: Allocated memory for this many count phys
* @phy: a list of phys that make up this sas_host/expander
* @sas_port_list: list of ports attached to this sas_host/expander
* @port: hba port entry containing node's port number info
Expand All @@ -813,6 +816,7 @@ struct _sas_node {
u16 enclosure_handle;
u64 enclosure_logical_id;
u8 responding;
u8 nr_phys_allocated;
struct hba_port *port;
struct _sas_phy *phy;
struct list_head sas_port_list;
Expand Down
59 changes: 57 additions & 2 deletions drivers/scsi/mpt3sas/mpt3sas_scsih.c
Original file line number Diff line number Diff line change
Expand Up @@ -3869,7 +3869,7 @@ _scsih_ublock_io_device(struct MPT3SAS_ADAPTER *ioc,

shost_for_each_device(sdev, ioc->shost) {
sas_device_priv_data = sdev->hostdata;
if (!sas_device_priv_data)
if (!sas_device_priv_data || !sas_device_priv_data->sas_target)
continue;
if (sas_device_priv_data->sas_target->sas_address
!= sas_address)
Expand Down Expand Up @@ -6406,11 +6406,26 @@ _scsih_sas_port_refresh(struct MPT3SAS_ADAPTER *ioc)
int i, j, count = 0, lcount = 0;
int ret;
u64 sas_addr;
u8 num_phys;

drsprintk(ioc, ioc_info(ioc,
"updating ports for sas_host(0x%016llx)\n",
(unsigned long long)ioc->sas_hba.sas_address));

mpt3sas_config_get_number_hba_phys(ioc, &num_phys);
if (!num_phys) {
ioc_err(ioc, "failure at %s:%d/%s()!\n",
__FILE__, __LINE__, __func__);
return;
}

if (num_phys > ioc->sas_hba.nr_phys_allocated) {
ioc_err(ioc, "failure at %s:%d/%s()!\n",
__FILE__, __LINE__, __func__);
return;
}
ioc->sas_hba.num_phys = num_phys;

port_table = kcalloc(ioc->sas_hba.num_phys,
sizeof(struct hba_port), GFP_KERNEL);
if (!port_table)
Expand Down Expand Up @@ -6611,6 +6626,30 @@ _scsih_sas_host_refresh(struct MPT3SAS_ADAPTER *ioc)
ioc->sas_hba.phy[i].hba_vphy = 1;
}

/*
* Add new HBA phys to STL if these new phys got added as part
* of HBA Firmware upgrade/downgrade operation.
*/
if (!ioc->sas_hba.phy[i].phy) {
if ((mpt3sas_config_get_phy_pg0(ioc, &mpi_reply,
&phy_pg0, i))) {
ioc_err(ioc, "failure at %s:%d/%s()!\n",
__FILE__, __LINE__, __func__);
continue;
}
ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
MPI2_IOCSTATUS_MASK;
if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
ioc_err(ioc, "failure at %s:%d/%s()!\n",
__FILE__, __LINE__, __func__);
continue;
}
ioc->sas_hba.phy[i].phy_id = i;
mpt3sas_transport_add_host_phy(ioc,
&ioc->sas_hba.phy[i], phy_pg0,
ioc->sas_hba.parent_dev);
continue;
}
ioc->sas_hba.phy[i].handle = ioc->sas_hba.handle;
attached_handle = le16_to_cpu(sas_iounit_pg0->PhyData[i].
AttachedDevHandle);
Expand All @@ -6622,6 +6661,19 @@ _scsih_sas_host_refresh(struct MPT3SAS_ADAPTER *ioc)
attached_handle, i, link_rate,
ioc->sas_hba.phy[i].port);
}
/*
* Clear the phy details if this phy got disabled as part of
* HBA Firmware upgrade/downgrade operation.
*/
for (i = ioc->sas_hba.num_phys;
i < ioc->sas_hba.nr_phys_allocated; i++) {
if (ioc->sas_hba.phy[i].phy &&
ioc->sas_hba.phy[i].phy->negotiated_linkrate >=
SAS_LINK_RATE_1_5_GBPS)
mpt3sas_transport_update_links(ioc,
ioc->sas_hba.sas_address, 0, i,
MPI2_SAS_NEG_LINK_RATE_PHY_DISABLED, NULL);
}
out:
kfree(sas_iounit_pg0);
}
Expand Down Expand Up @@ -6654,7 +6706,10 @@ _scsih_sas_host_add(struct MPT3SAS_ADAPTER *ioc)
__FILE__, __LINE__, __func__);
return;
}
ioc->sas_hba.phy = kcalloc(num_phys,

ioc->sas_hba.nr_phys_allocated = max_t(u8,
MPT_MAX_HBA_NUM_PHYS, num_phys);
ioc->sas_hba.phy = kcalloc(ioc->sas_hba.nr_phys_allocated,
sizeof(struct _sas_phy), GFP_KERNEL);
if (!ioc->sas_hba.phy) {
ioc_err(ioc, "failure at %s:%d/%s()!\n",
Expand Down
6 changes: 2 additions & 4 deletions drivers/scsi/pm8001/pm8001_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,12 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha,
if (rc) {
pm8001_dbg(pm8001_ha, FAIL,
"pm8001_setup_irq failed [ret: %d]\n", rc);
goto err_out_shost;
goto err_out;
}
/* Request Interrupt */
rc = pm8001_request_irq(pm8001_ha);
if (rc)
goto err_out_shost;
goto err_out;

count = pm8001_ha->max_q_num;
/* Queues are chosen based on the number of cores/msix availability */
Expand Down Expand Up @@ -423,8 +423,6 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha,
pm8001_tag_init(pm8001_ha);
return 0;

err_out_shost:
scsi_remove_host(pm8001_ha->shost);
err_out_nodev:
for (i = 0; i < pm8001_ha->max_memcnt; i++) {
if (pm8001_ha->memoryMap.region[i].virt_ptr != NULL) {
Expand Down
37 changes: 15 additions & 22 deletions drivers/scsi/qedi/qedi_fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,6 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi,
{
struct qedi_work_map *work, *work_tmp;
u32 proto_itt = cqe->itid;
itt_t protoitt = 0;
int found = 0;
struct qedi_cmd *qedi_cmd = NULL;
u32 iscsi_cid;
Expand Down Expand Up @@ -812,16 +811,12 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi,
return;

check_cleanup_reqs:
if (qedi_conn->cmd_cleanup_req > 0) {
QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_TID,
if (atomic_inc_return(&qedi_conn->cmd_cleanup_cmpl) ==
qedi_conn->cmd_cleanup_req) {
QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
"Freeing tid=0x%x for cid=0x%x\n",
cqe->itid, qedi_conn->iscsi_conn_id);
qedi_conn->cmd_cleanup_cmpl++;
wake_up(&qedi_conn->wait_queue);
} else {
QEDI_ERR(&qedi->dbg_ctx,
"Delayed or untracked cleanup response, itt=0x%x, tid=0x%x, cid=0x%x\n",
protoitt, cqe->itid, qedi_conn->iscsi_conn_id);
}
}

Expand Down Expand Up @@ -1163,7 +1158,7 @@ int qedi_cleanup_all_io(struct qedi_ctx *qedi, struct qedi_conn *qedi_conn,
}

qedi_conn->cmd_cleanup_req = 0;
qedi_conn->cmd_cleanup_cmpl = 0;
atomic_set(&qedi_conn->cmd_cleanup_cmpl, 0);

QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
"active_cmd_count=%d, cid=0x%x, in_recovery=%d, lun_reset=%d\n",
Expand Down Expand Up @@ -1215,16 +1210,15 @@ int qedi_cleanup_all_io(struct qedi_ctx *qedi, struct qedi_conn *qedi_conn,
qedi_conn->iscsi_conn_id);

rval = wait_event_interruptible_timeout(qedi_conn->wait_queue,
((qedi_conn->cmd_cleanup_req ==
qedi_conn->cmd_cleanup_cmpl) ||
test_bit(QEDI_IN_RECOVERY,
&qedi->flags)),
5 * HZ);
(qedi_conn->cmd_cleanup_req ==
atomic_read(&qedi_conn->cmd_cleanup_cmpl)) ||
test_bit(QEDI_IN_RECOVERY, &qedi->flags),
5 * HZ);
if (rval) {
QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
"i/o cmd_cleanup_req=%d, equal to cmd_cleanup_cmpl=%d, cid=0x%x\n",
qedi_conn->cmd_cleanup_req,
qedi_conn->cmd_cleanup_cmpl,
atomic_read(&qedi_conn->cmd_cleanup_cmpl),
qedi_conn->iscsi_conn_id);

return 0;
Expand All @@ -1233,7 +1227,7 @@ int qedi_cleanup_all_io(struct qedi_ctx *qedi, struct qedi_conn *qedi_conn,
QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
"i/o cmd_cleanup_req=%d, not equal to cmd_cleanup_cmpl=%d, cid=0x%x\n",
qedi_conn->cmd_cleanup_req,
qedi_conn->cmd_cleanup_cmpl,
atomic_read(&qedi_conn->cmd_cleanup_cmpl),
qedi_conn->iscsi_conn_id);

iscsi_host_for_each_session(qedi->shost,
Expand All @@ -1242,11 +1236,10 @@ int qedi_cleanup_all_io(struct qedi_ctx *qedi, struct qedi_conn *qedi_conn,

/* Enable IOs for all other sessions except current.*/
if (!wait_event_interruptible_timeout(qedi_conn->wait_queue,
(qedi_conn->cmd_cleanup_req ==
qedi_conn->cmd_cleanup_cmpl) ||
test_bit(QEDI_IN_RECOVERY,
&qedi->flags),
5 * HZ)) {
(qedi_conn->cmd_cleanup_req ==
atomic_read(&qedi_conn->cmd_cleanup_cmpl)) ||
test_bit(QEDI_IN_RECOVERY, &qedi->flags),
5 * HZ)) {
iscsi_host_for_each_session(qedi->shost,
qedi_mark_device_available);
return -1;
Expand All @@ -1266,7 +1259,7 @@ void qedi_clearsq(struct qedi_ctx *qedi, struct qedi_conn *qedi_conn,

qedi_ep = qedi_conn->ep;
qedi_conn->cmd_cleanup_req = 0;
qedi_conn->cmd_cleanup_cmpl = 0;
atomic_set(&qedi_conn->cmd_cleanup_cmpl, 0);

if (!qedi_ep) {
QEDI_WARN(&qedi->dbg_ctx,
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/qedi/qedi_iscsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ static int qedi_conn_bind(struct iscsi_cls_session *cls_session,
qedi_conn->iscsi_conn_id = qedi_ep->iscsi_cid;
qedi_conn->fw_cid = qedi_ep->fw_cid;
qedi_conn->cmd_cleanup_req = 0;
qedi_conn->cmd_cleanup_cmpl = 0;
atomic_set(&qedi_conn->cmd_cleanup_cmpl, 0);

if (qedi_bind_conn_to_iscsi_cid(qedi, qedi_conn)) {
rc = -EINVAL;
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/qedi/qedi_iscsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ struct qedi_conn {
spinlock_t list_lock; /* internal conn lock */
u32 active_cmd_count;
u32 cmd_cleanup_req;
u32 cmd_cleanup_cmpl;
atomic_t cmd_cleanup_cmpl;

u32 iscsi_conn_id;
int itt;
Expand Down
3 changes: 3 additions & 0 deletions drivers/scsi/qla2xxx/qla_dbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2491,6 +2491,9 @@ ql_dbg(uint level, scsi_qla_host_t *vha, uint id, const char *fmt, ...)
struct va_format vaf;
char pbuf[64];

if (!ql_mask_match(level) && !trace_ql_dbg_log_enabled())
return;

va_start(va, fmt);

vaf.fmt = fmt;
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/qla2xxx/qla_edif.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ qla_edif_app_getfcinfo(scsi_qla_host_t *vha, struct bsg_job *bsg_job)
"APP request entry - portid=%06x.\n", tdid.b24);

/* Ran out of space */
if (pcnt > app_req.num_ports)
if (pcnt >= app_req.num_ports)
break;

if (tdid.b24 != 0 && tdid.b24 != fcport->d_id.b24)
Expand Down
6 changes: 2 additions & 4 deletions drivers/scsi/qla2xxx/qla_mbx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1695,10 +1695,8 @@ qla2x00_get_adapter_id(scsi_qla_host_t *vha, uint16_t *id, uint8_t *al_pa,
mcp->in_mb |= MBX_13|MBX_12|MBX_11|MBX_10;
if (IS_FWI2_CAPABLE(vha->hw))
mcp->in_mb |= MBX_19|MBX_18|MBX_17|MBX_16;
if (IS_QLA27XX(vha->hw) || IS_QLA28XX(vha->hw)) {
mcp->in_mb |= MBX_15;
mcp->out_mb |= MBX_7|MBX_21|MBX_22|MBX_23;
}
if (IS_QLA27XX(vha->hw) || IS_QLA28XX(vha->hw))
mcp->in_mb |= MBX_15|MBX_21|MBX_22|MBX_23;

mcp->tov = MBX_TOV_SECONDS;
mcp->flags = 0;
Expand Down
Loading

0 comments on commit 87f77d3

Please sign in to comment.