1. 23 7月, 2020 1 次提交
  2. 10 7月, 2020 5 次提交
  3. 27 5月, 2020 1 次提交
    • S
      driver core: Update device link status correctly for SYNC_STATE_ONLY links · 8c3e315d
      Saravana Kannan 提交于
      When SYNC_STATE_ONLY support was added in commit 05ef983e ("driver
      core: Add device link support for SYNC_STATE_ONLY flag"),
      SYNC_STATE_ONLY links were treated similar to STATELESS links in terms
      of not blocking consumer probe if the supplier hasn't probed yet.
      
      That caused a SYNC_STATE_ONLY device link's status to not get updated.
      Since SYNC_STATE_ONLY device link is no longer useful once the
      consumer probes, commit 21c27f06 ("driver core: Fix
      SYNC_STATE_ONLY device link implementation") addresses the status
      update issue by deleting the SYNC_STATE_ONLY device link instead of
      complicating the status update code.
      
      However, there are still some cases where we need to update the status
      of a SYNC_STATE_ONLY device link. This is because a SYNC_STATE_ONLY
      device link can later get converted into a normal MANAGED device link
      when a normal MANAGED device link is created between a supplier and
      consumer that already have a SYNC_STATE_ONLY device link between them.
      
      If a SYNC_STATE_ONLY device link's status isn't maintained correctly
      till it's converted to a normal MANAGED device link, then the normal
      MANAGED device link will end up with a wrong link status. This can cause
      a warning stack trace[1] when the consumer device probes successfully.
      
      This commit fixes the SYNC_STATE_ONLY device link status update issue
      where it wouldn't transition correctly from DL_STATE_DORMANT or
      DL_STATE_AVAILABLE to DL_STATE_CONSUMER_PROBE. It also resets the status
      back to DL_STATE_DORMANT or DL_STATE_AVAILABLE if the consumer probe
      fails.
      
      [1] - https://lore.kernel.org/lkml/20200522204120.3b3c9ed6@apollo/
      Fixes: 05ef983e ("driver core: Add device link support for SYNC_STATE_ONLY flag")
      Fixes: 21c27f06 ("driver core: Fix SYNC_STATE_ONLY device link implementation")
      Reported-by: NMichael Walle <michael@walle.cc>
      Tested-by: NMichael Walle <michael@walle.cc>
      Signed-off-by: NSaravana Kannan <saravanak@google.com>
      Reviewed-by: NRafael J. Wysocki <rrafael.j.wysocki@intel.com>
      Link: https://lore.kernel.org/r/20200526220928.49939-1-saravanak@google.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8c3e315d
  4. 21 5月, 2020 2 次提交
  5. 19 5月, 2020 1 次提交
    • S
      driver core: Fix SYNC_STATE_ONLY device link implementation · 21c27f06
      Saravana Kannan 提交于
      When SYNC_STATE_ONLY support was added in commit 05ef983e ("driver
      core: Add device link support for SYNC_STATE_ONLY flag"),
      device_link_add() incorrectly skipped adding the new SYNC_STATE_ONLY
      device link to the supplier's and consumer's "device link" list.
      
      This causes multiple issues:
      - The device link is lost forever from driver core if the caller
        didn't keep track of it (caller typically isn't expected to). This is
        a memory leak.
      - The device link is also never visible to any other code path after
        device_link_add() returns.
      
      If we fix the "device link" list handling, that exposes a bunch of
      issues.
      
      1. The device link "status" state management code rightfully doesn't
      handle the case where a DL_FLAG_MANAGED device link exists between a
      supplier and consumer, but the consumer manages to probe successfully
      before the supplier. The addition of DL_FLAG_SYNC_STATE_ONLY links break
      this assumption. This causes device_links_driver_bound() to throw a
      warning when this happens.
      
      Since DL_FLAG_SYNC_STATE_ONLY device links are mainly used for creating
      proxy device links for child device dependencies and aren't useful once
      the consumer device probes successfully, this patch just deletes
      DL_FLAG_SYNC_STATE_ONLY device links once its consumer device probes.
      This way, we avoid the warning, free up some memory and avoid
      complicating the device links "status" state management code.
      
      2. Creating a DL_FLAG_STATELESS device link between two devices that
      already have a DL_FLAG_SYNC_STATE_ONLY device link will result in the
      DL_FLAG_STATELESS flag not getting set correctly. This patch also fixes
      this.
      
      Lastly, this patch also fixes minor whitespace issues.
      
      Cc: stable@vger.kernel.org
      Fixes: 05ef983e ("driver core: Add device link support for SYNC_STATE_ONLY flag")
      Signed-off-by: NSaravana Kannan <saravanak@google.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Link: https://lore.kernel.org/r/20200519063000.128819-1-saravanak@google.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      21c27f06
  6. 15 5月, 2020 3 次提交
  7. 10 5月, 2020 1 次提交
  8. 05 5月, 2020 1 次提交
  9. 28 4月, 2020 1 次提交
  10. 21 4月, 2020 1 次提交
  11. 20 4月, 2020 1 次提交
  12. 27 3月, 2020 1 次提交
    • G
      Revert "driver core: Set fw_devlink to "permissive" behavior by default" · 18555cb6
      Greg Kroah-Hartman 提交于
      This reverts commit c442a0d1 as it
      breaks some of the Raspberry Pi devices.  Marek writes:
      	This patch has just landed in linux-next 20200326. Sadly it
      	breaks booting of the Raspberry Pi3b and Pi4 boards, either in
      	32bit or 64bit mode. There is no warning nor panic message, just
      	a silent freeze. The last message shown on the earlycon is:
      
      	[    0.893217] Serial: 8250/16550 driver, 1 ports, IRQ sharing enabled
      
      so revert it for now and let's try again and add it to linux-next after
      5.7-rc1 is out so that we can try to get more debugging/testing
      happening.
      Reported-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Frank Rowand <frowand.list@gmail.com>
      Cc: Saravana Kannan <saravanak@google.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      18555cb6
  13. 24 3月, 2020 1 次提交
  14. 21 3月, 2020 1 次提交
    • S
      driver core: Add device links from fwnode only for the primary device · 4dbe191c
      Saravana Kannan 提交于
      Sometimes, more than one (generally two) device can point to the same
      fwnode.  However, only one device is set as the fwnode's device
      (fwnode->dev) and can be looked up from the fwnode.
      
      Typically, only one of these devices actually have a driver and actually
      probe. If we create device links for all these devices, then the
      suppliers' of these devices (with the same fwnode) will never get a
      sync_state() call because one of their consumer devices will never probe
      (because they don't have a driver).
      
      So, create device links only for the device that is considered as the
      fwnode's device.
      
      One such example of this is the PCI bridge platform_device and the
      corresponding pci_bus device. Both these devices will have the same
      fwnode. It's the platform_device that is registered first and is set as
      the fwnode's device. Also the platform_device is the one that actually
      probes. Without this patch none of the suppliers of a PCI bridge
      platform_device would get a sync_state() callback.
      
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: linux-pci@vger.kernel.org
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NSaravana Kannan <saravanak@google.com>
      Link: https://lore.kernel.org/r/20200321045448.15192-1-saravanak@google.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4dbe191c
  15. 05 3月, 2020 5 次提交
  16. 04 3月, 2020 2 次提交
  17. 27 2月, 2020 2 次提交
  18. 15 11月, 2019 1 次提交
  19. 03 11月, 2019 3 次提交
  20. 10 10月, 2019 1 次提交
    • R
      cpufreq: Avoid cpufreq_suspend() deadlock on system shutdown · 65650b35
      Rafael J. Wysocki 提交于
      It is incorrect to set the cpufreq syscore shutdown callback pointer
      to cpufreq_suspend(), because that function cannot be run in the
      syscore stage of system shutdown for two reasons: (a) it may attempt
      to carry out actions depending on devices that have already been shut
      down at that point and (b) the RCU synchronization carried out by it
      may not be able to make progress then.
      
      The latter issue has been present since commit 45975c7d ("rcu:
      Define RCU-sched API in terms of RCU for Tree RCU PREEMPT builds"),
      but the former one has been there since commit 90de2a4a ("cpufreq:
      suspend cpufreq governors on shutdown") regardless.
      
      Fix that by dropping cpufreq_syscore_ops altogether and making
      device_shutdown() call cpufreq_suspend() directly before shutting
      down devices, which is along the lines of what system-wide power
      management does.
      
      Fixes: 45975c7d ("rcu: Define RCU-sched API in terms of RCU for Tree RCU PREEMPT builds")
      Fixes: 90de2a4a ("cpufreq: suspend cpufreq governors on shutdown")
      Reported-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Tested-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Cc: 4.0+ <stable@vger.kernel.org> # 4.0+
      65650b35
  21. 04 10月, 2019 3 次提交
    • S
      driver core: Add sync_state driver/bus callback · fc5a251d
      Saravana Kannan 提交于
      This sync_state driver/bus callback is called once all the consumers
      of a supplier have probed successfully.
      
      This allows the supplier device's driver/bus to sync the supplier
      device's state to the software state with the guarantee that all the
      consumers are actively managing the resources provided by the supplier
      device.
      
      To maintain backwards compatibility and ease transition from existing
      frameworks and resource cleanup schemes, late_initcall_sync is the
      earliest when the sync_state callback might be called.
      
      There is no upper bound on the time by which the sync_state callback
      has to be called. This is because if a consumer device never probes,
      the supplier has to maintain its resources in the state left by the
      bootloader. For example, if the bootloader leaves the display
      backlight at a fixed voltage and the backlight driver is never probed,
      you don't want the backlight to ever be turned off after boot up.
      
      Also, when multiple devices are added after kernel init, some
      suppliers could be added before their consumer devices get added. In
      these instances, the supplier devices could get their sync_state
      callback called right after they probe because the consumers devices
      haven't had a chance to create device links to the suppliers.
      
      To handle this correctly, this change also provides APIs to
      pause/resume sync state callbacks so that when multiple devices are
      added, their sync_state callback evaluation can be postponed to happen
      after all of them are added.
      
      kbuild test robot reported missing documentation for device.state_synced
      Reported-by: Nkbuild test robot <lkp@intel.com>
      Signed-off-by: NSaravana Kannan <saravanak@google.com>
      Link: https://lore.kernel.org/r/20190904211126.47518-5-saravanak@google.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fc5a251d
    • S
      driver core: Add support for linking devices during device addition · e2ae9bcc
      Saravana Kannan 提交于
      The firmware corresponding to a device (dev.fwnode) might be able to
      provide functional dependency information between a device and its
      supplier and consumer devices.  Tracking this functional dependency
      allows optimizing device probe order and informing a supplier when all
      its consumers have probed (and thereby actively managing their
      resources).
      
      The existing device links feature allows tracking and using
      supplier-consumer relationships. So, this patch adds the add_links()
      fwnode callback to allow firmware to create device links for each
      device as the device is added.
      
      However, when consumer devices are added, they might not have a supplier
      device to link to despite needing mandatory resources/functionality from
      one or more suppliers. A waiting_for_suppliers list is created to track
      such consumers and retry linking them when new devices get added.
      Signed-off-by: NSaravana Kannan <saravanak@google.com>
      Link: https://lore.kernel.org/r/20190904211126.47518-3-saravanak@google.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e2ae9bcc
    • S
      driver core: Add fwnode_to_dev() to look up device from fwnode · 372a67c0
      Saravana Kannan 提交于
      It's often useful to look up a device that corresponds to a fwnode. So
      add an API to do that irrespective of the bus on which the device has
      been added to.
      Signed-off-by: NSaravana Kannan <saravanak@google.com>
      Link: https://lore.kernel.org/r/20190904211126.47518-2-saravanak@google.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      372a67c0
  22. 28 8月, 2019 2 次提交