Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers/perf: Simplify the SMMUv3 PMU event attributes

For each PMU event, there is a SMMU_EVENT_ATTR(xx, XX) and
&smmu_event_attr_xx.attr.attr. Let's redefine the SMMU_EVENT_ATTR
to simplify the smmu_pmu_events.

Signed-off-by: Qi Liu <liuqi115@huawei.com>
Link: https://lore.kernel.org/r/1612789498-12957-1-git-send-email-liuqi115@huawei.com
Signed-off-by: Will Deacon <will@kernel.org>

authored by

Qi Liu and committed by
Will Deacon
17474413 fb62d675

+13 -19
+13 -19
drivers/perf/arm_smmuv3_pmu.c
··· 509 509 return sysfs_emit(page, "event=0x%02llx\n", pmu_attr->id); 510 510 } 511 511 512 - #define SMMU_EVENT_ATTR(name, config) \ 513 - PMU_EVENT_ATTR(name, smmu_event_attr_##name, \ 514 - config, smmu_pmu_event_show) 515 - SMMU_EVENT_ATTR(cycles, 0); 516 - SMMU_EVENT_ATTR(transaction, 1); 517 - SMMU_EVENT_ATTR(tlb_miss, 2); 518 - SMMU_EVENT_ATTR(config_cache_miss, 3); 519 - SMMU_EVENT_ATTR(trans_table_walk_access, 4); 520 - SMMU_EVENT_ATTR(config_struct_access, 5); 521 - SMMU_EVENT_ATTR(pcie_ats_trans_rq, 6); 522 - SMMU_EVENT_ATTR(pcie_ats_trans_passed, 7); 512 + #define SMMU_EVENT_ATTR(name, config) \ 513 + (&((struct perf_pmu_events_attr) { \ 514 + .attr = __ATTR(name, 0444, smmu_pmu_event_show, NULL), \ 515 + .id = config, \ 516 + }).attr.attr) 523 517 524 518 static struct attribute *smmu_pmu_events[] = { 525 - &smmu_event_attr_cycles.attr.attr, 526 - &smmu_event_attr_transaction.attr.attr, 527 - &smmu_event_attr_tlb_miss.attr.attr, 528 - &smmu_event_attr_config_cache_miss.attr.attr, 529 - &smmu_event_attr_trans_table_walk_access.attr.attr, 530 - &smmu_event_attr_config_struct_access.attr.attr, 531 - &smmu_event_attr_pcie_ats_trans_rq.attr.attr, 532 - &smmu_event_attr_pcie_ats_trans_passed.attr.attr, 519 + SMMU_EVENT_ATTR(cycles, 0), 520 + SMMU_EVENT_ATTR(transaction, 1), 521 + SMMU_EVENT_ATTR(tlb_miss, 2), 522 + SMMU_EVENT_ATTR(config_cache_miss, 3), 523 + SMMU_EVENT_ATTR(trans_table_walk_access, 4), 524 + SMMU_EVENT_ATTR(config_struct_access, 5), 525 + SMMU_EVENT_ATTR(pcie_ats_trans_rq, 6), 526 + SMMU_EVENT_ATTR(pcie_ats_trans_passed, 7), 533 527 NULL 534 528 }; 535 529