[PATCH v2] scsi:ufs:add quirk to keep write booster on

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: tanghuan <tanghuan@xxxxxxxx>

Some samsung devices have performance issue when the
remaining space is low, and the write booster needs
to be always on.

Therefore, add quirk option UFS_DEVICE_QUIRK_KEEP_ON_WB

Reported-by: kernel test robot <lkp@xxxxxxxxx>
Signed-off-by: tanghuan <tanghuan@xxxxxxxx>
---
 drivers/scsi/ufs/ufs_quirks.h |  6 ++++++
 drivers/scsi/ufs/ufshcd.c     | 13 +++++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/ufs/ufs_quirks.h b/drivers/scsi/ufs/ufs_quirks.h
index 35ec9ea79869..532719eb4f50 100644
--- a/drivers/scsi/ufs/ufs_quirks.h
+++ b/drivers/scsi/ufs/ufs_quirks.h
@@ -122,4 +122,10 @@ struct ufs_dev_fix {
  */
 #define UFS_DEVICE_QUIRK_SWAP_L2P_ENTRY_FOR_HPB_READ (1 << 12)
 
+/*
+ * Some SAMSUNG UFS devices require keep on Write Booster for prevent
+ * performance drop. Enable this quirk to keep on Write Booster
+ */
+#define UFS_DEVICE_QUIRK_KEEP_ON_WB        (1 << 13)
+
 #endif /* UFS_QUIRKS_H_ */
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index dac8fbf221f7..b0b9c4e6b185 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1250,10 +1250,15 @@ static int ufshcd_devfreq_scale(struct ufs_hba *hba, bool scale_up)
 		}
 	}
 
-	/* Enable Write Booster if we have scaled up else disable it */
-	downgrade_write(&hba->clk_scaling_lock);
-	is_writelock = false;
-	ufshcd_wb_toggle(hba, scale_up);
+	/*
+	 * if no need UFS_DEVICE_QUIRK_KEEP_ON_WB, Enable Write
+	 * Booster if we have scaled up else disable it
+	 */
+	if (!(hba->dev_quirks & UFS_DEVICE_QUIRK_KEEP_ON_WB)) {
+		downgrade_write(&hba->clk_scaling_lock);
+		is_writelock = false;
+		ufshcd_wb_toggle(hba, scale_up);
+	}
 
 out_unprepare:
 	ufshcd_clock_scaling_unprepare(hba, is_writelock);
-- 
2.32.0




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux