Skip to content

Commit ff4a9f4

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 small fixes, one in drivers. The core changes are to the internal representation of flags in scsi_devices which removes space wasting bools in favour of single bit flags and to add a flag to force a runtime resume which is used by ATA devices" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: sd: Fix system start for ATA devices scsi: Change SCSI device boolean fields to single bit flags scsi: ufs: core: Clear cmd if abort succeeds in MCQ mode
2 parents c1c09da + b09d7f8 commit ff4a9f4

File tree

5 files changed

+40
-9
lines changed

5 files changed

+40
-9
lines changed

drivers/ata/libata-scsi.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,9 +1055,14 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev)
10551055
* Ask the sd driver to issue START STOP UNIT on runtime suspend
10561056
* and resume and shutdown only. For system level suspend/resume,
10571057
* devices power state is handled directly by libata EH.
1058+
* Given that disks are always spun up on system resume, also
1059+
* make sure that the sd driver forces runtime suspended disks
1060+
* to be resumed to correctly reflect the power state of the
1061+
* device.
10581062
*/
1059-
sdev->manage_runtime_start_stop = true;
1060-
sdev->manage_shutdown = true;
1063+
sdev->manage_runtime_start_stop = 1;
1064+
sdev->manage_shutdown = 1;
1065+
sdev->force_runtime_start_on_system_start = 1;
10611066
}
10621067

10631068
/*

drivers/firewire/sbp2.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,9 +1519,9 @@ static int sbp2_scsi_slave_configure(struct scsi_device *sdev)
15191519
sdev->use_10_for_rw = 1;
15201520

15211521
if (sbp2_param_exclusive_login) {
1522-
sdev->manage_system_start_stop = true;
1523-
sdev->manage_runtime_start_stop = true;
1524-
sdev->manage_shutdown = true;
1522+
sdev->manage_system_start_stop = 1;
1523+
sdev->manage_runtime_start_stop = 1;
1524+
sdev->manage_shutdown = 1;
15251525
}
15261526

15271527
if (sdev->type == TYPE_ROM)

drivers/scsi/sd.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3949,8 +3949,15 @@ static int sd_resume(struct device *dev, bool runtime)
39493949

39503950
static int sd_resume_system(struct device *dev)
39513951
{
3952-
if (pm_runtime_suspended(dev))
3952+
if (pm_runtime_suspended(dev)) {
3953+
struct scsi_disk *sdkp = dev_get_drvdata(dev);
3954+
struct scsi_device *sdp = sdkp ? sdkp->device : NULL;
3955+
3956+
if (sdp && sdp->force_runtime_start_on_system_start)
3957+
pm_request_resume(dev);
3958+
39533959
return 0;
3960+
}
39543961

39553962
return sd_resume(dev, false);
39563963
}

drivers/ufs/core/ufshcd.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6444,11 +6444,24 @@ static bool ufshcd_abort_one(struct request *rq, void *priv)
64446444
struct scsi_device *sdev = cmd->device;
64456445
struct Scsi_Host *shost = sdev->host;
64466446
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;
64476450

64486451
*ret = ufshcd_try_to_abort_task(hba, tag);
64496452
dev_err(hba->dev, "Aborting tag %d / CDB %#02x %s\n", tag,
64506453
hba->lrb[tag].cmd ? hba->lrb[tag].cmd->cmnd[0] : -1,
64516454
*ret ? "failed" : "succeeded");
6455+
6456+
/* Release cmd in MCQ mode if abort succeeds */
6457+
if (is_mcq_enabled(hba) && (*ret == 0)) {
6458+
hwq = ufshcd_mcq_req_to_hwq(hba, scsi_cmd_to_rq(lrbp->cmd));
6459+
spin_lock_irqsave(&hwq->cq_lock, flags);
6460+
if (ufshcd_cmd_inflight(lrbp->cmd))
6461+
ufshcd_release_scsi_cmd(hba, lrbp);
6462+
spin_unlock_irqrestore(&hwq->cq_lock, flags);
6463+
}
6464+
64526465
return *ret == 0;
64536466
}
64546467

include/scsi/scsi_device.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,19 +167,25 @@ struct scsi_device {
167167
* power state for system suspend/resume (suspend to RAM and
168168
* hibernation) operations.
169169
*/
170-
bool manage_system_start_stop;
170+
unsigned manage_system_start_stop:1;
171171

172172
/*
173173
* If true, let the high-level device driver (sd) manage the device
174174
* power state for runtime device suspand and resume operations.
175175
*/
176-
bool manage_runtime_start_stop;
176+
unsigned manage_runtime_start_stop:1;
177177

178178
/*
179179
* If true, let the high-level device driver (sd) manage the device
180180
* power state for system shutdown (power off) operations.
181181
*/
182-
bool manage_shutdown;
182+
unsigned manage_shutdown:1;
183+
184+
/*
185+
* If set and if the device is runtime suspended, ask the high-level
186+
* device driver (sd) to force a runtime resume of the device.
187+
*/
188+
unsigned force_runtime_start_on_system_start:1;
183189

184190
unsigned removable:1;
185191
unsigned changed:1; /* Data invalid due to media change */

0 commit comments

Comments
 (0)