1. 03 12月, 2014 1 次提交
  2. 02 12月, 2014 2 次提交
    • R
      ACPI / sleep: Drain outstanding events after disabling multiple GPEs · c52fa70c
      Rafael J. Wysocki 提交于
      After multiple GPEs have been disabled at the low level in one go,
      like when acpi_disable_all_gpes() is called, we should always drain
      all of the outstanding events from them, or interesting races become
      possible.
      
      For this reason, call acpi_os_wait_events_complete() after
      acpi_enable_all_wakeup_gpes() and acpi_disable_all_gpes() in
      acpi_freeze_prepare() and acpi_power_off_prepare(), respectively.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c52fa70c
    • R
      ACPICA: Save current masks of enabled GPEs after enable register writes · c50f13c6
      Rafael J. Wysocki 提交于
      There is a race condition between acpi_hw_disable_all_gpes() or
      acpi_enable_all_wakeup_gpes() and acpi_ev_asynch_enable_gpe() such
      that if the latter wins the race, it may mistakenly enable a GPE
      disabled by the former.  This may lead to premature system wakeups
      during system suspend and potentially to more serious consequences.
      
      The source of the problem is how acpi_hw_low_set_gpe() works when
      passed ACPI_GPE_CONDITIONAL_ENABLE as the second argument.  In that
      case, the GPE will be enabled if the corresponding bit is set in the
      enable_for_run mask of the GPE enable register containing that bit.
      However, acpi_hw_disable_all_gpes() and acpi_enable_all_wakeup_gpes()
      don't modify the enable_for_run masks of GPE registers when writing
      to them.  In consequence, if acpi_ev_asynch_enable_gpe(), which
      eventually calls acpi_hw_low_set_gpe() with the second argument
      equal to ACPI_GPE_CONDITIONAL_ENABLE, is executed in parallel with
      one of these functions, it may reverse changes made by them.
      
      To fix the problem, introduce a new enable_mask field in struct
      acpi_gpe_register_info in which to store the current mask of
      enabled GPEs and modify acpi_hw_low_set_gpe() to take this
      mask into account instead of enable_for_run when its second
      argument is equal to ACPI_GPE_CONDITIONAL_ENABLE.  Also modify
      the low-level routines called by acpi_hw_disable_all_gpes(),
      acpi_enable_all_wakeup_gpes() and acpi_enable_all_runtime_gpes()
      to update the enable_mask masks of GPE registers after all
      (successful) writes to those registers.
      Acked-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c50f13c6
  3. 01 12月, 2014 1 次提交
  4. 28 11月, 2014 5 次提交
  5. 27 11月, 2014 5 次提交
  6. 26 11月, 2014 1 次提交
  7. 25 11月, 2014 1 次提交
  8. 24 11月, 2014 1 次提交
  9. 20 11月, 2014 1 次提交
    • R
      ACPI / PM: Ignore wakeup setting if the ACPI companion can't wake up · 78579b7c
      Rafael J. Wysocki 提交于
      As reported by Dmitry, on some Chromebooks there are devices with
      corresponding ACPI objects and with unusual system wakeup
      configuration.  Namely, they technically are wakeup-capable, but the
      wakeup is handled via a platform-specific out-of-band mechanism and
      the ACPI PM layer has no information on the wakeup capability.  As
      a result, device_may_wakeup(dev) called from acpi_dev_suspend_late()
      returns 'true' for those devices, but the wakeup.flags.valid flag is
      unset for the corresponding ACPI device objects, so acpi_device_wakeup()
      reproducibly fails for them causing acpi_dev_suspend_late() to return
      an error code.  The entire system suspend is then aborted and the
      machines in question cannot suspend at all.
      
      Address the problem by ignoring the device_may_wakeup(dev) return
      value in acpi_dev_suspend_late() if the ACPI companion of the device
      being handled has wakeup.flags.valid unset (in which case it is clear
      that the wakeup is supposed to be handled by other means).
      
      This fixes a regression introduced by commit a76e9bd8 (i2c:
      attach/detach I2C client device to the ACPI power domain) as the
      affected systems could suspend and resume successfully before that
      commit.
      
      Fixes: a76e9bd8 (i2c: attach/detach I2C client device to the ACPI power domain)
      Reported-by: NDmitry Torokhov <dtor@chromium.org>
      Reviewed-by: NDmitry Torokhov <dtor@chromium.org>
      Cc: 3.13+ <stable@vger.kernel.org> # 3.13+
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      78579b7c
  10. 18 11月, 2014 2 次提交
  11. 12 11月, 2014 5 次提交
    • L
      ACPI / OSL: Add IRQ handler flushing support in the OSL. · 90253a79
      Lv Zheng 提交于
      It is possible that a GPE handler or a fixed event handler still accessed
      after removing the handlers by invoking acpi_remove_gpe_handler() or
      acpi_remove_fixed_event_handler(), this possibility can crash OPSM after a
      module removal. In the Linux kernel, though all other GPE drivers are not
      modules, since the IPMI_SI (ipmi_si_intf.c) can be compiled as a module, we
      still need to consider a solution for this issue when the driver switches
      to ACPI_GPE_RAW_HANDLER mode in order to invoke GPE APIs.
      
      ACPICA expects acpi_os_wait_events_complete() to be invoked after GPE
      disabling so that OSPM can ensure all running GPE handlers have exitted.
      But currently acpi_os_wait_events_complete() can only flush _Lxx/_Exx
      evaluation work queue and this philosophy cannot work for drivers that have
      installed a dedicated GPE handler.
      
      The only way to protect a callback is to perform some state holders
      (reference count, state machine) before invoking the callback. Then this
      issue can only be fixed by the following means:
      1. Flush GPE in ACPICA before invoking the GPE handler. But currently,
         there is no such implementation in acpi_ev_gpe_dispatch().
      2. Flush GPE in ACPICA OSL before invoking the SCI handler. But currently,
         there is no such implementation in acpi_irq().
      3. Flush IRQ in OSPM IRQ layer before invoking the IRQ handler. In Linus
         kernel, this can be done by synchronize_irq().
      4. Flush scheduling in OSPM vector entry layer before invoking the vector.
         In Linux, this can be done by synchronize_sched().
      
      Since ACPICA expects the GPE handlers to be flushed by the ACPICA OSL or
      the GPE drivers. If it is implemented by the GPE driver, we should see
      synchronize_irq()/synchronize_sched() invoked in such drivers. If it is
      implemented by the ACPICA OSL, ACPICA currently provides
      acpi_os_wait_events_complete() hook to achieve this. After the following
      commit:
        Commit: 69c841b6
        Author: Lv Zheng <lv.zheng@intel.com>
        Subject: ACPICA: Update use of acpi_os_wait_events_complete interface.
      The OSL acpi_os_wait_events_complete() is invoked after a GPE handler is
      removed from acpi_remove_gpe_handler() or a fixed event handler is removed
      from acpi_remove_fixed_event_handler(). Thus it is possible to implement
      GPE handler flushing using this ACPICA OSL now. So the solution 1 is
      currently not taken into account.
      
      By examining the IPMI_SI driver, we noticed that the IPMI_SI driver:
      1. Uses free_irq() to flush non GPE based IRQ handlers, in free_irq(),
         synchronize_irq() is invoked, and
      2. Uses acpi_remove_gpe_handler() to flush GPE based IRQ handlers, for such
         IRQ handlers, there is no synchronize_irq() invoked.
      Since there isn't synchronize_sched() implemented for this driver, from the
      driver's perspective, acpi_remove_gpe_handler() should have properly
      flushed the GPE handlers for it. Since the driver doesn't invoke
      synchronize_irq(), the solution 3 is not what the drivers expect.
      
      This patch implements solution 2. But since given the fact that the GPE is
      managed inside of ACPICA, and implementing the GPE flushing requires to
      implement the whole GPE management code again in the OSL, instead of
      flushing GPE, this patch flushes IRQ in acpi_os_wait_events_complete(). The
      flushing could last longer than expected as though the target GPE/fixed
      event that is removed can be fastly flushed, other GPEs/fix events can still
      be issued during the flushing period.
      
      This patch fixes this issue by invoking synchronize_hardirq() in
      acpi_os_wait_events_complete(). The reason why we don't invoke
      synchronize_irq() is: currently ACPICA is not threaded IRQ capable and the
      only difference between synchronize_irq() and synchronize_hardirq() is
      synchronize_irq() also flushes threaded IRQ handlers. Thus using
      synchronize_hardirq() can help to reduce the overall synchronization time
      for the current ACPICA implementation.
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
      Cc: Len Brown <lenb@kernel.org>
      Cc: Robert Moore <robert.moore@intel.com>
      Cc: Corey Minyard <minyard@acm.org>
      Cc: linux-acpi@vger.kernel.org
      Cc: devel@acpica.org
      Cc: openipmi-developer@lists.sourceforge.net
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      90253a79
    • A
      ACPI / LPSS: introduce a 'proxy' device to power on LPSS for DMA · 6c17ee44
      Andy Shevchenko 提交于
      The LPSS DMA controller does not have _PS0 and _PS3 methods. Moreover it can be
      powered off automatically whenever the last LPSS device goes down. In case of
      no power any access to the DMA controller will hang the system. The behaviour
      is reproduced on some HP laptops based on Intel Bay Trail [1] as well as on
      Asus T100 transformer.
      
      This patch introduces a so called 'proxy' device that has the knobs to handle a
      power of the LPSS island. When the system needs to program the DMA controller
      it calls to the ACPI LPSS power domain callbacks that wake or suspend the
      'proxy' device.
      
      [1] http://www.spinics.net/lists/dmaengine/msg01514.htmlSuggested-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Tested-by: NScott Ashcroft <scott.ashcroft@talk21.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      6c17ee44
    • A
      ACPI / LPSS: allow to use specific PM domain during ->probe() · 01ac170b
      Andy Shevchenko 提交于
      The LPSS DMA controller would like to use the specific PM domain callbacks
      during early stage, namely in ->probe(). This patch moves the specific PM
      domain assignment early to be accessible during a whole life time of the device
      in the system.
      Suggested-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Tested-by: NScott Ashcroft <scott.ashcroft@talk21.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      01ac170b
    • A
      ACPI / LPSS: add all LPSS devices to the specific power domain · cb39dcdd
      Andy Shevchenko 提交于
      Currently the LPSS devices are located in the different power domains depends
      on LPSS_SAVE_CTX flag. We would like to use the specific power domain for all
      LPSS devices.
      
      The LPSS DMA controller has no knobs to control its power state. The specific
      power domain implementation will handle this case. The patch does a preparation
      for that.
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Tested-by: NScott Ashcroft <scott.ashcroft@talk21.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      cb39dcdd
    • K
      ACPI / osl: speedup grace period in acpi_os_map_cleanup · 74b51ee1
      Konstantin Khlebnikov 提交于
      ACPI maintains cache of ioremap regions to speed up operations and
      access to them from irq context where ioremap() calls aren't allowed.
      This code abuses synchronize_rcu() on unmap path for synchronization
      with fast-path in acpi_os_read/write_memory which uses this cache.
      
      Since v3.10 CPUs are allowed to enter idle state even if they have RCU
      callbacks queued, see commit c0f4dfd4
      ("rcu: Make RCU_FAST_NO_HZ take advantage of numbered callbacks").
      That change caused problems with nvidia proprietary driver which calls
      acpi_os_map/unmap_generic_address several times during initialization.
      Each unmap calls synchronize_rcu and adds significant delay. Totally
      initialization is slowed for a couple of seconds and that is enough to
      trigger timeout in hardware, gpu decides to "fell off the bus". Widely
      spread workaround is reducing "rcu_idle_gp_delay" from 4 to 1 jiffy.
      
      This patch replaces synchronize_rcu() with synchronize_rcu_expedited()
      which is much faster.
      
      Link: https://devtalk.nvidia.com/default/topic/567297/linux/linux-3-10-driver-crash/Signed-off-by: NKonstantin Khlebnikov <koct9i@gmail.com>
      Reported-and-tested-by: NAlexander Monakov <amonakov@gmail.com>
      Reviewed-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      74b51ee1
  12. 06 11月, 2014 1 次提交
  13. 05 11月, 2014 4 次提交
  14. 30 10月, 2014 2 次提交
  15. 29 10月, 2014 2 次提交
    • L
      ACPI / EC: Fix regression due to conflicting firmware behavior between Samsung and Acer. · 79149001
      Lv Zheng 提交于
      It is reported that Samsung laptops that need to poll events are broken by
      the following commit:
       Commit 3afcf2ec
       Subject: ACPI / EC: Add support to disallow QR_EC to be issued when SCI_EVT isn't set
      
      The behaviors of the 2 vendor firmwares are conflict:
       1. Acer: OSPM shouldn't issue QR_EC unless SCI_EVT is set, firmware
               automatically sets SCI_EVT as long as there is event queued up.
       2. Samsung: OSPM should issue QR_EC whatever SCI_EVT is set, firmware
                  returns 0 when there is no event queued up.
      
      This patch is a quick fix to distinguish the behaviors to make Acer
      behavior only effective for Acer EC firmware so that the breakages on
      Samsung EC firmware can be avoided.
      
      Fixes: 3afcf2ec (ACPI / EC: Add support to disallow QR_EC to be issued ...)
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=44161Reported-and-tested-by: NOrtwin Glück <odi@odi.ch>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Cc: 3.17+ <stable@vger.kernel.org> # 3.17+
      [ rjw : Subject ]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      79149001
    • L
      Revert "ACPI / EC: Add support to disallow QR_EC to be issued before completing previous QR_EC" · df9ff918
      Lv Zheng 提交于
      It is reported that the following commit breaks Samsung hardware:
       Commit: 558e4736.
       Subject: ACPI / EC: Add support to disallow QR_EC to be issued before
                completing previous QR_EC
      
      Which means the Samsung behavior conflicts with the Acer behavior.
      
      1. Samsung may behave like:
         [ +event 1 ] SCI_EVT set
         [ +event 2 ] SCI_EVT set
                                    write QR_EC
                                    read event
         [ -event 1 ] SCI_EVT clear
         Without the above commit, Samsung can work:
         [ +event 1 ] SCI_EVT set
         [ +event 2 ] SCI_EVT set
                                    write QR_EC
                                    CAN prepare next QR_EC as SCI_EVT=1
                                    read event
         [ -event 1 ] SCI_EVT clear
                                    write QR_EC
                                    read event
         [ -event 2 ] SCI_EVT clear
         With the above commit, Samsung cannot work:
         [ +event 1 ] SCI_EVT set
         [ +event 2 ] SCI_EVT set
                                    write QR_EC
                                    read event
         [ -event 1 ] SCI_EVT clear
                                    CANNOT prepare next QR_EC as SCI_EVT=0
      2. Acer may behave like:
         [ +event 1 ] SCI_EVT set
         [ +event 2 ]
                                    write QR_EC
                                    read event
         [ -event 1 ] SCI_EVT clear
         [ +event 2 ] SCI_EVT set
         Without the above commit, Acer cannot work when there is only 1 event:
         [ +event 1 ] SCI_EVT set
                                    write QR_EC
                                    can prepared next QR_EC as SCI_EVT=1
                                    read event
         [ -event 1 ] SCI_EVT clear
                                    CANNOT write QR_EC as SCI_EVT=0
         With the above commit, Acer can work:
         [ +event 1 ] SCI_EVT set
         [ +event 2 ]
                                    write QR_EC
                                    read event
         [ -event 1 ] SCI_EVT set
                                    can prepare next QR_EC because SCI_EVT=0
                                    CAN write QR_EC as SCI_EVT=1
      
      Since Acer can also work with only the following commit applied:
       Commit: 3afcf2ec
       Subject: ACPI / EC: Add support to disallow QR_EC to be issued when
                SCI_EVT isn't set
      commit 558e4736 can be reverted.
      
      Fixes: 558e4736 (ACPI / EC: Add support to disallow QR_EC to be issued ...)
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=44161Reported-and-tested-by: NOrtwin Glück <odi@odi.ch>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Cc: 3.17+ <stable@vger.kernel.org> # 3.17+
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      df9ff918
  16. 28 10月, 2014 1 次提交
    • M
      ACPI: Use ACPI companion to match only the first physical device · 52870786
      Mika Westerberg 提交于
      Commit 6ab34301 ("mfd: Add ACPI support") made the MFD subdevices
      share the parent MFD ACPI companion if no _HID/_CID is specified for
      the subdevice in mfd_cell description. However, since all the subdevices
      share the ACPI companion, the match and modalias generation logic started
      to use the ACPI companion as well resulting this:
      
        # cat /sys/bus/platform/devices/HID-SENSOR-200041.6.auto/modalias
        acpi:INT33D1:PNP0C50:
      
      instead of the expected one
      
        # cat /sys/bus/platform/devices/HID-SENSOR-200041.6.auto/modalias
        platform:HID-SENSOR-200041
      
      In other words the subdevice modalias is overwritten by the one taken from
      ACPI companion. This causes udev not to load the driver anymore.
      
      It is useful to be able to share the ACPI companion so that MFD subdevices
      (and possibly other devices as well) can access the ACPI resources even if
      they do not have ACPI representation in the namespace themselves.
      
      An example where this is used is Minnowboard LPC driver that creates GPIO
      as a subdevice among other things. Without the ACPI companion gpiolib is
      not able to lookup the corresponding GPIO controller from ACPI GpioIo
      resource.
      
      To fix this, restrict the match and modalias logic to be limited to the
      first (primary) physical device associated with the given ACPI comapnion.
      The secondary devices will still be able to access the ACPI companion,
      but they will be matched in a different way.
      
      Fixes: 6ab34301 (mfd: Add ACPI support)
      Reported-by: NJarkko Nikula <jarkko.nikula@linux.intel.com>
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      52870786
  17. 24 10月, 2014 1 次提交
  18. 22 10月, 2014 1 次提交
  19. 21 10月, 2014 3 次提交