[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xen/arm: copy cpu clock-frequency to CPU DT node.



On Fri, 2013-11-01 at 16:58 -0400, Jon Fraser wrote:
> When creating the CPU DT node, copy the clock-frequency if present.
> 
> Signed-off-by: Jon Fraser <jfraser@xxxxxxxxxxxx>
> ---
>  xen/arch/arm/domain_build.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index c644be2..b212627 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -391,6 +391,7 @@ static int make_cpus_node(const struct domain *d, void 
> *fdt,
>      u32 len;
>      /* Placeholder for cpu@ + a 32-bit number + \0 */
>      char buf[15];
> +    u32 *clock_frequency;
>  
>      DPRINT("Create cpus node\n");
>  
> @@ -411,6 +412,7 @@ static int make_cpus_node(const struct domain *d, void 
> *fdt,
>          if ( dt_device_type_is_equal(npcpu, "cpu") )
>          {
>              compatible = dt_get_property(npcpu, "compatible", &len);
> +            clock_frequency = (u32 *)dt_get_property(npcpu, 
> "clock-frequency", NULL);

Julien's the expert but I think you need to use dt_property_read_u32
here, to get the correct endianness conversion (as well as for pure
forms sake of using the correct API for the job).

>              break;
>          }
>      }
> @@ -457,6 +459,12 @@ static int make_cpus_node(const struct domain *d, void 
> *fdt,
>          if ( res )
>              return res;
>  
> +        if (clock_frequency) {
> +            res = fdt_property_cell(fdt, "clock-frequency", *(u32 
> *)clock_frequency);

I suppose there ought to be some API for this side of things too, but I
can't see it right now...

Note that fdt_property_cell contains a cpu_to_fdt32 so it is converting
while the read of the property not, so I think the code is broken as is?

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.