1. 02 3月, 2014 2 次提交
    • U
      PM: Add pm_runtime_suspend|resume_force functions · 37f20416
      Ulf Hansson 提交于
      This patch provides two new runtime PM helper functions which intend to
      be used from system suspend/resume callbacks, to make sure devices are
      put into low power state during system suspend and brought back to full
      power at system resume.
      
      The prerequisite is to have all levels of a device's runtime PM
      callbacks to be defined through the SET_PM_RUNTIME_PM_OPS macro, which
      means these are available for CONFIG_PM.
      
      By using the new runtime PM helper functions especially the two
      scenarios below will be addressed.
      
      1) The PM core prevents .runtime_suspend callbacks from being invoked
      during system suspend. That means even for a runtime PM centric
      subsystem and driver, the device needs to be put into low power state
      from a system suspend callback. Otherwise it may very well be left in
      full power state (runtime resumed) while the system is suspended. By
      using the new helper functions, we make sure to walk the hierarchy of
      a device's power domain, subsystem and driver.
      
      2) Subsystems and drivers need to cope with all the combinations of
      CONFIG_PM_SLEEP and CONFIG_PM_RUNTIME. The two new helper functions
      smothly addresses this.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      37f20416
    • U
      PM / runtime: Fetch runtime PM callbacks using a macro · 5f59df79
      Ulf Hansson 提交于
      While fetching the proper runtime PM callback, we walk the hierarchy of
      device's power domains, subsystems and drivers.
      
      This is common for rpm_suspend(), rpm_idle() and rpm_resume(). Let's
      clean up the code by using a macro that handles this.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      5f59df79
  2. 01 3月, 2014 1 次提交
  3. 26 2月, 2014 1 次提交
  4. 13 2月, 2014 1 次提交
  5. 11 2月, 2014 4 次提交
    • R
      PM / QoS: Add type to dev_pm_qos_add_ancestor_request() arguments · 71d821fd
      Rafael J. Wysocki 提交于
      Rework dev_pm_qos_add_ancestor_request() so that device PM QoS type
      is passed to it as the third argument and make it support the
      DEV_PM_QOS_LATENCY_TOLERANCE device PM QoS type (in addition to
      DEV_PM_QOS_RESUME_LATENCY).
      
      That will allow the drivers of devices without latency tolerance
      hardware support to use their ancestors having it as proxies for
      their latency tolerance requirements.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      71d821fd
    • R
      PM / QoS: Introcuce latency tolerance device PM QoS type · 2d984ad1
      Rafael J. Wysocki 提交于
      Add a new latency tolerance device PM QoS type to be use for
      specifying active state (RPM_ACTIVE) memory access (DMA) latency
      tolerance requirements for devices.  It may be used to prevent
      hardware from choosing overly aggressive energy-saving operation
      modes (causing too much latency to appear) for the whole platform.
      
      This feature reqiures hardware support, so it only will be
      available for devices having a new .set_latency_tolerance()
      callback in struct dev_pm_info populated, in which case the
      routine pointed to by it should implement whatever is necessary
      to transfer the effective requirement value to the hardware.
      
      Whenever the effective latency tolerance changes for the device,
      its .set_latency_tolerance() callback will be executed and the
      effective value will be passed to it.  If that value is negative,
      which means that the list of latency tolerance requirements for
      the device is empty, the callback is expected to switch the
      underlying hardware latency tolerance control mechanism to an
      autonomous mode if available.  If that value is PM_QOS_LATENCY_ANY,
      in turn, and the hardware supports a special "no requirement"
      setting, the callback is expected to use it.  That allows software
      to prevent the hardware from automatically updating the device's
      latency tolerance in response to its power state changes (e.g. during
      transitions from D3cold to D0), which generally may be done in the
      autonomous latency tolerance control mode.
      
      If .set_latency_tolerance() is present for the device, a new
      pm_qos_latency_tolerance_us attribute will be present in the
      devivce's power directory in sysfs.  Then, user space can use
      that attribute to specify its latency tolerance requirement for
      the device, if any.  Writing "any" to it means "no requirement, but
      do not let the hardware control latency tolerance" and writing
      "auto" to it allows the hardware to be switched to the autonomous
      mode if there are no other requirements from the kernel side in the
      device's list.
      
      This changeset includes a fix from Mika Westerberg.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      2d984ad1
    • R
      PM / QoS: Add no_constraints_value field to struct pm_qos_constraints · 327adaed
      Rafael J. Wysocki 提交于
      Add a new field, no_constraints_value, to struct pm_qos_constraints
      representing a list of PM QoS constraint requests to be returned by
      pm_qos_get_value() when that list of requests is empty.
      
      That field will be equal to default_value for all of the existing
      global PM QoS classes and for the resume latency device PM QoS type,
      but it will be different from default_value for the new latency
      tolerance device PM QoS type introduced by the next changeset.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      327adaed
    • R
      PM / QoS: Rename device resume latency QoS items · b02f6695
      Rafael J. Wysocki 提交于
      Rename symbols, variables, functions and structure fields related do
      the resume latency device PM QoS type so that it is clear where they
      belong (in particular, to avoid confusion with the latency tolerance
      device PM QoS type introduced by a subsequent changeset).
      
      Update the PM QoS documentation to better reflect its current state.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      b02f6695
  6. 08 2月, 2014 1 次提交
  7. 17 1月, 2014 2 次提交
  8. 15 1月, 2014 3 次提交
  9. 14 1月, 2014 2 次提交
  10. 11 1月, 2014 3 次提交
    • R
      drivers/base: provide an infrastructure for componentised subsystems · 2a41e607
      Russell King 提交于
      Subsystems such as ALSA, DRM and others require a single card-level
      device structure to represent a subsystem.  However, firmware tends to
      describe the individual devices and the connections between them.
      
      Therefore, we need a way to gather up the individual component devices
      together, and indicate when we have all the component devices.
      
      We do this in DT by providing a "superdevice" node which specifies
      the components, eg:
      
      	imx-drm {
      		compatible = "fsl,drm";
      		crtcs = <&ipu1>;
      		connectors = <&hdmi>;
      	};
      
      The superdevice is declared into the component support, along with the
      subcomponents.  The superdevice receives callbacks to locate the
      subcomponents, and identify when all components are present.  At this
      point, we bind the superdevice, which causes the appropriate subsystem
      to be initialised in the conventional way.
      
      When any of the components or superdevice are removed from the system,
      we unbind the superdevice, thereby taking the subsystem down.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2a41e607
    • T
      sysfs, driver-core: remove unused {sysfs|device}_schedule_callback_owner() · d1ba277e
      Tejun Heo 提交于
      All device_schedule_callback_owner() users are converted to use
      device_remove_file_self().  Remove now unused
      {sysfs|device}_schedule_callback_owner().
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d1ba277e
    • T
      kernfs, sysfs, driver-core: implement kernfs_remove_self() and its wrappers · 1ae06819
      Tejun Heo 提交于
      Sometimes it's necessary to implement a node which wants to delete
      nodes including itself.  This isn't straightforward because of kernfs
      active reference.  While a file operation is in progress, an active
      reference is held and kernfs_remove() waits for all such references to
      drain before completing.  For a self-deleting node, this is a deadlock
      as kernfs_remove() ends up waiting for an active reference that itself
      is sitting on top of.
      
      This currently is worked around in the sysfs layer using
      sysfs_schedule_callback() which makes such removals asynchronous.
      While it works, it's rather cumbersome and inherently breaks
      synchronicity of the operation - the file operation which triggered
      the operation may complete before the removal is finished (or even
      started) and the removal may fail asynchronously.  If a removal
      operation is immmediately followed by another operation which expects
      the specific name to be available (e.g. removal followed by rename
      onto the same name), there's no way to make the latter operation
      reliable.
      
      The thing is there's no inherent reason for this to be asynchrnous.
      All that's necessary to do this synchronous is a dedicated operation
      which drops its own active ref and deactivates self.  This patch
      implements kernfs_remove_self() and its wrappers in sysfs and driver
      core.  kernfs_remove_self() is to be called from one of the file
      operations, drops the active ref and deactivates using
      __kernfs_deactivate_self(), removes the self node, and restores active
      ref to the dead node using __kernfs_reactivate_self() so that the ref
      is balanced afterwards.  __kernfs_remove() is updated so that it takes
      an early exit if the target node is already fully removed so that the
      active ref restored by kernfs_remove_self() after removal doesn't
      confuse the deactivation path.
      
      This makes implementing self-deleting nodes very easy.  The normal
      removal path doesn't even need to be changed to use
      kernfs_remove_self() for the self-deleting node.  The method can
      invoke kernfs_remove_self() on itself before proceeding the normal
      removal path.  kernfs_remove() invoked on the node by the normal
      deletion path will simply be ignored.
      
      This will replace sysfs_schedule_callback().  A subtle feature of
      sysfs_schedule_callback() is that it collapses multiple invocations -
      even if multiple removals are triggered, the removal callback is run
      only once.  An equivalent effect can be achieved by testing the return
      value of kernfs_remove_self() - only the one which gets %true return
      value should proceed with actual deletion.  All other instances of
      kernfs_remove_self() will wait till the enclosing kernfs operation
      which invoked the winning instance of kernfs_remove_self() finishes
      and then return %false.  This trivially makes all users of
      kernfs_remove_self() automatically show correct synchronous behavior
      even when there are multiple concurrent operations - all "echo 1 >
      delete" instances will finish only after the whole operation is
      completed by one of the instances.
      
      v2: For !CONFIG_SYSFS, dummy version kernfs_remove_self() was missing
          and sysfs_remove_file_self() had incorrect return type.  Fix it.
          Reported by kbuild test bot.
      
      v3: Updated to use __kernfs_{de|re}activate_self().
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: kbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1ae06819
  11. 09 1月, 2014 3 次提交
    • B
      firmware_class: Fix the file size check · 08da2012
      Ben Hutchings 提交于
      We expect to read firmware blobs with a single call to kernel_read(),
      which returns int.  Therefore the size must be within the range of
      int, not long.
      Signed-off-by: NBen Hutchings <ben@decadent.org.uk>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      08da2012
    • B
      driver-core: Fix use-after-free triggered by bus_unregister() · 174be70b
      Bart Van Assche 提交于
      Avoid that bus_unregister() triggers a use-after-free with
      CONFIG_DEBUG_KOBJECT_RELEASE=y. This patch avoids that the
      following sequence triggers a kernel crash with memory poisoning
      enabled:
      * bus_register()
      * driver_register()
      * driver_unregister()
      * bus_unregister()
      
      The above sequence causes the bus private data to be freed from
      inside the bus_unregister() call although it is not guaranteed in
      that function that the reference count on the bus private data has
      dropped to zero. As an example, with CONFIG_DEBUG_KOBJECT_RELEASE=y
      the ${bus}/drivers kobject is still holding a reference on
      bus->p->subsys.kobj via its parent pointer at the time the bus
      private data is freed. Fix this by deferring freeing the bus private
      data until the last kobject_put() call on bus->p->subsys.kobj.
      
      The kernel oops triggered by the above sequence and with memory
      poisoning enabled and that is fixed by this patch is as follows:
      
      general protection fault: 0000 [#1] PREEMPT SMP
      CPU: 3 PID: 2711 Comm: kworker/3:32 Tainted: G        W  O 3.13.0-rc4-debug+ #1
      Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
      Workqueue: events kobject_delayed_cleanup
      task: ffff880037f866d0 ti: ffff88003b638000 task.ti: ffff88003b638000
      Call Trace:
       [<ffffffff81263105>] ? kobject_get_path+0x25/0x100
       [<ffffffff81264354>] kobject_uevent_env+0x134/0x600
       [<ffffffff8126482b>] kobject_uevent+0xb/0x10
       [<ffffffff81262fa2>] kobject_delayed_cleanup+0xc2/0x1b0
       [<ffffffff8106c047>] process_one_work+0x217/0x700
       [<ffffffff8106bfdb>] ? process_one_work+0x1ab/0x700
       [<ffffffff8106c64b>] worker_thread+0x11b/0x3a0
       [<ffffffff8106c530>] ? process_one_work+0x700/0x700
       [<ffffffff81074b70>] kthread+0xf0/0x110
       [<ffffffff81074a80>] ? insert_kthread_work+0x80/0x80
       [<ffffffff815673bc>] ret_from_fork+0x7c/0xb0
       [<ffffffff81074a80>] ? insert_kthread_work+0x80/0x80
      Code: 89 f8 48 89 e5 f6 82 c0 27 63 81 20 74 15 0f 1f 44 00 00 48 83 c0 01 0f b6 10 f6 82 c0 27 63 81 20 75 f0 5d c3 66 0f 1f 44 00 00 <80> 3f 00 55 48 89 e5 74 15 48 89 f8 0f 1f 40 00 48 83 c0 01 80
      RIP  [<ffffffff81267ed0>] strlen+0x0/0x30
       RSP <ffff88003b639c70>
      ---[ end trace 210f883ef80376aa ]---
      Signed-off-by: NBart Van Assche <bvanassche@acm.org>
      Acked-by: NMing Lei <ming.lei@canonical.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      174be70b
    • B
      firmware loader: Add sparse annotation · 98233b21
      Bart Van Assche 提交于
      Avoid that sparse reports the following warning on __fw_free_buf():
      
      drivers/base/firmware_class.c:230:9: warning: context imbalance in '__fw_free_buf' - unexpected unlock
      Signed-off-by: NBart Van Assche <bvanassche@acm.org>
      Acked-by: NMing Lei <ming.lei@canonical.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      98233b21
  12. 30 12月, 2013 1 次提交
  13. 29 12月, 2013 1 次提交
    • R
      ACPI / hotplug / driver core: Handle containers in a special way · caa73ea1
      Rafael J. Wysocki 提交于
      ACPI container devices require special hotplug handling, at least
      on some systems, since generally user space needs to carry out
      system-specific cleanup before it makes sense to offline devices in
      the container.  However, the current ACPI hotplug code for containers
      first attempts to offline devices in the container and only then it
      notifies user space of the container offline.
      
      Moreover, after commit 202317a5 (ACPI / scan: Add acpi_device
      objects for all device nodes in the namespace), ACPI device objects
      representing containers are present as long as the ACPI namespace
      nodes corresponding to them are present, which may be forever, even
      if the container devices are physically detached from the system (the
      return values of the corresponding _STA methods change in those
      cases, but generally the namespace nodes themselves are still there).
      Thus it is useful to introduce entities representing containers that
      will go away during container hot-unplug.
      
      The goal of this change is to address both the above issues.
      
      The idea is to create a "companion" container system device for each
      of the ACPI container device objects during the initial namespace
      scan or on a hotplug event making the container present.  That system
      device will be unregistered on container removal.  A new bus type
      for container devices is added for this purpose, because device
      offline and online operations need to be defined for them.  The
      online operation is a trivial function that is always successful
      and the offline uses a callback pointed to by the container device's
      offline member.
      
      For ACPI containers that callback simply walks the list of ACPI
      device objects right below the container object (its children) and
      checks if all of their physical companion devices are offline.  If
      that's not the case, it returns -EBUSY and the container system
      devivce cannot be put offline.  Consequently, to put the container
      system device offline, it is necessary to put all of the physical
      devices depending on its ACPI companion object offline beforehand.
      
      Container system devices created for ACPI container objects are
      initially online.  They are created by the container ACPI scan
      handler whose hotplug.demand_offline flag is set.  That causes
      acpi_scan_hot_remove() to check if the companion container system
      device is offline before attempting to remove an ACPI container or
      any devices below it.  If the check fails, a KOBJ_CHANGE uevent is
      emitted for the container system device in question and user space
      is expected to offline all devices below the container and the
      container itself in response to it.  Then, user space can finalize
      the removal of the container with the help of its ACPI device
      object's eject attribute in sysfs.
      Tested-by: NYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      caa73ea1
  14. 22 12月, 2013 1 次提交
    • U
      PM / Runtime: Implement the pm_generic_runtime functions for CONFIG_PM · 717e5d45
      Ulf Hansson 提交于
      The pm_generic_runtime_suspend|resume functions were implemented within
      CONFIG_PM_RUNTIME.
      
      As we also may use runtime PM callbacks during system suspend, to put
      devices into low power state, we need to move the implementation of
      pm_generic_runtime_suspend|resume to CONFIG_PM.
      
      This change gives a power domain provision to invoke a platform
      driver's runtime PM callback from a power domain's system PM callback.
      This were earlier prevented by the platform bus, since it uses the
      pm_generic_runtime_suspend|resume functions as runtime PM callbacks.
      
      Cc: Kevin Hilman <khilman@linaro.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      717e5d45
  15. 20 12月, 2013 1 次提交
  16. 19 12月, 2013 2 次提交
  17. 17 12月, 2013 2 次提交
  18. 09 12月, 2013 4 次提交
  19. 08 12月, 2013 1 次提交
  20. 28 11月, 2013 1 次提交
  21. 26 11月, 2013 1 次提交
  22. 24 11月, 2013 1 次提交
  23. 21 11月, 2013 1 次提交