OSDN Git Service

mmc: card: Skip regular block io operations for RPMB partitions
authorAbbas Raza <Abbas_Raza@mentor.com>
Fri, 12 Sep 2014 16:39:06 +0000 (00:39 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 24 Dec 2014 17:02:18 +0000 (01:02 +0800)
Idea behind this patch is to skip all the regular block io operations
for RPMB partitions because these are not regular partitions and require
a different command sequence for reading and writing. RPMB partitions
should only be accessed via ioctl. Without this patch we see following
issues with some eMMC devices

dd if=/dev/mmcblk1rpmb of=/dev/null bs=1 count=1
[  124.185513] mmcblk1rpmb: error -110 transferring data, sector 0, nr 32, cmd response 0x900, card status 0xb00
[  124.195506] mmcblk1rpmb: retrying using single block read
[  124.201035] mmcblk1rpmb: timed out sending r/w cmd command, card status 0x400900
[  124.208559] mmcblk1rpmb: timed out sending r/w cmd command, card status 0x400900
[  124.216049] mmcblk1rpmb: timed out sending r/w cmd command, card status 0x400900
[  124.223567] mmcblk1rpmb: timed out sending r/w cmd command, card status 0x400900
[  124.231087] mmcblk1rpmb: timed out sending r/w cmd command, card status 0x400900
[  124.238600] mmcblk1rpmb: timed out sending r/w cmd command, card status 0x400900
[  124.246012] end_request: I/O error, dev mmcblk1rpmb, sector 0
[  124.251773] Buffer I/O error on device mmcblk1rpmb, logical block 0
[  124.258065] end_request: I/O error, dev mmcblk1rpmb, sector 8
[  124.263822] Buffer I/O error on device mmcblk1rpmb, logical block 1
[  124.270102] end_request: I/O error, dev mmcblk1rpmb, sector 16
[  124.275944] Buffer I/O error on device mmcblk1rpmb, logical block 2
[  124.282222] end_request: I/O error, dev mmcblk1rpmb, sector 24
[  124.288064] Buffer I/O error on device mmcblk1rpmb, logical block 3
[  129.717711] mmcblk1rpmb: error -110 transferring data, sector 0, nr 8, cmd response 0x900, card status 0xb00
[  129.727590] mmcblk1rpmb: retrying using single block read
[  129.733088] mmcblk1rpmb: timed out sending r/w cmd command, card status 0x400900
[  129.740605] mmcblk1rpmb: timed out sending r/w cmd command, card status 0x400900
[  129.748121] mmcblk1rpmb: timed out sending r/w cmd command, card status 0x400900
[  129.755612] mmcblk1rpmb: timed out sending r/w cmd command, card status 0x400900
[  129.763125] mmcblk1rpmb: timed out sending r/w cmd command, card status 0x400900
[  129.770639] mmcblk1rpmb: timed out sending r/w cmd command, card status 0x400900
[  129.778073] end_request: I/O error, dev mmcblk1rpmb, sector 0
[  129.783834] Buffer I/O error on device mmcblk1rpmb, logical block 0
dd: /dev/mmcblk1rpmb: Input/output error

drivers/mmc/card/block.c

index 1fa4c80..c0f16c7 100644 (file)
@@ -2019,6 +2019,13 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
                /* claim host only for the first request */
                mmc_get_card(card);
 
+       if (md->area_type & MMC_BLK_DATA_AREA_RPMB) {
+               if (req)
+                       blk_end_request_all(req, 0);
+               ret = 0;
+               goto out;
+       }
+
        ret = mmc_blk_part_switch(card, md);
        if (ret) {
                if (req) {