]> xenbits.xensource.com Git - xtf.git/commitdiff
Add HYPERCALL5 and hypercall_argo_op()
authorChristopher Clark <christopher.w.clark@gmail.com>
Thu, 28 Jan 2021 06:26:35 +0000 (22:26 -0800)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 13 Apr 2021 20:19:41 +0000 (21:19 +0100)
[Split out from argo patch]

Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
[Also implement HYPERCALL0 as it is frequently opencoded]
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
arch/x86/hypercall_page.S
arch/x86/include/arch/hypercall-x86_32.h
arch/x86/include/arch/hypercall-x86_64.h
include/xen/xen.h
include/xtf/hypercall.h

index b77c1b95e9623341093e9319d7d5fdba2286c3a6..cc6ddc26fea50657a21e83cf9f88d82a2eeda50e 100644 (file)
@@ -59,7 +59,7 @@ DECLARE_HYPERCALL(sysctl)
 DECLARE_HYPERCALL(domctl)
 DECLARE_HYPERCALL(kexec_op)
 DECLARE_HYPERCALL(tmem_op)
-DECLARE_HYPERCALL(xc_reserved_op)
+DECLARE_HYPERCALL(argo_op)
 DECLARE_HYPERCALL(xenpmu_op)
 
 DECLARE_HYPERCALL(arch_0)
index 34a7026ee159072b018f762396710a00945710ad..eabb7b1f8f854fcdf7ad6aa744f95c06bcf94adf 100644 (file)
@@ -7,6 +7,17 @@
  * Inputs: %ebx, %ecx, %edx, %esi, %edi, %ebp (arguments 1-6)
  */
 
+#define _hypercall32_0(type, hcall)                                     \
+    ({                                                                  \
+        long res;                                                       \
+        asm volatile (                                                  \
+            "call hypercall_page + %c[offset]"                          \
+            : "=a" (res)                                                \
+            : [offset] "i" (hcall * 32)                                 \
+            : "memory" );                                               \
+        (type)res;                                                      \
+    })
+
 #define _hypercall32_1(type, hcall, a1)                                 \
     ({                                                                  \
         long res, _a1 = (long)(a1);                                     \
         (type)res;                                                      \
     })
 
+#define _hypercall32_5(type, hcall, a1, a2, a3, a4, a5)                 \
+    ({                                                                  \
+        long res, _a1 = (long)(a1), _a2 = (long)(a2), _a3 = (long)(a3), \
+            _a4 = (long)(a4), _a5 = (long)(a5);                         \
+        asm volatile (                                                  \
+            "call hypercall_page + %c[offset]"                          \
+            : "=a" (res), "+b" (_a1), "+c" (_a2), "+d" (_a3),           \
+              "+S" (_a4), "+D" (_a5)                                    \
+            : [offset] "i" (hcall * 32)                                 \
+            : "memory" );                                               \
+        (type)res;                                                      \
+    })
+
 #endif /* XTF_X86_32_HYPERCALL_H */
 
 /*
index d283ad344c6d85652f7231847931e15323b5aa68..6cb67287c5e059cd9d9fb173184ec97fa501158c 100644 (file)
@@ -7,6 +7,17 @@
  * Inputs: %rdi, %rsi, %rdx, %r10, %r8, %r9 (arguments 1-6)
  */
 
+#define _hypercall64_0(type, hcall)                                     \
+    ({                                                                  \
+        long res;                                                       \
+        asm volatile (                                                  \
+            "call hypercall_page + %c[offset]"                          \
+            : "=a" (res)                                                \
+            : [offset] "i" (hcall * 32)                                 \
+            : "memory" );                                               \
+        (type)res;                                                      \
+    })
+
 #define _hypercall64_1(type, hcall, a1)                                 \
     ({                                                                  \
         long res, _a1 = (long)(a1);                                     \
         (type)res;                                                      \
     })
 
+#define _hypercall64_5(type, hcall, a1, a2, a3, a4, a5)                 \
+    ({                                                                  \
+        long res, _a1 = (long)(a1), _a2 = (long)(a2), _a3 = (long)(a3); \
+        register long _a4 asm ("r10") = (long)(a4);                     \
+        register long _a5 asm ("r8") = (long)(a5);                      \
+        asm volatile (                                                  \
+            "call hypercall_page + %c[offset]"                          \
+            : "=a" (res), "+D" (_a1), "+S" (_a2), "+d" (_a3),           \
+              "+r" (_a4), "+r" (_a5)                                    \
+            : [offset] "i" (hcall * 32)                                 \
+            : "memory" );                                               \
+        (type)res;                                                      \
+    })
+
 #endif /* XTF_X86_64_HYPERCALL_H */
 
 /*
index 877f2f0eb8a68cc142874733701adf619bdf6d58..11af167702cd4446f9da8ff4a74d3d58e5a385ec 100644 (file)
@@ -49,7 +49,7 @@
 #define __HYPERVISOR_domctl               36
 #define __HYPERVISOR_kexec_op             37
 #define __HYPERVISOR_tmem_op              38
-#define __HYPERVISOR_xc_reserved_op       39 /* reserved for XenClient */
+#define __HYPERVISOR_argo_op              39
 #define __HYPERVISOR_xenpmu_op            40
 
 /* Architecture-specific hypercall definitions. */
index acda5926efdcc8a62a5c330f17b8aa58810c1d00..fcd16dc3d2ee1409104e4a43ed68242f09dd3b03 100644 (file)
@@ -9,18 +9,22 @@
 #if defined(__x86_64__)
 
 # include <arch/hypercall-x86_64.h>
+# define HYPERCALL0 _hypercall64_0
 # define HYPERCALL1 _hypercall64_1
 # define HYPERCALL2 _hypercall64_2
 # define HYPERCALL3 _hypercall64_3
 # define HYPERCALL4 _hypercall64_4
+# define HYPERCALL5 _hypercall64_5
 
 #elif defined(__i386__)
 
 # include <arch/hypercall-x86_32.h>
+# define HYPERCALL0 _hypercall32_0
 # define HYPERCALL1 _hypercall32_1
 # define HYPERCALL2 _hypercall32_2
 # define HYPERCALL3 _hypercall32_3
 # define HYPERCALL4 _hypercall32_4
+# define HYPERCALL5 _hypercall32_5
 
 #else
 # error Bad architecture for hypercalls
@@ -170,6 +174,12 @@ static inline long hypercall_sysctl(xen_sysctl_t *arg)
     return HYPERCALL1(long, __HYPERVISOR_sysctl, arg);
 }
 
+static inline long hypercall_argo_op(unsigned int cmd, void *arg1, void *arg2,
+                                     unsigned long arg3, unsigned long arg4)
+{
+    return HYPERCALL5(long, __HYPERVISOR_argo_op, cmd, arg1, arg2, arg3, arg4);
+}
+
 /*
  * Higher level hypercall helpers
  */