lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <201501262204.59305@pali>
Date:	Mon, 26 Jan 2015 22:04:59 +0100
From:	Pali Rohár <pali.rohar@...il.com>
To:	Chris Ball <chris@...ntf.net>, Ulf Hansson <ulf.hansson@...aro.org>
Cc:	linux-mmc@...r.kernel.org, linux-kernel@...r.kernel.org,
	Pavel Machek <pavel@....cz>,
	Ivaylo Dimitrov <ivo.g.dimitrov.75@...il.com>,
	Sebastian Reichel <sre@...nel.org>,
	Aaro Koskinen <aaro.koskinen@....fi>
Subject: mmc does not work in qemu n900

Hello,

for unknown reason kernel in qemu n900 machine is not able to 
detect internal eMMC memory. External SD card is detected without 
problem.

If I apply this one-line patch eMMC in qemu start working:

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 9584bff..0d4461c 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2337,6 +2337,9 @@ static int mmc_rescan_try_freq(
 		return 0;
 	if (!mmc_attach_sd(host))
 		return 0;
+
+	mmc_go_idle(host);
+
 	if (!mmc_attach_mmc(host))
 		return 0;

I played with mmc and qemu n900 a bit and also this simple patch 
(without first) fix problem (that mmc is not detected by kernel):

diff --git a/drivers/mmc/core/mmc_ops.c 
b/drivers/mmc/core/mmc_ops.c
index 3b044c5..0c93a2c 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -157,6 +157,10 @@ int mmc_send_op_cond(
 
 	BUG_ON(!host);
 
+	/* reset mmc before calling op_cond */
+	memset(&cmd, 0, sizeof(struct mmc_command));
+	mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES);
+
 	cmd.opcode = MMC_SEND_OP_COND;
 	cmd.arg = mmc_host_is_spi(host) ? 0 : ocr;
 	cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R3 | MMC_CMD_BCR;
 

I have no idea where is problem. I also do not understand mmc 
kernel code, but second patch I have on my HDD since 2.6.37.

Can somebody with knowledge of mmc subsystem look at this 
problem? Why any of these two patches fix problem when mmc is not 
detected by kernel in qemu (machine n900)? Detection of mmc fails 
because function mmc_send_op_cond() without one of above patches 
fails.

-- 
Pali Rohár
pali.rohar@...il.com

Download attachment "signature.asc " of type "application/pgp-signature" (199 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ