ANDROID: scsi: ufs: UFS HPB feature not working

UFS HPB feature not working/disabled for some UFS storage device in Android12-5.10
There was below error trigger in the UFS init flow at kernel bootup time.

[name:ufshcd_core&]ufshpb_get_dev_info: HPB 103 version is not supported.
[name:ufshcd_core&]ufshcd_query_flag: Sending flag query for idn 18 failed, err = 253
[name:ufshcd_core&]ufshcd_query_flag: Sending flag query for idn 18 failed, err = 253
[name:ufshcd_core&]ufshcd_query_flag: Sending flag query for idn 18 failed, err = 253
[name:ufshcd_core&]ufshcd_query_flag_retry: query attribute, opcode 5, idn 18, failed with error 253 after 3 retires

It observed that the 0x103 version have some extension of legacy UFS HPB.
We have to consider all the extension of legacy
(after 0x100 in the code for legacy support).
Similar for Advanced version(0x200) also.
Added mask for the major version so that it can be picked for legacy
or advance HPB version accordingly and support HPB thereafter.

UFS HPB feature has been integrated in Linux stable branch from linux-5.15. So it is not there in Linux-5.10.y stable branch and recently from Linux-6.6, this HPB feature removed from the mainline.
i.e. submitted this bug here in Android12-5.10 as this is Android specific.

Bug: 320628430
Change-Id: I171255de991f19d5d662447939f35e6595d1c4e2
Fixes: 756ecd96f6 ("scsi: ufs: Add HPB 2.0 support")
Signed-off-by: Sanjeev Yadav <sanjeev.y@mediatek.com>
This commit is contained in:
Sanjeev Yadav 2024-01-11 15:25:04 +05:30 committed by Todd Kjos
parent 75c057fe65
commit 789c68e980
2 changed files with 2 additions and 1 deletions

View File

@ -2873,7 +2873,7 @@ void ufshpb_get_dev_info(struct ufs_hba *hba, u8 *desc_buf)
hpb_dev_info->control_mode = desc_buf[DEVICE_DESC_PARAM_HPB_CONTROL];
version = get_unaligned_be16(desc_buf + DEVICE_DESC_PARAM_HPB_VER);
version = get_unaligned_be16(desc_buf + DEVICE_DESC_PARAM_HPB_VER) & HPB_MAJOR_VERSION_MASK;
if ((version != HPB_SUPPORT_VERSION) &&
(version != HPB_SUPPORT_LEGACY_VERSION)) {
dev_err(hba->dev, "%s: HPB %x version is not supported.\n",

View File

@ -53,6 +53,7 @@
#define HPB_SUPPORT_VERSION 0x200
#define HPB_SUPPORT_LEGACY_VERSION 0x100
#define HPB_MAJOR_VERSION_MASK 0xFF00
enum UFSHPB_MODE {
HPB_HOST_CONTROL,