Skip to content

Commit

Permalink
imx8qm-mek: Resolve boot issue for non-EL3 environments
Browse files Browse the repository at this point in the history
This commit addresses the issue of unauthorized writes to cntfrq_el0 during boot when not in EL3 mode.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
  • Loading branch information
Fix-Point committed Oct 15, 2024
1 parent 2f26323 commit be76b25
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions arch/arm64/src/imx8/imx8_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,15 @@ const struct arm_mmu_config g_mmu_config =

void arm64_el_init(void)
{
write_sysreg(CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC, cntfrq_el0);
uint64_t el = arm64_current_el();

ARM64_ISB();
/* Only in EL3 we can write to cntfrq_el0. */

if (el == 3)
{
write_sysreg(CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC, cntfrq_el0);
ARM64_ISB();
}
}

/****************************************************************************
Expand Down

0 comments on commit be76b25

Please sign in to comment.