2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-11 23:23:52 +08:00
linux-next/drivers/usb/musb
Supriya Karanth 39287076e4 usb: musb: Reselect index reg in interrupt context
musb INDEX register is getting modified/corrupted during temporary
un-locking in a SMP system. Set this register with proper value
after re-acquiring the lock

Scenario:
---------
CPU1 is handling a data transfer completion interrupt received for
the CLASS1 EP
CPU2 is handling a CLASS2 thread which is queuing data to musb for
transfer

Below is the error sequence:

         CPU1                   |             CPU2
--------------------------------------------------------------------
Data transfer completion inter- |
rupt recieved.                  |
                                |
musb INDEX reg set to CLASS1 EP |
                                |
musb LOCK is acquired.          |
                                |
                                | CLASS2 thread queues data.
                                |
                                | CLASS2 thread tries to acquire musb
                                | LOCK but lock is already taken by
                                | CLASS1, so CLASS2 thread is
                                | spinning.
                                |
From Interrupt Context musb     |
giveback function is called     |
                                |
The giveback function releases  | CLASS2 thread now acquires LOCK
LOCK                            |
                                |
ClASS1 Request's completion cal-| ClASS2 schedules the data transfer and
lback is called                 | sets the MUSB INDEX to Class2 EP number
                                |
Interrupt handler for CLASS1 EP |
tries to acquire LOCK and is    |
spinning                        |
                                |
Interrupt for Class1 EP acquires| Class2 completes the scheduling etc and
the MUSB LOCK                   | releases the musb LOCK
                                |
Interrupt for Class1 EP schedul-|
es the next data transfer       |
but musb INDEX register is still|
set to CLASS2 EP                |

Since the MUSB INDEX register is set to a different endpoint, we
read and modify the wrong registers. Hence data transfer will not
happen properly. This results in unpredictable behavior

So, the MUSB INDEX register is set to proper value again when
interrupt re-acquires the lock

Cc: stable@vger.kernel.org
Signed-off-by: Supriya Karanth <supriya.karanth@stericsson.com>
Signed-off-by: Praveena Nadahally <praveen.nadahally@stericsson.com>
Reviewed-by: srinidhi kasagar <srinidhi.kasagar@stericsson.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-24 12:23:02 +02:00
..
am35x.c usb: musb: make modules behave better 2012-01-31 14:18:26 +02:00
blackfin.c usb: musb: make modules behave better 2012-01-31 14:18:26 +02:00
blackfin.h usb: musb: drop a gigantic amount of ifdeferry 2011-07-01 14:31:10 -07:00
cppi_dma.c module_param: make bool parameters really bool (drivers & misc) 2012-01-13 09:32:20 +10:30
cppi_dma.h headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
da8xx.c usb: musb: make modules behave better 2012-01-31 14:18:26 +02:00
davinci.c usb: musb: make modules behave better 2012-01-31 14:18:26 +02:00
davinci.h USB: musb: partial DaVinci dm355 support 2009-03-24 16:20:36 -07:00
Kconfig usb: musb: cleanup kconfig 2011-12-20 14:01:38 +02:00
Makefile usb: musb: use a Kconfig choice to pick the right DMA method 2011-12-12 11:51:41 +02:00
musb_core.c usb: musb: make modules behave better 2012-01-31 14:18:26 +02:00
musb_core.h usb: musb: fix pm_runtime calls while atomic 2011-12-12 11:51:54 +02:00
musb_debug.h usb: musb: remove extern qualifier from musb_debug.h header 2011-12-21 13:21:02 +02:00
musb_debugfs.c usb: musb: debugfs: fix error check 2012-02-01 11:02:46 +02:00
musb_dma.h usb: musb: introduce api for dma code to check compatibility with usb request 2011-02-01 10:41:30 +02:00
musb_gadget_ep0.c usb: musb: headers cleanup 2011-12-12 11:51:52 +02:00
musb_gadget.c usb: musb: Reselect index reg in interrupt context 2012-02-24 12:23:02 +02:00
musb_gadget.h usb: musb: gadget: do not poke with gadget's list_head 2011-02-17 21:11:46 +02:00
musb_host.c usb: musb: fix reset issue with full speed device 2011-12-14 09:32:51 +02:00
musb_host.h usb: musb: drop a gigantic amount of ifdeferry 2011-07-01 14:31:10 -07:00
musb_io.h usb: musb: allow building USB_MUSB_TUSB6010 as a module 2011-12-12 11:51:42 +02:00
musb_regs.h usb: musb: tusb6010: fix compilation 2011-08-12 11:52:50 +03:00
musb_virthub.c usb: musb: drop a gigantic amount of ifdeferry 2011-07-01 14:31:10 -07:00
musbhsdma.c USB: irq: Remove IRQF_DISABLED 2011-09-18 01:39:36 -07:00
musbhsdma.h Merge branches 'devel-cleanup', 'devel-board', 'devel-early-init' and 'devel-ti816x' into omap-for-linus 2011-02-16 11:32:38 -08:00
omap2430.c usb: musb: make modules behave better 2012-01-31 14:18:26 +02:00
omap2430.h USB: musb: get rid of omap_readl/writel 2010-03-02 14:54:38 -08:00
tusb6010_omap.c usb: musb: tusb6010: fix compilation 2011-08-12 11:52:50 +03:00
tusb6010.c usb: musb: make modules behave better 2012-01-31 14:18:26 +02:00
tusb6010.h USB: musb: Remove my email address from few musb related drivers 2009-04-23 14:15:27 -07:00
ux500_dma.c Merge branch 'next' of git://git.infradead.org/users/vkoul/slave-dma 2012-01-17 18:40:24 -08:00
ux500.c usb: musb: make modules behave better 2012-01-31 14:18:26 +02:00