x86/hypercall: Move some of the hvm hypercall infrastructure into hypercall.h
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 26 Jan 2015 11:10:02 +0000 (11:10 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 6 Sep 2016 12:33:44 +0000 (13:33 +0100)
It will be reused for PV hypercalls in subsequent changes.

 * Rename hvm_hypercall_t to hypercall_fn_t
 * Introduce hypercall_table_t

Finally, rework the #includes for hypercall.h so it may be included in
isolation.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <JBeulich@suse.com>
xen/arch/x86/hvm/hvm.c
xen/include/asm-x86/hypercall.h

index 58a40b64165d94e44018461664427c02f8ed1f08..9002e3c977545ae2da0d98e621744d6005762c09 100644 (file)
@@ -4117,17 +4117,13 @@ static long hvm_physdev_op_compat32(
     }
 }
 
-typedef unsigned long hvm_hypercall_t(
-    unsigned long, unsigned long, unsigned long, unsigned long, unsigned long,
-    unsigned long);
-
 #define HYPERCALL(x)                                         \
-    [ __HYPERVISOR_ ## x ] = { (hvm_hypercall_t *) do_ ## x, \
-                               (hvm_hypercall_t *) do_ ## x }
+    [ __HYPERVISOR_ ## x ] = { (hypercall_fn_t *) do_ ## x,  \
+                               (hypercall_fn_t *) do_ ## x }
 
 #define COMPAT_CALL(x)                                       \
-    [ __HYPERVISOR_ ## x ] = { (hvm_hypercall_t *) do_ ## x, \
-                               (hvm_hypercall_t *) compat_ ## x }
+    [ __HYPERVISOR_ ## x ] = { (hypercall_fn_t *) do_ ## x,  \
+                               (hypercall_fn_t *) compat_ ## x }
 
 #define do_memory_op          hvm_memory_op
 #define compat_memory_op      hvm_memory_op_compat32
@@ -4137,10 +4133,7 @@ typedef unsigned long hvm_hypercall_t(
 #define compat_grant_table_op hvm_grant_table_op_compat32
 #define do_arch_1             paging_domctl_continuation
 
-static const struct {
-    hvm_hypercall_t *native;
-    hvm_hypercall_t *compat;
-} hvm_hypercall_table[NR_hypercalls] = {
+static const hypercall_table_t hvm_hypercall_table[NR_hypercalls] = {
     COMPAT_CALL(memory_op),
     COMPAT_CALL(grant_table_op),
     COMPAT_CALL(vcpu_op),
@@ -4172,8 +4165,6 @@ static const struct {
 #undef HYPERCALL
 #undef COMPAT_CALL
 
-extern const uint8_t hypercall_args_table[], compat_hypercall_args_table[];
-
 int hvm_do_hypercall(struct cpu_user_regs *regs)
 {
     struct vcpu *curr = current;
index 945d58ad477098e0068764b6353143e2fbd7f9a5..731f3a8156c4425cb91cb59dd2f00bfe3f80f08b 100644 (file)
@@ -5,9 +5,21 @@
 #ifndef __ASM_X86_HYPERCALL_H__
 #define __ASM_X86_HYPERCALL_H__
 
+#include <xen/types.h>
 #include <public/physdev.h>
+#include <public/event_channel.h>
 #include <public/arch-x86/xen-mca.h> /* for do_mca */
-#include <xen/types.h>
+
+typedef unsigned long hypercall_fn_t(
+    unsigned long, unsigned long, unsigned long,
+    unsigned long, unsigned long, unsigned long);
+
+typedef struct {
+    hypercall_fn_t *native, *compat;
+} hypercall_table_t;
+
+extern const uint8_t hypercall_args_table[NR_hypercalls],
+  compat_hypercall_args_table[NR_hypercalls];
 
 /*
  * Both do_mmuext_op() and do_mmu_update():