]> xenbits.xensource.com Git - people/liuw/xen.git/commitdiff
xen: make grant table support configurable
authorWei Liu <wei.liu2@citrix.com>
Fri, 18 Jan 2019 12:43:57 +0000 (12:43 +0000)
committerWei Liu <wei.liu2@citrix.com>
Wed, 6 Mar 2019 12:56:27 +0000 (12:56 +0000)
Introduce CONFIG_GRANT_TABLE. Provide stubs and make sure x86 and arm
hypervisors build with grant table disabled.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <julien.grall@arm.com>
xen/arch/arm/traps.c
xen/arch/x86/hvm/Makefile
xen/arch/x86/hvm/hypercall.c
xen/arch/x86/hypercall.c
xen/arch/x86/pv/Makefile
xen/arch/x86/pv/hypercall.c
xen/common/Kconfig
xen/common/Makefile
xen/include/xen/grant_table.h

index 8741aa1d59ce77890ea5924dc5f1e45ea1fdb28b..d8b9a8a0f046364ca38b3451dd1fb83563e9e4bc 100644 (file)
@@ -1396,7 +1396,9 @@ static arm_hypercall_t arm_hypercall_table[] = {
     HYPERCALL_DEPRECATED(physdev_op_compat, 1),
     HYPERCALL(sysctl, 2),
     HYPERCALL(hvm_op, 2),
+#ifdef CONFIG_GRANT_TABLE
     HYPERCALL(grant_table_op, 3),
+#endif
     HYPERCALL(multicall, 2),
     HYPERCALL(platform_op, 1),
     HYPERCALL_ARM(vcpu_op, 3),
index 86b106f8e7c1d9d4a086fc7de034a5cf1da7a228..43e5f3a21f8b8ae9a7a7cf8175d8a2a2afe3badb 100644 (file)
@@ -7,7 +7,7 @@ obj-y += dm.o
 obj-bin-y += dom0_build.init.o
 obj-y += domain.o
 obj-y += emulate.o
-obj-y += grant_table.o
+obj-$(CONFIG_GRANT_TABLE) += grant_table.o
 obj-y += hpet.o
 obj-y += hvm.o
 obj-y += hypercall.o
index 5bb1750595e02548735ff636eea0690a647717f3..00455ff11532d494571e80cd89f549a5eb7f5e23 100644 (file)
@@ -47,6 +47,7 @@ static long hvm_memory_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
     return rc;
 }
 
+#ifdef CONFIG_GRANT_TABLE
 static long hvm_grant_table_op(
     unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) uop, unsigned int count)
 {
@@ -71,6 +72,7 @@ static long hvm_grant_table_op(
     else
         return compat_grant_table_op(cmd, uop, count);
 }
+#endif
 
 static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 {
@@ -119,7 +121,9 @@ static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 
 static const hypercall_table_t hvm_hypercall_table[] = {
     HVM_CALL(memory_op),
+#ifdef CONFIG_GRANT_TABLE
     HVM_CALL(grant_table_op),
+#endif
     COMPAT_CALL(vcpu_op),
     HVM_CALL(physdev_op),
     COMPAT_CALL(xen_version),
index 93e78600da5461bf3c1c4fe49806d78f9c6f5fc0..cf44b82793a2a8e7c2aadd34f63c885f4b8ae376 100644 (file)
@@ -47,7 +47,9 @@ const hypercall_args_t hypercall_args_table[NR_hypercalls] =
     ARGS(xen_version, 2),
     ARGS(console_io, 3),
     ARGS(physdev_op_compat, 1),
+#ifdef CONFIG_GRANT_TABLE
     ARGS(grant_table_op, 3),
+#endif
     ARGS(vm_assist, 2),
     COMP(update_va_mapping_otherdomain, 4, 5),
     ARGS(vcpu_op, 3),
index 65bca04175b7b7affb6879eea9b93f25ffdebadb..cf28434ba91460d65b080db4754124a1f2f9cae9 100644 (file)
@@ -5,7 +5,7 @@ obj-y += emulate.o
 obj-y += emul-gate-op.o
 obj-y += emul-inv-op.o
 obj-y += emul-priv-op.o
-obj-y += grant_table.o
+obj-$(CONFIG_GRANT_TABLE) += grant_table.o
 obj-y += hypercall.o
 obj-y += iret.o
 obj-y += misc-hypercalls.o
index f452dd5c0416020fec6d598887971609d7e64b1b..e9da8419cae4e0eea5230802f4ac57fde260aa32 100644 (file)
@@ -53,7 +53,9 @@ const hypercall_table_t pv_hypercall_table[] = {
     COMPAT_CALL(xen_version),
     HYPERCALL(console_io),
     COMPAT_CALL(physdev_op_compat),
+#ifdef CONFIG_GRANT_TABLE
     COMPAT_CALL(grant_table_op),
+#endif
     COMPAT_CALL(vm_assist),
     COMPAT_CALL(update_va_mapping_otherdomain),
     COMPAT_CALL(iret),
index 04384628bb2673a6d485deac20ef66826530093d..c8385062417c2e26a8c186fc8e6e7005d569bde1 100644 (file)
@@ -11,6 +11,17 @@ config COMPAT
 config CORE_PARKING
        bool
 
+config GRANT_TABLE
+       bool "Grant table support" if EXPERT = "y"
+       default y
+       ---help---
+         Grant table provides a generic mechanism to memory sharing
+         between domains. This shared memory interface underpins the
+         split device drivers for block and network IO in a classic
+         Xen setup.
+
+         If unsure, say Y.
+
 config HAS_ALTERNATIVE
        bool
 
index 59ac7ded6e601a9e9806930eb3ad9defa36e5ae5..bca48e6e2264a404366a6f923bd97ae3f598c48a 100644 (file)
@@ -11,7 +11,7 @@ obj-y += event_2l.o
 obj-y += event_channel.o
 obj-y += event_fifo.o
 obj-$(CONFIG_CRASH_DEBUG) += gdbstub.o
-obj-y += grant_table.o
+obj-$(CONFIG_GRANT_TABLE) += grant_table.o
 obj-y += guestcopy.o
 obj-bin-y += gunzip.init.o
 obj-y += irq.o
index 12e8a4b80b1fd3235c33112ac5edc9b05d6d1f49..6f9345d9ef546dbc123c73b400a1ac21dde87717 100644 (file)
@@ -29,6 +29,7 @@
 #include <asm/page.h>
 #include <asm/grant_table.h>
 
+#ifdef CONFIG_GRANT_TABLE
 struct grant_table;
 
 extern unsigned int opt_max_grant_frames;
@@ -61,4 +62,51 @@ int gnttab_get_shared_frame(struct domain *d, unsigned long idx,
 int gnttab_get_status_frame(struct domain *d, unsigned long idx,
                             mfn_t *mfn);
 
+#else
+
+#define opt_max_grant_frames 0
+#define opt_max_maptrack_frames 0
+
+static inline int grant_table_init(struct domain *d,
+                                   unsigned int max_grant_frames,
+                                   unsigned int max_maptrack_frames)
+{
+    return 0;
+}
+
+static inline void grant_table_destroy(struct domain *d) {}
+
+static inline void grant_table_init_vcpu(struct vcpu *v) {}
+
+static inline void grant_table_warn_active_grants(struct domain *d) {}
+
+static inline void gnttab_release_mappings(struct domain *d) {}
+
+static inline int mem_sharing_gref_to_gfn(struct grant_table *gt,
+                                          grant_ref_t ref,
+                                          gfn_t *gfn, uint16_t *status)
+{
+    return -EINVAL;
+}
+
+static inline int gnttab_map_frame(struct domain *d, unsigned long idx,
+                                   gfn_t gfn, mfn_t *mfn)
+{
+    return -EINVAL;
+}
+
+static inline int gnttab_get_shared_frame(struct domain *d, unsigned long idx,
+                                          mfn_t *mfn)
+{
+    return -EINVAL;
+}
+
+static inline int gnttab_get_status_frame(struct domain *d, unsigned long idx,
+                                          mfn_t *mfn)
+{
+    return -EINVAL;
+}
+
+#endif /* CONFIG_GRANT_TABLE */
+
 #endif /* __XEN_GRANT_TABLE_H__ */