Message ID | 1572670898-750-2-git-send-email-cang@codeaurora.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | UFS driver general fixes bundle 1 | expand |
> > Signed-off-by: Can Guo <cang@codeaurora.org> Reviewed-by: Bean Huo <beanhuo@micron.com>
Can, > Host sends MODE_SENSE_10 with caching mode page, to check if the > device supports the cache feature. UFS JEDEC standards require DBD > field to be set to 1. UFS requires DBD for all MODE SENSE(10) invocations, not just for accessing the caching mode page. I think the flag name needs to reflect this. Also, I do not particularly like this being a scsi_host flag. All the other flags we have in this department are per scsi_device. My recommendation would be to add a set_dbd_for_ms flag to struct scsi_device and then do: sdev->set_dbd_for_ms = 1; in ufshcd_slave_alloc() mirroring the existing: sdev->use_10_for_ms = 1; This makes the MODE SENSE tweakery consistent. Thanks!
On 2019-11-13 11:03, Martin K. Petersen wrote: > Can, > >> Host sends MODE_SENSE_10 with caching mode page, to check if the >> device supports the cache feature. UFS JEDEC standards require DBD >> field to be set to 1. > > UFS requires DBD for all MODE SENSE(10) invocations, not just for > accessing the caching mode page. I think the flag name needs to reflect > this. > > Also, I do not particularly like this being a scsi_host flag. All the > other flags we have in this department are per scsi_device. > > My recommendation would be to add a set_dbd_for_ms flag to struct > scsi_device and then do: > > sdev->set_dbd_for_ms = 1; > > in ufshcd_slave_alloc() mirroring the existing: > > sdev->use_10_for_ms = 1; > > This makes the MODE SENSE tweakery consistent. > > Thanks! Hi Martin, Thank you, good idea. I will make the change in your way. Best regards, Can Guo.
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index aab4ed8..a9cca2f 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2660,7 +2660,7 @@ static int sd_try_rc16_first(struct scsi_device *sdp) dbd = 8; } else { modepage = 8; - dbd = 0; + dbd = sdp->host->set_dbd_for_caching ? 8 : 0; } /* cautiously ask */ diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 2c3f0c5..3900987 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -650,6 +650,12 @@ struct Scsi_Host { unsigned no_scsi2_lun_in_cdb:1; /* + * Set "DBD" field in mode_sense caching mode page in case it is + * mandatory by LLD standard. + */ + unsigned set_dbd_for_caching:1; + + /* * Optional work queue to be utilized by the transport */ char work_q_name[20];
Host sends MODE_SENSE_10 with caching mode page, to check if the device supports the cache feature. UFS JEDEC standards require DBD field to be set to 1. This patch allows LLD to define the setting of DBD if required. Signed-off-by: Can Guo <cang@codeaurora.org> --- drivers/scsi/sd.c | 2 +- include/scsi/scsi_host.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-)