Aply Patch for eMMC problem: Don't initialize partitions on RPMB flagged areas.

  5 years ago

Hy Everybody....

I am writing here from a modern eMMC Laptop/Tablet named
Medion Akoya S6214T

Confirmed the Bug by Nell Hardcastle in May 2014 with his following original Comment:

Newer eMMC flash devices have a small partition (several megabytes) that is used to store OEM security keys (for things like DRM or encrypting private app data under something like Android). Linux implements support for the Replay Protected Memory Block partition in the form of ioctls. It's a pretty raw access layer, most of the implementation on these devices rightfully lives in userland instead of the kernel.

If you have one of these devices in some configurations you will get errors like this.

[ 11.361670] mmc0: Got data interrupt 0x00000002 even though no data operation was in progress.
[ 11.363818] mmcblk0rpmb: error -110 transferring data, sector 8064, nr 8, cmd response 0x900, card status 0xb00
[ 11.363932] mmcblk0rpmb: retrying using single block read
[ 11.365980] mmcblk0rpmb: timed out sending r/w cmd command, card status 0x400900
[ 11.368122] mmcblk0rpmb: timed out sending r/w cmd command, card status 0x400900
[ 11.370246] mmcblk0rpmb: timed out sending r/w cmd command, card status 0x400900
[ 11.372380] mmcblk0rpmb: timed out sending r/w cmd command, card status 0x400900
[ 11.374503] mmcblk0rpmb: timed out sending r/w cmd command, card status 0x400900
[ 11.376637] mmcblk0rpmb: timed out sending r/w cmd command, card status 0x400900
[ 11.376723] end_request: I/O error, dev mmcblk0rpmb, sector 8064
[ 11.376793] Buffer I/O error on device mmcblk0rpmb, logical block 1008

On the Asus T100 tablet I was testing with, during boot Ubuntu would hang while this happened for 5-10 seconds each time and it would happen 3 or 4 times before the boot would finish. Some disk operations later would try to check that partition and cause the same sort of I/O hangs. I went looking for a udev rule to fix it but it kept happening despite removing the MMC setup rules. To finally fix it, I ended up writing this small kernel patch.

From 0f5081c323c52ac842b01fd79df3b3c251f7aca9 Mon Sep 17 00:00:00 2001
From: Nell Hardcastle
Date: Thu, 29 May 2014 22:06:50 -0700
Subject: [PATCH] eMMC: Don't initialize partitions on RPMB flagged areas.

Prevents a lot of pointless hanging at boot on some devices.
drivers/mmc/card/block.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 452782b..dd85dcf 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -2255,7 +2255,7 @@ static int mmc_blk_alloc_parts(struct mmc_card *card, struct mmc_blk_data *md)
return 0;

for (idx = 0; idx < card->nr_parts; idx++) {
- if (card->part[idx].size) {
+ if (card->part[idx].size && !(card->part[idx].area_type & MMC_BLK_DATA_AREA_RPMB)) {
ret = mmc_blk_alloc_part(card, md,
card->part[idx].size >> 9,

This isn't suitable for contributing to the kernel, if you actually do need to use the RPMB partition for something you might need the partition setup, but for anyone else having this problem this might be useful. The right way to do this is probably deeper in the initialization so that it doesn't entirely disable the device.

So my Idea, to make it possible to install Mint on this Tablets Like
his Asus T100 and mine, is to boot without this support and apply the above Kernel Patch in the next install Versions/ISO s of Mint with a choice to use the patch (maybe as a boot option) till the handling of RPMB Partitions is generally solved !!


Latest comments
xenopeek 5 years ago

Linux Mint does not patch kernels but uses upstream Ubuntu / Debian (depending on your edition) kernels. Such a patch would have to be submitted to upstream kernel maintainers or, ideally, to kernel developers directly.

lib2know 5 years ago

Everything looks like @zyklop really knows what he does (and where).
It looks very trustworthy. And i agree with @mikefreeman.
Maybe it can be posted on tutorials, too.

I wish more ideas like that (@zyklop) and less declining comments.

Hammer459 5 years ago

Publishing code here is not trustworthy.
Wanting a fix in the os _IS_ a support issue.
Posting code to Clem is good, but the proper place is to kernel.org

mikefreeman 5 years ago

@Hammer459 - This is not a support issue, as this person is not only presenting the problem, but already has the solution (in fact, has written the patch himself). This is a good idea! Although @remoulder does have a good point, that maybe @zyklop should contribute the patch directly to the developers. That might get the job done even faster.

lib2know 5 years ago

First time i see someone here, to have an idea and the solution at the same time. Great!

remoulder 5 years ago

If you wish to contribute code you should contact the developers directly not post here

Hammer459 5 years ago

This is a support issue that should be posted in the Forums