@@ -0,0 +1,838 @@
+// SPDX-License-Identifier: GPL-2.0+
+/* Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
You don't really need to add the license text as well as SPDX. Except for the fact
that in this case they don't match - which is it?
Right. I will stick to SPDX-License-Identifier: GPL-2.0+
Also, how relevant is it going to be for future DT support? We don't really want
too many artificial dependencies on the way ACPI support happens to currently
be implemented.
Sorry, it's not clear to me what is proposed here as far as naming the PMU is
concerned. Please see below as well.
+out:"arm_smmu_v3_%lu", id);
+ kfree(temp);
+ return ret;
+}
+
+
+static char *smmu_pmu_assign_name(struct smmu_pmu *pmu) {
+ unsigned long id;
+ struct device *smmu, *dev = pmu->dev;
+ char *s_name = NULL, *p_name = NULL;
+
+ smmu = iort_find_pmcg_ref_smmu(dev);
+ if (smmu) {
+ if (!smmu_pmu_get_dev_id(dev_name(smmu), &id))
+ s_name = kasprintf(GFP_KERNEL,
+ }
+
+ if (!s_name)
+ s_name = kasprintf(GFP_KERNEL, "arm_smmu_v3");
As I touched on before, I think it's worth generalising this from the start, and
trying to resolve the component reference to a struct device rather than
IORT/SMMU specific internals. However it also occurs to me that maybe this
isn't as important as it first seemed - since the auto-numbered ID doesn't
actually say which PMCG is which, the only way for the user to actually identify
which PMU is the correct one to count events for a particular endpoint is still to
grovel up the base address, so as long as the PMU name uniquely correlates to
the PMCG device, I'm not sure anything really matters beyond that.
So If I understand this correctly,
iort_find_pmcg_ref_smmu() should be something like iort_find_pmcg_ref()
which returns the associated struct device for the ref node and then, pmu is
named as,
arm_smmu_v3_x_pmcg_y
nc_dev_name_x_pmcg_y
pciXXXX_pmcg_y (Itâs a bit tricky for RC as we will end up with struct pci_bus)
(where x and y are auto ids)
Please let me know if this is what is proposed here.
It is possible to include the pmcg base address instead of the auto-numbered id
as proposed in v1 series.