mirror of https://github.com/torvalds/linux.git
perf/arm_cspmu: nvidia: Add revision id matching
Distinguish NVIDIA devices by revision and variant bits in PMIIDR register in addition to product id. Reviewed-by: Ilkka Koskinen <ilkka@os.amperecomputing.com> Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com> Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
parent
04330be8dc
commit
82dfd72bfb
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#define NV_GENERIC_FILTER_ID_MASK GENMASK_ULL(31, 0)
|
||||
|
||||
#define NV_PRODID_MASK GENMASK(31, 0)
|
||||
#define NV_PRODID_MASK (PMIIDR_PRODUCTID | PMIIDR_VARIANT | PMIIDR_REVISION)
|
||||
|
||||
#define NV_FORMAT_NAME_GENERIC 0
|
||||
|
||||
|
|
@ -220,7 +220,7 @@ struct nv_cspmu_match {
|
|||
|
||||
static const struct nv_cspmu_match nv_cspmu_match[] = {
|
||||
{
|
||||
.prodid = 0x103,
|
||||
.prodid = 0x10300000,
|
||||
.prodid_mask = NV_PRODID_MASK,
|
||||
.filter_mask = NV_PCIE_FILTER_ID_MASK,
|
||||
.filter_default_val = NV_PCIE_FILTER_ID_MASK,
|
||||
|
|
@ -230,7 +230,7 @@ static const struct nv_cspmu_match nv_cspmu_match[] = {
|
|||
.format_attr = pcie_pmu_format_attrs
|
||||
},
|
||||
{
|
||||
.prodid = 0x104,
|
||||
.prodid = 0x10400000,
|
||||
.prodid_mask = NV_PRODID_MASK,
|
||||
.filter_mask = NV_NVL_C2C_FILTER_ID_MASK,
|
||||
.filter_default_val = NV_NVL_C2C_FILTER_ID_MASK,
|
||||
|
|
@ -240,7 +240,7 @@ static const struct nv_cspmu_match nv_cspmu_match[] = {
|
|||
.format_attr = nvlink_c2c_pmu_format_attrs
|
||||
},
|
||||
{
|
||||
.prodid = 0x105,
|
||||
.prodid = 0x10500000,
|
||||
.prodid_mask = NV_PRODID_MASK,
|
||||
.filter_mask = NV_NVL_C2C_FILTER_ID_MASK,
|
||||
.filter_default_val = NV_NVL_C2C_FILTER_ID_MASK,
|
||||
|
|
@ -250,7 +250,7 @@ static const struct nv_cspmu_match nv_cspmu_match[] = {
|
|||
.format_attr = nvlink_c2c_pmu_format_attrs
|
||||
},
|
||||
{
|
||||
.prodid = 0x106,
|
||||
.prodid = 0x10600000,
|
||||
.prodid_mask = NV_PRODID_MASK,
|
||||
.filter_mask = NV_CNVL_FILTER_ID_MASK,
|
||||
.filter_default_val = NV_CNVL_FILTER_ID_MASK,
|
||||
|
|
@ -260,7 +260,7 @@ static const struct nv_cspmu_match nv_cspmu_match[] = {
|
|||
.format_attr = cnvlink_pmu_format_attrs
|
||||
},
|
||||
{
|
||||
.prodid = 0x2CF,
|
||||
.prodid = 0x2CF00000,
|
||||
.prodid_mask = NV_PRODID_MASK,
|
||||
.filter_mask = 0x0,
|
||||
.filter_default_val = 0x0,
|
||||
|
|
@ -312,7 +312,6 @@ static char *nv_cspmu_format_name(const struct arm_cspmu *cspmu,
|
|||
|
||||
static int nv_cspmu_init_ops(struct arm_cspmu *cspmu)
|
||||
{
|
||||
u32 prodid;
|
||||
struct nv_cspmu_ctx *ctx;
|
||||
struct device *dev = cspmu->dev;
|
||||
struct arm_cspmu_impl_ops *impl_ops = &cspmu->impl.ops;
|
||||
|
|
@ -322,13 +321,12 @@ static int nv_cspmu_init_ops(struct arm_cspmu *cspmu)
|
|||
if (!ctx)
|
||||
return -ENOMEM;
|
||||
|
||||
prodid = FIELD_GET(PMIIDR_PRODUCTID, cspmu->impl.pmiidr);
|
||||
|
||||
/* Find matching PMU. */
|
||||
for (; match->prodid; match++) {
|
||||
const u32 prodid_mask = match->prodid_mask;
|
||||
|
||||
if ((match->prodid & prodid_mask) == (prodid & prodid_mask))
|
||||
if ((match->prodid & prodid_mask) ==
|
||||
(cspmu->impl.pmiidr & prodid_mask))
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue