Linux MIPS Architecture development
 help / color / mirror / Atom feed
* Hi-Speed USB controller and au1500
@ 2004-10-14 17:35 Yates, John
  2004-10-14 18:40 ` Pete Popov
  0 siblings, 1 reply; 9+ messages in thread
From: Yates, John @ 2004-10-14 17:35 UTC (permalink / raw)
  To: linux-mips

Hello all,

I am having a problem using a PCI USB 2.0 Hi-Speed controller (EHCI) with
the dbau1500 eval kit with kernel 2.4.26. I have traced the problem down to
a call to atomic_add() (in include/asm-mips/atomic.h) that uses assembly to
access ll/sc registers of the mips architecture.  If I override CPU options
and disable ll/sc when configuring the kernel,  everything works fine.
However this causes the atomic_add() to use
local_irq_save()/local_irq_restore().  I am assuming this will cause quite a
performance hit since atomic_add() gets called all over the place.  I should
include that the ll/sc version of atomic_add() seems to work fine until the
call from the usb infrastructure. 

Below is a code trail that leads to the call to atomic_add():

 
hub.c:			usb_hub_port_connect_change()
usb.c: 			usb_set_address()
usb.c: 			usb_control_msg()
usb.c: 			usb_internal_control_msg()
usb.c: 			usb_start_wait_urb()
usb.c: 			usb_submit_urb()
usb.c: 			submit_urb()
hcd.c: 			hcd_submit_urb()	
host/ehci-hcd.c: 		ehci_urb_enqueue() 	(urb_enqueue
function ptr)
host/ehci-q.c: 		submit_async()  
host/ehci-q.c: 		qh_append_tds()
host/ehci-mem.c: 		qh_get()
atomic.h			atomic_inc()
atomic.h			#define atomic_inc(v) atomic_add(1,(v)) <-
uses ll/sc

To reproduce my results:

Plug in a Hi-Speed USB 2.0 controller into your pci slot and boot with a usb
ehci enabled  kernel. Be sure to disable the non-pci usb host that is
built-in to the au1500 when building the  kernel. (I have tried two
controllers (NEC and ALi) with identical results.) 

Plug a Hi-Speed device (thumb drive or external HD) into the controller.
(system stops responding here)

Low/Full speed devices work without a problem because they use the ohci or
uhci drivers. 


Any help or direction will be greatly appreciated.

John

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

* Re: Hi-Speed USB controller and au1500
  2004-10-14 17:35 Yates, John
@ 2004-10-14 18:40 ` Pete Popov
  0 siblings, 0 replies; 9+ messages in thread
From: Pete Popov @ 2004-10-14 18:40 UTC (permalink / raw)
  To: Yates, John, linux-mips


--- "Yates, John" <jpy@sparta.com> wrote:

> Hello all,
> 
> I am having a problem using a PCI USB 2.0 Hi-Speed
> controller (EHCI) with
> the dbau1500 eval kit with kernel 2.4.26. I have
> traced the problem down to
> a call to atomic_add() (in
> include/asm-mips/atomic.h) that uses assembly to
> access ll/sc registers of the mips architecture.  If
> I override CPU options
> and disable ll/sc when configuring the kernel, 
> everything works fine.

Hmm, that sounds suspicuous. I would guess the ll/sc
is just a symptom you're seeing, but that's probably
not the root of the problem. If you disable ll/sc, the
kernel has to emulate those instructions, if your
userland code uses them, which changes the
characteristics of the system, including timings.
There's probably a timing problem somewhere, but ...
that's just a guess.

Pete

> However this causes the atomic_add() to use
> local_irq_save()/local_irq_restore().  I am assuming
> this will cause quite a
> performance hit since atomic_add() gets called all
> over the place.  I should
> include that the ll/sc version of atomic_add() seems
> to work fine until the
> call from the usb infrastructure. 
> 
> Below is a code trail that leads to the call to
> atomic_add():
> 
>  
> hub.c:			usb_hub_port_connect_change()
> usb.c: 			usb_set_address()
> usb.c: 			usb_control_msg()
> usb.c: 			usb_internal_control_msg()
> usb.c: 			usb_start_wait_urb()
> usb.c: 			usb_submit_urb()
> usb.c: 			submit_urb()
> hcd.c: 			hcd_submit_urb()	
> host/ehci-hcd.c: 		ehci_urb_enqueue() 	(urb_enqueue
> function ptr)
> host/ehci-q.c: 		submit_async()  
> host/ehci-q.c: 		qh_append_tds()
> host/ehci-mem.c: 		qh_get()
> atomic.h			atomic_inc()
> atomic.h			#define atomic_inc(v) atomic_add(1,(v))
> <-
> uses ll/sc
> 
> To reproduce my results:
> 
> Plug in a Hi-Speed USB 2.0 controller into your pci
> slot and boot with a usb
> ehci enabled  kernel. Be sure to disable the non-pci
> usb host that is
> built-in to the au1500 when building the  kernel. (I
> have tried two
> controllers (NEC and ALi) with identical results.) 
> 
> Plug a Hi-Speed device (thumb drive or external HD)
> into the controller.
> (system stops responding here)
> 
> Low/Full speed devices work without a problem
> because they use the ohci or
> uhci drivers. 
> 
> 
> Any help or direction will be greatly appreciated.
> 
> John
> 
> 

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

* RE: Hi-Speed USB controller and au1500
@ 2004-10-22 14:15 Yates, John
  2004-10-23 14:38 ` Bruno Randolf
  0 siblings, 1 reply; 9+ messages in thread
From: Yates, John @ 2004-10-22 14:15 UTC (permalink / raw)
  To: 'Eric DeVolder', linux-mips

Thank you. This indeed works. 

The CONFIG_NONCOHERENT_IO option is set by default in config-shared.in when
one selects the db1500 board (among others). Does anyone have
recommendations as to how to modify config-shared.in to give others the
option of disabling this default behavior?

Possible places could be:

1. Add an override defaults sub-menu for the boards that support disabling
CONFIG_NONCOHERENT_IO.

2. Add a CONFIG_NONCOHERENT_IO item to the bottom of "Machine Selection"
menu. (There is already a "High Memory Support" option at the bottom of the
"machine Selection" menu.)

3. Add a CONFIG_NONCOHERENT_IO item to the "Override CPU options" sub-menu
(in the "CPU Selection" menu). 

4....

Thanks, John

-----Original Message-----
From: Eric DeVolder [mailto:eric.devolder@amd.com] 
Sent: Monday, October 18, 2004 12:28 PM
To: Yates, John
Subject: Re: Hi-Speed USB controller and au1500

I'm guessing that CONFIG_NONCOHERENT_IO is set which means that the 
buffers used by USB are non-cached, and so the LL/SC combinations 
performed by the USB stack to the structs in this non-cached area will 
always fail. (Examine the MIPS LL/SC...only works to cached spaces...)

Depending upon which version of the Au1500 you have, 
CONFIG_NONCOHERENT_IO was necessary due to coherency bugs. I believe 
everything should be fixed with Au1500 AD so that CONFIG_NONCOHERENT_IO 
isn't needed....

Eric

Yates, John wrote:

>Hello all,
>
>I am having a problem using a PCI USB 2.0 Hi-Speed controller (EHCI) with
>the dbau1500 eval kit with kernel 2.4.26. I have traced the problem down to
>a call to atomic_add() (in include/asm-mips/atomic.h) that uses assembly to
>access ll/sc registers of the mips architecture.  If I override CPU options
>and disable ll/sc when configuring the kernel,  everything works fine.
>However this causes the atomic_add() to use
>local_irq_save()/local_irq_restore().  I am assuming this will cause quite
a
>performance hit since atomic_add() gets called all over the place.  I
should
>include that the ll/sc version of atomic_add() seems to work fine until the
>call from the usb infrastructure. 
>
>Below is a code trail that leads to the call to atomic_add():
>
> 
>hub.c:			usb_hub_port_connect_change()
>usb.c: 			usb_set_address()
>usb.c: 			usb_control_msg()
>usb.c: 			usb_internal_control_msg()
>usb.c: 			usb_start_wait_urb()
>usb.c: 			usb_submit_urb()
>usb.c: 			submit_urb()
>hcd.c: 			hcd_submit_urb()	
>host/ehci-hcd.c: 		ehci_urb_enqueue() 	(urb_enqueue
>function ptr)
>host/ehci-q.c: 		submit_async()  
>host/ehci-q.c: 		qh_append_tds()
>host/ehci-mem.c: 		qh_get()
>atomic.h			atomic_inc()
>atomic.h			#define atomic_inc(v) atomic_add(1,(v)) <-
>uses ll/sc
>
>To reproduce my results:
>
>Plug in a Hi-Speed USB 2.0 controller into your pci slot and boot with a
usb
>ehci enabled  kernel. Be sure to disable the non-pci usb host that is
>built-in to the au1500 when building the  kernel. (I have tried two
>controllers (NEC and ALi) with identical results.) 
>
>Plug a Hi-Speed device (thumb drive or external HD) into the controller.
>(system stops responding here)
>
>Low/Full speed devices work without a problem because they use the ohci or
>uhci drivers. 
>
>
>Any help or direction will be greatly appreciated.
>
>John
>
>
>  
>

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

* Re: Hi-Speed USB controller and au1500
  2004-10-22 14:15 Hi-Speed USB controller and au1500 Yates, John
@ 2004-10-23 14:38 ` Bruno Randolf
  2004-10-23 15:24   ` Ralf Baechle
  2004-10-23 17:33   ` Pete Popov
  0 siblings, 2 replies; 9+ messages in thread
From: Bruno Randolf @ 2004-10-23 14:38 UTC (permalink / raw)
  To: linux-mips; +Cc: 'Eric DeVolder'

[-- Attachment #1: Type: text/plain, Size: 4278 bytes --]

maybe not everything ist fixed in AD stepping... we have observed that on our 
Au1500 AD board the internal USB host only works when we set 
CONFIG_NONCOHERENT_IO=y. 

without CONFIG_NONCOHERENT_IO=y we get crashes when the used usb bandwidth 
gets higher. for example with an USB ethernet adapter: ping works but real 
traffic makes the kernel crash. usb-storage does not work at all.

can you confirm this?

would it be possible to use CONFIG_NONCOHERENT_IO=y only for USB, and not PCI? 
we have PCI cards (prism54) which only work without CONFIG_NONCOHERENT_IO, so 
at the moment we can either have USB host or prism54 based PCI cards...

bruno





On Friday 22 October 2004 16:15, Yates, John wrote:
> Thank you. This indeed works.
>
> The CONFIG_NONCOHERENT_IO option is set by default in config-shared.in when
> one selects the db1500 board (among others). Does anyone have
> recommendations as to how to modify config-shared.in to give others the
> option of disabling this default behavior?
>
> Possible places could be:
>
> 1. Add an override defaults sub-menu for the boards that support disabling
> CONFIG_NONCOHERENT_IO.
>
> 2. Add a CONFIG_NONCOHERENT_IO item to the bottom of "Machine Selection"
> menu. (There is already a "High Memory Support" option at the bottom of the
> "machine Selection" menu.)
>
> 3. Add a CONFIG_NONCOHERENT_IO item to the "Override CPU options" sub-menu
> (in the "CPU Selection" menu).
>
> 4....
>
> Thanks, John
>
> -----Original Message-----
> From: Eric DeVolder [mailto:eric.devolder@amd.com]
> Sent: Monday, October 18, 2004 12:28 PM
> To: Yates, John
> Subject: Re: Hi-Speed USB controller and au1500
>
> I'm guessing that CONFIG_NONCOHERENT_IO is set which means that the
> buffers used by USB are non-cached, and so the LL/SC combinations
> performed by the USB stack to the structs in this non-cached area will
> always fail. (Examine the MIPS LL/SC...only works to cached spaces...)
>
> Depending upon which version of the Au1500 you have,
> CONFIG_NONCOHERENT_IO was necessary due to coherency bugs. I believe
> everything should be fixed with Au1500 AD so that CONFIG_NONCOHERENT_IO
> isn't needed....
>
> Eric
>
> Yates, John wrote:
> >Hello all,
> >
> >I am having a problem using a PCI USB 2.0 Hi-Speed controller (EHCI) with
> >the dbau1500 eval kit with kernel 2.4.26. I have traced the problem down
> > to a call to atomic_add() (in include/asm-mips/atomic.h) that uses
> > assembly to access ll/sc registers of the mips architecture.  If I
> > override CPU options and disable ll/sc when configuring the kernel, 
> > everything works fine. However this causes the atomic_add() to use
> >local_irq_save()/local_irq_restore().  I am assuming this will cause quite
>
> a
>
> >performance hit since atomic_add() gets called all over the place.  I
>
> should
>
> >include that the ll/sc version of atomic_add() seems to work fine until
> > the call from the usb infrastructure.
> >
> >Below is a code trail that leads to the call to atomic_add():
> >
> >
> >hub.c:   usb_hub_port_connect_change()
> >usb.c:    usb_set_address()
> >usb.c:    usb_control_msg()
> >usb.c:    usb_internal_control_msg()
> >usb.c:    usb_start_wait_urb()
> >usb.c:    usb_submit_urb()
> >usb.c:    submit_urb()
> >hcd.c:    hcd_submit_urb()
> >host/ehci-hcd.c:   ehci_urb_enqueue()  (urb_enqueue
> >function ptr)
> >host/ehci-q.c:   submit_async()
> >host/ehci-q.c:   qh_append_tds()
> >host/ehci-mem.c:   qh_get()
> >atomic.h   atomic_inc()
> >atomic.h   #define atomic_inc(v) atomic_add(1,(v)) <-
> >uses ll/sc
> >
> >To reproduce my results:
> >
> >Plug in a Hi-Speed USB 2.0 controller into your pci slot and boot with a
>
> usb
>
> >ehci enabled  kernel. Be sure to disable the non-pci usb host that is
> >built-in to the au1500 when building the  kernel. (I have tried two
> >controllers (NEC and ALi) with identical results.)
> >
> >Plug a Hi-Speed device (thumb drive or external HD) into the controller.
> >(system stops responding here)
> >
> >Low/Full speed devices work without a problem because they use the ohci or
> >uhci drivers.
> >
> >
> >Any help or direction will be greatly appreciated.
> >
> >John

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: Hi-Speed USB controller and au1500
  2004-10-23 14:38 ` Bruno Randolf
@ 2004-10-23 15:24   ` Ralf Baechle
  2004-10-23 17:33   ` Pete Popov
  1 sibling, 0 replies; 9+ messages in thread
From: Ralf Baechle @ 2004-10-23 15:24 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linux-mips, 'Eric DeVolder'

On Sat, Oct 23, 2004 at 04:38:15PM +0200, Bruno Randolf wrote:

> would it be possible to use CONFIG_NONCOHERENT_IO=y only for USB, and not PCI? 
> we have PCI cards (prism54) which only work without CONFIG_NONCOHERENT_IO, so 
> at the moment we can either have USB host or prism54 based PCI cards...

At the moment you can use such a partially coherent system with with
CONFIG_NONCOHERENT_IO.  It should work but of course not be overly efficient.
Supporting I/O coherency on a per device base is on the to do list.

  Ralf

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

* Re: Hi-Speed USB controller and au1500
  2004-10-23 14:38 ` Bruno Randolf
  2004-10-23 15:24   ` Ralf Baechle
@ 2004-10-23 17:33   ` Pete Popov
  2004-10-23 18:25     ` Bruno Randolf
  1 sibling, 1 reply; 9+ messages in thread
From: Pete Popov @ 2004-10-23 17:33 UTC (permalink / raw)
  To: Bruno Randolf, linux-mips; +Cc: 'Eric DeVolder'


> maybe not everything ist fixed in AD stepping... we
> have observed that on our 
> Au1500 AD board the internal USB host only works
> when we set CONFIG_NONCOHERENT_IO=y. 

Is this with 2.4 or 2.6? I haven't changed the
coherency defaults in 2.4. Which board do you have,
Db1500?

> without CONFIG_NONCOHERENT_IO=y we get crashes when
> the used usb bandwidth 
> gets higher. for example with an USB ethernet
> adapter: ping works but real 
> traffic makes the kernel crash. usb-storage does not
> work at all.
> 
> can you confirm this?

Not immediately but hopefully in the next few days.
Does usb storage work for you with NONCOHERENT_IO set?
 
> would it be possible to use CONFIG_NONCOHERENT_IO=y
> only for USB, and not PCI? 

Probably not cleanly.

> we have PCI cards (prism54) which only work without
> CONFIG_NONCOHERENT_IO, so 
> at the moment we can either have USB host or prism54
> based PCI cards...

Pete

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

* Re: Hi-Speed USB controller and au1500
  2004-10-23 17:33   ` Pete Popov
@ 2004-10-23 18:25     ` Bruno Randolf
  2004-10-23 20:06       ` Pete Popov
  2004-10-24  0:30       ` Pete Popov
  0 siblings, 2 replies; 9+ messages in thread
From: Bruno Randolf @ 2004-10-23 18:25 UTC (permalink / raw)
  To: ppopov; +Cc: linux-mips, 'Eric DeVolder'

[-- Attachment #1: Type: text/plain, Size: 644 bytes --]

On Saturday 23 October 2004 19:33, Pete Popov wrote:
> > maybe not everything ist fixed in AD stepping... we
> > have observed that on our
> > Au1500 AD board the internal USB host only works
> > when we set CONFIG_NONCOHERENT_IO=y.
>
> Is this with 2.4 or 2.6? I haven't changed the
> coherency defaults in 2.4. 

this is with 2.4.24 and with 2.4.27
have not tried it with 2.6 yet.

> Which board do you have, 
> Db1500?

we have custom boards, called "mtx-1", marketed as "meshcube" or "access cube"

> Does usb storage work for you with NONCOHERENT_IO set?

yes, USB host works fine with CONFIG_NONCOHERENT_IO=y

bruno

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: Hi-Speed USB controller and au1500
  2004-10-23 18:25     ` Bruno Randolf
@ 2004-10-23 20:06       ` Pete Popov
  2004-10-24  0:30       ` Pete Popov
  1 sibling, 0 replies; 9+ messages in thread
From: Pete Popov @ 2004-10-23 20:06 UTC (permalink / raw)
  To: Bruno Randolf, ppopov; +Cc: linux-mips, 'Eric DeVolder'


> On Saturday 23 October 2004 19:33, Pete Popov wrote:
> > > maybe not everything ist fixed in AD stepping...
> we
> > > have observed that on our
> > > Au1500 AD board the internal USB host only works
> > > when we set CONFIG_NONCOHERENT_IO=y.
> >
> > Is this with 2.4 or 2.6? I haven't changed the
> > coherency defaults in 2.4. 
> 
> this is with 2.4.24 and with 2.4.27
> have not tried it with 2.6 yet.

The usb support is now in 2.6; I pushed it in
recently. You'll still need the 36bit address support
patch that's in my directory. If you get to it before
me, let me know the result with usb storage in 2.6.

Pete
 
> > Which board do you have, 
> > Db1500?
> 
> we have custom boards, called "mtx-1", marketed as
> "meshcube" or "access cube"
> 
> > Does usb storage work for you with NONCOHERENT_IO
> set?
> 
> yes, USB host works fine with
> CONFIG_NONCOHERENT_IO=y
> 
> bruno
> 

> ATTACHMENT part 2 application/pgp-signature 

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

* Re: Hi-Speed USB controller and au1500
  2004-10-23 18:25     ` Bruno Randolf
  2004-10-23 20:06       ` Pete Popov
@ 2004-10-24  0:30       ` Pete Popov
  1 sibling, 0 replies; 9+ messages in thread
From: Pete Popov @ 2004-10-24  0:30 UTC (permalink / raw)
  To: Bruno Randolf; +Cc: linux-mips, 'Eric DeVolder'

Bruno Randolf wrote:
> On Saturday 23 October 2004 19:33, Pete Popov wrote:
> 
>>>maybe not everything ist fixed in AD stepping... we
>>>have observed that on our
>>>Au1500 AD board the internal USB host only works
>>>when we set CONFIG_NONCOHERENT_IO=y.
>>
>>Is this with 2.4 or 2.6? I haven't changed the
>>coherency defaults in 2.4. 
> 
> this is with 2.4.24 and with 2.4.27
> have not tried it with 2.6 yet.

I can confirm that 2.6 fails with usb storage stress tests as well. 
Guess I should have tested something other than keyboard and mouse.

Pete

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

end of thread, other threads:[~2004-10-24  0:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-22 14:15 Hi-Speed USB controller and au1500 Yates, John
2004-10-23 14:38 ` Bruno Randolf
2004-10-23 15:24   ` Ralf Baechle
2004-10-23 17:33   ` Pete Popov
2004-10-23 18:25     ` Bruno Randolf
2004-10-23 20:06       ` Pete Popov
2004-10-24  0:30       ` Pete Popov
  -- strict thread matches above, loose matches on Subject: below --
2004-10-14 17:35 Yates, John
2004-10-14 18:40 ` Pete Popov

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