lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGOxZ50VQs+oXmSDFAtsmJYACPszdnJOr2b0vQXmjBH2VWTtWQ@mail.gmail.com>
Date:   Sun, 19 Jan 2020 07:37:43 +0530
From:   Alim Akhtar <alim.akhtar@...il.com>
To:     Bean Huo <huobean@...il.com>
Cc:     Alim Akhtar <alim.akhtar@...sung.com>,
        Avri Altman <avri.altman@....com>, asutoshd@...eaurora.org,
        "James E.J. Bottomley" <jejb@...ux.ibm.com>,
        "Martin K. Petersen" <martin.petersen@...cle.com>,
        Stanley Chu <stanley.chu@...iatek.com>,
        "Bean Huo (beanhuo)" <beanhuo@...ron.com>,
        Bart Van Assche <bvanassche@....org>,
        Tomas Winkler <tomas.winkler@...el.com>,
        Can Guo <cang@...eaurora.org>, linux-scsi@...r.kernel.org,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 7/8] scsi: ufs: Add max_lu_supported in struct ufs_dev_info

On Sun, Jan 19, 2020 at 5:45 AM Bean Huo <huobean@...il.com> wrote:
>
> From: Bean Huo <beanhuo@...ron.com>
>
> Add one new parameter max_lu_supported in struct ufs_dev_info,
> which will be used to express exactly how many general LUs being
> supported by UFS device, and initialize it during booting stage.
> This patch also adds a new function ufshcd_init_device_geo_params()
> for initialization of UFS device geometry descriptor related parameters.
>
> Reviewed-by: Asutosh Das <asutoshd@...eaurora.org>
> Signed-off-by: Bean Huo <beanhuo@...ron.com>
> ---
Reviewed-by: Alim Akhtar <alim.akhtar@...sung.com>

>  drivers/scsi/ufs/ufs.h    |  2 ++
>  drivers/scsi/ufs/ufshcd.c | 41 +++++++++++++++++++++++++++++++++++++--
>  2 files changed, 41 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
> index fcc9b4d4e56f..c982bcc94662 100644
> --- a/drivers/scsi/ufs/ufs.h
> +++ b/drivers/scsi/ufs/ufs.h
> @@ -530,6 +530,8 @@ struct ufs_dev_info {
>         bool f_power_on_wp_en;
>         /* Keeps information if any of the LU is power on write protected */
>         bool is_lu_power_on_wp;
> +       /* Maximum number of general LU supported by the UFS device */
> +       u8 max_lu_supported;
>         u16 wmanufacturerid;
>         /*UFS device Product Name */
>         u8 *model;
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 4f8fcbb5f92e..dd10558f4d01 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -6858,6 +6858,37 @@ static void ufshcd_init_desc_sizes(struct ufs_hba *hba)
>                 hba->desc_size.hlth_desc = QUERY_DESC_HEALTH_DEF_SIZE;
>  }
>
> +static int ufshcd_init_device_geo_params(struct ufs_hba *hba)
> +{
> +       int err;
> +       size_t buff_len;
> +       u8 *desc_buf;
> +
> +       buff_len = hba->desc_size.geom_desc;
> +       desc_buf = kmalloc(buff_len, GFP_KERNEL);
> +       if (!desc_buf) {
> +               err = -ENOMEM;
> +               goto out;
> +       }
> +
> +       err = ufshcd_read_desc(hba, QUERY_DESC_IDN_GEOMETRY, 0,
> +                       desc_buf, buff_len);
> +       if (err) {
> +               dev_err(hba->dev, "%s: Failed reading Geometry Desc. err = %d\n",
> +                               __func__, err);
> +               goto out;
> +       }
> +
> +       if (desc_buf[GEOMETRY_DESC_PARAM_MAX_NUM_LUN] == 1)
> +               hba->dev_info.max_lu_supported = 32;
> +       else if (desc_buf[GEOMETRY_DESC_PARAM_MAX_NUM_LUN] == 0)
> +               hba->dev_info.max_lu_supported = 8;
> +
> +out:
> +       kfree(desc_buf);
> +       return err;
> +}
> +
>  static struct ufs_ref_clk ufs_ref_clk_freqs[] = {
>         {19200000, REF_CLK_FREQ_19_2_MHZ},
>         {26000000, REF_CLK_FREQ_26_MHZ},
> @@ -6931,9 +6962,17 @@ static int ufshcd_init_params(struct ufs_hba *hba)
>         bool flag;
>         int ret;
>
> +       /* Clear any previous UFS device information */
> +       memset(&hba->dev_info, 0, sizeof(hba->dev_info));
> +
>         /* Init check for device descriptor sizes */
>         ufshcd_init_desc_sizes(hba);
>
> +       /* Init UFS geometry descriptor related parameters */
> +       ret = ufshcd_init_device_geo_params(hba);
> +       if (ret)
> +               goto out;
> +
>         /* Check and apply UFS device quirks */
>         ret = ufs_get_device_desc(hba);
>         if (ret) {
> @@ -6944,8 +6983,6 @@ static int ufshcd_init_params(struct ufs_hba *hba)
>
>         ufs_fixup_device_setup(hba);
>
> -       /* Clear any previous UFS device information */
> -       memset(&hba->dev_info, 0, sizeof(hba->dev_info));
>         if (!ufshcd_query_flag_retry(hba, UPIU_QUERY_OPCODE_READ_FLAG,
>                         QUERY_FLAG_IDN_PWR_ON_WPE, &flag))
>                 hba->dev_info.f_power_on_wp_en = flag;
> --
> 2.17.1
>


--
Regards,
Alim

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ