Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F154460361
D31109.id92079.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D31109.id92079.diff
View Options
Index: lib/libpmc/libpmc_pmu_util.c
===================================================================
--- lib/libpmc/libpmc_pmu_util.c
+++ lib/libpmc/libpmc_pmu_util.c
@@ -142,6 +142,13 @@
return (name);
}
+#elif defined(__powerpc64__)
+
+static const char *
+pmu_alias_get(const char *name)
+{
+ return (name);
+}
#elif defined(__aarch64__)
@@ -571,6 +578,32 @@
return (pmc_pmu_amd_pmcallocate(event_name, pm, &ped));
}
+#elif defined(__powerpc64__)
+
+int
+pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm)
+{
+ const struct pmu_event *pe;
+ struct pmu_event_desc ped;
+ int idx = -1;
+
+ bzero(&pm->pm_md, sizeof(pm->pm_md));
+ pm->pm_caps |= (PMC_CAP_READ | PMC_CAP_WRITE);
+ event_name = pmu_alias_get(event_name);
+
+ if ((pe = pmu_event_get(NULL, event_name, &idx)) == NULL)
+ return (ENOENT);
+ if (pe->event == NULL)
+ return (ENOENT);
+ if (pmu_parse_event(&ped, pe->event))
+ return (ENOENT);
+
+ assert(ped.ped_event >= 0);
+ pm->pm_ev = ped.ped_event;
+ pm->pm_class = PMC_CLASS_POWER8;
+ return (0);
+}
+
#elif defined(__aarch64__)
int
Index: sys/dev/hwpmc/hwpmc_power8.c
===================================================================
--- sys/dev/hwpmc/hwpmc_power8.c
+++ sys/dev/hwpmc/hwpmc_power8.c
@@ -275,6 +275,34 @@
mtspr(SPR_MMCR0, mmcr0);
}
+static int
+power8_allocate_pmc(int cpu, int ri, struct pmc *pm,
+ const struct pmc_op_pmcallocate *a)
+{
+ uint32_t caps, config = 0;
+
+ KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
+ ("[powerpc,%d] illegal CPU value %d", __LINE__, cpu));
+ KASSERT(ri >= 0 && ri < ppc_max_pmcs,
+ ("[powerpc,%d] illegal row index %d", __LINE__, ri));
+
+ caps = a->pm_caps;
+ config = a->pm_ev;
+
+ if (caps & PMC_CAP_SYSTEM)
+ config |= POWERPC_PMC_KERNEL_ENABLE;
+ if (caps & PMC_CAP_USER)
+ config |= POWERPC_PMC_USER_ENABLE;
+ if ((caps & (PMC_CAP_USER | PMC_CAP_SYSTEM)) == 0)
+ config |= POWERPC_PMC_ENABLE;
+
+ pm->pm_md.pm_powerpc.pm_powerpc_evsel = config;
+
+ PMCDBG3(MDP,ALL,1,"powerpc-allocate cpu=%d ri=%d -> config=0x%x",
+ cpu, ri, config);
+ return (0);
+}
+
int
pmc_power8_initialize(struct pmc_mdep *pmc_mdep)
{
@@ -291,7 +319,7 @@
pcd->pcd_pcpu_init = power8_pcpu_init;
pcd->pcd_pcpu_fini = power8_pcpu_fini;
- pcd->pcd_allocate_pmc = powerpc_allocate_pmc;
+ pcd->pcd_allocate_pmc = power8_allocate_pmc;
pcd->pcd_release_pmc = powerpc_release_pmc;
pcd->pcd_start_pmc = powerpc_start_pmc;
pcd->pcd_stop_pmc = powerpc_stop_pmc;
@@ -304,10 +332,7 @@
pmc_mdep->pmd_npmc += POWER8_MAX_PMCS;
pmc_mdep->pmd_intr = powerpc_pmc_intr;
- ppc_event_codes = power8_event_codes;
ppc_event_codes_size = power8_event_codes_size;
- ppc_event_first = PMC_EV_POWER8_FIRST;
- ppc_event_last = PMC_EV_POWER8_LAST;
ppc_max_pmcs = POWER8_MAX_PMCS;
powerpc_set_pmc = power8_set_pmc;
Index: sys/dev/hwpmc/hwpmc_powerpc.c
===================================================================
--- sys/dev/hwpmc/hwpmc_powerpc.c
+++ sys/dev/hwpmc/hwpmc_powerpc.c
@@ -603,6 +603,9 @@
pmc_mdep = NULL;
}
+ /* Set the value for kern.hwpmc.cpuid */
+ snprintf(pmc_cpuid, sizeof(pmc_cpuid), "%08lx", mfpvr());
+
return (pmc_mdep);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 29, 4:23 PM (14 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32357638
Default Alt Text
D31109.id92079.diff (3 KB)
Attached To
Mode
D31109: Add Power8 and Power9 PMCs
Attached
Detach File
Event Timeline
Log In to Comment