1. 02 3月, 2019 1 次提交
  2. 26 2月, 2019 2 次提交
  3. 20 2月, 2019 1 次提交
    • R
      driver core: Fix PM-runtime for links added during consumer probe · 36003d4c
      Rafael J. Wysocki 提交于
      Commit 4c06c4e6 ("driver core: Fix possible supplier PM-usage
      counter imbalance") introduced a regression that causes suppliers
      to be suspended prematurely for device links added during consumer
      driver probe if the initial PM-runtime status of the consumer is
      "suspended" and the consumer is resumed after adding the link and
      before pm_runtime_put_suppliers() is called.  In that case,
      pm_runtime_put_suppliers() will drop the rpm_active refcount for
      the link by one and (since rpm_active is equal to two after the
      preceding consumer resume) the supplier's PM-runtime usage counter
      will be decremented, which may cause the supplier to suspend even
      though the consumer's PM-runtime status is "active".
      
      For this reason, partially revert commit 4c06c4e6 as the problem
      it tried to fix needs to be addressed somewhat differently, and
      change pm_runtime_get_suppliers() and pm_runtime_put_suppliers() so
      that the latter only drops rpm_active references acquired by the
      former.  [This requires adding a new field to struct device_link,
      but I coulnd't find a cleaner way to address the issue that would
      work in all cases.]
      
      This causes pm_runtime_put_suppliers() to effectively ignore device
      links added during consumer probe, so device_link_add() doesn't need
      to worry about ensuring that suppliers will remain active after
      pm_runtime_put_suppliers() for links created with DL_FLAG_RPM_ACTIVE
      set and it only needs to bump up rpm_active by one for those links,
      so pm_runtime_active_link() is not necessary any more.
      
      Fixes: 4c06c4e6 ("driver core: Fix possible supplier PM-usage counter imbalance")
      Reported-by: NJon Hunter <jonathanh@nvidia.com>
      Tested-by: NJon Hunter <jonathanh@nvidia.com>
      Tested-by: NUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      36003d4c
  4. 19 2月, 2019 1 次提交
  5. 14 2月, 2019 1 次提交
    • F
      async: Add cmdline option to specify drivers to be async probed · 1ea61b68
      Feng Tang 提交于
      Asynchronous driver probing can help much on kernel fastboot, and
      this option can provide a flexible way to optimize and quickly verify
      async driver probe.
      
      Also it will help in below cases:
      * Some driver actually covers several families of HWs, some of which
        could use async probing while others don't. So we can't simply
        turn on the PROBE_PREFER_ASYNCHRONOUS flag in driver, but use this
        cmdline option, like igb driver async patch discussed at
        https://www.spinics.net/lists/netdev/msg545986.html
      
      * For SOC (System on Chip) with multiple spi or i2c controllers, most
        of the slave spi/i2c devices will be assigned with fixed controller
        number, while async probing may make those controllers get different
        index for each boot, which prevents those controller drivers to be
        async probed. For platforms not using these spi/i2c slave devices,
        they can use this cmdline option to benefit from the async probing.
      Suggested-by: NAlexander Duyck <alexander.h.duyck@linux.intel.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Signed-off-by: NFeng Tang <feng.tang@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1ea61b68
  6. 13 2月, 2019 2 次提交
    • R
      driver core: Fix possible supplier PM-usage counter imbalance · 4c06c4e6
      Rafael J. Wysocki 提交于
      If a stateless device link to a certain supplier with
      DL_FLAG_PM_RUNTIME set in the flags is added and then removed by the
      consumer driver's probe callback, the supplier's PM-runtime usage
      counter will be nonzero after that which effectively causes the
      supplier to remain "always on" going forward.
      
      Namely, device_link_add() called to add the link invokes
      device_link_rpm_prepare() which notices that the consumer driver is
      probing, so it increments the supplier's PM-runtime usage counter
      with the assumption that the link will stay around until
      pm_runtime_put_suppliers() is called by driver_probe_device(),
      but if the link goes away before that point, the supplier's
      PM-runtime usage counter will remain nonzero.
      
      To prevent that from happening, first rework pm_runtime_get_suppliers()
      and pm_runtime_put_suppliers() to use the rpm_active refounts of device
      links and make the latter only drop rpm_active and the supplier's
      PM-runtime usage counter for each link by one, unless rpm_active is
      one already for it.  Next, modify device_link_add() to bump up the
      new link's rpm_active refcount and the suppliers PM-runtime usage
      counter by two, to prevent pm_runtime_put_suppliers(), if it is
      called subsequently, from suspending the supplier prematurely (in
      case its PM-runtime usage counter goes down to 0 in there).
      
      Due to the way rpm_put_suppliers() works, this change does not
      affect runtime suspend of the consumer ends of new device links (or,
      generally, device links for which DL_FLAG_PM_RUNTIME has just been
      set).
      
      Fixes: e2f3cd83 ("driver core: Fix handling of runtime PM flags in device_link_add()")
      Reported-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
      Tested-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4c06c4e6
    • R
      PM-runtime: Fix __pm_runtime_set_status() race with runtime resume · c1567f81
      Rafael J. Wysocki 提交于
      Commit 4080ab08 ("PM-runtime: Take suppliers into account in
      __pm_runtime_set_status()") introduced a race condition that may
      trigger if __pm_runtime_set_status() is used incorrectly (that is,
      if it is called when PM-runtime is enabled for the target device
      and working).
      
      In that case, if the original PM-runtime status of the device is
      RPM_SUSPENDED, a runtime resume of the device may occur after
      __pm_runtime_set_status() has dropped its power.lock spinlock
      and before deactivating its suppliers, so the suppliers may be
      deactivated while the device is PM-runtime-active which may lead
      to functional issues.
      
      To avoid that, modify __pm_runtime_set_status() to check whether
      or not PM-runtime is enabled for the device before activating its
      suppliers (if the new status is RPM_ACTIVE) and either return an
      error if that's the case or increment the device's disable_depth
      counter to prevent PM-runtime from being enabled for it while
      the remaining part of the function is running (disable_depth is
      then decremented on the way out).
      
      Fixes: 4080ab08 ("PM-runtime: Take suppliers into account in __pm_runtime_set_status()")
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c1567f81
  7. 12 2月, 2019 1 次提交
  8. 08 2月, 2019 7 次提交
    • D
      i915/snd_hdac: I915 subcomponent for the snd_hdac · 8857c7d0
      Daniel Vetter 提交于
      Since we need multiple components for I915 for different purposes
      (Audio & Mei_hdcp), we adopt the subcomponents methodology introduced
      by the previous patch (mentioned below).
      
      	Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      	Date:   Mon Jan 28 17:08:20 2019 +0530
      
      	    components: multiple components for a device
      Reviewed-by: NTakashi Iwai <tiwai@suse.de>
      Signed-off-by-by: Ramalingam C <ramalinagm.c@intel.com> (commit message)
      Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> (code)
      cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      cc: Russell King <rmk+kernel@arm.linux.org.uk>
      cc: Rafael J. Wysocki <rafael@kernel.org>
      cc: Jaroslav Kysela <perex@perex.cz>
      cc: Takashi Iwai <tiwai@suse.com>
      cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      cc: Jani Nikula <jani.nikula@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190207232759.14553-4-daniel.vetter@ffwll.ch
      8857c7d0
    • D
      components: multiple components for a device · 3521ee99
      Daniel Vetter 提交于
      Component framework is extended to support multiple components for
      a struct device. These will be matched with different masters based on
      its sub component value.
      
      We are introducing this, as I915 needs two different components
      with different subcomponent value, which will be matched to two
      different component masters(Audio and HDCP) based on the subcomponent
      values.
      
      v2: Add documenation.
      
      v3: Rebase on top of updated documenation.
      
      v4: Review from Rafael:
      - Remove redundant "This" from kerneldoc (also in the previous patch)
      - Streamline the logic in find_component() a bit.
      
      Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> (v1 code)
      Signed-off-by: Ramalingam C <ramalingam.c@intel.com> (v1 commit message)
      Cc: Ramalingam C <ramalingam.c@intel.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Cc: Rafael J. Wysocki <rafael@kernel.org>
      Cc: Jaroslav Kysela <perex@perex.cz>
      Cc: Takashi Iwai <tiwai@suse.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190207232759.14553-2-daniel.vetter@ffwll.ch
      3521ee99
    • D
      component: Add documentation · 4d69c80e
      Daniel Vetter 提交于
      While typing these I think doing an s/component_master/aggregate/
      would be useful:
      - it's shorter :-)
      - I think component/aggregate is much more meaningful naming than
        component/puppetmaster or something like that. At least to my
        English ear "aggregate" emphasizes much more the "assemble a pile of
        things into something bigger" aspect, and there's not really much
        of a control hierarchy between aggregate and constituing components.
      
      But that's way more than a quick doc typing exercise ...
      
      Thanks to Ram for commenting on an initial draft of these docs.
      
      v2: Review from Rafael:
      - git add Documenation/driver-api/component.rst
      - lots of polish to the wording + spelling fixes.
      
      v3: Review from Russell:
      - s/framework/helper
      - clarify the documentation for component_match_add functions.
      
      v4: Remove a few superflous "This".
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: "C, Ramalingam" <ramalingam.c@intel.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Cc: Rafael J. Wysocki <rafael@kernel.org>
      Cc: Jaroslav Kysela <perex@perex.cz>
      Cc: Takashi Iwai <tiwai@suse.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190207232759.14553-1-daniel.vetter@ffwll.ch
      4d69c80e
    • G
      driver core: Postpone DMA tear-down until after devres release · 376991db
      Geert Uytterhoeven 提交于
      When unbinding the (IOMMU-enabled) R-Car SATA device on Salvator-XS
      (R-Car H3 ES2.0), in preparation of rebinding against vfio-platform for
      device pass-through for virtualization:
      
          echo ee300000.sata > /sys/bus/platform/drivers/sata_rcar/unbind
      
      the kernel crashes with:
      
          Unable to handle kernel paging request at virtual address ffffffbf029ffffc
          Mem abort info:
            ESR = 0x96000006
            Exception class = DABT (current EL), IL = 32 bits
            SET = 0, FnV = 0
            EA = 0, S1PTW = 0
          Data abort info:
            ISV = 0, ISS = 0x00000006
            CM = 0, WnR = 0
          swapper pgtable: 4k pages, 39-bit VAs, pgdp = 000000007e8c586c
          [ffffffbf029ffffc] pgd=000000073bfc6003, pud=000000073bfc6003, pmd=0000000000000000
          Internal error: Oops: 96000006 [#1] SMP
          Modules linked in:
          CPU: 0 PID: 1098 Comm: bash Not tainted 5.0.0-rc5-salvator-x-00452-g37596f884f4318ef #287
          Hardware name: Renesas Salvator-X 2nd version board based on r8a7795 ES2.0+ (DT)
          pstate: 60400005 (nZCv daif +PAN -UAO)
          pc : __free_pages+0x8/0x58
          lr : __dma_direct_free_pages+0x50/0x5c
          sp : ffffff801268baa0
          x29: ffffff801268baa0 x28: 0000000000000000
          x27: ffffffc6f9c60bf0 x26: ffffffc6f9c60bf0
          x25: ffffffc6f9c60810 x24: 0000000000000000
          x23: 00000000fffff000 x22: ffffff8012145000
          x21: 0000000000000800 x20: ffffffbf029fffc8
          x19: 0000000000000000 x18: ffffffc6f86c42c8
          x17: 0000000000000000 x16: 0000000000000070
          x15: 0000000000000003 x14: 0000000000000000
          x13: ffffff801103d7f8 x12: 0000000000000028
          x11: ffffff8011117604 x10: 0000000000009ad8
          x9 : ffffff80110126d0 x8 : ffffffc6f7563000
          x7 : 6b6b6b6b6b6b6b6b x6 : 0000000000000018
          x5 : ffffff8011cf3cc8 x4 : 0000000000004000
          x3 : 0000000000080000 x2 : 0000000000000001
          x1 : 0000000000000000 x0 : ffffffbf029fffc8
          Process bash (pid: 1098, stack limit = 0x00000000c38e3e32)
          Call trace:
           __free_pages+0x8/0x58
           __dma_direct_free_pages+0x50/0x5c
           arch_dma_free+0x1c/0x98
           dma_direct_free+0x14/0x24
           dma_free_attrs+0x9c/0xdc
           dmam_release+0x18/0x20
           release_nodes+0x25c/0x28c
           devres_release_all+0x48/0x4c
           device_release_driver_internal+0x184/0x1f0
           device_release_driver+0x14/0x1c
           unbind_store+0x70/0xb8
           drv_attr_store+0x24/0x34
           sysfs_kf_write+0x4c/0x64
           kernfs_fop_write+0x154/0x1c4
           __vfs_write+0x34/0x164
           vfs_write+0xb4/0x16c
           ksys_write+0x5c/0xbc
           __arm64_sys_write+0x14/0x1c
           el0_svc_common+0x98/0x114
           el0_svc_handler+0x1c/0x24
           el0_svc+0x8/0xc
          Code: d51b4234 17fffffa a9bf7bfd 910003fd (b9403404)
          ---[ end trace 8c564cdd3a1a840f ]---
      
      While I've bisected this to commit e8e683ae ("iommu/of: Fix
      probe-deferral"), and reverting that commit on post-v5.0-rc4 kernels
      does fix the problem, this turned out to be a red herring.
      
      On arm64, arch_teardown_dma_ops() resets dev->dma_ops to NULL.
      Hence if a driver has used a managed DMA allocation API, the allocated
      DMA memory will be freed using the direct DMA ops, while it may have
      been allocated using a custom DMA ops (iommu_dma_ops in this case).
      
      Fix this by reversing the order of the calls to devres_release_all() and
      arch_teardown_dma_ops().
      Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Acked-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: stable <stable@vger.kernel.org>
      Reviewed-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      376991db
    • R
      PM-runtime: Take suppliers into account in __pm_runtime_set_status() · 4080ab08
      Rafael J. Wysocki 提交于
      If the target device has any suppliers, as reflected by device links
      to them, __pm_runtime_set_status() does not take them into account,
      which is not consistent with the other parts of the PM-runtime
      framework and may lead to programming mistakes.
      
      Modify __pm_runtime_set_status() to take suppliers into account by
      activating them upfront if the new status is RPM_ACTIVE and
      deactivating them on exit if the new status is RPM_SUSPENDED.
      
      If the activation of one of the suppliers fails, the new status
      will be RPM_SUSPENDED and the (remaining) suppliers will be
      deactivated on exit (the child count of the device's parent
      will be dropped too then).
      
      Of course, adding device links locking to __pm_runtime_set_status()
      means that it cannot be run fron interrupt context, so make it use
      spin_lock_irq() and spin_unlock_irq() instead of spin_lock_irqsave()
      and spin_unlock_irqrestore(), respectively.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4080ab08
    • A
      net: dsa: b53: Fix for failure when irq is not defined in dt · 39841cc1
      Arun Parameswaran 提交于
      Fixes the issues with non BCM58XX chips in the b53 driver
      failing, when the irq is not specified in the device tree.
      
      Removed the check for BCM58XX in b53_srab_prepare_irq(),
      so the 'port->irq' will be set to '-EXIO' if the irq is not
      specified in the device tree.
      
      Fixes: 16994374 ("net: dsa: b53: Make SRAB driver manage port interrupts")
      Fixes: b2ddc48a ("net: dsa: b53: Do not fail when IRQ are not initialized")
      Signed-off-by: NArun Parameswaran <arun.parameswaran@broadcom.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      39841cc1
    • H
      geneve: should not call rt6_lookup() when ipv6 was disabled · c0a47e44
      Hangbin Liu 提交于
      When we add a new GENEVE device with IPv6 remote, checking only for
      IS_ENABLED(CONFIG_IPV6) is not enough as we may disable IPv6 in the
      kernel command line (ipv6.disable=1), and calling rt6_lookup() would
      cause a NULL pointer dereference.
      
      v2:
      - don't mix declarations and code (reported by Stefano Brivio, Eric Dumazet)
      - there's no need to use in6_dev_get() as we only need to check that
        idev exists (reported by David Ahern). This is under RTNL, so we can
        simply use __in6_dev_get() instead (Stefano, Eric).
      Reported-by: NJianlin Shi <jishi@redhat.com>
      Fixes: c40e89fd ("geneve: configure MTU based on a lower device")
      Cc: Alexey Kodanev <alexey.kodanev@oracle.com>
      Signed-off-by: NHangbin Liu <liuhangbin@gmail.com>
      Reviewed-by: NStefano Brivio <sbrivio@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c0a47e44
  9. 07 2月, 2019 24 次提交