diff options
author | Can Guo <cang@codeaurora.org> | 2019-12-05 03:14:30 +0100 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2019-12-20 04:08:52 +0100 |
commit | a3a763917216992b8b1b2cc1b4fadb27c660fe70 (patch) | |
tree | d4c961c0bbe6c067be238155429f222d05203478 /drivers/scsi | |
parent | scsi: core: Adjust DBD setting in MODE SENSE for caching mode page per LLD (diff) | |
download | linux-a3a763917216992b8b1b2cc1b4fadb27c660fe70.tar.xz linux-a3a763917216992b8b1b2cc1b4fadb27c660fe70.zip |
scsi: ufs: Use DBD setting in mode sense
UFS standard requires DBD field to be set to 1 in MODE SENSE(10).
Some card vendors are more strict and check the DBD field, hence respond
with CHECK_CONDITION (Sense key set to ILLEGAL_REQUEST and ASC set to
INVALID FIELD IN CDB). When host sends MODE SENSE for page caching, as a
result of the CHECK_CONDITION response, host assumes that the device
doesn't support the cache feature and doesn't send SYNCHRONIZE_CACHE
commands to flush the device cache. This can result in data corruption in
case of sudden power down when there is data stored in the device cache.
This patch fixes the DBD field setting as required in UFS standard.
Link: https://lore.kernel.org/r/0101016ed3d657e4-32a6dd52-1505-4312-97ff-2bd3bee59eb7-000000@us-west-2.amazonses.com
Reviewed-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/ufs/ufshcd.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index bd2ce2d4823f..0aa42b68dab6 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4545,6 +4545,9 @@ static int ufshcd_slave_alloc(struct scsi_device *sdev) /* Mode sense(6) is not supported by UFS, so use Mode sense(10) */ sdev->use_10_for_ms = 1; + /* DBD field should be set to 1 in mode sense(10) */ + sdev->set_dbd_for_ms = 1; + /* allow SCSI layer to restart the device in case of errors */ sdev->allow_restart = 1; |