Re: [PATCH v1 1/3] scsi: ufs: add write booster feature support

2020-06-24 Thread Stanley Chu
Hi Steev,

On Wed, 2020-06-24 at 11:15 -0500, Steev Klimaszewski wrote:
> On 6/23/20 8:53 PM, Stanley Chu wrote:
> > Hi Steev,
> >
> > Please help try below simple patch to see if above WriteBooster messages
> > can be eliminated.
> >
> >
> > ---
> >  drivers/scsi/ufs/ufshcd.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> > index f173ad1bd79f..089c0785f0b3 100644
> > --- a/drivers/scsi/ufs/ufshcd.c
> > +++ b/drivers/scsi/ufs/ufshcd.c
> > @@ -6985,6 +6985,8 @@ static int ufs_get_device_desc(struct ufs_hba
> > *hba)
> > dev_info->wspecversion == 0x220 ||
> > (hba->dev_quirks & UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES))
> > ufshcd_wb_probe(hba, desc_buf);
> > +   else
> > +   hba->caps &= ~UFSHCD_CAP_WB_EN;
> >  
> > /*
> >  * ufshcd_read_string_desc returns size of the string
> 
> Hi Stanley,
> 
> That worked.
> 
> 
>  1.
> [0.704775] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
> Unable to find vdd-hba-supply regulator, assuming enabled
>  2.
> [0.704781] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
> Unable to find vccq-supply regulator, assuming enabled
>  3.
> [0.704783] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
> Unable to find vccq2-supply regulator, assuming enabled
>  4.
> [0.705618] ufshcd-qcom 1d84000.ufshc: Found QC Inline Crypto
> Engine (ICE) v3.1.75
>  5.
> [0.707496] scsi host0: ufshcd
>  6.
> [0.720415] ALSA device list:
>  7.
> [0.720422]   No soundcards found.
>  8.
> [0.734245] ufshcd-qcom 1d84000.ufshc: ufshcd_print_pwr_info:[RX,
> TX]: gear=[1, 1], lane[1, 1], pwr[SLOWAUTO_MODE, SLOWAUTO_MODE],
> rate = 0
>  9.
> [0.845159] ufshcd-qcom 1d84000.ufshc: ufshcd_print_pwr_info:[RX,
> TX]: gear=[3, 3], lane[2, 2], pwr[FAST MODE, FAST MODE], rate = 2
> 10.
> [0.846399] ufshcd-qcom 1d84000.ufshc:
> ufshcd_find_max_sup_active_icc_level: Regulator capability was not
> set, actvIccLevel=0
> 11.
> [0.849258] scsi 0:0:0:49488: Well-known LUNSAMSUNG
>  KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6
> 12.
> [0.853372] scsi 0:0:0:49476: Well-known LUNSAMSUNG
>  KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6
> 13.
> [0.855135] scsi 0:0:0:49456: Well-known LUNSAMSUNG
>  KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6
> 14.
> [0.857050] scsi 0:0:0:0: Direct-Access SAMSUNG
>  KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6
> 15.
> [0.858297] sd 0:0:0:0: Power-on or device reset occurred
> 16.
> [0.859985] scsi 0:0:0:1: Direct-Access SAMSUNG
>  KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6
> 17.
> [0.860702] sd 0:0:0:0: [sda] 29765632 4096-byte logical blocks:
> (122 GB/114 GiB)
> 
> (full dmesg output at https://pastebin.com/Pvfqe42P )
> 
> I guess you can throw my Tested-by on there.
> 

Thanks so much for the test!
I have re-sent the patch with your "Tested-By" tag : )

Thanks a lot,
Stanley Chu




Re: [PATCH v1 1/3] scsi: ufs: add write booster feature support

2020-06-24 Thread Steev Klimaszewski


On 6/23/20 8:53 PM, Stanley Chu wrote:
> Hi Steev,
>
> Please help try below simple patch to see if above WriteBooster messages
> can be eliminated.
>
>
> ---
>  drivers/scsi/ufs/ufshcd.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index f173ad1bd79f..089c0785f0b3 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -6985,6 +6985,8 @@ static int ufs_get_device_desc(struct ufs_hba
> *hba)
>   dev_info->wspecversion == 0x220 ||
>   (hba->dev_quirks & UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES))
>   ufshcd_wb_probe(hba, desc_buf);
> + else
> + hba->caps &= ~UFSHCD_CAP_WB_EN;
>  
>   /*
>* ufshcd_read_string_desc returns size of the string

Hi Stanley,

That worked.


 1.
[    0.704775] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
Unable to find vdd-hba-supply regulator, assuming enabled
 2.
[    0.704781] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
Unable to find vccq-supply regulator, assuming enabled
 3.
[    0.704783] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
Unable to find vccq2-supply regulator, assuming enabled
 4.
[    0.705618] ufshcd-qcom 1d84000.ufshc: Found QC Inline Crypto
Engine (ICE) v3.1.75
 5.
[    0.707496] scsi host0: ufshcd
 6.
[    0.720415] ALSA device list:
 7.
[    0.720422]   No soundcards found.
 8.
[    0.734245] ufshcd-qcom 1d84000.ufshc: ufshcd_print_pwr_info:[RX,
TX]: gear=[1, 1], lane[1, 1], pwr[SLOWAUTO_MODE, SLOWAUTO_MODE],
rate = 0
 9.
[    0.845159] ufshcd-qcom 1d84000.ufshc: ufshcd_print_pwr_info:[RX,
TX]: gear=[3, 3], lane[2, 2], pwr[FAST MODE, FAST MODE], rate = 2
10.
[    0.846399] ufshcd-qcom 1d84000.ufshc:
ufshcd_find_max_sup_active_icc_level: Regulator capability was not
set, actvIccLevel=0
11.
[    0.849258] scsi 0:0:0:49488: Well-known LUN    SAMSUNG
 KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6
12.
[    0.853372] scsi 0:0:0:49476: Well-known LUN    SAMSUNG
 KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6
13.
[    0.855135] scsi 0:0:0:49456: Well-known LUN    SAMSUNG
 KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6
14.
[    0.857050] scsi 0:0:0:0: Direct-Access     SAMSUNG
 KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6
15.
[    0.858297] sd 0:0:0:0: Power-on or device reset occurred
16.
[    0.859985] scsi 0:0:0:1: Direct-Access     SAMSUNG
 KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6
17.
[    0.860702] sd 0:0:0:0: [sda] 29765632 4096-byte logical blocks:
(122 GB/114 GiB)

(full dmesg output at https://pastebin.com/Pvfqe42P )

I guess you can throw my Tested-by on there.

Thanks

--Steev



Re: [PATCH v1 1/3] scsi: ufs: add write booster feature support

2020-06-23 Thread Stanley Chu
Hi Kyuho,

On Wed, 2020-06-24 at 11:06 +0900, Kyuho Choi wrote:
> Hi Stanley,
> 
> On 6/24/20, Stanley Chu  wrote:
> > Hi Steev,
> >
> > On Tue, 2020-06-23 at 20:10 -0500, Steev Klimaszewski wrote:
> >> On 6/23/20 1:51 AM, Kyuho Choi wrote:
> >> > Hi Avri,
> >> >
> >> > On 6/23/20, Avri Altman  wrote:
> >> >>> AFAIK, this device are ufs 2.1. It's not support writebooster.
> >> >>>
> >> >>> I'd check latest linux scsi branch and ufshcd_wb_config function's
> >> >>> called without device capability check.
> >> >> Please grep ufshcd_wb_probe.
> >> >>
> >> > I got your point, but as I mentioned, this device not support wb, this
> >> > is old products.
> >> >
> >> > I'm not sure ufshcd_wb_probe are called or not in Rob and Steev's
> >> > platform.
> >> > If it's called, hba->caps are setted with wb diable and this error not
> >> > occured.
> >> > But (it looks) not called, same query error will be occured in
> >> > ufshcd_wb_config/ctrl.
> >> >
> >> > BR,
> >> > Kyuho Choi
> >>
> >> I do show ufshcd_wb_probe in my sources - I'm based on 5.8-rc2 with a
> >> few extra patches for the c630, and the inline encryption patches.
> >>
> >> I this is the output that I see -
> >>
> >>  1.
> >> [0.702501] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
> >> Unable to find vdd-hba-supply regulator, assuming enabled
> >>  2.
> >> [0.702506] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
> >> Unable to find vccq-supply regulator, assuming enabled
> >>  3.
> >> [0.702508] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
> >> Unable to find vccq2-supply regulator, assuming enabled
> >>  4.
> >> [0.703296] ufshcd-qcom 1d84000.ufshc: Found QC Inline Crypto
> >> Engine (ICE) v3.1.75
> >>  5.
> >> [0.705121] scsi host0: ufshcd
> >>  6.
> >> [0.720163] ALSA device list:
> >>  7.
> >> [0.720171]   No soundcards found.
> >>  8.
> >> [0.731393] ufshcd-qcom 1d84000.ufshc: ufshcd_print_pwr_info:[RX,
> >> TX]: gear=[1, 1], lane[1, 1], pwr[SLOWAUTO_MODE, SLOWAUTO_MODE],
> >> rate = 0
> >>  9.
> >> [0.893738] ufshcd-qcom 1d84000.ufshc: ufshcd_print_pwr_info:[RX,
> >> TX]: gear=[3, 3], lane[2, 2], pwr[FAST MODE, FAST MODE], rate = 2
> >> 10.
> >> [0.894703] ufshcd-qcom 1d84000.ufshc:
> >> ufshcd_find_max_sup_active_icc_level: Regulator capability was not
> >> set, actvIccLevel=0
> >> 11.
> >> [0.896032] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> >> flag query for idn 14 failed, err = 253
> >> 12.
> >> [0.896919] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> >> flag query for idn 14 failed, err = 253
> >> 13.
> >> [0.897798] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> >> flag query for idn 14 failed, err = 253
> >> 14.
> >> [0.898227] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag_retry:
> >> query attribute, opcode 6, idn 14, failed with error 253 after 3
> >> retires
> >> 15.
> >> [0.898798] ufshcd-qcom 1d84000.ufshc: ufshcd_wb_ctrl write
> >> booster enable failed 253
> >> 16.
> >> [0.899150] ufshcd-qcom 1d84000.ufshc: ufshcd_wb_config: Enable
> >> WB failed: 253
> >> 17.
> >> [0.899918] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> >> flag query for idn 16 failed, err = 253
> >> 18.
> >> [0.900448] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> >> flag query for idn 16 failed, err = 253
> >> 19.
> >> [0.901290] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> >> flag query for idn 16 failed, err = 253
> >> 20.
> >> [0.901749] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag_retry:
> >> query attribute, opcode 6, idn 16, failed with error 253 after 3
> >> retires
> >> 21.
> >> [0.902285] ufshcd-qcom 1d84000.ufshc: ufshcd_wb_config: En WB
> >> flush during H8: failed: 253
> >> 22.
> >> [0.903105] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> >> flag query for idn 15 failed, err = 253
> >> 23.
> >> [0.903988] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> >> flag query for idn 15 failed, err = 253
> >> 24.
> >> [0.904866] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> >> flag query for idn 15 failed, err = 253
> >> 25.
> >> [0.905294] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag_retry:
> >> query attribute, opcode 6, idn 15, failed with error 253 after 3
> >> retires
> >> 26.
> >> [0.905859] ufshcd-qcom 1d84000.ufshc: ufshcd_wb_buf_flush_enable
> >> WB - buf flush enable failed 253
> >
> > Please help try below simple patch to see if above WriteBooster messages
> > can be eliminated.
> >
> >
> > ---
> >  drivers/scsi/ufs/ufshcd.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> > index f173ad1bd79f..089c0785f0b3 100644
> > --- a/drivers/scsi/ufs/ufshcd.c
> > +++ 

Re: [PATCH v1 1/3] scsi: ufs: add write booster feature support

2020-06-23 Thread Kyuho Choi
Hi Stanley,

On 6/24/20, Stanley Chu  wrote:
> Hi Steev,
>
> On Tue, 2020-06-23 at 20:10 -0500, Steev Klimaszewski wrote:
>> On 6/23/20 1:51 AM, Kyuho Choi wrote:
>> > Hi Avri,
>> >
>> > On 6/23/20, Avri Altman  wrote:
>> >>> AFAIK, this device are ufs 2.1. It's not support writebooster.
>> >>>
>> >>> I'd check latest linux scsi branch and ufshcd_wb_config function's
>> >>> called without device capability check.
>> >> Please grep ufshcd_wb_probe.
>> >>
>> > I got your point, but as I mentioned, this device not support wb, this
>> > is old products.
>> >
>> > I'm not sure ufshcd_wb_probe are called or not in Rob and Steev's
>> > platform.
>> > If it's called, hba->caps are setted with wb diable and this error not
>> > occured.
>> > But (it looks) not called, same query error will be occured in
>> > ufshcd_wb_config/ctrl.
>> >
>> > BR,
>> > Kyuho Choi
>>
>> I do show ufshcd_wb_probe in my sources - I'm based on 5.8-rc2 with a
>> few extra patches for the c630, and the inline encryption patches.
>>
>> I this is the output that I see -
>>
>>  1.
>> [0.702501] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
>> Unable to find vdd-hba-supply regulator, assuming enabled
>>  2.
>> [0.702506] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
>> Unable to find vccq-supply regulator, assuming enabled
>>  3.
>> [0.702508] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
>> Unable to find vccq2-supply regulator, assuming enabled
>>  4.
>> [0.703296] ufshcd-qcom 1d84000.ufshc: Found QC Inline Crypto
>> Engine (ICE) v3.1.75
>>  5.
>> [0.705121] scsi host0: ufshcd
>>  6.
>> [0.720163] ALSA device list:
>>  7.
>> [0.720171]   No soundcards found.
>>  8.
>> [0.731393] ufshcd-qcom 1d84000.ufshc: ufshcd_print_pwr_info:[RX,
>> TX]: gear=[1, 1], lane[1, 1], pwr[SLOWAUTO_MODE, SLOWAUTO_MODE],
>> rate = 0
>>  9.
>> [0.893738] ufshcd-qcom 1d84000.ufshc: ufshcd_print_pwr_info:[RX,
>> TX]: gear=[3, 3], lane[2, 2], pwr[FAST MODE, FAST MODE], rate = 2
>> 10.
>> [0.894703] ufshcd-qcom 1d84000.ufshc:
>> ufshcd_find_max_sup_active_icc_level: Regulator capability was not
>> set, actvIccLevel=0
>> 11.
>> [0.896032] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
>> flag query for idn 14 failed, err = 253
>> 12.
>> [0.896919] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
>> flag query for idn 14 failed, err = 253
>> 13.
>> [0.897798] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
>> flag query for idn 14 failed, err = 253
>> 14.
>> [0.898227] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag_retry:
>> query attribute, opcode 6, idn 14, failed with error 253 after 3
>> retires
>> 15.
>> [0.898798] ufshcd-qcom 1d84000.ufshc: ufshcd_wb_ctrl write
>> booster enable failed 253
>> 16.
>> [0.899150] ufshcd-qcom 1d84000.ufshc: ufshcd_wb_config: Enable
>> WB failed: 253
>> 17.
>> [0.899918] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
>> flag query for idn 16 failed, err = 253
>> 18.
>> [0.900448] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
>> flag query for idn 16 failed, err = 253
>> 19.
>> [0.901290] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
>> flag query for idn 16 failed, err = 253
>> 20.
>> [0.901749] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag_retry:
>> query attribute, opcode 6, idn 16, failed with error 253 after 3
>> retires
>> 21.
>> [0.902285] ufshcd-qcom 1d84000.ufshc: ufshcd_wb_config: En WB
>> flush during H8: failed: 253
>> 22.
>> [0.903105] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
>> flag query for idn 15 failed, err = 253
>> 23.
>> [0.903988] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
>> flag query for idn 15 failed, err = 253
>> 24.
>> [0.904866] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
>> flag query for idn 15 failed, err = 253
>> 25.
>> [0.905294] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag_retry:
>> query attribute, opcode 6, idn 15, failed with error 253 after 3
>> retires
>> 26.
>> [0.905859] ufshcd-qcom 1d84000.ufshc: ufshcd_wb_buf_flush_enable
>> WB - buf flush enable failed 253
>
> Please help try below simple patch to see if above WriteBooster messages
> can be eliminated.
>
>
> ---
>  drivers/scsi/ufs/ufshcd.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index f173ad1bd79f..089c0785f0b3 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -6985,6 +6985,8 @@ static int ufs_get_device_desc(struct ufs_hba
> *hba)
>   dev_info->wspecversion == 0x220 ||
>   (hba->dev_quirks & UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES))
>   ufshcd_wb_probe(hba, desc_buf);
> + else
> + hba->caps &= ~UFSHCD_CAP_WB_EN;


Re: [PATCH v1 1/3] scsi: ufs: add write booster feature support

2020-06-23 Thread Kyuho Choi
Hi Steev,

Thanks for share log!.

On 6/24/20, Steev Klimaszewski  wrote:
>
> On 6/23/20 1:51 AM, Kyuho Choi wrote:
>> Hi Avri,
>>
>> On 6/23/20, Avri Altman  wrote:
 AFAIK, this device are ufs 2.1. It's not support writebooster.

 I'd check latest linux scsi branch and ufshcd_wb_config function's
 called without device capability check.
>>> Please grep ufshcd_wb_probe.
>>>
>> I got your point, but as I mentioned, this device not support wb, this
>> is old products.
>>
>> I'm not sure ufshcd_wb_probe are called or not in Rob and Steev's
>> platform.
>> If it's called, hba->caps are setted with wb diable and this error not
>> occured.
>> But (it looks) not called, same query error will be occured in
>> ufshcd_wb_config/ctrl.
>>
>> BR,
>> Kyuho Choi
>
> I do show ufshcd_wb_probe in my sources - I'm based on 5.8-rc2 with a
> few extra patches for the c630, and the inline encryption patches.
>
> I this is the output that I see -
>
>  1.
> [0.702501] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
> Unable to find vdd-hba-supply regulator, assuming enabled
>  2.
> [0.702506] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
> Unable to find vccq-supply regulator, assuming enabled
>  3.
> [0.702508] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
> Unable to find vccq2-supply regulator, assuming enabled
>  4.
> [0.703296] ufshcd-qcom 1d84000.ufshc: Found QC Inline Crypto
> Engine (ICE) v3.1.75
>  5.
> [0.705121] scsi host0: ufshcd
>  6.
> [0.720163] ALSA device list:
>  7.
> [0.720171]   No soundcards found.
>  8.
> [0.731393] ufshcd-qcom 1d84000.ufshc: ufshcd_print_pwr_info:[RX,
> TX]: gear=[1, 1], lane[1, 1], pwr[SLOWAUTO_MODE, SLOWAUTO_MODE],
> rate = 0
>  9.
> [0.893738] ufshcd-qcom 1d84000.ufshc: ufshcd_print_pwr_info:[RX,
> TX]: gear=[3, 3], lane[2, 2], pwr[FAST MODE, FAST MODE], rate = 2
> 10.
> [0.894703] ufshcd-qcom 1d84000.ufshc:
> ufshcd_find_max_sup_active_icc_level: Regulator capability was not
> set, actvIccLevel=0
> 11.
> [0.896032] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> flag query for idn 14 failed, err = 253
> 12.
> [0.896919] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> flag query for idn 14 failed, err = 253
> 13.
> [0.897798] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> flag query for idn 14 failed, err = 253
> 14.
> [0.898227] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag_retry:
> query attribute, opcode 6, idn 14, failed with error 253 after 3
> retires
> 15.
> [0.898798] ufshcd-qcom 1d84000.ufshc: ufshcd_wb_ctrl write
> booster enable failed 253
> 16.
> [0.899150] ufshcd-qcom 1d84000.ufshc: ufshcd_wb_config: Enable
> WB failed: 253

Like here, as I mentioned in last. Some of UFS 2.1 device maybe got a
query fail like this.

> 17.
> [0.899918] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> flag query for idn 16 failed, err = 253
> 18.
> [0.900448] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> flag query for idn 16 failed, err = 253
> 19.
> [0.901290] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> flag query for idn 16 failed, err = 253
> 20.
> [0.901749] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag_retry:
> query attribute, opcode 6, idn 16, failed with error 253 after 3
> retires
> 21.
> [0.902285] ufshcd-qcom 1d84000.ufshc: ufshcd_wb_config: En WB
> flush during H8: failed: 253
> 22.
> [0.903105] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> flag query for idn 15 failed, err = 253
> 23.
> [0.903988] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> flag query for idn 15 failed, err = 253
> 24.
> [0.904866] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> flag query for idn 15 failed, err = 253
> 25.
> [0.905294] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag_retry:
> query attribute, opcode 6, idn 15, failed with error 253 after 3
> retires
> 26.
> [0.905859] ufshcd-qcom 1d84000.ufshc: ufshcd_wb_buf_flush_enable
> WB - buf flush enable failed 253
> 27.
> [0.907659] scsi 0:0:0:49488: Well-known LUNSAMSUNG
>  KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6

I'd searching this ufs device part no and it's ufs 2.1 too.

> 28.
> [0.911082] scsi 0:0:0:49476: Well-known LUNSAMSUNG
>  KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6
> 29.
> [0.913268] scsi 0:0:0:49456: Well-known LUNSAMSUNG
>  KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6
> 30.
> [0.914580] scsi 0:0:0:0: Direct-Access SAMSUNG
>  KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6
> 31.
> [0.915156] sd 0:0:0:0: Power-on or device reset occurred
> 32.
> [0.915311] scsi 0:0:0:1: Direct-Access SAMSUNG
>  KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6
> 33.
> [0.916104] scsi 0:0:0:2: Direct-Access 

Re: [PATCH v1 1/3] scsi: ufs: add write booster feature support

2020-06-23 Thread Stanley Chu
Hi Steev,

On Tue, 2020-06-23 at 20:10 -0500, Steev Klimaszewski wrote:
> On 6/23/20 1:51 AM, Kyuho Choi wrote:
> > Hi Avri,
> >
> > On 6/23/20, Avri Altman  wrote:
> >>> AFAIK, this device are ufs 2.1. It's not support writebooster.
> >>>
> >>> I'd check latest linux scsi branch and ufshcd_wb_config function's
> >>> called without device capability check.
> >> Please grep ufshcd_wb_probe.
> >>
> > I got your point, but as I mentioned, this device not support wb, this
> > is old products.
> >
> > I'm not sure ufshcd_wb_probe are called or not in Rob and Steev's platform.
> > If it's called, hba->caps are setted with wb diable and this error not 
> > occured.
> > But (it looks) not called, same query error will be occured in
> > ufshcd_wb_config/ctrl.
> >
> > BR,
> > Kyuho Choi
> 
> I do show ufshcd_wb_probe in my sources - I'm based on 5.8-rc2 with a
> few extra patches for the c630, and the inline encryption patches.
> 
> I this is the output that I see -
> 
>  1.
> [0.702501] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
> Unable to find vdd-hba-supply regulator, assuming enabled
>  2.
> [0.702506] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
> Unable to find vccq-supply regulator, assuming enabled
>  3.
> [0.702508] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
> Unable to find vccq2-supply regulator, assuming enabled
>  4.
> [0.703296] ufshcd-qcom 1d84000.ufshc: Found QC Inline Crypto
> Engine (ICE) v3.1.75
>  5.
> [0.705121] scsi host0: ufshcd
>  6.
> [0.720163] ALSA device list:
>  7.
> [0.720171]   No soundcards found.
>  8.
> [0.731393] ufshcd-qcom 1d84000.ufshc: ufshcd_print_pwr_info:[RX,
> TX]: gear=[1, 1], lane[1, 1], pwr[SLOWAUTO_MODE, SLOWAUTO_MODE],
> rate = 0
>  9.
> [0.893738] ufshcd-qcom 1d84000.ufshc: ufshcd_print_pwr_info:[RX,
> TX]: gear=[3, 3], lane[2, 2], pwr[FAST MODE, FAST MODE], rate = 2
> 10.
> [0.894703] ufshcd-qcom 1d84000.ufshc:
> ufshcd_find_max_sup_active_icc_level: Regulator capability was not
> set, actvIccLevel=0
> 11.
> [0.896032] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> flag query for idn 14 failed, err = 253
> 12.
> [0.896919] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> flag query for idn 14 failed, err = 253
> 13.
> [0.897798] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> flag query for idn 14 failed, err = 253
> 14.
> [0.898227] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag_retry:
> query attribute, opcode 6, idn 14, failed with error 253 after 3 retires
> 15.
> [0.898798] ufshcd-qcom 1d84000.ufshc: ufshcd_wb_ctrl write
> booster enable failed 253
> 16.
> [0.899150] ufshcd-qcom 1d84000.ufshc: ufshcd_wb_config: Enable
> WB failed: 253
> 17.
> [0.899918] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> flag query for idn 16 failed, err = 253
> 18.
> [0.900448] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> flag query for idn 16 failed, err = 253
> 19.
> [0.901290] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> flag query for idn 16 failed, err = 253
> 20.
> [0.901749] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag_retry:
> query attribute, opcode 6, idn 16, failed with error 253 after 3 retires
> 21.
> [0.902285] ufshcd-qcom 1d84000.ufshc: ufshcd_wb_config: En WB
> flush during H8: failed: 253
> 22.
> [0.903105] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> flag query for idn 15 failed, err = 253
> 23.
> [0.903988] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> flag query for idn 15 failed, err = 253
> 24.
> [0.904866] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
> flag query for idn 15 failed, err = 253
> 25.
> [0.905294] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag_retry:
> query attribute, opcode 6, idn 15, failed with error 253 after 3 retires
> 26.
> [0.905859] ufshcd-qcom 1d84000.ufshc: ufshcd_wb_buf_flush_enable
> WB - buf flush enable failed 253

Please help try below simple patch to see if above WriteBooster messages
can be eliminated.


---
 drivers/scsi/ufs/ufshcd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index f173ad1bd79f..089c0785f0b3 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6985,6 +6985,8 @@ static int ufs_get_device_desc(struct ufs_hba
*hba)
dev_info->wspecversion == 0x220 ||
(hba->dev_quirks & UFS_DEVICE_QUIRK_SUPPORT_EXTENDED_FEATURES))
ufshcd_wb_probe(hba, desc_buf);
+   else
+   hba->caps &= ~UFSHCD_CAP_WB_EN;
 
/*
 * ufshcd_read_string_desc returns size of the string
-- 



> 27.
> [0.907659] scsi 0:0:0:49488: Well-known LUNSAMSUNG
>  KLUDG4U1EA-B0C1  0500 PQ: 0 

Re: [PATCH v1 1/3] scsi: ufs: add write booster feature support

2020-06-23 Thread Steev Klimaszewski


On 6/23/20 1:51 AM, Kyuho Choi wrote:
> Hi Avri,
>
> On 6/23/20, Avri Altman  wrote:
>>> AFAIK, this device are ufs 2.1. It's not support writebooster.
>>>
>>> I'd check latest linux scsi branch and ufshcd_wb_config function's
>>> called without device capability check.
>> Please grep ufshcd_wb_probe.
>>
> I got your point, but as I mentioned, this device not support wb, this
> is old products.
>
> I'm not sure ufshcd_wb_probe are called or not in Rob and Steev's platform.
> If it's called, hba->caps are setted with wb diable and this error not 
> occured.
> But (it looks) not called, same query error will be occured in
> ufshcd_wb_config/ctrl.
>
> BR,
> Kyuho Choi

I do show ufshcd_wb_probe in my sources - I'm based on 5.8-rc2 with a
few extra patches for the c630, and the inline encryption patches.

I this is the output that I see -

 1.
[    0.702501] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
Unable to find vdd-hba-supply regulator, assuming enabled
 2.
[    0.702506] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
Unable to find vccq-supply regulator, assuming enabled
 3.
[    0.702508] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg:
Unable to find vccq2-supply regulator, assuming enabled
 4.
[    0.703296] ufshcd-qcom 1d84000.ufshc: Found QC Inline Crypto
Engine (ICE) v3.1.75
 5.
[    0.705121] scsi host0: ufshcd
 6.
[    0.720163] ALSA device list:
 7.
[    0.720171]   No soundcards found.
 8.
[    0.731393] ufshcd-qcom 1d84000.ufshc: ufshcd_print_pwr_info:[RX,
TX]: gear=[1, 1], lane[1, 1], pwr[SLOWAUTO_MODE, SLOWAUTO_MODE],
rate = 0
 9.
[    0.893738] ufshcd-qcom 1d84000.ufshc: ufshcd_print_pwr_info:[RX,
TX]: gear=[3, 3], lane[2, 2], pwr[FAST MODE, FAST MODE], rate = 2
10.
[    0.894703] ufshcd-qcom 1d84000.ufshc:
ufshcd_find_max_sup_active_icc_level: Regulator capability was not
set, actvIccLevel=0
11.
[    0.896032] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
flag query for idn 14 failed, err = 253
12.
[    0.896919] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
flag query for idn 14 failed, err = 253
13.
[    0.897798] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
flag query for idn 14 failed, err = 253
14.
[    0.898227] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag_retry:
query attribute, opcode 6, idn 14, failed with error 253 after 3 retires
15.
[    0.898798] ufshcd-qcom 1d84000.ufshc: ufshcd_wb_ctrl write
booster enable failed 253
16.
[    0.899150] ufshcd-qcom 1d84000.ufshc: ufshcd_wb_config: Enable
WB failed: 253
17.
[    0.899918] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
flag query for idn 16 failed, err = 253
18.
[    0.900448] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
flag query for idn 16 failed, err = 253
19.
[    0.901290] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
flag query for idn 16 failed, err = 253
20.
[    0.901749] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag_retry:
query attribute, opcode 6, idn 16, failed with error 253 after 3 retires
21.
[    0.902285] ufshcd-qcom 1d84000.ufshc: ufshcd_wb_config: En WB
flush during H8: failed: 253
22.
[    0.903105] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
flag query for idn 15 failed, err = 253
23.
[    0.903988] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
flag query for idn 15 failed, err = 253
24.
[    0.904866] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending
flag query for idn 15 failed, err = 253
25.
[    0.905294] ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag_retry:
query attribute, opcode 6, idn 15, failed with error 253 after 3 retires
26.
[    0.905859] ufshcd-qcom 1d84000.ufshc: ufshcd_wb_buf_flush_enable
WB - buf flush enable failed 253
27.
[    0.907659] scsi 0:0:0:49488: Well-known LUN    SAMSUNG
 KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6
28.
[    0.911082] scsi 0:0:0:49476: Well-known LUN    SAMSUNG
 KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6
29.
[    0.913268] scsi 0:0:0:49456: Well-known LUN    SAMSUNG
 KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6
30.
[    0.914580] scsi 0:0:0:0: Direct-Access     SAMSUNG
 KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6
31.
[    0.915156] sd 0:0:0:0: Power-on or device reset occurred
32.
[    0.915311] scsi 0:0:0:1: Direct-Access     SAMSUNG
 KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6
33.
[    0.916104] scsi 0:0:0:2: Direct-Access     SAMSUNG
 KLUDG4U1EA-B0C1  0500 PQ: 0 ANSI: 6
34.
[    0.916318] sd 0:0:0:0: [sda] 29765632 4096-byte logical blocks:
(122 GB/114 GiB)
35.
[    0.916417] sd 0:0:0:0: [sda] Write Protect is off
36.
[    0.916424] sd 0:0:0:0: [sda] Mode Sense: 00 32 00 10
37.
[    0.916589] sd 0:0:0:0: [sda] Write cache: enabled, read cache:
enabled, supports DPO and FUA
38.
[    0.916667] sd 0:0:0:0: [sda] Optimal transfer size 8192 bytes

Re: [PATCH v1 1/3] scsi: ufs: add write booster feature support

2020-06-23 Thread Kyuho Choi
Hi Avri,

On 6/23/20, Avri Altman  wrote:
>>
>> AFAIK, this device are ufs 2.1. It's not support writebooster.
>>
>> I'd check latest linux scsi branch and ufshcd_wb_config function's
>> called without device capability check.
> Please grep ufshcd_wb_probe.
>
I got your point, but as I mentioned, this device not support wb, this
is old products.

I'm not sure ufshcd_wb_probe are called or not in Rob and Steev's platform.
If it's called, hba->caps are setted with wb diable and this error not occured.
But (it looks) not called, same query error will be occured in
ufshcd_wb_config/ctrl.

BR,
Kyuho Choi


RE: [PATCH v1 1/3] scsi: ufs: add write booster feature support

2020-06-23 Thread Avri Altman
> 
> AFAIK, this device are ufs 2.1. It's not support writebooster.
> 
> I'd check latest linux scsi branch and ufshcd_wb_config function's
> called without device capability check.
Please grep ufshcd_wb_probe.


Re: [PATCH v1 1/3] scsi: ufs: add write booster feature support

2020-06-22 Thread Kyuho Choi
Hi Rob,

On 6/22/20, Rob Clark  wrote:
> On Sun, Jun 21, 2020 at 12:58 AM Bjorn Andersson
>  wrote:
>>
>> On Sun 21 Jun 00:40 PDT 2020, Avri Altman wrote:
>>
>> >
>> > >
>> > > On Wed, Apr 8, 2020 at 3:00 PM Asutosh Das 
>> > > wrote:
>> > > >
>> > > > The write performance of TLC NAND is considerably
>> > > > lower than SLC NAND. Using SLC NAND as a WriteBooster
>> > > > Buffer enables the write request to be processed with
>> > > > lower latency and improves the overall write performance.
>> > > >
>> > > > Adds support for shared-buffer mode WriteBooster.
>> > > >
>> > > > WriteBooster enable: SW enables it when clocks are
>> > > > scaled up, thus it's enabled only in high load conditions.
>> > > >
>> > > > WriteBooster disable: SW will disable the feature,
>> > > > when clocks are scaled down. Thus writes would go as normal
>> > > > writes.
>> > >
>> > > btw, in v5.8-rc1 (plus handful of remaining patches for lenovo c630
>> > > laptop (sdm850)), I'm seeing a lot of:
>> > >
>> > >   ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending flag query
>> > > for
>> > > idn 14 failed, err = 253
>> > >   ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending flag query
>> > > for
>> > > idn 14 failed, err = 253
>> > >   ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag_retry: query
>> > > attribute,
>> > > opcode 6, idn 14, failed with error 253 after 3 retires
>> > >   ufshcd-qcom 1d84000.ufshc: ufshcd_wb_ctrl write booster enable
>> > > failed 253
>> > >
>> > > and at least subjectively, compiling mesa seems slower, which seems
>> > > like it might be related?
>> > This looks like a device issue to be taken with the flash vendor:
>>
>> There's no way for a end-user to file a bug report with the flash vendor
>> on a device bought from an OEM and even if they would accept the bug
>> report they wouldn't re-provision the flash in an shipped device.
>>
>> So you will have to work around this in the driver.
>
> oh, ugg.. well I think these msgs from dmesg identify the part if we
> end up needing to use a denylist:
>
> scsi 0:0:0:49488: Well-known LUNSKhynix  H28S8Q302CMR A102 PQ: 0
> ANSI: 6
> scsi 0:0:0:49476: Well-known LUNSKhynix  H28S8Q302CMR A102 PQ: 0
> ANSI: 6
> scsi 0:0:0:49456: Well-known LUNSKhynix  H28S8Q302CMR A102 PQ: 0
> ANSI: 6
> scsi 0:0:0:0: Direct-Access SKhynix  H28S8Q302CMR A102 PQ: 0 ANSI:
> 6
> scsi 0:0:0:1: Direct-Access SKhynix  H28S8Q302CMR A102 PQ: 0 ANSI:
> 6
> sd 0:0:0:0: [sda] 29765632 4096-byte logical blocks: (122 GB/114 GiB)
> sd 0:0:0:0: [sda] Write Protect is off
> sd 0:0:0:0: [sda] Mode Sense: 00 32 00 10
> sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, supports
> DPO and FUA
> sd 0:0:0:0: [sda] Optimal transfer size 786432 bytes
> scsi 0:0:0:2: Direct-Access SKhynix  H28S8Q302CMR A102 PQ: 0 ANSI:
> 6
> scsi 0:0:0:3: Direct-Access SKhynix  H28S8Q302CMR A102 PQ: 0 ANSI:
> 6
>

AFAIK, this device are ufs 2.1. It's not support writebooster.

I'd check latest linux scsi branch and ufshcd_wb_config function's
called without device capability check.

ufshcd_wb_config
 -> ufshcd_is_wb_allowed
 -> only check about hba caps with writebooster

Asutosh's first patch already check about device's capability in here.

IMO, it would be need to fixing in ufshcd_probe_hba or ufshcd_wb_config.

>
> (otoh I guess the driver could just notice that writeboost keeps
> failing and stop trying to use it)
>
> BR,
> -R
>
>
>> Regards,
>> Bjorn
>>
>> > The device reports that it supports wd, but returns inalid idn for flag
>> > 0xe...
>> >
>> > Thanks,
>> > Avri
>


Re: [PATCH v1 1/3] scsi: ufs: add write booster feature support

2020-06-21 Thread Steev Klimaszewski


On 6/21/20 11:50 AM, Rob Clark wrote:
> This looks like a device issue to be taken with the flash vendor:
>> There's no way for a end-user to file a bug report with the flash vendor
>> on a device bought from an OEM and even if they would accept the bug
>> report they wouldn't re-provision the flash in an shipped device.
>>
>> So you will have to work around this in the driver.
> oh, ugg.. well I think these msgs from dmesg identify the part if we
> end up needing to use a denylist:
>
> scsi 0:0:0:49488: Well-known LUNSKhynix  H28S8Q302CMR A102 PQ: 0 
> ANSI: 6
> scsi 0:0:0:49476: Well-known LUNSKhynix  H28S8Q302CMR A102 PQ: 0 
> ANSI: 6
> scsi 0:0:0:49456: Well-known LUNSKhynix  H28S8Q302CMR A102 PQ: 0 
> ANSI: 6
> scsi 0:0:0:0: Direct-Access SKhynix  H28S8Q302CMR A102 PQ: 0 ANSI: 6
> scsi 0:0:0:1: Direct-Access SKhynix  H28S8Q302CMR A102 PQ: 0 ANSI: 6
> sd 0:0:0:0: [sda] 29765632 4096-byte logical blocks: (122 GB/114 GiB)
> sd 0:0:0:0: [sda] Write Protect is off
> sd 0:0:0:0: [sda] Mode Sense: 00 32 00 10
> sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, supports
> DPO and FUA
> sd 0:0:0:0: [sda] Optimal transfer size 786432 bytes
> scsi 0:0:0:2: Direct-Access SKhynix  H28S8Q302CMR A102 PQ: 0 ANSI: 6
> scsi 0:0:0:3: Direct-Access SKhynix  H28S8Q302CMR A102 PQ: 0 ANSI: 6
>
>
> (otoh I guess the driver could just notice that writeboost keeps
> failing and stop trying to use it)
>
> BR,
> -R


FWIW, I see this on my c630 as well, but my LUN shows up as


scsi 0:0:0:49488: Well-known LUN    SAMSUNG  KLUDG4U1EA-B0C1   0500 PQ:
0 ANSI: 6



Re: [PATCH v1 1/3] scsi: ufs: add write booster feature support

2020-06-21 Thread Rob Clark
On Sun, Jun 21, 2020 at 12:58 AM Bjorn Andersson
 wrote:
>
> On Sun 21 Jun 00:40 PDT 2020, Avri Altman wrote:
>
> >
> > >
> > > On Wed, Apr 8, 2020 at 3:00 PM Asutosh Das 
> > > wrote:
> > > >
> > > > The write performance of TLC NAND is considerably
> > > > lower than SLC NAND. Using SLC NAND as a WriteBooster
> > > > Buffer enables the write request to be processed with
> > > > lower latency and improves the overall write performance.
> > > >
> > > > Adds support for shared-buffer mode WriteBooster.
> > > >
> > > > WriteBooster enable: SW enables it when clocks are
> > > > scaled up, thus it's enabled only in high load conditions.
> > > >
> > > > WriteBooster disable: SW will disable the feature,
> > > > when clocks are scaled down. Thus writes would go as normal
> > > > writes.
> > >
> > > btw, in v5.8-rc1 (plus handful of remaining patches for lenovo c630
> > > laptop (sdm850)), I'm seeing a lot of:
> > >
> > >   ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending flag query for
> > > idn 14 failed, err = 253
> > >   ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending flag query for
> > > idn 14 failed, err = 253
> > >   ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag_retry: query attribute,
> > > opcode 6, idn 14, failed with error 253 after 3 retires
> > >   ufshcd-qcom 1d84000.ufshc: ufshcd_wb_ctrl write booster enable failed 
> > > 253
> > >
> > > and at least subjectively, compiling mesa seems slower, which seems
> > > like it might be related?
> > This looks like a device issue to be taken with the flash vendor:
>
> There's no way for a end-user to file a bug report with the flash vendor
> on a device bought from an OEM and even if they would accept the bug
> report they wouldn't re-provision the flash in an shipped device.
>
> So you will have to work around this in the driver.

oh, ugg.. well I think these msgs from dmesg identify the part if we
end up needing to use a denylist:

scsi 0:0:0:49488: Well-known LUNSKhynix  H28S8Q302CMR A102 PQ: 0 ANSI: 6
scsi 0:0:0:49476: Well-known LUNSKhynix  H28S8Q302CMR A102 PQ: 0 ANSI: 6
scsi 0:0:0:49456: Well-known LUNSKhynix  H28S8Q302CMR A102 PQ: 0 ANSI: 6
scsi 0:0:0:0: Direct-Access SKhynix  H28S8Q302CMR A102 PQ: 0 ANSI: 6
scsi 0:0:0:1: Direct-Access SKhynix  H28S8Q302CMR A102 PQ: 0 ANSI: 6
sd 0:0:0:0: [sda] 29765632 4096-byte logical blocks: (122 GB/114 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 00 32 00 10
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, supports
DPO and FUA
sd 0:0:0:0: [sda] Optimal transfer size 786432 bytes
scsi 0:0:0:2: Direct-Access SKhynix  H28S8Q302CMR A102 PQ: 0 ANSI: 6
scsi 0:0:0:3: Direct-Access SKhynix  H28S8Q302CMR A102 PQ: 0 ANSI: 6


(otoh I guess the driver could just notice that writeboost keeps
failing and stop trying to use it)

BR,
-R


> Regards,
> Bjorn
>
> > The device reports that it supports wd, but returns inalid idn for flag 
> > 0xe...
> >
> > Thanks,
> > Avri


Re: [PATCH v1 1/3] scsi: ufs: add write booster feature support

2020-06-21 Thread Bjorn Andersson
On Sun 21 Jun 00:40 PDT 2020, Avri Altman wrote:

>  
> > 
> > On Wed, Apr 8, 2020 at 3:00 PM Asutosh Das 
> > wrote:
> > >
> > > The write performance of TLC NAND is considerably
> > > lower than SLC NAND. Using SLC NAND as a WriteBooster
> > > Buffer enables the write request to be processed with
> > > lower latency and improves the overall write performance.
> > >
> > > Adds support for shared-buffer mode WriteBooster.
> > >
> > > WriteBooster enable: SW enables it when clocks are
> > > scaled up, thus it's enabled only in high load conditions.
> > >
> > > WriteBooster disable: SW will disable the feature,
> > > when clocks are scaled down. Thus writes would go as normal
> > > writes.
> > 
> > btw, in v5.8-rc1 (plus handful of remaining patches for lenovo c630
> > laptop (sdm850)), I'm seeing a lot of:
> > 
> >   ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending flag query for
> > idn 14 failed, err = 253
> >   ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending flag query for
> > idn 14 failed, err = 253
> >   ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag_retry: query attribute,
> > opcode 6, idn 14, failed with error 253 after 3 retires
> >   ufshcd-qcom 1d84000.ufshc: ufshcd_wb_ctrl write booster enable failed 253
> > 
> > and at least subjectively, compiling mesa seems slower, which seems
> > like it might be related?
> This looks like a device issue to be taken with the flash vendor:

There's no way for a end-user to file a bug report with the flash vendor
on a device bought from an OEM and even if they would accept the bug
report they wouldn't re-provision the flash in an shipped device.

So you will have to work around this in the driver.

Regards,
Bjorn

> The device reports that it supports wd, but returns inalid idn for flag 0xe...
> 
> Thanks,
> Avri


RE: [PATCH v1 1/3] scsi: ufs: add write booster feature support

2020-06-21 Thread Avri Altman
 
> 
> On Wed, Apr 8, 2020 at 3:00 PM Asutosh Das 
> wrote:
> >
> > The write performance of TLC NAND is considerably
> > lower than SLC NAND. Using SLC NAND as a WriteBooster
> > Buffer enables the write request to be processed with
> > lower latency and improves the overall write performance.
> >
> > Adds support for shared-buffer mode WriteBooster.
> >
> > WriteBooster enable: SW enables it when clocks are
> > scaled up, thus it's enabled only in high load conditions.
> >
> > WriteBooster disable: SW will disable the feature,
> > when clocks are scaled down. Thus writes would go as normal
> > writes.
> 
> btw, in v5.8-rc1 (plus handful of remaining patches for lenovo c630
> laptop (sdm850)), I'm seeing a lot of:
> 
>   ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending flag query for
> idn 14 failed, err = 253
>   ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending flag query for
> idn 14 failed, err = 253
>   ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag_retry: query attribute,
> opcode 6, idn 14, failed with error 253 after 3 retires
>   ufshcd-qcom 1d84000.ufshc: ufshcd_wb_ctrl write booster enable failed 253
> 
> and at least subjectively, compiling mesa seems slower, which seems
> like it might be related?
This looks like a device issue to be taken with the flash vendor:
The device reports that it supports wd, but returns inalid idn for flag 0xe...

Thanks,
Avri


Re: [PATCH v1 1/3] scsi: ufs: add write booster feature support

2020-06-20 Thread Rob Clark
On Wed, Apr 8, 2020 at 3:00 PM Asutosh Das  wrote:
>
> The write performance of TLC NAND is considerably
> lower than SLC NAND. Using SLC NAND as a WriteBooster
> Buffer enables the write request to be processed with
> lower latency and improves the overall write performance.
>
> Adds support for shared-buffer mode WriteBooster.
>
> WriteBooster enable: SW enables it when clocks are
> scaled up, thus it's enabled only in high load conditions.
>
> WriteBooster disable: SW will disable the feature,
> when clocks are scaled down. Thus writes would go as normal
> writes.

btw, in v5.8-rc1 (plus handful of remaining patches for lenovo c630
laptop (sdm850)), I'm seeing a lot of:

  ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending flag query for
idn 14 failed, err = 253
  ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag: Sending flag query for
idn 14 failed, err = 253
  ufshcd-qcom 1d84000.ufshc: ufshcd_query_flag_retry: query attribute,
opcode 6, idn 14, failed with error 253 after 3 retires
  ufshcd-qcom 1d84000.ufshc: ufshcd_wb_ctrl write booster enable failed 253

and at least subjectively, compiling mesa seems slower, which seems
like it might be related?

not sure if that is a known issue?

BR,
-R

>
> To keep the endurance of the WriteBooster Buffer at a
> maximum, this load based toggling is adopted.
>
> Signed-off-by: Asutosh Das 
> Signed-off-by: Subhash Jadavani 
> ---
>  drivers/scsi/ufs/ufs.h|  31 +-
>  drivers/scsi/ufs/ufshcd.c | 240 
> +-
>  drivers/scsi/ufs/ufshcd.h |  21 
>  3 files changed, 288 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
> index 990cb48..2c77b3e 100644
> --- a/drivers/scsi/ufs/ufs.h
> +++ b/drivers/scsi/ufs/ufs.h
> @@ -140,6 +140,9 @@ enum flag_idn {
> QUERY_FLAG_IDN_BUSY_RTC = 0x09,
> QUERY_FLAG_IDN_RESERVED3= 0x0A,
> QUERY_FLAG_IDN_PERMANENTLY_DISABLE_FW_UPDATE= 0x0B,
> +   QUERY_FLAG_IDN_WB_EN= 0x0E,
> +   QUERY_FLAG_IDN_WB_BUFF_FLUSH_EN = 0x0F,
> +   QUERY_FLAG_IDN_WB_BUFF_FLUSH_DURING_HIBERN8 = 0x10,
>  };
>
>  /* Attribute idn for Query requests */
> @@ -168,6 +171,10 @@ enum attr_idn {
> QUERY_ATTR_IDN_PSA_STATE= 0x15,
> QUERY_ATTR_IDN_PSA_DATA_SIZE= 0x16,
> QUERY_ATTR_IDN_REF_CLK_GATING_WAIT_TIME = 0x17,
> +   QUERY_ATTR_IDN_WB_FLUSH_STATUS  = 0x1C,
> +   QUERY_ATTR_IDN_AVAIL_WB_BUFF_SIZE   = 0x1D,
> +   QUERY_ATTR_IDN_WB_BUFF_LIFE_TIME_EST= 0x1E,
> +   QUERY_ATTR_IDN_CURR_WB_BUFF_SIZE= 0x1F,
>  };
>
>  /* Descriptor idn for Query requests */
> @@ -191,7 +198,7 @@ enum desc_header_offset {
>  };
>
>  enum ufs_desc_def_size {
> -   QUERY_DESC_DEVICE_DEF_SIZE  = 0x40,
> +   QUERY_DESC_DEVICE_DEF_SIZE  = 0x59,
> QUERY_DESC_CONFIGURATION_DEF_SIZE   = 0x90,
> QUERY_DESC_UNIT_DEF_SIZE= 0x23,
> QUERY_DESC_INTERCONNECT_DEF_SIZE= 0x06,
> @@ -219,6 +226,7 @@ enum unit_desc_param {
> UNIT_DESC_PARAM_PHY_MEM_RSRC_CNT= 0x18,
> UNIT_DESC_PARAM_CTX_CAPABILITIES= 0x20,
> UNIT_DESC_PARAM_LARGE_UNIT_SIZE_M1  = 0x22,
> +   UNIT_DESC_PARAM_WB_BUF_ALLOC_UNITS  = 0x29,
>  };
>
>  /* Device descriptor parameters offsets in bytes*/
> @@ -258,6 +266,9 @@ enum device_desc_param {
> DEVICE_DESC_PARAM_PSA_MAX_DATA  = 0x25,
> DEVICE_DESC_PARAM_PSA_TMT   = 0x29,
> DEVICE_DESC_PARAM_PRDCT_REV = 0x2A,
> +   DEVICE_DESC_PARAM_EXT_UFS_FEATURE_SUP   = 0x4F,
> +   DEVICE_DESC_PARAM_WB_TYPE   = 0x54,
> +   DEVICE_DESC_PARAM_WB_SHARED_ALLOC_UNITS = 0x55,
>  };
>
>  /* Interconnect descriptor parameters offsets in bytes*/
> @@ -333,6 +344,11 @@ enum {
> UFSHCD_AMP  = 3,
>  };
>
> +/* Possible values for dExtendedUFSFeaturesSupport */
> +enum {
> +   UFS_DEV_WRITE_BOOSTER_SUP   = BIT(8),
> +};
> +
>  #define POWER_DESC_MAX_SIZE0x62
>  #define POWER_DESC_MAX_ACTV_ICC_LVLS   16
>
> @@ -447,6 +463,15 @@ enum ufs_dev_pwr_mode {
> UFS_POWERDOWN_PWR_MODE  = 3,
>  };
>
> +enum ufs_dev_wb_buf_avail_size {
> +   UFS_WB_10_PERCENT_BUF_REMAIN = 0x1,
> +   UFS_WB_40_PERCENT_BUF_REMAIN = 0x4,
> +};
> +
> +enum ufs_dev_wb_buf_user_cap_config {
> +   UFS_WB_BUFF_PRESERVE_USER_SPACE = 1,
> +   UFS_WB_BUFF_USER_SPACE_RED_EN = 2,
> +};
>  /**
>   * struct utp_cmd_rsp - Response UPIU structure
>   * @residual_transfer_count: Residual transfer count DW-3
> @@ -537,6 +562,10 @@ struct ufs_dev_info {
> u8 *model;
> u16 wspecversion;
> u32 clk_gating_wait_us;
> +   u32 d_ext_ufs_feature_sup;
> +   u8 b_wb_buffer_type;
> +   u32 d_wb_alloc_units;
> +   bool keep_vcc_on;
>