Skip to content

Commit 4d82e9d

Browse files
Merge branch '5.11/scsi-fixes' into 5.12/scsi-queue
The UFS core has received a substantial rework this cycle. This in turn has caused a merge conflict in linux-next. Merge 5.11/scsi-fixes into 5.12/scsi-queue and resolve the conflict. Signed-off-by: Martin K. Petersen <[email protected]>
2 parents 18c05fa + aa2c24e commit 4d82e9d

File tree

11 files changed

+92
-44
lines changed

11 files changed

+92
-44
lines changed

Documentation/ABI/testing/sysfs-driver-ufs

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -916,21 +916,25 @@ Date: September 2014
916916
Contact: Subhash Jadavani <[email protected]>
917917
Description: This entry could be used to set or show the UFS device
918918
runtime power management level. The current driver
919-
implementation supports 6 levels with next target states:
919+
implementation supports 7 levels with next target states:
920920

921921
== ====================================================
922-
0 an UFS device will stay active, an UIC link will
922+
0 UFS device will stay active, UIC link will
923923
stay active
924-
1 an UFS device will stay active, an UIC link will
924+
1 UFS device will stay active, UIC link will
925925
hibernate
926-
2 an UFS device will moved to sleep, an UIC link will
926+
2 UFS device will be moved to sleep, UIC link will
927927
stay active
928-
3 an UFS device will moved to sleep, an UIC link will
928+
3 UFS device will be moved to sleep, UIC link will
929929
hibernate
930-
4 an UFS device will be powered off, an UIC link will
930+
4 UFS device will be powered off, UIC link will
931931
hibernate
932-
5 an UFS device will be powered off, an UIC link will
932+
5 UFS device will be powered off, UIC link will
933933
be powered off
934+
6 UFS device will be moved to deep sleep, UIC link
935+
will be powered off. Note, deep sleep might not be
936+
supported in which case this value will not be
937+
accepted
934938
== ====================================================
935939

936940
What: /sys/bus/platform/drivers/ufshcd/*/rpm_target_dev_state
@@ -954,21 +958,25 @@ Date: September 2014
954958
Contact: Subhash Jadavani <[email protected]>
955959
Description: This entry could be used to set or show the UFS device
956960
system power management level. The current driver
957-
implementation supports 6 levels with next target states:
961+
implementation supports 7 levels with next target states:
958962

959963
== ====================================================
960-
0 an UFS device will stay active, an UIC link will
964+
0 UFS device will stay active, UIC link will
961965
stay active
962-
1 an UFS device will stay active, an UIC link will
966+
1 UFS device will stay active, UIC link will
963967
hibernate
964-
2 an UFS device will moved to sleep, an UIC link will
968+
2 UFS device will be moved to sleep, UIC link will
965969
stay active
966-
3 an UFS device will moved to sleep, an UIC link will
970+
3 UFS device will be moved to sleep, UIC link will
967971
hibernate
968-
4 an UFS device will be powered off, an UIC link will
972+
4 UFS device will be powered off, UIC link will
969973
hibernate
970-
5 an UFS device will be powered off, an UIC link will
974+
5 UFS device will be powered off, UIC link will
971975
be powered off
976+
6 UFS device will be moved to deep sleep, UIC link
977+
will be powered off. Note, deep sleep might not be
978+
supported in which case this value will not be
979+
accepted
972980
== ====================================================
973981

974982
What: /sys/bus/platform/drivers/ufshcd/*/spm_target_dev_state

drivers/scsi/fnic/vnic_dev.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,8 @@ static int vnic_dev_init_devcmd2(struct vnic_dev *vdev)
444444
fetch_index = ioread32(&vdev->devcmd2->wq.ctrl->fetch_index);
445445
if (fetch_index == 0xFFFFFFFF) { /* check for hardware gone */
446446
pr_err("error in devcmd2 init");
447-
return -ENODEV;
447+
err = -ENODEV;
448+
goto err_free_wq;
448449
}
449450

450451
/*
@@ -460,7 +461,7 @@ static int vnic_dev_init_devcmd2(struct vnic_dev *vdev)
460461
err = vnic_dev_alloc_desc_ring(vdev, &vdev->devcmd2->results_ring,
461462
DEVCMD2_RING_SIZE, DEVCMD2_DESC_SIZE);
462463
if (err)
463-
goto err_free_wq;
464+
goto err_disable_wq;
464465

465466
vdev->devcmd2->result =
466467
(struct devcmd2_result *) vdev->devcmd2->results_ring.descs;
@@ -481,8 +482,9 @@ static int vnic_dev_init_devcmd2(struct vnic_dev *vdev)
481482

482483
err_free_desc_ring:
483484
vnic_dev_free_desc_ring(vdev, &vdev->devcmd2->results_ring);
484-
err_free_wq:
485+
err_disable_wq:
485486
vnic_wq_disable(&vdev->devcmd2->wq);
487+
err_free_wq:
486488
vnic_wq_free(&vdev->devcmd2->wq);
487489
err_free_devcmd2:
488490
kfree(vdev->devcmd2);

drivers/scsi/ibmvscsi/ibmvfc.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,7 +1930,7 @@ static int ibmvfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)
19301930
iu->pri_task_attr = IBMVFC_SIMPLE_TASK;
19311931
}
19321932

1933-
vfc_cmd->correlation = cpu_to_be64(evt);
1933+
vfc_cmd->correlation = cpu_to_be64((u64)evt);
19341934

19351935
if (likely(!(rc = ibmvfc_map_sg_data(cmnd, evt, vfc_cmd, vhost->dev))))
19361936
return ibmvfc_send_event(evt, vhost, 0);
@@ -2707,7 +2707,7 @@ static int ibmvfc_abort_task_set(struct scsi_device *sdev)
27072707
tmf->flags = cpu_to_be16((IBMVFC_NO_MEM_DESC | IBMVFC_TMF));
27082708
evt->sync_iu = &rsp_iu;
27092709

2710-
tmf->correlation = cpu_to_be64(evt);
2710+
tmf->correlation = cpu_to_be64((u64)evt);
27112711

27122712
init_completion(&evt->comp);
27132713
rsp_rc = ibmvfc_send_event(evt, vhost, default_timeout);
@@ -3296,8 +3296,10 @@ static int ibmvfc_slave_configure(struct scsi_device *sdev)
32963296
unsigned long flags = 0;
32973297

32983298
spin_lock_irqsave(shost->host_lock, flags);
3299-
if (sdev->type == TYPE_DISK)
3299+
if (sdev->type == TYPE_DISK) {
33003300
sdev->allow_restart = 1;
3301+
blk_queue_rq_timeout(sdev->request_queue, 120 * HZ);
3302+
}
33013303
spin_unlock_irqrestore(shost->host_lock, flags);
33023304
return 0;
33033305
}

drivers/scsi/libfc/fc_exch.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,8 +1623,13 @@ static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp)
16231623
rc = fc_exch_done_locked(ep);
16241624
WARN_ON(fc_seq_exch(sp) != ep);
16251625
spin_unlock_bh(&ep->ex_lock);
1626-
if (!rc)
1626+
if (!rc) {
16271627
fc_exch_delete(ep);
1628+
} else {
1629+
FC_EXCH_DBG(ep, "ep is completed already,"
1630+
"hence skip calling the resp\n");
1631+
goto skip_resp;
1632+
}
16281633
}
16291634

16301635
/*
@@ -1643,6 +1648,7 @@ static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp)
16431648
if (!fc_invoke_resp(ep, sp, fp))
16441649
fc_frame_free(fp);
16451650

1651+
skip_resp:
16461652
fc_exch_release(ep);
16471653
return;
16481654
rel:
@@ -1899,10 +1905,16 @@ static void fc_exch_reset(struct fc_exch *ep)
18991905

19001906
fc_exch_hold(ep);
19011907

1902-
if (!rc)
1908+
if (!rc) {
19031909
fc_exch_delete(ep);
1910+
} else {
1911+
FC_EXCH_DBG(ep, "ep is completed already,"
1912+
"hence skip calling the resp\n");
1913+
goto skip_resp;
1914+
}
19041915

19051916
fc_invoke_resp(ep, sp, ERR_PTR(-FC_EX_CLOSED));
1917+
skip_resp:
19061918
fc_seq_set_resp(sp, NULL, ep->arg);
19071919
fc_exch_release(ep);
19081920
}

drivers/scsi/megaraid/megaraid_sas_base.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8244,11 +8244,9 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
82448244
goto out;
82458245
}
82468246

8247+
/* always store 64 bits regardless of addressing */
82478248
sense_ptr = (void *)cmd->frame + ioc->sense_off;
8248-
if (instance->consistent_mask_64bit)
8249-
put_unaligned_le64(sense_handle, sense_ptr);
8250-
else
8251-
put_unaligned_le32(sense_handle, sense_ptr);
8249+
put_unaligned_le64(sense_handle, sense_ptr);
82528250
}
82538251

82548252
/*

drivers/scsi/qla2xxx/qla_os.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ MODULE_PARM_DESC(ql2xfulldump_on_mpifail,
4242
int ql2xenforce_iocb_limit = 1;
4343
module_param(ql2xenforce_iocb_limit, int, S_IRUGO | S_IWUSR);
4444
MODULE_PARM_DESC(ql2xenforce_iocb_limit,
45-
"Enforce IOCB throttling, to avoid FW congestion. (default: 0)");
45+
"Enforce IOCB throttling, to avoid FW congestion. (default: 1)");
4646

4747
/*
4848
* CT6 CTX allocation cache

drivers/scsi/scsi_transport_srp.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,14 @@ int srp_reconnect_rport(struct srp_rport *rport)
541541
res = mutex_lock_interruptible(&rport->mutex);
542542
if (res)
543543
goto out;
544-
scsi_target_block(&shost->shost_gendev);
544+
if (rport->state != SRP_RPORT_FAIL_FAST)
545+
/*
546+
* sdev state must be SDEV_TRANSPORT_OFFLINE, transition
547+
* to SDEV_BLOCK is illegal. Calling scsi_target_unblock()
548+
* later is ok though, scsi_internal_device_unblock_nowait()
549+
* treats SDEV_TRANSPORT_OFFLINE like SDEV_BLOCK.
550+
*/
551+
scsi_target_block(&shost->shost_gendev);
545552
res = rport->state != SRP_RPORT_LOST ? i->f->reconnect(rport) : -ENODEV;
546553
pr_debug("%s (state %d): transport.reconnect() returned %d\n",
547554
dev_name(&shost->shost_gendev), rport->state, res);

drivers/scsi/ufs/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ config SCSI_UFS_DWC_TC_PCI
7272
config SCSI_UFSHCD_PLATFORM
7373
tristate "Platform bus based UFS Controller support"
7474
depends on SCSI_UFSHCD
75+
depends on HAS_IOMEM
7576
help
7677
This selects the UFS host controller support. Select this if
7778
you have an UFS controller on Platform bus.

drivers/scsi/ufs/ufshcd.c

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4030,6 +4030,8 @@ int ufshcd_link_recovery(struct ufs_hba *hba)
40304030
if (ret)
40314031
dev_err(hba->dev, "%s: link recovery failed, err %d",
40324032
__func__, ret);
4033+
else
4034+
ufshcd_clear_ua_wluns(hba);
40334035

40344036
return ret;
40354037
}
@@ -5029,7 +5031,8 @@ ufshcd_transfer_rsp_status(struct ufs_hba *hba, struct ufshcd_lrb *lrbp)
50295031
break;
50305032
} /* end of switch */
50315033

5032-
if ((host_byte(result) != DID_OK) && !hba->silence_err_logs)
5034+
if ((host_byte(result) != DID_OK) &&
5035+
(host_byte(result) != DID_REQUEUE) && !hba->silence_err_logs)
50335036
ufshcd_print_trs(hba, 1 << lrbp->task_tag, true);
50345037
return result;
50355038
}
@@ -6037,6 +6040,9 @@ static void ufshcd_err_handler(struct work_struct *work)
60376040
ufshcd_scsi_unblock_requests(hba);
60386041
ufshcd_err_handling_unprepare(hba);
60396042
up(&hba->host_sem);
6043+
6044+
if (!err && needs_reset)
6045+
ufshcd_clear_ua_wluns(hba);
60406046
}
60416047

60426048
/**
@@ -6330,9 +6336,13 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba)
63306336
intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS);
63316337
}
63326338

6333-
if (enabled_intr_status && retval == IRQ_NONE) {
6334-
dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x\n",
6335-
__func__, intr_status);
6339+
if (enabled_intr_status && retval == IRQ_NONE &&
6340+
!ufshcd_eh_in_progress(hba)) {
6341+
dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x (0x%08x, 0x%08x)\n",
6342+
__func__,
6343+
intr_status,
6344+
hba->ufs_stats.last_intr_status,
6345+
enabled_intr_status);
63366346
ufshcd_dump_regs(hba, 0, UFSHCI_REG_SPACE_SIZE, "host_regs: ");
63376347
}
63386348

@@ -6376,7 +6386,10 @@ static int __ufshcd_issue_tm_cmd(struct ufs_hba *hba,
63766386
* Even though we use wait_event() which sleeps indefinitely,
63776387
* the maximum wait time is bounded by %TM_CMD_TIMEOUT.
63786388
*/
6379-
req = blk_get_request(q, REQ_OP_DRV_OUT, BLK_MQ_REQ_RESERVED);
6389+
req = blk_get_request(q, REQ_OP_DRV_OUT, 0);
6390+
if (IS_ERR(req))
6391+
return PTR_ERR(req);
6392+
63806393
req->end_io_data = &wait;
63816394
free_slot = req->tag;
63826395
WARN_ON_ONCE(free_slot < 0 || free_slot >= hba->nutmrs);
@@ -6973,14 +6986,11 @@ static int ufshcd_host_reset_and_restore(struct ufs_hba *hba)
69736986
ufshcd_set_clk_freq(hba, true);
69746987

69756988
err = ufshcd_hba_enable(hba);
6976-
if (err)
6977-
goto out;
69786989

69796990
/* Establish the link again and restore the device */
6980-
err = ufshcd_probe_hba(hba, false);
69816991
if (!err)
6982-
ufshcd_clear_ua_wluns(hba);
6983-
out:
6992+
err = ufshcd_probe_hba(hba, false);
6993+
69846994
if (err)
69856995
dev_err(hba->dev, "%s: Host init failed %d\n", __func__, err);
69866996
ufshcd_update_evt_hist(hba, UFS_EVT_HOST_RESET, (u32)err);
@@ -7747,6 +7757,8 @@ static int ufshcd_add_lus(struct ufs_hba *hba)
77477757
if (ret)
77487758
goto out;
77497759

7760+
ufshcd_clear_ua_wluns(hba);
7761+
77507762
/* Initialize devfreq after UFS device is detected */
77517763
if (ufshcd_is_clkscaling_supported(hba)) {
77527764
memcpy(&hba->clk_scaling.saved_pwr_info.info,
@@ -7948,8 +7960,6 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie)
79487960
if (ret) {
79497961
pm_runtime_put_sync(hba->dev);
79507962
ufshcd_hba_exit(hba);
7951-
} else {
7952-
ufshcd_clear_ua_wluns(hba);
79537963
}
79547964
}
79557965

@@ -8805,6 +8815,7 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
88058815

88068816
hba->clk_gating.is_suspended = false;
88078817
hba->dev_info.b_rpm_dev_flush_capable = false;
8818+
ufshcd_clear_ua_wluns(hba);
88088819
ufshcd_release(hba);
88098820
out:
88108821
if (hba->dev_info.b_rpm_dev_flush_capable) {
@@ -8915,6 +8926,8 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
89158926
cancel_delayed_work(&hba->rpm_dev_flush_recheck_work);
89168927
}
89178928

8929+
ufshcd_clear_ua_wluns(hba);
8930+
89188931
/* Schedule clock gating in case of no access to UFS device yet */
89198932
ufshcd_release(hba);
89208933

drivers/target/iscsi/iscsi_target_login.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ int iscsit_setup_np(
896896
else
897897
len = sizeof(struct sockaddr_in);
898898
/*
899-
* Set SO_REUSEADDR, and disable Nagel Algorithm with TCP_NODELAY.
899+
* Set SO_REUSEADDR, and disable Nagle Algorithm with TCP_NODELAY.
900900
*/
901901
if (np->np_network_transport == ISCSI_TCP)
902902
tcp_sock_set_nodelay(sock->sk);

0 commit comments

Comments
 (0)