summaryrefslogtreecommitdiff
path: root/arch/x86/machine/pmu_amd.c
diff options
context:
space:
mode:
authorRemy Noel <mocramis@gmail.com>2018-04-30 20:30:08 +0200
committerRemy Noel <mocramis@gmail.com>2018-05-03 13:08:30 +0200
commitc4ba76cc4f84a25b259e9089b5e49a6edc015f1d (patch)
tree2e8548cd533672cf517b0ae5df76bf2e449f3890 /arch/x86/machine/pmu_amd.c
parent70794059bfae7a538ee6b1ffe6f1604950ef83f2 (diff)
perfmon: register a pmu_driver in place of pmu_ops.
Replace pmu_get_width with a property. Prepare the default overfow handling.
Diffstat (limited to 'arch/x86/machine/pmu_amd.c')
-rw-r--r--arch/x86/machine/pmu_amd.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/arch/x86/machine/pmu_amd.c b/arch/x86/machine/pmu_amd.c
index 105ba50..34df620 100644
--- a/arch/x86/machine/pmu_amd.c
+++ b/arch/x86/machine/pmu_amd.c
@@ -237,18 +237,12 @@ pmu_amd_handle_of_intr_v1(void)
}
}
-static uint8_t
-pmu_amd_get_pmc_width(void)
-{
- return PMU_AMD_PMC_WIDTH;
-}
-
static int __init
pmu_amd_setup(void)
{
const struct cpu *cpu;
struct pmu_amd *pmu;
- struct perfmon_pmu_ops pmu_driver;
+ struct perfmon_pmu_driver pmu_driver;
cpu = cpu_current();
@@ -264,16 +258,17 @@ pmu_amd_setup(void)
pmu = pmu_amd_get();
pmu->pmc_bm = (1U << PMU_AMD_NR_PMCS) - 1;
- pmu_driver.info = pmu_amd_info;
- pmu_driver.translate = pmu_amd_translate;
- pmu_driver.alloc = pmu_amd_alloc;
- pmu_driver.free = pmu_amd_free;
- pmu_driver.start = pmu_amd_start;
- pmu_driver.stop = pmu_amd_stop;
- pmu_driver.read = pmu_amd_read;
- pmu_driver.write = pmu_amd_write;
- pmu_driver.get_pmc_width = pmu_amd_get_pmc_width;
- pmu_driver.handle_of_intr = pmu_amd_handle_of_intr_v1;
+ pmu_driver.pmc_width = PMU_AMD_PMC_WIDTH;
+ pmu_driver.of_max_ticks = 1UL << (pmu_driver.pmc_width - 1);
+
+ pmu_driver.ops.info = pmu_amd_info;
+ pmu_driver.ops.translate = pmu_amd_translate;
+ pmu_driver.ops.alloc = pmu_amd_alloc;
+ pmu_driver.ops.free = pmu_amd_free;
+ pmu_driver.ops.start = pmu_amd_start;
+ pmu_driver.ops.stop = pmu_amd_stop;
+ pmu_driver.ops.read = pmu_amd_read;
+ pmu_driver.ops.write = pmu_amd_write;
return perfmon_pmu_register(&pmu_driver);
}