1. 29 7月, 2020 1 次提交
    • D
      nvme-pci: add support for ACPI StorageD3Enable property · df4f9bc4
      David E. Box 提交于
      This patch implements a solution for a BIOS hack used on some currently
      shipping Intel systems to change driver power management policy for PCIe
      NVMe drives. Some newer Intel platforms, like some Comet Lake systems,
      require that PCIe devices use D3 when doing suspend-to-idle in order to
      allow the platform to realize maximum power savings. This is particularly
      needed to support ATX power supply shutdown on desktop systems. In order to
      ensure this happens for root ports with storage devices, Microsoft
      apparently created this ACPI _DSD property as a way to influence their
      driver policy. To my knowledge this property has not been discussed with
      the NVME specification body.
      
      Though the solution is not ideal, it addresses a problem that also affects
      Linux since the NVMe driver's default policy of using NVMe APST during
      suspend-to-idle prevents the PCI root port from going to D3 and leads to
      higher power consumption for these platforms. The power consumption
      difference may be negligible on laptop systems, but many watts on desktop
      systems when the ATX power supply is blocked from powering down.
      
      The patch creates a new nvme_acpi_storage_d3 function to check for the
      StorageD3Enable property during probe and enables D3 as a quirk if set.  It
      also provides a 'noacpi' module parameter to allow skipping the quirk if
      needed.
      
      Tested with:
       - PM961 NVMe SED Samsung 512GB
       - INTEL SSDPEKKF512G8
      
      Link: https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/power-management-for-storage-hardware-devices-introSigned-off-by: NDavid E. Box <david.e.box@linux.intel.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      df4f9bc4
  2. 22 6月, 2020 1 次提交
  3. 11 10月, 2019 2 次提交
  4. 03 9月, 2019 1 次提交
  5. 26 8月, 2019 1 次提交
  6. 19 6月, 2019 1 次提交
  7. 03 6月, 2019 1 次提交
  8. 01 5月, 2019 1 次提交
    • P
      ACPI / property: fix handling of data_nodes in acpi_get_next_subnode() · 23583f77
      Pierre-Louis Bossart 提交于
      When the DSDT tables expose devices with subdevices and a set of
      hierarchical _DSD properties, the data returned by
      acpi_get_next_subnode() is incorrect, with the results suggesting a bad
      pointer assignment. The parser works fine with device_nodes or
      data_nodes, but not with a combination of the two.
      
      The problem is traced to an invalid pointer used when jumping from
      handling device_nodes to data nodes. The existing code looks for data
      nodes below the last subdevice found instead of the common root. Fix
      by forcing the acpi_device pointer to be derived from the same fwnode
      for the two types of subnodes.
      
      This same problem of handling device and data nodes was already fixed
      in a similar way by 'commit bf4703fd ("ACPI / property: fix data
      node parsing in acpi_get_next_subnode()")' but broken later by 'commit
      34055190 ("ACPI / property: Add fwnode_get_next_child_node()")', so
      this should probably go to linux-stable all the way to 4.12
      Signed-off-by: NPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Reviewed-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      23583f77
  9. 17 4月, 2019 1 次提交
  10. 05 12月, 2018 1 次提交
  11. 03 10月, 2018 2 次提交
  12. 23 7月, 2018 5 次提交
  13. 12 2月, 2018 2 次提交
  14. 13 12月, 2017 1 次提交
  15. 12 10月, 2017 2 次提交
  16. 20 9月, 2017 2 次提交
    • S
      ACPI: properties: Return _DSD hierarchical extension (data) sub-nodes correctly · 0c0bceb7
      Sakari Ailus 提交于
      The recently merged patch "ACPI: Prepare for constifying
      acpi_get_next_subnode() fwnode argument" was part of a patchset
      constifying the fwnode arguments across the fwnode property API. The
      purpose of the patch was to allow returning non-const fwnodes from a data
      structure the root of which is const.
      
      Unfortunately the patch introduced the functionality, in particular when
      starting parsed from an ACPI device node, the hierarchical data extension
      nodes would not be enumerated.
      
      Restore the old behaviour while still retaining constness properties of
      the patch.
      
      Fixes: 01c1da28 "ACPI: Prepare for constifying acpi_get_next_subnode() fwnode argument"
      Signed-off-by: NSakari Ailus <sakari.ailus@linux.intel.com>
      Acked-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      0c0bceb7
    • J
      ACPI / bus: Make ACPI_HANDLE() work for non-GPL code again · 9e987b70
      John Hubbard 提交于
      Due to commit db3e50f3 (device property: Get rid of struct
      fwnode_handle type field), ACPI_HANDLE() inadvertently became
      a GPL-only call. The call path that led to that was:
      
      ACPI_HANDLE()
          ACPI_COMPANION()
              to_acpi_device_node()
                  is_acpi_device_node()
                      acpi_device_fwnode_ops
                          DECLARE_ACPI_FWNODE_OPS(acpi_device_fwnode_ops);
      
      ...and the new DECLARE_ACPI_FWNODE_OPS() includes
      EXPORT_SYMBOL_GPL, whereas previously it was a static struct.
      
      In order to avoid changing any of that, let's instead provide ever
      so slightly better encapsulation of those struct fwnode_operations
      instances. Those do not really need to be directly used in
      inline function calls in header files. Simply moving two small
      functions (is_acpi_device_node and is_acpi_data_node) out of
      acpi_bus.h, and into a .c file, does that.
      
      That leaves the internals of struct fwnode_operations as GPL-only
      (which I think was the intent all along), but un-breaks any driver
      code out there that relies on the ACPI subsystem's being (historically)
      an EXPORT_SYMBOL-usable system. By that, I mean, ACPI_HANDLE() and
      other basic ACPI calls were non-GPL-protected.
      
      Also, while I'm there, remove a tiny bit of redundancy that was missed
      in the earlier commit, by having is_acpi_node() use the other two
      routines, instead of checking fwnode directly.
      
      Fixes: db3e50f3 (device property: Get rid of struct fwnode_handle type field)
      Signed-off-by: NJohn Hubbard <jhubbard@nvidia.com>
      Acked-by: NSakari Ailus <sakari.ailus@linux.intel.com>
      Acked-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      9e987b70
  17. 23 8月, 2017 1 次提交
  18. 04 8月, 2017 2 次提交
    • 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
    • L
      ACPI / property: Don't evaluate objects for devices w/o handle · 75fc70e0
      Lukas Wunner 提交于
      Fabricated devices such as LNXPWRBN lack a handle, causing evaluation
      of _CCA and _DSD to always fail with AE_BAD_PARAMETER.  While that is
      merely a (negligible) waste of processing power, evaluating a _DSM for
      them (such as Apple's device properties _DSM which we're about to add)
      results in an ugly error:
      
          ACPI: \: failed to evaluate _DSM (0x1001)
      
      Avoid by not evaluating _DSD and the upcoming _DSM for devices without
      handle.
      Acked-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      75fc70e0
  19. 26 7月, 2017 1 次提交
  20. 22 7月, 2017 5 次提交
  21. 22 6月, 2017 3 次提交
  22. 29 3月, 2017 3 次提交