mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* barebox for iMX8MMini crashes while usb_rescan for USB type A
@ 2020-01-13  7:54 Albert, Elmar
  2020-01-13 11:04 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Albert, Elmar @ 2020-01-13  7:54 UTC (permalink / raw)
  To: barebox

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
elr: 000000007fe70cec lr : 000000007fe25464
x0 : 000000005ff4005c x1 : 0000000000000000
x2 : 0000000000000014 x3 : 0000000030c51835
x4 : 0000000000000004 x5 : 0000000000000043
x6 : 0000000000000001 x7 : 0000000000000000
x8 : 000000005ff4005c x9 : 0000000060189d70
x10: 000000005fefd360 x11: 0000000000000200
x12: 000000007fea7eb0 x13: 000000005fefd360
x14: 0000000000000005 x15: 000000007fe70934
x16: 000000007fe6fe38 x17: 00000000000043b0
x18: 00000000000045f0 x19: 00000000601374e0
x20: 000000005ff3f3e8 x21: 0000000000011800
x22: 0000000000000040 x23: 0000000001180001
x24: 000000006018bd40 x25: 000000005ff40040
x26: 000000005ff40000 x27: 0000000000000006
x28: 000000005ff4005c x29: 000000007ffeeef0

Call trace:
[<7fe70cec>] (__arch_memset+0x4c/0x160) from [<7fe25e90>]
(submit_control_msg+0x61c/0x620)
[<7fe25e90>] (submit_control_msg+0x61c/0x620) from [<7fe1cc78>]
(usb_control_msg+0xe0/0x15c)
[<7fe1cc78>] (usb_control_msg+0xe0/0x15c) from [<7fe1cd74>]
(usb_get_descriptor+0x80/0xac)
[<7fe1cd74>] (usb_get_descriptor+0x80/0xac) from [<7fe1d40c>]
(usb_new_device+0x8c/0x7e4)
[<7fe1d40c>] (usb_new_device+0x8c/0x7e4) from [<7fe1e350>]
(usb_hub_port_connect_change+0x16c/0x1fc)
[<7fe1e350>] (usb_hub_port_connect_change+0x16c/0x1fc) from [<7fe1e670>]
(usb_hub_detect+0x290/0x3b0)
[<7fe1e670>] (usb_hub_detect+0x290/0x3b0) from [<7fe1dc58>]
(usb_host_detect+0xf4/0x104)
[<7fe1dc58>] (usb_host_detect+0xf4/0x104) from [<7fe1dcf4>]
(usb_rescan+0x8c/0xa4)
[<7fe1dcf4>] (usb_rescan+0x8c/0xa4) from [<7fe4c0a0>] (do_usb+0x5c/0x12c)
[<7fe4c0a0>] (do_usb+0x5c/0x12c) from [<7fe05a48>]
(execute_command+0x40/0x88)
[<7fe05a48>] (execute_command+0x40/0x88) from [<7fe0e8a4>]
(run_list_real+0x890/0x8fc)
[<7fe0e8a4>] (run_list_real+0x890/0x8fc) from [<7fe0deb8>]
(parse_stream_outer+0x1b0/0x218)
[<7fe0deb8>] (parse_stream_outer+0x1b0/0x218) from [<7fe0ec24>]
(run_shell+0x54/0x98)
[<7fe0ec24>] (run_shell+0x54/0x98) from [<7fe05a48>]
(execute_command+0x40/0x88)
[<7fe05a48>] (execute_command+0x40/0x88) from [<7fe0e8a4>]
(run_list_real+0x890/0x8fc)
[<7fe0e8a4>] (run_list_real+0x890/0x8fc) from [<7fe0e3fc>]
(run_list_real+0x3e8/0x8fc)
[<7fe0e3fc>] (run_list_real+0x3e8/0x8fc) from [<7fe0e3fc>]
(run_list_real+0x3e8/0x8fc)
[<7fe0e3fc>] (run_list_real+0x3e8/0x8fc) from [<7fe0deb8>]
(parse_stream_outer+0x1b0/0x218)
[<7fe0deb8>] (parse_stream_outer+0x1b0/0x218) from [<7fe0dfbc>]
(parse_string_outer+0x9c/0xf4)
[<7fe0dfbc>] (parse_string_outer+0x9c/0xf4) from [<7fe0e998>]
(source_script+0x88/0xb0)
[<7fe0e998>] (source_script+0x88/0xb0) from [<7fe0ea0c>]
(do_source+0x4c/0x8c)
[<7fe0ea0c>] (do_source+0x4c/0x8c) from [<7fe05a48>]
(execute_command+0x40/0x88)
[<7fe05a48>] (execute_command+0x40/0x88) from [<7fe0e8a4>]
(run_list_real+0x890/0x8fc)
[<7fe0e8a4>] (run_list_real+0x890/0x8fc) from [<7fe0deb8>]
(parse_stream_outer+0x1b0/0x218)
[<7fe0deb8>] (parse_stream_outer+0x1b0/0x218) from [<7fe0dfbc>]
(parse_string_outer+0x9c/0xf4)
[<7fe0dfbc>] (parse_string_outer+0x9c/0xf4) from [<7fe0ebb4>]
(run_command+0x3c/0x58)
[<7fe0ebb4>] (run_command+0x3c/0x58) from [<7fe0145c>]
(start_barebox+0x74/0xe4)
[<7fe0145c>] (start_barebox+0x74/0xe4) from [<7fe70360>]
(barebox_non_pbl_start+0x130/0x164)
[<7fe70360>] (barebox_non_pbl_start+0x130/0x164) from [<7fe0000c>]
(__bare_init_start+0x0/0x4)
[<7fe0000c>] (__bare_init_start+0x0/0x4) from [<4020523c>] (0x4020523c)
[<4020523c>] (0x4020523c) from [<40204ed0>] (0x40204ed0)
panic: unhandled exception
Call trace:
[<7fe70e54>] (unwind_backtrace+0x0/0x84) from [<7fe018e8>] (panic+0x5c/0x78)
[<7fe018e8>] (panic+0x5c/0x78) from [<7fe6fa20>] (do_fiq+0x0/0x24)
[<7fe6fa20>] (do_fiq+0x0/0x24) from [<7fe6fb64>] (do_error+0x0/0x24)
[<7fe6fb64>] (do_error+0x0/0x24) from [<7fe6f668>] (_do_sync+0x94/0x98)
[<7fe6f668>] (_do_sync+0x94/0x98) from [<7fe25e90>]
(submit_control_msg+0x61c/0x620)
[<7fe25e90>] (submit_control_msg+0x61c/0x620) from [<7fe1cc78>]
(usb_control_msg+0xe0/0x15c)
[<7fe1cc78>] (usb_control_msg+0xe0/0x15c) from [<7fe1cd74>]
(usb_get_descriptor+0x80/0xac)
[<7fe1cd74>] (usb_get_descriptor+0x80/0xac) from [<7fe1d40c>]
(usb_new_device+0x8c/0x7e4)
[<7fe1d40c>] (usb_new_device+0x8c/0x7e4) from [<7fe1e350>]
(usb_hub_port_connect_change+0x16c/0x1fc)
[<7fe1e350>] (usb_hub_port_connect_change+0x16c/0x1fc) from [<7fe1e670>]
(usb_hub_detect+0x290/0x3b0)
[<7fe1e670>] (usb_hub_detect+0x290/0x3b0) from [<7fe1dc58>]
(usb_host_detect+0xf4/0x104)
[<7fe1dc58>] (usb_host_detect+0xf4/0x104) from [<7fe1dcf4>]
(usb_rescan+0x8c/0xa4)
[<7fe1dcf4>] (usb_rescan+0x8c/0xa4) from [<7fe4c0a0>] (do_usb+0x5c/0x12c)
[<7fe4c0a0>] (do_usb+0x5c/0x12c) from [<7fe05a48>]
(execute_command+0x40/0x88)
[<7fe05a48>] (execute_command+0x40/0x88) from [<7fe0e8a4>]
(run_list_real+0x890/0x8fc)
[<7fe0e8a4>] (run_list_real+0x890/0x8fc) from [<7fe0deb8>]
(parse_stream_outer+0x1b0/0x218)
[<7fe0deb8>] (parse_stream_outer+0x1b0/0x218) from [<7fe0ec24>]
(run_shell+0x54/0x98)
[<7fe0ec24>] (run_shell+0x54/0x98) from [<7fe05a48>]
(execute_command+0x40/0x88)
[<7fe05a48>] (execute_command+0x40/0x88) from [<7fe0e8a4>]
(run_list_real+0x890/0x8fc)
[<7fe0e8a4>] (run_list_real+0x890/0x8fc) from [<7fe0e3fc>]
(run_list_real+0x3e8/0x8fc)
[<7fe0e3fc>] (run_list_real+0x3e8/0x8fc) from [<7fe0e3fc>]
(run_list_real+0x3e8/0x8fc)
[<7fe0e3fc>] (run_list_real+0x3e8/0x8fc) from [<7fe0deb8>]
(parse_stream_outer+0x1b0/0x218)
[<7fe0deb8>] (parse_stream_outer+0x1b0/0x218) from [<7fe0dfbc>]
(parse_string_outer+0x9c/0xf4)
[<7fe0dfbc>] (parse_string_outer+0x9c/0xf4) from [<7fe0e998>]
(source_script+0x88/0xb0)
[<7fe0e998>] (source_script+0x88/0xb0) from [<7fe0ea0c>]
(do_source+0x4c/0x8c)
[<7fe0ea0c>] (do_source+0x4c/0x8c) from [<7fe05a48>]
(execute_command+0x40/0x88)
[<7fe05a48>] (execute_command+0x40/0x88) from [<7fe0e8a4>]
(run_list_real+0x890/0x8fc)
[<7fe0e8a4>] (run_list_real+0x890/0x8fc) from [<7fe0deb8>]
(parse_stream_outer+0x1b0/0x218)
[<7fe0deb8>] (parse_stream_outer+0x1b0/0x218) from [<7fe0dfbc>]
(parse_string_outer+0x9c/0xf4)
[<7fe0dfbc>] (parse_string_outer+0x9c/0xf4) from [<7fe0ebb4>]
(run_command+0x3c/0x58)
[<7fe0ebb4>] (run_command+0x3c/0x58) from [<7fe0145c>]
(start_barebox+0x74/0xe4)
[<7fe0145c>] (start_barebox+0x74/0xe4) from [<7fe70360>]
(barebox_non_pbl_start+0x130/0x164)
[<7fe70360>] (barebox_non_pbl_start+0x130/0x164) from [<7fe0000c>]
(__bare_init_start+0x0/0x4)
[<7fe0000c>] (__bare_init_start+0x0/0x4) from [<4020523c>] (0x4020523c)
[<4020523c>] (0x4020523c) from [<40204ed0>] (0x40204ed0)

I did some further investigations by adding printks and I found, that it
crashes here:

eal: ehci_submit_async: ---------------- 5
eal: qh->qt_buffer = 0x5FF4005C

which is the command:

    memset(qh->qt_buffer, 0, sizeof(qh->qt_buffer));

in function:

static int
ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer,
           int length, struct devrequest *req, int timeout_ms)

in file: drivers/usb/host/ehci-hcd.c

It seems to be an issue regarding buffer handling.
The buffers are allocated (using memset function in
/arch/arm/lib64/string.c) during startup of the barebox and then will be
re-allocated during usb_rescan
without freeing before.
To make sure that this is the reason for the exception, I excluded the
mem-area (here 0x5FF4005C) in function void *memset(void *dst, int c,
__kernel_size_t size) in file
/arch/arm/lib64/string.c from calling __arch_memset(dst, c, size) when
already set. Then the usb is working.

So please would there be someone who can take care of this problem so
that the USB with type A can be used in barebox for iMX8MMini.

Thank you in advance.

--

Mit freundlichen Grüßen / Best Regards

Elmar Albert
Embedded R&D

DATA MODUL AG
Landsberger Str. 322
80687 Munich
Germany

Tel: +49 89 56017 197
Fax: +49 89 56017 345

Mail to:  ealbert@data-modul.com
Internet: http://www.data-modul.com


Vertrauliche E-Mail von / Confidential e-mail from: DATA MODUL AG
Vorstand / CEO: Dr. Florian Pesahl
Vorsitzende des Aufsichtsrates / Chairwoman of the Supervisory Board: Kristin D. Russell
Sitz der Gesellschaft / Registered Office: München
Registergericht / Registration Court: München Handelsregister B 85 591



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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: barebox for iMX8MMini crashes while usb_rescan for USB type A
  2020-01-13  7:54 barebox for iMX8MMini crashes while usb_rescan for USB type A Albert, Elmar
@ 2020-01-13 11:04 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2020-01-13 11:04 UTC (permalink / raw)
  To: Albert, Elmar; +Cc: andrew.smirnov, barebox

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-13 11:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-13  7:54 barebox for iMX8MMini crashes while usb_rescan for USB type A Albert, Elmar
2020-01-13 11:04 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox