ARM: Support for guest-request vm-events
PATCH 1/1 ARM: Support for guest-request vm-events
This patch implements ARM support for guest-request vm-events. The code has been ported from x86 side w/ minor adjustments.
--- xen/arch/arm/Makefile | 2 + xen/arch/arm/event.c | 86 ++++++++++++++++++++++++++++ xen/arch/arm/hvm.c | 9 ++- xen/arch/arm/monitor.c | 123 ++++++++++++++++++++++++++++++++++++++++ xen/include/asm-arm/domain.h | 8 +++ xen/include/asm-arm/hvm/event.h | 36 ++++++++++++ xen/include/asm-arm/monitor.h | 8 +-- xen/include/asm-arm/vm_event.h | 4 +- 8 files changed, 267 insertions(+), 9 deletions(-) create mode 100644 xen/arch/arm/event.c create mode 100644 xen/arch/arm/monitor.c create mode 100644 xen/include/asm-arm/hvm/event.h
xen/arch/arm/Makefile +2 -0
@@ -31,6 +31,8 @@ obj-y += smpboot.o obj-y += smp.o obj-y += shutdown.o obj-y += traps.o +obj-y += event.o +obj-y += monitor.o obj-y += vgic.o vgic-v2.o obj-$(CONFIG_ARM_64) += vgic-v3.o obj-y += vtimer.o
xen/arch/arm/event.c new file +86 -0
86 lines not on this page · raw message
xen/arch/arm/hvm.c +8 -1
@@ -11,10 +11,10 @@#include <public/hvm/params.h> #include <public/hvm/hvm_op.h> +#include <asm/hvm/event.h> #include <asm/hypercall.h> long do_hvm_op (unsigned long op,XEN_GUEST_HANDLE_PARAM (void ) arg) - {long rc =0 ;
@@ -55,6 +55,13 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg)break ; } +case HVMOP_guest_request_vm_event: +if (guest_handle_is_null (arg) ) +hvm_event_guest_request (); +else + rc = -EINVAL ; +break ; +default : {gdprintk (XENLOG_DEBUG ,"HVMOP op=%lu: not implemented\n" , op);
xen/arch/arm/monitor.c new file +123 -0
123 lines not on this page · raw message
xen/include/asm-arm/domain.h +8 -0
@@ -124,6 +124,14 @@ struct arch_domain } vuart;unsigned int evtchn_irq; + +/* Monitor options */ +struct { +uint8_t guest_request_enabled :1 ; +uint8_t guest_request_sync :1 ; + uint8_t : 6; + } monitor; + } __cacheline_aligned;struct arch_vcpu
xen/include/asm-arm/hvm/event.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* include/asm-arm/hvm/event.h: +* +* Copy-pasted & adjusted from x86 counterpart. +* +* Copyright (c) 2016, Bitdefender S.R.L. +* +* 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 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_HVM_EVENT_H__ +#define __ASM_ARM_HVM_EVENT_H__ + +void hvm_event_guest_request (void ); + +#endif /* __ASM_ARM_HVM_EVENT_H__ */ + +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* tab-width: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/asm-arm/monitor.h +2 -6
@@ -24,10 +24,6 @@#include <xen/sched.h> #include <public/domctl.h> -static inline -int monitor_domctl (struct domain *d,struct xen_domctl_monitor_op *op) -{ -return -ENOSYS ; -} +int monitor_domctl (struct domain *d,struct xen_domctl_monitor_op *op); -#endif /* __ASM_X86_MONITOR_H__ */ +#endif /* __ASM_ARM_MONITOR_H__ */
xen/include/asm-arm/vm_event.h +2 -2
@@ -25,14 +25,14 @@static inline int vm_event_init_domain (struct domain *d) { -/* Not supported on ARM. */ +/* Nothing to do */ return 0 ; }static inline void vm_event_cleanup_domain (struct domain *d) { -/* Not supported on ARM. */ +memset (&d->arch.monitor,0 ,sizeof (d->arch.monitor)); } static inline
Signature · 1 line
2.5.0
Quoted 2 lines · Corneliu ZUZU
This patch implements ARM support for guest-request vm-events. The code has been ported from x86 side w/ minor adjustments.
I've not looked at the patch yet, but if it only involves minor adjustments from the x86 side can some amount of it not be refactored into common code?
Ian.
Quoted 8 lines · Ian Campbell
Quoted 2 lines · Corneliu ZUZU
This patch implements ARM support for guest-request vm-events. The code has been ported from x86 side w/ minor adjustments.
I've not looked at the patch yet, but if it only involves minor adjustments from the x86 side can some amount of it not be refactored into common code?
Ian.
At a first glance it seems to me that parts of monitor vm-events code could be moved to common. But it also seems that it would require a bit of effort and I'm not sure yet if the end result won't actually complicate implementation of monitor vm-events for other architectures in the future. Some of the monitor vm-events implemented are strictly architecture specific,
e.g. VM_EVENT_REASON_MOV_TO_MSR will always be an x86-only vm-event, unless
it is somehow generalized (maybe somehow merged w/ VM_EVENT_REASON_WRITE_CTRLREG?). But *most* of them indeed don't directly have this kind of specificity, so it would make sense to make most of the code common, if possible.
To me personally this seems like a good idea and I'd be willing to give it a try, but as I said, it might require some other changes of the code, including x86 changes.
I was about to release another patch after this one to implement control-register writes vm-events for ARM, but I anticipate that doing this move first will actually benefit my effort in that direction as well (I think the patch code will get to be cleaner).
So, shall I try it?
Thanks, Corneliu.
Quoted 12 lines · CORNELIU ZUZU
Quoted 10 lines · Ian Campbell
Quoted 2 lines · Corneliu ZUZU
This patch implements ARM support for guest-request vm-events. The code has been ported from x86 side w/ minor adjustments.
I've not looked at the patch yet, but if it only involves minor adjustments
from the x86 side can some amount of it not be refactored into common code?Ian.
Quoted 14 lines
At a first glance it seems to me that parts of monitor vm-events code could be moved to common.
But it also seems that it would require a bit of effort and I'm not sure yet if the end result
won't actually complicate implementation of monitor vm-events for other architectures in the future.
Some of the monitor vm-events implemented are strictly architecture specific,
e.g.VM_EVENT_REASON_MOV_TO_MSRwill always be an x86-only vm-event, unless it is somehow generalized (maybe somehow merged w/VM_EVENT_REASON_WRITE_CTRLREG?).
But *most* of them indeed don't directly have this kind of specificity, so it would make sense to make
most of the code common, if possible.
That the sort of thing we would usually handle by having the common code call into a arch_foo() to decode any non-common options.
Quoted 10 lines
To me personally this seems like a good idea and I'd be willing to give it a try, but as I said,
it might require some other changes of the code, including x86 changes. I was about to release another patch after this one to implement control-register writes
vm-events for ARM, but I anticipate that doing this move first will actually benefit my effort in that
direction as well (I think the patch code will get to be cleaner).So, shall I try it?
From my POV as an ARM maintainer I think this is the way to go. I've also copied the VM EVENT maintainers in case they object for some reason.
I'd recommend always CCing Razvan and Tamas on this series, and considering adding any new ARM files to the entry in MAINTAINERS (assuming they don't object of course)
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 40 lines · Ian Campbell
Quoted 12 lines · CORNELIU ZUZU
Quoted 10 lines · Ian Campbell
Quoted 2 lines · Corneliu ZUZU
This patch implements ARM support for guest-request vm-events. The code has been ported from x86 side w/ minor adjustments.
I've not looked at the patch yet, but if it only involves minor adjustments
from the x86 side can some amount of it not be refactored into common code?Ian.
Quoted 14 lines
At a first glance it seems to me that parts of monitor vm-events code could be moved to common.
But it also seems that it would require a bit of effort and I'm not sure yet if the end result
won't actually complicate implementation of monitor vm-events for other architectures in the future.
Some of the monitor vm-events implemented are strictly architecture specific,
e.g.VM_EVENT_REASON_MOV_TO_MSRwill always be an x86-only vm-event, unless it is somehow generalized (maybe somehow merged w/VM_EVENT_REASON_WRITE_CTRLREG?).
But *most* of them indeed don't directly have this kind of specificity, so it would make sense to make
most of the code common, if possible.That the sort of thing we would usually handle by having the common code call into a
arch_foo()to decode any non-common options.Quoted 9 lines
To me personally this seems like a good idea and I'd be willing to give it a try, but as I said,
it might require some other changes of the code, including x86 changes. I was about to release another patch after this one to implement control-register writes
vm-events for ARM, but I anticipate that doing this move first will actually benefit my effort in that
direction as well (I think the patch code will get to be cleaner).
Quoted 8 lines
Quoted 1 line
So, shall I try it?
From my POV as an ARM maintainer I think this is the way to go. I've also copied the VM EVENT maintainers in case they object for some reason.
I'd recommend always CCing Razvan and Tamas on this series, and considering adding any new ARM files to the entry in
MAINTAINERS(assuming they don't object of course)
No objection from me on either factoring out the common code (where, and if possible) or adding the new files to MAINTAINERS.
Thanks,
Razvan
Quoted 40 lines · Ian Campbell
Quoted 11 lines · CORNELIU ZUZU
Quoted 10 lines · Ian Campbell
Quoted 2 lines · Corneliu ZUZU
This patch implements ARM support for guest-request vm-events. The code has been ported from x86 side w/ minor adjustments.
I've not looked at the patch yet, but if it only involves minor adjustments
from the x86 side can some amount of it not be refactored into common code?Ian.
Quoted 14 lines
At a first glance it seems to me that parts of monitor vm-events code could be moved to common.
But it also seems that it would require a bit of effort and I'm not sure yet if the end result
won't actually complicate implementation of monitor vm-events for other architectures in the future.
Some of the monitor vm-events implemented are strictly architecture specific,
e.g.VM_EVENT_REASON_MOV_TO_MSRwill always be an x86-only vm-event, unless it is somehow generalized (maybe somehow merged w/VM_EVENT_REASON_WRITE_CTRLREG?).
But *most* of them indeed don't directly have this kind of specificity, so it would make sense to make
most of the code common, if possible.That the sort of thing we would usually handle by having the common code call into a
arch_foo()to decode any non-common options.Quoted 11 lines
To me personally this seems like a good idea and I'd be willing to give it a try, but as I said,
it might require some other changes of the code, including x86 changes. I was about to release another patch after this one to implement control-register writes
vm-events for ARM, but I anticipate that doing this move first will actually benefit my effort in that
direction as well (I think the patch code will get to be cleaner).So, shall I try it?
From my POV as an ARM maintainer I think this is the way to go. I've also
Quoted 8 lines
copied the VM EVENT maintainers in case they object for some reason.
I'd recommend always CCing Razvan and Tamas on this series, and considering adding any new ARM files to the entry in
MAINTAINERS(assuming they don't object of course)Ian.
Ok, great. I'll try it tonight and post a patch series ASAP.
Concerning the CC list, Razvan actually noticed me earlier that he and Tamas should have been on it for this patch, since it is vm-events related. He said the problem is w/ the MAINTAINERS file and he will update it.
Corneliu.
Quoted 8 lines · Corneliu ZUZU
Ok, great. I'll try it tonight and post a patch series ASAP. Concerning the CC list, Razvan actually noticed me earlier that he and Tamas should have
been on it for this patch, since it is vm-events related. He said the problem is w/ theMAINTAINERSfile and he will update it.
It's just that you touch all new files I think.
I wonder if listing xen/arch/*/vm_event.c would do what we want.
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 10 lines · Ian Campbell
Quoted 8 lines · Corneliu ZUZU
Ok, great. I'll try it tonight and post a patch series ASAP. Concerning the CC list, Razvan actually noticed me earlier that he and Tamas should have
been on it for this patch, since it is vm-events related. He said the problem is w/ theMAINTAINERSfile and he will update it.
Quoted 3 lines
It's just that you touch all new files I think.
I wonder if listing
xen/arch/*/vm_event.cwould do what we want.
It worked for me, so if Tamas is onboard with this, then we can make this change.
Thanks,
Razvan
Quoted 13 lines · Razvan Cojocaru
Quoted 12 lines · Ian Campbell
Quoted 8 lines · Corneliu ZUZU
Ok, great. I'll try it tonight and post a patch series ASAP. Concerning the CC list, Razvan actually noticed me earlier that he and Tamas should have
been on it for this patch, since it is vm-events related. He said the problem is w/ theMAINTAINERSfile and he will update it.It's just that you touch all new files I think.
Quoted 9 lines
Quoted 1 line
I wonder if listing
xen/arch/*/vm_event.cwould do what we want.It worked for me, so if Tamas is onboard with this, then we can make this change.
Thanks,
Razvan
Sure, that works.
Tamas
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel