[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 4/7] Rename monitor_x86.c to monitor.c and monitor_arch.h to monitor.h
(last commit before this one explains why this was necessary) Signed-off-by: Corneliu ZUZU <czuzu@xxxxxxxxxxxxxxx> --- xen/arch/x86/Makefile | 2 +- xen/arch/x86/monitor.c | 72 +++++++++++++++++++++++++++++++++++++ xen/arch/x86/monitor_x86.c | 72 ------------------------------------- xen/common/monitor.c | 2 +- xen/include/asm-arm/monitor.h | 53 +++++++++++++++++++++++++++ xen/include/asm-arm/monitor_arch.h | 53 --------------------------- xen/include/asm-x86/monitor.h | 74 ++++++++++++++++++++++++++++++++++++++ xen/include/asm-x86/monitor_arch.h | 74 -------------------------------------- 8 files changed, 201 insertions(+), 201 deletions(-) create mode 100644 xen/arch/x86/monitor.c delete mode 100644 xen/arch/x86/monitor_x86.c create mode 100644 xen/include/asm-arm/monitor.h delete mode 100644 xen/include/asm-arm/monitor_arch.h create mode 100644 xen/include/asm-x86/monitor.h delete mode 100644 xen/include/asm-x86/monitor_arch.h diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 6e80cf0..8e6e901 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -36,7 +36,7 @@ obj-y += microcode_intel.o # This must come after the vendor specific files. obj-y += microcode.o obj-y += mm.o x86_64/mm.o -obj-y += monitor_x86.o +obj-y += monitor.o obj-y += mpparse.o obj-y += nmi.o obj-y += numa.o diff --git a/xen/arch/x86/monitor.c b/xen/arch/x86/monitor.c new file mode 100644 index 0000000..568def2 --- /dev/null +++ b/xen/arch/x86/monitor.c @@ -0,0 +1,72 @@ +/* + * arch/x86/monitor.c + * + * Arch-specific monitor_op domctl handler. + * + * Copyright (c) 2015 Tamas K Lengyel (tamas@xxxxxxxxxxxxx) + * Copyright (c) 2016, Bitdefender S.R.L. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License v2 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/>. + */ + +#include <asm/monitor.h> + +bool_t arch_monitor_domctl_event(struct domain *d, + struct xen_domctl_monitor_op *mop, + int *rc) +{ + struct arch_domain *ad = &d->arch; + bool_t requested_status = (XEN_DOMCTL_MONITOR_OP_ENABLE == mop->op); + + switch ( mop->event ) + { + case XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR: + { + bool_t old_status = ad->monitor.mov_to_msr_enabled; + + if ( unlikely(old_status == requested_status) ) + return -EEXIST; + + if ( XEN_DOMCTL_MONITOR_OP_ENABLE == mop->op && + mop->u.mov_to_msr.extended_capture && + !hvm_enable_msr_exit_interception(d) ) + return -EOPNOTSUPP; + + domain_pause(d); + + if ( XEN_DOMCTL_MONITOR_OP_ENABLE == mop->op && + mop->u.mov_to_msr.extended_capture ) + ad->monitor.mov_to_msr_extended = 1; + else + ad->monitor.mov_to_msr_extended = 0; + + ad->monitor.mov_to_msr_enabled = !old_status; + domain_unpause(d); + break; + } + + default: + return 0; + } + + return 1; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/x86/monitor_x86.c b/xen/arch/x86/monitor_x86.c deleted file mode 100644 index d19fd15..0000000 --- a/xen/arch/x86/monitor_x86.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * arch/x86/monitor_x86.c - * - * Arch-specific monitor_op domctl handler. - * - * Copyright (c) 2015 Tamas K Lengyel (tamas@xxxxxxxxxxxxx) - * Copyright (c) 2016, Bitdefender S.R.L. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License v2 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/>. - */ - -#include <asm/monitor_arch.h> - -bool_t arch_monitor_domctl_event(struct domain *d, - struct xen_domctl_monitor_op *mop, - int *rc) -{ - struct arch_domain *ad = &d->arch; - bool_t requested_status = (XEN_DOMCTL_MONITOR_OP_ENABLE == mop->op); - - switch ( mop->event ) - { - case XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR: - { - bool_t old_status = ad->monitor.mov_to_msr_enabled; - - if ( unlikely(old_status == requested_status) ) - return -EEXIST; - - if ( XEN_DOMCTL_MONITOR_OP_ENABLE == mop->op && - mop->u.mov_to_msr.extended_capture && - !hvm_enable_msr_exit_interception(d) ) - return -EOPNOTSUPP; - - domain_pause(d); - - if ( XEN_DOMCTL_MONITOR_OP_ENABLE == mop->op && - mop->u.mov_to_msr.extended_capture ) - ad->monitor.mov_to_msr_extended = 1; - else - ad->monitor.mov_to_msr_extended = 0; - - ad->monitor.mov_to_msr_enabled = !old_status; - domain_unpause(d); - break; - } - - default: - return 0; - } - - return 1; -} - -/* - * Local variables: - * mode: C - * c-file-style: "BSD" - * c-basic-offset: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/xen/common/monitor.c b/xen/common/monitor.c index 7bbeba5..1165aeb 100644 --- a/xen/common/monitor.c +++ b/xen/common/monitor.c @@ -25,7 +25,7 @@ #include <xsm/xsm.h> #include <public/domctl.h> -#include <asm/monitor_arch.h> /* for monitor_arch_# */ +#include <asm/monitor.h> /* for monitor_arch_# */ #if CONFIG_X86 #include <public/vm_event.h> /* for VM_EVENT_X86_CR3 */ diff --git a/xen/include/asm-arm/monitor.h b/xen/include/asm-arm/monitor.h new file mode 100644 index 0000000..eb770da --- /dev/null +++ b/xen/include/asm-arm/monitor.h @@ -0,0 +1,53 @@ +/* + * include/asm-arm/monitor.h + * + * Arch-specific monitor_op domctl handler. + * + * Copyright (c) 2015 Tamas K Lengyel (tamas@xxxxxxxxxxxxx) + * Copyright (c) 2016, Bitdefender S.R.L. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License v2 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/>. + */ + +#ifndef __ASM_ARM_MONITOR_H__ +#define __ASM_ARM_MONITOR_H__ + +#include <xen/sched.h> +#include <public/domctl.h> + +static inline +uint32_t arch_monitor_get_capabilities(struct domain *d) +{ + /* No monitor vm-events implemented on ARM. */ + return 0; +} + +static inline +bool_t arch_monitor_domctl_op(struct domain *d, + struct xen_domctl_monitor_op *mop, + int *rc) +{ + /* No arch-specific monitor ops on ARM. */ + return 0; +} + +static inline +bool_t arch_monitor_domctl_event(struct domain *d, + struct xen_domctl_monitor_op *mop, + int *rc) +{ + /* No arch-specific monitor vm-events on ARM. */ + return 0; +} + +#endif /* __ASM_ARM_MONITOR_H__ */ diff --git a/xen/include/asm-arm/monitor_arch.h b/xen/include/asm-arm/monitor_arch.h deleted file mode 100644 index d0df66c..0000000 --- a/xen/include/asm-arm/monitor_arch.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * include/asm-arm/monitor_arch.h - * - * Arch-specific monitor_op domctl handler. - * - * Copyright (c) 2015 Tamas K Lengyel (tamas@xxxxxxxxxxxxx) - * Copyright (c) 2016, Bitdefender S.R.L. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License v2 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/>. - */ - -#ifndef __ASM_ARM_MONITOR_ARCH_H__ -#define __ASM_ARM_MONITOR_ARCH_H__ - -#include <xen/sched.h> -#include <public/domctl.h> - -static inline -uint32_t arch_monitor_get_capabilities(struct domain *d) -{ - /* No monitor vm-events implemented on ARM. */ - return 0; -} - -static inline -bool_t arch_monitor_domctl_op(struct domain *d, - struct xen_domctl_monitor_op *mop, - int *rc) -{ - /* No arch-specific monitor ops on ARM. */ - return 0; -} - -static inline -bool_t arch_monitor_domctl_event(struct domain *d, - struct xen_domctl_monitor_op *mop, - int *rc) -{ - /* No arch-specific monitor vm-events on ARM. */ - return 0; -} - -#endif /* __ASM_ARM_MONITOR_ARCH_H__ */ diff --git a/xen/include/asm-x86/monitor.h b/xen/include/asm-x86/monitor.h new file mode 100644 index 0000000..b12823c --- /dev/null +++ b/xen/include/asm-x86/monitor.h @@ -0,0 +1,74 @@ +/* + * include/asm-x86/monitor.h + * + * Arch-specific monitor_op domctl handler. + * + * Copyright (c) 2015 Tamas K Lengyel (tamas@xxxxxxxxxxxxx) + * Copyright (c) 2016, Bitdefender S.R.L. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License v2 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/>. + */ + +#ifndef __ASM_X86_MONITOR_H__ +#define __ASM_X86_MONITOR_H__ + +#include <xen/sched.h> /* for struct domain, is_hvm_domain, ... */ +#include <public/domctl.h> /* for XEN_DOMCTL_MONITOR_#, ... */ +#include <asm/cpufeature.h> /* for cpu_has_vmx */ +#include <asm/hvm/hvm.h> /* for hvm_is_singlestep_supported */ + +static inline +uint32_t arch_monitor_get_capabilities(struct domain *d) +{ + uint32_t capabilities = 0; + + /* + * At the moment only Intel HVM domains are supported. However, event + * delivery could be extended to AMD and PV domains. + */ + if ( !is_hvm_domain(d) || !cpu_has_vmx ) + return capabilities; + + capabilities = (1 << XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG) | + (1 << XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR) | + (1 << XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT) | + (1 << XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST); + + /* Since we know this is on VMX, we can just call the hvm func */ + if ( hvm_is_singlestep_supported() ) + capabilities |= (1 << XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP); + + return capabilities; +} + +static inline +bool_t arch_monitor_domctl_op(struct domain *d, + struct xen_domctl_monitor_op *mop, + int *rc) +{ + if( likely(XEN_DOMCTL_MONITOR_OP_EMULATE_EACH_REP == mop->op) ) + { + domain_pause(d); + d->arch.mem_access_emulate_each_rep = !!mop->event; + domain_unpause(d); + *rc = 0; + return 1; + } + return 0; +} + +bool_t arch_monitor_domctl_event(struct domain *d, + struct xen_domctl_monitor_op *mop, + int *rc); + +#endif /* __ASM_X86_MONITOR_H__ */ diff --git a/xen/include/asm-x86/monitor_arch.h b/xen/include/asm-x86/monitor_arch.h deleted file mode 100644 index d9daf65..0000000 --- a/xen/include/asm-x86/monitor_arch.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * include/asm-x86/monitor_arch.h - * - * Arch-specific monitor_op domctl handler. - * - * Copyright (c) 2015 Tamas K Lengyel (tamas@xxxxxxxxxxxxx) - * Copyright (c) 2016, Bitdefender S.R.L. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License v2 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/>. - */ - -#ifndef __ASM_X86_MONITOR_ARCH_H__ -#define __ASM_X86_MONITOR_ARCH_H__ - -#include <xen/sched.h> /* for struct domain, is_hvm_domain, ... */ -#include <public/domctl.h> /* for XEN_DOMCTL_MONITOR_#, ... */ -#include <asm/cpufeature.h> /* for cpu_has_vmx */ -#include <asm/hvm/hvm.h> /* for hvm_is_singlestep_supported */ - -static inline -uint32_t arch_monitor_get_capabilities(struct domain *d) -{ - uint32_t capabilities = 0; - - /* - * At the moment only Intel HVM domains are supported. However, event - * delivery could be extended to AMD and PV domains. - */ - if ( !is_hvm_domain(d) || !cpu_has_vmx ) - return capabilities; - - capabilities = (1 << XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG) | - (1 << XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR) | - (1 << XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT) | - (1 << XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST); - - /* Since we know this is on VMX, we can just call the hvm func */ - if ( hvm_is_singlestep_supported() ) - capabilities |= (1 << XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP); - - return capabilities; -} - -static inline -bool_t arch_monitor_domctl_op(struct domain *d, - struct xen_domctl_monitor_op *mop, - int *rc) -{ - if( likely(XEN_DOMCTL_MONITOR_OP_EMULATE_EACH_REP == mop->op) ) - { - domain_pause(d); - d->arch.mem_access_emulate_each_rep = !!mop->event; - domain_unpause(d); - *rc = 0; - return 1; - } - return 0; -} - -bool_t arch_monitor_domctl_event(struct domain *d, - struct xen_domctl_monitor_op *mop, - int *rc); - -#endif /* __ASM_X86_MONITOR_ARCH_H__ */ -- 2.5.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |