Skip to content

Commit 2a0508d

Browse files
Merge branch '6.7/scsi-staging' into 6.7/scsi-fixes
Pull in queued fixes for 6.7 Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 parents b85ea95 + e439e4a commit 2a0508d

File tree

5 files changed

+40
-41
lines changed

5 files changed

+40
-41
lines changed

Documentation/devicetree/bindings/ufs/qcom,ufs.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ properties:
3636
- qcom,sm8350-ufshc
3737
- qcom,sm8450-ufshc
3838
- qcom,sm8550-ufshc
39+
- qcom,sm8650-ufshc
3940
- const: qcom,ufshc
4041
- const: jedec,ufs-2.0
4142

@@ -122,6 +123,7 @@ allOf:
122123
- qcom,sm8350-ufshc
123124
- qcom,sm8450-ufshc
124125
- qcom,sm8550-ufshc
126+
- qcom,sm8650-ufshc
125127
then:
126128
properties:
127129
clocks:

drivers/scsi/qla2xxx/qla_os.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1837,8 +1837,16 @@ static void qla2x00_abort_srb(struct qla_qpair *qp, srb_t *sp, const int res,
18371837
}
18381838

18391839
spin_lock_irqsave(qp->qp_lock_ptr, *flags);
1840-
if (ret_cmd && blk_mq_request_started(scsi_cmd_to_rq(cmd)))
1841-
sp->done(sp, res);
1840+
switch (sp->type) {
1841+
case SRB_SCSI_CMD:
1842+
if (ret_cmd && blk_mq_request_started(scsi_cmd_to_rq(cmd)))
1843+
sp->done(sp, res);
1844+
break;
1845+
default:
1846+
if (ret_cmd)
1847+
sp->done(sp, res);
1848+
break;
1849+
}
18421850
} else {
18431851
sp->done(sp, res);
18441852
}

drivers/scsi/scsi_debug.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ static ssize_t sdebug_error_write(struct file *file, const char __user *ubuf,
10191019
struct sdebug_err_inject *inject;
10201020
struct scsi_device *sdev = (struct scsi_device *)file->f_inode->i_private;
10211021

1022-
buf = kmalloc(count, GFP_KERNEL);
1022+
buf = kzalloc(count + 1, GFP_KERNEL);
10231023
if (!buf)
10241024
return -ENOMEM;
10251025

@@ -1132,23 +1132,16 @@ static const struct file_operations sdebug_target_reset_fail_fops = {
11321132
static int sdebug_target_alloc(struct scsi_target *starget)
11331133
{
11341134
struct sdebug_target_info *targetip;
1135-
struct dentry *dentry;
11361135

11371136
targetip = kzalloc(sizeof(struct sdebug_target_info), GFP_KERNEL);
11381137
if (!targetip)
11391138
return -ENOMEM;
11401139

11411140
targetip->debugfs_entry = debugfs_create_dir(dev_name(&starget->dev),
11421141
sdebug_debugfs_root);
1143-
if (IS_ERR_OR_NULL(targetip->debugfs_entry))
1144-
pr_info("%s: failed to create debugfs directory for target %s\n",
1145-
__func__, dev_name(&starget->dev));
11461142

11471143
debugfs_create_file("fail_reset", 0600, targetip->debugfs_entry, starget,
11481144
&sdebug_target_reset_fail_fops);
1149-
if (IS_ERR_OR_NULL(dentry))
1150-
pr_info("%s: failed to create fail_reset file for target %s\n",
1151-
__func__, dev_name(&starget->dev));
11521145

11531146
starget->hostdata = targetip;
11541147

drivers/scsi/sd.c

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,24 +1643,21 @@ static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing)
16431643
return disk_changed ? DISK_EVENT_MEDIA_CHANGE : 0;
16441644
}
16451645

1646-
static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr)
1646+
static int sd_sync_cache(struct scsi_disk *sdkp)
16471647
{
16481648
int retries, res;
16491649
struct scsi_device *sdp = sdkp->device;
16501650
const int timeout = sdp->request_queue->rq_timeout
16511651
* SD_FLUSH_TIMEOUT_MULTIPLIER;
1652-
struct scsi_sense_hdr my_sshdr;
1652+
struct scsi_sense_hdr sshdr;
16531653
const struct scsi_exec_args exec_args = {
16541654
.req_flags = BLK_MQ_REQ_PM,
1655-
/* caller might not be interested in sense, but we need it */
1656-
.sshdr = sshdr ? : &my_sshdr,
1655+
.sshdr = &sshdr,
16571656
};
16581657

16591658
if (!scsi_device_online(sdp))
16601659
return -ENODEV;
16611660

1662-
sshdr = exec_args.sshdr;
1663-
16641661
for (retries = 3; retries > 0; --retries) {
16651662
unsigned char cmd[16] = { 0 };
16661663

@@ -1685,15 +1682,23 @@ static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr)
16851682
return res;
16861683

16871684
if (scsi_status_is_check_condition(res) &&
1688-
scsi_sense_valid(sshdr)) {
1689-
sd_print_sense_hdr(sdkp, sshdr);
1685+
scsi_sense_valid(&sshdr)) {
1686+
sd_print_sense_hdr(sdkp, &sshdr);
16901687

16911688
/* we need to evaluate the error return */
1692-
if (sshdr->asc == 0x3a || /* medium not present */
1693-
sshdr->asc == 0x20 || /* invalid command */
1694-
(sshdr->asc == 0x74 && sshdr->ascq == 0x71)) /* drive is password locked */
1689+
if (sshdr.asc == 0x3a || /* medium not present */
1690+
sshdr.asc == 0x20 || /* invalid command */
1691+
(sshdr.asc == 0x74 && sshdr.ascq == 0x71)) /* drive is password locked */
16951692
/* this is no error here */
16961693
return 0;
1694+
/*
1695+
* This drive doesn't support sync and there's not much
1696+
* we can do because this is called during shutdown
1697+
* or suspend so just return success so those operations
1698+
* can proceed.
1699+
*/
1700+
if (sshdr.sense_key == ILLEGAL_REQUEST)
1701+
return 0;
16971702
}
16981703

16991704
switch (host_byte(res)) {
@@ -3853,7 +3858,7 @@ static void sd_shutdown(struct device *dev)
38533858

38543859
if (sdkp->WCE && sdkp->media_present) {
38553860
sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n");
3856-
sd_sync_cache(sdkp, NULL);
3861+
sd_sync_cache(sdkp);
38573862
}
38583863

38593864
if ((system_state != SYSTEM_RESTART &&
@@ -3874,7 +3879,6 @@ static inline bool sd_do_start_stop(struct scsi_device *sdev, bool runtime)
38743879
static int sd_suspend_common(struct device *dev, bool runtime)
38753880
{
38763881
struct scsi_disk *sdkp = dev_get_drvdata(dev);
3877-
struct scsi_sense_hdr sshdr;
38783882
int ret = 0;
38793883

38803884
if (!sdkp) /* E.g.: runtime suspend following sd_remove() */
@@ -3883,24 +3887,13 @@ static int sd_suspend_common(struct device *dev, bool runtime)
38833887
if (sdkp->WCE && sdkp->media_present) {
38843888
if (!sdkp->device->silence_suspend)
38853889
sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n");
3886-
ret = sd_sync_cache(sdkp, &sshdr);
3887-
3888-
if (ret) {
3889-
/* ignore OFFLINE device */
3890-
if (ret == -ENODEV)
3891-
return 0;
3892-
3893-
if (!scsi_sense_valid(&sshdr) ||
3894-
sshdr.sense_key != ILLEGAL_REQUEST)
3895-
return ret;
3890+
ret = sd_sync_cache(sdkp);
3891+
/* ignore OFFLINE device */
3892+
if (ret == -ENODEV)
3893+
return 0;
38963894

3897-
/*
3898-
* sshdr.sense_key == ILLEGAL_REQUEST means this drive
3899-
* doesn't support sync. There's not much to do and
3900-
* suspend shouldn't fail.
3901-
*/
3902-
ret = 0;
3903-
}
3895+
if (ret)
3896+
return ret;
39043897
}
39053898

39063899
if (sd_do_start_stop(sdkp->device, runtime)) {

drivers/ufs/core/ufs-mcq.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ int ufshcd_mcq_init(struct ufs_hba *hba)
436436

437437
for (i = 0; i < hba->nr_hw_queues; i++) {
438438
hwq = &hba->uhq[i];
439-
hwq->max_entries = hba->nutrs;
439+
hwq->max_entries = hba->nutrs + 1;
440440
spin_lock_init(&hwq->sq_lock);
441441
spin_lock_init(&hwq->cq_lock);
442442
mutex_init(&hwq->sq_mutex);
@@ -630,6 +630,7 @@ int ufshcd_mcq_abort(struct scsi_cmnd *cmd)
630630
int tag = scsi_cmd_to_rq(cmd)->tag;
631631
struct ufshcd_lrb *lrbp = &hba->lrb[tag];
632632
struct ufs_hw_queue *hwq;
633+
unsigned long flags;
633634
int err = FAILED;
634635

635636
if (!ufshcd_cmd_inflight(lrbp->cmd)) {
@@ -670,8 +671,10 @@ int ufshcd_mcq_abort(struct scsi_cmnd *cmd)
670671
}
671672

672673
err = SUCCESS;
674+
spin_lock_irqsave(&hwq->cq_lock, flags);
673675
if (ufshcd_cmd_inflight(lrbp->cmd))
674676
ufshcd_release_scsi_cmd(hba, lrbp);
677+
spin_unlock_irqrestore(&hwq->cq_lock, flags);
675678

676679
out:
677680
return err;

0 commit comments

Comments
 (0)