imx8qm-mek: Resolve boot issue for non-EL3 environments.

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>
This commit is contained in:
ouyangxiangzhen 2024-09-19 21:03:48 +08:00 committed by Xiang Xiao
parent a46eb84334
commit a45f903650

View file

@ -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();
}
}
/****************************************************************************