Skip to content

Commit

Permalink
[arm64] enable cycle counter
Browse files Browse the repository at this point in the history
  • Loading branch information
raphui committed Sep 1, 2016
1 parent f2c9072 commit 5946efc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/arm64/arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ void arch_early_init(void)

void arch_init(void)
{

int pmcr_mask = 1;

__asm__ volatile("msr pmcr_el0, %0":: "r"(pmcr_mask):);
#if WITH_SMP
arch_mp_init_percpu();

Expand Down
8 changes: 8 additions & 0 deletions arch/arm64/include/arch/arch_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,14 @@ static inline uint32_t arch_cycle_count(void)
: "=r" (count)
);
return count;
#elif ARM_ISA_ARMV8
uint32_t count;

ISB;
__asm__ volatile("mrs %0, pmccntr_el0"
: "=r" (count)
);
return count;
#else
//#warning no arch_cycle_count implementation
return 0;
Expand Down

0 comments on commit 5946efc

Please sign in to comment.