Pass the timer clock-frequency to DOM0 xen/arm: Pass the timer "clock-frequency" to DOM0 in make_timer_node()
PATCH v3 1/1 Pass the timer clock-frequency to DOM0 xen/arm: Pass the timer "clock-frequency" to DOM0 in make_timer_node()
If the DT representing the ARM generic timer mentions a clock-frequency, propragate it to the DT that is built for DOM0.
This is necessary as a workaround for boards (Odroid-XU) where CNTFRQ is not set or returns a wrong value.
Ideally CNTFRQ should be set by the boot loader. The bootloader should respect the ARM ARM (see B.8.1.1):
"The CNTFRQ register is UNKNOWN at reset, and therefore the counter frequency must written to CNTFRQ as part of the system boot process."
For the Odroid-XU the SPL BL2 code is entered in NS HYP mode which prevents the execution of the mcr call to set CNTFRQ.
---
Changed since v2:
* Gather all changes in one place.
* Added additional comments
Changed since v1:
* Fix typo for quotes around clock-frequency.
--- xen/arch/arm/domain_build.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
xen/arch/arm/domain_build.c +11 -0
@@ -622,6 +622,8 @@ static int make_timer_node(const struct domain *d, void *fdt,int res;const struct dt_irq *irq;gic_interrupt_t intrs[3 ]; +u32 clock_frequency; +bool_t clock_valid;DPRINT ("Create timer node\n" );
@@ -663,6 +665,15 @@ static int make_timer_node(const struct domain *d, void *fdt,if ( res )return res; + clock_valid =dt_property_read_u32 (dev,"clock-frequency" , + &clock_frequency); +if (clock_valid) + { + res =fdt_property_cell (fdt,"clock-frequency" , clock_frequency); +if ( res ) +return res; + } + res =fdt_end_node (fdt);return res;
Signature · 1 line
1.8.3.2
Hello Suriyan,
Thank you for the patch.
Quoted 41 lines · Suriyan Ramasami
If the DT representing the ARM generic timer mentions a clock-frequency, propragate it to the DT that is built for DOM0.
This is necessary as a workaround for boards (Odroid-XU) where CNTFRQ is not set or returns a wrong value.
Ideally CNTFRQ should be set by the boot loader. The bootloader should respect the ARM ARM (see B.8.1.1):
"The CNTFRQ register is UNKNOWN at reset, and therefore the counter frequency must written to CNTFRQ as part of the system boot process."For the Odroid-XU the SPL BL2 code is entered in NS HYP mode which prevents the execution of the mcr call to set CNTFRQ.
Signed-off-by Suriyan Ramasami <[email protected]>---
Changed since v2:
* Gather all changes in one place.
* Added additional commentsChanged since v1:
* Fix typo for quotes around clock-frequency.--- xen/arch/arm/domain_build.c | 11 +++++++++++ 1 file changed, 11 insertions(+)xen/arch/arm/domain_build.c +2
-0@@ -622,6 +622,8 @@ static int make_timer_node(const struct domain *d, void *fdt,int res;const struct dt_irq *irq;gic_interrupt_t intrs[3 ]; +u32 clock_frequency; +bool_t clock_valid;DPRINT ("Create timer node\n" );
xen/arch/arm/domain_build.c static int make_timer_node(const struct domain *d, void *fdt, · line 670
Quoted 6 lines
xen/arch/arm/domain_build.c +3
-0@@ -663,6 +665,15 @@ static int make_timer_node(const struct domain *d, void *fdt,if ( res )return res; + clock_valid =dt_property_read_u32 (dev,"clock-frequency" , + &clock_frequency); +if (clock_valid)
On Xen, the coding style request if to be:
if ( clock_valid )
With this change:
Regards,
Signature · 1 line
Julien Grall
Quoted 5 lines · Julien Grall
xen/arch/arm/domain_build.c static int make_timer_node(const struct domain *d, void *fdt, · line 670
Quoted 4 lines
xen/arch/arm/domain_build.c +3
-0+ clock_valid =dt_property_read_u32 (dev,"clock-frequency" , + &clock_frequency); +if (clock_valid)
Quoted 7 lines
On Xen, the coding style request if to be:
if (
clock_valid)With this change:
Reviewed-by Julien Grall <[email protected]>
Acked + applied with the coding style fix.
Ian.