Re: Where is the cntfrq_el0 register set for arm64 virt machine?

2022-03-22 Thread Peter Maydell
On Tue, 22 Mar 2022 at 06:42, Chan Kim  wrote:
>
> Hi,
>
> It may not be important but I'm trying to make the linux boot log the same
> for qemu direct kernel loading and loading by u-boot.
> In armv8 the cntfrq_el0 register is supposed to be written with the system
> counter frequency. The armv8 manual says it doesn't affect the hardware
> operation and it's just for S/W to know the frequency. U-boot program writes
> to that register with COUNTER_FREQUENCY value, when it's defined. In current
> armv8 virt machine, it's read as 62.5MHz but I coulnd't find where in the
> source the value is written. Where should I change to value in the qemu
> source?

If you want to model a board with a different CNTFRQ frequency
you should set the "cntfrq" property on the CPU object(s), which
will then cause the reset CNTFRQ_EL0 to be set accordingly,
and more importantly will mean the CPU generic timers actually
run at that frequency.
hw/arm/aspeed_ast2600.c is an example SoC that does this.

(QEMU provides a reset value for this register for when it's
directly booting a kernel -- in real hardware the firmware is
supposed to set the value, but when QEMU direct-boots a kernel
it's QEMU that's doing some of the jobs firmware would do.)

-- PMM



Where is the cntfrq_el0 register set for arm64 virt machine?

2022-03-22 Thread Chan Kim
Hi,

It may not be important but I'm trying to make the linux boot log the same
for qemu direct kernel loading and loading by u-boot.
In armv8 the cntfrq_el0 register is supposed to be written with the system
counter frequency. The armv8 manual says it doesn't affect the hardware
operation and it's just for S/W to know the frequency. U-boot program writes
to that register with COUNTER_FREQUENCY value, when it's defined. In current
armv8 virt machine, it's read as 62.5MHz but I coulnd't find where in the
source the value is written. Where should I change to value in the qemu
source? 
Thank you.

Chan Kim