All of lore.kernel.org
 help / color / mirror / Atom feed
* [ARM:PATCH v3 1/1] Pass the timer clock-frequency to DOM0 xen/arm: Pass the timer "clock-frequency" to DOM0 in make_timer_node()
@ 2014-04-14  8:14 Suriyan Ramasami
  2014-04-15 19:30 ` Julien Grall
  0 siblings, 1 reply; 3+ messages in thread
From: Suriyan Ramasami @ 2014-04-14  8:14 UTC (permalink / raw)
  To: julien.grall
  Cc: Suriyan Ramasami, xen-devel, tim, Ian.Campbell, stefano.stabellini

    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 <suriyan.r@gmail.com>

---
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(+)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 502db84..a86d756 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -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;
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [ARM:PATCH v3 1/1] Pass the timer clock-frequency to DOM0 xen/arm: Pass the timer "clock-frequency" to DOM0 in make_timer_node()
  2014-04-14  8:14 [ARM:PATCH v3 1/1] Pass the timer clock-frequency to DOM0 xen/arm: Pass the timer "clock-frequency" to DOM0 in make_timer_node() Suriyan Ramasami
@ 2014-04-15 19:30 ` Julien Grall
  2014-04-16 16:32   ` Ian Campbell
  0 siblings, 1 reply; 3+ messages in thread
From: Julien Grall @ 2014-04-15 19:30 UTC (permalink / raw)
  To: Suriyan Ramasami; +Cc: xen-devel, tim, Ian.Campbell, stefano.stabellini

Hello Suriyan,

Thank you for the patch.

On 04/14/2014 09:14 AM, Suriyan Ramasami wrote:
>     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 <suriyan.r@gmail.com>
> 
> ---
> 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(+)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 502db84..a86d756 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -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)

On Xen, the coding style request if to be:

if ( clock_valid )

With this change:

Reviewed-by: Julien Grall <julien.grall@linaro.org>

Regards,

-- 
Julien Grall

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ARM:PATCH v3 1/1] Pass the timer clock-frequency to DOM0 xen/arm: Pass the timer "clock-frequency" to DOM0 in make_timer_node()
  2014-04-15 19:30 ` Julien Grall
@ 2014-04-16 16:32   ` Ian Campbell
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Campbell @ 2014-04-16 16:32 UTC (permalink / raw)
  To: Julien Grall; +Cc: Suriyan Ramasami, xen-devel, tim, stefano.stabellini

On Tue, 2014-04-15 at 20:30 +0100, Julien Grall wrote:
>  
> > +    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:
> 
> Reviewed-by: Julien Grall <julien.grall@linaro.org>

Acked + applied with the coding style fix.

Ian.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-16 16:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-14  8:14 [ARM:PATCH v3 1/1] Pass the timer clock-frequency to DOM0 xen/arm: Pass the timer "clock-frequency" to DOM0 in make_timer_node() Suriyan Ramasami
2014-04-15 19:30 ` Julien Grall
2014-04-16 16:32   ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.