refactor(qemu): do not hardcode counter frequency

From QEMU change:

> In previous versions of the Arm architecture, the frequency of the
> generic timers as reported in CNTFRQ_EL0 could be any IMPDEF value,
> and for QEMU we picked 62.5MHz, giving a timer tick period of 16ns.
> In Armv8.6, the architecture standardized this frequency to 1GHz.

This change stops TF-A from hardcoding 62.5MHz frequency. Instead value
stored in CNTFRQ_EL0 would be used. As a result we get 62.5MHz on older
cores and 1GHz on newer ones.

Change-Id: I7d414ce6d3708e598bbb5a6f79eb2d4ec8e15ac4
Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
This commit is contained in:
Marcin Juszkiewicz 2024-04-22 17:27:56 +02:00
parent c8be7c08c3
commit 5436047a0e
3 changed files with 1 additions and 11 deletions

View file

@ -161,7 +161,7 @@ void bl31_platform_setup(void)
unsigned int plat_get_syscnt_freq2(void)
{
return SYS_COUNTER_FREQ_IN_TICKS;
return read_cntfrq_el0();
}
/*******************************************************************************

View file

@ -301,11 +301,6 @@
#define PLAT_SDEI_NORMAL_PRI 0x70
#define PLAT_SDEI_SGI_PRIVATE QEMU_IRQ_SEC_SGI_0
/*
* System counter
*/
#define SYS_COUNTER_FREQ_IN_TICKS ((1000 * 1000 * 1000) / 16)
/*
* Maximum size of Event Log buffer used in Measured Boot Event Log driver
*/

View file

@ -266,11 +266,6 @@
#define PLAT_QEMU_DT_BASE NS_DRAM0_BASE
#define PLAT_QEMU_DT_MAX_SIZE 0x100000
/*
* System counter
*/
#define SYS_COUNTER_FREQ_IN_TICKS ((1000 * 1000 * 1000) / 16)
#if SPM_MM
#define PLAT_QEMU_SP_IMAGE_BASE BL_RAM_BASE
#define PLAT_QEMU_SP_IMAGE_SIZE ULL(0x300000)