Skip to content

Commit 4b3b581

Browse files
Merge branch '6.12/scsi-fixes' into 6.13/scsi-staging
Pull in 6.12 fixes branch to resolve a merge conflict in ufs-mcq.c. Signed-off-by: Martin K. Petersen <[email protected]>
2 parents 826d94a + cb7e509 commit 4b3b581

File tree

9 files changed

+51
-51
lines changed

9 files changed

+51
-51
lines changed

drivers/scsi/fnic/fnic_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,6 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
830830
spin_lock_init(&fnic->vlans_lock);
831831
INIT_WORK(&fnic->fip_frame_work, fnic_handle_fip_frame);
832832
INIT_WORK(&fnic->event_work, fnic_handle_event);
833-
INIT_WORK(&fnic->flush_work, fnic_flush_tx);
834833
skb_queue_head_init(&fnic->fip_frame_queue);
835834
INIT_LIST_HEAD(&fnic->evlist);
836835
INIT_LIST_HEAD(&fnic->vlans);
@@ -948,6 +947,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
948947

949948
INIT_WORK(&fnic->link_work, fnic_handle_link);
950949
INIT_WORK(&fnic->frame_work, fnic_handle_frame);
950+
INIT_WORK(&fnic->flush_work, fnic_flush_tx);
951951
skb_queue_head_init(&fnic->frame_queue);
952952
skb_queue_head_init(&fnic->tx_queue);
953953

drivers/scsi/mpi3mr/mpi3mr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,8 @@ struct mpi3mr_hba_port {
542542
* @port_list: List of ports belonging to a SAS node
543543
* @num_phys: Number of phys associated with port
544544
* @marked_responding: used while refresing the sas ports
545-
* @lowest_phy: lowest phy ID of current sas port
546-
* @phy_mask: phy_mask of current sas port
545+
* @lowest_phy: lowest phy ID of current sas port, valid for controller port
546+
* @phy_mask: phy_mask of current sas port, valid for controller port
547547
* @hba_port: HBA port entry
548548
* @remote_identify: Attached device identification
549549
* @rphy: SAS transport layer rphy object

drivers/scsi/mpi3mr/mpi3mr_transport.c

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -590,12 +590,13 @@ static enum sas_linkrate mpi3mr_convert_phy_link_rate(u8 link_rate)
590590
* @mrioc: Adapter instance reference
591591
* @mr_sas_port: Internal Port object
592592
* @mr_sas_phy: Internal Phy object
593+
* @host_node: Flag to indicate this is a host_node
593594
*
594595
* Return: None.
595596
*/
596597
static void mpi3mr_delete_sas_phy(struct mpi3mr_ioc *mrioc,
597598
struct mpi3mr_sas_port *mr_sas_port,
598-
struct mpi3mr_sas_phy *mr_sas_phy)
599+
struct mpi3mr_sas_phy *mr_sas_phy, u8 host_node)
599600
{
600601
u64 sas_address = mr_sas_port->remote_identify.sas_address;
601602

@@ -605,9 +606,13 @@ static void mpi3mr_delete_sas_phy(struct mpi3mr_ioc *mrioc,
605606

606607
list_del(&mr_sas_phy->port_siblings);
607608
mr_sas_port->num_phys--;
608-
mr_sas_port->phy_mask &= ~(1 << mr_sas_phy->phy_id);
609-
if (mr_sas_port->lowest_phy == mr_sas_phy->phy_id)
610-
mr_sas_port->lowest_phy = ffs(mr_sas_port->phy_mask) - 1;
609+
610+
if (host_node) {
611+
mr_sas_port->phy_mask &= ~(1 << mr_sas_phy->phy_id);
612+
613+
if (mr_sas_port->lowest_phy == mr_sas_phy->phy_id)
614+
mr_sas_port->lowest_phy = ffs(mr_sas_port->phy_mask) - 1;
615+
}
611616
sas_port_delete_phy(mr_sas_port->port, mr_sas_phy->phy);
612617
mr_sas_phy->phy_belongs_to_port = 0;
613618
}
@@ -617,12 +622,13 @@ static void mpi3mr_delete_sas_phy(struct mpi3mr_ioc *mrioc,
617622
* @mrioc: Adapter instance reference
618623
* @mr_sas_port: Internal Port object
619624
* @mr_sas_phy: Internal Phy object
625+
* @host_node: Flag to indicate this is a host_node
620626
*
621627
* Return: None.
622628
*/
623629
static void mpi3mr_add_sas_phy(struct mpi3mr_ioc *mrioc,
624630
struct mpi3mr_sas_port *mr_sas_port,
625-
struct mpi3mr_sas_phy *mr_sas_phy)
631+
struct mpi3mr_sas_phy *mr_sas_phy, u8 host_node)
626632
{
627633
u64 sas_address = mr_sas_port->remote_identify.sas_address;
628634

@@ -632,9 +638,12 @@ static void mpi3mr_add_sas_phy(struct mpi3mr_ioc *mrioc,
632638

633639
list_add_tail(&mr_sas_phy->port_siblings, &mr_sas_port->phy_list);
634640
mr_sas_port->num_phys++;
635-
mr_sas_port->phy_mask |= (1 << mr_sas_phy->phy_id);
636-
if (mr_sas_phy->phy_id < mr_sas_port->lowest_phy)
637-
mr_sas_port->lowest_phy = ffs(mr_sas_port->phy_mask) - 1;
641+
if (host_node) {
642+
mr_sas_port->phy_mask |= (1 << mr_sas_phy->phy_id);
643+
644+
if (mr_sas_phy->phy_id < mr_sas_port->lowest_phy)
645+
mr_sas_port->lowest_phy = ffs(mr_sas_port->phy_mask) - 1;
646+
}
638647
sas_port_add_phy(mr_sas_port->port, mr_sas_phy->phy);
639648
mr_sas_phy->phy_belongs_to_port = 1;
640649
}
@@ -675,7 +684,7 @@ static void mpi3mr_add_phy_to_an_existing_port(struct mpi3mr_ioc *mrioc,
675684
if (srch_phy == mr_sas_phy)
676685
return;
677686
}
678-
mpi3mr_add_sas_phy(mrioc, mr_sas_port, mr_sas_phy);
687+
mpi3mr_add_sas_phy(mrioc, mr_sas_port, mr_sas_phy, mr_sas_node->host_node);
679688
return;
680689
}
681690
}
@@ -736,7 +745,7 @@ static void mpi3mr_del_phy_from_an_existing_port(struct mpi3mr_ioc *mrioc,
736745
mpi3mr_delete_sas_port(mrioc, mr_sas_port);
737746
else
738747
mpi3mr_delete_sas_phy(mrioc, mr_sas_port,
739-
mr_sas_phy);
748+
mr_sas_phy, mr_sas_node->host_node);
740749
return;
741750
}
742751
}
@@ -1028,7 +1037,7 @@ mpi3mr_alloc_hba_port(struct mpi3mr_ioc *mrioc, u16 port_id)
10281037
/**
10291038
* mpi3mr_get_hba_port_by_id - find hba port by id
10301039
* @mrioc: Adapter instance reference
1031-
* @port_id - Port ID to search
1040+
* @port_id: Port ID to search
10321041
*
10331042
* Return: mpi3mr_hba_port reference for the matched port
10341043
*/
@@ -1367,7 +1376,8 @@ static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc,
13671376
mpi3mr_sas_port_sanity_check(mrioc, mr_sas_node,
13681377
mr_sas_port->remote_identify.sas_address, hba_port);
13691378

1370-
if (mr_sas_node->num_phys >= sizeof(mr_sas_port->phy_mask) * 8)
1379+
if (mr_sas_node->host_node && mr_sas_node->num_phys >=
1380+
sizeof(mr_sas_port->phy_mask) * 8)
13711381
ioc_info(mrioc, "max port count %u could be too high\n",
13721382
mr_sas_node->num_phys);
13731383

@@ -1377,15 +1387,16 @@ static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc,
13771387
(mr_sas_node->phy[i].hba_port != hba_port))
13781388
continue;
13791389

1380-
if (i >= sizeof(mr_sas_port->phy_mask) * 8) {
1390+
if (mr_sas_node->host_node && (i >= sizeof(mr_sas_port->phy_mask) * 8)) {
13811391
ioc_warn(mrioc, "skipping port %u, max allowed value is %zu\n",
13821392
i, sizeof(mr_sas_port->phy_mask) * 8);
13831393
goto out_fail;
13841394
}
13851395
list_add_tail(&mr_sas_node->phy[i].port_siblings,
13861396
&mr_sas_port->phy_list);
13871397
mr_sas_port->num_phys++;
1388-
mr_sas_port->phy_mask |= (1 << i);
1398+
if (mr_sas_node->host_node)
1399+
mr_sas_port->phy_mask |= (1 << i);
13891400
}
13901401

13911402
if (!mr_sas_port->num_phys) {
@@ -1394,7 +1405,8 @@ static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc,
13941405
goto out_fail;
13951406
}
13961407

1397-
mr_sas_port->lowest_phy = ffs(mr_sas_port->phy_mask) - 1;
1408+
if (mr_sas_node->host_node)
1409+
mr_sas_port->lowest_phy = ffs(mr_sas_port->phy_mask) - 1;
13981410

13991411
if (mr_sas_port->remote_identify.device_type == SAS_END_DEVICE) {
14001412
tgtdev = mpi3mr_get_tgtdev_by_addr(mrioc,

drivers/scsi/scsi_debug.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3651,7 +3651,7 @@ static int do_device_access(struct sdeb_store_info *sip, struct scsi_cmnd *scp,
36513651
enum dma_data_direction dir;
36523652
struct scsi_data_buffer *sdb = &scp->sdb;
36533653
u8 *fsp;
3654-
int i;
3654+
int i, total = 0;
36553655

36563656
/*
36573657
* Even though reads are inherently atomic (in this driver), we expect
@@ -3688,18 +3688,16 @@ static int do_device_access(struct sdeb_store_info *sip, struct scsi_cmnd *scp,
36883688
fsp + (block * sdebug_sector_size),
36893689
sdebug_sector_size, sg_skip, do_write);
36903690
sdeb_data_sector_unlock(sip, do_write);
3691-
if (ret != sdebug_sector_size) {
3692-
ret += (i * sdebug_sector_size);
3691+
total += ret;
3692+
if (ret != sdebug_sector_size)
36933693
break;
3694-
}
36953694
sg_skip += sdebug_sector_size;
36963695
if (++block >= sdebug_store_sectors)
36973696
block = 0;
36983697
}
3699-
ret = num * sdebug_sector_size;
37003698
sdeb_data_unlock(sip, atomic);
37013699

3702-
return ret;
3700+
return total;
37033701
}
37043702

37053703
/* Returns number of bytes copied or -1 if error. */

drivers/scsi/scsi_transport_fc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,7 @@ static ssize_t fc_rport_set_marginal_state(struct device *dev,
12501250
*/
12511251
if (rport->port_state == FC_PORTSTATE_ONLINE)
12521252
rport->port_state = port_state;
1253-
else
1253+
else if (port_state != rport->port_state)
12541254
return -EINVAL;
12551255
} else if (port_state == FC_PORTSTATE_ONLINE) {
12561256
/*
@@ -1260,7 +1260,7 @@ static ssize_t fc_rport_set_marginal_state(struct device *dev,
12601260
*/
12611261
if (rport->port_state == FC_PORTSTATE_MARGINAL)
12621262
rport->port_state = port_state;
1263-
else
1263+
else if (port_state != rport->port_state)
12641264
return -EINVAL;
12651265
} else
12661266
return -EINVAL;

drivers/scsi/wd33c93.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ wd33c93_intr(struct Scsi_Host *instance)
831831
/* construct an IDENTIFY message with correct disconnect bit */
832832

833833
hostdata->outgoing_msg[0] = IDENTIFY(0, cmd->device->lun);
834-
if (scsi_pointer->phase)
834+
if (WD33C93_scsi_pointer(cmd)->phase)
835835
hostdata->outgoing_msg[0] |= 0x40;
836836

837837
if (hostdata->sync_stat[cmd->device->id] == SS_FIRST) {

drivers/target/target_core_device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name)
691691

692692
dev->queues = kcalloc(nr_cpu_ids, sizeof(*dev->queues), GFP_KERNEL);
693693
if (!dev->queues) {
694-
dev->transport->free_device(dev);
694+
hba->backend->ops->free_device(dev);
695695
return NULL;
696696
}
697697

drivers/ufs/core/ufs-mcq.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,8 +569,9 @@ int ufshcd_mcq_sq_cleanup(struct ufs_hba *hba, int task_tag)
569569
opr_sqd_base = mcq_opr_base(hba, OPR_SQD, id);
570570
writel(nexus, opr_sqd_base + REG_SQCTI);
571571

572-
/* SQRTCy.ICU = 1 */
573-
writel(SQ_ICU, opr_sqd_base + REG_SQRTC);
572+
/* Initiate Cleanup */
573+
writel(readl(opr_sqd_base + REG_SQRTC) | SQ_ICU,
574+
opr_sqd_base + REG_SQRTC);
574575

575576
/* Wait until SQRTSy.CUS = 1. Report SQRTSy.RTC. */
576577
reg = opr_sqd_base + REG_SQRTS;

drivers/ufs/core/ufshcd.c

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2923,9 +2923,8 @@ static void ufshcd_init_lrb(struct ufs_hba *hba, struct ufshcd_lrb *lrb, int i)
29232923
struct utp_transfer_req_desc *utrdlp = hba->utrdl_base_addr;
29242924
dma_addr_t cmd_desc_element_addr = hba->ucdl_dma_addr +
29252925
i * ufshcd_get_ucd_size(hba);
2926-
u16 response_offset = offsetof(struct utp_transfer_cmd_desc,
2927-
response_upiu);
2928-
u16 prdt_offset = offsetof(struct utp_transfer_cmd_desc, prd_table);
2926+
u16 response_offset = le16_to_cpu(utrdlp[i].response_upiu_offset);
2927+
u16 prdt_offset = le16_to_cpu(utrdlp[i].prd_table_offset);
29292928

29302929
lrb->utr_descriptor_ptr = utrdlp + i;
29312930
lrb->utrd_dma_addr = hba->utrdl_dma_addr +
@@ -5394,10 +5393,12 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp,
53945393
}
53955394
break;
53965395
case OCS_ABORTED:
5397-
result |= DID_ABORT << 16;
5398-
break;
53995396
case OCS_INVALID_COMMAND_STATUS:
54005397
result |= DID_REQUEUE << 16;
5398+
dev_warn(hba->dev,
5399+
"OCS %s from controller for tag %d\n",
5400+
(ocs == OCS_ABORTED ? "aborted" : "invalid"),
5401+
lrbp->task_tag);
54015402
break;
54025403
case OCS_INVALID_CMD_TABLE_ATTR:
54035404
case OCS_INVALID_PRDT_ATTR:
@@ -6444,26 +6445,12 @@ static bool ufshcd_abort_one(struct request *rq, void *priv)
64446445
struct scsi_device *sdev = cmd->device;
64456446
struct Scsi_Host *shost = sdev->host;
64466447
struct ufs_hba *hba = shost_priv(shost);
6447-
struct ufshcd_lrb *lrbp = &hba->lrb[tag];
6448-
struct ufs_hw_queue *hwq;
6449-
unsigned long flags;
64506448

64516449
*ret = ufshcd_try_to_abort_task(hba, tag);
64526450
dev_err(hba->dev, "Aborting tag %d / CDB %#02x %s\n", tag,
64536451
hba->lrb[tag].cmd ? hba->lrb[tag].cmd->cmnd[0] : -1,
64546452
*ret ? "failed" : "succeeded");
64556453

6456-
/* Release cmd in MCQ mode if abort succeeds */
6457-
if (hba->mcq_enabled && (*ret == 0)) {
6458-
hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(lrbp->cmd));
6459-
if (!hwq)
6460-
return 0;
6461-
spin_lock_irqsave(&hwq->cq_lock, flags);
6462-
if (ufshcd_cmd_inflight(lrbp->cmd))
6463-
ufshcd_release_scsi_cmd(hba, lrbp);
6464-
spin_unlock_irqrestore(&hwq->cq_lock, flags);
6465-
}
6466-
64676454
return *ret == 0;
64686455
}
64696456

@@ -8216,7 +8203,7 @@ static void ufshcd_update_rtc(struct ufs_hba *hba)
82168203

82178204
err = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_WRITE_ATTR, QUERY_ATTR_IDN_SECONDS_PASSED,
82188205
0, 0, &val);
8219-
ufshcd_rpm_put_sync(hba);
8206+
ufshcd_rpm_put(hba);
82208207

82218208
if (err)
82228209
dev_err(hba->dev, "%s: Failed to update rtc %d\n", __func__, err);
@@ -10171,7 +10158,9 @@ static void ufshcd_wl_shutdown(struct device *dev)
1017110158
shost_for_each_device(sdev, hba->host) {
1017210159
if (sdev == hba->ufs_device_wlun)
1017310160
continue;
10174-
scsi_device_quiesce(sdev);
10161+
mutex_lock(&sdev->state_mutex);
10162+
scsi_device_set_state(sdev, SDEV_OFFLINE);
10163+
mutex_unlock(&sdev->state_mutex);
1017510164
}
1017610165
__ufshcd_wl_suspend(hba, UFS_SHUTDOWN_PM);
1017710166

0 commit comments

Comments
 (0)