1. 25 8月, 2010 5 次提交
    • R
      PCI: PCIe: Ask BIOS for control of all native services at once · 28eb5f27
      Rafael J. Wysocki 提交于
      After commit 852972ac (ACPI: Disable
      ASPM if the platform won't provide _OSC control for PCIe) control of
      the PCIe Capability Structure is unconditionally requested by
      acpi_pci_root_add(), which in principle may cause problems to
      happen in two ways.  First, the BIOS may refuse to give control of
      the PCIe Capability Structure if it is not asked for any of the
      _OSC features depending on it at the same time.  Second, the BIOS may
      assume that control of the _OSC features depending on the PCIe
      Capability Structure will be requested in the future and may behave
      incorrectly if that doesn't happen.  For this reason, control of
      the PCIe Capability Structure should always be requested along with
      control of any other _OSC features that may depend on it (ie. PCIe
      native PME, PCIe native hot-plug, PCIe AER).
      
      Rework the PCIe port driver so that (1) it checks which native PCIe
      port services can be enabled, according to the BIOS, and (2) it
      requests control of all these services simultaneously.  In
      particular, this causes pcie_portdrv_probe() to fail if the BIOS
      refuses to grant control of the PCIe Capability Structure, which
      means that no native PCIe port services can be enabled for the PCIe
      Root Complex the given port belongs to.  If that happens, ASPM is
      disabled to avoid problems with mishandling it by the part of the
      PCIe hierarchy for which control of the PCIe Capability Structure
      has not been received.
      
      Make it possible to override this behavior using 'pcie_ports=native'
      (use the PCIe native services regardless of the BIOS response to the
      control request), or 'pcie_ports=compat' (do not use the PCIe native
      services at all).
      
      Accordingly, rework the existing PCIe port service drivers so that
      they don't request control of the services directly.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      28eb5f27
    • R
      ACPI/PCI: Negotiate _OSC control bits before requesting them · 75fb60f2
      Rafael J. Wysocki 提交于
      It is possible that the BIOS will not grant control of all _OSC
      features requested via acpi_pci_osc_control_set(), so it is
      recommended to negotiate the final set of _OSC features with the
      query flag set before calling _OSC to request control of these
      features.
      
      To implement it, rework acpi_pci_osc_control_set() so that the caller
      can specify the mask of _OSC control bits to negotiate and the mask
      of _OSC control bits that are absolutely necessary to it.  Then,
      acpi_pci_osc_control_set() will run _OSC queries in a loop until
      the mask of _OSC control bits returned by the BIOS is equal to the
      mask passed to it.  Also, before running the _OSC request
      acpi_pci_osc_control_set() will check if the caller's required
      control bits are present in the final mask.
      
      Using this mechanism we will be able to avoid situations in which the
      BIOS doesn't grant control of certain _OSC features, because they
      depend on some other _OSC features that have not been requested.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      75fb60f2
    • R
      ACPI/PCI: Do not preserve _OSC control bits returned by a query · 2b8fd918
      Rafael J. Wysocki 提交于
      There is the assumption in acpi_pci_osc_control_set() that it is
      always sufficient to compare the mask of _OSC control bits to be
      requested with the result of an _OSC query where all of the known
      control bits have been checked.  However, in general, that need not
      be the case.  For example, if an _OSC feature A depends on an _OSC
      feature B and control of A, B plus another _OSC feature C is
      requested simultaneously, the BIOS may return A, B, C, while it would
      only return C if A and C were requested without B.
      
      That may result in passing a wrong mask of _OSC control bits to an
      _OSC control request, in which case the BIOS may only grant control
      of a subset of the requested features.  Moreover, acpi_pci_run_osc()
      will return error code if that happens and the caller of
      acpi_pci_osc_control_set() will not know that it's been granted
      control of some _OSC features.  Consequently, the system will
      generally not work as expected.
      
      Apart from this acpi_pci_osc_control_set() always uses the mask
      of _OSC control bits returned by the very first invocation of
      acpi_pci_query_osc(), but that is done with the second argument
      equal to OSC_PCI_SEGMENT_GROUPS_SUPPORT which generally happens
      to affect the returned _OSC control bits.
      
      For these reasons, make acpi_pci_osc_control_set() always check if
      control of the requested _OSC features will be granted before making
      the final control request.  As a result, the osc_control_qry and
      osc_queried members of struct acpi_pci_root are not necessary any
      more, so drop them and remove the remaining code referring to them.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      2b8fd918
    • R
      ACPI/PCI: Make acpi_pci_query_osc() return control bits · ab8e8957
      Rafael J. Wysocki 提交于
      Make acpi_pci_query_osc() use an additional pointer argument to
      return the mask of control bits obtained from the BIOS to the
      caller.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      ab8e8957
    • R
      ACPI/PCI: Reorder checks in acpi_pci_osc_control_set() · b879dc4b
      Rafael J. Wysocki 提交于
      Make acpi_pci_osc_control_set() attempt to find the handle of the
      _OSC object under the given PCI root bridge object after verifying
      that its second argument is correct and that there is a struct
      acpi_pci_root object for the given root bridge handle, which is
      more logical than the old code.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      b879dc4b
  2. 15 8月, 2010 10 次提交
  3. 12 8月, 2010 1 次提交
    • T
      acpi: fix bogus preemption logic · 0a7992c9
      Thomas Gleixner 提交于
      The ACPI_PREEMPTION_POINT() logic was introduced in commit 8bd108d1
      (ACPICA: add preemption point after each opcode parse).  The follow up
      commits abe1dfab, 138d1569, c084ca70 tried to fix the preemption logic
      back and forth, but nobody noticed that the usage of
      in_atomic_preempt_off() in that context is wrong.
      
      The check which guards the call of cond_resched() is:
      
          if (!in_atomic_preempt_off() && !irqs_disabled())
      
      in_atomic_preempt_off() is not intended for general use as the comment
      above the macro definition clearly says:
      
       * Check whether we were atomic before we did preempt_disable():
       * (used by the scheduler, *after* releasing the kernel lock)
      
      On a CONFIG_PREEMPT=n kernel the usage of in_atomic_preempt_off() works by
      accident, but with CONFIG_PREEMPT=y it's just broken.
      
      The whole purpose of the ACPI_PREEMPTION_POINT() is to reduce the latency
      on a CONFIG_PREEMPT=n kernel, so make ACPI_PREEMPTION_POINT() depend on
      CONFIG_PREEMPT=n and remove the in_atomic_preempt_off() check.
      
      Addresses https://bugzilla.kernel.org/show_bug.cgi?id=16210
      
      [akpm@linux-foundation.org: fix build]
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Len Brown <lenb@kernel.org>
      Cc: Francois Valenduc <francois.valenduc@tvcablenet.be>
      Cc: Lin Ming <ming.m.lin@intel.com>
      Cc: <stable@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0a7992c9
  4. 11 8月, 2010 1 次提交
  5. 09 8月, 2010 3 次提交
  6. 07 8月, 2010 1 次提交
    • R
      ACPI / ACPICA: Fix reference counting problems with GPE handlers · 28f4f8a9
      Rafael J. Wysocki 提交于
      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: NRafael J. Wysocki <rjw@sisk.pl>
      Cc: "Moore, Robert" <robert.moore@intel.com>
      Cc: Lin Ming <ming.m.lin@intel.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      28f4f8a9
  7. 03 8月, 2010 6 次提交
  8. 02 8月, 2010 1 次提交
  9. 31 7月, 2010 1 次提交
    • M
      ACPI: Disable ASPM if the platform won't provide _OSC control for PCIe · 852972ac
      Matthew Garrett 提交于
      The PCI SIG documentation for the _OSC OS/firmware handshaking interface
      states:
      
      "If the _OSC control method is absent from the scope of a host bridge
      device, then the operating system must not enable or attempt to use any
      features defined in this section for the hierarchy originated by the host
      bridge."
      
      The obvious interpretation of this is that the OS should not attempt to use
      PCIe hotplug, PME or AER - however, the specification also notes that an
      _OSC method is *required* for PCIe hierarchies, and experimental validation
      with An Alternative OS indicates that it doesn't use any PCIe functionality
      if the _OSC method is missing. That arguably means we shouldn't be using
      MSI or extended config space, but right now our problems seem to be limited
      to vendors being surprised when ASPM gets enabled on machines when other
      OSs refuse to do so. So, for now, let's just disable ASPM if the _OSC
      method doesn't exist or refuses to hand over PCIe capability control.
      Acked-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NMatthew Garrett <mjg@redhat.com>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      852972ac
  10. 27 7月, 2010 2 次提交
  11. 25 7月, 2010 1 次提交
  12. 23 7月, 2010 2 次提交
  13. 21 7月, 2010 1 次提交
  14. 13 7月, 2010 5 次提交
    • R
      ACPI / ACPICA: Simplify acpi_ev_initialize_gpe_block() · a0d46871
      Rafael J. Wysocki 提交于
      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: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      a0d46871
    • R
      ACPI / ACPICA: Fail acpi_gpe_wakeup() if ACPI_GPE_CAN_WAKE is unset · 9ce10df8
      Rafael J. Wysocki 提交于
      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: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      9ce10df8
    • R
      ACPI / ACPICA: Do not execute _PRW methods during initialization · 9874647b
      Rafael J. Wysocki 提交于
      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: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      9874647b
    • R
      ACPI: Fix bogus GPE test in acpi_bus_set_run_wake_flags() · e8e18c95
      Rafael J. Wysocki 提交于
      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: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      e8e18c95
    • A
      ACPI: processor: fix processor_physically_present on UP · 856b185d
      Alex Chiang 提交于
      The commit 5d554a7b (ACPI: processor: add internal
      processor_physically_present()) is broken on uniprocessor (UP)
      configurations, as acpi_get_cpuid() will always return -1.
      
      We use the value of num_possible_cpus() to tell us whether we got
      an invalid cpuid from acpi_get_cpuid() in the SMP case, or if
      instead, we are UP, in which case num_possible_cpus() is #defined
      as 1.
      
      We use num_possible_cpus() instead of num_online_cpus() to
      protect ourselves against the scenario of CPU hotplug, and we've
      taken down all the CPUs except one.
      
      Thanks to Jan Pogadl for initial report and analysis and Chen
      Gong for review.
      
      https://bugzilla.kernel.org/show_bug.cgi?id=16357
      
      Reported-by: Jan Pogadl <pogadl.jan@googlemail.com>:
      Reviewed-by: NChen Gong <gong.chen@linux.intel.com>
      Signed-off-by: NAlex Chiang <achiang@canonical.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      856b185d