1. 09 4月, 2021 2 次提交
  2. 24 3月, 2021 1 次提交
  3. 23 3月, 2021 1 次提交
  4. 12 1月, 2021 1 次提交
    • D
      ACPI: scan: Harden acpi_device_add() against device ID overflows · a58015d6
      Dexuan Cui 提交于
      Linux VM on Hyper-V crashes with the latest mainline:
      
      [    4.069624] detected buffer overflow in strcpy
      [    4.077733] kernel BUG at lib/string.c:1149!
      ..
      [    4.085819] RIP: 0010:fortify_panic+0xf/0x11
      ...
      [    4.085819] Call Trace:
      [    4.085819]  acpi_device_add.cold.15+0xf2/0xfb
      [    4.085819]  acpi_add_single_object+0x2a6/0x690
      [    4.085819]  acpi_bus_check_add+0xc6/0x280
      [    4.085819]  acpi_ns_walk_namespace+0xda/0x1aa
      [    4.085819]  acpi_walk_namespace+0x9a/0xc2
      [    4.085819]  acpi_bus_scan+0x78/0x90
      [    4.085819]  acpi_scan_init+0xfa/0x248
      [    4.085819]  acpi_init+0x2c1/0x321
      [    4.085819]  do_one_initcall+0x44/0x1d0
      [    4.085819]  kernel_init_freeable+0x1ab/0x1f4
      
      This is because of the recent buffer overflow detection in the
      commit 6a39e62a ("lib: string.h: detect intra-object overflow in
      fortified string functions")
      
      Here acpi_device_bus_id->bus_id can only hold 14 characters, while the
      the acpi_device_hid(device) returns a 22-char string
      "HYPER_V_GEN_COUNTER_V1".
      
      Per ACPI Spec v6.2, Section 6.1.5 _HID (Hardware ID), if the ID is a
      string, it must be of the form AAA#### or NNNN####, i.e. 7 chars or 8
      chars.
      
      The field bus_id in struct acpi_device_bus_id was originally defined as
      char bus_id[9], and later was enlarged to char bus_id[15] in 2007 in the
      commit bb095854 ("ACPI: use more understandable bus_id for ACPI
      devices")
      
      Fix the issue by changing the field bus_id to const char *, and use
      kstrdup_const() to initialize it.
      Signed-off-by: NDexuan Cui <decui@microsoft.com>
      Tested-By: NJethro Beekman <jethro@fortanix.com>
      [ rjw: Subject change, whitespace adjustment ]
      Cc: All applicable <stable@vger.kernel.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a58015d6
  5. 02 12月, 2020 1 次提交
  6. 10 11月, 2020 1 次提交
  7. 11 5月, 2020 1 次提交
  8. 25 3月, 2020 1 次提交
  9. 14 3月, 2020 1 次提交
    • R
      ACPI: EC: Simplify acpi_ec_ecdt_start() and acpi_ec_init() · 98ada3c5
      Rafael J. Wysocki 提交于
      Notice that the return value of acpi_ec_init() is discarded anyway,
      so it can be void and it doesn't need to check the return values of
      acpi_bus_register_driver() and acpi_ec_ecdt_start() called by it.
      Thus the latter can be void too and it really has nothing to do
      if acpi_ec_add() has already found an EC matching the boot one in the
      namespace.  Also, acpi_ec_ecdt_get_handle() can be folded into it.
      
      Modify the code accordingly and while at it create a propoer kerneldoc
      comment to document acpi_ec_ecdt_start() and move the remark regarding
      ASUS X550ZE along with the related bug URL from acpi_ec_init() into
      that comment.
      
      Additionally, fix up a stale comment in acpi_ec_init().
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      98ada3c5
  10. 28 10月, 2019 1 次提交
    • D
      ACPI: EC: add support for hardware-reduced systems · 406857f7
      Daniel Drake 提交于
      As defined in the ACPI spec section 12.11, ACPI hardware-reduced
      platforms define the EC SCI interrupt as a GpioInt in the _CRS object.
      
      This replaces the previous way of using a GPE for this interrupt;
      GPE blocks are not available on reduced hardware platforms.
      
      Add support for handling this interrupt as an EC event source, and
      avoid GPE usage on reduced hardware platforms.
      
      This enables the use of several media keys (e.g. screen brightness
      up/down) on Asus UX434DA.
      Signed-off-by: NDaniel Drake <drake@endlessm.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      406857f7
  11. 08 8月, 2019 2 次提交
  12. 30 7月, 2019 1 次提交
    • R
      ACPI: PM: Set up EC GPE for system wakeup from drivers that need it · 10a08fd6
      Rafael J. Wysocki 提交于
      The EC GPE needs to be set up for system wakeup only if there is a
      driver depending on it, either intel-hid or intel-vbtn, bound to a
      button device that is expected to wake up the system from sleep (such
      as the power button on some Dell systems, like the XPS13 9360).  It
      doesn't need to be set up for waking up the system from sleep in any
      other cases and whether or not it is expected to wake up the system
      from sleep doesn't depend on whether or not the LPS0 device is
      present in the ACPI namespace.
      
      For this reason, rearrange the ACPI suspend-to-idle code to make the
      drivers depending on the EC GPE wakeup take care of setting it up and
      decouple that from the LPS0 device handling.
      
      While at it, make intel-hid and intel-vbtn prepare for system wakeup
      only if they are allowed to wake up the system from sleep by user
      space (via sysfs).
      
      [Note that acpi_ec_mark_gpe_for_wake() and acpi_ec_set_gpe_wake_mask()
       are there to prevent the EC GPE from being disabled by the
       acpi_enable_all_wakeup_gpes() call in acpi_s2idle_prepare(), so on
       systems with either intel-hid or intel-vbtn this change doesn't
       affect any interactions with the hardware or platform firmware.]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NAndy Shevchenko <andy.shevchenko@gmail.com>
      10a08fd6
  13. 23 7月, 2019 1 次提交
    • R
      ACPI: EC: Return bool from acpi_ec_dispatch_gpe() · 9089f16e
      Rafael J. Wysocki 提交于
      On some systems, if suspend-to-idle is used, the EC may signal system
      wakeup events (power button events, for example) as well as events
      that should not cause the system to resume and acpi_ec_dispatch_gpe()
      needs to be called to determine whether or not the system should
      resume then.  In particular, if acpi_ec_dispatch_gpe() doesn't detect
      any EC events at all, the system should remain suspended, so it is
      useful to know when that is the case.
      
      For this reason, make acpi_ec_dispatch_gpe() return a bool value
      indicating whether or not any EC events have been detected by it.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      9089f16e
  14. 04 7月, 2019 1 次提交
  15. 05 6月, 2019 1 次提交
  16. 29 1月, 2019 1 次提交
    • R
      ACPI: EC: Clean up probing for early EC · fdb3c177
      Rafael J. Wysocki 提交于
      Both acpi_ec_dsdt_probe() and acpi_ec_ecdt_probe() may be void as
      their return values are ignored anyway.  This allows a couple of
      gotos and labels to go away from there.
      
      Moreover, acpi_ec_ecdt_probe() only needs to allocate the ec
      object after getting the ECDT pointer and checking it, so the
      pointless memory allocation and release on systems without the
      ECDT can be avoided by reordering it.
      
      No intentional functional impact.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      fdb3c177
  17. 16 1月, 2019 1 次提交
  18. 20 12月, 2018 1 次提交
  19. 18 12月, 2018 1 次提交
  20. 27 11月, 2018 1 次提交
  21. 25 5月, 2018 1 次提交
    • R
      ACPI: EC: Dispatch the EC GPE directly on s2idle wake · 68e22011
      Rafael J. Wysocki 提交于
      On platforms where the Low Power S0 Idle _DSM interface is used,
      on wakeup from suspend-to-idle, when it is known that the ACPI SCI
      has triggered while suspended, dispatch the EC GPE in order to catch
      all EC events that may have triggered the wakeup before carrying out
      the noirq phase of device resume.
      
      That is needed to handle power button wakeup on some platforms where
      the EC goes into a low-power mode during suspend-to-idle and while in
      that mode it will discard events after a timeout.  If that timeout is
      shorter than the time it takes to complete the noirq resume of
      devices, looking for EC events after the latter is too late.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reported-by: NZhang Rui <rui.zhang@intel.com>
      Tested-by: NWendy Wang <wendy.wang@intel.com>
      68e22011
  22. 04 1月, 2018 1 次提交
  23. 21 11月, 2017 1 次提交
    • L
      ACPI / EC: Fix regression related to PM ops support in ECDT device · a64a62ce
      Lv Zheng 提交于
      On platforms (ASUS X550ZE and possibly all ASUS X series) with valid ECDT
      EC but invalid DSDT EC, EC PM ops won't be invoked as ECDT EC is not an
      ACPI device. Thus the following commit actually removed post-resume
      acpi_ec_enable_event() invocation for such platforms, and triggered a
      regression on them that after being resumed, EC (actually should be ECDT)
      driver stops handling EC events:
      
       Commit: c2b46d67
       Subject: ACPI / EC: Add PM operations to improve event handling for resume process
      
      Notice that the root cause actually is "ECDT is not an ACPI device" rather
      than "the timing of acpi_ec_enable_event() invocation", this patch fixes
      this issue by enumerating ECDT EC as an ACPI device. Due to the existence
      of the noirq stage, the ability of tuning the timing of
      acpi_ec_enable_event() invocation is still meaningful.
      
      This patch is a little bit different from the posted fix by moving
      acpi_config_boot_ec() from acpi_ec_ecdt_start() to acpi_ec_add() to make
      sure that EC event handling won't be stopped as long as the ACPI EC driver
      is bound. Thus the following sequence shouldn't disable EC event handling:
      unbind,suspend,resume,bind.
      
      Fixes: c2b46d67 (ACPI / EC: Add PM operations to improve event handling for resume process)
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=196847Reported-by: NLuya Tshimbalanga <luya@fedoraproject.org>
      Tested-by: NLuya Tshimbalanga <luya@fedoraproject.org>
      Cc: 4.9+ <stable@vger.kernel.org> # 4.9+
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a64a62ce
  24. 11 10月, 2017 1 次提交
    • S
      ACPI / LPIT: Add Low Power Idle Table (LPIT) support · eeb2d80d
      Srinivas Pandruvada 提交于
      Add functionality to read LPIT table, which provides:
      
       - Sysfs interface to read residency counters via
         /sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us
         /sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us
      
      Here the count "low_power_idle_cpu_residency_us" shows the time spent
      by CPU package in low power state.  This is read via MSR interface,
      which points to MSR for PKG C10.
      
      Here the count "low_power_idle_system_residency_us" show the count the
      system was in low power state. This is read via MMIO interface. This
      is mapped to SLP_S0 residency on modern Intel systems. This residency
      is achieved only when CPU is in PKG C10 and all functional blocks are
      in low power state.
      
      It is possible that none of the above counters present or anyone of the
      counter present or all counters present.
      
      For example: On my Kabylake system both of the above counters present.
      After suspend to idle these counts updated and prints:
      
       6916179
       6998564
      
      This counter can be read by tools like turbostat to display. Or it can
      be used to debug, if modern systems are reaching desired low power state.
      
       - Provides an interface to read residency counter memory address
      
         This address can be used to get the base address of PMC memory
         mapped IO.  This is utilized by intel_pmc_core driver to print
         more debug information.
      
      In addition, to avoid code duplication to read iomem, removed the read of
      iomem from acpi_os_read_memory() in osl.c and made a common function
      acpi_os_read_iomem(). This new function is used for reading iomem in
      in both osl.c and acpi_lpit.c.
      
      Link: http://www.uefi.org/sites/default/files/resources/Intel_ACPI_Low_Power_S0_Idle.pdfSigned-off-by: NSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      eeb2d80d
  25. 18 8月, 2017 1 次提交
  26. 04 8月, 2017 1 次提交
    • L
      ACPI / property: Support Apple _DSM properties · 899596e0
      Lukas Wunner 提交于
      While the rest of the world has standardized on _DSD as the way to store
      device properties in AML (introduced with ACPI 5.1 in 2014), Apple has
      been using a custom _DSM to achieve the same for much longer (ever since
      they switched from DeviceTree-based PowerPC to Intel in 2005, verified
      with MacOS X 10.4.11).
      
      The theory of operation on macOS is as follows:  AppleACPIPlatform.kext
      invokes mergeEFIproperties() and mergeDSMproperties() for each device to
      merge properties conveyed by EFI drivers as well as properties stored in
      AML into the I/O Kit registry from which they can be retrieved by
      drivers.  We've been supporting EFI properties since commit 58c5475a
      ("x86/efi: Retrieve and assign Apple device properties").  The present
      commit adds support for _DSM properties, thereby completing our support
      for Apple device properties.  The _DSM properties are made available
      under the primary fwnode, the EFI properties under the secondary fwnode.
      So for devices which possess both property types, they can all be
      elegantly accessed with the uniform API in <linux/property.h>.
      
      Until recently we had no need to support _DSM properties, they contained
      only uninteresting garbage.  The situation has changed with MacBooks and
      MacBook Pros introduced since 2015:  Their keyboard is attached with SPI
      instead of USB and the _CRS data which is necessary to initialize the
      spi driver only contains valid information if OSPM responds "false" to
      _OSI("Darwin").  If OSPM responds "true", _CRS is empty and the spi
      driver fails to initialize.  The rationale is very simple, Apple only
      cares about macOS and Windows:  On Windows, _CRS contains valid data,
      whereas on macOS it is empty.  Instead, macOS gleans the necessary data
      from the _DSM properties.
      
      Since Linux deliberately defaults to responding "true" to _OSI("Darwin"),
      we need to emulate macOS' behaviour by initializing the spi driver with
      data returned by the _DSM.
      
      An out-of-tree driver for the SPI keyboard exists which currently binds
      to the ACPI device, invokes the _DSM, parses the returned package and
      instantiates an SPI device with the data gleaned from the _DSM:
      https://github.com/cb22/macbook12-spi-driver/commit/9a416d699ef4
      https://github.com/cb22/macbook12-spi-driver/commit/0c34936ed9a1
      
      By adding support for Apple's _DSM properties in generic ACPI code, the
      out-of-tree driver will be able to register as a regular SPI driver,
      significantly reducing its amount of code and improving its chances to
      be mainlined.
      
      The SPI keyboard will not be the only user of this commit:  E.g. on the
      MacBook8,1, the UART-attached Bluetooth device likewise returns empty
      _CRS data if OSPM returns "true" to _OSI("Darwin").
      
      The _DSM returns a Package whose format unfortunately deviates slightly
      from the _DSD spec:  The properties are marshalled up in a single Package
      as alternating key/value elements, unlike _DSD which stores them as a
      Package of 2-element Packages.  The present commit therefore converts
      the Package to _DSD format and the ACPI core can then treat the data as
      if Apple would follow the standard.
      
      Well, except for one small annoyance:  The properties returned by the
      _DSM only ever have one of two types, Integer or Buffer.  The former is
      retrievable as usual with device_property_read_u64(), but the latter is
      not part of the _DSD spec and it is not possible to retrieve Buffer
      properties with the device_property_read_*() functions due to the type
      checking performed in drivers/acpi/property.c.  It is however possible
      to retrieve them with acpi_dev_get_property().  Apple is using the
      Buffer type somewhat sloppily to store null-terminated strings but also
      integers.  The real data type is not distinguishable by the ACPI core
      and the onus is on the caller to use the contents of the Buffer in an
      appropriate way.
      
      In case Apple moves to _DSD in the future, this commit first checks for
      _DSD and falls back to _DSM only if _DSD is not found.
      Tested-by: NRonald Tschalär <ronald@innovation.ch>
      Acked-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      899596e0
  27. 20 7月, 2017 1 次提交
    • R
      ACPI / PM / EC: Flush all EC work in acpi_freeze_sync() · 880a6627
      Rafael J. Wysocki 提交于
      Commit eed4d47e (ACPI / sleep: Ignore spurious SCI wakeups from
      suspend-to-idle) introduced acpi_freeze_sync() whose purpose is to
      flush all of the processing of possible wakeup events signaled via
      the ACPI SCI.  However, it doesn't flush the query workqueue used
      by the EC driver, so the events generated by the EC may not be
      processed timely which leads to issues (increased overhead at least,
      lost events possibly).
      
      To fix that introduce acpi_ec_flush_work() that will flush all of
      the outstanding EC work and call it from acpi_freeze_sync().
      
      Fixes: eed4d47e (ACPI / sleep: Ignore spurious SCI wakeups from suspend-to-idle)
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      880a6627
  28. 23 6月, 2017 1 次提交
    • R
      ACPI / sleep: EC-based wakeup from suspend-to-idle on recent systems · 8110dd28
      Rafael J. Wysocki 提交于
      Some recent Dell laptops, including the XPS13 model numbers 9360 and
      9365, cannot be woken up from suspend-to-idle by pressing the power
      button which is unexpected and makes that feature less usable on
      those systems.  Moreover, on the 9365 ACPI S3 (suspend-to-RAM) is
      not expected to be used at all (the OS these systems ship with never
      exercises the ACPI S3 path in the firmware) and suspend-to-idle is
      the only viable system suspend mechanism there.
      
      The reason why the power button wakeup from suspend-to-idle doesn't
      work on those systems is because their power button events are
      signaled by the EC (Embedded Controller), whose GPE (General Purpose
      Event) line is disabled during suspend-to-idle transitions in Linux.
      That is done on purpose, because in general the EC tends to be noisy
      for various reasons (battery and thermal updates and similar, for
      example) and all events signaled by it would kick the CPUs out of
      deep idle states while in suspend-to-idle, which effectively might
      defeat its purpose.
      
      Of course, on the Dell systems in question the EC GPE must be enabled
      during suspend-to-idle transitions for the button press events to
      be signaled while suspended at all, but fortunately there is a way
      out of this puzzle.
      
      First of all, those systems have the ACPI_FADT_LOW_POWER_S0 flag set
      in their ACPI tables, which means that the OS is expected to prefer
      the "low power S0 idle" system state over ACPI S3 on them.  That
      causes the most recent versions of other OSes to simply ignore ACPI
      S3 on those systems, so it is reasonable to expect that it should not
      be necessary to block GPEs during suspend-to-idle on them.
      
      Second, in addition to that, the systems in question provide a special
      firmware interface that can be used to indicate to the platform that
      the OS is transitioning into a system-wide low-power state in which
      certain types of activity are not desirable or that it is leaving
      such a state and that (in principle) should allow the platform to
      adjust its operation mode accordingly.
      
      That interface is a special _DSM object under a System Power
      Management Controller device (PNP0D80).  The expected way to use it
      is to invoke function 0 from it on system initialization, functions
      3 and 5 during suspend transitions and functions 4 and 6 during
      resume transitions (to reverse the actions carried out by the
      former).  In particular, function 5 from the "Low-Power S0" device
      _DSM is expected to cause the platform to put itself into a low-power
      operation mode which should include making the EC less verbose (so to
      speak).  Next, on resume, function 6 switches the platform back to
      the "working-state" operation mode.
      
      In accordance with the above, modify the ACPI suspend-to-idle code
      to look for the "Low-Power S0" _DSM interface on platforms with the
      ACPI_FADT_LOW_POWER_S0 flag set in the ACPI tables.  If it's there,
      use it during suspend-to-idle transitions as prescribed and avoid
      changing the GPE configuration in that case.  [That should reflect
      what the most recent versions of other OSes do.]
      
      Also modify the ACPI EC driver to make it handle events during
      suspend-to-idle in the usual way if the "Low-Power S0" _DSM interface
      is going to be used to make the power button events work while
      suspended on the Dell machines mentioned above
      
      Link: http://www.uefi.org/sites/default/files/resources/Intel_ACPI_Low_Power_S0_Idle.pdfSigned-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      8110dd28
  29. 22 6月, 2017 1 次提交
  30. 15 6月, 2017 1 次提交
    • R
      ACPI / PM: Ignore spurious SCI wakeups from suspend-to-idle · 33e4f80e
      Rafael J. Wysocki 提交于
      The ACPI SCI (System Control Interrupt) is set up as a wakeup IRQ
      during suspend-to-idle transitions and, consequently, any events
      signaled through it wake up the system from that state.  However,
      on some systems some of the events signaled via the ACPI SCI while
      suspended to idle should not cause the system to wake up.  In fact,
      quite often they should just be discarded.
      
      Arguably, systems should not resume entirely on such events, but in
      order to decide which events really should cause the system to resume
      and which are spurious, it is necessary to resume up to the point
      when ACPI SCIs are actually handled and processed, which is after
      executing dpm_resume_noirq() in the system resume path.
      
      For this reasons, add a loop around freeze_enter() in which the
      platforms can process events signaled via multiplexed IRQ lines
      like the ACPI SCI and add suspend-to-idle hooks that can be
      used for this purpose to struct platform_freeze_ops.
      
      In the ACPI case, the ->wake hook is used for checking if the SCI
      has triggered while suspended and deferring the interrupt-induced
      system wakeup until the events signaled through it are actually
      processed sufficiently to decide whether or not the system should
      resume.  In turn, the ->sync hook allows all of the relevant event
      queues to be flushed so as to prevent events from being missed due
      to race conditions.
      
      In addition to that, some ACPI code processing wakeup events needs
      to be modified to use the "hard" version of wakeup triggers, so that
      it will cause a system resume to happen on device-induced wakeup
      events even if the "soft" mechanism to prevent the system from
      suspending is not enabled.  However, to preserve the existing
      behavior with respect to suspend-to-RAM, this only is done in
      the suspend-to-idle case and only if an SCI has occurred while
      suspended.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      33e4f80e
  31. 13 4月, 2017 1 次提交
    • M
      ACPI / scan: Drop support for force_remove · ffc10d82
      Michal Hocko 提交于
      /sys/firmware/acpi/hotplug/force_remove was presumably added to support
      auto offlining in the past. This is, however, inherently dangerous for
      some hotplugable resources like memory. The memory offlining fails when
      the memory is still in use and cannot be dropped or migrated. If we
      ignore the failure we are basically allowing for subtle memory
      corruption or a crash.
      
      We have actually noticed the later while hitting BUG() during the memory
      hotremove (remove_memory):
      	ret = walk_memory_range(PFN_DOWN(start), PFN_UP(start + size - 1), NULL,
      			check_memblock_offlined_cb);
      	if (ret)
      		BUG();
      
      it took us quite non-trivial time realize that the customer had
      force_remove enabled. Even if the BUG was removed here and we could
      propagate the error up the call chain it wouldn't help at all because
      then we would hit a crash or a memory corruption later and harder to
      debug. So force_remove is unfixable for the memory hotremove. We haven't
      checked other hotplugable resources to be prone to a similar problems.
      
      Remove the force_remove functionality because it is not fixable currently.
      Keep the sysfs file and report an error if somebody tries to enable it.
      Encourage users to report about the missing functionality and work with
      them with an alternative solution.
      Reviewed-by: NLee, Chun-Yi <jlee@suse.com>
      Signed-off-by: NMichal Hocko <mhocko@suse.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ffc10d82
  32. 01 3月, 2017 1 次提交
    • R
      x86/ioapic: Split IOAPIC hot-removal into two steps · f2ae5da7
      Rui Wang 提交于
      The hot removal of IOAPIC is handling PCI and ACPI removal in one go. That
      only works when the PCI drivers released the interrupt resources, but
      breaks when a IOAPIC interrupt is still associated to a PCI device.
      
      The new pcibios_release_device() callback allows to solve that problem by
      splitting the removal into two steps:
      
      1) PCI removal:
      
         Release all PCI resources including eventually not yet released IOAPIC
         interrupts via the new pcibios_release_device() callback.
      
      2) ACPI removal:
      
         After release of all PCI resources the ACPI resources can be released
         without issue.
      
      [ tglx: Rewrote changelog ]
      Signed-off-by: NRui Wang <rui.y.wang@intel.com>
      Cc: tony.luck@intel.com
      Cc: linux-pci@vger.kernel.org
      Cc: rjw@rjwysocki.net
      Cc: linux-acpi@vger.kernel.org
      Cc: fengguang.wu@intel.com
      Cc: helgaas@kernel.org
      Cc: kbuild-all@01.org
      Cc: bhelgaas@google.com
      Link: http://lkml.kernel.org/r/1488288869-31290-3-git-send-email-rui.y.wang@intel.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      f2ae5da7
  33. 30 1月, 2017 1 次提交
  34. 27 12月, 2016 1 次提交
  35. 24 9月, 2016 1 次提交
    • M
      ACPI / watchdog: Add support for WDAT hardware watchdog · 058dfc76
      Mika Westerberg 提交于
      Starting from Intel Skylake the iTCO watchdog timer registers were moved to
      reside in the same register space with SMBus host controller.  Not all
      needed registers are available though and we need to unhide P2SB (Primary
      to Sideband) device briefly to be able to read status of required NO_REBOOT
      bit. The i2c-i801.c SMBus driver used to handle this and creation of the
      iTCO watchdog platform device.
      
      Windows, on the other hand, does not use the iTCO watchdog hardware
      directly even if it is available. Instead it relies on ACPI Watchdog Action
      Table (WDAT) table to describe the watchdog hardware to the OS. This table
      contains necessary information about the the hardware and also set of
      actions which are executed by a driver as needed.
      
      This patch implements a new watchdog driver that takes advantage of the
      ACPI WDAT table. We split the functionality into two parts: first part
      enumerates the WDAT table and if found, populates resources and creates
      platform device for the actual driver. The second part is the driver
      itself.
      
      The reason for the split is that this way we can make the driver itself to
      be a module and loaded automatically if the WDAT table is found. Otherwise
      the module is not loaded.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      058dfc76
  36. 10 9月, 2016 1 次提交
  37. 31 8月, 2016 2 次提交
    • L
      ACPI / EC: Add PM operations to improve event handling for resume process · c2b46d67
      Lv Zheng 提交于
      This patch makes 2 changes:
      
      1. Restore old behavior
      Originally, EC driver stops handling both events and transactions in
      acpi_ec_block_transactions(), and restarts to handle transactions in
      acpi_ec_unblock_transactions_early(), restarts to handle both events and
      transactions in acpi_ec_unblock_transactions().
      While currently, EC driver still stops handling both events and
      transactions in acpi_ec_block_transactions(), but restarts to handle both
      events and transactions in acpi_ec_unblock_transactions_early().
      This patch tries to restore the old behavior by dropping
      __acpi_ec_enable_event() from acpi_unblock_transactions_early().
      
      2. Improve old behavior
      However this still cannot fix the real issue as both of the
      acpi_ec_unblock_xxx() functions are invoked in the noirq stage. Since the
      EC driver actually doesn't implement the event handling in the polling
      mode, re-enabling the event handling too early in the noirq stage could
      result in the problem that if there is no triggering source causing
      advance_transaction() to be invoked, pending SCI_EVT cannot be detected by
      the EC driver and _Qxx cannot be triggered.
      It actually makes sense to restart the event handling in any point during
      resuming after the noirq stage. Just like the boot stage where the event
      handling is enabled in .add(), this patch further moves
      acpi_ec_enable_event() to .resume(). After doing that, the following 2
      functions can be combined:
      acpi_ec_unblock_transactions_early()/acpi_ec_unblock_transactions().
      
      The differences of the event handling availability between the old behavior
      (this patch isn't applied) and the new behavior (this patch is applied) are
      as follows:
                              !Applied        Applied
      before suspend          Y               Y
      suspend before EC       Y               Y
      suspend after EC        Y               Y
      suspend_late            Y               Y
      suspend_noirq           Y (actually N)  Y (actually N)
      resume_noirq            Y (actually N)  Y (actually N)
      resume_late             Y (actually N)  Y (actually N)
      resume before EC        Y (actually N)  Y (actually N)
      resume after EC         Y (actually N)  Y
      after resume            Y (actually N)  Y
      Where "actually N" means if there is no triggering source, the EC driver
      is actually not able to notice the pending SCI_EVT occurred in the noirq
      stage. So we can clearly see that this patch has improved the situation.
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Tested-by: NTodd E Brandt <todd.e.brandt@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c2b46d67
    • L
      ACPI / bus: Make acpi_get_first_physical_node() public · daae45ca
      Lukas Wunner 提交于
      Following the fwnode of a device is currently a one-way road: We provide
      ACPI_COMPANION() to obtain the fwnode but there's no (public) method to
      do the reverse. Granted, there may be multiple physical_nodes, but often
      the first one in the list is sufficient.
      
      A handy function to obtain it was introduced with commit 3b95bd16
      ("ACPI: introduce a function to find the first physical device"), but
      currently it's only available internally.
      
      We're about to add an EFI Device Path parser which needs this function.
      Consider the following device path: ACPI(PNP0A03,0)/PCI(28,2)/PCI(0,0)
      The PCI root is encoded as an ACPI device in the path, so the parser
      has to find the corresponding ACPI device, then find its physical node,
      find the PCI bridge in slot 1c (decimal 28), function 2 below it and
      finally find the PCI device in slot 0, function 0.
      
      To this end, make acpi_get_first_physical_node() public.
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      daae45ca