* mmc_blk_ioctl_cmd: cmd error -110, when I try set writeprotect to user data area
@ 2012-03-20 2:07 Jongman Heo
0 siblings, 0 replies; 2+ messages in thread
From: Jongman Heo @ 2012-03-20 2:07 UTC (permalink / raw)
To: linux-mmc@vger.kernel.org; +Cc: 허종만
Hi, all,
I'm seeing weird issue with MMC ioctl.
I've modified mmc-util package a bit, to set write-protection to user data area, using following argument.
idata.write_flag = 1;
idata.opcode = 28; // MMC_SET_WRITE_PROT
idata.arg = ... // 512B sector address
...
idata.flags = MMC_RSP_R1B | MMC_CMD_AC;
// As I remember, "MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC" shows no difference.
If I execute the program, it returns "ioctl: Connection timed out" error, and dmesg shows following.
[ 67.252710] sdhci-pci 0000:01:1b.0: mmc_blk_ioctl_cmd: cmd error -110
But if I run "fdisk -l /dev/mmcblk0" command before the execution, it works... no error occurs and write protection works..
Have you seen similar issue like this? fdisk command affects MMC flash status?
FYI, I'm using 2.6.35 kernel (MMC ioctl command support and some features are backported).
===========================================================================
strace output for ioctl timeout error
===========================================================================
./strace ./mmc-util userwriteprotect set /dev/mmcblk0
execve("./mmc-util", ["./mmc-util", "userwriteprotect", "set", "/dev/mmcblk0"], [/* 12 vars */]) = 0
brk(0) = 0x804e000
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7783a000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("./tls/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./tls/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/tls/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/tls/i686/sse2", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/tls/i686", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/tls/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/tls/sse2", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/tls", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/i686/sse2", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/i686", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/sse2", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
open("/usr/lib/tls/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/tls/i686/sse2", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/tls/i686", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/tls/sse2", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/tls", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/usr/lib/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i686/sse2", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/usr/lib/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i686", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/usr/lib/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/sse2", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/usr/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib", {st_mode=S_IFDIR|0775, st_size=12288, ...}) = 0
open("/lib/tls/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/i686/sse2", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/i686", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/lib/tls/sse2/libc.s[ 67.252710] sdhci-pci 0000:01:1b.0: mmc_blk_ioctl_cmd: cmd error -110
o.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/sse2", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/lib/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i686/sse2", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/lib/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i686", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/lib/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/sse2", 0x7f9e5c14) = -1 ENOENT (No such file or directory)
open("/lib/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\340l\1\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0775, st_size=8840761, ...}) = 0
mmap2(NULL, 1345928, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x776f1000
mmap2(0x77834000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x142) = 0x77834000
mmap2(0x77837000, 10632, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x77837000
close(3) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x776f0000
set_thread_area({entry_number:-1 -> 6, base_addr:0x776f06c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0x77834000, 8192, PROT_READ) = 0
mprotect(0x77857000, 4096, PROT_READ) = 0
brk(0) = 0x804e000
brk(0x806f000) = 0x806f000
open("/dev/mmcblk0", O_RDWR|O_LARGEFILE) = 3
ioctl(3, 0xc048b300, 0x7f9e60f4) = -1 ETIMEDOUT (Connection timed out)
dup(2) = 4
fcntl64(4, F_GETFL) = 0x2 (flags O_RDWR)
fstat64(4, {st_mode=S_IFCHR|0600, st_rdev=makedev(5, 1), ...}) = 0
ioctl(4, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B115200 opost isig icanon echo ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x776ef000
_llseek(4, 0, 0x7f9e5f70, SEEK_CUR) = -1 ESPIPE (Illegal seek)
write(4, "ioctl: Connection timed out\n", 28ioctl: Connection timed out
) = 28
close(4) = 0
munmap(0x776ef000, 4096) = 0
write(2, "Could not write\n", 16Could not write
) = 16
exit_group(1) = ?
===========================================================================
strace output for success (after fdisk command)
===========================================================================
./strace ./mmc-util userwriteprotect set /dev/mmcblk0
execve("./mmc-util", ["./mmc-util", "userwriteprotect", "set", "/dev/mmcblk0"], [/* 12 vars */]) = 0
brk(0) = 0x804e000
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x778d1000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("./tls/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./tls/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("./libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/tls/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/tls/i686/sse2", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/tls/i686", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/tls/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/tls/sse2", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/tls", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/i686/sse2", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/i686", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib/sse2", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/local/lib", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
open("/usr/lib/tls/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/tls/i686/sse2", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/tls/i686", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/tls/sse2", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/usr/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/tls", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/usr/lib/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i686/sse2", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/usr/lib/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i686", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/usr/lib/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/sse2", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/usr/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib", {st_mode=S_IFDIR|0775, st_size=12288, ...}) = 0
open("/lib/tls/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/i686/sse2", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/lib/tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/i686", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/lib/tls/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls/sse2", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/tls", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/lib/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i686/sse2", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/lib/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i686", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/lib/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/sse2", 0x7fefe144) = -1 ENOENT (No such file or directory)
open("/lib/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\340l\1\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0775, st_size=8840761, ...}) = 0
mmap2(NULL, 1345928, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x77788000
mmap2(0x778cb000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x142) = 0x778cb000
mmap2(0x778ce000, 10632, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x778ce000
close(3) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x77787000
set_thread_area({entry_number:-1 -> 6, base_addr:0x777876c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0x778cb000, 8192, PROT_READ) = 0
mprotect(0x778ee000, 4096, PROT_READ) = 0
brk(0) = 0x804e000
brk(0x806f000) = 0x806f000
open("/dev/mmcblk0", O_RDWR|O_LARGEFILE) = 3
ioctl(3, 0xc048b300, 0x7fefe624) = 0
exit_group(0) = ?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: mmc_blk_ioctl_cmd: cmd error -110, when I try set writeprotect to user data area
@ 2012-03-28 4:07 Jongman Heo
0 siblings, 0 replies; 2+ messages in thread
From: Jongman Heo @ 2012-03-28 4:07 UTC (permalink / raw)
To: linux-mmc@vger.kernel.org; +Cc: Jongman Heo
> ------- Original Message -------
> Sender : Jongman Heo<jongman.heo@samsung.com> S5/Senior Engineer/STB S/W R&D Lab./Samsung Electronics
> Date : 2012-03-20 11:07 (GMT+09:00)
> Title : mmc_blk_ioctl_cmd: cmd error -110, when I try set writeprotect to user data area
>
>
> Hi, all,
>
> I'm seeing weird issue with MMC ioctl.
>
> I've modified mmc-util package a bit, to set write-protection to user data area, using following argument.
>
> idata.write_flag = 1;
> idata.opcode = 28; // MMC_SET_WRITE_PROT
> idata.arg = ... // 512B sector address
> ...
> idata.flags = MMC_RSP_R1B | MMC_CMD_AC;
> // As I remember, "MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC" shows no difference.
>
> If I execute the program, it returns "ioctl: Connection timed out" error, and dmesg shows following.
>
> [ 67.252710] sdhci-pci 0000:01:1b.0: mmc_blk_ioctl_cmd: cmd error -110
>
>
> But if I run "fdisk -l /dev/mmcblk0" command before the execution, it works... no error occurs and write protection works..
>
> Have you seen similar issue like this? fdisk command affects MMC flash status?
> FYI, I'm using 2.6.35 kernel (MMC ioctl command support and some features are backported).
>
>
Today, I've tried to solve this issue again, and I found the root cause.
My eMMC flash has two boot partitions by default.
Partition table probing did access the eMMC boot partitions at the end, which leads to change EXT_CSD_PART_CONFIG value to 0x1 (boot partition 0), not 0x0 (User Area).
If I ever access any user area of eMMC (/dev/mmcblk0p1 ~ /dev/mmcblk0/12), PARTITION_ACCESS value of PARTITION_CONFIG changes to 0x0, and my write-protection ioctl for user area works. (Previously, fdisk command did the job..)
FYI, I've used NFS boot environment, and there was no access operation on eMMC user area before my ioctl command.
Obviously, commit 41e2a489 ("mmc: Ensure linux starts in eMMC user partition") does not help to solve my issue.
But I think my issue can be solved at user space level, Thanks.
Result from extcsd read command of mmc-util, right after boot :
./mmc-util extcsd read /dev/mmcblk0
[snip]
Boot configuration bytes [PARTITION_CONFIG: 0x01]
Not boot enable
R/W Boot Partition 1
[snip]
dmesg shows that eMMC boot partitions are accessed at the end of partition probing.
===============================================================
[ 1.729148] mmc0: new MMC card at address 0001
[ 1.733924] mmcblk0: mmc0:0001 M4G1FB 3.64 GiB
[ 1.738554] mmcblk0boot0: mmc0:0001 M4G1FB partition 1 1.00 MiB
[ 1.744569] mmcblk0boot1: mmc0:0001 M4G1FB partition 2 1.00 MiB
[ 1.750815] mmcblk0:
[ 1.754503] p1 p2 p3 p4 <
[ 1.758547] p5
[ 1.761614] p6
[ 1.764698] p7
[ 1.767497] p8
[ 1.770297] p9
[ 1.773377] p10
[ 1.776544] p11
[ 1.779713] p12 >
[ 1.784224] mmcblk0boot1:
[ 1.788196] unknown partition table
[ 1.792278] mmcblk0boot0:
[ 1.796321] unknown partition table
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-28 4:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-20 2:07 mmc_blk_ioctl_cmd: cmd error -110, when I try set writeprotect to user data area Jongman Heo
-- strict thread matches above, loose matches on Subject: below --
2012-03-28 4:07 Jongman Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox