1. 02 9月, 2022 1 次提交
    • N
      powerpc/papr_scm: Ensure rc is always initialized in papr_scm_pmu_register() · 6cf07810
      Nathan Chancellor 提交于
      Clang warns:
      
        arch/powerpc/platforms/pseries/papr_scm.c:492:6: warning: variable 'rc' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
                if (!p->stat_buffer_len)
                    ^~~~~~~~~~~~~~~~~~~
        arch/powerpc/platforms/pseries/papr_scm.c:523:64: note: uninitialized use occurs here
                dev_info(&p->pdev->dev, "nvdimm pmu didn't register rc=%d\n", rc);
                                                                              ^~
        include/linux/dev_printk.h:150:67: note: expanded from macro 'dev_info'
                dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
                                                                                ^~~~~~~~~~~
        include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
                        _p_func(dev, fmt, ##__VA_ARGS__);                       \
                                            ^~~~~~~~~~~
        arch/powerpc/platforms/pseries/papr_scm.c:492:2: note: remove the 'if' if its condition is always false
                if (!p->stat_buffer_len)
                ^~~~~~~~~~~~~~~~~~~~~~~~
        arch/powerpc/platforms/pseries/papr_scm.c:484:8: note: initialize the variable 'rc' to silence this warning
                int rc, nodeid;
                      ^
                      = 0
        1 warning generated.
      
      The call to papr_scm_pmu_check_events() was eliminated but a return code
      was not added to the if statement. Add the same return code from
      papr_scm_pmu_check_events() for this condition so there is no more
      warning.
      
      Fixes: 9b1ac046 ("powerpc/papr_scm: Fix nvdimm event mappings")
      Signed-off-by: NNathan Chancellor <nathan@kernel.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Link: https://github.com/ClangBuiltLinux/linux/issues/1701
      Link: https://lore.kernel.org/r/20220830151256.1473169-1-nathan@kernel.org
      6cf07810
  2. 23 8月, 2022 1 次提交
    • K
      powerpc/papr_scm: Fix nvdimm event mappings · 9b1ac046
      Kajol Jain 提交于
      Commit 4c08d4bb ("powerpc/papr_scm: Add perf interface support")
      added performance monitoring support for papr-scm nvdimm devices via
      perf interface. Commit also added an array in papr_scm_priv
      structure called "nvdimm_events_map", which got filled based on the
      result of H_SCM_PERFORMANCE_STATS hcall.
      
      Currently there is an assumption that the order of events in the
      stats buffer, returned by the hypervisor is same. And order also
      happens to matches with the events specified in nvdimm driver code.
      But this assumption is not documented in Power Architecture
      Platform Requirements (PAPR) document. Although the order
      of events happens to be same on current generation od system, but
      it might not be true in future generation systems. Fix the issue, by
      adding a static mapping for nvdimm events to corresponding stat-id,
      and removing the dynamic map from papr_scm_priv structure. Also
      remove the function papr_scm_pmu_check_events from papr_scm.c file,
      as we no longer need to copy stat-ids dynamically.
      
      Fixes: 4c08d4bb ("powerpc/papr_scm: Add perf interface support")
      Reported-by: NAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Signed-off-by: NKajol Jain <kjain@linux.ibm.com>
      Reviewed-by: NVaibhav Jain <vaibhav@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20220804074852.55157-1-kjain@linux.ibm.com
      9b1ac046
  3. 25 7月, 2022 1 次提交
  4. 29 6月, 2022 1 次提交
  5. 31 5月, 2022 1 次提交
    • V
      powerpc/papr_scm: don't requests stats with '0' sized stats buffer · 07bf9431
      Vaibhav Jain 提交于
      Sachin reported [1] that on a POWER-10 lpar he is seeing a kernel panic being
      reported with vPMEM when papr_scm probe is being called. The panic is of the
      form below and is observed only with following option disabled(profile) for the
      said LPAR 'Enable Performance Information Collection' in the HMC:
      
       Kernel attempted to write user page (1c) - exploit attempt? (uid: 0)
       BUG: Kernel NULL pointer dereference on write at 0x0000001c
       Faulting instruction address: 0xc008000001b90844
       Oops: Kernel access of bad area, sig: 11 [#1]
      <snip>
       NIP [c008000001b90844] drc_pmem_query_stats+0x5c/0x270 [papr_scm]
       LR [c008000001b92794] papr_scm_probe+0x2ac/0x6ec [papr_scm]
       Call Trace:
             0xc00000000941bca0 (unreliable)
             papr_scm_probe+0x2ac/0x6ec [papr_scm]
             platform_probe+0x98/0x150
             really_probe+0xfc/0x510
             __driver_probe_device+0x17c/0x230
      <snip>
       ---[ end trace 0000000000000000 ]---
       Kernel panic - not syncing: Fatal exception
      
      On investigation looks like this panic was caused due to a 'stat_buffer' of
      size==0 being provided to drc_pmem_query_stats() to fetch all performance
      stats-ids of an NVDIMM. However drc_pmem_query_stats() shouldn't have been called
      since the vPMEM NVDIMM doesn't support and performance stat-id's. This was caused
      due to missing check for 'p->stat_buffer_len' at the beginning of
      papr_scm_pmu_check_events() which indicates that the NVDIMM doesn't support
      performance-stats.
      
      Fix this by introducing the check for 'p->stat_buffer_len' at the beginning of
      papr_scm_pmu_check_events().
      
      [1] https://lore.kernel.org/all/6B3A522A-6A5F-4CC9-B268-0C63AA6E07D3@linux.ibm.com
      
      Fixes: 0e0946e2 ("powerpc/papr_scm: Fix leaking nvdimm_events_map elements")
      Reported-by: NSachin Sant <sachinp@linux.ibm.com>
      Signed-off-by: NVaibhav Jain <vaibhav@linux.ibm.com>
      Tested-by: NSachin Sant <sachinp@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20220524112353.1718454-1-vaibhav@linux.ibm.com
      07bf9431
  6. 22 5月, 2022 1 次提交
    • V
      powerpc/papr_scm: Fix leaking nvdimm_events_map elements · 0e0946e2
      Vaibhav Jain 提交于
      Right now 'char *' elements allocated for individual 'stat_id' in
      'papr_scm_priv.nvdimm_events_map[]' during papr_scm_pmu_check_events(), get
      leaked in papr_scm_remove() and papr_scm_pmu_register(),
      papr_scm_pmu_check_events() error paths.
      
      Also individual 'stat_id' arent NULL terminated 'char *' instead they are fixed
      8-byte sized identifiers. However papr_scm_pmu_register() assumes it to be a
      NULL terminated 'char *' and at other places it assumes it to be a
      'papr_scm_perf_stat.stat_id' sized string which is 8-byes in size.
      
      Fix this by allocating the memory for papr_scm_priv.nvdimm_events_map to also
      include space for 'stat_id' entries. This is possible since number of available
      events/stat_ids are known upfront. This saves some memory and one extra level of
      indirection from 'nvdimm_events_map' to 'stat_id'. Also rest of the code
      can continue to call 'kfree(papr_scm_priv.nvdimm_events_map)' without needing to
      iterate over the array and free up individual elements.
      
      Fixes: 4c08d4bb ("powerpc/papr_scm: Add perf interface support")
      Signed-off-by: NVaibhav Jain <vaibhav@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20220511082637.646714-1-vaibhav@linux.ibm.com
      0e0946e2
  7. 06 5月, 2022 1 次提交
    • K
      powerpc/papr_scm: Fix buffer overflow issue with CONFIG_FORTIFY_SOURCE · 348c7134
      Kajol Jain 提交于
      With CONFIG_FORTIFY_SOURCE enabled, string functions will also perform
      dynamic checks for string size which can panic the kernel, like incase
      of overflow detection.
      
      In papr_scm, papr_scm_pmu_check_events function uses stat->stat_id with
      string operations, to populate the nvdimm_events_map array. Since
      stat_id variable is not NULL terminated, the kernel panics with
      CONFIG_FORTIFY_SOURCE enabled at boot time.
      
      Below are the logs of kernel panic:
      
        detected buffer overflow in __fortify_strlen
        ------------[ cut here ]------------
        kernel BUG at lib/string_helpers.c:980!
        Oops: Exception in kernel mode, sig: 5 [#1]
        NIP [c00000000077dad0] fortify_panic+0x28/0x38
        LR [c00000000077dacc] fortify_panic+0x24/0x38
        Call Trace:
        [c0000022d77836e0] [c00000000077dacc] fortify_panic+0x24/0x38 (unreliable)
        [c00800000deb2660] papr_scm_pmu_check_events.constprop.0+0x118/0x220 [papr_scm]
        [c00800000deb2cb0] papr_scm_probe+0x288/0x62c [papr_scm]
        [c0000000009b46a8] platform_probe+0x98/0x150
      
      Fix this issue by using kmemdup_nul() to copy the content of
      stat->stat_id directly to the nvdimm_events_map array.
      
      mpe: stat->stat_id comes from the hypervisor, not userspace, so there is
      no security exposure.
      
      Fixes: 4c08d4bb ("powerpc/papr_scm: Add perf interface support")
      Signed-off-by: NKajol Jain <kjain@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20220505153451.35503-1-kjain@linux.ibm.com
      348c7134
  8. 24 3月, 2022 1 次提交
    • K
      powerpc/papr_scm: Fix build failure when · d0007eb1
      Kajol Jain 提交于
      The following build failure occurs when CONFIG_PERF_EVENTS is not set
      as generic pmu functions are not visible in that scenario.
      
      arch/powerpc/platforms/pseries/papr_scm.c:372:35: error: ‘struct perf_event’ has no member named ‘attr’
               p->nvdimm_events_map[event->attr.config],
                                         ^~
      In file included from ./include/linux/list.h:5,
                       from ./include/linux/kobject.h:19,
                       from ./include/linux/of.h:17,
                       from arch/powerpc/platforms/pseries/papr_scm.c:5:
      arch/powerpc/platforms/pseries/papr_scm.c: In function ‘papr_scm_pmu_event_init’:
      arch/powerpc/platforms/pseries/papr_scm.c:389:49: error: ‘struct perf_event’ has no member named ‘pmu’
        struct nvdimm_pmu *nd_pmu = to_nvdimm_pmu(event->pmu);
                                                       ^~
      ./include/linux/container_of.h:18:26: note: in definition of macro ‘container_of’
        void *__mptr = (void *)(ptr);     \
                                ^~~
      arch/powerpc/platforms/pseries/papr_scm.c:389:30: note: in expansion of macro ‘to_nvdimm_pmu’
        struct nvdimm_pmu *nd_pmu = to_nvdimm_pmu(event->pmu);
                                    ^~~~~~~~~~~~~
      In file included from ./include/linux/bits.h:22,
                       from ./include/linux/bitops.h:6,
                       from ./include/linux/of.h:15,
                       from arch/powerpc/platforms/pseries/papr_scm.c:5:
      
      Fix the build issue by adding check for CONFIG_PERF_EVENTS config option
      and also add stub function for papr_scm_pmu_register to handle
      the CONFIG_PERF_EVENTS=n case. Also move the position of macro
      "to_nvdimm_pmu" inorder to merge it in CONFIG_PERF_EVENTS=y block.
      
      based on libnvdimm-for-next tree)
      
      Fixes: 4c08d4bb ("powerpc/papr_scm: Add perf interface support") (Commit id
      Signed-off-by: NKajol Jain <kjain@linux.ibm.com>
      Link: https://lore.kernel.org/r/20220323164550.109768-2-kjain@linux.ibm.comSigned-off-by: NDan Williams <dan.j.williams@intel.com>
      d0007eb1
  9. 10 3月, 2022 1 次提交
    • K
      powerpc/papr_scm: Add perf interface support · 4c08d4bb
      Kajol Jain 提交于
      Performance monitoring support for papr-scm nvdimm devices
      via perf interface is added which includes addition of pmu
      functions like add/del/read/event_init for nvdimm_pmu struture.
      
      A new parameter 'priv' in added to the pdev_archdata structure to save
      nvdimm_pmu device pointer, to handle the unregistering of pmu device.
      
      papr_scm_pmu_register function populates the nvdimm_pmu structure
      with name, capabilities, cpumask along with event handling
      functions. Finally the populated nvdimm_pmu structure is passed to
      register the pmu device. Event handling functions internally uses
      hcall to get events and counter data.
      
      Result in power9 machine with 2 nvdimm device:
      
      Ex: List all event by perf list
      
      command:# perf list nmem
      
        nmem0/cache_rh_cnt/                                [Kernel PMU event]
        nmem0/cache_wh_cnt/                                [Kernel PMU event]
        nmem0/cri_res_util/                                [Kernel PMU event]
        nmem0/ctl_res_cnt/                                 [Kernel PMU event]
        nmem0/ctl_res_tm/                                  [Kernel PMU event]
        nmem0/fast_w_cnt/                                  [Kernel PMU event]
        nmem0/host_l_cnt/                                  [Kernel PMU event]
        nmem0/host_l_dur/                                  [Kernel PMU event]
        nmem0/host_s_cnt/                                  [Kernel PMU event]
        nmem0/host_s_dur/                                  [Kernel PMU event]
        nmem0/med_r_cnt/                                   [Kernel PMU event]
        nmem0/med_r_dur/                                   [Kernel PMU event]
        nmem0/med_w_cnt/                                   [Kernel PMU event]
        nmem0/med_w_dur/                                   [Kernel PMU event]
        nmem0/mem_life/                                    [Kernel PMU event]
        nmem0/poweron_secs/                                [Kernel PMU event]
        ...
        nmem1/mem_life/                                    [Kernel PMU event]
        nmem1/poweron_secs/                                [Kernel PMU event]
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Tested-by: NNageswara R Sastry <rnsastry@linux.ibm.com>
      Signed-off-by: NKajol Jain <kjain@linux.ibm.com>
      [Add numa_map_to_online_node function call to get online node id]
      Reported-by: NNageswara R Sastry <rnsastry@linux.ibm.com>
      Reviewed-by: NMadhavan Srinivasan <maddy@in.ibm.com>
      Link: https://lore.kernel.org/r/20220225143024.47947-4-kjain@linux.ibm.comSigned-off-by: NDan Williams <dan.j.williams@intel.com>
      4c08d4bb
  10. 08 3月, 2022 1 次提交
  11. 16 2月, 2022 1 次提交
    • V
      powerpc/papr_scm: Implement initial support for injecting smart errors · bbbca723
      Vaibhav Jain 提交于
      Presently PAPR doesn't support injecting smart errors on an
      NVDIMM. This makes testing the NVDIMM health reporting functionality
      difficult as simulating NVDIMM health related events need a hacked up
      qemu version.
      
      To solve this problem this patch proposes simulating certain set of
      NVDIMM health related events in papr_scm. Specifically 'fatal' health
      state and 'dirty' shutdown state. These error can be injected via the
      user-space 'ndctl-inject-smart(1)' command. With the proposed patch and
      corresponding ndctl patches following command flow is expected:
      
      $ sudo ndctl list -DH -d nmem0
      ...
            "health_state":"ok",
            "shutdown_state":"clean",
      ...
       # inject unsafe shutdown and fatal health error
      $ sudo ndctl inject-smart nmem0 -Uf
      ...
            "health_state":"fatal",
            "shutdown_state":"dirty",
      ...
       # uninject all errors
      $ sudo ndctl inject-smart nmem0 -N
      ...
            "health_state":"ok",
            "shutdown_state":"clean",
      ...
      
      The patch adds a new member 'health_bitmap_inject_mask' inside struct
      papr_scm_priv which is then bitwise ANDed to the health bitmap fetched from the
      hypervisor. The value for 'health_bitmap_inject_mask' is accessible from sysfs
      at nmemX/papr/health_bitmap_inject.
      
      A new PDSM named 'SMART_INJECT' is proposed that accepts newly
      introduced 'struct nd_papr_pdsm_smart_inject' as payload thats
      exchanged between libndctl and papr_scm to indicate the requested
      smart-error states.
      
      When the processing the PDSM 'SMART_INJECT', papr_pdsm_smart_inject()
      constructs a pair or 'inject_mask' and 'clear_mask' bitmaps from the payload
      and bit-blt it to the 'health_bitmap_inject_mask'. This ensures the after being
      fetched from the hypervisor, the health_bitmap reflects requested smart-error
      states.
      Signed-off-by: NVaibhav Jain <vaibhav@linux.ibm.com>
      Signed-off-by: NShivaprasad G Bhat <sbhat@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20220124202204.1488346-1-vaibhav@linux.ibm.com
      bbbca723
  12. 25 6月, 2021 3 次提交
  13. 24 6月, 2021 1 次提交
  14. 17 5月, 2021 1 次提交
    • V
      powerpc/papr_scm: Reduce error severity if nvdimm stats inaccessible · f3f6d184
      Vaibhav Jain 提交于
      Currently drc_pmem_qeury_stats() generates a dev_err in case
      "Enable Performance Information Collection" feature is disabled from
      HMC or performance stats are not available for an nvdimm. The error is
      of the form below:
      
      papr_scm ibm,persistent-memory:ibm,pmemory@44104001: Failed to query
      	 performance stats, Err:-10
      
      This error message confuses users as it implies a possible problem
      with the nvdimm even though its due to a disabled/unavailable
      feature. We fix this by explicitly handling the H_AUTHORITY and
      H_UNSUPPORTED errors from the H_SCM_PERFORMANCE_STATS hcall.
      
      In case of H_AUTHORITY error an info message is logged instead of an
      error, saying that "Permission denied while accessing performance
      stats" and an EPERM error is returned back.
      
      In case of H_UNSUPPORTED error we return a EOPNOTSUPP error back from
      drc_pmem_query_stats() indicating that performance stats-query
      operation is not supported on this nvdimm.
      
      Fixes: 2d02bf83 ("powerpc/papr_scm: Fetch nvdimm performance stats from PHYP")
      Signed-off-by: NVaibhav Jain <vaibhav@linux.ibm.com>
      Reviewed-by: NIra Weiny <ira.weiny@intel.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210508043642.114076-1-vaibhav@linux.ibm.com
      f3f6d184
  15. 27 4月, 2021 1 次提交
  16. 16 4月, 2021 1 次提交
  17. 14 4月, 2021 1 次提交
  18. 08 10月, 2020 1 次提交
  19. 06 10月, 2020 1 次提交
  20. 16 9月, 2020 1 次提交
    • V
      powerpc/papr_scm: Fix warning triggered by perf_stats_show() · ca78ef2f
      Vaibhav Jain 提交于
      A warning is reported by the kernel in case perf_stats_show() returns
      an error code. The warning is of the form below:
      
       papr_scm ibm,persistent-memory:ibm,pmemory@44100001:
       	  Failed to query performance stats, Err:-10
       dev_attr_show: perf_stats_show+0x0/0x1c0 [papr_scm] returned bad count
       fill_read_buffer: dev_attr_show+0x0/0xb0 returned bad count
      
      On investigation it looks like that the compiler is silently
      truncating the return value of drc_pmem_query_stats() from 'long' to
      'int', since the variable used to store the return code 'rc' is an
      'int'. This truncated value is then returned back as a 'ssize_t' back
      from perf_stats_show() to 'dev_attr_show()' which thinks of it as a
      large unsigned number and triggers this warning..
      
      To fix this we update the type of variable 'rc' from 'int' to
      'ssize_t' that prevents the compiler from truncating the return value
      of drc_pmem_query_stats() and returning correct signed value back from
      perf_stats_show().
      
      Fixes: 2d02bf83 ("powerpc/papr_scm: Fetch nvdimm performance stats from PHYP")
      Signed-off-by: NVaibhav Jain <vaibhav@linux.ibm.com>
      Reviewed-by: NIra Weiny <ira.weiny@intel.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20200912081451.66225-1-vaibhav@linux.ibm.com
      ca78ef2f
  21. 09 9月, 2020 1 次提交
  22. 31 7月, 2020 2 次提交
    • V
      powerpc/papr_scm: Add support for fetching nvdimm 'fuel-gauge' metric · af0870c4
      Vaibhav Jain 提交于
      We add support for reporting 'fuel-gauge' NVDIMM metric via
      PAPR_PDSM_HEALTH pdsm payload. 'fuel-gauge' metric indicates the usage
      life remaining of a papr-scm compatible NVDIMM. PHYP exposes this
      metric via the H_SCM_PERFORMANCE_STATS.
      
      The metric value is returned from the pdsm by extending the return
      payload 'struct nd_papr_pdsm_health' without breaking the ABI. A new
      field 'dimm_fuel_gauge' to hold the metric value is introduced at the
      end of the payload struct and its presence is indicated by by
      extension flag PDSM_DIMM_HEALTH_RUN_GAUGE_VALID.
      
      The patch introduces a new function papr_pdsm_fuel_gauge() that is
      called from papr_pdsm_health(). If fetching NVDIMM performance stats
      is supported then 'papr_pdsm_fuel_gauge()' allocated an output buffer
      large enough to hold the performance stat and passes it to
      drc_pmem_query_stats() that issues the HCALL to PHYP. The return value
      of the stat is then populated in the 'struct
      nd_papr_pdsm_health.dimm_fuel_gauge' field with extension flag
      'PDSM_DIMM_HEALTH_RUN_GAUGE_VALID' set in 'struct
      nd_papr_pdsm_health.extension_flags'
      Signed-off-by: NVaibhav Jain <vaibhav@linux.ibm.com>
      Reviewed-by: NAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20200731064153.182203-3-vaibhav@linux.ibm.com
      af0870c4
    • V
      powerpc/papr_scm: Fetch nvdimm performance stats from PHYP · 2d02bf83
      Vaibhav Jain 提交于
      Update papr_scm.c to query dimm performance statistics from PHYP via
      H_SCM_PERFORMANCE_STATS hcall and export them to user-space as PAPR
      specific NVDIMM attribute 'perf_stats' in sysfs. The patch also
      provide a sysfs ABI documentation for the stats being reported and
      their meanings.
      
      During NVDIMM probe time in papr_scm_nvdimm_init() a special variant
      of H_SCM_PERFORMANCE_STATS hcall is issued to check if collection of
      performance statistics is supported or not. If successful then a PHYP
      returns a maximum possible buffer length needed to read all
      performance stats. This returned value is stored in a per-nvdimm
      attribute 'stat_buffer_len'.
      
      The layout of request buffer for reading NVDIMM performance stats from
      PHYP is defined in 'struct papr_scm_perf_stats' and 'struct
      papr_scm_perf_stat'. These structs are used in newly introduced
      drc_pmem_query_stats() that issues the H_SCM_PERFORMANCE_STATS hcall.
      
      The sysfs access function perf_stats_show() uses value
      'stat_buffer_len' to allocate a buffer large enough to hold all
      possible NVDIMM performance stats and passes it to
      drc_pmem_query_stats() to populate. Finally statistics reported in the
      buffer are formatted into the sysfs access function output buffer.
      Signed-off-by: NVaibhav Jain <vaibhav@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20200731064153.182203-2-vaibhav@linux.ibm.com
      2d02bf83
  23. 26 7月, 2020 1 次提交
  24. 20 7月, 2020 1 次提交
  25. 16 7月, 2020 1 次提交
  26. 16 6月, 2020 4 次提交
    • V
      powerpc/papr_scm: Implement support for PAPR_PDSM_HEALTH · d35f18b5
      Vaibhav Jain 提交于
      This patch implements support for PDSM request 'PAPR_PDSM_HEALTH'
      that returns a newly introduced 'struct nd_papr_pdsm_health' instance
      containing dimm health information back to user space in response to
      ND_CMD_CALL. This functionality is implemented in newly introduced
      papr_pdsm_health() that queries the nvdimm health information and
      then copies this information to the package payload whose layout is
      defined by 'struct nd_papr_pdsm_health'.
      Signed-off-by: NVaibhav Jain <vaibhav@linux.ibm.com>
      Cc: "Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Ira Weiny <ira.weiny@intel.com>
      Link: https://lore.kernel.org/r/20200615124407.32596-7-vaibhav@linux.ibm.comSigned-off-by: NDan Williams <dan.j.williams@intel.com>
      d35f18b5
    • V
      ndctl/papr_scm,uapi: Add support for PAPR nvdimm specific methods · f517f792
      Vaibhav Jain 提交于
      Introduce support for PAPR NVDIMM Specific Methods (PDSM) in papr_scm
      module and add the command family NVDIMM_FAMILY_PAPR to the white list
      of NVDIMM command sets. Also advertise support for ND_CMD_CALL for the
      nvdimm command mask and implement necessary scaffolding in the module
      to handle ND_CMD_CALL ioctl and PDSM requests that we receive.
      
      The layout of the PDSM request as we expect from libnvdimm/libndctl is
      described in newly introduced uapi header 'papr_pdsm.h' which
      defines a 'struct nd_pkg_pdsm' and a maximal union named
      'nd_pdsm_payload'. These new structs together with 'struct nd_cmd_pkg'
      for a pdsm envelop thats sent by libndctl to libnvdimm and serviced by
      papr_scm in 'papr_scm_service_pdsm()'. The PDSM request is
      communicated by member 'struct nd_cmd_pkg.nd_command' together with
      other information on the pdsm payload (size-in, size-out).
      
      The patch also introduces 'struct pdsm_cmd_desc' instances of which
      are stored in an array __pdsm_cmd_descriptors[] indexed with PDSM cmd
      and corresponding access function pdsm_cmd_desc() is
      introduced. 'struct pdsm_cdm_desc' holds the service function for a
      given PDSM and corresponding payload in/out sizes.
      
      A new function papr_scm_service_pdsm() is introduced and is called from
      papr_scm_ndctl() in case of a PDSM request is received via ND_CMD_CALL
      command from libnvdimm. The function performs validation on the PDSM
      payload based on info present in corresponding PDSM descriptor and if
      valid calls the 'struct pdcm_cmd_desc.service' function to service the
      PDSM.
      Signed-off-by: NVaibhav Jain <vaibhav@linux.ibm.com>
      Cc: "Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Ira Weiny <ira.weiny@intel.com>
      Link: https://lore.kernel.org/r/20200615124407.32596-6-vaibhav@linux.ibm.comSigned-off-by: NDan Williams <dan.j.williams@intel.com>
      f517f792
    • V
      powerpc/papr_scm: Improve error logging and handling papr_scm_ndctl() · b5f38f09
      Vaibhav Jain 提交于
      Since papr_scm_ndctl() can be called from outside papr_scm, its
      exposed to the possibility of receiving NULL as value of 'cmd_rc'
      argument. This patch updates papr_scm_ndctl() to protect against such
      possibility by assigning it pointer to a local variable in case cmd_rc
      == NULL.
      
      Finally the patch also updates the 'default' add a debug log unknown
      'cmd' values.
      Signed-off-by: NVaibhav Jain <vaibhav@linux.ibm.com>
      Reviewed-by: NIra Weiny <ira.weiny@intel.com>
      Cc: "Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Ira Weiny <ira.weiny@intel.com>
      Link: https://lore.kernel.org/r/20200615124407.32596-5-vaibhav@linux.ibm.comSigned-off-by: NDan Williams <dan.j.williams@intel.com>
      b5f38f09
    • V
      powerpc/papr_scm: Fetch nvdimm health information from PHYP · b791abf3
      Vaibhav Jain 提交于
      Implement support for fetching nvdimm health information via
      H_SCM_HEALTH hcall as documented in Ref[1]. The hcall returns a pair
      of 64-bit bitmap, bitwise-and of which is then stored in
      'struct papr_scm_priv' and subsequently partially exposed to
      user-space via newly introduced dimm specific attribute
      'papr/flags'. Since the hcall is costly, the health information is
      cached and only re-queried, 60s after the previous successful hcall.
      
      The patch also adds a  documentation text describing flags reported by
      the the new sysfs attribute 'papr/flags' is also introduced at
      Documentation/ABI/testing/sysfs-bus-papr-pmem.
      
      [1] commit 58b278f5 ("powerpc: Provide initial documentation for
      PAPR hcalls")
      Signed-off-by: NVaibhav Jain <vaibhav@linux.ibm.com>
      Cc: "Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Ira Weiny <ira.weiny@intel.com>
      Link: https://lore.kernel.org/r/20200615124407.32596-4-vaibhav@linux.ibm.comSigned-off-by: NDan Williams <dan.j.williams@intel.com>
      b791abf3
  27. 01 4月, 2020 1 次提交
  28. 18 3月, 2020 1 次提交
  29. 19 2月, 2020 1 次提交
  30. 18 2月, 2020 1 次提交
  31. 25 1月, 2020 2 次提交
  32. 06 1月, 2020 1 次提交
  33. 20 11月, 2019 1 次提交