diff mbox

[Xen-devel,10/10] xen/arm: Handle different bootwrapper locations for Hip04 platform

Message ID 1415009522-6344-11-git-send-email-frediano.ziglio@huawei.com
State New
Headers show

Commit Message

Frediano Ziglio Nov. 3, 2014, 10:12 a.m. UTC
From: Zoltan Kiss <zoltan.kiss@linaro.org>

Signed-off-by: Zoltan Kiss <zoltan.kiss@huawei.com>
---
 xen/arch/arm/platforms/hip04.c | 63 ++++++++++++++++++++++++++----------------
 1 file changed, 39 insertions(+), 24 deletions(-)

Comments

Julien Grall Nov. 3, 2014, 2:13 p.m. UTC | #1
Hi Frediano,

This could be merged in #1.

Regards,

On 11/03/2014 10:12 AM, Frediano Ziglio wrote:
> From: Zoltan Kiss <zoltan.kiss@linaro.org>
> 
> Signed-off-by: Zoltan Kiss <zoltan.kiss@huawei.com>
> ---
>  xen/arch/arm/platforms/hip04.c | 63 ++++++++++++++++++++++++++----------------
>  1 file changed, 39 insertions(+), 24 deletions(-)
> 
> diff --git a/xen/arch/arm/platforms/hip04.c b/xen/arch/arm/platforms/hip04.c
> index 024c8a0..dec4984 100644
> --- a/xen/arch/arm/platforms/hip04.c
> +++ b/xen/arch/arm/platforms/hip04.c
> @@ -136,7 +136,7 @@ static void hip04_cluster_up(unsigned int cluster)
>  
>  static int __init hip04_smp_init(void)
>  {
> -    struct dt_device_node *np, *np_fab;
> +    struct dt_device_node *np, *np_fab, *bw;
>      const char *msg;
>      u64 addr, size;
>  
> @@ -150,30 +150,45 @@ static int __init hip04_smp_init(void)
>      if ( !np_fab )
>          goto err;
>  
> -    msg = "failed to get bootwrapper-phys\n";
>      if ( !dt_property_read_u32(np, "bootwrapper-phys",
> -                               &hip04_boot.bootwrapper_phys) )
> -        goto err;
> -
> -    msg = "failed to get bootwrapper-size\n";
> -    if ( !dt_property_read_u32(np, "bootwrapper-size",
> -                               &hip04_boot.bootwrapper_size) )
> -        goto err;
> -
> -    msg = "failed to get bootwrapper-magic\n";
> -    if ( !dt_property_read_u32(np, "bootwrapper-magic",
> -                               &hip04_boot.bootwrapper_magic) )
> -        goto err;
> -
> -    msg = "failed to get relocation-entry\n";
> -    if ( !dt_property_read_u32(np, "relocation-entry",
> -                               &hip04_boot.relocation_entry) )
> -        goto err;
> -
> -    msg = "failed to get relocation-size\n";
> -    if ( !dt_property_read_u32(np, "relocation-size",
> -                 &hip04_boot.relocation_size) )
> -        goto err;
> +                               &hip04_boot.bootwrapper_phys) ) {
> +        u32 boot_method[4];
> +        bw = dt_find_compatible_node(NULL, NULL, "hisilicon,hip04-bootwrapper");
> +        msg = "hisilicon,hip04-bootwrapper missing in DT\n";
> +        if ( !bw )
> +            goto err;
> +
> +        msg = "failed to get boot-method\n";
> +        if ( !dt_property_read_u32_array(bw, "boot-method", boot_method, 4) )
> +            goto err;
> +        hip04_boot.bootwrapper_phys = boot_method[0];
> +        hip04_boot.bootwrapper_size = boot_method[1];
> +        hip04_boot.bootwrapper_magic = 0xa5a5a5a5;
> +        hip04_boot.relocation_entry = boot_method[2];
> +        hip04_boot.relocation_size = boot_method[3];
> +    }
> +    else
> +    {
> +        msg = "failed to get bootwrapper-size\n";
> +        if ( !dt_property_read_u32(np, "bootwrapper-size",
> +                                   &hip04_boot.bootwrapper_size) )
> +            goto err;
> +
> +        msg = "failed to get bootwrapper-magic\n";
> +        if ( !dt_property_read_u32(np, "bootwrapper-magic",
> +                                   &hip04_boot.bootwrapper_magic) )
> +            goto err;
> +
> +        msg = "failed to get relocation-entry\n";
> +        if ( !dt_property_read_u32(np, "relocation-entry",
> +                                   &hip04_boot.relocation_entry) )
> +            goto err;
> +
> +        msg = "failed to get relocation-size\n";
> +        if ( !dt_property_read_u32(np, "relocation-size",
> +                                   &hip04_boot.relocation_size) )
> +            goto err;
> +    }
>  
>      relocation = ioremap_nocache(hip04_boot.relocation_entry,
>                                   hip04_boot.relocation_size);
>
Frediano Ziglio Nov. 3, 2014, 3:28 p.m. UTC | #2
> 
> Hi Frediano,
> 
> This could be merged in #1.
> 
> Regards,
> 

No, as it require the patch just before it so merging to #1 cause a commit that does not compile

Frediano

> On 11/03/2014 10:12 AM, Frediano Ziglio wrote:
> > From: Zoltan Kiss <zoltan.kiss@linaro.org>
> >
> > Signed-off-by: Zoltan Kiss <zoltan.kiss@huawei.com>
> > ---
> >  xen/arch/arm/platforms/hip04.c | 63
> > ++++++++++++++++++++++++++----------------
> >  1 file changed, 39 insertions(+), 24 deletions(-)
> >
> > diff --git a/xen/arch/arm/platforms/hip04.c
> > b/xen/arch/arm/platforms/hip04.c index 024c8a0..dec4984 100644
> > --- a/xen/arch/arm/platforms/hip04.c
> > +++ b/xen/arch/arm/platforms/hip04.c
> > @@ -136,7 +136,7 @@ static void hip04_cluster_up(unsigned int cluster)
> >
> >  static int __init hip04_smp_init(void)  {
> > -    struct dt_device_node *np, *np_fab;
> > +    struct dt_device_node *np, *np_fab, *bw;
> >      const char *msg;
> >      u64 addr, size;
> >
> > @@ -150,30 +150,45 @@ static int __init hip04_smp_init(void)
> >      if ( !np_fab )
> >          goto err;
> >
> > -    msg = "failed to get bootwrapper-phys\n";
> >      if ( !dt_property_read_u32(np, "bootwrapper-phys",
> > -                               &hip04_boot.bootwrapper_phys) )
> > -        goto err;
> > -
> > -    msg = "failed to get bootwrapper-size\n";
> > -    if ( !dt_property_read_u32(np, "bootwrapper-size",
> > -                               &hip04_boot.bootwrapper_size) )
> > -        goto err;
> > -
> > -    msg = "failed to get bootwrapper-magic\n";
> > -    if ( !dt_property_read_u32(np, "bootwrapper-magic",
> > -                               &hip04_boot.bootwrapper_magic) )
> > -        goto err;
> > -
> > -    msg = "failed to get relocation-entry\n";
> > -    if ( !dt_property_read_u32(np, "relocation-entry",
> > -                               &hip04_boot.relocation_entry) )
> > -        goto err;
> > -
> > -    msg = "failed to get relocation-size\n";
> > -    if ( !dt_property_read_u32(np, "relocation-size",
> > -                 &hip04_boot.relocation_size) )
> > -        goto err;
> > +                               &hip04_boot.bootwrapper_phys) ) {
> > +        u32 boot_method[4];
> > +        bw = dt_find_compatible_node(NULL, NULL, "hisilicon,hip04-
> bootwrapper");
> > +        msg = "hisilicon,hip04-bootwrapper missing in DT\n";
> > +        if ( !bw )
> > +            goto err;
> > +
> > +        msg = "failed to get boot-method\n";
> > +        if ( !dt_property_read_u32_array(bw, "boot-method",
> boot_method, 4) )
> > +            goto err;
> > +        hip04_boot.bootwrapper_phys = boot_method[0];
> > +        hip04_boot.bootwrapper_size = boot_method[1];
> > +        hip04_boot.bootwrapper_magic = 0xa5a5a5a5;
> > +        hip04_boot.relocation_entry = boot_method[2];
> > +        hip04_boot.relocation_size = boot_method[3];
> > +    }
> > +    else
> > +    {
> > +        msg = "failed to get bootwrapper-size\n";
> > +        if ( !dt_property_read_u32(np, "bootwrapper-size",
> > +                                   &hip04_boot.bootwrapper_size) )
> > +            goto err;
> > +
> > +        msg = "failed to get bootwrapper-magic\n";
> > +        if ( !dt_property_read_u32(np, "bootwrapper-magic",
> > +                                   &hip04_boot.bootwrapper_magic) )
> > +            goto err;
> > +
> > +        msg = "failed to get relocation-entry\n";
> > +        if ( !dt_property_read_u32(np, "relocation-entry",
> > +                                   &hip04_boot.relocation_entry) )
> > +            goto err;
> > +
> > +        msg = "failed to get relocation-size\n";
> > +        if ( !dt_property_read_u32(np, "relocation-size",
> > +                                   &hip04_boot.relocation_size) )
> > +            goto err;
> > +    }
> >
> >      relocation = ioremap_nocache(hip04_boot.relocation_entry,
> >                                   hip04_boot.relocation_size);
> >
> 
> 
> --
> Julien Grall
Julien Grall Nov. 3, 2014, 3:33 p.m. UTC | #3
On 11/03/2014 03:28 PM, Frediano Ziglio wrote:
>>
>> Hi Frediano,
>>
>> This could be merged in #1.
>>
>> Regards,
>>
> 
> No, as it require the patch just before it so merging to #1 cause a commit that does not compile

Why don't you move the patch #9 earlier in the patch series too?

Regards,
Frediano Ziglio Nov. 3, 2014, 3:36 p.m. UTC | #4
> On 11/03/2014 03:28 PM, Frediano Ziglio wrote:
> >>
> >> Hi Frediano,
> >>
> >> This could be merged in #1.
> >>
> >> Regards,
> >>
> >
> > No, as it require the patch just before it so merging to #1 cause a
> commit that does not compile
> 
> Why don't you move the patch #9 earlier in the patch series too?
> 
> Regards,
> 

So move patch #9 and #10 in another position? Looks ok, which position?

I did most of changes you requested. I was thinking to post another version with this last change.

The change suggested by Ian (do not use a quirk) is still in my TODO list as could be quite big.

I don't know which constant I should use for the 510 number.

Frediano
Julien Grall Nov. 3, 2014, 3:40 p.m. UTC | #5
On 11/03/2014 03:36 PM, Frediano Ziglio wrote:
>> On 11/03/2014 03:28 PM, Frediano Ziglio wrote:
>>>>
>>>> Hi Frediano,
>>>>
>>>> This could be merged in #1.
>>>>
>>>> Regards,
>>>>
>>>
>>> No, as it require the patch just before it so merging to #1 cause a
>> commit that does not compile
>>
>> Why don't you move the patch #9 earlier in the patch series too?
>>
>> Regards,
>>
> 
> So move patch #9 and #10 in another position? Looks ok, which position?

I would move #9 to the top of the list and merge #10 in the current #1.

> I did most of changes you requested. I was thinking to post another version with this last change.
> 
> The change suggested by Ian (do not use a quirk) is still in my TODO list as could be quite big.
> 
> I don't know which constant I should use for the 510 number.

The first one is not useful as it will catch buggy hardware, the second
could be replace by nr_lines.

So you could even drop the 2 510.
diff mbox

Patch

diff --git a/xen/arch/arm/platforms/hip04.c b/xen/arch/arm/platforms/hip04.c
index 024c8a0..dec4984 100644
--- a/xen/arch/arm/platforms/hip04.c
+++ b/xen/arch/arm/platforms/hip04.c
@@ -136,7 +136,7 @@  static void hip04_cluster_up(unsigned int cluster)
 
 static int __init hip04_smp_init(void)
 {
-    struct dt_device_node *np, *np_fab;
+    struct dt_device_node *np, *np_fab, *bw;
     const char *msg;
     u64 addr, size;
 
@@ -150,30 +150,45 @@  static int __init hip04_smp_init(void)
     if ( !np_fab )
         goto err;
 
-    msg = "failed to get bootwrapper-phys\n";
     if ( !dt_property_read_u32(np, "bootwrapper-phys",
-                               &hip04_boot.bootwrapper_phys) )
-        goto err;
-
-    msg = "failed to get bootwrapper-size\n";
-    if ( !dt_property_read_u32(np, "bootwrapper-size",
-                               &hip04_boot.bootwrapper_size) )
-        goto err;
-
-    msg = "failed to get bootwrapper-magic\n";
-    if ( !dt_property_read_u32(np, "bootwrapper-magic",
-                               &hip04_boot.bootwrapper_magic) )
-        goto err;
-
-    msg = "failed to get relocation-entry\n";
-    if ( !dt_property_read_u32(np, "relocation-entry",
-                               &hip04_boot.relocation_entry) )
-        goto err;
-
-    msg = "failed to get relocation-size\n";
-    if ( !dt_property_read_u32(np, "relocation-size",
-                 &hip04_boot.relocation_size) )
-        goto err;
+                               &hip04_boot.bootwrapper_phys) ) {
+        u32 boot_method[4];
+        bw = dt_find_compatible_node(NULL, NULL, "hisilicon,hip04-bootwrapper");
+        msg = "hisilicon,hip04-bootwrapper missing in DT\n";
+        if ( !bw )
+            goto err;
+
+        msg = "failed to get boot-method\n";
+        if ( !dt_property_read_u32_array(bw, "boot-method", boot_method, 4) )
+            goto err;
+        hip04_boot.bootwrapper_phys = boot_method[0];
+        hip04_boot.bootwrapper_size = boot_method[1];
+        hip04_boot.bootwrapper_magic = 0xa5a5a5a5;
+        hip04_boot.relocation_entry = boot_method[2];
+        hip04_boot.relocation_size = boot_method[3];
+    }
+    else
+    {
+        msg = "failed to get bootwrapper-size\n";
+        if ( !dt_property_read_u32(np, "bootwrapper-size",
+                                   &hip04_boot.bootwrapper_size) )
+            goto err;
+
+        msg = "failed to get bootwrapper-magic\n";
+        if ( !dt_property_read_u32(np, "bootwrapper-magic",
+                                   &hip04_boot.bootwrapper_magic) )
+            goto err;
+
+        msg = "failed to get relocation-entry\n";
+        if ( !dt_property_read_u32(np, "relocation-entry",
+                                   &hip04_boot.relocation_entry) )
+            goto err;
+
+        msg = "failed to get relocation-size\n";
+        if ( !dt_property_read_u32(np, "relocation-size",
+                                   &hip04_boot.relocation_size) )
+            goto err;
+    }
 
     relocation = ioremap_nocache(hip04_boot.relocation_entry,
                                  hip04_boot.relocation_size);