All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daejun Park <daejun7.park@samsung.com>
To: Avri Altman <Avri.Altman@wdc.com>,
	Daejun Park <daejun7.park@samsung.com>,
	"James E . J . Bottomley" <jejb@linux.ibm.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	Bart Van Assche <bvanassche@acm.org>,
	Bean Huo <beanhuo@micron.com>,
	ALIM AKHTAR <alim.akhtar@samsung.com>
Subject: RE:(2) [PATCH 2/3] scsi: ufs: Map the correct size to the rpmb unit descriptor
Date: Wed, 28 Jul 2021 16:51:56 +0900	[thread overview]
Message-ID: <2038148563.21627459202139.JavaMail.epsvc@epcpadp3> (raw)
In-Reply-To: <DM6PR04MB6575191C52E5323A9754B2E7FCEA9@DM6PR04MB6575.namprd04.prod.outlook.com>

Hi,

> > Hi Avri,
> > 
> > > diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h index
> > > 579cf6f9e7a1..d0be8d4c8091 100644
> > > --- a/drivers/scsi/ufs/ufs.h
> > > +++ b/drivers/scsi/ufs/ufs.h
> > > @@ -167,6 +167,7 @@ enum desc_idn {
> > >          QUERY_DESC_IDN_GEOMETRY                = 0x7,
> > >          QUERY_DESC_IDN_POWER                = 0x8,
> > >          QUERY_DESC_IDN_HEALTH           = 0x9,
> > > +        QUERY_DESC_IDN_UNIT_RPMB        = 0xA,
> > >          QUERY_DESC_IDN_MAX,
> > 
> > By adding QUERY_DESC_IDN_UNIT_RPMB, the value of
> > QUERY_DESC_IDN_MAX is changed to 0xB.
> > ...
> Yes
>  
> > 
> > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> > > index 74ccfd2b80ce..eec1bc95391b 100644
> > > --- a/drivers/scsi/ufs/ufshcd.c
> > > +++ b/drivers/scsi/ufs/ufshcd.c
> > > @@ -3319,11 +3319,13 @@ int ufshcd_query_descriptor_retry(struct ufs_hba
> > *hba,
> > >   * @desc_len: mapped desc length (out)
> > >   */
> > >  void ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn
> > desc_id,
> > > -                                  int *desc_len)
> > > +                                  int desc_index, int *desc_len)
> > >  {
> > >          if (desc_id >= QUERY_DESC_IDN_MAX || desc_id ==
> > QUERY_DESC_IDN_RFU_0 ||
> > >              desc_id == QUERY_DESC_IDN_RFU_1)
> > >                  *desc_len = 0;
> > 
> > So, if user sending desc_id as 0xA, it can not be detected as invalid descriptor.
> Which user?
> Oh, you mean if someone uses the ufs-bsg with some upiu-based query app, like ufs-utils?
> Well, those apps are for developers and field engineers, expected to know what they are doing...

Yes, but checking QUERY_DESC_IDN_MAX can be useless because of adding entry in enum desc_idn.
 
> Alternatively, maybe its better to just remove the unit descriptor sysfs entries for wlun altogether?
> They really meant nothing and shouldn't be there in the first place.
> What do you think?

Although if they were removed, ufs-bsg can access unit descriptors of wlun.
But it can be OK because developers are expected to access unit descriptors of wlun correctly.
So, I think it can be a solution.

> Thanks,
> Avri 
> > 
> > > +        else if (desc_index == UFS_UPIU_RPMB_WLUN)
> > > +                *desc_len = hba->desc_size[QUERY_DESC_IDN_UNIT_RPMB];
> > >          else
> > >                  *desc_len = hba->desc_size[desc_id];  }
> > 
> > Thanks,
> > Daejun
>  
>  
>  

  reply	other threads:[~2021-07-28  8:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27 12:35 [PATCH 0/3] Log correct rpmb unit descriptor size Avri Altman
2021-07-27 12:35 ` [PATCH 1/3] scsi: ufs: Remove redundant define Avri Altman
2021-07-29  6:26   ` Bean Huo
2021-07-27 12:35 ` [PATCH 2/3] scsi: ufs: Map the correct size to the rpmb unit descriptor Avri Altman
2021-07-28  5:06   ` Daejun Park
2021-07-28  7:28     ` Avri Altman
2021-07-28  7:51       ` Daejun Park [this message]
2021-07-27 12:35 ` [PATCH 3/3] scsi: ufs: Generalize ufs_is_valid_unit_desc_lun() Avri Altman
2021-08-06  3:03 ` [PATCH 0/3] Log correct rpmb unit descriptor size Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2038148563.21627459202139.JavaMail.epsvc@epcpadp3 \
    --to=daejun7.park@samsung.com \
    --cc=Avri.Altman@wdc.com \
    --cc=alim.akhtar@samsung.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.