Skip to content

Commit c53f467

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "Three HBA driver and one upper level driver (sg) fix. The sg change is the largest, but that results mostly from moving code to avoid the described race condition" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: ufs: core: Add ufshcd_update_evt_hist() for UFS suspend error scsi: sg: Fix occasional bogus elapsed time that exceeds timeout scsi: mpi3mr: Read missing IOCFacts flag for reply queue full overflow scsi: scsi_debug: Fix atomic write enable module param description
2 parents 04688d6 + c9f36f0 commit c53f467

5 files changed

Lines changed: 21 additions & 9 deletions

File tree

drivers/scsi/mpi3mr/mpi/mpi30_ioc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ struct mpi3_ioc_facts_data {
166166
#define MPI3_IOCFACTS_FLAGS_SIGNED_NVDATA_REQUIRED (0x00010000)
167167
#define MPI3_IOCFACTS_FLAGS_DMA_ADDRESS_WIDTH_MASK (0x0000ff00)
168168
#define MPI3_IOCFACTS_FLAGS_DMA_ADDRESS_WIDTH_SHIFT (8)
169+
#define MPI3_IOCFACTS_FLAGS_MAX_REQ_PER_REPLY_QUEUE_LIMIT (0x00000040)
169170
#define MPI3_IOCFACTS_FLAGS_INITIAL_PORT_ENABLE_MASK (0x00000030)
170171
#define MPI3_IOCFACTS_FLAGS_INITIAL_PORT_ENABLE_SHIFT (4)
171172
#define MPI3_IOCFACTS_FLAGS_INITIAL_PORT_ENABLE_NOT_STARTED (0x00000000)

drivers/scsi/mpi3mr/mpi3mr_fw.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3158,6 +3158,8 @@ static void mpi3mr_process_factsdata(struct mpi3mr_ioc *mrioc,
31583158
mrioc->facts.dma_mask = (facts_flags &
31593159
MPI3_IOCFACTS_FLAGS_DMA_ADDRESS_WIDTH_MASK) >>
31603160
MPI3_IOCFACTS_FLAGS_DMA_ADDRESS_WIDTH_SHIFT;
3161+
mrioc->facts.max_req_limit = (facts_flags &
3162+
MPI3_IOCFACTS_FLAGS_MAX_REQ_PER_REPLY_QUEUE_LIMIT);
31613163
mrioc->facts.protocol_flags = facts_data->protocol_flags;
31623164
mrioc->facts.mpi_version = le32_to_cpu(facts_data->mpi_version.word);
31633165
mrioc->facts.max_reqs = le16_to_cpu(facts_data->max_outstanding_requests);

drivers/scsi/scsi_debug.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7459,7 +7459,7 @@ MODULE_PARM_DESC(lbprz,
74597459
MODULE_PARM_DESC(lbpu, "enable LBP, support UNMAP command (def=0)");
74607460
MODULE_PARM_DESC(lbpws, "enable LBP, support WRITE SAME(16) with UNMAP bit (def=0)");
74617461
MODULE_PARM_DESC(lbpws10, "enable LBP, support WRITE SAME(10) with UNMAP bit (def=0)");
7462-
MODULE_PARM_DESC(atomic_write, "enable ATOMIC WRITE support, support WRITE ATOMIC(16) (def=0)");
7462+
MODULE_PARM_DESC(atomic_wr, "enable ATOMIC WRITE support, support WRITE ATOMIC(16) (def=0)");
74637463
MODULE_PARM_DESC(lowest_aligned, "lowest aligned lba (def=0)");
74647464
MODULE_PARM_DESC(lun_format, "LUN format: 0->peripheral (def); 1 --> flat address method");
74657465
MODULE_PARM_DESC(max_luns, "number of LUNs per target to simulate(def=1)");

drivers/scsi/sg.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,8 @@ sg_new_write(Sg_fd *sfp, struct file *file, const char __user *buf,
731731
sg_remove_request(sfp, srp);
732732
return -EFAULT;
733733
}
734+
hp->duration = jiffies_to_msecs(jiffies);
735+
734736
if (hp->interface_id != 'S') {
735737
sg_remove_request(sfp, srp);
736738
return -ENOSYS;
@@ -815,7 +817,6 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,
815817
return -ENODEV;
816818
}
817819

818-
hp->duration = jiffies_to_msecs(jiffies);
819820
if (hp->interface_id != '\0' && /* v3 (or later) interface */
820821
(SG_FLAG_Q_AT_TAIL & hp->flags))
821822
at_head = 0;
@@ -1338,9 +1339,6 @@ sg_rq_end_io(struct request *rq, blk_status_t status)
13381339
"sg_cmd_done: pack_id=%d, res=0x%x\n",
13391340
srp->header.pack_id, result));
13401341
srp->header.resid = resid;
1341-
ms = jiffies_to_msecs(jiffies);
1342-
srp->header.duration = (ms > srp->header.duration) ?
1343-
(ms - srp->header.duration) : 0;
13441342
if (0 != result) {
13451343
struct scsi_sense_hdr sshdr;
13461344

@@ -1389,6 +1387,9 @@ sg_rq_end_io(struct request *rq, blk_status_t status)
13891387
done = 0;
13901388
}
13911389
srp->done = done;
1390+
ms = jiffies_to_msecs(jiffies);
1391+
srp->header.duration = (ms > srp->header.duration) ?
1392+
(ms - srp->header.duration) : 0;
13921393
write_unlock_irqrestore(&sfp->rq_list_lock, iflags);
13931394

13941395
if (likely(done)) {
@@ -2533,6 +2534,7 @@ static void sg_proc_debug_helper(struct seq_file *s, Sg_device * sdp)
25332534
const sg_io_hdr_t *hp;
25342535
const char * cp;
25352536
unsigned int ms;
2537+
unsigned int duration;
25362538

25372539
k = 0;
25382540
list_for_each_entry(fp, &sdp->sfds, sfd_siblings) {
@@ -2570,13 +2572,17 @@ static void sg_proc_debug_helper(struct seq_file *s, Sg_device * sdp)
25702572
seq_printf(s, " id=%d blen=%d",
25712573
srp->header.pack_id, blen);
25722574
if (srp->done)
2573-
seq_printf(s, " dur=%d", hp->duration);
2575+
seq_printf(s, " dur=%u", hp->duration);
25742576
else {
25752577
ms = jiffies_to_msecs(jiffies);
2576-
seq_printf(s, " t_o/elap=%d/%d",
2578+
duration = READ_ONCE(hp->duration);
2579+
if (duration)
2580+
duration = (ms > duration ?
2581+
ms - duration : 0);
2582+
seq_printf(s, " t_o/elap=%u/%u",
25772583
(new_interface ? hp->timeout :
25782584
jiffies_to_msecs(fp->timeout)),
2579-
(ms > hp->duration ? ms - hp->duration : 0));
2585+
duration);
25802586
}
25812587
seq_printf(s, "ms sgat=%d op=0x%02x\n", usg,
25822588
(int) srp->data.cmd_opcode);

drivers/ufs/core/ufshcd.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10359,7 +10359,7 @@ static int ufshcd_suspend(struct ufs_hba *hba)
1035910359
ret = ufshcd_setup_clocks(hba, false);
1036010360
if (ret) {
1036110361
ufshcd_enable_irq(hba);
10362-
return ret;
10362+
goto out;
1036310363
}
1036410364
if (ufshcd_is_clkgating_allowed(hba)) {
1036510365
hba->clk_gating.state = CLKS_OFF;
@@ -10371,6 +10371,9 @@ static int ufshcd_suspend(struct ufs_hba *hba)
1037110371
/* Put the host controller in low power mode if possible */
1037210372
ufshcd_hba_vreg_set_lpm(hba);
1037310373
ufshcd_pm_qos_update(hba, false);
10374+
out:
10375+
if (ret)
10376+
ufshcd_update_evt_hist(hba, UFS_EVT_SUSPEND_ERR, (u32)ret);
1037410377
return ret;
1037510378
}
1037610379

0 commit comments

Comments
 (0)