Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102594858
D32316.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D32316.diff
View Options
diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c
--- a/sys/dev/hwpmc/hwpmc_arm64.c
+++ b/sys/dev/hwpmc/hwpmc_arm64.c
@@ -531,7 +531,7 @@
{
struct pmc_mdep *pmc_mdep;
struct pmc_classdep *pcd;
- int idcode, impcode;
+ int classes, idcode, impcode;
int reg;
uint64_t midr;
@@ -561,8 +561,16 @@
arm64_pcpu = malloc(sizeof(struct arm64_cpu *) * pmc_cpu_max(),
M_PMC, M_WAITOK | M_ZERO);
- /* Just one class */
- pmc_mdep = pmc_mdep_alloc(1);
+ /* One AArch64 CPU class */
+ classes = 1;
+
+ /* Query presence of optional classes and set max class. */
+ if (pmc_cmn600_nclasses() > 0)
+ classes = MAX(classes, PMC_MDEP_CLASS_INDEX_CMN600);
+ if (pmc_dmc620_nclasses() > 0)
+ classes = MAX(classes, PMC_MDEP_CLASS_INDEX_DMC620_C);
+
+ pmc_mdep = pmc_mdep_alloc(classes);
switch(impcode) {
case PMCR_IMP_ARM:
@@ -611,6 +619,13 @@
pmc_mdep->pmd_npmc += arm64_npmcs;
+ if (pmc_cmn600_nclasses() > 0)
+ pmc_cmn600_initialize(pmc_mdep);
+ if (pmc_dmc620_nclasses() > 0) {
+ pmc_dmc620_initialize_cd2(pmc_mdep);
+ pmc_dmc620_initialize_c(pmc_mdep);
+ }
+
return (pmc_mdep);
}
diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c
--- a/sys/dev/hwpmc/hwpmc_mod.c
+++ b/sys/dev/hwpmc/hwpmc_mod.c
@@ -5600,6 +5600,16 @@
return (ENOSYS);
}
+ /*
+ * Refresh classes base ri. Optional classes may come in different
+ * order.
+ */
+ for (ri = c = 0; c < md->pmd_nclass; c++) {
+ pcd = &md->pmd_classdep[c];
+ pcd->pcd_ri = ri;
+ ri += pcd->pcd_num;
+ }
+
KASSERT(md->pmd_nclass >= 1 && md->pmd_npmc >= 1,
("[pmc,%d] no classes or pmcs", __LINE__));
@@ -5642,7 +5652,9 @@
if (md->pmd_pcpu_init)
error = md->pmd_pcpu_init(md, cpu);
for (n = 0; error == 0 && n < md->pmd_nclass; n++)
- error = md->pmd_classdep[n].pcd_pcpu_init(md, cpu);
+ if (md->pmd_classdep[n].pcd_num > 0)
+ error = md->pmd_classdep[n].pcd_pcpu_init(md,
+ cpu);
}
pmc_restore_cpu_binding(&pb);
@@ -5755,6 +5767,8 @@
if (error == 0) {
printf(PMC_MODULE_NAME ":");
for (n = 0; n < (int) md->pmd_nclass; n++) {
+ if (md->pmd_classdep[n].pcd_num == 0)
+ continue;
pcd = &md->pmd_classdep[n];
printf(" %s/%d/%d/0x%b",
pmc_name_of_pmcclass(pcd->pcd_class),
@@ -5877,7 +5891,9 @@
continue;
pmc_select_cpu(cpu);
for (c = 0; c < md->pmd_nclass; c++)
- md->pmd_classdep[c].pcd_pcpu_fini(md, cpu);
+ if (md->pmd_classdep[c].pcd_num > 0)
+ md->pmd_classdep[c].pcd_pcpu_fini(md,
+ cpu);
if (md->pmd_pcpu_fini)
md->pmd_pcpu_fini(md, cpu);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 15, 1:30 PM (16 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14642875
Default Alt Text
D32316.diff (2 KB)
Attached To
Mode
D32316: Support of optional PMC classes.
Attached
Detach File
Event Timeline
Log In to Comment