mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Steve Schefter <steve@scheftech.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] Avoid SDRAM access crash
Date: Wed, 4 Jul 2012 08:51:01 +0200	[thread overview]
Message-ID: <20120704065101.GD2698@pengutronix.de> (raw)
In-Reply-To: <4FF2D611.2040207@scheftech.com>

On Tue, Jul 03, 2012 at 07:22:57AM -0400, Steve Schefter wrote:
> Hi Sascha.
> 
> >I wonder why this has never hit me. On what hardware did you see this?
> 
> Me too.  All I can say is that the timing is tight.  I see crashes
> at various DRAM addresses, all depending on how much was left in
> cache when the tlb invalidate was done.
> 
> I'm using the Phytec phyCORE-OMAP44xx card.
> 
> >Does the following patch solve your problem aswell?
> 
> It does.  I see that routine contains a cache flush as well.

Ok, thanks for testing. I applied my version because it flushes only
the relevant parts of the cache and looks more like C ;)

Sascha

> 
> Regards,
> 	Steve
> 
> >
> >8<----------------------------------------------------
> >
> >ARM mmu: flush page tables in arm_mmu_remap_sdram()
> >
> >Signed-off-by: Sascha Hauer<s.hauer@pengutronix.de>
> >---
> >  arch/arm/cpu/mmu.c |    5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> >diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c
> >index 55b07a4..607f357 100644
> >--- a/arch/arm/cpu/mmu.c
> >+++ b/arch/arm/cpu/mmu.c
> >@@ -147,7 +147,7 @@ static int arm_mmu_remap_sdram(struct memory_bank *bank)
> >  	if ((phys&  (SZ_1M - 1)) || (bank->size&  (SZ_1M - 1)))
> >  		return -EINVAL;
> >
> >-	ptes = memalign(0x400, num_ptes * sizeof(u32));
> >+	ptes = memalign(PAGE_SIZE, num_ptes * sizeof(u32));
> >
> >  	debug("ptes: 0x%p ttb_start: 0x%08lx ttb_end: 0x%08lx\n",
> >  			ptes, ttb_start, ttb_end);
> >@@ -165,6 +165,9 @@ static int arm_mmu_remap_sdram(struct memory_bank *bank)
> >  		pte += 256;
> >  	}
> >
> >+	dma_flush_range((unsigned long)ttb, (unsigned long)ttb + 0x4000);
> >+	dma_flush_range((unsigned long)ptes, num_ptes * sizeof(u32));
> >+
> >  	tlb_invalidate();
> >
> >  	return 0;
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-07-04  6:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-02 17:22 steve
2012-07-03  7:36 ` Sascha Hauer
2012-07-03 11:22   ` Steve Schefter
2012-07-04  6:51     ` Sascha Hauer [this message]
2012-07-04 11:18       ` Steve Schefter

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=20120704065101.GD2698@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=steve@scheftech.com \
    /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