From: Stefano Stabellini Date: Tue, 17 Jul 2012 16:33:29 +0000 (+0100) Subject: xen/arm: implement do_hvm_op for ARM X-Git-Tag: 4.2.0-rc1~77 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=4d4e656f02196cc96c6f930970e808e28f7ef873;p=xen.git xen/arm: implement do_hvm_op for ARM Signed-off-by: Stefano Stabellini Acked-by: Tim Deegan Committed-by: Ian Campbell --- diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 5a87ba6386..634b620892 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -26,6 +26,7 @@ obj-y += traps.o obj-y += vgic.o obj-y += vtimer.o obj-y += vpl011.o +obj-y += hvm.o #obj-bin-y += ....o diff --git a/xen/arch/arm/hvm.c b/xen/arch/arm/hvm.c new file mode 100644 index 0000000000..c11378db02 --- /dev/null +++ b/xen/arch/arm/hvm.c @@ -0,0 +1,60 @@ +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE(void) arg) + +{ + long rc = 0; + + switch ( op ) + { + case HVMOP_set_param: + case HVMOP_get_param: + { + struct xen_hvm_param a; + struct domain *d; + + if ( copy_from_guest(&a, arg, 1) ) + return -EFAULT; + + if ( a.index >= HVM_NR_PARAMS ) + return -EINVAL; + + rc = rcu_lock_target_domain_by_id(a.domid, &d); + if ( rc != 0 ) + return rc; + + if ( op == HVMOP_set_param ) + { + d->arch.hvm_domain.params[a.index] = a.value; + } + else + { + a.value = d->arch.hvm_domain.params[a.index]; + rc = copy_to_guest(arg, &a, 1) ? -EFAULT : 0; + } + + rcu_unlock_domain(d); + break; + } + + default: + { + printk("%s: Bad HVM op %ld.\n", __func__, op); + rc = -ENOSYS; + break; + } + } + + return rc; +} diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index f5f43dac6b..f6e6807bc8 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -430,6 +430,7 @@ static arm_hypercall_t *arm_hypercall_table[] = { HYPERCALL(memory_op), HYPERCALL(physdev_op), HYPERCALL(sysctl), + HYPERCALL(hvm_op), }; static void do_debug_trap(struct cpu_user_regs *regs, unsigned int code) diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h index 2b1454560c..114a8f6d78 100644 --- a/xen/include/asm-arm/domain.h +++ b/xen/include/asm-arm/domain.h @@ -5,6 +5,7 @@ #include #include #include +#include /* Represents state corresponding to a block of 32 interrupts */ struct vgic_irq_rank { @@ -28,9 +29,15 @@ struct pending_irq struct list_head lr_queue; }; +struct hvm_domain +{ + uint64_t params[HVM_NR_PARAMS]; +} __cacheline_aligned; + struct arch_domain { struct p2m_domain p2m; + struct hvm_domain hvm_domain; struct { /*