From mboxrd@z Thu Jan 1 00:00:00 1970 From: Krishna Konda Subject: Re: [PATCH v3 0/5] mmc: Add access to RPMB partition Date: Tue, 20 Nov 2012 10:54:40 -0800 Message-ID: <1353437680.18639.737.camel@kkonda-linux.qualcomm.com> References: <1344265951-22437-1-git-send-email-loic.pallardy-ext@stericsson.com> <87mwyf7rjp.fsf@octavius.laptop.org> <1353348746.25586.1.camel@kkonda-linux.qualcomm.com> <50AB3E5F.3010906@st.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Return-path: Received: from wolverine01.qualcomm.com ([199.106.114.254]:23248 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751849Ab2KTSyl (ORCPT ); Tue, 20 Nov 2012 13:54:41 -0500 In-Reply-To: <50AB3E5F.3010906@st.com> Sender: linux-mmc-owner@vger.kernel.org List-Id: linux-mmc@vger.kernel.org To: Loic PALLARDY Cc: Chris Ball , Loic PALLARDY STE , "linux-mmc@vger.kernel.org" , Linus Walleij , STEricsson_nomadik_linux On Tue, 2012-11-20 at 09:25 +0100, Loic PALLARDY wrote: > > I have a test program I'll integrate in mmc-utils. > > Regards, > Loic 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 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 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. 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 1. Extend the current ioctl to handle both cases 2. Add a new ioctl cmd for rpmb requests 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. -- Thanks, Krishna Konda ----------------------------------------------------------------------- Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation -----------------------------------------------------------------------