mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: "Albert, Elmar" <EAlbert@data-modul.com>
Cc: andrew.smirnov@gmail.com,
	"barebox@lists.infradead.org" <barebox@lists.infradead.org>
Subject: Re: barebox for iMX8MMini crashes while usb_rescan for USB type A
Date: Mon, 13 Jan 2020 12:04:42 +0100	[thread overview]
Message-ID: <20200113110442.fhi6vodwirt5el2m@pengutronix.de> (raw)
In-Reply-To: <99c3d904-b27d-57ad-89ee-ee2510391618@data-modul.com>

Hi Albert,

On Mon, Jan 13, 2020 at 07:54:54AM +0000, Albert, Elmar wrote:
> Hello everybody,
> 
> I'm working on a customer board based on an iMX8MMini using Barebox
> based on version 2019.05.0. We have problems to bring-up the USB with
> type A connector,
> we are not using type C as on the NXP EVK.
> 
> I added the iMX8MMini to the drivers/usb/imx/imx-usb-misc.c completely
> separated from the already implementation for the iMX7D.
> 
> When starting an usb_rescan using the usb command, barebox crashes with
> an exception. I updated the usb driver to version 2019.12.0, but get the
> same behaviour,
> it crashes with an exception:
> 
> DABT (current EL) exception (ESR 0x96000061) at 0x000000005ff4005c

The problem seems to be here that memset is called on non aligned memory
that is allocated with dma_alloc_coherent(). On ARM64 we have memset
implemented like this:

void *memset(void *dst, int c, __kernel_size_t size)
{
        if (likely(get_cr() & CR_M))
                return __arch_memset(dst, c, size);

        return __default_memset(dst, c, size);
}

As you found out __arch_memset() crashes in your case. The test
get_cr() & CR_M isn't quite correct here. We must test here how the page
is mapped, not if the MMU is enabled. This test might be too expensive
here, so that it's probably better to introduce and use memset_io here
which doesn't try this optimization.

Andrey, as you introduced this code, do you have any ideas to share what
we want to do here?

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
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:[~2020-01-13 11:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-13  7:54 Albert, Elmar
2020-01-13 11:04 ` 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=20200113110442.fhi6vodwirt5el2m@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=EAlbert@data-modul.com \
    --cc=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /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