[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 2/2] xen/arm: Replace XEN_PSCI_* by PSCI_VERSION(major, minor)



It will avoid to introduce a new XEN_PSCI_* define every time we support
a new version of PSCI in Xen.

Also fix the coding style in modified place.

Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx>
---
 xen/arch/arm/psci.c        |  6 +++---
 xen/arch/arm/vpsci.c       | 15 ++++++++-------
 xen/include/asm-arm/psci.h |  4 ----
 3 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/xen/arch/arm/psci.c b/xen/arch/arm/psci.c
index 53ee2e4..ae3df47 100644
--- a/xen/arch/arm/psci.c
+++ b/xen/arch/arm/psci.c
@@ -46,13 +46,13 @@ int call_psci_cpu_on(int cpu)
 
 void call_psci_system_off(void)
 {
-    if ( psci_ver > XEN_PSCI_V_0_1 )
+    if ( psci_ver > PSCI_VERSION(0, 1) )
         call_smc(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0);
 }
 
 void call_psci_system_reset(void)
 {
-    if ( psci_ver > XEN_PSCI_V_0_1 )
+    if ( psci_ver > PSCI_VERSION(0, 1) )
         call_smc(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);
 }
 
@@ -100,7 +100,7 @@ int __init psci_init_0_1(void)
         return -ENOENT;
     }
 
-    psci_ver = XEN_PSCI_V_0_1;
+    psci_ver = PSCI_VERSION(0, 1);
 
     printk(XENLOG_INFO "Using PSCI-0.1 for SMP bringup\n");
 
diff --git a/xen/arch/arm/vpsci.c b/xen/arch/arm/vpsci.c
index aebe1e2..0e024f7 100644
--- a/xen/arch/arm/vpsci.c
+++ b/xen/arch/arm/vpsci.c
@@ -41,8 +41,8 @@ static int do_common_cpu_on(register_t target_cpu, register_t 
entry_point,
     if ( is_64bit_domain(d) && is_thumb )
         return PSCI_INVALID_PARAMETERS;
 
-    if( ( ver == XEN_PSCI_V_0_2 ) &&
-            ( !test_bit(_VPF_down, &v->pause_flags) ) )
+    if ( (ver == PSCI_VERSION(0, 2)) &&
+            !test_bit(_VPF_down, &v->pause_flags) )
         return PSCI_ALREADY_ON;
 
     if ( (ctxt = alloc_vcpu_guest_context()) == NULL )
@@ -59,14 +59,14 @@ static int do_common_cpu_on(register_t target_cpu, 
register_t entry_point,
     if ( is_32bit_domain(d) )
     {
         ctxt->user_regs.cpsr = PSR_GUEST32_INIT;
-        if( ver == XEN_PSCI_V_0_2 )
+        if ( ver == PSCI_VERSION(0, 2) )
             ctxt->user_regs.r0_usr = context_id;
     }
 #ifdef CONFIG_ARM_64
     else
     {
         ctxt->user_regs.cpsr = PSR_GUEST64_INIT;
-        if( ver == XEN_PSCI_V_0_2 )
+        if ( ver == PSCI_VERSION(0, 2) )
             ctxt->user_regs.x0 = context_id;
     }
 #endif
@@ -94,7 +94,7 @@ static int do_common_cpu_on(register_t target_cpu, register_t 
entry_point,
 
 int32_t do_psci_cpu_on(uint32_t vcpuid, register_t entry_point)
 {
-    return do_common_cpu_on(vcpuid,entry_point,0,XEN_PSCI_V_0_1);
+    return do_common_cpu_on(vcpuid, entry_point, 0 , PSCI_VERSION(0, 1));
 }
 
 int32_t do_psci_cpu_off(uint32_t power_state)
@@ -107,7 +107,7 @@ int32_t do_psci_cpu_off(uint32_t power_state)
 
 uint32_t do_psci_0_2_version(void)
 {
-    return XEN_PSCI_V_0_2;
+    return PSCI_VERSION(0, 2);
 }
 
 register_t do_psci_0_2_cpu_suspend(uint32_t power_state, register_t 
entry_point,
@@ -132,7 +132,8 @@ int32_t do_psci_0_2_cpu_off(void)
 int32_t do_psci_0_2_cpu_on(register_t target_cpu, register_t entry_point,
                        register_t context_id)
 {
-    return do_common_cpu_on(target_cpu,entry_point,context_id,XEN_PSCI_V_0_2);
+    return do_common_cpu_on(target_cpu, entry_point, context_id,
+                            PSCI_VERSION(0, 2));
 }
 
 static const unsigned long target_affinity_mask[] = {
diff --git a/xen/include/asm-arm/psci.h b/xen/include/asm-arm/psci.h
index d8a109f..be2458a 100644
--- a/xen/include/asm-arm/psci.h
+++ b/xen/include/asm-arm/psci.h
@@ -41,10 +41,6 @@ register_t do_psci_0_2_migrate_info_up_cpu(void);
 void do_psci_0_2_system_off(void);
 void do_psci_0_2_system_reset(void);
 
-/* PSCI version */
-#define XEN_PSCI_V_0_1 1
-#define XEN_PSCI_V_0_2 2
-
 /* PSCI v0.2 interface */
 #define PSCI_0_2_FN_BASE        0x84000000
 #define PSCI_0_2_FN(n)          (PSCI_0_2_FN_BASE + (n))
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.