Skip to content

Commit 891e811

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: "The important core fix is another tweak to our discard discovery issues. The off by 512 in logical block count seems bad, but in fact the inline was only ever used in debug prints, which is why no-one noticed" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: sd: Do not attempt to configure discard unless LBPME is set scsi: MAINTAINERS: Add header files to SCSI SUBSYSTEM scsi: ufs: qcom: Add UFSHCD_QUIRK_BROKEN_LSDBS_CAP for SM8550 SoC scsi: ufs: core: Add a quirk for handling broken LSDBS field in controller capabilities register scsi: core: Fix the return value of scsi_logical_block_count() scsi: MAINTAINERS: Update HiSilicon SAS controller driver maintainer
2 parents d2bafcf + cbaac68 commit 891e811

File tree

6 files changed

+24
-4
lines changed

6 files changed

+24
-4
lines changed

MAINTAINERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10175,7 +10175,7 @@ F: Documentation/devicetree/bindings/infiniband/hisilicon-hns-roce.txt
1017510175
F: drivers/infiniband/hw/hns/
1017610176

1017710177
HISILICON SAS Controller
10178-
M: Xiang Chen <chenxiang66@hisilicon.com>
10178+
M: Yihang Li <liyihang9@huawei.com>
1017910179
S: Supported
1018010180
W: http://www.hisilicon.com
1018110181
F: Documentation/devicetree/bindings/scsi/hisilicon-sas.txt
@@ -20374,6 +20374,7 @@ F: Documentation/devicetree/bindings/scsi/
2037420374
F: drivers/scsi/
2037520375
F: drivers/ufs/
2037620376
F: include/scsi/
20377+
F: include/uapi/scsi/
2037720378

2037820379
SCSI TAPE DRIVER
2037920380
M: Kai Mäkisara <[email protected]>

drivers/scsi/sd.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3308,6 +3308,9 @@ static void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer)
33083308

33093309
static unsigned int sd_discard_mode(struct scsi_disk *sdkp)
33103310
{
3311+
if (!sdkp->lbpme)
3312+
return SD_LBP_FULL;
3313+
33113314
if (!sdkp->lbpvpd) {
33123315
/* LBP VPD page not provided */
33133316
if (sdkp->max_unmap_blocks)

drivers/ufs/core/ufshcd.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2426,7 +2426,11 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba)
24262426
* 0h: legacy single doorbell support is available
24272427
* 1h: indicate that legacy single doorbell support has been removed
24282428
*/
2429-
hba->lsdb_sup = !FIELD_GET(MASK_LSDB_SUPPORT, hba->capabilities);
2429+
if (!(hba->quirks & UFSHCD_QUIRK_BROKEN_LSDBS_CAP))
2430+
hba->lsdb_sup = !FIELD_GET(MASK_LSDB_SUPPORT, hba->capabilities);
2431+
else
2432+
hba->lsdb_sup = true;
2433+
24302434
if (!hba->mcq_sup)
24312435
return 0;
24322436

drivers/ufs/host/ufs-qcom.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,9 @@ static void ufs_qcom_advertise_quirks(struct ufs_hba *hba)
857857

858858
if (host->hw_ver.major > 0x3)
859859
hba->quirks |= UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH;
860+
861+
if (of_device_is_compatible(hba->dev->of_node, "qcom,sm8550-ufshc"))
862+
hba->quirks |= UFSHCD_QUIRK_BROKEN_LSDBS_CAP;
860863
}
861864

862865
static void ufs_qcom_set_phy_gear(struct ufs_qcom_host *host)
@@ -1847,7 +1850,8 @@ static void ufs_qcom_remove(struct platform_device *pdev)
18471850
}
18481851

18491852
static const struct of_device_id ufs_qcom_of_match[] __maybe_unused = {
1850-
{ .compatible = "qcom,ufshc"},
1853+
{ .compatible = "qcom,ufshc" },
1854+
{ .compatible = "qcom,sm8550-ufshc" },
18511855
{},
18521856
};
18531857
MODULE_DEVICE_TABLE(of, ufs_qcom_of_match);

include/scsi/scsi_cmnd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ static inline sector_t scsi_get_lba(struct scsi_cmnd *scmd)
234234

235235
static inline unsigned int scsi_logical_block_count(struct scsi_cmnd *scmd)
236236
{
237-
unsigned int shift = ilog2(scmd->device->sector_size) - SECTOR_SHIFT;
237+
unsigned int shift = ilog2(scmd->device->sector_size);
238238

239239
return blk_rq_bytes(scsi_cmd_to_rq(scmd)) >> shift;
240240
}

include/ufs/ufshcd.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,14 @@ enum ufshcd_quirks {
676676
* the standard best practice for managing keys).
677677
*/
678678
UFSHCD_QUIRK_KEYS_IN_PRDT = 1 << 24,
679+
680+
/*
681+
* This quirk indicates that the controller reports the value 1 (not
682+
* supported) in the Legacy Single DoorBell Support (LSDBS) bit of the
683+
* Controller Capabilities register although it supports the legacy
684+
* single doorbell mode.
685+
*/
686+
UFSHCD_QUIRK_BROKEN_LSDBS_CAP = 1 << 25,
679687
};
680688

681689
enum ufshcd_caps {

0 commit comments

Comments
 (0)