Ulf Hansson ulf.hansson@linaro.org writes:
On Thu, 15 Oct 2020 at 12:44, Alex Bennée alex.bennee@linaro.org wrote:
Alex Bennée via Stratos-dev stratos-dev@op-lists.linaro.org writes:
Hi Ulf,
Ilias told me you were the eMMC guru so your might be best placed to advise on this problem.
Ping?
This slipped through in my email filtering, my apologies.
Anyway, let me try to help.
<snip>
However I'm wary of adding an open ended pass-through definition, especially anything that might tempt an implementer to start trying to read and write data using eMMC commands instead of the proper virtio commands.
- What eMMC commands are needed for a probe?
I suggest you have a look at the mmc core in the kernel. More precisely:
drivers/mmc/core/core.c, drivers/mmc/core/mmc.c and drivers/mmc/core/mmc_ops.c. These files implement the eMMC specification, in principle.
Start following the path from the mmc_rescan() function, where you would end up in mmc_attach_mmc() after a while, which is the piece of code dealing with the eMMC card initializations.
Note that, depending on the greater speed mode you want to support, the more complicated becomes the initialization.
I'm not looking to emulate an eMMC device but to provide enough support that an eMMC stack which understands RPMB partitions can operate with a virtio-rpmb backend. It may well be that the driver model is just not suited to being plumbed into existing eMMC software stacks.
- What are the bounds of frame sizes for those commands?
Not sure what you mean by frame size here. Most of the initialization commands don't transmit any data from an I/O point of view, but are sent on a single command line.
In some cases, there are 512 bytes being transmitted on the 8 data lines, along with control commands on a separate line.
- I'm currently overloading the wasted stuff[196] bytes to the encapsulation and it would get complicated if we extended into the used fields.
No clue what you are talking about, sorry.
The virtio-rpmb frame is 512 bytes of which 196 bytes is currently unused by the specification. If I can fit everything into currently unused bytes that makes things simpler - but it depends on the maximum frame size needed to do a negotiation that satisfies the software stack. I'm not expecting to transfer any data aside from 256 byte RPMB data frames.
- Should we mandate certain responses?
The eMMC spec mandates the responses, so not sure what you propose.
- e.g. 0 "normal" size, eMMC version 4.1 etc
I clearly don't have the full context here, but I understand that you are looking at an abstraction layer above eMMC, but perhaps even block devices in general?
Seems I need to get a better picture, if I should be able to guide you in some direction.
We can run a HO or if you can point me to some other documentations!?
Sure - maybe a HO with Ilias and myself so he can lay out the problem he's trying to solve and I can explain what the virtio-rpmb device provides.
Kind regards Uffe