1. 09 1月, 2019 1 次提交
  2. 22 12月, 2018 2 次提交
    • D
      acpi/nfit, libnvdimm/security: add Intel DSM 1.8 master passphrase support · 89fa9d8e
      Dave Jiang 提交于
      With Intel DSM 1.8 [1] two new security DSMs are introduced. Enable/update
      master passphrase and master secure erase. The master passphrase allows
      a secure erase to be performed without the user passphrase that is set on
      the NVDIMM. The commands of master_update and master_erase are added to
      the sysfs knob in order to initiate the DSMs. They are similar in opeartion
      mechanism compare to update and erase.
      
      [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>
      89fa9d8e
    • D
      acpi/nfit, libnvdimm/security: Add security DSM overwrite support · 7d988097
      Dave Jiang 提交于
      Add support for the NVDIMM_FAMILY_INTEL "ovewrite" capability as
      described by the Intel DSM spec v1.7. This will allow triggering of
      overwrite on Intel NVDIMMs. The overwrite operation can take tens of
      minutes. When the overwrite DSM is issued successfully, the NVDIMMs will
      be unaccessible. The kernel will do backoff polling to detect when the
      overwrite process is completed. According to the DSM spec v1.7, the 128G
      NVDIMMs can take up to 15mins to perform overwrite and larger DIMMs will
      take longer.
      
      Given that overwrite puts the DIMM in an indeterminate state until it
      completes introduce the NDD_SECURITY_OVERWRITE flag to prevent other
      operations from executing when overwrite is happening. The
      NDD_WORK_PENDING flag is added to denote that there is a device reference
      on the nvdimm device for an async workqueue thread context.
      Signed-off-by: NDave Jiang <dave.jiang@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      7d988097
  3. 14 12月, 2018 2 次提交
  4. 11 12月, 2018 1 次提交
  5. 06 12月, 2018 1 次提交
  6. 05 12月, 2018 1 次提交
    • D
      acpi/nfit: Add support for Intel DSM 1.8 commands · b3ed2ce0
      Dave Jiang 提交于
      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>
      b3ed2ce0
  7. 11 11月, 2018 2 次提交
    • D
      Revert "acpi, nfit: Further restrict userspace ARS start requests" · 2121db09
      Dan Williams 提交于
      The following lockdep splat results from acquiring the init_mutex in
      acpi_nfit_clear_to_send():
      
       WARNING: possible circular locking dependency detected
       lt-daxdev-error/7216 is trying to acquire lock:
       00000000f694db15 (&acpi_desc->init_mutex){+.+.}, at: acpi_nfit_clear_to_send+0x27/0x80 [nfit]
      
       but task is already holding lock:
       00000000182298f2 (&nvdimm_bus->reconfig_mutex){+.+.}, at: __nd_ioctl+0x457/0x610 [libnvdimm]
      
       which lock already depends on the new lock.
      
      
       the existing dependency chain (in reverse order) is:
      
       -> #1 (&nvdimm_bus->reconfig_mutex){+.+.}:
              nvdimm_badblocks_populate+0x41/0x150 [libnvdimm]
              nd_region_notify+0x95/0xb0 [libnvdimm]
              nd_device_notify+0x40/0x50 [libnvdimm]
              ars_complete+0x7f/0xd0 [nfit]
              acpi_nfit_scrub+0xbb/0x410 [nfit]
              process_one_work+0x22b/0x5c0
              worker_thread+0x3c/0x390
              kthread+0x11e/0x140
              ret_from_fork+0x3a/0x50
      
       -> #0 (&acpi_desc->init_mutex){+.+.}:
              __mutex_lock+0x83/0x980
              acpi_nfit_clear_to_send+0x27/0x80 [nfit]
              __nd_ioctl+0x474/0x610 [libnvdimm]
              nd_ioctl+0xa4/0xb0 [libnvdimm]
              do_vfs_ioctl+0xa5/0x6e0
              ksys_ioctl+0x70/0x80
              __x64_sys_ioctl+0x16/0x20
              do_syscall_64+0x60/0x210
              entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      New infrastructure is needed to be able to perform this check without
      acquiring the lock.
      
      Fixes: 59486121 ("acpi, nfit: Further restrict userspace ARS start")
      Cc: Dave Jiang <dave.jiang@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      2121db09
    • D
      acpi, nfit: Fix ARS overflow continuation · 3fa58dca
      Dan Williams 提交于
      When the platform BIOS is unable to report all the media error records
      it requires the OS to restart the scrub at a prescribed location. The
      driver detects the overflow condition, but then fails to report it to
      the ARS state machine after reaping the records. Propagate -ENOSPC
      correctly to continue the ARS operation.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 1cf03c00 ("nfit: scrub and register regions in a workqueue")
      Reported-by: NJacek Zloch <jacek.zloch@intel.com>
      Reviewed-by: NDave Jiang <dave.jiang@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      3fa58dca
  8. 18 10月, 2018 4 次提交
    • D
      acpi, nfit: Further restrict userspace ARS start requests · 59486121
      Dan Williams 提交于
      In addition to not allowing ARS start while the background thread is
      actively running, prevent ARS start while any scrub request is pending.
      
      This aligns the window for ARS start submission with the status of ARS
      reported via sysfs. Previously userspace could sneak its own ARS start
      requests in while sysfs reported -EBUSY.
      Reviewed-by: NDave Jiang <dave.jiang@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      59486121
    • D
      acpi, nfit: Fix Address Range Scrub completion tracking · d3abaf43
      Dan Williams 提交于
      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>
      d3abaf43
    • D
      tools/testing/nvdimm: Populate dirty shutdown data · f1101766
      Dan Williams 提交于
      Allow the unit tests to verify the retrieval of the dirty shutdown
      count via smart commands, and allow the driver-load-time retrieval of
      the smart health payload to be simulated by nfit_test.
      Reviewed-by: NKeith Busch <keith.busch@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      f1101766
    • D
      acpi, nfit: Collect shutdown status · 0ead1118
      Dan Williams 提交于
      Some NVDIMMs, in addition to providing an indication of whether the
      previous shutdown was clean, also provide a running count of lifetime
      dirty-shutdown events for the device. In anticipation of this
      functionality appearing on more devices arrange for the nfit driver to
      retrieve / cache this data at DIMM discovery time, and export it via
      sysfs.
      Reviewed-by: NKeith Busch <keith.busch@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      0ead1118
  9. 17 10月, 2018 1 次提交
  10. 28 7月, 2018 1 次提交
  11. 15 7月, 2018 1 次提交
  12. 12 7月, 2018 1 次提交
    • D
      nfit: fix unchecked dereference in acpi_nfit_ctl · ee6581ce
      Dave Jiang 提交于
      Incremental patch to fix the unchecked dereference in acpi_nfit_ctl.
      Reported by Dan Carpenter:
      
      "acpi/nfit: fix cmd_rc for acpi_nfit_ctl to
      always return a value" from Jun 28, 2018, leads to the following
      Smatch complaint:
      
          drivers/acpi/nfit/core.c:578 acpi_nfit_ctl()
           warn: variable dereferenced before check 'cmd_rc' (see line 411)
      
      drivers/acpi/nfit/core.c
         410
         411		*cmd_rc = -EINVAL;
                      ^^^^^^^^^^^^^^^^^^
      Patch adds unchecked dereference.
      
      Fixes: c1985cef ("acpi/nfit: fix cmd_rc for acpi_nfit_ctl to always return a value")
      Signed-off-by: NDave Jiang <dave.jiang@intel.com>
      ee6581ce
  13. 06 7月, 2018 1 次提交
  14. 01 7月, 2018 1 次提交
  15. 13 6月, 2018 1 次提交
    • K
      treewide: devm_kzalloc() -> devm_kcalloc() · a86854d0
      Kees Cook 提交于
      The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc().
      This patch replaces cases of:
      
              devm_kzalloc(handle, a * b, gfp)
      
      with:
              devm_kcalloc(handle, a * b, gfp)
      
      as well as handling cases of:
      
              devm_kzalloc(handle, a * b * c, gfp)
      
      with:
      
              devm_kzalloc(handle, array3_size(a, b, c), gfp)
      
      as it's slightly less ugly than:
      
              devm_kcalloc(handle, array_size(a, b), c, gfp)
      
      This does, however, attempt to ignore constant size factors like:
      
              devm_kzalloc(handle, 4 * 1024, gfp)
      
      though any constants defined via macros get caught up in the conversion.
      
      Any factors with a sizeof() of "unsigned char", "char", and "u8" were
      dropped, since they're redundant.
      
      Some manual whitespace fixes were needed in this patch, as Coccinelle
      really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...".
      
      The Coccinelle script used for this was:
      
      // Fix redundant parens around sizeof().
      @@
      expression HANDLE;
      type TYPE;
      expression THING, E;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	(sizeof(TYPE)) * E
      +	sizeof(TYPE) * E
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(sizeof(THING)) * E
      +	sizeof(THING) * E
        , ...)
      )
      
      // Drop single-byte sizes and redundant parens.
      @@
      expression HANDLE;
      expression COUNT;
      typedef u8;
      typedef __u8;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	sizeof(u8) * (COUNT)
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(__u8) * (COUNT)
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(char) * (COUNT)
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(unsigned char) * (COUNT)
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(u8) * COUNT
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(__u8) * COUNT
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(char) * COUNT
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(unsigned char) * COUNT
      +	COUNT
        , ...)
      )
      
      // 2-factor product with sizeof(type/expression) and identifier or constant.
      @@
      expression HANDLE;
      type TYPE;
      expression THING;
      identifier COUNT_ID;
      constant COUNT_CONST;
      @@
      
      (
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * (COUNT_ID)
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * COUNT_ID
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * COUNT_CONST
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * (COUNT_ID)
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * COUNT_ID
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * COUNT_CONST
      +	COUNT_CONST, sizeof(THING)
        , ...)
      )
      
      // 2-factor product, only identifiers.
      @@
      expression HANDLE;
      identifier SIZE, COUNT;
      @@
      
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	SIZE * COUNT
      +	COUNT, SIZE
        , ...)
      
      // 3-factor product with 1 sizeof(type) or sizeof(expression), with
      // redundant parens removed.
      @@
      expression HANDLE;
      expression THING;
      identifier STRIDE, COUNT;
      type TYPE;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      )
      
      // 3-factor product with 2 sizeof(variable), with redundant parens removed.
      @@
      expression HANDLE;
      expression THING1, THING2;
      identifier COUNT;
      type TYPE1, TYPE2;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE1) * sizeof(TYPE2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      )
      
      // 3-factor product, only identifiers, with redundant parens removed.
      @@
      expression HANDLE;
      identifier STRIDE, SIZE, COUNT;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	(COUNT) * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	COUNT * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	COUNT * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(COUNT) * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	COUNT * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(COUNT) * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(COUNT) * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	COUNT * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      )
      
      // Any remaining multi-factor products, first at least 3-factor products,
      // when they're not all constants...
      @@
      expression HANDLE;
      expression E1, E2, E3;
      constant C1, C2, C3;
      @@
      
      (
        devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
      |
        devm_kzalloc(HANDLE,
      -	(E1) * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(E1) * (E2) * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(E1) * (E2) * (E3)
      +	array3_size(E1, E2, E3)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	E1 * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      )
      
      // And then all remaining 2 factors products when they're not all constants,
      // keeping sizeof() as the second factor argument.
      @@
      expression HANDLE;
      expression THING, E1, E2;
      type TYPE;
      constant C1, C2, C3;
      @@
      
      (
        devm_kzalloc(HANDLE, sizeof(THING) * C2, ...)
      |
        devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...)
      |
        devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
      |
        devm_kzalloc(HANDLE, C1 * C2, ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * (E2)
      +	E2, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * E2
      +	E2, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * (E2)
      +	E2, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * E2
      +	E2, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	(E1) * E2
      +	E1, E2
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	(E1) * (E2)
      +	E1, E2
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	E1 * E2
      +	E1, E2
        , ...)
      )
      Signed-off-by: NKees Cook <keescook@chromium.org>
      a86854d0
  16. 04 6月, 2018 1 次提交
    • D
      acpi, nfit: Remove ecc_unit_size · d4dd7091
      Dan Williams 提交于
      The "Clear Error Unit" may be smaller than the ECC unit size on some
      devices. For example, poison may be tracked at 64-byte alignment even
      though the ECC unit is larger. Unless / until the ACPI specification
      provides a non-ambiguous way to communicate this property do not expose
      this to userspace.
      
      Software that had been using this property must already be prepared for
      the case where the property is not provided on older kernels, so it is
      safe to remove this attribute.
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      d4dd7091
  17. 07 4月, 2018 3 次提交
    • D
      nfit, address-range-scrub: add module option to skip initial ars · bca811a7
      Dan Williams 提交于
      After attempting to quickly retrieve known errors the kernel proceeds to
      kick off a long running ARS. Add a module option to disable this
      behavior at initialization time, or at new region discovery time.
      Otherwise, ARS can be started manually regardless of the state of this
      setting.
      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>
      bca811a7
    • 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
  18. 06 4月, 2018 1 次提交
  19. 04 4月, 2018 1 次提交
  20. 03 4月, 2018 1 次提交
  21. 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
  22. 22 3月, 2018 2 次提交
    • D
      nfit: skip region registration for incomplete control regions · 0731de47
      Dan Williams 提交于
      Per the ACPI specification the only functional purpose for a DIMM
      Control Region to be mapped into the system physical address space, from
      an OSPM perspective, is to support block-apertures. However, there are
      some BIOSen that publish DIMM Control Region SPA entries for pre-boot
      environment consumption.  Undo the kernel policy of generating disabled
      'ndblk' regions when this configuration is detected.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 1f7df6f8 ("libnvdimm, nfit: regions (block-data-window...)")
      Reviewed-by: NToshi Kani <toshi.kani@hpe.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      0731de47
    • D
      libnvdimm, nfit: fix persistence domain reporting · fe9a552e
      Dan Williams 提交于
      The persistence domain is a point in the platform where once writes
      reach that destination the platform claims it will make them persistent
      relative to power loss. In the ACPI NFIT this is currently communicated
      as 2 bits in the "NFIT - Platform Capabilities Structure". The bits
      comprise a hierarchy, i.e. bit0 "CPU Cache Flush to NVDIMM Durability on
      Power Loss Capable" implies bit1 "Memory Controller Flush to NVDIMM
      Durability on Power Loss Capable".
      
      Commit 96c3a239 "libnvdimm: expose platform persistence attr..."
      shows the persistence domain as flags, but it's really an enumerated
      hierarchy.
      
      Fix this newly introduced user ABI to show the closest available
      persistence domain before userspace develops dependencies on seeing, or
      needing to develop code to tolerate, the raw NFIT flags communicated
      through the libnvdimm-generic region attribute.
      
      Fixes: 96c3a239 ("libnvdimm: expose platform persistence attr...")
      Reviewed-by: NDave Jiang <dave.jiang@intel.com>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      fe9a552e
  23. 14 3月, 2018 1 次提交
  24. 06 3月, 2018 1 次提交
  25. 03 2月, 2018 1 次提交
  26. 02 2月, 2018 2 次提交
  27. 05 12月, 2017 1 次提交
    • D
      acpi, nfit: fix health event notification · adf68957
      Dan Williams 提交于
      Integration testing with a BIOS that generates injected health event
      notifications fails to communicate those events to userspace. The nfit
      driver neglects to link the ACPI DIMM device with the necessary driver
      data so acpi_nvdimm_notify() fails this lookup:
      
              nfit_mem = dev_get_drvdata(dev);
              if (nfit_mem && nfit_mem->flags_attr)
                      sysfs_notify_dirent(nfit_mem->flags_attr);
      
      Add the necessary linkage when installing the notification handler and
      clean it up when the nfit driver instance is torn down.
      
      Cc: <stable@vger.kernel.org>
      Cc: Toshi Kani <toshi.kani@hpe.com>
      Cc: Vishal Verma <vishal.l.verma@intel.com>
      Fixes: ba9c8dd3 ("acpi, nfit: add dimm device notification support")
      Reported-by: NDaniel Osawa <daniel.k.osawa@intel.com>
      Tested-by: NDaniel Osawa <daniel.k.osawa@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      adf68957
  28. 13 11月, 2017 1 次提交
    • D
      acpi, nfit: validate commands against the device type · 0e7f0741
      Dan Williams 提交于
      Fix occasions in acpi_nfit_ctl where we check the command type without
      validating whether we are parsing dimm vs bus level commands. Where the
      command numbers alias between dimms and bus we can make the wrong
      assumption just checking the raw command number. For example, with a
      simple nfit_test mock up of the clear-error command we trigger the
      following:
      
          BUG: unable to handle kernel NULL pointer dereference at 0000000000000094
          IP: acpi_nfit_ctl+0x29b/0x930 [nfit]
          [..]
          Call Trace:
           nfit_test_probe+0xb85/0xc09 [nfit_test]
           platform_drv_probe+0x3b/0xa0
           ? platform_drv_probe+0x3b/0xa0
           driver_probe_device+0x29c/0x450
           ? test_alloc+0x180/0x180 [nfit_test]
           __driver_attach+0xe3/0xf0
           ? driver_probe_device+0x450/0x450
           bus_for_each_dev+0x73/0xc0
           driver_attach+0x1e/0x20
           bus_add_driver+0x173/0x270
           driver_register+0x60/0xe0
           __platform_driver_register+0x36/0x40
           nfit_test_init+0x2a1/0x1000 [nfit_test]
      
      Fixes: 4b27db7e ("acpi, nfit: add support for the _LSI, _LSR, and...")
      Reported-by: NVishal Verma <vishal.l.verma@intel.com>
      Tested-by: NVishal Verma <vishal.l.verma@intel.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      0e7f0741
  29. 03 11月, 2017 1 次提交
  30. 31 10月, 2017 1 次提交