1. 11 7月, 2012 1 次提交
    • A
      PCI: EHCI: fix crash during suspend on ASUS computers · dbf0e4c7
      Alan Stern 提交于
      Quite a few ASUS computers experience a nasty problem, related to the
      EHCI controllers, when going into system suspend.  It was observed
      that the problem didn't occur if the controllers were not put into the
      D3 power state before starting the suspend, and commit
      151b6128 (USB: EHCI: fix crash during
      suspend on ASUS computers) was created to do this.
      
      It turned out this approach messed up other computers that didn't have
      the problem -- it prevented USB wakeup from working.  Consequently
      commit c2fb8a3f (USB: add
      NO_D3_DURING_SLEEP flag and revert 151b6128) was merged; it
      reverted the earlier commit and added a whitelist of known good board
      names.
      
      Now we know the actual cause of the problem.  Thanks to AceLan Kao for
      tracking it down.
      
      According to him, an engineer at ASUS explained that some of their
      BIOSes contain a bug that was added in an attempt to work around a
      problem in early versions of Windows.  When the computer goes into S3
      suspend, the BIOS tries to verify that the EHCI controllers were first
      quiesced by the OS.  Nothing's wrong with this, but the BIOS does it
      by checking that the PCI COMMAND registers contain 0 without checking
      the controllers' power state.  If the register isn't 0, the BIOS
      assumes the controller needs to be quiesced and tries to do so.  This
      involves making various MMIO accesses to the controller, which don't
      work very well if the controller is already in D3.  The end result is
      a system hang or memory corruption.
      
      Since the value in the PCI COMMAND register doesn't matter once the
      controller has been suspended, and since the value will be restored
      anyway when the controller is resumed, we can work around the BIOS bug
      simply by setting the register to 0 during system suspend.  This patch
      (as1590) does so and also reverts the second commit mentioned above,
      which is now unnecessary.
      
      In theory we could do this for every PCI device.  However to avoid
      introducing new problems, the patch restricts itself to EHCI host
      controllers.
      
      Finally the affected systems can suspend with USB wakeup working
      properly.
      
      Reference: https://bugzilla.kernel.org/show_bug.cgi?id=37632
      Reference: https://bugzilla.kernel.org/show_bug.cgi?id=42728Based-on-patch-by: NAceLan Kao <acelan.kao@canonical.com>
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: NDâniel Fraga <fragabr@gmail.com>
      Tested-by: NJavier Marcet <jmarcet@gmail.com>
      Tested-by: NAndrey Rahmatullin <wrar@wrar.name>
      Tested-by: NOleksij Rempel <bug-track@fisher-privat.net>
      Tested-by: NPavel Pisa <pisa@cmp.felk.cvut.cz>
      Cc: stable <stable@vger.kernel.org>
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      Acked-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dbf0e4c7
  2. 05 5月, 2012 1 次提交
    • K
      PCI: disable Bus Master on PCI device shutdown · b566a22c
      Khalid Aziz 提交于
      Disable Bus Master bit on the device in pci_device_shutdown() to ensure PCI
      devices do not continue to DMA data after shutdown.  This can cause memory
      corruption in case of a kexec where the current kernel shuts down and
      transfers control to a new kernel while a PCI device continues to DMA to
      memory that does not belong to it any more in the new kernel.
      
      I have tested this code on two laptops, two workstations and a 16-socket
      server.  kexec worked correctly on all of them.
      Signed-off-by: NKhalid Aziz <khalid.aziz@hp.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      b566a22c
  3. 18 2月, 2012 1 次提交
    • R
      PCI / PM: Disable wakeup during shutdown for devices not enabled to wake up · 5b415f1e
      Rafael J. Wysocki 提交于
      If a PCI device is enabled to generate wakeup signals (PME) when put
      into a low-power state by runtime PM, it will be still enabled to
      generate those signals after the system shutdown, unless its driver's
      .shutdown() callback takes care of the wakeup signals generation
      setting.  Moreover, there are devices that are not enabled to wake
      up the system and that are configured by runtime PM to generate
      wakeup signals so that (runtime) remote wakeup works with them.
      Those devices should be reconfigured during system shutdown so that
      they don't generate wakeup signals, but at least some drivers don't
      do that.  However, that very well may be done by the PCI core so
      that drivers don't have to worry about it.  For this reason, modify
      pci_device_shutdown() to disable the generation of wakeup events for
      devices not supposed to wake up the system.
      
      References: https://bugzilla.kernel.org/show_bug.cgi?id=37952Reported-and-tested-by: NKamil Iskra <kamil.54002@iskra.name>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      5b415f1e
  4. 27 1月, 2012 1 次提交
  5. 25 1月, 2012 1 次提交
    • A
      Dynamic ID addition doesn't need get_driver() · cef9bc56
      Alan Stern 提交于
      As part of the removal of get_driver()/put_driver(), this patch
      (as1511) changes all the places that add dynamic IDs for drivers.
      Since these additions are done by writing to the drivers' sysfs
      attribute files, and the attributes are removed when the drivers are
      unregistered, there is no reason to take an extra reference to the
      drivers.
      
      The one exception is the pci-stub driver, which calls pci_add_dynid()
      as part of its registration.  But again, there's no reason to take an
      extra reference here, because the driver can't be unloaded while it is
      being registered.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Dmitry Torokhov <dmitry.torokhov@gmail.com>
      CC: Jiri Kosina <jkosina@suse.cz>
      CC: Jesse Barnes <jbarnes@virtuousgeek.org>
      CC: Dominik Brodowski <linux@dominikbrodowski.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      cef9bc56
  6. 07 1月, 2012 1 次提交
  7. 06 7月, 2011 1 次提交
    • R
      PCI / PM: Detect early wakeup in pci_pm_prepare() · eea3fc03
      Rafael J. Wysocki 提交于
      A subsequent patch is going to move the invocation of
      pm_runtime_barrier() from dpm_prepare() to __device_suspend().
      Consequently, early wakeup events resulting from runtime resume
      requests for wakeup devices queued up right before system suspend
      will only be detected after all of the subsystem-level .prepare()
      callbacks have run.  However, the PCI bus type calls
      pm_runtime_get_sync() from its pci_pm_prepare() callback routine,
      so it would destroy the early wakeup events information regarding PCI
      devices.  To prevent this from happening add an early wakeup
      detection mechanism, analogous to the one currently in dpm_prepare(),
      to pci_pm_prepare().
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      eea3fc03
  8. 22 6月, 2011 1 次提交
    • R
      PCI / PM: Block races between runtime PM and system sleep · a5f76d5e
      Rafael J. Wysocki 提交于
      After commit e8665002
      (PM: Allow pm_runtime_suspend() to succeed during system suspend) it
      is possible that a device resumed by the pm_runtime_resume(dev) in
      pci_pm_prepare() will be suspended immediately from a work item,
      timer function or otherwise, defeating the very purpose of calling
      pm_runtime_resume(dev) from there.  To prevent that from happening
      it is necessary to increment the runtime PM usage counter of the
      device by replacing pm_runtime_resume() with pm_runtime_get_sync().
      Moreover, the incremented runtime PM usage counter has to be
      decremented by the corresponding pci_pm_complete(), via
      pm_runtime_put_sync().
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Cc: stable@kernel.org
      Acked-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      a5f76d5e
  9. 12 4月, 2011 1 次提交
    • R
      PM / Hibernate: Introduce CONFIG_HIBERNATE_CALLBACKS · 1f112cee
      Rafael J. Wysocki 提交于
      Xen save/restore is going to use hibernate device callbacks for
      quiescing devices and putting them back to normal operations and it
      would need to select CONFIG_HIBERNATION for this purpose.  However,
      that also would cause the hibernate interfaces for user space to be
      enabled, which might confuse user space, because the Xen kernels
      don't support hibernation.  Moreover, it would be wasteful, as it
      would make the Xen kernels include a substantial amount of code that
      they would never use.
      
      To address this issue introduce new power management Kconfig option
      CONFIG_HIBERNATE_CALLBACKS, such that it will only select the code
      that is necessary for the hibernate device callbacks to work and make
      CONFIG_HIBERNATION select it.  Then, Xen save/restore will be able to
      select CONFIG_HIBERNATE_CALLBACKS without dragging the entire
      hibernate code along with it.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Tested-by: NShriram Rajagopalan <rshriram@cs.ubc.ca>
      1f112cee
  10. 15 3月, 2011 1 次提交
  11. 24 12月, 2010 2 次提交
  12. 31 7月, 2010 1 次提交
    • A
      PCI: change device runtime PM settings for probe and remove · f3ec4f87
      Alan Stern 提交于
      This patch (as1388) changes the way the PCI core handles runtime PM
      settings when probing or unbinding drivers.  Now the core will make
      sure the device is enabled for runtime PM, with a usage count >= 1,
      when a driver is probed.  It does the same when calling a driver's
      remove method.
      
      If the driver wants to use runtime PM, all it has to do is call
      pm_runtime_pu_noidle() near the end of its probe routine (to cancel
      the core's usage increment) and pm_runtime_get_noresume() near the
      start of its remove routine (to restore the usage count).  It does not
      need to mess around with setting the runtime state to enabled,
      disabled, active, or suspended.
      
      The patch updates e1000e and r8169, the only PCI drivers that already
      use the existing runtime PM interface.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      f3ec4f87
  13. 23 2月, 2010 1 次提交
  14. 15 9月, 2009 2 次提交
  15. 10 9月, 2009 1 次提交
  16. 21 8月, 2009 1 次提交
  17. 25 7月, 2009 1 次提交
  18. 24 7月, 2009 1 次提交
  19. 31 3月, 2009 4 次提交
  20. 21 3月, 2009 2 次提交
  21. 13 3月, 2009 1 次提交
  22. 05 2月, 2009 4 次提交
  23. 28 1月, 2009 2 次提交
    • R
      PCI PM: Fix hibernation breakage on EeePC 701 · 545ffd58
      Rafael J. Wysocki 提交于
      Hibernation breaks on EeePC 701 as a result of attempting to put one
      of its (driverless) devices into a low power state.  Avoid that by
      not attepmting to power manage driverless devices during hibernation.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reported-and-tested-by: NAlan Jenkins <alan-jenkins@tuffmail.co.uk>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      545ffd58
    • R
      PCI PM: Fix suspend error paths and testing facility breakage · 418e4da3
      Rafael J. Wysocki 提交于
      If one of device drivers refuses to suspend by returning error code
      from its ->suspend() callback, the devices that have already been
      suspended are resumed by executing their drivers' ->resume()
      callbacks.  Some of these callbacks expect the device's
      configuration space to be restored if the device has been put into
      D3 before they are called.  Unfortunately, this mechanism has been
      broken by recent changes moving the restoration of config spaces
      of some devices (most importantly, USB controllers and HDA Intel)
      into the resume callbacks executed with interrupts off.  Obviously,
      these callbacks are not invoked in the suspend error path and, as a
      result, the system cannot be successfully brought back into the
      working state in case of a suspend error.  The same thing happens
      in the hibernation error path right before putting the system into
      S4.
      
      Similarly, the suspend testing facility associated with the
      /sys/power/pm_test file is broken, because it uses the very same
      mechanism that is used in the suspend and hibernation error paths.
      
      Fix the breakage by making the PCI core restore the configuration
      spaces of PCI devices that haven't been restored already before
      pci_pm_resume() is called for those devices by the PM core.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      418e4da3
  24. 17 1月, 2009 1 次提交
    • R
      PCI PM: Restore standard config registers of all devices early · aa8c6c93
      Rafael J. Wysocki 提交于
      There is a problem in our handling of suspend-resume of PCI devices that
      many of them have their standard config registers restored with
      interrupts enabled and they are put into the full power state with
      interrupts enabled as well.  This may lead to the following scenario:
        * an interrupt vector is shared between two or more devices
        * one device is resumed earlier and generates an interrupt
        * the interrupt handler of another device tries to handle it and
          attempts to access the device the config space of which hasn't been
          restored yet and/or which still is in a low power state
        * the system crashes as a result
      
      To prevent this from happening we should restore the standard
      configuration registers of all devices with interrupts disabled and we
      should put them into the D0 power state right after that.
      Unfortunately, this cannot be done using the existing
      pci_set_power_state(), because it can sleep.  Also, to do it we have to
      make sure that the config spaces of all devices were actually saved
      during suspend.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      aa8c6c93
  25. 08 1月, 2009 6 次提交