All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avri Altman <Avri.Altman@sandisk.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Paolo Valente <paolo.valente@linaro.org>
Subject: RE: Outstanding MQ questions from MMC
Date: Sat, 15 Apr 2017 19:24:55 +0000	[thread overview]
Message-ID: <BY2PR0401MB0901B0167734FEFB7F1E5DF6E5040@BY2PR0401MB0901.namprd04.prod.outlook.com> (raw)
In-Reply-To: <CACRpkdbstMEC-_JcEfEm1debQRPeYBDmTPm0L_jGFnrgRZg1Zw@mail.gmail.com>

WW91IGNhbiBzZWUgaG93IGl0J3MgZG9uZSBpbiBtbWNfYmxrX2lvY3RsX3JwbWJfY21kKCkuDQoN
ClRoZSBSUE1CIHByb3RvY29sIGRlZmluZXMgNiB0eXBlcyBvZiBhY2Nlc3NlczoNCkFjY2Vzc2Vz
IHRoYXQgcGVyZm9ybXMgcmVhZCBvcGVyYXRpb24gKHJlYWQgY291bnRlciwgcmVhZCBkYXRhLCBh
bmQgcmVhZCBjb25maWd1cmF0aW9uKSAtIHJlcXVpcmVzIHNlbmRpbmcgMiByZXF1ZXN0cy4gDQpB
Y2Nlc3NlcyB0aGF0IHBlcmZvcm1zIHdyaXRlIG9wZXJhdGlvbiAocHJvZ3JhbSBrZXksIHdyaXRl
IGRhdGEsIHdyaXRlIGNvbmZpZ3VyYXRpb24pIC0gcmVxdWlyZXMgc2VuZGluZyAzIHJlcXVlc3Rz
LA0KQnV0IHlvdSBtdXN0IGRvIHJlYWQgY291bnRlciBiZWZvcmVoYW5kIChhY2NlcHQgZnJvbSBw
cm9ncmFtIGtleSksIGhlb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cyB0aGUNCj4gNSByZXF1ZXN0cy4NCj4g
DQo+IFRodXMgd2UgbmVlZCB0byBzZW5kIGEgc2luZ2xlIGN1c3RvbSByZXF1ZXN0IGNvbnRhaW5p
bmcgYSBsaXN0IG9mIDUgdGhpbmdzIHRvDQo+IGRvLCBhbmQgcmV0dXJuIGFmdGVyIHRoYXQuDQo+
IA0KPiBPciBkbyB5b3UgbWVhbiB0aGF0IHdlIHJldHVybiB0byB1c2Vyc3BhY2UgaW5iZXR3ZWVu
IHRoZXNlIGRpZmZlcmVudA0KPiByZXF1ZXN0cyBhbmQgdGhlIHNlcXVlbmNpbmcgaXMgZG9uZSBp
biB1c2Vyc3BhY2U/DQo+IA0KPiBJIGhvcGUgbm90IGJlY2F1c2UgdGhhdCBzb3VuZHMgZnJhZ2ls
ZSwgbGlrZSB1c2Vyc3BhY2UgY291bGQgY3Jhc2ggYW5kIGxlYXZlDQo+IHRoZSBob3N0IGxvY2sg
ZGFuZ2xpbmcgOi8NCj4gDQo+IFlvdXJzLA0KPiBMaW51cyBXYWxsZWlqDQo=

WARNING: multiple messages have this Message-ID (diff)
From: Avri Altman <Avri.Altman@sandisk.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Paolo Valente <paolo.valente@linaro.org>
Subject: RE: Outstanding MQ questions from MMC
Date: Sat, 15 Apr 2017 19:24:55 +0000	[thread overview]
Message-ID: <BY2PR0401MB0901B0167734FEFB7F1E5DF6E5040@BY2PR0401MB0901.namprd04.prod.outlook.com> (raw)
In-Reply-To: <CACRpkdbstMEC-_JcEfEm1debQRPeYBDmTPm0L_jGFnrgRZg1Zw@mail.gmail.com>

You can see how it's done in mmc_blk_ioctl_rpmb_cmd().

The RPMB protocol defines 6 types of accesses:
Accesses that performs read operation (read counter, read data, and read configuration) - requires sending 2 requests. 
Accesses that performs write operation (program key, write data, write configuration) - requires sending 3 requests,
But you must do read counter beforehand (accept from program key), hence the 5 different requests.

The standard does not define a "special" request that does it all in once, 
but expects a pre-define series of cmd18 & cmd25 for each access type, 
in which the payload are 512 bytes frames in a pre-defined structure.
  
Cheers,
Avri

> -----Original Message-----
> From: Linus Walleij [mailto:linus.walleij@linaro.org]
> Sent: Saturday, April 15, 2017 9:35 PM
> To: Avri Altman <Avri.Altman@sandisk.com>
> Cc: Arnd Bergmann <arnd@arndb.de>; Ulf Hansson
> <ulf.hansson@linaro.org>; linux-mmc@vger.kernel.org; linux-
> block@vger.kernel.org; Jens Axboe <axboe@kernel.dk>; Christoph Hellwig
> <hch@lst.de>; Adrian Hunter <adrian.hunter@intel.com>; Paolo Valente
> <paolo.valente@linaro.org>
> Subject: Re: Outstanding MQ questions from MMC
> 
> On Fri, Apr 14, 2017 at 8:41 PM, Avri Altman <Avri.Altman@sandisk.com>
> wrote:
> > [Me]
> >> 2. Turn RPMB and other ioctl() MMC operations into mmc_queue_req
> >>    things and funnel them into the block scheduler
> >>    using REQ_OP_DRV_IN/OUT requests.
> >>
> >
> > Accessing the RPMB is done via a strange protocol, in which each access is
> comprised of several requests.
> > For example, writing to the RPMB will require sending 5 different requests:
> > 2 requests to read the write counter, and then 3 more requests for the
> write operation itself.
> >
> > Once the sequence has started, it should not get interfered by other
> requests, or the operation will fail.
> 
> So I guess currently something takes a host lock and then performs the
> 5 requests.
> 
> Thus we need to send a single custom request containing a list of 5 things to
> do, and return after that.
> 
> Or do you mean that we return to userspace inbetween these different
> requests and the sequencing is done in userspace?
> 
> I hope not because that sounds fragile, like userspace could crash and leave
> the host lock dangling :/
> 
> Yours,
> Linus Walleij

  reply	other threads:[~2017-04-15 19:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29  3:09 Outstanding MQ questions from MMC Linus Walleij
2017-03-30 12:42 ` Arnd Bergmann
2017-03-30 16:39   ` Ulf Hansson
2017-03-31  8:43     ` Arnd Bergmann
2017-04-13 13:22       ` Linus Walleij
2017-04-14 18:41         ` Avri Altman
2017-04-14 18:41           ` Avri Altman
2017-04-15 18:34           ` Linus Walleij
2017-04-15 19:24             ` Avri Altman [this message]
2017-04-15 19:24               ` Avri Altman
2017-04-18 15:31               ` Alex Lemberg
2017-04-18 15:31                 ` Alex Lemberg
2017-05-18  9:36                 ` Linus Walleij
2017-04-15 10:20         ` Ulf Hansson
2017-05-18  9:40 ` Christoph Hellwig

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=BY2PR0401MB0901B0167734FEFB7F1E5DF6E5040@BY2PR0401MB0901.namprd04.prod.outlook.com \
    --to=avri.altman@sandisk.com \
    --cc=adrian.hunter@intel.com \
    --cc=arnd@arndb.de \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=paolo.valente@linaro.org \
    --cc=ulf.hansson@linaro.org \
    /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.