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

Re: [Xen-devel] [PATCH 1/7] arm: move arch/arm/hvm.c to arch/arm/hvm/hvm.c



On Mon, 8 Feb 2016, Corneliu ZUZU wrote:
> X86-side hvm.c is @ arch/x86/hvm/hvm.c. To maintain arm<->x86 symmetry,
> also move arch/arm/hvm.c to arch/arm/hvm/hvm.c.

Why are we doing this? These are not header files, their paths don't
necessarily need to be the same and xen/arch/x86/hvm/hvm.c is very
different from xen/arch/arm/hvm.c.

Please state the reason more clearly.


> Signed-off-by: Corneliu ZUZU <czuzu@xxxxxxxxxxxxxxx>
> ---
>  xen/arch/arm/Makefile     |  2 +-
>  xen/arch/arm/hvm.c        | 67 
> -----------------------------------------------
>  xen/arch/arm/hvm/Makefile |  1 +
>  xen/arch/arm/hvm/hvm.c    | 66 ++++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 68 insertions(+), 68 deletions(-)
>  delete mode 100644 xen/arch/arm/hvm.c
>  create mode 100644 xen/arch/arm/hvm/Makefile
>  create mode 100644 xen/arch/arm/hvm/hvm.c
> 
> diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
> index 1783912..22f1c75 100644
> --- a/xen/arch/arm/Makefile
> +++ b/xen/arch/arm/Makefile
> @@ -1,6 +1,7 @@
>  subdir-$(CONFIG_ARM_32) += arm32
>  subdir-$(CONFIG_ARM_64) += arm64
>  subdir-y += platforms
> +subdir-y += hvm
>  subdir-$(CONFIG_ARM_64) += efi
>  
>  obj-$(EARLY_PRINTK) += early_printk.o
> @@ -34,7 +35,6 @@ obj-y += vgic.o vgic-v2.o
>  obj-$(CONFIG_ARM_64) += vgic-v3.o
>  obj-y += vtimer.o
>  obj-y += vuart.o
> -obj-y += hvm.o
>  obj-y += device.o
>  obj-y += decode.o
>  obj-y += processor.o
> diff --git a/xen/arch/arm/hvm.c b/xen/arch/arm/hvm.c
> deleted file mode 100644
> index 5fd0753..0000000
> --- a/xen/arch/arm/hvm.c
> +++ /dev/null
> @@ -1,67 +0,0 @@
> -#include <xen/config.h>
> -#include <xen/init.h>
> -#include <xen/lib.h>
> -#include <xen/errno.h>
> -#include <xen/guest_access.h>
> -#include <xen/sched.h>
> -
> -#include <xsm/xsm.h>
> -
> -#include <public/xen.h>
> -#include <public/hvm/params.h>
> -#include <public/hvm/hvm_op.h>
> -
> -#include <asm/hypercall.h>
> -
> -long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(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;
> -
> -        d = rcu_lock_domain_by_any_id(a.domid);
> -        if ( d == NULL )
> -            return -ESRCH;
> -
> -        rc = xsm_hvm_param(XSM_TARGET, d, op);
> -        if ( rc )
> -            goto param_fail;
> -
> -        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;
> -        }
> -
> -    param_fail:
> -        rcu_unlock_domain(d);
> -        break;
> -    }
> -
> -    default:
> -    {
> -        gdprintk(XENLOG_DEBUG, "HVMOP op=%lu: not implemented\n", op);
> -        rc = -ENOSYS;
> -        break;
> -    }
> -    }
> -
> -    return rc;
> -}
> diff --git a/xen/arch/arm/hvm/Makefile b/xen/arch/arm/hvm/Makefile
> new file mode 100644
> index 0000000..6ee4054
> --- /dev/null
> +++ b/xen/arch/arm/hvm/Makefile
> @@ -0,0 +1 @@
> +obj-y += hvm.o
> diff --git a/xen/arch/arm/hvm/hvm.c b/xen/arch/arm/hvm/hvm.c
> new file mode 100644
> index 0000000..1ae681f
> --- /dev/null
> +++ b/xen/arch/arm/hvm/hvm.c
> @@ -0,0 +1,66 @@
> +#include <xen/config.h>
> +#include <xen/init.h>
> +#include <xen/lib.h>
> +#include <xen/errno.h>
> +#include <xen/guest_access.h>
> +#include <xen/sched.h>
> +
> +#include <xsm/xsm.h>
> +
> +#include <public/xen.h>
> +#include <public/hvm/params.h>
> +#include <public/hvm/hvm_op.h>
> +
> +#include <asm/hypercall.h>
> +
> +long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(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;
> +
> +        d = rcu_lock_domain_by_any_id(a.domid);
> +        if ( d == NULL )
> +            return -ESRCH;
> +
> +        rc = xsm_hvm_param(XSM_TARGET, d, op);
> +        if ( rc )
> +            goto param_fail;
> +
> +        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;
> +        }
> +
> +    param_fail:
> +        rcu_unlock_domain(d);
> +        break;
> +    }
> +
> +    default:
> +    {
> +        gdprintk(XENLOG_DEBUG, "HVMOP op=%lu: not implemented\n", op);
> +        rc = -ENOSYS;
> +        break;
> +    }
> +    }
> +
> +    return rc;
> +}
> -- 
> 2.5.0
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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