From 6b09ac59f08a6e5b36e0d9faa29571d824eec7e7 Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Tue, 9 Jul 2019 11:41:18 +0200 Subject: [PATCH] hw: enable performance counter for ARMv8 Ref #3426 --- repos/base-hw/src/bootstrap/spec/rpi3/platform.cc | 3 +++ repos/base-hw/src/include/hw/spec/arm_64/cpu.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/repos/base-hw/src/bootstrap/spec/rpi3/platform.cc b/repos/base-hw/src/bootstrap/spec/rpi3/platform.cc index 3dd063e0f..75457ddf3 100644 --- a/repos/base-hw/src/bootstrap/spec/rpi3/platform.cc +++ b/repos/base-hw/src/bootstrap/spec/rpi3/platform.cc @@ -104,6 +104,9 @@ unsigned Bootstrap::Platform::enable_mmu() prepare_hypervisor(); } + /* enable performance counter for user-land */ + Cpu::Pmuserenr_el0::write(0b1111); + Cpu::Vbar_el1::write(Hw::Mm::supervisor_exception_vector().base); /* set memory attributes in indirection register */ diff --git a/repos/base-hw/src/include/hw/spec/arm_64/cpu.h b/repos/base-hw/src/include/hw/spec/arm_64/cpu.h index 969f416a2..a867dd0ba 100644 --- a/repos/base-hw/src/include/hw/spec/arm_64/cpu.h +++ b/repos/base-hw/src/include/hw/spec/arm_64/cpu.h @@ -97,6 +97,8 @@ struct Hw::Arm_64_cpu struct Attr3 : Bitfield<24, 8> {}; ); + SYSTEM_REGISTER(32, Pmuserenr_el0, pmuserenr_el0); + SYSTEM_REGISTER(64, Scr, scr_el3, struct Ns : Bitfield<0, 1> {}; struct Smd : Bitfield<7, 1> {};