Skip to contentSkip to conversation

xen/arm: gic-v3: Bail out if gicv3_cpu_init fail

PATCH In review Julien Grall 2 participants 4 messages Dec 6, 2017 – Dec 8, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: gic-v3: Bail out if gicv3_cpu_init fail

From: Julien Grall <[email protected]>

When system registers are not enabled, all the access to them will trap in EL2. In Xen, system registers will be enabled by gicv3_cpu_init only on success. As the rest of the code (e.g gicv3_hyp_init) relies on system register, it is better to bail out directly.

This will save time on debugging early boot issue on GICv3 platform.

---

This makes easier to debug early boot issue on GICv3 platform. It would be worth considering to backport it.

---
 xen/arch/arm/gic-v3.c | 8 ++++++++
 1 file changed, 8 insertions(+)
xen/arch/arm/gic-v3.c +8 -0
index 473e26111f..a0d290b55c 100644
@@ -847,8 +847,12 @@ static int gicv3_secondary_cpu_init(void)
     spin_lock(&gicv3.lock);
 
     res = gicv3_cpu_init();
+    if ( res )
+        goto out;
+
     gicv3_hyp_init();
 
+out:
     spin_unlock(&gicv3.lock);
 
     return res;
@@ -1705,8 +1709,12 @@ static int __init gicv3_init(void)
         panic("GICv3: ITS: initialization failed: %d\n", res);
 
     res = gicv3_cpu_init();
+    if ( res )
+        goto out;
+
     gicv3_hyp_init();
 
+out:
     spin_unlock(&gicv3.lock);
 
     return res;
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Julien Grall

From: Julien Grall <[email protected]>

When system registers are not enabled, all the access to them will trap

^ accesses

Quoted 7 lines

in EL2. In Xen, system registers will be enabled by gicv3_cpu_init only on success. As the rest of the code (e.g gicv3_hyp_init) relies on system register, it is better to bail out directly.

This will save time on debugging early boot issue on GICv3 platform.

This is good:

Do we also want to print a warning or an error message?

Quoted 41 lines

---

This makes easier to debug early boot issue on GICv3 platform. It would be worth considering to backport it.

---
 xen/arch/arm/gic-v3.c | 8 ++++++++
 1 file changed, 8 insertions(+)
xen/arch/arm/gic-v3.c +8 -0
index 473e26111f..a0d290b55c 100644
@@ -847,8 +847,12 @@ static int gicv3_secondary_cpu_init(void)
     spin_lock(&gicv3.lock);
 
     res = gicv3_cpu_init();
+    if ( res )
+        goto out;
+
     gicv3_hyp_init();
 
+out:
     spin_unlock(&gicv3.lock);
 
     return res;
@@ -1705,8 +1709,12 @@ static int __init gicv3_init(void)
         panic("GICv3: ITS: initialization failed: %d\n", res);
 
     res = gicv3_cpu_init();
+    if ( res )
+        goto out;
+
     gicv3_hyp_init();
 
+out:
     spin_unlock(&gicv3.lock);
 
     return res;
Signature · 1 line
2.11.0

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw

Hi Stefano,

Quoted 13 lines · Stefano Stabellini
Quoted 3 lines · Julien Grall

From: Julien Grall <[email protected]>

When system registers are not enabled, all the access to them will trap

^ accesses

Quoted 6 lines

in EL2. In Xen, system registers will be enabled by gicv3_cpu_init only on success. As the rest of the code (e.g gicv3_hyp_init) relies on system register, it is better to bail out directly.

This will save time on debugging early boot issue on GICv3 platform.

Quoted 8 lines
Quoted 1 line

This is good:

Do we also want to print a warning or an error message?

AFAICT, all the path that return an error in gicv3_cpu_init (and the callers) have already a warning/error message. So no need to add an extra one here.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#3 lore raw
Quoted 20 lines · Julien Grall

Hi Stefano,

Quoted 17 lines · Stefano Stabellini
Quoted 3 lines · Julien Grall

From: Julien Grall <[email protected]>

When system registers are not enabled, all the access to them will trap

^ accesses

Quoted 7 lines

in EL2. In Xen, system registers will be enabled by gicv3_cpu_init only on success. As the rest of the code (e.g gicv3_hyp_init) relies on system register, it is better to bail out directly.

This will save time on debugging early boot issue on GICv3 platform.

This is good:

Quoted 7 lines
Quoted 4 lines

Do we also want to print a warning or an error message?

AFAICT, all the path that return an error in gicv3_cpu_init (and the callers) have already a warning/error message. So no need to add an extra one here.

committed

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel