xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: xen-devel@lists.xen.org
Cc: edgar.iglesias@xilinx.com, julien.grall@arm.com, sstabellini@kernel.org
Subject: [RFC v2 4/6] xen/arm: Introduce call_smcc64
Date: Tue,  7 Feb 2017 20:42:03 +0100	[thread overview]
Message-ID: <1486496525-14637-5-git-send-email-edgar.iglesias@gmail.com> (raw)
In-Reply-To: <1486496525-14637-1-git-send-email-edgar.iglesias@gmail.com>

From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>

Introduce call_smcc64, a helper function to issue 64-bit SMC
calls that follow the SMC Calling Convention. This includes
returning up to 4 64-bit values.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 xen/include/asm-arm/processor.h | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index afc0e9a..a604f8c 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -706,6 +706,46 @@ void vcpu_regs_user_to_hyp(struct vcpu *vcpu,
 int call_smc(register_t function_id, register_t arg0, register_t arg1,
              register_t arg2);
 
+/*
+ * Helper to issue a 64-bit SMC according to the SMC Calling Convention.
+ *
+ * @fid:      Function Identifier
+ * @a0 - a5:  6 arguments
+ * @ret:      Pointer to 4 register_t carrying return values
+ */
+static inline register_t call_smcc64(register_t fid,
+                                     register_t a0,
+                                     register_t a1,
+                                     register_t a2,
+                                     register_t a3,
+                                     register_t a4,
+                                     register_t a5,
+                                     register_t *ret)
+{
+    register register_t x0 asm("x0") = fid;
+    register register_t x1 asm("x1") = a0;
+    register register_t x2 asm("x2") = a1;
+    register register_t x3 asm("x3") = a2;
+    register register_t x4 asm("x4") = a3;
+    register register_t x5 asm("x5") = a4;
+    register register_t x6 asm("x6") = a5;
+
+    asm volatile ("smc #0\n"
+                  : "+r" (x0), "+r" (x1), "+r" (x2), "+r" (x3),
+                    "+r" (x4), "+r" (x5), "+r" (x6)
+                  :
+                  : "x7", "x8", "x9", "x10", "x11", "x12",
+                    "x13", "x14", "x15", "x16", "x17" );
+
+    if (ret) {
+        ret[0] = x0;
+        ret[1] = x1;
+        ret[2] = x2;
+        ret[3] = x3;
+    }
+    return x0;
+}
+
 void do_trap_guest_error(struct cpu_user_regs *regs);
 
 #endif /* __ASSEMBLY__ */
-- 
2.7.4


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

  parent reply	other threads:[~2017-02-07 19:42 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07 19:41 [RFC v2 0/6] zynqmp: Add forwarding of platform specific firmware calls Edgar E. Iglesias
2017-02-07 19:42 ` [RFC v2 1/6] xen/arm: traps: Reorder early overwrite of FID Edgar E. Iglesias
2017-02-13 22:06   ` Stefano Stabellini
2017-02-07 19:42 ` [RFC v2 2/6] xen/arm: Introduce platform_hvc Edgar E. Iglesias
2017-02-13 22:08   ` Stefano Stabellini
2017-07-31 21:30     ` Edgar E. Iglesias
2017-02-07 19:42 ` [RFC v2 3/6] xen/arm: Allow platform_hvc to handle guest SMC calls Edgar E. Iglesias
2017-02-07 20:38   ` Tamas K Lengyel
2017-02-07 20:51     ` Julien Grall
2017-02-08  0:24       ` Tamas K Lengyel
2017-02-08  8:31         ` Edgar E. Iglesias
2017-02-08 16:40           ` Tamas K Lengyel
2017-02-08 16:58             ` Julien Grall
2017-02-08 17:21               ` Tamas K Lengyel
2017-02-08 17:29               ` Edgar E. Iglesias
2017-02-08 19:40                 ` Edgar E. Iglesias
2017-02-08 20:15                   ` Tamas K Lengyel
2017-02-08 22:04                     ` Julien Grall
2017-02-08 23:28                       ` Tamas K Lengyel
2017-02-09  0:08                         ` Julien Grall
2017-02-09  1:20                           ` Stefano Stabellini
2017-02-09  9:12                             ` Edgar E. Iglesias
2017-02-09  9:27                               ` Edgar E. Iglesias
2017-02-09 18:22                                 ` Stefano Stabellini
2017-02-09 18:25                                   ` Tamas K Lengyel
2017-02-09 18:43                                     ` Stefano Stabellini
2017-02-09 19:32                                       ` Tamas K Lengyel
2017-07-31 22:23                                         ` Edgar E. Iglesias
2017-08-01 10:37                                           ` Julien Grall
2017-08-01 11:40                                             ` Edgar E. Iglesias
2017-02-09 16:46                           ` Volodymyr Babchuk
2017-02-09 18:11                           ` Tamas K Lengyel
2017-02-09 18:39                             ` Julien Grall
2017-02-09 19:42                               ` Tamas K Lengyel
2017-02-09 20:01                                 ` Edgar E. Iglesias
2017-02-09 20:36                                   ` Tamas K Lengyel
2017-02-09 14:46                       ` Edgar E. Iglesias
2017-02-07 19:42 ` Edgar E. Iglesias [this message]
2017-02-13 22:11   ` [RFC v2 4/6] xen/arm: Introduce call_smcc64 Stefano Stabellini
2017-02-07 19:42 ` [RFC v2 5/6] xen/arm: zynqmp: Forward plaform specific firmware calls Edgar E. Iglesias
2017-02-14  0:02   ` Stefano Stabellini
2017-02-17 18:47   ` Julien Grall
2017-02-07 19:42 ` [RFC v2 6/6] xen/arm: zynqmp: Remove blacklist of ZynqMP's PM node Edgar E. Iglesias
2017-02-14  0:03   ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1486496525-14637-5-git-send-email-edgar.iglesias@gmail.com \
    --to=edgar.iglesias@gmail.com \
    --cc=edgar.iglesias@xilinx.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).