]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: ufs: Use DBD setting in mode sense
authorCan Guo <cang@codeaurora.org>
Thu, 5 Dec 2019 02:14:30 +0000 (02:14 +0000)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 20 Dec 2019 03:08:52 +0000 (22:08 -0500)
commit9dd1b9089e8c533275cf6f02c336e2a07e2b32f6
treed4c961c0bbe6c067be238155429f222d05203478
parentcb0bcad9cfe2b47c6c73b29f3ca9b94460c14140
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>
drivers/scsi/ufs/ufshcd.c