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

[Xen-devel] [PATCH v2 07/23] vixen: introduce is_vixen() to allow altering behavior



From: Anthony Liguori <aliguori@xxxxxxxxxx>

Vixen (Virtualized Xen) is a paravirtual mode of Xen where
paravirtual I/O is passed through from the parent hypervisor
all the way through the dom0 guest.  The dom0 guest is also
deprivileged and renumbered to give the appearance that it
is running as a normal PV guest.

Signed-off-by: Anthony Liguori <aliguori@xxxxxxxxxx>
---
v1 -> v2
 - ARM stubs
---
 xen/arch/x86/guest/Makefile       |  1 +
 xen/arch/x86/guest/vixen.c        | 30 +++++++++++++++
 xen/include/asm-arm/guest/vixen.h | 81 +++++++++++++++++++++++++++++++++++++++
 xen/include/asm-x86/guest/vixen.h | 73 +++++++++++++++++++++++++++++++++++
 4 files changed, 185 insertions(+)
 create mode 100644 xen/arch/x86/guest/vixen.c
 create mode 100644 xen/include/asm-arm/guest/vixen.h
 create mode 100644 xen/include/asm-x86/guest/vixen.h

diff --git a/xen/arch/x86/guest/Makefile b/xen/arch/x86/guest/Makefile
index c5d5188..1c9cd7d 100644
--- a/xen/arch/x86/guest/Makefile
+++ b/xen/arch/x86/guest/Makefile
@@ -1,2 +1,3 @@
 obj-y += hypercall_page.o
 obj-y += xen.o
+obj-y += vixen.o
diff --git a/xen/arch/x86/guest/vixen.c b/xen/arch/x86/guest/vixen.c
new file mode 100644
index 0000000..d82e68f
--- /dev/null
+++ b/xen/arch/x86/guest/vixen.c
@@ -0,0 +1,30 @@
+/******************************************************************************
+ * arch/x86/guest/vixen.c
+ *
+ * Support for detecting and running under Xen HVM.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2017-2018 Amazon.com, Inc. or its affiliates.
+ */
+
+#include <asm/guest/vixen.h>
+
+static int in_vixen;
+
+bool is_vixen(void)
+{
+    return in_vixen > 0;
+}
+
diff --git a/xen/include/asm-arm/guest/vixen.h 
b/xen/include/asm-arm/guest/vixen.h
new file mode 100644
index 0000000..ade6724
--- /dev/null
+++ b/xen/include/asm-arm/guest/vixen.h
@@ -0,0 +1,81 @@
+/******************************************************************************
+ * include/asm-x86/guest.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms and conditions of the GNU General Public
+ * License, version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2018 Amazon.com, Inc. or its affiliates.
+ */
+
+#ifndef __ARM_GUEST_VIXEN_H__
+#define __ARM_GUEST_VIXEN_H__
+
+#include <xen/types.h>
+
+static inline int
+HYPERVISOR_xen_version(int cmd, void *arg)
+{
+    return -ENOSYS;
+}
+
+static inline unsigned long
+HYPERVISOR_hvm_op(int op, void *arg)
+{
+    return -ENOSYS;
+}
+
+static inline int
+HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
+{
+    return -ENOSYS;
+}
+
+static inline long
+HYPERVISOR_memory_op(unsigned int cmd, void *arg)
+{
+    return -ENOSYS;
+}
+
+static inline int
+HYPERVISOR_event_channel_op(int cmd, void *arg)
+{
+    return -ENOSYS;
+}
+
+static inline int
+HYPERVISOR_sched_op(int cmd, void *arg)
+{
+    return -ENOSYS;
+}
+
+static inline int
+HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args)
+{
+    return -ENOSYS;
+}
+
+static inline bool is_vixen(void)
+{
+    return false;
+}
+
+static inline bool vixen_has_per_cpu_notifications(void)
+{
+    return false;
+}
+
+static inline bool vixen_ring_process(uint16_t port)
+{
+    return false;
+}
+
+#endif
diff --git a/xen/include/asm-x86/guest/vixen.h 
b/xen/include/asm-x86/guest/vixen.h
new file mode 100644
index 0000000..be90c46
--- /dev/null
+++ b/xen/include/asm-x86/guest/vixen.h
@@ -0,0 +1,73 @@
+/******************************************************************************
+ * include/asm-x86/guest/vixen.h
+ *
+ * Support for detecting and running under Xen HVM.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2017-2018 Amazon.com, Inc. or its affiliates.
+ */
+
+#ifndef XEN_VIXEN_H
+#define XEN_VIXEN_H
+
+#include <asm/guest.h>
+#include <public/xen.h>
+#include <xen/sched.h>
+
+static inline int
+HYPERVISOR_xen_version(int cmd, void *arg)
+{
+    return _hypercall64_2(int, __HYPERVISOR_xen_version, cmd, arg);
+}
+
+static inline unsigned long
+HYPERVISOR_hvm_op(int op, void *arg)
+{
+   return _hypercall64_2(unsigned long, __HYPERVISOR_hvm_op, op, arg);
+}
+
+static inline int
+HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
+{
+    return _hypercall64_3(int, __HYPERVISOR_grant_table_op, cmd, uop, count);
+}
+
+static inline long
+HYPERVISOR_memory_op(unsigned int cmd, void *arg)
+{
+    return _hypercall64_2(long, __HYPERVISOR_memory_op, cmd, arg);
+}
+
+static inline int
+HYPERVISOR_event_channel_op(int cmd, void *arg)
+{
+    return _hypercall64_2(int, __HYPERVISOR_event_channel_op, cmd, arg);
+}
+
+static inline int
+HYPERVISOR_sched_op(int cmd, void *arg)
+{
+    return _hypercall64_2(int, __HYPERVISOR_sched_op, cmd, arg);
+}
+
+static inline int
+HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args)
+{
+       return _hypercall64_3(int, __HYPERVISOR_vcpu_op, cmd, vcpuid, 
extra_args);
+}
+
+bool is_vixen(void);
+
+#endif
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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