public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Peng Fan <van.freenix@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] Problems with D-cache invalidation in Freescale eSDHC driver
Date: Fri, 18 Mar 2016 21:53:56 +0800	[thread overview]
Message-ID: <20160318135354.GA21596@linux-7smt.suse> (raw)
In-Reply-To: <20160318091648.Horde.QsN1Tk-Oz9hiaPPgJvnIWw1@webmail.df.eu>

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

  reply	other threads:[~2016-03-18 13:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-18  8:16 [U-Boot] Problems with D-cache invalidation in Freescale eSDHC driver mario.six at gdsys.cc
2016-03-18 13:53 ` Peng Fan [this message]
2016-03-21  9:32   ` mario.six at gdsys.cc
2016-03-21  9:53     ` Peng Fan
2016-03-21 16:02       ` york sun
2016-03-22  8:17         ` Mario Six

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160318135354.GA21596@linux-7smt.suse \
    --to=van.freenix@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox