1. 09 Jun, 2021 10 commits
  2. 05 Jun, 2021 1 commit
  3. 04 Jun, 2021 13 commits
    • Wesley Cheng's avatar
      usb: gadget: f_fs: Ensure io_completion_wq is idle during unbind · 6fc1db5e
      Wesley Cheng authored
      During unbind, ffs_func_eps_disable() will be executed, resulting in
      completion callbacks for any pending USB requests.  When using AIO,
      irrespective of the completion status, io_data work is queued to
      io_completion_wq to evaluate and handle the completed requests.  Since
      work runs asynchronously to the unbind() routine, there can be a
      scenario where the work runs after the USB gadget has been fully
      removed, resulting in accessing of a resource which has been already
      freed. (i.e. usb_ep_free_request() accessing the USB ep structure)
      
      Explicitly drain the io_completion_wq, instead of relying on the
      destroy_workqueue() (in ffs_data_put()) to make sure no pending
      completion work items are running.
      Signed-off-by: default avatarWesley Cheng <wcheng@codeaurora.org>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/1621644261-1236-1-git-send-email-wcheng@codeaurora.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6fc1db5e
    • Li Jun's avatar
      usb: typec: tcpm: cancel send discover hrtimer when unregister tcpm port · 024236ab
      Li Jun authored
      Like the state_machine_timer, we should also cancel possible pending
      send discover identity hrtimer when unregister tcpm port.
      
      Fixes: c34e85fa ("usb: typec: tcpm: Send DISCOVER_IDENTITY from dedicated work")
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarLi Jun <jun.li@nxp.com>
      Link: https://lore.kernel.org/r/1622627829-11070-3-git-send-email-jun.li@nxp.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      024236ab
    • Li Jun's avatar
      usb: typec: tcpm: cancel frs hrtimer when unregister tcpm port · 7ade4805
      Li Jun authored
      Like the state_machine_timer, we should also cancel possible pending
      frs hrtimer when unregister tcpm port.
      
      Fixes: 8dc4bd07 ("usb: typec: tcpm: Add support for Sink Fast Role SWAP(FRS)")
      Cc: stable <stable@vger.kernel.org>
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarLi Jun <jun.li@nxp.com>
      Link: https://lore.kernel.org/r/1622627829-11070-2-git-send-email-jun.li@nxp.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7ade4805
    • Li Jun's avatar
      usb: typec: tcpm: cancel vdm and state machine hrtimer when unregister tcpm port · 3a13ff7e
      Li Jun authored
      A pending hrtimer may expire after the kthread_worker of tcpm port
      is destroyed, see below kernel dump when do module unload, fix it
      by cancel the 2 hrtimers.
      
      [  111.517018] Unable to handle kernel paging request at virtual address ffff8000118cb880
      [  111.518786] blk_update_request: I/O error, dev sda, sector 60061185 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
      [  111.526594] Mem abort info:
      [  111.526597]   ESR = 0x96000047
      [  111.526600]   EC = 0x25: DABT (current EL), IL = 32 bits
      [  111.526604]   SET = 0, FnV = 0
      [  111.526607]   EA = 0, S1PTW = 0
      [  111.526610] Data abort info:
      [  111.526612]   ISV = 0, ISS = 0x00000047
      [  111.526615]   CM = 0, WnR = 1
      [  111.526619] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000041d75000
      [  111.526623] [ffff8000118cb880] pgd=10000001bffff003, p4d=10000001bffff003, pud=10000001bfffe003, pmd=10000001bfffa003, pte=0000000000000000
      [  111.526642] Internal error: Oops: 96000047 [#1] PREEMPT SMP
      [  111.526647] Modules linked in: dwc3_imx8mp dwc3 phy_fsl_imx8mq_usb [last unloaded: tcpci]
      [  111.526663] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.13.0-rc4-00927-gebbe9dbd802c-dirty #36
      [  111.526670] Hardware name: NXP i.MX8MPlus EVK board (DT)
      [  111.526674] pstate: 800000c5 (Nzcv daIF -PAN -UAO -TCO BTYPE=--)
      [  111.526681] pc : queued_spin_lock_slowpath+0x1a0/0x390
      [  111.526695] lr : _raw_spin_lock_irqsave+0x88/0xb4
      [  111.526703] sp : ffff800010003e20
      [  111.526706] x29: ffff800010003e20 x28: ffff00017f380180
      [  111.537156] buffer_io_error: 6 callbacks suppressed
      [  111.537162] Buffer I/O error on dev sda1, logical block 60040704, async page read
      [  111.539932]  x27: ffff00017f3801c0
      [  111.539938] x26: ffff800010ba2490 x25: 0000000000000000 x24: 0000000000000001
      [  111.543025] blk_update_request: I/O error, dev sda, sector 60061186 op 0x0:(READ) flags 0x0 phys_seg 7 prio class 0
      [  111.548304]
      [  111.548306] x23: 00000000000000c0 x22: ffff0000c2a9f184 x21: ffff00017f380180
      [  111.551374] Buffer I/O error on dev sda1, logical block 60040705, async page read
      [  111.554499]
      [  111.554503] x20: ffff0000c5f14210 x19: 00000000000000c0 x18: 0000000000000000
      [  111.557391] Buffer I/O error on dev sda1, logical block 60040706, async page read
      [  111.561218]
      [  111.561222] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
      [  111.564205] Buffer I/O error on dev sda1, logical block 60040707, async page read
      [  111.570887] x14: 00000000000000f5 x13: 0000000000000001 x12: 0000000000000040
      [  111.570902] x11: ffff0000c05ac6d8
      [  111.583420] Buffer I/O error on dev sda1, logical block 60040708, async page read
      [  111.588978]  x10: 0000000000000000 x9 : 0000000000040000
      [  111.588988] x8 : 0000000000000000
      [  111.597173] Buffer I/O error on dev sda1, logical block 60040709, async page read
      [  111.605766]  x7 : ffff00017f384880 x6 : ffff8000118cb880
      [  111.605777] x5 : ffff00017f384880
      [  111.611094] Buffer I/O error on dev sda1, logical block 60040710, async page read
      [  111.617086]  x4 : 0000000000000000 x3 : ffff0000c2a9f184
      [  111.617096] x2 : ffff8000118cb880
      [  111.622242] Buffer I/O error on dev sda1, logical block 60040711, async page read
      [  111.626927]  x1 : ffff8000118cb880 x0 : ffff00017f384888
      [  111.626938] Call trace:
      [  111.626942]  queued_spin_lock_slowpath+0x1a0/0x390
      [  111.795809]  kthread_queue_work+0x30/0xc0
      [  111.799828]  state_machine_timer_handler+0x20/0x30
      [  111.804624]  __hrtimer_run_queues+0x140/0x1e0
      [  111.808990]  hrtimer_interrupt+0xec/0x2c0
      [  111.813004]  arch_timer_handler_phys+0x38/0x50
      [  111.817456]  handle_percpu_devid_irq+0x88/0x150
      [  111.821991]  __handle_domain_irq+0x80/0xe0
      [  111.826093]  gic_handle_irq+0xc0/0x140
      [  111.829848]  el1_irq+0xbc/0x154
      [  111.832991]  arch_cpu_idle+0x1c/0x2c
      [  111.836572]  default_idle_call+0x24/0x6c
      [  111.840497]  do_idle+0x238/0x2ac
      [  111.843729]  cpu_startup_entry+0x2c/0x70
      [  111.847657]  rest_init+0xdc/0xec
      [  111.850890]  arch_call_rest_init+0x14/0x20
      [  111.854988]  start_kernel+0x508/0x540
      [  111.858659] Code: 910020e0 8b0200c2 f861d884 aa0203e1 (f8246827)
      [  111.864760] ---[ end trace 308b9a4a3dcb73ac ]---
      [  111.869381] Kernel panic - not syncing: Oops: Fatal exception in interrupt
      [  111.876258] SMP: stopping secondary CPUs
      [  111.880185] Kernel Offset: disabled
      [  111.883673] CPU features: 0x00001001,20000846
      [  111.888031] Memory Limit: none
      [  111.891090] ---[ end Kernel panic - not syncing: Oops: Fatal exception in interrupt ]---
      
      Fixes: 3ed8e1c2 ("usb: typec: tcpm: Migrate workqueue to RT priority for processing events")
      Cc: stable <stable@vger.kernel.org>
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarLi Jun <jun.li@nxp.com>
      Link: https://lore.kernel.org/r/1622627829-11070-1-git-send-email-jun.li@nxp.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3a13ff7e
    • Kyle Tso's avatar
      usb: typec: tcpm: Properly handle Alert and Status Messages · 063933f4
      Kyle Tso authored
      When receiving Alert Message, if it is not unexpected but is
      unsupported for some reason, the port should return Not_Supported
      Message response.
      
      Also, according to PD3.0 Spec 6.5.2.1.4 Event Flags Field, the
      OTP/OVP/OCP flags in the Event Flags field in Status Message no longer
      require Get_PPS_Status Message to clear them. Thus remove it when
      receiving Status Message with those flags being set.
      
      In addition, add the missing AMS operations for Status Message.
      
      Fixes: 64f7c494 ("typec: tcpm: Add support for sink PPS related messages")
      Fixes: 0908c5ac ("usb: typec: tcpm: AMS and Collision Avoidance")
      Signed-off-by: default avatarKyle Tso <kyletso@google.com>
      Link: https://lore.kernel.org/r/20210531164928.2368606-1-kyletso@google.com
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      063933f4
    • Neil Armstrong's avatar
      usb: dwc3-meson-g12a: fix usb2 PHY glue init when phy0 is disabled · 4d2aa178
      Neil Armstrong authored
      When only PHY1 is used (for example on Odroid-HC4), the regmap init code
      uses the usb2 ports when doesn't initialize the PHY1 regmap entry.
      
      This fixes:
      Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020
      ...
      pc : regmap_update_bits_base+0x40/0xa0
      lr : dwc3_meson_g12a_usb2_init_phy+0x4c/0xf8
      ...
      Call trace:
      regmap_update_bits_base+0x40/0xa0
      dwc3_meson_g12a_usb2_init_phy+0x4c/0xf8
      dwc3_meson_g12a_usb2_init+0x7c/0xc8
      dwc3_meson_g12a_usb_init+0x28/0x48
      dwc3_meson_g12a_probe+0x298/0x540
      platform_probe+0x70/0xe0
      really_probe+0xf0/0x4d8
      driver_probe_device+0xfc/0x168
      ...
      
      Fixes: 013af227 ("usb: dwc3: meson-g12a: handle the phy and glue registers separately")
      Reviewed-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20210601084830.260196-1-narmstrong@baylibre.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4d2aa178
    • Christophe JAILLET's avatar
      usb: dwc3: meson-g12a: Disable the regulator in the error handling path of the probe · 1d0d3d81
      Christophe JAILLET authored
      If an error occurs after a successful 'regulator_enable()' call,
      'regulator_disable()' must be called.
      
      Fix the error handling path of the probe accordingly.
      
      The remove function doesn't need to be fixed, because the
      'regulator_disable()' call is already hidden in 'dwc3_meson_g12a_suspend()'
      which is called via 'pm_runtime_set_suspended()' in the remove function.
      
      Fixes: c9999337 ("usb: dwc3: Add Amlogic G12A DWC3 glue")
      Reviewed-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Acked-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Link: https://lore.kernel.org/r/79df054046224bbb0716a8c5c2082650290eec86.1621616013.git.christophe.jaillet@wanadoo.fr
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1d0d3d81
    • Kyle Tso's avatar
      usb: typec: tcpm: Fix misuses of AMS invocation · 80137c18
      Kyle Tso authored
      tcpm_ams_start is used to initiate an AMS as well as checking Collision
      Avoidance conditions but not for flagging passive AMS (initiated by the
      port partner). Fix the misuses of tcpm_ams_start in tcpm_pd_svdm.
      
      ATTENTION doesn't need responses so the AMS flag is not needed here.
      
      Fixes: 0bc3ee92 ("usb: typec: tcpm: Properly interrupt VDM AMS")
      Signed-off-by: default avatarKyle Tso <kyletso@google.com>
      Link: https://lore.kernel.org/r/20210601123151.3441914-5-kyletso@google.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      80137c18
    • Kyle Tso's avatar
      usb: typec: tcpm: Introduce snk_vdo_v1 for SVDM version 1.0 · 7ac50510
      Kyle Tso authored
      The ID Header VDO and Product VDOs defined in USB PD Spec rev 2.0 and
      rev 3.1 are quite different. Add an additional array snk_vdo_v1 and
      send it as the response to the port partner if it only supports SVDM
      version 1.0.
      Acked-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
      Signed-off-by: default avatarKyle Tso <kyletso@google.com>
      Link: https://lore.kernel.org/r/20210601123151.3441914-4-kyletso@google.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7ac50510
    • Kyle Tso's avatar
      dt-bindings: connector: Add PD rev 2.0 VDO definition · 55b54c26
      Kyle Tso authored
      Add the VDO definition for USB PD rev 2.0 in the bindings and define a
      new property snk-vdos-v1 containing legacy VDOs as the responses to the
      port partner which only supports PD rev 2.0.
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarKyle Tso <kyletso@google.com>
      Link: https://lore.kernel.org/r/20210601123151.3441914-3-kyletso@google.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      55b54c26
    • Kyle Tso's avatar
      usb: typec: tcpm: Correct the responses in SVDM Version 2.0 DFP · f41bfc7e
      Kyle Tso authored
      In USB PD Spec Rev 3.1 Ver 1.0, section "6.12.5 Applicability of
      Structured VDM Commands", DFP is allowed and recommended to respond to
      Discovery Identity with ACK. And in section "6.4.4.2.5.1 Commands other
      than Attention", NAK should be returned only when receiving Messages
      with invalid fields, Messages in wrong situation, or unrecognize
      Messages.
      
      Still keep the original design for SVDM Version 1.0 for backward
      compatibilities.
      
      Fixes: 193a6801 ("staging: typec: tcpm: Respond to Discover Identity commands")
      Acked-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
      Signed-off-by: default avatarKyle Tso <kyletso@google.com>
      Link: https://lore.kernel.org/r/20210601123151.3441914-2-kyletso@google.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f41bfc7e
    • Alexandru Elisei's avatar
      Revert "usb: dwc3: core: Add shutdown callback for dwc3" · 8f11fe7e
      Alexandru Elisei authored
      This reverts commit 568262bf.
      
      The commit causes the following panic when shutting down a rockpro64-v2
      board:
      
      [..]
      [   41.684569] xhci-hcd xhci-hcd.2.auto: USB bus 1 deregistered
      [   41.686301] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000a0
      [   41.687096] Mem abort info:
      [   41.687345]   ESR = 0x96000004
      [   41.687615]   EC = 0x25: DABT (current EL), IL = 32 bits
      [   41.688082]   SET = 0, FnV = 0
      [   41.688352]   EA = 0, S1PTW = 0
      [   41.688628] Data abort info:
      [   41.688882]   ISV = 0, ISS = 0x00000004
      [   41.689219]   CM = 0, WnR = 0
      [   41.689481] user pgtable: 4k pages, 48-bit VAs, pgdp=00000000073b2000
      [   41.690046] [00000000000000a0] pgd=0000000000000000, p4d=0000000000000000
      [   41.690654] Internal error: Oops: 96000004 [#1] PREEMPT SMP
      [   41.691143] Modules linked in:
      [   41.691416] CPU: 5 PID: 1 Comm: shutdown Not tainted 5.13.0-rc4 #43
      [   41.691966] Hardware name: Pine64 RockPro64 v2.0 (DT)
      [   41.692409] pstate: 60000005 (nZCv daif -PAN -UAO -TCO BTYPE=--)
      [   41.692937] pc : down_read_interruptible+0xec/0x200
      [   41.693373] lr : simple_recursive_removal+0x48/0x280
      [   41.693815] sp : ffff800011fab910
      [   41.694107] x29: ffff800011fab910 x28: ffff0000008fe480 x27: ffff0000008fe4d8
      [   41.694736] x26: ffff800011529a90 x25: 00000000000000a0 x24: ffff800011edd030
      [   41.695364] x23: 0000000000000080 x22: 0000000000000000 x21: ffff800011f23994
      [   41.695992] x20: ffff800011f23998 x19: ffff0000008fe480 x18: ffffffffffffffff
      [   41.696620] x17: 000c0400bb44ffff x16: 0000000000000009 x15: ffff800091faba3d
      [   41.697248] x14: 0000000000000004 x13: 0000000000000000 x12: 0000000000000020
      [   41.697875] x11: 0101010101010101 x10: 7f7f7f7f7f7f7f7f x9 : 6f6c746364716e62
      [   41.698502] x8 : 7f7f7f7f7f7f7f7f x7 : fefefeff6364626d x6 : 0000000000000440
      [   41.699130] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 00000000000000a0
      [   41.699758] x2 : 0000000000000001 x1 : 0000000000000000 x0 : 00000000000000a0
      [   41.700386] Call trace:
      [   41.700602]  down_read_interruptible+0xec/0x200
      [   41.701003]  debugfs_remove+0x5c/0x80
      [   41.701328]  dwc3_debugfs_exit+0x1c/0x6c
      [   41.701676]  dwc3_remove+0x34/0x1a0
      [   41.701988]  platform_remove+0x28/0x60
      [   41.702322]  __device_release_driver+0x188/0x22c
      [   41.702730]  device_release_driver+0x2c/0x44
      [   41.703106]  bus_remove_device+0x124/0x130
      [   41.703468]  device_del+0x16c/0x424
      [   41.703777]  platform_device_del.part.0+0x1c/0x90
      [   41.704193]  platform_device_unregister+0x28/0x44
      [   41.704608]  of_platform_device_destroy+0xe8/0x100
      [   41.705031]  device_for_each_child_reverse+0x64/0xb4
      [   41.705470]  of_platform_depopulate+0x40/0x84
      [   41.705853]  __dwc3_of_simple_teardown+0x20/0xd4
      [   41.706260]  dwc3_of_simple_shutdown+0x14/0x20
      [   41.706652]  platform_shutdown+0x28/0x40
      [   41.706998]  device_shutdown+0x158/0x330
      [   41.707344]  kernel_power_off+0x38/0x7c
      [   41.707684]  __do_sys_reboot+0x16c/0x2a0
      [   41.708029]  __arm64_sys_reboot+0x28/0x34
      [   41.708383]  invoke_syscall+0x48/0x114
      [   41.708716]  el0_svc_common.constprop.0+0x44/0xdc
      [   41.709131]  do_el0_svc+0x28/0x90
      [   41.709426]  el0_svc+0x2c/0x54
      [   41.709698]  el0_sync_handler+0xa4/0x130
      [   41.710045]  el0_sync+0x198/0x1c0
      [   41.710342] Code: c8047c62 35ffff84 17fffe5f f9800071 (c85ffc60)
      [   41.710881] ---[ end trace 406377df5178f75c ]---
      [   41.711299] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
      [   41.712084] Kernel Offset: disabled
      [   41.712391] CPU features: 0x10001031,20000846
      [   41.712775] Memory Limit: none
      [   41.713049] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---
      
      As Felipe explained: "dwc3_shutdown() is just called dwc3_remove()
      directly, then we end up calling debugfs_remove_recursive() twice."
      
      Reverting the commit fixes the panic.
      
      Fixes: 568262bf ("usb: dwc3: core: Add shutdown callback for dwc3")
      Acked-by: default avatarFelipe Balbi <balbi@kernel.org>
      Signed-off-by: default avatarAlexandru Elisei <alexandru.elisei@arm.com>
      Link: https://lore.kernel.org/r/20210603151742.298243-1-alexandru.elisei@arm.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8f11fe7e
    • Kyle Tso's avatar
      dt-bindings: connector: Replace BIT macro with generic bit ops · 9257bd80
      Kyle Tso authored
      BIT macro is not defined. Replace it with generic bit operations.
      
      Fixes: 630dce28 ("dt-bindings: connector: Add SVDM VDO properties")
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarKyle Tso <kyletso@google.com>
      Link: https://lore.kernel.org/r/20210527121029.583611-1-kyletso@google.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9257bd80
  4. 03 Jun, 2021 1 commit
    • Jack Pham's avatar
      usb: dwc3: debugfs: Add and remove endpoint dirs dynamically · 8d396bb0
      Jack Pham authored
      The DWC3 DebugFS directory and files are currently created once
      during probe.  This includes creation of subdirectories for each
      of the gadget's endpoints.  This works fine for peripheral-only
      controllers, as dwc3_core_init_mode() calls dwc3_gadget_init()
      just prior to calling dwc3_debugfs_init().
      
      However, for dual-role controllers, dwc3_core_init_mode() will
      instead call dwc3_drd_init() which is problematic in a few ways.
      First, the initial state must be determined, then dwc3_set_mode()
      will have to schedule drd_work and by then dwc3_debugfs_init()
      could have already been invoked.  Even if the initial mode is
      peripheral, dwc3_gadget_init() happens after the DebugFS files
      are created, and worse so if the initial state is host and the
      controller switches to peripheral much later.  And secondly,
      even if the gadget endpoints' debug entries were successfully
      created, if the controller exits peripheral mode, its dwc3_eps
      are freed so the debug files would now hold stale references.
      
      So it is best if the DebugFS endpoint entries are created and
      removed dynamically at the same time the underlying dwc3_eps are.
      Do this by calling dwc3_debugfs_create_endpoint_dir() as each
      endpoint is created, and conversely remove the DebugFS entry when
      the endpoint is freed.
      
      Fixes: 41ce1456 ("usb: dwc3: core: make dwc3_set_mode() work properly")
      Cc: stable <stable@vger.kernel.org>
      Reviewed-by: default avatarPeter Chen <peter.chen@kernel.org>
      Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
      Link: https://lore.kernel.org/r/20210529192932.22912-1-jackp@codeaurora.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8d396bb0
  5. 02 Jun, 2021 4 commits
    • Kyle Tso's avatar
      usb: pd: Set PD_T_SINK_WAIT_CAP to 310ms · 6490fa56
      Kyle Tso authored
      Current timer PD_T_SINK_WAIT_CAP is set to 240ms which will violate the
      SinkWaitCapTimer (tTypeCSinkWaitCap 310 - 620 ms) defined in the PD
      Spec if the port is faster enough when running the state machine. Set it
      to the lower bound 310ms to ensure the timeout is in Spec.
      
      Fixes: f0690a25 ("staging: typec: USB Type-C Port Manager (tcpm)")
      Cc: stable <stable@vger.kernel.org>
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarKyle Tso <kyletso@google.com>
      Link: https://lore.kernel.org/r/20210528081613.730661-1-kyletso@google.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6490fa56
    • Thomas Petazzoni's avatar
      usb: musb: fix MUSB_QUIRK_B_DISCONNECT_99 handling · b65ba0c3
      Thomas Petazzoni authored
      In commit 92af4fc6 ("usb: musb: Fix suspend with devices
      connected for a64"), the logic to support the
      MUSB_QUIRK_B_DISCONNECT_99 quirk was modified to only conditionally
      schedule the musb->irq_work delayed work.
      
      This commit badly breaks ECM Gadget on AM335X. Indeed, with this
      commit, one can observe massive packet loss:
      
      $ ping 192.168.0.100
      ...
      15 packets transmitted, 3 received, 80% packet loss, time 14316ms
      
      Reverting this commit brings back a properly functioning ECM
      Gadget. An analysis of the commit seems to indicate that a mistake was
      made: the previous code was not falling through into the
      MUSB_QUIRK_B_INVALID_VBUS_91, but now it is, unless the condition is
      taken.
      
      Changing the logic to be as it was before the problematic commit *and*
      only conditionally scheduling musb->irq_work resolves the regression:
      
      $ ping 192.168.0.100
      ...
      64 packets transmitted, 64 received, 0% packet loss, time 64475ms
      
      Fixes: 92af4fc6 ("usb: musb: Fix suspend with devices connected for a64")
      Cc: stable@vger.kernel.org
      Tested-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      Tested-by: default avatarDrew Fustini <drew@beagleboard.org>
      Acked-by: default avatarTony Lindgren <tony@atomide.com>
      Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@bootlin.com>
      Link: https://lore.kernel.org/r/20210528140446.278076-1-thomas.petazzoni@bootlin.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b65ba0c3
    • Jack Pham's avatar
      usb: dwc3: gadget: Bail from dwc3_gadget_exit() if dwc->gadget is NULL · 03715ea2
      Jack Pham authored
      There exists a possible scenario in which dwc3_gadget_init() can fail:
      during during host -> peripheral mode switch in dwc3_set_mode(), and
      a pending gadget driver fails to bind.  Then, if the DRD undergoes
      another mode switch from peripheral->host the resulting
      dwc3_gadget_exit() will attempt to reference an invalid and dangling
      dwc->gadget pointer as well as call dma_free_coherent() on unmapped
      DMA pointers.
      
      The exact scenario can be reproduced as follows:
       - Start DWC3 in peripheral mode
       - Configure ConfigFS gadget with FunctionFS instance (or use g_ffs)
       - Run FunctionFS userspace application (open EPs, write descriptors, etc)
       - Bind gadget driver to DWC3's UDC
       - Switch DWC3 to host mode
         => dwc3_gadget_exit() is called. usb_del_gadget() will put the
      	ConfigFS driver instance on the gadget_driver_pending_list
       - Stop FunctionFS application (closes the ep files)
       - Switch DWC3 to peripheral mode
         => dwc3_gadget_init() fails as usb_add_gadget() calls
      	check_pending_gadget_drivers() and attempts to rebind the UDC
      	to the ConfigFS gadget but fails with -19 (-ENODEV) because the
      	FFS instance is not in FFS_ACTIVE state (userspace has not
      	re-opened and written the descriptors yet, i.e. desc_ready!=0).
       - Switch DWC3 back to host mode
         => dwc3_gadget_exit() is called again, but this time dwc->gadget
      	is invalid.
      
      Although it can be argued that userspace should take responsibility
      for ensuring that the FunctionFS application be ready prior to
      allowing the composite driver bind to the UDC, failure to do so
      should not result in a panic from the kernel driver.
      
      Fix this by setting dwc->gadget to NULL in the failure path of
      dwc3_gadget_init() and add a check to dwc3_gadget_exit() to bail out
      unless the gadget pointer is valid.
      
      Fixes: e81a7018 ("usb: dwc3: allocate gadget structure dynamically")
      Cc: <stable@vger.kernel.org>
      Reviewed-by: default avatarPeter Chen <peter.chen@kernel.org>
      Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
      Link: https://lore.kernel.org/r/20210528160405.17550-1-jackp@codeaurora.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      03715ea2
    • Wesley Cheng's avatar
      usb: dwc3: gadget: Disable gadget IRQ during pullup disable · 82129373
      Wesley Cheng authored
      Current sequence utilizes dwc3_gadget_disable_irq() alongside
      synchronize_irq() to ensure that no further DWC3 events are generated.
      However, the dwc3_gadget_disable_irq() API only disables device
      specific events.  Endpoint events can still be generated.  Briefly
      disable the interrupt line, so that the cleanup code can run to
      prevent device and endpoint events. (i.e. __dwc3_gadget_stop() and
      dwc3_stop_active_transfers() respectively)
      
      Without doing so, it can lead to both the interrupt handler and the
      pullup disable routine both writing to the GEVNTCOUNT register, which
      will cause an incorrect count being read from future interrupts.
      
      Fixes: ae7e8610 ("usb: dwc3: Stop active transfers before halting the controller")
      Signed-off-by: default avatarWesley Cheng <wcheng@codeaurora.org>
      Link: https://lore.kernel.org/r/1621571037-1424-1-git-send-email-wcheng@codeaurora.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      82129373
  6. 30 May, 2021 5 commits
    • Linus Torvalds's avatar
      Linux 5.13-rc4 · 8124c8a6
      Linus Torvalds authored
      8124c8a6
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · b90e90f4
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "This is a bit larger than usual at rc4 time. The reason is due to
        Lee's work of fixing newly reported build warnings.
      
        The rest is fixes as usual"
      
      * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (22 commits)
        MAINTAINERS: adjust to removing i2c designware platform data
        i2c: s3c2410: fix possible NULL pointer deref on read message after write
        i2c: mediatek: Disable i2c start_en and clear intr_stat brfore reset
        i2c: i801: Don't generate an interrupt on bus reset
        i2c: mpc: implement erratum A-004447 workaround
        powerpc/fsl: set fsl,i2c-erratum-a004447 flag for P1010 i2c controllers
        powerpc/fsl: set fsl,i2c-erratum-a004447 flag for P2041 i2c controllers
        dt-bindings: i2c: mpc: Add fsl,i2c-erratum-a004447 flag
        i2c: busses: i2c-stm32f4: Remove incorrectly placed ' ' from function name
        i2c: busses: i2c-st: Fix copy/paste function misnaming issues
        i2c: busses: i2c-pnx: Provide descriptions for 'alg_data' data structure
        i2c: busses: i2c-ocores: Place the expected function names into the documentation headers
        i2c: busses: i2c-eg20t: Fix 'bad line' issue and provide description for 'msgs' param
        i2c: busses: i2c-designware-master: Fix misnaming of 'i2c_dw_init_master()'
        i2c: busses: i2c-cadence: Fix incorrectly documented 'enum cdns_i2c_slave_mode'
        i2c: busses: i2c-ali1563: File headers are not good candidates for kernel-doc
        i2c: muxes: i2c-arb-gpio-challenge: Demote non-conformant kernel-doc headers
        i2c: busses: i2c-nomadik: Fix formatting issue pertaining to 'timeout'
        i2c: sh_mobile: Use new clock calculation formulas for RZ/G2E
        i2c: I2C_HISI should depend on ACPI
        ...
      b90e90f4
    • Linus Torvalds's avatar
      Merge tag 'seccomp-fixes-v5.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · 9a76c0ee
      Linus Torvalds authored
      Pull seccomp fixes from Kees Cook:
       "This fixes a hard-to-hit race condition in the addfd user_notif
        feature of seccomp, visible since v5.9.
      
        And a small documentation fix"
      
      * tag 'seccomp-fixes-v5.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        seccomp: Refactor notification handler to prepare for new semantics
        Documentation: seccomp: Fix user notification documentation
      9a76c0ee
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-5.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 9d68fe84
      Linus Torvalds authored
      Pull RISC-V fixes from Palmer Dabbelt:
       "A handful of RISC-V related fixes:
      
         - avoid errors when the stack tracing code is tracing itself.
      
         - resurrect the memtest= kernel command line argument on RISC-V,
           which was briefly enabled during the merge window before a
           refactoring disabled it.
      
         - build fix and some warning cleanups"
      
      * tag 'riscv-for-linus-5.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        riscv: kexec: Fix W=1 build warnings
        riscv: kprobes: Fix build error when MMU=n
        riscv: Select ARCH_USE_MEMTEST
        riscv: stacktrace: fix the riscv stacktrace when CONFIG_FRAME_POINTER enabled
      9d68fe84
    • Linus Torvalds's avatar
      Merge tag 'xfs-5.13-fixes-3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux · 75b9c727
      Linus Torvalds authored
      Pull xfs fixes from Darrick Wong:
       "This week's pile mitigates some decades-old problems in how extent
        size hints interact with realtime volumes, fixes some failures in
        online shrink, and fixes a problem where directory and symlink
        shrinking on extremely fragmented filesystems could fail.
      
        The most user-notable change here is to point users at our (new) IRC
        channel on OFTC. Freedom isn't free, it costs folks like you and me;
        and if you don't kowtow, they'll expel everyone and take over your
        channel. (Ok, ok, that didn't fit the song lyrics...)
      
        Summary:
      
         - Fix a bug where unmapping operations end earlier than expected,
           which can cause chaos on multi-block directory and symlink shrink
           operations.
      
         - Fix an erroneous assert that can trigger if we try to transition a
           bmap structure from btree format to extents format with zero
           extents. This was exposed by xfs/538"
      
      * tag 'xfs-5.13-fixes-3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
        xfs: bunmapi has unnecessary AG lock ordering issues
        xfs: btree format inode forks can have zero extents
        xfs: add new IRC channel to MAINTAINERS
        xfs: validate extsz hints against rt extent size when rtinherit is set
        xfs: standardize extent size hint validation
        xfs: check free AG space when making per-AG reservations
      75b9c727
  7. 29 May, 2021 6 commits