Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: ufs: qcom: Add sanity checks for gear/lane values during ICC scaling

Let's add the checks to warn the user if the ICC scaling is not supported
for the gear/lane values and also fallback to the max value if that's the
case.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20240403-ufs-icc-fix-v2-2-958412a5eb45@linaro.org
Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Manivannan Sadhasivam and committed by
Martin K. Petersen
33507b39 83ef2ab4

+10
+10
drivers/ufs/host/ufs-qcom.c
··· 687 687 int gear = max_t(u32, p->gear_rx, p->gear_tx); 688 688 int lane = max_t(u32, p->lane_rx, p->lane_tx); 689 689 690 + if (WARN_ONCE(gear > QCOM_UFS_MAX_GEAR, 691 + "ICC scaling for UFS Gear (%d) not supported. Using Gear (%d) bandwidth\n", 692 + gear, QCOM_UFS_MAX_GEAR)) 693 + gear = QCOM_UFS_MAX_GEAR; 694 + 695 + if (WARN_ONCE(lane > QCOM_UFS_MAX_LANE, 696 + "ICC scaling for UFS Lane (%d) not supported. Using Lane (%d) bandwidth\n", 697 + lane, QCOM_UFS_MAX_LANE)) 698 + lane = QCOM_UFS_MAX_LANE; 699 + 690 700 if (ufshcd_is_hs_mode(p)) { 691 701 if (p->hs_rate == PA_HS_MODE_B) 692 702 return ufs_qcom_bw_table[MODE_HS_RB][gear][lane];