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

[Xen-changelog] [xen master] arm: add a function to invoke the PSCI handler



commit 3702d92fe4540f52032281c88182e48962c08f57
Author:     Andre Przywara <andre.przywara@xxxxxxxxxx>
AuthorDate: Thu Dec 5 11:08:10 2013 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Thu Dec 5 12:25:13 2013 +0000

    arm: add a function to invoke the PSCI handler
    
    The PSCI handler is invoked via a secure monitor call with the
    arguments defined in registers. Copy the function from the
    Linux code and adjust it to work on both ARM32 and ARM64.
    
    Signed-off-by: Andre Przywara <andre.przywara@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 xen/arch/arm/psci.c        |   30 ++++++++++++++++++++++++++++++
 xen/include/asm-arm/psci.h |    1 +
 2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/xen/arch/arm/psci.c b/xen/arch/arm/psci.c
index efb514e..25a8697 100644
--- a/xen/arch/arm/psci.c
+++ b/xen/arch/arm/psci.c
@@ -25,8 +25,38 @@
 
 bool_t psci_available;
 
+#ifdef CONFIG_ARM_32
+#define REG_PREFIX "r"
+#else
+#define REG_PREFIX "x"
+#endif
+
+static noinline int __invoke_psci_fn_smc(register_t function_id,
+                                         register_t arg0,
+                                         register_t arg1,
+                                         register_t arg2)
+{
+    asm volatile(
+        __asmeq("%0", REG_PREFIX"0")
+        __asmeq("%1", REG_PREFIX"1")
+        __asmeq("%2", REG_PREFIX"2")
+        __asmeq("%3", REG_PREFIX"3")
+        "smc #0"
+        : "+r" (function_id)
+        : "r" (arg0), "r" (arg1), "r" (arg2));
+
+    return function_id;
+}
+
+#undef REG_PREFIX
+
 static uint32_t psci_cpu_on_nr;
 
+int call_psci_cpu_on(int cpu)
+{
+    return __invoke_psci_fn_smc(psci_cpu_on_nr, cpu, __pa(init_secondary), 0);
+}
+
 int __init psci_init(void)
 {
     const struct dt_device_node *psci;
diff --git a/xen/include/asm-arm/psci.h b/xen/include/asm-arm/psci.h
index 36ce87d..189964b 100644
--- a/xen/include/asm-arm/psci.h
+++ b/xen/include/asm-arm/psci.h
@@ -10,6 +10,7 @@
 extern bool_t psci_available;
 
 int psci_init(void);
+int call_psci_cpu_on(int cpu);
 
 /* functions to handle guest PSCI requests */
 int do_psci_cpu_on(uint32_t vcpuid, register_t entry_point);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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