hw: enable ARMv8 performance counter

Fix #3618
This commit is contained in:
Stefan Kalkowski 2020-01-15 15:55:08 +01:00 committed by Christian Helmuth
parent 9db50753f1
commit 56ef7ca9e7
2 changed files with 5 additions and 0 deletions

View File

@ -158,6 +158,9 @@ unsigned Bootstrap::Platform::enable_mmu()
/* enable performance counter for user-land */
Cpu::Pmuserenr_el0::write(0b1111);
Cpu::Pmcr_el0::access_t pmcr = Cpu::Pmcr_el0::read();
Cpu::Pmcr_el0::write(pmcr | 1);
Cpu::Pmcntenset_el0::write(1 << 31);
/* enable user-level access of physical/virtual counter */
Cpu::Cntkctl_el1::write(0b11);

View File

@ -137,6 +137,8 @@ struct Hw::Arm_64_cpu
SYSTEM_REGISTER(64, Mpidr, mpidr_el1);
SYSTEM_REGISTER(32, Pmcr_el0, pmcr_el0);
SYSTEM_REGISTER(32, Pmcntenset_el0, pmcntenset_el0);
SYSTEM_REGISTER(32, Pmuserenr_el0, pmuserenr_el0);
SYSTEM_REGISTER(64, Scr, scr_el3,