Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[arm64] enable cycle counter #158

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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