powerpc/papr_scm: Fix nvdimm event mappings
authorKajol Jain <kjain@linux.ibm.com>
Thu, 4 Aug 2022 07:48:52 +0000 (13:18 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 23 Aug 2022 01:44:36 +0000 (11:44 +1000)
commit9b1ac04698a4bfec146322502cdcd9904c1777fa
treee41f9677a3a99dae9ec9311e3f39c1cddf77b14a
parent1c23f9e627a7b412978b4e852793c5e3c3efc555
powerpc/papr_scm: Fix nvdimm event mappings

Commit 4c08d4bbc089 ("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: 4c08d4bbc089 ("powerpc/papr_scm: Add perf interface support")
Reported-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Kajol Jain <kjain@linux.ibm.com>
Reviewed-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220804074852.55157-1-kjain@linux.ibm.com
arch/powerpc/platforms/pseries/papr_scm.c