1. 07 Aug, 2010 1 commit
    • Rafael J. Wysocki's avatar
      ACPI / ACPICA: Fix reference counting problems with GPE handlers · 28f4f8a9
      Rafael J. Wysocki authored
      If a handler is installed for a GPE associated with an AML method and
      such that it cannot wake up the system from sleep states, the GPE
      remains enabled after the handler has been installed, although it
      should be disabled in that case to avoid spurious execution of the
      handler.
      
      Fix this issue by making acpi_install_gpe_handler() disable GPEs
      that were previously associated with AML methods and cannot wake up
      the system from sleep states.
      
      Analogously, make acpi_remove_gpe_handler() enable the GPEs that
      are associated with AML methods after their handlers have been
      removed and cannot wake up the system from sleep states.  In addition
      to that, fix a code ordering issue in acpi_remove_gpe_handler() that
      renders the locking ineffective (ACPI_MTX_EVENTS is released
      temporarily in the middle of the routine to wait for the completion
      of events already in progress).
      
      For this purpose introduce acpi_raw_disable_gpe() and
      acpi_raw_enable_gpe() to be called with acpi_gbl_gpe_lock held
      and rework acpi_disable_gpe() and acpi_enable_gpe(), respectively, to
      use them.  Also rework acpi_gpe_can_wake() to use
      acpi_raw_disable_gpe() instead of calling acpi_disable_gpe() after
      releasing the lock to avoid the possible theoretical race with
      acpi_install_gpe_handler().
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Cc: "Moore, Robert" <robert.moore@intel.com>
      Cc: Lin Ming <ming.m.lin@intel.com>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
      28f4f8a9
  2. 12 Jul, 2010 4 commits
    • Rafael J. Wysocki's avatar
      ACPI / ACPICA: Simplify acpi_ev_initialize_gpe_block() · a0d46871
      Rafael J. Wysocki authored
      Simplify the main loop in acpi_ev_initialize_gpe_block() by
      rearranging code and removing the "enabled" label that is not
      necessary any more.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
      a0d46871
    • Rafael J. Wysocki's avatar
      ACPI / ACPICA: Fail acpi_gpe_wakeup() if ACPI_GPE_CAN_WAKE is unset · 9ce10df8
      Rafael J. Wysocki authored
      Make acpi_gpe_wakeup() return error code for GPEs whose
      ACPI_GPE_CAN_WAKE flag is not set.  This way acpi_gpe_wakeup() will
      only wake for the GPEs reported by the host OS as "wakeup" ones with
      the help of acpi_gpe_can_wake().
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
      9ce10df8
    • Rafael J. Wysocki's avatar
      ACPI / ACPICA: Do not execute _PRW methods during initialization · 9874647b
      Rafael J. Wysocki authored
      Currently, during initialization ACPICA walks the entire ACPI
      namespace in search of any device objects with assciated _PRW
      methods.  All of the _PRW methods found are executed in the process
      to extract the GPE information returned by them, so that the GPEs in
      question can be marked as "able to wakeup" (more precisely, the
      ACPI_GPE_CAN_WAKE flag is set for them).  The only purpose of this
      exercise is to avoid enabling the CAN_WAKE GPEs automatically, even
      if there are _Lxx/_Exx methods associated with them.  However, it is
      both costly and unnecessary, because the host OS has to execute the
      _PRW methods anyway to check which devices can wake up the system
      from sleep states.  Moreover, it then uses full information
      returned by _PRW, including the GPE information, so it can take care
      of disabling the GPEs if necessary.
      
      Remove the code that walks the namespace and executes _PRW from
      ACPICA and modify comments to reflect that change.  Make
      acpi_bus_set_run_wake_flags() disable GPEs for wakeup devices
      so that they don't cause spurious wakeup events to be signaled.
      This not only reduces the complexity of the ACPICA initialization
      code, but in some cases it should reduce the kernel boot time as
      well.
      
      Unfortunately, for this purpose we need a new ACPICA function,
      acpi_gpe_can_wake(), to be called by the host OS in order to disable
      the GPEs that can wake up the system and were previously enabled by
      acpi_ev_initialize_gpe_block() or acpi_ev_update_gpes() (such a GPE
      should be disabled only once, because the initialization code enables
      it only once, but it may be pointed to by _PRW for multiple devices
      and that's why the additional function is necessary).
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
      9874647b
    • Rafael J. Wysocki's avatar
      ACPI: Fix bogus GPE test in acpi_bus_set_run_wake_flags() · e8e18c95
      Rafael J. Wysocki authored
      When we check if a GPE can be used for runtime signaling, we only
      search the FADT GPE blocks, which is incorrect, becuase the GPE
      may be located elsewhere.  We really should be using the GPE device
      information previously returned by _PRW here, so make that happen.
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
      e8e18c95
  3. 07 Jul, 2010 23 commits
  4. 05 Jul, 2010 8 commits
  5. 04 Jul, 2010 1 commit
    • Will Deacon's avatar
      ARM: 6205/1: perf: ensure counter delta is treated as unsigned · 446a5a8b
      Will Deacon authored
      Hardware performance counters on ARM are 32-bits wide but atomic64_t
      variables are used to represent counter data in the hw_perf_event structure.
      
      The armpmu_event_update function right-shifts a signed 64-bit delta variable
      and adds the result to the event count. This can lead to shifting in sign-bits
      if the MSB of the 32-bit counter value is set. This results in perf output
      such as:
      
       Performance counter stats for 'sleep 20':
      
       18446744073460670464  cycles             <-- 0xFFFFFFFFF12A6000
              7783773  instructions             #      0.000 IPC
                  465  context-switches
                  161  page-faults
              1172393  branches
      
         20.154242147  seconds time elapsed
      
      This patch ensures that the delta value is treated as unsigned so that the
      right shift sets the upper bits to zero.
      
      Cc: <stable@kernel.org>
      Acked-by: default avatarJamie Iles <jamie.iles@picochip.com>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      446a5a8b
  6. 03 Jul, 2010 1 commit
  7. 02 Jul, 2010 2 commits