mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: "Eric Bénard" <eric@eukrea.com>
Cc: "barebox@lists.infradead.org" <barebox@lists.infradead.org>
Subject: Re: magicvar breaks tftp (or ramfs)
Date: Tue, 29 May 2012 18:23:50 +0200	[thread overview]
Message-ID: <20120529162350.GY30400@pengutronix.de> (raw)
In-Reply-To: <20120529104844.4df2752d@eb-e6520>

On Tue, May 29, 2012 at 10:48:44AM +0200, Eric Bénard wrote:
> Hi Sascha,
> 
> > 
> > I really want to believe this, but I wouldn't be so sure. I think
> > it's more likely that you found a bug in barebox that your new
> > toolchain happens to trigger. Could you provide the objdump of
> > show_progress along with a complete stack trace including register
> > contents?
> > 
> here is the full trace.
> There is something strange as it seems a wrong value gets loaded into R3
> leading to the error.

I recently found a bug that could match this description. The following
patch fixes this, but currently I don't now what other places might be
affected. It's a matter of reviewing all places where dma_inv_range is
used. Does the problem persist when you turn off the MMU?

Sascha



From f11b34785ba3d33854c752e81c43de0271d19d35 Mon Sep 17 00:00:00 2001
From: Sascha Hauer <s.hauer@pengutronix.de>
Date: Thu, 24 May 2012 16:02:37 +0200
Subject: [PATCH] USB gadget fsl: request cacheline aligned buffer

The fsl udc driver allocates a buffer for small requests. The
driver then calls dma_inv_range later on it. This buffer happens
to be not cacheline aligned which means that a dma_inv_range can
corrupt other memory around the buffer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/usb/gadget/fsl_udc.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/fsl_udc.c b/drivers/usb/gadget/fsl_udc.c
index 5b64ec2..96cdb30 100644
--- a/drivers/usb/gadget/fsl_udc.c
+++ b/drivers/usb/gadget/fsl_udc.c
@@ -2109,7 +2109,8 @@ static int struct_udc_setup(struct fsl_udc *udc,
 	udc->status_req = container_of(fsl_alloc_request(NULL),
 			struct fsl_req, req);
 	/* allocate a small amount of memory to get valid address */
-	udc->status_req->req.buf = xmalloc(8);
+	udc->status_req->req.buf = xmemalign(4096, 4096);
+	udc->status_req->req.length = 8;
 	udc->resume_state = USB_STATE_NOTATTACHED;
 	udc->usb_state = USB_STATE_POWERED;
 	udc->ep0_dir = 0;
-- 
1.7.10


-- 
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

      parent reply	other threads:[~2012-05-29 16:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-12 16:34 Eric Bénard
2011-12-12 16:51 ` Eric Bénard
2011-12-12 21:16 ` Eric Bénard
2011-12-13  9:48   ` Sascha Hauer
2011-12-13 15:09     ` Eric Bénard
2011-12-13 19:26       ` Sascha Hauer
2012-05-29  8:48         ` Eric Bénard
2012-05-29 10:48           ` Eric Bénard
2012-05-29 16:23           ` Sascha Hauer [this message]

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=20120529162350.GY30400@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=eric@eukrea.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