xen/arm: gic-v3: Bail out if gicv3_cpu_init fail
authorJulien Grall <julien.grall@arm.com>
Wed, 6 Dec 2017 14:51:37 +0000 (14:51 +0000)
committerStefano Stabellini <sstabellini@kernel.org>
Fri, 8 Dec 2017 21:17:38 +0000 (13:17 -0800)
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.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/gic-v3.c

index 473e26111f23d286ac528b8935da255074f63077..a0d290b55c12ec32e1007c253bd9e7083a3b71da 100644 (file)
@@ -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;