summaryrefslogtreecommitdiff
path: root/arch/x86/machine
diff options
context:
space:
mode:
authorRemy Noel <mocramis@gmail.com>2018-04-18 19:16:40 +0200
committerRemy Noel <mocramis@gmail.com>2018-04-21 00:04:20 +0200
commit1b86674fcbefb0c860c02ade0463db469f4df1bb (patch)
treef2b741d60c7ae8996ca736378b28dc213a33b033 /arch/x86/machine
parent75924457863e9dc90475b5cbd9bcabfff87cfc0d (diff)
perfmon: Test overflow in cpu test.
Adds perfmon_event_write as a test-only API.
Diffstat (limited to 'arch/x86/machine')
-rw-r--r--arch/x86/machine/pmu_intel.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/x86/machine/pmu_intel.c b/arch/x86/machine/pmu_intel.c
index 6439282..40e1450 100644
--- a/arch/x86/machine/pmu_intel.c
+++ b/arch/x86/machine/pmu_intel.c
@@ -231,6 +231,21 @@ pmu_intel_read(unsigned int pmc_id)
return cpu_get_msr64(PMU_INTEL_MSR_PMC0 + pmc_id);
}
+#ifdef CONFIG_PERFMON_TEST
+
+static void
+pmu_intel_write(unsigned int pmc_id, uint64_t value)
+{
+ uint32_t low, high;
+
+ low = value & 0xffffffff;
+ high = value >> 32;
+
+ cpu_set_msr(PMU_INTEL_MSR_PMC0 + pmc_id, low, high);
+}
+
+#endif /* CONFIG_PERFMON_TEST */
+
static void
pmu_intel_handle_of_intr_v1(struct trap_frame *frame)
{
@@ -318,6 +333,9 @@ pmu_intel_setup(void)
pmu_driver.read = pmu_intel_read;
pmu_driver.get_pmc_width = pmu_intel_get_pmc_width;
pmu_driver.handle_of_intr = pmu_intel_handle_of_intr_v1;
+#ifdef CONFIG_PERFMON_TEST
+ pmu_driver.write = pmu_intel_write;
+#endif
return perfmon_pmu_register(&pmu_driver);
}