[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 07/22] 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> --- xen/arch/x86/guest/Makefile | 1 + xen/arch/x86/guest/vixen.c | 30 ++++++++++++++++ xen/include/asm-x86/guest/vixen.h | 73 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 xen/arch/x86/guest/vixen.c 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-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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |