Skip to content
  1. Jul 19, 2013
    • P33M's avatar
      dwc_otg: prevent OOPSes during device disconnects · eb1b482a
      P33M authored
      The dwc_otg_urb_enqueue function is thread-unsafe. In particular the
      access of urb->hcpriv, usb_hcd_link_urb_to_ep, dwc_otg_urb->qtd and
      friends does not occur within a critical section and so if a device
      was unplugged during activity there was a high chance that the
      usbcore hub_thread would try to disable the endpoint with partially-
      formed entries in the URB queue. This would result in BUG() or null
      pointer dereferences.
      
      Fix so that access of urb->hcpriv, enqueuing to the hardware and
      adding to usbcore endpoint URB lists is contained within a single
      critical section.
      eb1b482a
  2. Jul 18, 2013
  3. Jul 14, 2013
    • P33M's avatar
      dwc_otg: fiq: prevent FIQ thrash and incorrect state passing to IRQ · c46c85b2
      P33M authored
      In the case of a transaction to a device that had previously aborted
      due to an error, several interrupts are enabled to reset the error
      count when a device responds. This has the side-effect of making the
      FIQ thrash because the hardware will generate multiple instances of
      a NAK on an IN bulk/interrupt endpoint and multiple instances of ACK
      on an OUT bulk/interrupt endpoint. Make the FIQ mask and clear the
      associated interrupts.
      
      Additionally, on non-split transactions make sure that only unmasked
      interrupts are cleared. This caused a hard-to-trigger but serious
      race condition when you had the combination of an endpoint awaiting
      error recovery and a transaction completed on an endpoint - due to
      the sequencing and timing of interrupts generated by the dwc_otg core,
      it was possible to confuse the IRQ handler.
      c46c85b2
    • P33M's avatar
      dwc_otg: mask correct interrupts after transaction error recovery · 4e36213a
      P33M authored
      The dwc_otg driver will unmask certain interrupts on a transaction
      that previously halted in the error state in order to reset the
      QTD error count. The various fine-grained interrupt handlers do not
      consider that other interrupts besides themselves were unmasked.
      
      By disabling the two other interrupts only ever enabled in DMA mode
      for this purpose, we can avoid unnecessary function calls in the
      IRQ handler. This will also prevent an unneccesary FIQ interrupt
      from being generated if the FIQ is enabled.
      4e36213a
  4. Jul 11, 2013
    • popcornmix's avatar
      sdhci-bcm2807: Increase sync_after_dma timeout · 245f716a
      popcornmix authored
      The current timeout is being hit with some cards that complete successfully with a longer timeout.
      The timeout is not handled well, and is believed to be a code path that causes corruption.
      872a8ff7 suggests that crappy cards can take up to 3 seconds to respond
      245f716a
  5. Jul 04, 2013
  6. Jul 02, 2013
  7. Jun 28, 2013
    • Nicolas Pitre's avatar
      ARM: 7670/1: fix the memset fix · 438b4b4e
      Nicolas Pitre authored
      Commit 455bd4c4
      
       ("ARM: 7668/1: fix memset-related crashes caused by
      recent GCC (4.7.2) optimizations") attempted to fix a compliance issue
      with the memset return value.  However the memset itself became broken
      by that patch for misaligned pointers.
      
      This fixes the above by branching over the entry code from the
      misaligned fixup code to avoid reloading the original pointer.
      
      Also, because the function entry alignment is wrong in the Thumb mode
      compilation, that fixup code is moved to the end.
      
      While at it, the entry instructions are slightly reworked to help dual
      issue pipelines.
      
      Signed-off-by: default avatarNicolas Pitre <nico@linaro.org>
      Tested-by: default avatarAlexander Holler <holler@ahsoftware.de>
      Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      438b4b4e
    • Ivan Djelic's avatar
      ARM: 7668/1: fix memset-related crashes caused by recent GCC (4.7.2) optimizations · 786d4c1d
      Ivan Djelic authored
      
      
      Recent GCC versions (e.g. GCC-4.7.2) perform optimizations based on
      assumptions about the implementation of memset and similar functions.
      The current ARM optimized memset code does not return the value of
      its first argument, as is usually expected from standard implementations.
      
      For instance in the following function:
      
      void debug_mutex_lock_common(struct mutex *lock, struct mutex_waiter *waiter)
      {
      	memset(waiter, MUTEX_DEBUG_INIT, sizeof(*waiter));
      	waiter->magic = waiter;
      	INIT_LIST_HEAD(&waiter->list);
      }
      
      compiled as:
      
      800554d0 <debug_mutex_lock_common>:
      800554d0:       e92d4008        push    {r3, lr}
      800554d4:       e1a00001        mov     r0, r1
      800554d8:       e3a02010        mov     r2, #16 ; 0x10
      800554dc:       e3a01011        mov     r1, #17 ; 0x11
      800554e0:       eb04426e        bl      80165ea0 <memset>
      800554e4:       e1a03000        mov     r3, r0
      800554e8:       e583000c        str     r0, [r3, #12]
      800554ec:       e5830000        str     r0, [r3]
      800554f0:       e5830004        str     r0, [r3, #4]
      800554f4:       e8bd8008        pop     {r3, pc}
      
      GCC assumes memset returns the value of pointer 'waiter' in register r0; causing
      register/memory corruptions.
      
      This patch fixes the return value of the assembly version of memset.
      It adds a 'mov' instruction and merges an additional load+store into
      existing load/store instructions.
      For ease of review, here is a breakdown of the patch into 4 simple steps:
      
      Step 1
      ======
      Perform the following substitutions:
      ip -> r8, then
      r0 -> ip,
      and insert 'mov ip, r0' as the first statement of the function.
      At this point, we have a memset() implementation returning the proper result,
      but corrupting r8 on some paths (the ones that were using ip).
      
      Step 2
      ======
      Make sure r8 is saved and restored when (! CALGN(1)+0) == 1:
      
      save r8:
      -       str     lr, [sp, #-4]!
      +       stmfd   sp!, {r8, lr}
      
      and restore r8 on both exit paths:
      -       ldmeqfd sp!, {pc}               @ Now <64 bytes to go.
      +       ldmeqfd sp!, {r8, pc}           @ Now <64 bytes to go.
      (...)
              tst     r2, #16
              stmneia ip!, {r1, r3, r8, lr}
      -       ldr     lr, [sp], #4
      +       ldmfd   sp!, {r8, lr}
      
      Step 3
      ======
      Make sure r8 is saved and restored when (! CALGN(1)+0) == 0:
      
      save r8:
      -       stmfd   sp!, {r4-r7, lr}
      +       stmfd   sp!, {r4-r8, lr}
      
      and restore r8 on both exit paths:
              bgt     3b
      -       ldmeqfd sp!, {r4-r7, pc}
      +       ldmeqfd sp!, {r4-r8, pc}
      (...)
              tst     r2, #16
              stmneia ip!, {r4-r7}
      -       ldmfd   sp!, {r4-r7, lr}
      +       ldmfd   sp!, {r4-r8, lr}
      
      Step 4
      ======
      Rewrite register list "r4-r7, r8" as "r4-r8".
      
      Signed-off-by: default avatarIvan Djelic <ivan.djelic@parrot.com>
      Reviewed-by: default avatarNicolas Pitre <nico@linaro.org>
      Signed-off-by: default avatarDirk Behme <dirk.behme@gmail.com>
      Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      786d4c1d
  8. Jun 23, 2013
  9. Jun 22, 2013
    • popcornmix's avatar
      Merge pull request #314 from hglm/cfbimageblit · bf3a6c5e
      popcornmix authored
      Speed up framebuffer console text rendering
      bf3a6c5e
    • Harm Hanemaaijer's avatar
      Speed up console framebuffer imageblit function · 7b297aee
      Harm Hanemaaijer authored
      
      
      Especially on platforms with a slower CPU but a relatively high
      framebuffer fill bandwidth, like current ARM devices, the existing
      console monochrome imageblit function used to draw console text is
      suboptimal for common pixel depths such as 16bpp and 32bpp. The existing
      code is quite general and can deal with several pixel depths. By creating
      special case functions for 16bpp and 32bpp, by far the most common pixel
      formats used on modern systems, a significant speed-up is attained
      which can be readily felt on ARM-based devices like the Raspberry Pi
      and the Allwinner platform, but should help any platform using the
      fb layer.
      
      The special case functions allow constant folding, eliminating a number
      of instructions including divide operations, and allow the use of an
      unrolled loop, eliminating instructions with a variable shift size,
      reducing source memory access instructions, and eliminating excessive
      branching. These unrolled loops also allow much better code optimization
      by the C compiler. The code that selects which optimized variant is used
      is also simplified, eliminating integer divide instructions.
      
      The speed-up, measured by timing 'cat file.txt' in the console, varies
      between 40% and 70%, when testing on the Raspberry Pi and Allwinner
      ARM-based platforms, depending on font size and the pixel depth, with
      the greater benefit for 32bpp.
      
      Signed-off-by: default avatarHarm Hanemaaijer <fgenfb@yahoo.com>
      7b297aee
  10. Jun 21, 2013
    • Mike Bradley's avatar
      dwc_otg: Call usb_hcd_unlink_urb_from_ep with lock held in completion handler · 9475f39e
      Mike Bradley authored
      usb_hcd_unlink_urb_from_ep must be called with the HCD lock held.  Calling it
      asynchronously in the tasklet was not safe (regression in
      c4564d4a).
      
      This change unlinks it from the endpoint prior to queueing it for handling in
      the tasklet, and also adds a check to ensure the urb is OK to be unlinked
      before doing so.
      
      NULL pointer dereference kernel oopses had been observed in usb_hcd_giveback_urb
      when a USB device was unplugged/replugged during data transfer.  This effect
      was reproduced using automated USB port power control, hundreds of replug
      events were performed during active transfers to confirm that the problem was
      eliminated.
      9475f39e
  11. Jun 20, 2013
  12. Jun 13, 2013
  13. Jun 04, 2013
  14. May 31, 2013
  15. May 29, 2013
  16. May 17, 2013
  17. May 14, 2013
  18. May 13, 2013
  19. May 11, 2013
  20. Apr 27, 2013
  21. Apr 26, 2013
  22. Apr 22, 2013
    • popcornmix's avatar
      Merge pull request #279 from P33M/rpi-3.6.y · 07b8b7db
      popcornmix authored
      dwc_otg: fix NAK holdoff and allow on split transactions only
      07b8b7db
    • P33M's avatar
      dwc_otg: fix NAK holdoff and allow on split transactions only · b4cc7c06
      P33M authored
      This corrects a bug where if a single active non-periodic endpoint
      had at least one transaction in its qh, on frnum == MAX_FRNUM the qh
      would get skipped and never get queued again. This would result in
      a silent device until error detection (automatic or otherwise) would
      either reset the device or flush and requeue the URBs.
      
      Additionally the NAK holdoff was enabled for all transactions - this
      would potentially stall a HS endpoint for 1ms if a previous error state
      enabled this interrupt and the next response was a NAK. Fix so that
      only split transactions get held off.
      b4cc7c06
  23. Apr 18, 2013
  24. Apr 11, 2013
  25. Apr 04, 2013
    • Marcin Jurkowski's avatar
      w1: fix oops when w1_search is called from netlink connector · dd244643
      Marcin Jurkowski authored
      On Sat, Mar 02, 2013 at 10:45:10AM +0100, Sven Geggus wrote:
      > This is the bad commit I found doing git bisect:
      > 04f482fa is the first bad commit
      > commit 04f482fa
      
      
      > Author: Patrick McHardy <kaber@trash.net>
      > Date:   Mon Mar 28 08:39:36 2011 +0000
      
      Good job. I was too lazy to bisect for bad commit;)
      
      Reading the code I found problematic kthread_should_stop call from netlink
      connector which causes the oops. After applying a patch, I've been testing
      owfs+w1 setup for nearly two days and it seems to work very reliable (no
      hangs, no memleaks etc).
      More detailed description and possible fix is given below:
      
      Function w1_search can be called from either kthread or netlink callback.
      While the former works fine, the latter causes oops due to kthread_should_stop
      invocation.
      
      This patch adds a check if w1_search is serving netlink command, skipping
      kthread_should_stop invocation if so.
      
      Signed-off-by: default avatarMarcin Jurkowski <marcin1j@gmail.com>
      Acked-by: default avatarEvgeniy Polyakov <zbr@ioremap.net>
      Cc: Josh Boyer <jwboyer@gmail.com>
      Tested-by: default avatarSven Geggus <lists@fuchsschwanzdomain.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: stable <stable@vger.kernel.org> # 3.0+
      dd244643
  26. Apr 03, 2013
  27. Apr 02, 2013