Re: [PATCH v4 4/7] scsi: ufs: wb: Add explicit flush sysfs attribute

From: Bean Huo
Date: Wed Jul 27 2022 - 14:46:27 EST


On Wed, 2022-07-27 at 16:08 +0900, Jinyoung CHOI wrote:
> There is the following quirk to bypass "WB Flush" in Write Booster.
>
>         - UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL
>
> If this quirk is not set, there is no knob that can control "WB
> Flush".

>
> There are three flags that control Write Booster Feature.
>         1. WB ON/OFF
>         2. WB Hibern Flush ON/OFF (implicitly)
>         3. WB Flush ON/OFF (explicit)
>
> The sysfs attribute that controls the WB was implemented. (1)
>
> In the case of "Hibern Flush", it is always good to turn on.
> Control may not be required. (2)
>
> Finally, "Flush" may be necessary because the Auto-Hibern8 is not
> supported in a specific environment.
> So the sysfs attribute that controls this is necessary. (3)
>
> Reviewed-by: Avri Altman <avri.altman@xxxxxxx>
> Signed-off-by: Jinyoung Choi <j-young.choi@xxxxxxxxxxx>
> ---
...
>
> +static ssize_t wb_buf_flush_en_store(struct device *dev,
> +                                    struct device_attribute *attr,
> +                                    const char *buf, size_t count)
> +{
> +       struct ufs_hba *hba = dev_get_drvdata(dev);
> +       unsigned int wb_buf_flush_en;
> +       ssize_t res;
> +
> +       if (ufshcd_is_wb_allowed(hba) &&
> +          !(hba->quirks & UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL)) {
> +               dev_warn(dev, "It is not allowed to configure WB buf
> flush!\n");
> +               return -EOPNOTSUPP;
> +       }
> +
Hi J-young,

I don't understand here, if UFSHCI_QUIRK_SKIP_MANUAL_WB_FLUSH_CTRL is
not set (manual flush is not disable), so we cannot manually flush
buffer? or should we check if Auto-Hibern8 is supported?

Kind regards,
Bean