1. 05 Aug, 2020 1 commit
  2. 04 Aug, 2020 1 commit
    • Michael Ellerman's avatar
      powerpc: Fix circular dependency between percpu.h and mmu.h · 0c83b277
      Michael Ellerman authored
      Recently random.h started including percpu.h (see commit
      f227e3ec ("random32: update the net random state on interrupt and
      activity")), which broke corenet64_smp_defconfig:
      
        In file included from /linux/arch/powerpc/include/asm/paca.h:18,
                         from /linux/arch/powerpc/include/asm/percpu.h:13,
                         from /linux/include/linux/random.h:14,
                         from /linux/lib/uuid.c:14:
        /linux/arch/powerpc/include/asm/mmu.h:139:22: error: unknown type name 'next_tlbcam_idx'
          139 | DECLARE_PER_CPU(int, next_tlbcam_idx);
      
      This is due to a circular header dependency:
        asm/mmu.h includes asm/percpu.h, which includes asm/paca.h, which
        includes asm/mmu.h
      
      Which means DECLARE_PER_CPU() isn't defined when mmu.h needs it.
      
      We can fix it by moving the include of paca.h below the include of
      asm-generic/percpu.h.
      
      This moves the include of paca.h out of the #ifdef __powerpc64__, but
      that is OK because paca.h is almost entirely inside #ifdef
      CONFIG_PPC64 anyway.
      
      It also moves the include of paca.h out of the #ifdef CONFIG_SMP,
      which could possibly break something, but seems to have no ill
      effects.
      
      Fixes: f227e3ec ("random32: update the net random state on interrupt and activity")
      Cc: stable@vger.kernel.org # v5.8
      Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20200804130558.292328-1-mpe@ellerman.id.au
      0c83b277
  3. 03 Aug, 2020 3 commits
  4. 31 Jul, 2020 2 commits
    • Vaibhav Jain's avatar
      powerpc/papr_scm: Add support for fetching nvdimm 'fuel-gauge' metric · af0870c4
      Vaibhav Jain authored
      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: default avatarVaibhav Jain <vaibhav@linux.ibm.com>
      Reviewed-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20200731064153.182203-3-vaibhav@linux.ibm.com
      af0870c4
    • Vaibhav Jain's avatar
      powerpc/papr_scm: Fetch nvdimm performance stats from PHYP · 2d02bf83
      Vaibhav Jain authored
      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: default avatarVaibhav Jain <vaibhav@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20200731064153.182203-2-vaibhav@linux.ibm.com
      2d02bf83
  5. 30 Jul, 2020 13 commits
  6. 29 Jul, 2020 20 commits