1. 25 Aug, 2017 11 commits
  2. 16 Aug, 2017 29 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.12.8 · a0fb6543
      Greg Kroah-Hartman authored
      a0fb6543
    • Michael Neuling's avatar
      powerpc: Fix /proc/cpuinfo revision for POWER9 DD2 · 1d4efdd2
      Michael Neuling authored
      commit 64ebb9a2 upstream.
      
      The P9 PVR bits 12-15 don't indicate a revision but instead different
      chip configurations.  From BookIV we have:
         Bits      Configuration
          0 :    Scale out 12 cores
          1 :    Scale out 24 cores
          2 :    Scale up  12 cores
          3 :    Scale up  24 cores
      
      DD1 doesn't use this but DD2 does. Linux will mostly use the "Scale
      out 24 core" configuration (ie. SMT4 not SMT8) which results in a PVR
      of 0x004e1200. The reported revision in /proc/cpuinfo is hence
      reported incorrectly as "18.0".
      
      This patch fixes this to mask off only the relevant bits for the major
      revision (ie. bits 8-11) for POWER9.
      Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarStewart Smith <stewart@linux.vnet.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1d4efdd2
    • Steven J. Hill's avatar
      MIPS: Octeon: Fix broken EDAC driver. · d40a5450
      Steven J. Hill authored
      commit 81a67e52 upstream.
      
      Commit "MIPS: Octeon: Remove unused L2C types and macros." broke the
      the EDAC driver. Bring back 'cvmx-l2d-defs.h' file and the missing
      types for L2C. Fixes: 15f68479 ("MIPS: Octeon: Remove unused L2C
      types and macros.")
      
      Fixes: 15f68479 ("MIPS: Octeon: Remove unused L2C types and macros.")
      Signed-off-by: default avatarSteven J. Hill <steven.hill@cavium.com>
      Reviewed-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16906/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d40a5450
    • Paul Burton's avatar
      Revert "MIPS: Don't unnecessarily include kmalloc.h into <asm/cache.h>." · bc60edb6
      Paul Burton authored
      commit ae5b0675 upstream.
      
      Commit 296e46db ("MIPS: Don't unnecessarily include kmalloc.h into
      <asm/cache.h>.") claimed that the inclusion of the machine's kmalloc.h
      from asm/cache.h is unnecessary, but this is not true.
      
      Without including kmalloc.h we don't get a definition for
      ARCH_DMA_MINALIGN, which means we no longer suitably align DMA. Further
      to this the definition of ARCH_KMALLOC_MINALIGN provided by linux/slab.h
      ends up being set to the alignment of an unsigned long long value rather
      than to ARCH_DMA_MINALIGN, which means that buffers allocated using
      kmalloc may no longer be safely aligned for use with DMA.
      
      Fix this by re-adding the include of kmalloc.h in asm/cache.h. This
      reverts commit 296e46db ("MIPS: Don't unnecessarily include
      kmalloc.h into <asm/cache.h>.")
      Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
      Fixes: 296e46db ("MIPS: Don't unnecessarily include kmalloc.h into <asm/cache.h>.")
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16895/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bc60edb6
    • Maciej W. Rozycki's avatar
      MIPS: DEC: Fix an int-handler.S CPU_DADDI_WORKAROUNDS regression · 0a5a16f6
      Maciej W. Rozycki authored
      commit 68fe5568 upstream.
      
      Fix a commit 3021773c ("MIPS: DEC: Avoid la pseudo-instruction in
      delay slots") regression and remove assembly errors:
      
      arch/mips/dec/int-handler.S: Assembler messages:
      arch/mips/dec/int-handler.S:162: Error: Macro used $at after ".set noat"
      arch/mips/dec/int-handler.S:163: Error: Macro used $at after ".set noat"
      arch/mips/dec/int-handler.S:229: Error: Macro used $at after ".set noat"
      arch/mips/dec/int-handler.S:230: Error: Macro used $at after ".set noat"
      
      triggering with with the CPU_DADDI_WORKAROUNDS option set and the DADDIU
      instruction.  This is because with that option in place the instruction
      becomes a macro, which expands to an LI/DADDU (or actually ADDIU/DADDU)
      sequence that uses $at as a temporary register.
      
      With CPU_DADDI_WORKAROUNDS we only support `-msym32' compilation though,
      and this is already enforced in arch/mips/Makefile, so choose the 32-bit
      expansion variant for the supported configurations and then replace the
      64-bit variant with #error just in case.
      
      Fixes: 3021773c ("MIPS: DEC: Avoid la pseudo-instruction in delay slots")
      Signed-off-by: default avatarMaciej W. Rozycki <macro@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16893/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0a5a16f6
    • Neil Armstrong's avatar
      pinctrl: meson-gxl: Add missing GPIODV_18 pin entry · 88898647
      Neil Armstrong authored
      commit aa955695 upstream.
      
      GPIODV_18 entry was missing in the original driver push.
      
      Fixes: 0f15f500 ("pinctrl: meson: Add GXL pinctrl definitions")
      Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
      Reviewed-by: default avatarJerome Brunet <jbrunet@baylibre.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      88898647
    • Neil Armstrong's avatar
      pinctrl: meson-gxbb: Add missing GPIODV_18 pin entry · d7b28b4c
      Neil Armstrong authored
      commit 34e61801 upstream.
      
      GPIODV_18 entry was missing in the original driver push.
      
      Fixes: 468c234f ("pinctrl: amlogic: Add support for Amlogic Meson GXBB SoC")
      Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
      Reviewed-by: default avatarJerome Brunet <jbrunet@baylibre.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d7b28b4c
    • Thomas Gleixner's avatar
      pinctrl: samsung: Remove bogus irq_[un]mask from resource management · 155407bb
      Thomas Gleixner authored
      commit 3fa53ec2 upstream.
      
      The irq chip callbacks irq_request/release_resources() have absolutely no
      business with masking and unmasking the irq.
      
      The core code unmasks the interrupt after complete setup and masks it
      before invoking irq_release_resources().
      
      The unmask is actually harmful as it happens before the interrupt is
      completely initialized in __setup_irq().
      
      Remove it.
      
      Fixes: f6a8249f ("pinctrl: exynos: Lock GPIOs as interrupts when used as EINTs")
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Krzysztof Kozlowski <krzk@kernel.org>
      Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Kukjin Kim <kgene@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-samsung-soc@vger.kernel.org
      Cc: linux-gpio@vger.kernel.org
      Acked-by: default avatarTomasz Figa <tomasz.figa@gmail.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      155407bb
    • Masahiro Yamada's avatar
      pinctrl: uniphier: fix WARN_ON() of pingroups dump on LD20 · 21d22dff
      Masahiro Yamada authored
      commit 1bd303dc upstream.
      
      The pingroups dump of debugfs hits WARN_ON() in pinctrl_groups_show().
      Filling non-existing ports with '-1' turned out a bad idea.
      
      Fixes: 336306ee ("pinctrl: uniphier: add UniPhier PH1-LD20 pinctrl driver")
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      21d22dff
    • Masahiro Yamada's avatar
      pinctrl: uniphier: fix WARN_ON() of pingroups dump on LD11 · 338ac5dd
      Masahiro Yamada authored
      commit 9592bc25 upstream.
      
      The pingroups dump of debugfs hits WARN_ON() in pinctrl_groups_show().
      Filling non-existing ports with '-1' turned out a bad idea.
      
      Fixes: 70f2f9c4 ("pinctrl: uniphier: add UniPhier PH1-LD11 pinctrl driver")
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      338ac5dd
    • Andy Shevchenko's avatar
      pinctrl: intel: merrifield: Correct UART pin lists · be9f6589
      Andy Shevchenko authored
      commit 5d996132 upstream.
      
      UART pin lists consist GPIO numbers which is simply wrong.
      Replace it by pin numbers.
      
      Fixes: 4e80c8f5 ("pinctrl: intel: Add Intel Merrifield pin controller support")
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      be9f6589
    • Icenowy Zheng's avatar
      pinctrl: sunxi: add a missing function of A10/A20 pinctrl driver · 5fa72b4b
      Icenowy Zheng authored
      commit d81ece74 upstream.
      
      The PH16 pin has a function with mux id 0x5, which is the DET pin of the
      "sim" (smart card reader) IP block.
      
      This function is missing in old versions of A10/A20 SoCs' datasheets and
      user manuals, so it's also missing in the old drivers. The newest A10
      Datasheet V1.70 and A20 Datasheet V1.41 contain this pin function, and
      it's discovered during implementing R40 pinctrl driver.
      
      Add it to the driver. As we now merged A20 pinctrl driver to the A10
      one, we need to only fix the A10 driver now.
      
      Fixes: f2821b1c ("pinctrl: sunxi: Move Allwinner A10 pinctrl
      driver to a driver of its own")
      Signed-off-by: default avatarIcenowy Zheng <icenowy@aosc.io>
      Reviewed-by: default avatarChen-Yu Tsai <wens@csie.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5fa72b4b
    • Andy Shevchenko's avatar
      pinctrl: cherryview: Add Setzer models to the Chromebook DMI quirk · c75a48ee
      Andy Shevchenko authored
      commit 2d80bd3f upstream.
      
      Add one more model to the Chromebook DMI quirk to make it working again.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=194945
      Fixes: 2a8209fa ("pinctrl: cherryview: Extend the Chromebook DMI quirk to Intel_Strago systems")
      Reported-by: mail@abhishek.geek.nz
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c75a48ee
    • Christoph Hellwig's avatar
      pnfs/blocklayout: require 64-bit sector_t · cc7f330b
      Christoph Hellwig authored
      commit 8a9d6e96 upstream.
      
      The blocklayout code does not compile cleanly for a 32-bit sector_t,
      and also has no reliable checks for devices sizes, which makes it
      unsafe to use with a kernel that doesn't support large block devices.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reported-by: default avatarArnd Bergmann <arnd@arndb.de>
      Fixes: 5c83746a ("pnfs/blocklayout: in-kernel GETDEVICEINFO XDR parsing")
      Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cc7f330b
    • Stefan-Gabriel Mirea's avatar
      iio: adc: vf610_adc: Fix VALT selection value for REFSEL bits · e8a1edad
      Stefan-Gabriel Mirea authored
      commit d466d3c1 upstream.
      
      In order to select the alternate voltage reference pair (VALTH/VALTL), the
      right value for the REFSEL field in the ADCx_CFG register is "01", leading
      to 0x800 as register mask. See section 8.2.6.4 in the reference manual[1].
      
      [1] http://www.nxp.com/docs/en/reference-manual/VFXXXRM.pdf
      
      Fixes: a7754276 ("iio:adc:imx: add Freescale Vybrid vf610 adc driver")
      Signed-off-by: default avatarStefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e8a1edad
    • Marc Zyngier's avatar
      xhci: Reset Renesas uPD72020x USB controller for 32-bit DMA issue · 0e1f0eae
      Marc Zyngier authored
      commit 8466489e upstream.
      
      The Renesas uPD72020x XHCI controller seems to suffer from a really
      annoying bug, where it may retain some of its DMA programming across a XHCI
      reset, and despite the driver correctly programming new DMA addresses.
      This is visible if the device has been using 64-bit DMA addresses, and is
      then switched to using 32-bit DMA addresses.  The top 32 bits of the
      address (now zero) are ignored are replaced by the 32 bits from the
      *previous* programming.  Sticking with 64-bit DMA always works, but doesn't
      seem very appropriate.
      
      A PCI reset of the device restores the normal functionality, which is done
      at probe time.  Unfortunately, this has to be done before any quirk has
      been discovered, hence the intrusive nature of the fix.
      Tested-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0e1f0eae
    • Marc Zyngier's avatar
      PCI: Add pci_reset_function_locked() · ea9647cf
      Marc Zyngier authored
      commit a477b9cd upstream.
      
      The implementation of PCI workarounds may require that the device is reset
      from its probe function.  This implies that the PCI device lock is already
      held, and makes calling pci_reset_function() impossible (since it will
      itself try to take that lock).
      
      Add pci_reset_function_locked(), which is the equivalent of
      pci_reset_function(), except that it requires the PCI device lock to be
      already held by the caller.
      Tested-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      [bhelgaas: folded in fix for conflict with 52354b9d ("PCI: Remove
      __pci_dev_reset() and pci_dev_reset()")]
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ea9647cf
    • Christoph Hellwig's avatar
      PCI: Remove __pci_dev_reset() and pci_dev_reset() · c71305e6
      Christoph Hellwig authored
      commit 52354b9d upstream.
      
      Implement the reset probing / reset chain directly in
      __pci_probe_reset_function() and __pci_reset_function_locked()
      respectively.
      
      Link: http://lkml.kernel.org/r/20170601111039.8913-4-hch@lst.deSigned-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c71305e6
    • Christoph Hellwig's avatar
      PCI: Protect pci_error_handlers->reset_notify() usage with device_lock() · 31e71939
      Christoph Hellwig authored
      commit b014e96d upstream.
      
      Every method in struct device_driver or structures derived from it like
      struct pci_driver MUST provide exclusion vs the driver's ->remove() method,
      usually by using device_lock().
      
      Protect use of pci_error_handlers->reset_notify() by holding the device
      lock while calling it.
      
      Note:
      
        - pci_dev_lock() calls device_lock() in addition to blocking user-space
          config accesses.
      
        - pci_err_handlers->reset_notify() is used inside
          pci_dev_save_and_disable() and pci_dev_restore().  We could hold the
          device lock directly in pci_reset_notify(), but we expand the region
          since we have several calls following each other.
      
      Without this, ->reset_notify() may race with ->remove() calls, which can be
      easily triggered in NVMe.
      
      [bhelgaas: changelog, add pci_reset_notify() comment]
      [bhelgaas: fold in fix from Dan Carpenter <dan.carpenter@oracle.com>:
      http://lkml.kernel.org/r/20170701135323.x5vaj4e2wcs2mcro@mwanda]
      Link: http://lkml.kernel.org/r/20170601111039.8913-2-hch@lst.deReported-by: default avatarRakesh Pandit <rakesh@tuxera.com>
      Tested-by: default avatarRakesh Pandit <rakesh@tuxera.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      31e71939
    • Sandeep Singh's avatar
      usb:xhci:Add quirk for Certain failing HP keyboard on reset after resume · b23ef7b8
      Sandeep Singh authored
      commit e788787e upstream.
      
      Certain HP keyboards would keep inputting a character automatically which
      is the wake-up key after S3 resume
      
      On some AMD platforms USB host fails to respond (by holding resume-K) to
      USB device (an HP keyboard) resume request within 1ms (TURSM) and ensures
      that resume is signaled for at least 20 ms (TDRSMDN), which is defined in
      USB 2.0 spec. The result is that the keyboard is out of function.
      
      In SNPS USB design, the host responds to the resume request only after
      system gets back to S0 and the host gets to functional after the internal
      HW restore operation that is more than 1 second after the initial resume
      request from the USB device.
      
      As a workaround for specific keyboard ID(HP Keyboards), applying port reset
      after resume when the keyboard is plugged in.
      Signed-off-by: default avatarSandeep Singh <Sandeep.Singh@amd.com>
      Signed-off-by: default avatarShyam Sundar S K <Shyam-sundar.S-k@amd.com>
      cc: Nehal Shah <Nehal-bakulchandra.Shah@amd.com>
      Reviewed-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b23ef7b8
    • Kai-Heng Feng's avatar
      usb: quirks: Add no-lpm quirk for Moshi USB to Ethernet Adapter · 73e7a2dc
      Kai-Heng Feng authored
      commit 7496cfe5 upstream.
      
      Moshi USB to Ethernet Adapter internally uses a Genesys Logic hub to
      connect to Realtek r8153.
      
      The Realtek r8153 ethernet does not work on the internal hub, no-lpm quirk
      can make it work.
      
      Since another r8153 dongle at my hand does not have the issue, so add
      the quirk to the Genesys Logic hub instead.
      Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      73e7a2dc
    • Bin Liu's avatar
      usb: core: unlink urbs from the tail of the endpoint's urb_list · 488f4d80
      Bin Liu authored
      commit 2eac1362 upstream.
      
      While unlink an urb, if the urb has been programmed in the controller,
      the controller driver might do some hw related actions to tear down the
      urb.
      
      Currently usb_hcd_flush_endpoint() passes each urb from the head of the
      endpoint's urb_list to the controller driver, which could make the
      controller driver think each urb has been programmed and take the
      unnecessary actions for each urb.
      
      This patch changes the behavior in usb_hcd_flush_endpoint() to pass the
      urbs from the tail of the list, to avoid any unnecessary actions in an
      controller driver.
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarBin Liu <b-liu@ti.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      488f4d80
    • Alan Stern's avatar
      USB: Check for dropped connection before switching to full speed · 7ff799af
      Alan Stern authored
      commit 94c43b98 upstream.
      
      Some buggy USB disk adapters disconnect and reconnect multiple times
      during the enumeration procedure.  This may lead to a device
      connecting at full speed instead of high speed, because when the USB
      stack sees that a device isn't able to enumerate at high speed, it
      tries to hand the connection over to a full-speed companion
      controller.
      
      The logic for doing this is careful to check that the device is still
      connected.  But this check is inadequate if the device disconnects and
      reconnects before the check is done.  The symptom is that a device
      works, but much more slowly than it is capable of operating.
      
      The situation was made worse recently by commit 22547c4c ("usb:
      hub: Wait for connection to be reestablished after port reset"), which
      increases the delay following a reset before a disconnect is
      recognized, thus giving the device more time to reconnect.
      
      This patch makes the check more robust.  If the device was
      disconnected at any time during enumeration, we will now skip the
      full-speed handover.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Reported-and-tested-by: default avatarZdenek Kabelac <zkabelac@redhat.com>
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7ff799af
    • Yoshihiro Shimoda's avatar
      usb: renesas_usbhs: Fix UGCTRL2 value for R-Car Gen3 · c45923eb
      Yoshihiro Shimoda authored
      commit 2acecd58 upstream.
      
      The latest HW manual (Rev.0.55) shows us this UGCTRL2.VBUSSEL bit.
      If the bit sets to 1, the VBUS drive is controlled by phy related
      registers (called "UCOM Registers" on the manual). Since R-Car Gen3
      environment will control VBUS by phy-rcar-gen3-usb2 driver,
      the UGCTRL2.VBUSSEL bit should be set to 1. So, this patch fixes
      the register's value. Otherwise, even if the ID pin indicates to
      peripheral, the R-Car will output USBn_PWEN to 1 when a host driver
      is running.
      
      Fixes: de18757e ("usb: renesas_usbhs: add R-Car Gen3 power control"
      Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c45923eb
    • Yoshihiro Shimoda's avatar
      usb: gadget: udc: renesas_usb3: Fix usb_gadget_giveback_request() calling · f5324020
      Yoshihiro Shimoda authored
      commit aca5b9eb upstream.
      
      According to the gadget.h, a "complete" function will always be called
      with interrupts disabled. However, sometimes usb3_request_done() function
      is called with interrupts enabled. So, this function should be held
      by spin_lock_irqsave() to disable interruption. Also, this driver has
      to call spin_unlock() to avoid spinlock recursion by this driver before
      calling usb_gadget_giveback_request().
      Reported-by: default avatarKazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
      Tested-by: default avatarKazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
      Fixes: 746bfe63 ("usb: gadget: renesas_usb3: add support for Renesas USB3.0 peripheral controller")
      Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f5324020
    • Bart Van Assche's avatar
      block: Make blk_mq_delay_kick_requeue_list() rerun the queue at a quiet time · 79263486
      Bart Van Assche authored
      commit d4acf365 upstream.
      
      The blk_mq_delay_kick_requeue_list() function is used by the device
      mapper and only by the device mapper to rerun the queue and requeue
      list after a delay. This function is called once per request that
      gets requeued. Modify this function such that the queue is run once
      per path change event instead of once per request that is requeued.
      
      Fixes: commit 2849450a ("blk-mq: introduce blk_mq_delay_kick_requeue_list()")
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
      Cc: Mike Snitzer <snitzer@redhat.com>
      Cc: Laurence Oberman <loberman@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      79263486
    • Luis R. Rodriguez's avatar
      firmware: avoid invalid fallback aborts by using killable wait · 67e1a98e
      Luis R. Rodriguez authored
      commit 260d9f2f upstream.
      
      Commit 0cb64249 ("firmware_loader: abort request if wait_for_completion
      is interrupted") added via 4.0 added support to abort the fallback mechanism
      when a signal was detected and wait_for_completion_interruptible() returned
      -ERESTARTSYS -- for instance when a user hits CTRL-C. The abort was overly
      *too* effective.
      
      When a child process terminates (successful or not) the signal SIGCHLD can
      be sent to the parent process which ran the child in the background and
      later triggered a sync request for firmware through a sysfs interface which
      relies on the fallback mechanism. This signal in turn can be recieved by the
      interruptible wait we constructed on firmware_class and detects it as an
      abort *before* userspace could get a chance to write the firmware. Upon
      failure -EAGAIN is returned, so userspace is also kept in the dark about
      exactly what happened.
      
      We can reproduce the issue with the fw_fallback.sh selftest:
      
      Before this patch:
      $ sudo tools/testing/selftests/firmware/fw_fallback.sh
      ...
      tools/testing/selftests/firmware/fw_fallback.sh: error - sync firmware request cancelled due to SIGCHLD
      
      After this patch:
      $ sudo tools/testing/selftests/firmware/fw_fallback.sh
      ...
      tools/testing/selftests/firmware/fw_fallback.sh: SIGCHLD on sync ignored as expected
      
      Fix this by making the wait killable -- only killable by SIGKILL (kill -9).
      We loose the ability to allow userspace to cancel a write with CTRL-C
      (SIGINT), however its been decided the compromise to require SIGKILL is
      worth the gains.
      
      Chances of this issue occuring are low due to the number of drivers upstream
      exclusively relying on the fallback mechanism for firmware (2 drivers),
      however this is observed in the field with custom drivers with sysfs
      triggers to load firmware. Only distributions relying on the fallback
      mechanism are impacted as well. An example reported issue was on Android,
      as follows:
      
      1) Android init (pid=1) fork()s (say pid=42) [this child process is totally
         unrelated to firmware loading, it could be sleep 2; for all we care ]
      2) Android init (pid=1) does a write() on a (driver custom) sysfs file which
         ends up calling request_firmware() kernel side
      3) The firmware loading fallback mechanism is used, the request is sent to
         userspace and pid 1 waits in the kernel on wait_*
      4) before firmware loading completes pid 42 dies (for any reason, even
         normal termination)
      5) Kernel delivers SIGCHLD to pid=1 to tell it a child has died, which
         causes -ERESTARTSYS to be returned from wait_*
      6) The kernel's wait aborts and return -EAGAIN for the
         request_firmware() caller.
      
      Fixes: 0cb64249 ("firmware_loader: abort request if wait_for_completion is interrupted")
      Suggested-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      Suggested-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Tested-by: default avatarMartin Fuzzey <mfuzzey@parkeon.com>
      Reported-by: default avatarMartin Fuzzey <mfuzzey@parkeon.com>
      Signed-off-by: default avatarLuis R. Rodriguez <mcgrof@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      67e1a98e
    • Luis R. Rodriguez's avatar
      firmware: fix batched requests - send wake up on failure on direct lookups · b1b5c0b2
      Luis R. Rodriguez authored
      commit 90d41e74 upstream.
      
      Fix batched requests from waiting forever on failure.
      
      The firmware API batched requests feature has been broken since the API call
      request_firmware_direct() was introduced on commit bba3a87e ("firmware:
      Introduce request_firmware_direct()"), added on v3.14 *iff* the firmware
      being requested was not present in *certain kernel builds* [0].
      
      When no firmware is found the worker which goes on to finish never informs
      waiters queued up of this, so any batched request will stall in what seems
      to be forever (MAX_SCHEDULE_TIMEOUT). Sadly, a reboot will also stall, as
      the reboot notifier was only designed to kill custom fallback workers. The
      issue seems to the user as a type of soft lockup, what *actually* happens
      underneath the hood is a wait call which never completes as we failed to
      issue a completion on error.
      
      For device drivers with optional firmware schemes (ie, Intel iwlwifi, or
      Netronome -- even though it uses request_firmware() and not
      request_firmware_direct()), this could mean that when you boot a system with
      multiple cards the firmware will seem to never load on the system, or that
      the card is just not responsive even the driver initialization. Due to
      differences in scheduling possible this should not always trigger --
      one would need to to ensure that multiple requests are in place at the
      right time for this to work, also release_firmware() must not be called
      prior to any other incoming request. The complexity may not be worth
      supporting batched requests in the future given the wait mechanism is
      only used also for the fallback mechanism. We'll keep it for now and
      just fix it.
      
      Its reported that at least with the Intel WiFi cards on one system this
      issue was creeping up 50% of the boots [0].
      
      Before this commit batched requests testing revealed:
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n
      CONFIG_FW_LOADER_USER_HELPER=y
      
      Most common Linux distribution setup.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     FAIL                OK
      request_firmware_direct()              FAIL                OK
      request_firmware_nowait(uevent=true)   FAIL                OK
      request_firmware_nowait(uevent=false)  FAIL                OK
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n
      CONFIG_FW_LOADER_USER_HELPER=n
      
      Only possible if CONFIG_DELL_RBU=n and CONFIG_LEDS_LP55XX_COMMON=n, rare.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     FAIL                OK
      request_firmware_direct()              FAIL                OK
      request_firmware_nowait(uevent=true)   FAIL                OK
      request_firmware_nowait(uevent=false)  FAIL                OK
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
      CONFIG_FW_LOADER_USER_HELPER=y
      
      Google Android setup.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     OK                  OK
      request_firmware_direct()              FAIL                OK
      request_firmware_nowait(uevent=true)   OK                  OK
      request_firmware_nowait(uevent=false)  OK                  OK
      ============================================================================
      
      Ater this commit batched testing results:
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n
      CONFIG_FW_LOADER_USER_HELPER=y
      
      Most common Linux distribution setup.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     OK                  OK
      request_firmware_direct()              OK                  OK
      request_firmware_nowait(uevent=true)   OK                  OK
      request_firmware_nowait(uevent=false)  OK                  OK
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n
      CONFIG_FW_LOADER_USER_HELPER=n
      
      Only possible if CONFIG_DELL_RBU=n and CONFIG_LEDS_LP55XX_COMMON=n, rare.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     OK                  OK
      request_firmware_direct()              OK                  OK
      request_firmware_nowait(uevent=true)   OK                  OK
      request_firmware_nowait(uevent=false)  OK                  OK
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
      CONFIG_FW_LOADER_USER_HELPER=y
      
      Google Android setup.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     OK                  OK
      request_firmware_direct()              OK                  OK
      request_firmware_nowait(uevent=true)   OK                  OK
      request_firmware_nowait(uevent=false)  OK                  OK
      ============================================================================
      
      [0] https://bugzilla.kernel.org/show_bug.cgi?id=195477
      
      Fixes: bba3a87e ("firmware: Introduce request_firmware_direct()"
      Reported-by: default avatarNicolas <nbroeking@me.com>
      Reported-by: default avatarJohn Ewalt  <jewalt@lgsinnovations.com>
      Reported-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarLuis R. Rodriguez <mcgrof@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b1b5c0b2
    • Luis R. Rodriguez's avatar
      firmware: fix batched requests - wake all waiters · c2c32ed5
      Luis R. Rodriguez authored
      commit e44565f6 upstream.
      
      The firmware cache mechanism serves two purposes, the secondary purpose is
      not well documented nor understood. This fixes a regression with the
      secondary purpose of the firmware cache mechanism: batched requests on
      successful lookups. Without this fix *any* time a batched request is
      triggered, secondary requests for which the batched request mechanism
      was designed for will seem to last forver and seem to never return.
      This issue is present for all kernel builds possible, and a hard reset
      is required.
      
      The firmware cache is used for:
      
      1) Addressing races with file lookups during the suspend/resume cycle
         by keeping firmware in memory during the suspend/resume cycle
      
      2) Batched requests for the same file rely only on work from the first file
         lookup, which keeps the firmware in memory until the last
         release_firmware() is called
      
      Batched requests *only* take effect if secondary requests come in prior to
      the first user calling release_firmware(). The devres name used for the
      internal firmware cache is used as a hint other pending requests are
      ongoing, the firmware buffer data is kept in memory until the last user of
      the buffer calls release_firmware(), therefore serializing requests and
      delaying the release until all requests are done.
      
      Batched requests wait for a wakup or signal so we can rely on the first file
      fetch to write to the pending secondary requests. Commit 5b029624
      ("firmware: do not use fw_lock for fw_state protection") ported the firmware
      API to use swait, and in doing so failed to convert complete_all() to
      swake_up_all() -- it used swake_up(), loosing the ability for *some* batched
      requests to take effect.
      
      We *could* fix this by just using swake_up_all() *but* swait is now known
      to be very special use case, so its best to just move away from it. So we
      just go back to using completions as before commit 5b029624 ("firmware:
      do not use fw_lock for fw_state protection") given this was using
      complete_all().
      
      Without this fix it has been reported plugging in two Intel 6260 Wifi cards
      on a system will end up enumerating the two devices only 50% of the time
      [0]. The ported swake_up() should have actually handled the case with two
      devices, however, *if more than two cards are used* the swake_up() would
      not have sufficed. This change is only part of the required fixes for
      batched requests. Another fix is provided in the next patch.
      
      This particular change should fix the cases where more than three requests
      with the same firmware name is used, otherwise batched requests will wait
      for MAX_SCHEDULE_TIMEOUT and just timeout eventually.
      
      Below is a summary of tests triggering batched requests on different
      kernel builds.
      
      Before this patch:
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n
      CONFIG_FW_LOADER_USER_HELPER=y
      
      Most common Linux distribution setup.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     FAIL                FAIL
      request_firmware_direct()              FAIL                FAIL
      request_firmware_nowait(uevent=true)   FAIL                FAIL
      request_firmware_nowait(uevent=false)  FAIL                FAIL
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n
      CONFIG_FW_LOADER_USER_HELPER=n
      
      Only possible if CONFIG_DELL_RBU=n and CONFIG_LEDS_LP55XX_COMMON=n, rare.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     FAIL                FAIL
      request_firmware_direct()              FAIL                FAIL
      request_firmware_nowait(uevent=true)   FAIL                FAIL
      request_firmware_nowait(uevent=false)  FAIL                FAIL
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
      CONFIG_FW_LOADER_USER_HELPER=y
      
      Google Android setup.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     FAIL                FAIL
      request_firmware_direct()              FAIL                FAIL
      request_firmware_nowait(uevent=true)   FAIL                FAIL
      request_firmware_nowait(uevent=false)  FAIL                FAIL
      ============================================================================
      
      After this patch:
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n
      CONFIG_FW_LOADER_USER_HELPER=y
      
      Most common Linux distribution setup.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     FAIL                OK
      request_firmware_direct()              FAIL                OK
      request_firmware_nowait(uevent=true)   FAIL                OK
      request_firmware_nowait(uevent=false)  FAIL                OK
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n
      CONFIG_FW_LOADER_USER_HELPER=n
      
      Only possible if CONFIG_DELL_RBU=n and CONFIG_LEDS_LP55XX_COMMON=n, rare.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     FAIL                OK
      request_firmware_direct()              FAIL                OK
      request_firmware_nowait(uevent=true)   FAIL                OK
      request_firmware_nowait(uevent=false)  FAIL                OK
      ============================================================================
      CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
      CONFIG_FW_LOADER_USER_HELPER=y
      
      Google Android setup.
      
      API-type                               no-firmware-found   firmware-found
      ----------------------------------------------------------------------
      request_firmware()                     OK                  OK
      request_firmware_direct()              FAIL                OK
      request_firmware_nowait(uevent=true)   OK                  OK
      request_firmware_nowait(uevent=false)  OK                  OK
      ============================================================================
      
      [0] https://bugzilla.kernel.org/show_bug.cgi?id=195477
      
      Cc: Ming Lei <ming.lei@redhat.com>
      Fixes: 5b029624 ("firmware: do not use fw_lock for fw_state protection")
      Reported-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarLuis R. Rodriguez <mcgrof@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c2c32ed5