mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bean Huo <beanhuo@iokpp.de>
To: Avri Altman <Avri.Altman@wdc.com>,
	"alim.akhtar@samsung.com" <alim.akhtar@samsung.com>,
	"jejb@linux.ibm.com" <jejb@linux.ibm.com>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
	"stanley.chu@mediatek.com" <stanley.chu@mediatek.com>,
	"beanhuo@micron.com" <beanhuo@micron.com>,
	"bvanassche@acm.org" <bvanassche@acm.org>,
	"tomas.winkler@intel.com" <tomas.winkler@intel.com>,
	"daejun7.park@samsung.com" <daejun7.park@samsung.com>,
	"quic_cang@quicinc.com" <quic_cang@quicinc.com>,
	"quic_nguyenb@quicinc.com" <quic_nguyenb@quicinc.com>,
	"quic_xiaosenh@quicinc.com" <quic_xiaosenh@quicinc.com>,
	"quic_richardp@quicinc.com" <quic_richardp@quicinc.com>,
	"quic_asutoshd@quicinc.com" <quic_asutoshd@quicinc.com>,
	"hare@suse.de" <hare@suse.de>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 6/6] ufs: core: Add advanced RPMB support in ufs_bsg
Date: Mon, 28 Nov 2022 20:01:27 +0100	[thread overview]
Message-ID: <12c9e417168cdc044b9fd53c30d02ccab29179b2.camel@iokpp.de> (raw)
In-Reply-To: <DM6PR04MB6575750D9C6F84FC3BE06AFBFC0D9@DM6PR04MB6575.namprd04.prod.outlook.com>

On Tue, 2022-11-22 at 11:55 +0000, Avri Altman wrote:
> > +static int ufs_bsg_exec_advanced_rpmb_req(struct ufs_hba *hba,
> > struct
> > +bsg_job *job) {
> > +       struct ufs_rpmb_request *rpmb_request = job->request;
> > +       struct ufs_rpmb_reply *rpmb_reply = job->reply;
> > +       struct bsg_buffer *payload = NULL;
> > +       enum dma_data_direction dir;
> > +       struct scatterlist *sg_list;
> > +       int rpmb_req_type;
> > +       int sg_cnt;
> > +       int ret;
> > +       int data_len;
> > +
> > +       if (hba->ufs_version < ufshci_version(4, 0) || !hba-
> > > dev_info.b_advanced_rpmb_en ||
> > +           !(hba->capabilities & MASK_EHSLUTRD_SUPPORTED))
> > +               return -EINVAL;
> > +
> > +       if (rpmb_request->ehs_req.length != 2 || rpmb_request-
> > > ehs_req.ehs_type != 1)
> > +               return -EINVAL;
> Maybe you could also check:
> In case of rpmb write, the request payload 4096 × Advanced RPMB Block
> Count,
> And same goes for response payload for rpmb read.
> 
> Thanks,
> Avri
> 

Hi Avri, 

in Spec:

"If the Block Count indicates a value greater than bRPMB_ReadWriteSize,
then the authenticated data write/read operation fails and the Result
is set to “General failure” (0001h)."


I think this should be checked in the application in userspace because
if the application passes a wrong/incorrect payload length, it will
error out and have no effect on UFS. In order to add this check in a
driver in the kernel, we need to maintain bRPMB_ReadWriteSize in kernel
space. Sometimes this is a waste of resources because we don't know if
the client will access the RPMB.

I have enabled Advanced RPMB feature in the ufs-utils as an example,
will be refered in cover-letter in the next version.

Kind regards,
Bean


  reply	other threads:[~2022-11-28 19:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-20 22:22 [PATCH v2 0/6] UFS Advanced RPMB Bean Huo
2022-11-20 22:22 ` [PATCH v2 1/6] ufs: ufs_bsg: Remove unnecessary length checkup Bean Huo
2022-12-01  6:46   ` Avri Altman
2022-11-20 22:22 ` [PATCH v2 2/6] ufs: ufs_bsg: Cleanup ufs_bsg_request Bean Huo
2022-11-22  7:51   ` Avri Altman
2022-11-20 22:22 ` [PATCH v2 3/6] ufs: core: Split ufshcd_map_sg Bean Huo
2022-11-22  8:15   ` Avri Altman
2022-11-24 14:43     ` Bean Huo
2022-11-20 22:22 ` [PATCH v2 4/6] ufs: core: Advanced RPMB detection Bean Huo
2022-11-22  9:11   ` Avri Altman
2022-11-20 22:22 ` [PATCH v2 5/6] ufs: core: Pass EHS length into ufshcd_prepare_req_desc_hdr() Bean Huo
2022-11-22  9:41   ` Avri Altman
2022-11-20 22:22 ` [PATCH v2 6/6] ufs: core: Add advanced RPMB support in ufs_bsg Bean Huo
2022-11-22 11:05   ` Avri Altman
2022-11-22 11:27     ` Avri Altman
2022-11-22 11:55   ` Avri Altman
2022-11-28 19:01     ` Bean Huo [this message]
2022-11-28 20:07       ` Avri Altman

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=12c9e417168cdc044b9fd53c30d02ccab29179b2.camel@iokpp.de \
    --to=beanhuo@iokpp.de \
    --cc=Avri.Altman@wdc.com \
    --cc=alim.akhtar@samsung.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=daejun7.park@samsung.com \
    --cc=hare@suse.de \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=quic_asutoshd@quicinc.com \
    --cc=quic_cang@quicinc.com \
    --cc=quic_nguyenb@quicinc.com \
    --cc=quic_richardp@quicinc.com \
    --cc=quic_xiaosenh@quicinc.com \
    --cc=stanley.chu@mediatek.com \
    --cc=tomas.winkler@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®