]> xenbits.xensource.com Git - people/liuw/xen.git/commitdiff
arm/timer: fix panic when booting with DT
authorShannon Zhao <shannon.zhao@linaro.org>
Fri, 4 Mar 2016 15:45:52 +0000 (16:45 +0100)
committerWei Liu <wei.liu2@citrix.com>
Tue, 15 Mar 2016 16:32:34 +0000 (16:32 +0000)
While to support ACPI, patch "arm/acpi: Parse GTDT to initialize timer"
refactors the functions preinit_xen_time and init_xen_time. But it
wrongly moves the platform_get_irq from init_xen_time to
preinit_dt_xen_time and this will cause booting failure.

So move platform_get_irq back to init_xen_time to fix it.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
xen/arch/arm/time.c

index 5f8f974788a3d05df5f0f7013ff3fe703b789243..7dae28bfd08422a664e4b05e38a2b48e0e81e5b7 100644 (file)
@@ -119,7 +119,6 @@ static void __init preinit_dt_xen_time(void)
     };
     int res;
     u32 rate;
-    unsigned int i;
 
     timer = dt_find_matching_node(NULL, timer_ids);
     if ( !timer )
@@ -133,16 +132,6 @@ static void __init preinit_dt_xen_time(void)
         cpu_khz = rate / 1000;
         timer_dt_clock_frequency = rate;
     }
-
-    /* Retrieve all IRQs for the timer */
-    for ( i = TIMER_PHYS_SECURE_PPI; i < MAX_TIMER_PPI; i++ )
-    {
-        res = platform_get_irq(timer, i);
-
-        if ( res < 0 )
-            panic("Timer: Unable to retrieve IRQ %u from the device tree", i);
-        timer_irq[i] = res;
-    }
 }
 
 void __init preinit_xen_time(void)
@@ -165,9 +154,28 @@ void __init preinit_xen_time(void)
     boot_count = READ_SYSREG64(CNTPCT_EL0);
 }
 
+static void __init init_dt_xen_time(void)
+{
+    int res;
+    unsigned int i;
+
+    /* Retrieve all IRQs for the timer */
+    for ( i = TIMER_PHYS_SECURE_PPI; i < MAX_TIMER_PPI; i++ )
+    {
+        res = platform_get_irq(timer, i);
+
+        if ( res < 0 )
+            panic("Timer: Unable to retrieve IRQ %u from the device tree", i);
+        timer_irq[i] = res;
+    }
+}
+
 /* Set up the timer on the boot CPU (late init function) */
 int __init init_xen_time(void)
 {
+    if ( acpi_disabled )
+        init_dt_xen_time();
+
     /* Check that this CPU supports the Generic Timer interface */
     if ( !cpu_has_gentimer )
         panic("CPU does not support the Generic Timer v1 interface");