1. 19 11月, 2013 3 次提交
  2. 08 11月, 2013 1 次提交
    • R
      ACPI / hotplug: Consolidate deferred execution of ACPI hotplug routines · 7b98118a
      Rafael J. Wysocki 提交于
      There are two different interfaces for queuing up work items on the
      ACPI hotplug workqueue, alloc_acpi_hp_work() used by PCI and PCI host
      bridge hotplug code and acpi_os_hotplug_execute() used by the common
      ACPI hotplug code and docking stations.  They both are somewhat
      cumbersome to use and work slightly differently.
      
      The users of alloc_acpi_hp_work() have to submit a work function that
      will extract the necessary data items from a struct acpi_hp_work
      object allocated by alloc_acpi_hp_work() and then will free that
      object, while it would be more straightforward to simply use a work
      function with one more argument and let the interface take care of
      the execution details.
      
      The users of acpi_os_hotplug_execute() also have to deal with the
      fact that it takes only one argument in addition to the work function
      pointer, although acpi_os_execute_deferred() actually takes care of
      the allocation and freeing of memory, so it would have been able to
      pass more arguments to the work function if it hadn't been
      constrained by the connection with acpi_os_execute().
      
      Moreover, while alloc_acpi_hp_work() makes GFP_KERNEL memory
      allocations, which is correct, because hotplug work items are
      always queued up from process context, acpi_os_hotplug_execute()
      uses GFP_ATOMIC, as that is needed by acpi_os_execute().  Also,
      acpi_os_execute_deferred() queued up by it waits for the ACPI event
      workqueues to flush before executing the work function, whereas
      alloc_acpi_hp_work() can't do anything similar.  That leads to
      somewhat arbitrary differences in behavior between various ACPI
      hotplug code paths and has to be straightened up.
      
      For this reason, replace both alloc_acpi_hp_work() and
      acpi_os_hotplug_execute() with a single interface,
      acpi_hotplug_execute(), combining their behavior and being more
      friendly to its users than any of the two.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      7b98118a
  3. 07 11月, 2013 7 次提交
  4. 31 8月, 2013 1 次提交
  5. 30 8月, 2013 1 次提交
    • R
      ACPI / hotplug: Remove containers synchronously · f943db40
      Rafael J. Wysocki 提交于
      The current protocol for handling hot remove of containers is very
      fragile and causes acpi_eject_store() to acquire acpi_scan_lock
      which may deadlock with the removal of the device that it is called
      for (the reason is that device sysfs attributes cannot be removed
      while their callbacks are being executed and ACPI device objects
      are removed under acpi_scan_lock).
      
      The problem is related to the fact that containers are handled by
      acpi_bus_device_eject() in a special way, which is to emit an
      offline uevent instead of just removing the container.  Then, user
      space is expected to handle that uevent and use the container's
      "eject" attribute to actually remove it.  That is fragile, because
      user space may fail to complete the ejection (for example, by not
      using the container's "eject" attribute at all) leaving the BIOS
      kind of in a limbo.  Moreover, if the eject event is not signaled
      for a container itself, but for its parent device object (or
      generally, for an ancestor above it in the ACPI namespace), the
      container will be removed straight away without doing that whole
      dance.
      
      For this reason, modify acpi_bus_device_eject() to remove containers
      synchronously like any other objects (user space will get its uevent
      anyway in case it does some other things in response to it) and
      remove the eject_pending ACPI device flag that is not used any more.
      This way acpi_eject_store() doesn't have a reason to acquire
      acpi_scan_lock any more and one possible deadlock scenario goes
      away (plus the code is simplified a bit).
      Reported-and-tested-by: NGu Zheng <guz.fnst@cn.fujitsu.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      f943db40
  6. 06 8月, 2013 1 次提交
  7. 30 7月, 2013 1 次提交
  8. 15 7月, 2013 5 次提交
  9. 04 7月, 2013 1 次提交
  10. 28 6月, 2013 1 次提交
  11. 23 6月, 2013 1 次提交
  12. 20 6月, 2013 1 次提交
  13. 16 6月, 2013 1 次提交
    • R
      ACPI / scan: Simplify ACPI driver probing · d9e455f5
      Rafael J. Wysocki 提交于
      There is no particular reason why acpi_bus_driver_init() needs to be
      a separate function and its location with respect to its only caller,
      acpi_device_probe(), makes the code a bit difficult to follow.
      
      Besides, it doesn't really make sense to check if 'device' is not
      NULL in acpi_bus_driver_init(), because we've already dereferenced
      dev->driver in acpi_device_probe() at that point and, moreover,
      'device' cannot be NULL then, because acpi_device_probe() is called
      via really_probe() (which also sets dev->driver for that matter).
      
      For these reasons, drop acpi_bus_driver_init() altogether and move
      the remaining code from it directly into acpi_device_probe().
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d9e455f5
  14. 10 6月, 2013 1 次提交
  15. 08 6月, 2013 1 次提交
  16. 05 6月, 2013 1 次提交
    • A
      ACPI / scan: do not match drivers against objects having scan handlers · 9f29ab11
      Aaron Lu 提交于
      With the introduction of ACPI scan handlers, an ACPI device object
      with an ACPI scan handler attached to it must not be bound to an ACPI
      driver any more.  Therefore it doesn't make sense to match those
      ACPI device objects against a newly registered ACPI driver in
      acpi_bus_match(), so make that function return 0 if the device
      object passed to it has an ACPI scan handler attached.
      
      This also addresses a regression related to a broken ACPI table in
      the BIOS, where it has defined a _ROM method under the PCI root
      bridge object.  This causes the video module to treat that object
      as a display controller device (since only display devices are
      supposed to have a _ROM method defined according to the ACPI spec).
      As a result, the ACPI video driver binds to the PCI root bridge
      object and overwrites the previously assigned driver_data field of
      it, causing subsequent calls to acpi_get_pci_dev() to fail.
      
      [rjw: Subject and changelog]
      References: https://bugzilla.kernel.org/show_bug.cgi?id=58091Reported-by: NJason Cassell <bluesloth600@gmail.com>
      Reported-and-bisected-by: NDmitry S. Demin <dmitryy.demin@gmail.com>
      Cc: 3.9+ <stable@kernel.org>
      Signed-off-by: NAaron Lu <aaron.lu@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      9f29ab11
  17. 02 6月, 2013 2 次提交
  18. 16 5月, 2013 1 次提交
  19. 14 5月, 2013 1 次提交
  20. 12 5月, 2013 2 次提交
    • R
      ACPI / processor: Use common hotplug infrastructure · ac212b69
      Rafael J. Wysocki 提交于
      Split the ACPI processor driver into two parts, one that is
      non-modular, resides in the ACPI core and handles the enumeration
      and hotplug of processors and one that implements the rest of the
      existing processor driver functionality.
      
      The non-modular part uses an ACPI scan handler object to enumerate
      processors on the basis of information provided by the ACPI namespace
      and to hook up with the common ACPI hotplug infrastructure.  It also
      populates the ACPI handle of each processor device having a
      corresponding object in the ACPI namespace, which allows the driver
      proper to bind to those devices, and makes the driver bind to them
      if it is readily available (i.e. loaded) when the scan handler's
      .attach() routine is running.
      
      There are a few reasons to make this change.
      
      First, switching the ACPI processor driver to using the common ACPI
      hotplug infrastructure reduces code duplication and size considerably,
      even though a new file is created along with a header comment etc.
      
      Second, since the common hotplug code attempts to offline devices
      before starting the (non-reversible) removal procedure, it will abort
      (and possibly roll back) hot-remove operations involving processors
      if cpu_down() returns an error code for one of them instead of
      continuing them blindly (if /sys/firmware/acpi/hotplug/force_remove
      is unset).  That is a more desirable behavior than what the current
      code does.
      
      Finally, the separation of the scan/hotplug part from the driver
      proper makes it possible to simplify the driver's .remove() routine,
      because it doesn't need to worry about the possible cleanup related
      to processor removal any more (the scan/hotplug part is responsible
      for that now) and can handle device removal and driver removal
      symmetricaly (i.e. as appropriate).
      
      Some user-visible changes in sysfs are made (for example, the
      'sysdev' link from the ACPI device node to the processor device's
      directory is gone and a 'physical_node' link is present instead
      and a corresponding 'firmware_node' is present in the processor
      device's directory, the processor driver is now visible under
      /sys/bus/cpu/drivers/ and bound to the processor device), but
      that shouldn't affect the functionality that users care about
      (frequency scaling, C-states and thermal management).
      
      Tested on my venerable Toshiba Portege R500.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Reviewed-by: NToshi Kani <toshi.kani@hp.com>
      ac212b69
    • R
      ACPI / hotplug: Use device offline/online for graceful hot-removal · 683058e3
      Rafael J. Wysocki 提交于
      Modify the generic ACPI hotplug code to be able to check if devices
      scheduled for hot-removal may be gracefully removed from the system
      using the device offline/online mechanism introduced previously.
      
      Namely, make acpi_scan_hot_remove() handling device hot-removal call
      device_offline() for all physical companions of the ACPI device nodes
      involved in the operation and check the results.  If any of the
      device_offline() calls fails, the function will not progress to the
      removal phase (which cannot be aborted), unless its (new) force
      argument is set (in case of a failing offline it will put the devices
      offlined by it back online).
      
      In support of 'forced' device hot-removal, add a new sysfs attribute
      'force_remove' that will reside under /sys/firmware/acpi/hotplug/.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NToshi Kani <toshi.kani@hp.com>
      683058e3
  21. 13 4月, 2013 1 次提交
  22. 25 3月, 2013 5 次提交
    • T
      ACPI: Verify device status after eject · 882fd12e
      Toshi Kani 提交于
      ACPI spec states that the OS evaluates _STA after calling _EJ0
      in order to verify if eject was successful.  Added a check to
      verify if the enabled bit of the status value is cleared after
      _EJ0.
      
      Note, the present bit is not checked since some FW implementations
      do not clear the present bit until the hardware is physically
      removed.
      Signed-off-by: NToshi Kani <toshi.kani@hp.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      882fd12e
    • T
      ACPI: Update _OST handling for notify · 2cbb14fb
      Toshi Kani 提交于
      When the kernel calls _OSC with OSC_SB_HOTPLUG_OST_SUPPORT bit
      set at boot-time, the OS is responsible for calling _OST for
      ACPI hotplug events.  However, when hotplug.enabled attribute
      is unset for ACPI scan drivers, their notify handlers are removed
      and _OST is not called for ACPI hotplug events as a result.
      
      This patch keeps the notify handler of ACPI scan drivers,
      acpi_hotplug_notify_cb(), installed regardless of the state of
      hotplug.enabled.  The notify handler then checks if hotplug.enabled
      is set for the associated scan handler.  If unset, the notify
      handler calls _OST with a proper error code.  The patch also
      eliminates ACPI namespace walk when hotplug.enabled is changed
      via sysfs.
      Signed-off-by: NToshi Kani <toshi.kani@hp.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      2cbb14fb
    • T
      ACPI: Update PNPID match handling for notify · 6b772e8f
      Toshi Kani 提交于
      When installing/removing a notify handler to/from an ACPI device
      object, ACPI core tries to match its associated scan handler to
      see if it supports hotplug.  However, the matching logic of the
      notify handler is different from the matching logic of attaching
      a scan handler to an ACPI device object.  This patch updates the
      matching logic of the notify handlers to be consistent with the
      attach handling.
      Signed-off-by: NToshi Kani <toshi.kani@hp.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      6b772e8f
    • T
      ACPI: Update PNPID set/free interfaces · c0af4175
      Toshi Kani 提交于
      This patch introduces acpi_set_pnp_ids() and acpi_free_pnp_ids(),
      which are updated from acpi_device_set_id() and acpi_free_ids(),
      to setup and free acpi_device_pnp for a given acpi_handle.  They
      can be called without acpi_device.
      Signed-off-by: NToshi Kani <toshi.kani@hp.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c0af4175
    • T
      ACPI: Remove acpi_device dependency in acpi_device_set_id() · d4e1a692
      Toshi Kani 提交于
      This patch updates the internal operations of acpi_device_set_id()
      to setup acpi_device_pnp without using acpi_device.  There is no
      functional change to acpi_device_set_id() in this patch.
      
      acpi_pnp_type is added to acpi_device_pnp, so that PNPID type is
      self-contained within acpi_device_pnp.  acpi_add_id(), acpi_bay_match(),
      acpi_dock_match(), acpi_ibm_smbus_match() and acpi_is_video_device()
      are changed to take acpi_handle as an argument, instead of acpi_device.
      Signed-off-by: NToshi Kani <toshi.kani@hp.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d4e1a692