Commit 17474413 authored by Qi Liu's avatar Qi Liu Committed by Will Deacon
Browse files

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: default avatarQi Liu <liuqi115@huawei.com>
Link: https://lore.kernel.org/r/1612789498-12957-1-git-send-email-liuqi115@huawei.com


Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent fb62d675
Loading
Loading
Loading
Loading
+13 −19
Original line number Diff line number Diff line
@@ -510,26 +510,20 @@ static ssize_t smmu_pmu_event_show(struct device *dev,
}

#define SMMU_EVENT_ATTR(name, config)					\
	PMU_EVENT_ATTR(name, smmu_event_attr_##name, \
		       config, smmu_pmu_event_show)
SMMU_EVENT_ATTR(cycles, 0);
SMMU_EVENT_ATTR(transaction, 1);
SMMU_EVENT_ATTR(tlb_miss, 2);
SMMU_EVENT_ATTR(config_cache_miss, 3);
SMMU_EVENT_ATTR(trans_table_walk_access, 4);
SMMU_EVENT_ATTR(config_struct_access, 5);
SMMU_EVENT_ATTR(pcie_ats_trans_rq, 6);
SMMU_EVENT_ATTR(pcie_ats_trans_passed, 7);
	(&((struct perf_pmu_events_attr) {				\
		.attr = __ATTR(name, 0444, smmu_pmu_event_show, NULL),	\
		.id = config,						\
	}).attr.attr)

static struct attribute *smmu_pmu_events[] = {
	&smmu_event_attr_cycles.attr.attr,
	&smmu_event_attr_transaction.attr.attr,
	&smmu_event_attr_tlb_miss.attr.attr,
	&smmu_event_attr_config_cache_miss.attr.attr,
	&smmu_event_attr_trans_table_walk_access.attr.attr,
	&smmu_event_attr_config_struct_access.attr.attr,
	&smmu_event_attr_pcie_ats_trans_rq.attr.attr,
	&smmu_event_attr_pcie_ats_trans_passed.attr.attr,
	SMMU_EVENT_ATTR(cycles, 0),
	SMMU_EVENT_ATTR(transaction, 1),
	SMMU_EVENT_ATTR(tlb_miss, 2),
	SMMU_EVENT_ATTR(config_cache_miss, 3),
	SMMU_EVENT_ATTR(trans_table_walk_access, 4),
	SMMU_EVENT_ATTR(config_struct_access, 5),
	SMMU_EVENT_ATTR(pcie_ats_trans_rq, 6),
	SMMU_EVENT_ATTR(pcie_ats_trans_passed, 7),
	NULL
};