1. 02 9月, 2020 2 次提交
    • D
      acpi/nfit, libnvdimm: Store dimm id as a member to struct nvdimm · 83d94276
      Dave Jiang 提交于
      to #27305291
      
      commit d6548ae4d16dc231dec22860c9c472bcb991fb15 upstream.
      
      The generated dimm id is needed for the sysfs attribute as well as being
      used as the identifier/description for the security key. Since it's
      constant and should never change, store it as a member of struct nvdimm.
      
      As nvdimm_create() continues to grow parameters relative to NFIT driver
      requirements, do not require other implementations to keep pace.
      Introduce __nvdimm_create() to carry the new parameters and keep
      nvdimm_create() with the long standing default api.
      Signed-off-by: NDave Jiang <dave.jiang@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      
      [ Shile: fixed conflict in drivers/acpi/nfit/nfit.h ]
      Signed-off-by: NShile Zhang <shile.zhang@linux.alibaba.com>
      Reviewed-by: NYang Shi <yang.shi@linux.alibaba.com>
      83d94276
    • D
      acpi/nfit: Add support for Intel DSM 1.8 commands · d7258548
      Dave Jiang 提交于
      to #27305291
      
      commit b3ed2ce024c36054e51cca2eb31a1cdbe4a5f11e upstream.
      
      Add command definition for security commands defined in Intel DSM
      specification v1.8 [1]. This includes "get security state", "set
      passphrase", "unlock unit", "freeze lock", "secure erase", "overwrite",
      "overwrite query", "master passphrase enable/disable", and "master
      erase", . Since this adds several Intel definitions, move the relevant
      bits to their own header.
      
      These commands mutate physical data, but that manipulation is not cache
      coherent. The requirement to flush and invalidate caches makes these
      commands unsuitable to be called from userspace, so extra logic is added
      to detect and block these commands from being submitted via the ioctl
      command submission path.
      
      Lastly, the commands may contain sensitive key material that should not
      be dumped in a standard debug session. Update the nvdimm-command
      payload-dump facility to move security command payloads behind a
      default-off compile time switch.
      
      [1]: http://pmem.io/documents/NVDIMM_DSM_Interface-V1.8.pdfSigned-off-by: NDave Jiang <dave.jiang@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      
      [ Shile: fixed conflicts:
      This patch updated the file "drivers/acpi/nfit/intel.h". The header file is
      introduced by commit 0ead111 ("acpi, nfit: Collect shutdown status") in
      upstream, which also update the test files. So let's fetch this part to fix
      the conflict:
      - tools/testing/nvdimm/test/nfit.c
      - tools/testing/nvdimm/test/nfit_test.h ]
      Signed-off-by: NShile Zhang <shile.zhang@linux.alibaba.com>
      Reviewed-by: NYang Shi <yang.shi@linux.alibaba.com>
      d7258548
  2. 27 4月, 2019 4 次提交
  3. 14 11月, 2018 1 次提交
    • D
      acpi, nfit: Fix Address Range Scrub completion tracking · 96f81d51
      Dan Williams 提交于
      commit d3abaf43bab8d5b0a3c6b982100d9e2be96de4ad upstream.
      
      The Address Range Scrub implementation tried to skip running scrubs
      against ranges that were already scrubbed by the BIOS. Unfortunately
      that support also resulted in early scrub completions as evidenced by
      this debug output from nfit_test:
      
          nd_region region9: ARS: range 1 short complete
          nd_region region3: ARS: range 1 short complete
          nd_region region4: ARS: range 2 ARS start (0)
          nd_region region4: ARS: range 2 short complete
      
      ...i.e. completions without any indications that the scrub was started.
      
      This state of affairs was hard to see in the code due to the
      proliferation of state bits and mistakenly trying to track done state
      per-range when the completion is a global property of the bus.
      
      So, kill the four ARS state bits (ARS_REQ, ARS_REQ_REDO, ARS_DONE, and
      ARS_SHORT), and replace them with just 2 request flags ARS_REQ_SHORT and
      ARS_REQ_LONG. The implementation will still complete and reap the
      results of BIOS initiated ARS, but it will not attempt to use that
      information to affect the completion status of scrubbing the ranges from
      a Linux perspective.
      
      Instead, try to synchronously run a short ARS per range at init time and
      schedule a long scrub in the background. If ARS is busy with an ARS
      request, schedule both a short and a long scrub for when ARS returns to
      idle. This logic also satisfies the intent of what ARS_REQ_REDO was
      trying to achieve. The new rule is that the REQ flag stays set until the
      next successful ars_start() for that range.
      
      With the new policy that the REQ flags are not cleared until the next
      start, the implementation no longer loses requests as can be seen from
      the following log:
      
          nd_region region3: ARS: range 1 ARS start short (0)
          nd_region region9: ARS: range 1 ARS start short (0)
          nd_region region3: ARS: range 1 complete
          nd_region region4: ARS: range 2 ARS start short (0)
          nd_region region9: ARS: range 1 complete
          nd_region region9: ARS: range 1 ARS start long (0)
          nd_region region4: ARS: range 2 complete
          nd_region region3: ARS: range 1 ARS start long (0)
          nd_region region9: ARS: range 1 complete
          nd_region region3: ARS: range 1 complete
          nd_region region4: ARS: range 2 ARS start long (0)
          nd_region region4: ARS: range 2 complete
      
      ...note that the nfit_test emulated driver provides 2 buses, that is why
      some of the range indices are duplicated. Notice that each range
      now successfully completes a short and long scrub.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 14c73f99 ("nfit, address-range-scrub: introduce nfit_spa->ars_state")
      Fixes: cc3d3458 ("acpi/nfit: queue issuing of ars when an uc error...")
      Reported-by: NJacek Zloch <jacek.zloch@intel.com>
      Reported-by: NKrzysztof Rusocki <krzysztof.rusocki@intel.com>
      Reviewed-by: NDave Jiang <dave.jiang@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      96f81d51
  4. 28 7月, 2018 1 次提交
  5. 06 7月, 2018 1 次提交
  6. 07 4月, 2018 2 次提交
    • D
      nfit, address-range-scrub: rework and simplify ARS state machine · bc6ba808
      Dan Williams 提交于
      ARS is an operation that can take 10s to 100s of seconds to find media
      errors that should rarely be present. If the platform crashes due to
      media errors in persistent memory, the expectation is that the BIOS will
      report those known errors in a 'short' ARS request.
      
      A 'short' ARS request asks platform firmware to return an ARS payload
      with all known errors, but without issuing a 'long' scrub. At driver
      init a short request is issued to all PMEM ranges before registering
      regions. Then, in the background, a long ARS is scheduled for each
      region.
      
      The ARS implementation is simplified to centralize ARS completion work
      in the ars_complete() helper. The timeout is removed since there is no
      facility to cancel ARS, and this otherwise arranges for system init to
      never be blocked waiting for a 'long' ARS. The ars_state flags are used
      to coordinate ARS requests from driver init, ARS requests from
      userspace, and ARS requests in response to media error notifications.
      
      Given that there is no notification of ARS completion the implementation
      still needs to poll. It backs off exponentially to a maximum poll period
      of 30 minutes.
      Suggested-by: NToshi Kani <toshi.kani@hpe.com>
      Co-developed-by: NDave Jiang <dave.jiang@intel.com>
      Signed-off-by: NDave Jiang <dave.jiang@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      bc6ba808
    • D
      nfit, address-range-scrub: determine one platform max_ars value · 459d0ddb
      Dan Williams 提交于
      acpi_nfit_query_poison() is awkward in that it requires an nfit_spa
      argument in order to determine what max_ars value to use. Instead probe
      for the minimum max_ars across all scrub-capable ranges in the system
      and drop the nfit_spa argument.
      
      This enables a larger rework / simplification of the ARS state machine
      whereby the status can be retrieved once and then iterated over all
      address ranges to reap completions.
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      459d0ddb
  7. 06 4月, 2018 1 次提交
  8. 29 3月, 2018 1 次提交
    • D
      acpi, nfit: rework NVDIMM leaf method detection · 466d1493
      Dan Williams 提交于
      Some BIOSen do not handle 0-byte transfer lengths for the _LSR and _LSW
      (label storage read/write) methods. This causes Linux to fallback to the
      deprecated _DSM path, or otherwise disable label support.
      
      Introduce acpi_nvdimm_has_method() to detect whether a method is
      available rather than calling the method, require _LSI and _LSR to be
      paired, and require read support before enabling write support.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 4b27db7e ("acpi, nfit: add support for the _LS...")
      Suggested-by: NErik Schmauss <erik.schmauss@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      466d1493
  9. 02 2月, 2018 1 次提交
  10. 16 11月, 2017 1 次提交
  11. 31 10月, 2017 1 次提交
  12. 30 10月, 2017 1 次提交
  13. 08 10月, 2017 2 次提交
  14. 03 7月, 2017 1 次提交
  15. 16 6月, 2017 1 次提交
  16. 06 6月, 2017 1 次提交
  17. 19 4月, 2017 1 次提交
  18. 18 4月, 2017 2 次提交
  19. 07 12月, 2016 1 次提交
    • D
      tools/testing/nvdimm: unit test acpi_nfit_ctl() · a7de92da
      Dan Williams 提交于
      A recent flurry of bug discoveries in the nfit driver's DSM marshalling
      routine has highlighted the fact that we do not have unit test coverage
      for this routine. Add a self-test of acpi_nfit_ctl() routine before
      probing the "nfit_test.0" device. This mocks stimulus to acpi_nfit_ctl()
      and if any of the tests fail "nfit_test.0" will be unavailable causing
      the rest of the tests to not run / fail.
      
      This unit test will also be a place to land reproductions of quirky BIOS
      behavior discovered in the field and ensure the kernel does not regress
      against implementations it has seen in practice.
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      a7de92da
  20. 01 10月, 2016 1 次提交
    • V
      nfit: don't start a full scrub by default for an MCE · 9ffd6350
      Vishal Verma 提交于
      Starting a full Address Range Scrub (ARS) on hitting a memory error
      machine check exception may not always be desirable. Provide a way
      through sysfs to toggle the behavior between just adding the address
      (cache line) where the MCE happened to the poison list and doing a full
      scrub. The former (selective insertion of the address) is done
      unconditionally.
      
      Cc: linux-acpi@vger.kernel.org
      Cc: Linda Knippers <linda.knippers@hpe.com>
      Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NVishal Verma <vishal.l.verma@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      9ffd6350
  21. 02 9月, 2016 1 次提交
  22. 30 8月, 2016 1 次提交
  23. 23 8月, 2016 2 次提交
  24. 24 7月, 2016 3 次提交
    • V
      nfit: do an ARS scrub on hitting a latent media error · 6839a6d9
      Vishal Verma 提交于
      When a latent (unknown to 'badblocks') error is encountered, it will
      trigger a machine check exception. On a system with machine check
      recovery, this will only SIGBUS the process(es) which had the bad page
      mapped (as opposed to a kernel panic on platforms without machine
      check recovery features). In the former case, we want to trigger a full
      rescan of that nvdimm bus. This will allow any additional, new errors
      to be captured in the block devices' badblocks lists, and offending
      operations on them can be trapped early, avoiding machine checks.
      
      This is done by registering a callback function with the
      x86_mce_decoder_chain and calling the new ars_rescan functionality with
      the address in the mce notificatiion.
      
      Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Signed-off-by: NVishal Verma <vishal.l.verma@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      6839a6d9
    • D
      nfit: move to nfit/ sub-directory · bdf97013
      Dan Williams 提交于
      With the arrival of x86-machine-check support the nfit driver will add a
      (conditionally-compiled) source file.  Prepare for this by moving all
      nfit source to drivers/acpi/nfit/.  This is pure code movement, no
      functional changes.
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      bdf97013
    • V
      nfit, libnvdimm: allow an ARS scrub to be triggered on demand · 37b137ff
      Vishal Verma 提交于
      Normally, an ARS (Address Range Scrub) only happens at
      boot/initialization time. There can however arise situations where a
      bus-wide rescan is needed - notably, in the case of discovering a latent
      media error, we should do a full rescan to figure out what other sectors
      are bad, and thus potentially avoid triggering an mce on them in the
      future. Also provide a sysfs trigger to start a bus-wide scrub.
      
      Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NVishal Verma <vishal.l.verma@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      37b137ff
  25. 22 7月, 2016 2 次提交
  26. 13 7月, 2016 1 次提交
    • D
      pmem: kill __pmem address space · 7a9eb206
      Dan Williams 提交于
      The __pmem address space was meant to annotate codepaths that touch
      persistent memory and need to coordinate a call to wmb_pmem().  Now that
      wmb_pmem() is gone, there is little need to keep this annotation.
      
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      7a9eb206
  27. 12 7月, 2016 3 次提交
    • D
      libnvdimm: introduce nvdimm_flush() and nvdimm_has_flush() · f284a4f2
      Dan Williams 提交于
      nvdimm_flush() is a replacement for the x86 'pcommit' instruction.  It is
      an optional write flushing mechanism that an nvdimm bus can provide for
      the pmem driver to consume.  In the case of the NFIT nvdimm-bus-provider
      nvdimm_flush() is implemented as a series of flush-hint-address [1]
      writes to each dimm in the interleave set (region) that backs the
      namespace.
      
      The nvdimm_has_flush() routine relies on platform firmware to describe
      the flushing capabilities of a platform.  It uses the heuristic of
      whether an nvdimm bus provider provides flush address data to return a
      ternary result:
      
            1: flush addresses defined
            0: dimm topology described without flush addresses (assume ADR)
       -errno: no topology information, unable to determine flush mechanism
      
      The pmem driver is expected to take the following actions on this ternary
      result:
      
            1: nvdimm_flush() in response to REQ_FUA / REQ_FLUSH and shutdown
            0: do not set, WC or FUA on the queue, take no further action
       -errno: warn and then operate as if nvdimm_has_flush() returned '0'
      
      The caveat of this heuristic is that it can not distinguish the "dimm
      does not have flush address" case from the "platform firmware is broken
      and failed to describe a flush address".  Given we are already
      explicitly trusting the NFIT there's not much more we can do beyond
      blacklisting broken firmwares if they are ever encountered.
      
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      f284a4f2
    • D
      libnvdimm, nfit: move flush hint mapping to region-device driver-data · e5ae3b25
      Dan Williams 提交于
      In preparation for triggering flushes of a DIMM's writes-posted-queue
      (WPQ) via the pmem driver move mapping of flush hint addresses to the
      region driver.  Since this uses devm_nvdimm_memremap() the flush
      addresses will remain mapped while any region to which the dimm belongs
      is active.
      
      We need to communicate more information to the nvdimm core to facilitate
      this mapping, namely each dimm object now carries an array of flush hint
      address resources.
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      e5ae3b25
    • D
      libnvdimm, nfit: remove nfit_spa_map() infrastructure · a8a6d2e0
      Dan Williams 提交于
      Now that all shared mappings are handled by devm_nvdimm_memremap() we no
      longer need nfit_spa_map() nor do we need to trigger a callback to the
      bus provider at region disable time.
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      a8a6d2e0