[U-Boot] Problems with D-cache invalidation in Freescale eSDHC driver

Peng Fan van.freenix at gmail.com
Fri Mar 18 14:53:56 CET 2016


Hi Mario,

On Fri, Mar 18, 2016 at 09:16:48AM +0100, mario.six at gdsys.cc wrote:
>
>Hello,
>
>I've been working on a QorIQ P1022 board (controlcenterd) to run the newest
>U-Boot on it, and I encountered some strange behavior.
>
>During boot, we get these error messages
>
>"
>ERROR: Cannot import environment: errno = 12
>
>at common/env_common.c:221/env_import()
>*** Warning - import failed, using default environment
>
>ERROR: Environment import failed: errno = 12
>
>at common/env_common.c:123/set_default_env()
>## Can't malloc 9 bytes
>"
>
>After bisecting, I found out that the commit 4683b22 (mmc:fsl_esdhc
>invalidate dcache before read) apparently causes this. With the additional
>d-cache invalidations in place, malloc and free calls fail.
>
>Now, after some experimenting, I found out that deactivating the d-cache
>invalidation when reading the first sector is enough; that is, if one
>replaces the first invalidation
>
>"
>if (data->flags & MMC_DATA_READ)
>	check_and_invalidate_dcache_range(cmd, data);
>"
>
>with
>
>"
>if (data->flags & MMC_DATA_READ && (cmd->cmdidx != MMC_CMD_READ_SINGLE_BLOCK
>|| cmd->cmdarg != 0))
>	check_and_invalidate_dcache_range(cmd, data);
>"
>
>in fsl_esdhc.c, it seems to work, but I have no idea why that is the case.
>
>Any ideas would be greatly appreciated.

Before you chaning:
"
if (data->flags & MMC_DATA_READ)
	check_and_invalidate_dcache_range(cmd, data);
"

can you please try this, https://patchwork.ozlabs.org/patch/511889/ and
kindly give some feedback whether the patch can fix you issue or not?

I strongly agree that U-Boot should flow the Linux DMA flow to avoid
potential write back and speculative read which may cause DMA data
be polluted.

Anyway please first try first invalidate L2, then invalidate L1.

I plan to pick the upper patch or rework for DMA usage, but have not
began the work (:

Thanks,
Peng.

>
>Best regards,
>Mario
>
>
>_______________________________________________
>U-Boot mailing list
>U-Boot at lists.denx.de
>http://lists.denx.de/mailman/listinfo/u-boot


More information about the U-Boot mailing list