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 16, 2016
1 parent f2c9072 commit 86f7743
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
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
4 changes: 4 additions & 0 deletions arch/arm64/mp.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ enum handler_return arm_ipi_reschedule_handler(void *arg)

void arch_mp_init_percpu(void)
{
int pmcr_mask = 1;

__asm__ volatile("msr pmcr_el0, %0":: "r"(pmcr_mask):);

register_int_handler(MP_IPI_GENERIC + GIC_IPI_BASE, &arm_ipi_generic_handler, 0);
register_int_handler(MP_IPI_RESCHEDULE + GIC_IPI_BASE, &arm_ipi_reschedule_handler, 0);

Expand Down

0 comments on commit 86f7743

Please sign in to comment.