1. 19 6月, 2015 1 次提交
  2. 08 5月, 2015 1 次提交
  3. 25 3月, 2015 1 次提交
  4. 12 11月, 2014 2 次提交
    • 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
    • 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
  5. 01 10月, 2014 1 次提交
    • R
      ACPI / sleep: Rework the handling of ACPI GPE wakeup from suspend-to-idle · a8d46b9e
      Rafael J. Wysocki 提交于
      The ACPI GPE wakeup from suspend-to-idle is currently based on using
      the IRQF_NO_SUSPEND flag for the ACPI SCI, but that is problematic
      for a couple of reasons.  First, in principle the ACPI SCI may be
      shared and IRQF_NO_SUSPEND does not really work well with shared
      interrupts.  Second, it may require the ACPI subsystem to special-case
      the handling of device notifications depending on whether or not
      they are received during suspend-to-idle in some places which would
      lead to fragile code.  Finally, it's better the handle ACPI wakeup
      interrupts consistently with wakeup interrupts from other sources.
      
      For this reason, remove the IRQF_NO_SUSPEND flag from the ACPI SCI
      and use enable_irq_wake()/disable_irq_wake() with it instead, which
      requires two additional platform hooks to be added to struct
      platform_freeze_ops.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a8d46b9e
  6. 25 9月, 2014 1 次提交
    • M
      ACPI: Support _OSI("Darwin") correctly · 7bc5a2ba
      Matthew Garrett 提交于
      Apple hardware queries _OSI("Darwin") in order to determine whether the
      system is running OS X, and changes firmware behaviour based on the
      answer.  The most obvious difference in behaviour is that Thunderbolt
      hardware is forcibly powered down unless the system is running OS X. The
      obvious solution would be to simply add Darwin to the list of supported
      _OSI strings, but this causes problems.
      
      Recent Apple hardware includes two separate methods for checking _OSI
      strings. The first will check whether Darwin is supported, and if so
      will exit. The second will check whether Darwin is supported, but will
      then continue to check for further operating systems. If a further
      operating system is found then later firmware code will assume that the
      OS is not OS X.  This results in the unfortunate situation where the
      Thunderbolt controller is available at boot time but remains powered
      down after suspend.
      
      The easiest way to handle this is to special-case it in the
      Linux-specific OSI handling code. If we see Darwin, we should answer
      true and then disable all other _OSI vendor strings.
      
      The next problem is that the Apple PCI _OSC method has the following
      code:
      
      if (LEqual (0x01, OSDW ()))
        if (LAnd (LEqual (Arg0, GUID), NEXP)
          (do stuff)
        else
          (fail)
      NEXP is a value in high memory and is presumably under the control of
      the firmware. No methods sets it. The methods that are called in the "do
      stuff" path are dummies. Unless there's some additional firmware call in
      early boot, there's no way for this call to succeed - and even if it
      does, it doesn't do anything.
      
      The easiest way to handle this is simply to ignore it. We know which
      flags would be set, so just set them by hand if the platform is running
      in Darwin mode.
      Signed-off-by: NMatthew Garrett <matthew.garrett@nebula.com>
      [andreas.noever@gmail.com: merged two patches, do not touch ACPICA]
      Signed-off-by: NAndreas Noever <andreas.noever@gmail.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      7bc5a2ba
  7. 21 7月, 2014 1 次提交
  8. 17 6月, 2014 1 次提交
  9. 05 6月, 2014 1 次提交
  10. 28 5月, 2014 1 次提交
    • L
      ACPI: Clean up acpi_os_map/unmap_memory() to eliminate __iomem. · a238317c
      Lv Zheng 提交于
      ACPICA doesn't include protections around address space checking, Linux
      build tests always complain increased sparse warnings around ACPICA
      internal acpi_os_map/unmap_memory() invocations.  This patch tries to fix
      this issue permanently.
      
      There are 2 choices left for us to solve this issue:
       1. Add __iomem address space awareness into ACPICA.
       2. Remove sparse checker of __iomem from ACPICA source code.
      
      This patch chooses solution 2, because:
       1.  Most of the acpi_os_map/unmap_memory() invocations are used for ACPICA.
           table mappings, which in fact are not IO addresses.
       2.  The only IO addresses usage is for "system memory space" mapping code in:
            drivers/acpi/acpica/exregion.c
            drivers/acpi/acpica/evrgnini.c
            drivers/acpi/acpica/exregion.c
          The mapped address is accessed in the handler of "system memory space"
          - acpi_ex_system_memory_space_handler().  This function in fact can be
          changed to invoke acpi_os_read/write_memory() so that __iomem can
          always be type-casted in the OSL layer.
      
      According to the above investigation, we drew the following conclusion:
      It is not a good idea to introduce __iomem address space awareness into
      ACPICA mostly in order to protect non-IO addresses.
      
      We can simply remove __iomem for acpi_os_map/unmap_memory() to remove
      __iomem checker for ACPICA code. Then we need to enforce external usages
      to invoke other APIs that are aware of __iomem address space.
      The external usages are:
       drivers/acpi/apei/einj.c
       drivers/acpi/acpi_extlog.c
       drivers/char/tpm/tpm_acpi.c
       drivers/acpi/nvs.c
      
      This patch thus performs cleanups in this way:
       1. Add acpi_os_map/unmap_iomem() to be invoked by non-ACPICA code.
       2. Remove __iomem from acpi_os_map/unmap_memory().
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a238317c
  11. 21 4月, 2014 1 次提交
  12. 04 4月, 2014 1 次提交
  13. 26 3月, 2014 3 次提交
  14. 19 3月, 2014 1 次提交
  15. 05 3月, 2014 1 次提交
  16. 13 2月, 2014 1 次提交
    • L
      ACPICA: Add boot option to disable auto return object repair · 4dde507f
      Lv Zheng 提交于
      Sometimes, there might be bugs caused by unexpected AML which is compliant
      to the Windows but not compliant to the Linux implementation.
      
      There is a predefined validation mechanism implemented in ACPICA to repair
      the unexpected AML evaluation results that are caused by the unexpected
      AMLs.  For example, BIOS may return misorder _CST result and the repair
      mechanism can make an ascending order on the returned _CST package object
      based on the C-state type.
      This mechanism is quite useful to implement an AML interpreter with better
      compliance with the real world where Windows is the de-facto standard and
      BIOS codes are only tested on one platform thus not compliant to the
      ACPI specification.
      
      But if a compliance issue hasn't been figured out yet, it will be
      difficult for developers to identify if the unexpected evaluation result
      is caused by this mechanism or by the AML interpreter.
      For example, _PR0 is expected to be a control method, but BIOS may use
      Package: "Name(_PR0, Package(1) {P1PR})".
      This boot option can disable the predefined validation mechanism so that
      developers can make sure the root cause comes from the parser/executer.
      
      This patch adds a new kernel parameter to disable this feature.
      
      A build test has been made on a Dell Inspiron mini 1100 (i386 z530)
      machine when this patch is applied and the corresponding boot test is
      performed w/ or w/o the new kernel parameter specified.
      
      References: https://bugzilla.kernel.org/show_bug.cgi?id=67901Tested-by: NFabian Wehning <fabian.wehning@googlemail.com>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      4dde507f
  17. 06 1月, 2014 1 次提交
  18. 07 12月, 2013 3 次提交
    • A
      ACPI: remove trailing whitespace · cad1525a
      Al Stone 提交于
      Minor cleanup: remove some extra trailing white space.
      Signed-off-by: NAl Stone <al.stone@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      cad1525a
    • L
      ACPI / i915: Fix incorrect <acpi/acpi.h> inclusions via <linux/acpi_io.h> · 27d50c82
      Lv Zheng 提交于
      To avoid build problems and breaking dependencies between ACPI header
      files, <acpi/acpi.h> should not be included directly by code outside
      of the ACPI core subsystem.  However, that is possible if
      <linux/acpi_io.h> is included, because that file contains
      a direct inclusion of <acpi/acpi.h>.
      
      For this reason, remove the direct <acpi/acpi.h> inclusion from
      <linux/acpi_io.h>, move that file from include/linux/ to include/acpi/
      and make <linux/acpi.h> include it for CONFIG_ACPI set along with the
      other ACPI header files.  Accordingly, Remove the inclusions of
      <linux/acpi_io.h> from everywhere.
      
      Of course, that causes the contents of the new <acpi/acpi_io.h> file
      to be available for CONFIG_ACPI set only, so intel_opregion.o that
      depends on it should also depend on CONFIG_ACPI (and it really should
      not be compiled for CONFIG_ACPI unset anyway).
      
      References: https://01.org/linuxgraphics/sites/default/files/documentation/acpi_igd_opregion_spec.pdf
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Acked-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      [rjw: Subject and changelog]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      27d50c82
    • L
      ACPI: Clean up inclusions of ACPI header files · 8b48463f
      Lv Zheng 提交于
      Replace direct inclusions of <acpi/acpi.h>, <acpi/acpi_bus.h> and
      <acpi/acpi_drivers.h>, which are incorrect, with <linux/acpi.h>
      inclusions and remove some inclusions of those files that aren't
      necessary.
      
      First of all, <acpi/acpi.h>, <acpi/acpi_bus.h> and <acpi/acpi_drivers.h>
      should not be included directly from any files that are built for
      CONFIG_ACPI unset, because that generally leads to build warnings about
      undefined symbols in !CONFIG_ACPI builds.  For CONFIG_ACPI set,
      <linux/acpi.h> includes those files and for CONFIG_ACPI unset it
      provides stub ACPI symbols to be used in that case.
      
      Second, there are ordering dependencies between those files that always
      have to be met.  Namely, it is required that <acpi/acpi_bus.h> be included
      prior to <acpi/acpi_drivers.h> so that the acpi_pci_root declarations the
      latter depends on are always there.  And <acpi/acpi.h> which provides
      basic ACPICA type declarations should always be included prior to any other
      ACPI headers in CONFIG_ACPI builds.  That also is taken care of including
      <linux/acpi.h> as appropriate.
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Acked-by: Bjorn Helgaas <bhelgaas@google.com> (drivers/pci stuff)
      Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> (Xen stuff)
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      8b48463f
  19. 23 11月, 2013 1 次提交
    • R
      ACPI / scan: Define non-empty device removal handler · d783156e
      Rafael J. Wysocki 提交于
      If an ACPI namespace node is removed (usually, as a result of a
      table unload), and there is a data object attached to that node,
      acpi_ns_delete_node() executes the removal handler submitted to
      acpi_attach_data() for that object.  That handler is currently empty
      for struct acpi_device objects, so it is necessary to detach those
      objects from the corresponding ACPI namespace nodes in advance every
      time a table unload may happen.  That is cumbersome and inefficient
      and leads to some design constraints that turn out to be quite
      inconvenient (in particular, struct acpi_device objects cannot be
      registered for namespace nodes representing devices that are not
      reported as present or functional by _STA).
      
      For this reason, introduce a non-empty removal handler for ACPI
      device objects that will unregister them when their ACPI namespace
      nodes go away.
      
      This code modification alone should not change functionality except
      for the ordering of the ACPI hotplug workqueue which should not
      matter (without subsequent code changes).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      d783156e
  20. 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
  21. 18 10月, 2013 1 次提交
  22. 25 9月, 2013 2 次提交
  23. 15 8月, 2013 1 次提交
  24. 13 8月, 2013 1 次提交
  25. 31 7月, 2013 1 次提交
  26. 26 7月, 2013 1 次提交
  27. 23 7月, 2013 2 次提交
    • L
      ACPI: Add facility to remove all _OSI strings · 741d8128
      Lv Zheng 提交于
      This patch changes the "acpi_osi=" boot parameter implementation so
      that:
      1. "acpi_osi=!" can be used to disable all _OSI OS vendor strings by
         default.  It is meaningless to specify "acpi_osi=!" multiple
         times as it can only affect the default state of the target _OSI
         strings.
      2. "acpi_osi=!*" can be used to remove all _OSI OS vendor strings
         and all _OSI feature group strings.  It is useful to specify
         "acpi_osi=!*" multiple times through kernel command line to
         override the current state of the target _OSI strings.
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Reviewed-by: NZhang Rui <rui.zhang@intel.com>
      Acked-by: NLen Brown <len.brown@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      741d8128
    • L
      ACPI: Add facility to disable all _OSI OS vendor strings · 5dc17986
      Lv Zheng 提交于
      This patch introduces "acpi_osi=!" command line to force Linux replying
      "UNSUPPORTED" to all of the _OSI strings.  This patch is based on an
      ACPICA enhancement - the new API acpi_update_interfaces().
      
      The _OSI object provides the platform with the ability to query OSPM
      to determine the set of ACPI related interfaces, behaviors, or
      features that the operating system supports.  The argument passed to
      the _OSI is a string like the followings:
      1. Feature Group String, examples include
         Module Device
         Processor Device
         3.0 _SCP Extensions
         Processor Aggregator Device
         ...
      2. OS Vendor String, examples include
         Linux
         FreeBSD
         Windows
         ...
      
      There are AML codes provided in the ACPI namespace written in the
      following style to determine OSPM interfaces / features:
          Method(OSCK)
          {
              if (CondRefOf(_OSI, Local0))
              {
                  if (\_OSI("Windows"))
                  {
                      Return (One)
                  }
                  if (\_OSI("Windows 2006"))
                  {
                      Return (Ones)
                  }
                  Return (Zero)
              }
              Return (Zero)
          }
      
      There is a debugging facility implemented in Linux.  Users can pass
      "acpi_osi=" boot parameters to the kernel to tune the _OSI evaluation
      result so that certain AML codes can be executed.  Current
      implementation includes:
      1. 'acpi_osi=' - this makes CondRefOf(_OSI, Local0) TRUE
      2. 'acpi_osi="Windows"' - this makes \_OSI("Windows") TRUE
      3. 'acpi_osi="!Windows"' - this makes \_OSI("Windows") FALSE
      The function to implement this feature is also used as a quirk mechanism
      in the Linux ACPI subystem.
      
      When _OSI is evaluatated by the AML codes, ACPICA replies "SUPPORTED"
      to all Windows operating system vendor strings.  This is because
      Windows operating systems return "SUPPORTED" if the argument to the
      _OSI method specifies an earlier version of Windows.  Please refer to
      the following MSDN document:
      
      How to Identify the Windows Version in ACPI by Using _OSI
      http://msdn.microsoft.com/en-us/library/hardware/gg463275.aspx
      
      This adds difficulties when developers want to feed specific Windows
      operating system vendor string to the BIOS codes for debugging
      purpose, multiple acpi_osi="!xxx" have to be specified in the command
      line to force Linux replying "UNSUPPORTED" to the Windows OS vendor
      strings listed in the AML codes.
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Reviewed-by: NZhang Rui <rui.zhang@intel.com>
      Acked-by: NLen Brown <len.brown@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      5dc17986
  28. 28 6月, 2013 1 次提交
    • M
      ACPI: implement acpi_os_get_timer() according the spec · 10619066
      Mika Westerberg 提交于
      ACPI Timer() opcode should return monotonically increasing clock with 100ns
      granularity according the ACPI 5.0 spec.
      
      Testing the current Timer() implementation with following ASL code (and an
      additional debug print in acpi_os_sleep() to get the sleep times dumped out
      to dmesg):
      
      	// Test: 10ms
      	Store(Timer, Local1)
      	Sleep(10)
      	Divide(Subtract(Timer, Local1), 10000,, Local1)
      	Sleep(Local1)
      
      	// Test: 200ms
      	Store(Timer, Local1)
      	Sleep(200)
      	Divide(Subtract(Timer, Local1), 10000,, Local1)
      	Sleep(Local1)
      
      	// Test 1300ms
      	Store(Timer, Local1)
      	Sleep(1300)
      	Divide(Subtract(Timer, Local1), 10000,, Local1)
      	Sleep(Local1)
      
      The second sleep value is calculated using Timer(). If the implementation
      is good enough we should be able to get the second value pretty close to
      the first.
      
      However, the current Timer() gives pretty bad sleep times:
      
      	[   11.488100] ACPI: acpi_os_get_timer() TBD
      	[   11.492150] ACPI: Sleep(10)
      	[   11.502993] ACPI: Sleep(0)
      	[   11.506315] ACPI: Sleep(200)
      	[   11.706237] ACPI: Sleep(0)
      	[   11.709550] ACPI: Sleep(1300)
      	[   13.008929] ACPI: Sleep(0)
      
      Fix this with the help of ktime_get(). Once the fix is applied and run
      against the same ASL code we get:
      
      	[   11.486786] ACPI: Sleep(10)
      	[   11.499029] ACPI: Sleep(12)
      	[   11.512350] ACPI: Sleep(200)
      	[   11.712282] ACPI: Sleep(200)
      	[   11.912170] ACPI: Sleep(1300)
      	[   13.211577] ACPI: Sleep(1300)
      
      That is much more closer to the values we expected.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      10619066
  29. 16 6月, 2013 1 次提交
  30. 24 4月, 2013 1 次提交
  31. 25 3月, 2013 1 次提交
  32. 10 2月, 2013 1 次提交
  33. 31 1月, 2013 1 次提交
    • M
      efi: Make 'efi_enabled' a function to query EFI facilities · 83e68189
      Matt Fleming 提交于
      Originally 'efi_enabled' indicated whether a kernel was booted from
      EFI firmware. Over time its semantics have changed, and it now
      indicates whether or not we are booted on an EFI machine with
      bit-native firmware, e.g. 64-bit kernel with 64-bit firmware.
      
      The immediate motivation for this patch is the bug report at,
      
          https://bugs.launchpad.net/ubuntu-cdimage/+bug/1040557
      
      which details how running a platform driver on an EFI machine that is
      designed to run under BIOS can cause the machine to become
      bricked. Also, the following report,
      
          https://bugzilla.kernel.org/show_bug.cgi?id=47121
      
      details how running said driver can also cause Machine Check
      Exceptions. Drivers need a new means of detecting whether they're
      running on an EFI machine, as sadly the expression,
      
          if (!efi_enabled)
      
      hasn't been a sufficient condition for quite some time.
      
      Users actually want to query 'efi_enabled' for different reasons -
      what they really want access to is the list of available EFI
      facilities.
      
      For instance, the x86 reboot code needs to know whether it can invoke
      the ResetSystem() function provided by the EFI runtime services, while
      the ACPI OSL code wants to know whether the EFI config tables were
      mapped successfully. There are also checks in some of the platform
      driver code to simply see if they're running on an EFI machine (which
      would make it a bad idea to do BIOS-y things).
      
      This patch is a prereq for the samsung-laptop fix patch.
      
      Cc: David Airlie <airlied@linux.ie>
      Cc: Corentin Chary <corentincj@iksaif.net>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Dave Jiang <dave.jiang@intel.com>
      Cc: Olof Johansson <olof@lixom.net>
      Cc: Peter Jones <pjones@redhat.com>
      Cc: Colin Ian King <colin.king@canonical.com>
      Cc: Steve Langasek <steve.langasek@canonical.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Konrad Rzeszutek Wilk <konrad@kernel.org>
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
      Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
      83e68189