1. 24 10月, 2017 1 次提交
  2. 17 10月, 2017 1 次提交
  3. 14 10月, 2017 1 次提交
  4. 11 10月, 2017 4 次提交
    • 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
    • U
      ACPI / PM: Split code validating need for runtime resume in ->prepare() · c2ebf788
      Ulf Hansson 提交于
      Move the code dealing with validation of whether runtime resuming the
      device is needed during system suspend.
      
      In this way it becomes more clear for what circumstances ACPI is prevented
      from trying the direct_complete path.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c2ebf788
    • U
      ACPI / PM: Restore acpi_subsys_complete() · e4da817d
      Ulf Hansson 提交于
      Commit 58a1fbbb (PM / PCI / ACPI: Kick devices that might have
      been reset by firmware), made PCI's and ACPI's ->complete() callbacks
      to be assigned to a new API called pm_complete_with_resume_check(),
      which was introduced in the same change.
      
      Later it turned out that using pm_complete_with_resume_check() wasn't
      good enough for PCI, as it needed additional PCI specific checks,
      before deciding whether runtime resuming the device is needed when
      running the ->complete() callback.
      
      This leaves ACPI as the only user of pm_complete_with_resume_check().
      Therefore let's restore ACPI's acpi_subsys_complete(), which was
      dropped in commit 58a1fbbb (PM / PCI / ACPI: Kick devices that
      might have been reset by firmware).
      
      This enables us to remove the pm_complete_with_resume_check() API in
      a following change, but it also enables ACPI to add more ACPI
      specific checks in acpi_subsys_complete() if that turns out to be
      necessary.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      e4da817d
    • R
      ACPI / PM: Combine two identical device resume routines · 63705c40
      Rafael J. Wysocki 提交于
      Notice that acpi_dev_runtime_resume() and acpi_dev_resume_early() are
      actually literally identical after some more-or-less recent changes,
      so rename acpi_dev_runtime_resume() to acpi_dev_resume(), use it
      everywhere instead of acpi_dev_resume_early() and drop the latter.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
      63705c40
  5. 05 10月, 2017 1 次提交
    • L
      ACPI/IORT: Fix PCI ACS enablement · 37f6b42e
      Lorenzo Pieralisi 提交于
      commit f6810c15 ("iommu/arm-smmu: Clean up early-probing
      workarounds") removed kernel code that was allowing to initialize
      and probe the SMMU devices early (ie earlier than PCI devices, through
      linker script callback entries) in the boot process because it was not
      needed any longer in that the SMMU devices/drivers now support deferred
      probing.
      
      Since the SMMUs probe routines are also in charge of requesting global
      PCI ACS kernel enablement, commit f6810c15 ("iommu/arm-smmu: Clean
      up early-probing workarounds") also postponed PCI ACS enablement to
      SMMUs devices probe time, which is too late given that PCI devices needs
      to detect if PCI ACS is enabled to init the respective capability
      through the following call path:
      
      pci_device_add()
       -> pci_init_capabilities()
        -> pci_enable_acs()
      
      Add code in the ACPI IORT SMMU platform devices initialization path
      (that is called before ACPI PCI enumeration) to detect if there
      exists firmware mappings to map root complexes ids to SMMU ids
      and if so enable ACS for the system.
      
      Fixes: f6810c15 ("iommu/arm-smmu: Clean up early-probing workarounds")
      Reviewed-by: NRobin Murphy <robin.murphy@arm.com>
      Tested-by: NNate Watterson <nwatters@codeaurora.org>
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Hanjun Guo <hanjun.guo@linaro.org>
      Cc: Sudeep Holla <sudeep.holla@arm.com>
      Cc: Zhou Wang <wangzhou1@hisilicon.com>
      Cc: Alex Williamson <alex.williamson@redhat.com>
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      37f6b42e
  6. 28 9月, 2017 1 次提交
  7. 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
  8. 19 9月, 2017 1 次提交
    • A
      ACPI / watchdog: properly initialize resources · 6ce14f64
      Arnd Bergmann 提交于
      We copy a local resource structure into a list, but only
      initialize some of its members, as pointed out by gcc-4.4:
      
      drivers/acpi/acpi_watchdog.c: In function 'acpi_watchdog_init':
      drivers/acpi/acpi_watchdog.c:105: error: 'res.child' may be used uninitialized in this function
      drivers/acpi/acpi_watchdog.c:105: error: 'res.sibling' may be used uninitialized in this function
      drivers/acpi/acpi_watchdog.c:105: error: 'res.parent' may be used uninitialized in this function
      drivers/acpi/acpi_watchdog.c:105: error: 'res.desc' may be used uninitialized in this function
      drivers/acpi/acpi_watchdog.c:105: error: 'res.name' may be used uninitialized in this function
      
      Newer compilers can presumably optimize the uninitialized access
      away entirely and don't warn at all, but rely on the kzalloc()
      to zero the structure first. This adds an explicit initialization
      to force consistent behavior.
      
      Fixes: 058dfc76 (ACPI / watchdog: Add support for WDAT hardware watchdog)
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NGuenter Roeck <linux@roeck-us.net>
      Acked-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      6ce14f64
  9. 14 9月, 2017 1 次提交
  10. 05 9月, 2017 1 次提交
    • M
      libnvdimm, nfit: move the check on nd_reserved2 to the endpoint · 9edcad53
      Meng Xu 提交于
      Delay the check of nd_reserved2 to the actual endpoint (acpi_nfit_ctl)
      that uses it, as a prevention of a potential double-fetch bug.
      
      While examining the kernel source code, I found a dangerous operation that
      could turn into a double-fetch situation (a race condition bug) where
      the same userspace memory region are fetched twice into kernel with sanity
      checks after the first fetch while missing checks after the second fetch.
      
      In the case of _IOC_NR(ioctl_cmd) == ND_CMD_CALL:
      
      1. The first fetch happens in line 935 copy_from_user(&pkg, p, sizeof(pkg)
      
      2. subsequently `pkg.nd_reserved2` is asserted to be all zeroes
      (line 984 to 986).
      
      3. The second fetch happens in line 1022 copy_from_user(buf, p, buf_len)
      
      4. Given that `p` can be fully controlled in userspace, an attacker can
      race condition to override the header part of `p`, say,
      `((struct nd_cmd_pkg *)p)->nd_reserved2` to arbitrary value
      (say nine 0xFFFFFFFF for `nd_reserved2`) after the first fetch but before the
      second fetch. The changed value will be copied to `buf`.
      
      5. There is no checks on the second fetches until the use of it in
      line 1034: nd_cmd_clear_to_send(nvdimm_bus, nvdimm, cmd, buf) and
      line 1038: nd_desc->ndctl(nd_desc, nvdimm, cmd, buf, buf_len, &cmd_rc)
      which means that the assumed relation, `p->nd_reserved2` are all zeroes might
      not hold after the second fetch. And once the control goes to these functions
      we lose the context to assert the assumed relation.
      
      6. Based on my manual analysis, `p->nd_reserved2` is not used in function
      `nd_cmd_clear_to_send` and potential implementations of `nd_desc->ndctl`
      so there is no working exploit against it right now. However, this could
      easily turns to an exploitable one if careless developers start to use
      `p->nd_reserved2` later and assume that they are all zeroes.
      
      Move the validation of the nd_reserved2 field to the ->ndctl()
      implementation where it has a stable buffer to evaluate.
      Signed-off-by: NMeng Xu <mengxu.gatech@gmail.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      9edcad53
  11. 01 9月, 2017 2 次提交
    • R
      libnvdimm, nd_blk: remove mmio_flush_range() · 5deb67f7
      Robin Murphy 提交于
      mmio_flush_range() suffers from a lack of clearly-defined semantics,
      and is somewhat ambiguous to port to other architectures where the
      scope of the writeback implied by "flush" and ordering might matter,
      but MMIO would tend to imply non-cacheable anyway. Per the rationale
      in 67a3e8fe ("nd_blk: change aperture mapping from WC to WB"), the
      only existing use is actually to invalidate clean cache lines for
      ARCH_MEMREMAP_PMEM type mappings *without* writeback. Since the recent
      cleanup of the pmem API, that also now happens to be the exact purpose
      of arch_invalidate_pmem(), which would be a far more well-defined tool
      for the job.
      
      Rather than risk potentially inconsistent implementations of
      mmio_flush_range() for the sake of one callsite, streamline things by
      removing it entirely and instead move the ARCH_MEMREMAP_PMEM related
      definitions up to the libnvdimm level, so they can be shared by NFIT
      as well. This allows NFIT to be enabled for arm64.
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      5deb67f7
    • D
      libnvdimm, nfit: export an 'ecc_unit_size' sysfs attribute · a15797f4
      Dan Williams 提交于
      When the nfit driver initializes it runs an ARS (Address Range Scrub)
      operation across every pmem range. Part of that process involves
      determining the ARS capabilities of a given address range. One of the
      capabilities that is reported is the 'Clear Uncorrectable Error Range
      Length Unit Size' (see: ACPI 6.2 section 9.20.7.4 Function Index 1 -
      Query ARS Capabilities). This property is of interest to userspace
      software as it indicates the boundary at which the NVDIMM may need to
      perform read-modify-write cycles to maintain ECC blocks.
      
      Cc: Vishal Verma <vishal.l.verma@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      a15797f4
  12. 30 8月, 2017 3 次提交
  13. 29 8月, 2017 3 次提交
  14. 24 8月, 2017 4 次提交
  15. 23 8月, 2017 2 次提交
  16. 20 8月, 2017 1 次提交
  17. 18 8月, 2017 8 次提交
  18. 17 8月, 2017 1 次提交
  19. 15 8月, 2017 1 次提交
  20. 11 8月, 2017 1 次提交