linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Loic PALLARDY <loic.pallardy@st.com>
To: Krishna Konda <kkonda@codeaurora.org>
Cc: Chris Ball <cjb@laptop.org>,
	Loic PALLARDY STE <loic.pallardy-ext@stericsson.com>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	STEricsson_nomadik_linux <STEricsson_nomadik_linux@list.st.com>
Subject: Re: [PATCH v3 0/5] mmc: Add access to RPMB partition
Date: Wed, 21 Nov 2012 10:55:55 +0100	[thread overview]
Message-ID: <50ACA52B.4040201@st.com> (raw)
In-Reply-To: <1353437680.18639.737.camel@kkonda-linux.qualcomm.com>

Hi Krishna,

On 11/20/2012 07:54 PM, Krishna Konda wrote:
>
> Loic/Linus/Chris, I think the IOCTL is not complete in terms of handling
> the RPMB requests. Here is why I think that is - let me know your
> opinion
>
> There are four request types that are needed to be supported - two under
> read category and two under write. They are
>
> Reads
> -------
> 1. Read Write Counter
> 2. Authenticated data read
>
>
> Writes
> -------
> 1. Provision RPMB key (though it might be done in a secure environment)
> 2. Authenticated data read
Agree
>
> While its given that the rpmb data frames are going to have that
> information encoded in it and the frames will be generated by a secure
> piece of code, the request types can be classified as above.
>
> The ioctl interface to do this but currently that does the following
> 1. Switch partition
> 2. Set block count
> 3. One command - whatever is passed in by the userspace application.
>
> So here are the set of commands that need to happen in a rpmb read
> operation
> 1. Switch partition
> 2. Set block count
> 3. Write data frame - CMD25 to write the rpmb data frame
> 4. Set block count
> 5. Read the data - CMD18 to do the actual read
>
> I am guessing that you would expect the userspace application too call
> into the ioctl twice to take care of the 4&  5
Yes exactly, you have to first send your command and then to read the 
result, 2 IOCTLs are needed

> and that might not be an
> issue if there was no request processed for mmcqd i.e. no other
> process/thread claims the host. But if that were to happen, then the
> rpmb operation will fail - please let me know if this assumption or my
> understanding of the spec is wrong.
I tested this and I don't identify issue.
I have Android running in parallel of my test and lot of other mmc 
accesses are performed in parallel, so my test suite doesn't guarantee 
that the 2 ioctls are contiguous.
I had the same understanding of the RPMB specification, but after tests 
and discussion with our eMMC provider, it appears that RPMB state 
machine is independent of the rest.
>
> Similarly for rpmb write operation, these are the step involved
> 1. Switch partition
> 2. Set block count
> 3. Write data frame - CMD25 to write the rpmb data frame with data
> 4. Set block count
> 5. Read the data - CMD25 to write rpmb data frame indicating that rpmb
> result register is about to be read
> 6. Set block count
> 7. Read rpmb result - CMD18 to read the rpmb result register
>
> In the case of write, there are an additional two commands compared to
> reads. Since all of these needs to be done in one shot, I believe the
> current ioctl is not sufficient and this can be handled in the following
> ways

No needed to do it in one shot. You can send the write and check status 
later.
I tested it, didn't detect any problem.
>
> 1. Extend the current ioctl to handle both cases
> 2. Add a new ioctl cmd for rpmb requests
It was my first implementation, but after internal STE review and eMMC 
check I merge it in existing ioctl.

Please let me know if you detect any issue.

Regards,
Loic
>
> Personally I think adding another ioctl is a better way to do this since
> the current ioctl will get cumbersome and technically the rpmb requests
> are different kind of requests that need to be done atomically. I  am
> coding this up as a separate ioctl but before I post the patch, I wanted
> feedback on this approach.
>
>

  reply	other threads:[~2012-11-21  9:56 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-06 15:12 [PATCH v3 0/5] mmc: Add access to RPMB partition Loic Pallardy
2012-08-06 15:12 ` [PATCH v3 1/5] mmc: core: Expose " Loic Pallardy
     [not found]   ` <CAJOk3oHfTMr7-esASZKV0kmiFmeGzD1OjgwMZrTtz8Pk61Lswg@mail.gmail.com>
2012-11-16 21:32     ` Fwd: " Krishna Konda
2012-08-06 15:12 ` [PATCH v3 2/5] mmc: card: Do not scan RPMB partitions Loic Pallardy
     [not found]   ` <CAJOk3oE2gXH1AQQBqq-nuLCEb4--vcMZRYnQJNWOdCP8c0JcAA@mail.gmail.com>
2012-11-16 21:31     ` Fwd: " Krishna Konda
2012-08-06 15:12 ` [PATCH v3 3/5] mmc: core: Extend sysfs to ext_csd parameters for RPMB support Loic Pallardy
     [not found]   ` <CAJOk3oHSTygZBkj847a+OKcSAB8=G0YN8vrz07080sUdPB0+_Q@mail.gmail.com>
2012-11-16 21:27     ` Fwd: " Krishna Konda
2012-08-06 15:12 ` [PATCH v3 4/5] mmc: core: Add mmc_set_blockcount feature Loic Pallardy
     [not found]   ` <CAJOk3oEvYUEBAP729nbkxA9XKn=1H6076OPLDSsvq5GP7Z8Qxg@mail.gmail.com>
2012-11-16 21:26     ` Fwd: " Krishna Konda
2012-08-06 15:12 ` [PATCH v3 5/5] mmc: card: Add RPMB support in IOCTL interface Loic Pallardy
2012-08-21  7:17   ` shashidhar hiremath
2012-08-22  7:43     ` Loic pallardy
     [not found]   ` <CAJOk3oERiGjxm-u6iGZLxK0Mq5noC76d33ojwVtY3gtdRBju3g@mail.gmail.com>
2012-11-16 21:23     ` Fwd: " Krishna Konda
     [not found] ` <CAJOk3oGMtZvrkw9ic306BKNSKCAzPQCYmJrvq5=zDi1pHjjQxg@mail.gmail.com>
2012-11-14 21:14   ` Fwd: [PATCH v3 0/5] mmc: Add access to RPMB partition Krishna Konda
2012-11-15  8:04     ` Linus Walleij
2012-11-16 21:11       ` Krishna Konda
2012-11-17 20:19         ` Linus Walleij
2012-11-17 23:12 ` Chris Ball
2012-11-19 10:09   ` Linus Walleij
2012-11-19 18:12   ` Krishna Konda
2012-11-20  8:25     ` Loic PALLARDY
2012-11-20 18:54       ` Krishna Konda
2012-11-21  9:55         ` Loic PALLARDY [this message]
2012-11-21 11:02           ` Sundar J. Dev
2012-11-21 17:32             ` Loic PALLARDY
2012-11-22  4:32               ` Sundar J. Dev

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=50ACA52B.4040201@st.com \
    --to=loic.pallardy@st.com \
    --cc=STEricsson_nomadik_linux@list.st.com \
    --cc=cjb@laptop.org \
    --cc=kkonda@codeaurora.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=loic.pallardy-ext@stericsson.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;
as well as URLs for NNTP newsgroup(s).