summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorRemy Noel <mocramis@gmail.com>2018-04-08 12:29:41 +0200
committerRemy Noel <mocramis@gmail.com>2018-04-21 00:04:20 +0200
commit0274c8726015e83c989aac905b6626e40397495c (patch)
treed7857b4d4a8983ad2fe08339c83d0f285b45e1f6 /arch
parent7f545f440e58b081b1ff630e78903ee4ee901a5a (diff)
kern/perfmon: Handle overflow on sync.
Add new perfmon driver method "get_pmc_width".
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/machine/pmu_amd.c7
-rw-r--r--arch/x86/machine/pmu_intel.c9
2 files changed, 16 insertions, 0 deletions
diff --git a/arch/x86/machine/pmu_amd.c b/arch/x86/machine/pmu_amd.c
index 0f8b14a..1c6545e 100644
--- a/arch/x86/machine/pmu_amd.c
+++ b/arch/x86/machine/pmu_amd.c
@@ -197,6 +197,12 @@ pmu_amd_read(unsigned int pmc_id)
return cpu_get_msr64(PMU_AMD_MSR_PERCTR0 + pmc_id);
}
+static uint8_t
+pmu_amd_get_pmc_width(void)
+{
+ return PMU_AMD_PMC_WIDTH;
+}
+
static int __init
pmu_amd_setup(void)
{
@@ -225,6 +231,7 @@ pmu_amd_setup(void)
pmu_driver.start = pmu_amd_start;
pmu_driver.stop = pmu_amd_stop;
pmu_driver.read = pmu_amd_read;
+ pmu_driver.get_pmc_width = pmu_amd_get_pmc_width;
return perfmon_pmu_register(&pmu_driver);
}
diff --git a/arch/x86/machine/pmu_intel.c b/arch/x86/machine/pmu_intel.c
index 26647af..fcebb06 100644
--- a/arch/x86/machine/pmu_intel.c
+++ b/arch/x86/machine/pmu_intel.c
@@ -226,7 +226,15 @@ pmu_intel_read(unsigned int pmc_id)
return cpu_get_msr64(PMU_INTEL_MSR_PMC0 + pmc_id);
}
+static uint8_t
+pmu_intel_get_pmc_width(void)
+{
+ struct pmu_intel *pmu;
+ pmu = pmu_intel_get();
+
+ return pmu->pmc_width;
+}
static int __init
pmu_intel_setup(void)
@@ -273,6 +281,7 @@ pmu_intel_setup(void)
pmu_driver.start = pmu_intel_start;
pmu_driver.stop = pmu_intel_stop;
pmu_driver.read = pmu_intel_read;
+ pmu_driver.get_pmc_width = pmu_intel_get_pmc_width;
return perfmon_pmu_register(&pmu_driver);
}