]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
xen/arm: Add support of PSCI v1.0 for the host
authorJulien Grall <julien.grall@citrix.com>
Mon, 12 Oct 2015 15:39:11 +0000 (16:39 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 23 Oct 2015 13:31:36 +0000 (14:31 +0100)
From Xen's point of view, PSCI v0.2 and PSCI v1.0 are very similar. All
the PSCI calls used within Xen (PSCI_VERSION, CPU_ON, SYSTEM_OFF and
SYSTEM_RESET) behave exactly the same.

Furthermore, based on the spec (5.3.1 DEN0022C), any 1.y version must be
compatible with 1.x when y > x for any functions existing in 1.x.

So check the presence of the new compatible string [1] and allow Xen to
boot on any platform using PSCI 1.x.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2015-October/374547.html

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/psci.c
xen/include/asm-arm/psci.h

index 172c6e723775c69877fbb3cc740c152b129155a5..44ccc2f6fae5155b565fed51f5819c4de452ac3b 100644 (file)
@@ -109,10 +109,16 @@ int __init psci_init_0_1(void)
 
 int __init psci_init_0_2(void)
 {
+    static const struct dt_device_match psci_ids[] __initconst =
+    {
+        DT_MATCH_COMPATIBLE("arm,psci-0.2"),
+        DT_MATCH_COMPATIBLE("arm,psci-1.0"),
+        { /* sentinel */ },
+    };
     int ret;
     const struct dt_device_node *psci;
 
-    psci = dt_find_compatible_node(NULL, NULL, "arm,psci-0.2");
+    psci = dt_find_matching_node(NULL, psci_ids);
     if ( !psci )
         return -EOPNOTSUPP;
 
@@ -122,15 +128,18 @@ int __init psci_init_0_2(void)
 
     psci_ver = call_smc(PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0);
 
-    if ( psci_ver != XEN_PSCI_V_0_2 )
+    /* For the moment, we only support PSCI 0.2 and PSCI 1.x */
+    if ( psci_ver != PSCI_VERSION(0, 2) && PSCI_VERSION_MAJOR(psci_ver != 1) )
     {
-        printk("Error: PSCI version %#x is not supported.\n", psci_ver);
+        printk("Error: Unrecognized PSCI version %u.%u\n",
+               PSCI_VERSION_MAJOR(psci_ver), PSCI_VERSION_MINOR(psci_ver));
         return -EOPNOTSUPP;
     }
 
     psci_cpu_on_nr = PSCI_0_2_FN_NATIVE(CPU_ON);
 
-    printk(XENLOG_INFO "Using PSCI-0.2 for SMP bringup\n");
+    printk(XENLOG_INFO "Using PSCI-%u.%u for SMP bringup\n",
+           PSCI_VERSION_MAJOR(psci_ver), PSCI_VERSION_MINOR(psci_ver));
 
     return 0;
 }
index 5d17ee32ccd67a174c4650ff640d4ebe982b7f93..d8a109fa734cc44568aee1db826bceb866bfbdf2 100644 (file)
@@ -87,6 +87,19 @@ void do_psci_0_2_system_reset(void);
 #define PSCI_0_2_POWER_STATE_TYPE_MASK      \
                     (0x1 << PSCI_0_2_POWER_STATE_TYPE_SHIFT)
 
+/* PSCI version decoding (independent of PSCI version) */
+#define PSCI_VERSION_MAJOR_SHIFT            16
+#define PSCI_VERSION_MINOR_MASK             \
+        ((1U << PSCI_VERSION_MAJOR_SHIFT) - 1)
+#define PSCI_VERSION_MAJOR_MASK             ~PSCI_VERSION_MINOR_MASK
+#define PSCI_VERSION_MAJOR(ver)             \
+        (((ver) & PSCI_VERSION_MAJOR_MASK) >> PSCI_VERSION_MAJOR_SHIFT)
+#define PSCI_VERSION_MINOR(ver)             \
+        ((ver) & PSCI_VERSION_MINOR_MASK)
+
+#define PSCI_VERSION(major, minor)          \
+    (((major) << PSCI_VERSION_MAJOR_SHIFT) | (minor))
+
 #endif /* __ASM_PSCI_H__ */
 
 /*