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

Re: [Xen-devel] [PATCH 2/5] arm: allow libxc to build (untested)



On Mon, 16 Jan 2012, Ian Campbell wrote:
> Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
> ---
>  Config.mk                 |    2 +-
>  tools/libxc/Makefile      |    1 +
>  tools/libxc/xc_core.h     |    2 +
>  tools/libxc/xc_core_arm.c |   70 
> +++++++++++++++++++++++++++++++++++++++++++++
>  tools/libxc/xc_core_arm.h |   61 +++++++++++++++++++++++++++++++++++++++
>  tools/libxc/xenctrl.h     |    4 ++
>  6 files changed, 139 insertions(+), 1 deletions(-)
>  create mode 100644 tools/libxc/xc_core_arm.c
>  create mode 100644 tools/libxc/xc_core_arm.h
> 
> diff --git a/Config.mk b/Config.mk
> index 1c229c0..13a569e 100644
> --- a/Config.mk
> +++ b/Config.mk
> @@ -13,7 +13,7 @@ realpath = $(wildcard $(foreach file,$(1),$(shell cd -P 
> $(dir $(file)) && echo "
>  debug ?= y
>  
>  XEN_COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/ \
> -                         -e s/i86pc/x86_32/ -e s/amd64/x86_64/)
> +                         -e s/i86pc/x86_32/ -e s/amd64/x86_64/ -e 
> s/arm.*/arm/)
>  XEN_TARGET_ARCH     ?= $(XEN_COMPILE_ARCH)
>  XEN_OS              ?= $(shell uname -s)
>  
> diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile
> index b5e7022..b5bd7fb 100644
> --- a/tools/libxc/Makefile
> +++ b/tools/libxc/Makefile
> @@ -6,6 +6,7 @@ MINOR    = 0
>  
>  CTRL_SRCS-y       :=
>  CTRL_SRCS-y       += xc_core.c
> +CTRL_SRCS-$(CONFIG_ARM) += xc_core_arm.c
>  CTRL_SRCS-$(CONFIG_X86) += xc_core_x86.c
>  CTRL_SRCS-$(CONFIG_IA64) += xc_core_ia64.c
>  CTRL_SRCS-y       += xc_cpupool.c
> diff --git a/tools/libxc/xc_core.h b/tools/libxc/xc_core.h
> index 1e88a75..358a8c1 100644
> --- a/tools/libxc/xc_core.h
> +++ b/tools/libxc/xc_core.h
> @@ -155,6 +155,8 @@ int xc_core_arch_map_p2m_writable(xc_interface *xch, 
> unsigned int guest_width,
>  # include "xc_core_x86.h"
>  #elif defined (__ia64__)
>  # include "xc_core_ia64.h"
> +#elif defined (__arm__)
> +# include "xc_core_arm.h"
>  #else
>  # error "unsupported architecture"
>  #endif
> diff --git a/tools/libxc/xc_core_arm.c b/tools/libxc/xc_core_arm.c
> new file mode 100644
> index 0000000..9009295
> --- /dev/null
> +++ b/tools/libxc/xc_core_arm.c
> @@ -0,0 +1,70 @@
> +/*
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation;
> + * version 2.1 of the License.
> + *
> + * This library 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
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 
>  USA
> + *
> + * Copyright (c) 2012 Citrix Systems Ltd.
> + */
> +
> +#include "xg_private.h"
> +#include "xc_core.h"
> +
> +int
> +xc_core_arch_gpfn_may_present(struct xc_core_arch_context *arch_ctxt,
> +                              unsigned long pfn)
> +{
> +    /* default to trying to map the page */
> +    /* TODO consult p2m */
> +    return 1;
> +}
> +
> +int
> +xc_core_arch_memory_map_get(xc_interface *xch,
> +                            struct xc_core_arch_context *arch_ctxt,
> +                            xc_dominfo_t *info,
> +                            shared_info_any_t *live_shinfo,
> +                            xc_core_memory_map_t **mapp,
> +                            unsigned int *nr_entries)
> +{
> +    /* TODO return the memory map! */
> +    ERROR("%s is not implemented yet\n", __func__);
> +    errno = ENOSYS;
> +    return -1;
> +}
> +
> +int
> +xc_core_arch_auto_translated_physmap(const xc_dominfo_t *info)
> +{
> +    /* All domains are auto_translated_physmap mode. */
> +    return 1;
> +}
> +
> +int
> +xc_core_arch_map_p2m(xc_interface *xch, unsigned int guest_width, 
> xc_dominfo_t *info,
> +                     shared_info_any_t *live_shinfo, xen_pfn_t **live_p2m,
> +                     unsigned long *pfnp)
> +{
> +    /* All domains are auto_translated_physmap mode. */
> +    errno = ENOSYS;
> +    return -1;
> +}
> +
> +/*
> + * Local variables:
> + * mode: C
> + * c-set-style: "BSD"
> + * c-basic-offset: 4
> + * tab-width: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
> diff --git a/tools/libxc/xc_core_arm.h b/tools/libxc/xc_core_arm.h
> new file mode 100644
> index 0000000..a2ef5a8
> --- /dev/null
> +++ b/tools/libxc/xc_core_arm.h
> @@ -0,0 +1,61 @@
> +/*
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library 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
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 
>  USA
> + *
> + * Copyright (c) 2007 Isaku Yamahata <yamahata at valinux co jp>
> + *                    VA Linux Systems Japan K.K.
> + *
> + */
> +
> +#ifndef XC_CORE_ARM_H
> +#define XC_CORE_ARM_H
> +
> +#define ELF_ARCH_DATA           ELFDATA2LSB
> +#define ELF_ARCH_MACHINE        EM_ARM
> +
> +struct xc_core_arch_context {
> +    /* nothing */
> +};
> +
> +#define xc_core_arch_context_init(arch_ctxt)            do {} while (0)
> +#define xc_core_arch_context_free(arch_ctxt)            do {} while (0)
> +#define xc_core_arch_context_get(arch_ctxt, ctxt, xch, domid) \
> +                                                                (0)
> +#define xc_core_arch_context_dump(xch, arch_ctxt, args, dump_rtn)    (0)
> +
> +int
> +xc_core_arch_gpfn_may_present(struct xc_core_arch_context *arch_ctxt,
> +                              unsigned long pfn);
> +static inline int
> +xc_core_arch_context_get_shdr(xc_interface *xch,
> +                              struct xc_core_arch_context *arch_ctxt, 
> +                              struct xc_core_section_headers *sheaders,
> +                              struct xc_core_strtab *strtab,
> +                              uint64_t *filesz, uint64_t offset)
> +{

/* TODO */ ?

> +    *filesz = 0;
> +    return 0;
> +}
> +
> +#endif /* XC_CORE_ARM_H */
> +
> +/*
> + * Local variables:
> + * mode: C
> + * c-set-style: "BSD"
> + * c-basic-offset: 4
> + * tab-width: 4
> + * indent-tabs-mode: nil
> + * End:
> + */
> diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h
> index 1e149c1..1054584 100644
> --- a/tools/libxc/xenctrl.h
> +++ b/tools/libxc/xenctrl.h
> @@ -81,6 +81,10 @@
>  #define xen_mb()   asm volatile ("mf" ::: "memory")
>  #define xen_rmb()  asm volatile ("mf" ::: "memory")
>  #define xen_wmb()  asm volatile ("mf" ::: "memory")
> +#elif defined(__arm__)
> +#define xen_mb()   asm volatile ("dsb" : : : "memory")
> +#define xen_rmb()  asm volatile ("dsb" : : : "memory")
> +#define xen_wmb()  asm volatile ("dsb" : : : "memory")
>  #else
>  #error "Define barriers"
>  #endif
 
I think the memory barriers are correct

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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