arm: compile tools
v4 cover arm: compile tools
Hi all,
this patch series allows tools/ to compile on ARM, mostly providing an empty implementation for all the arch specific functions that are needed.
Changes in v4:
- rebased on 55a36564fb4f85722c67f16fe508f3ecbd204549;
- minor compile fixes.
Changes in v3:
- move libxl_cpuid_policy_list_gen_json to libxl_(no)cpuid.c;
- rename xc_hvm_build.c to xc_hvm_build_x86.c;
- remove xc_nohvm, introduce xc_hvm_build_arm.c instead;
- remove "libxl: do not allocate e820 for non x86 guests.";
- introduce libxl__arch_domain_create.
Changes in v2:
- rebased on a22587ae517170a7755d3a88611ae0e2d5bb555e;
- dropped "arm: arch_dump_shared_mem_info as a no-op" that is already in xen-unstable;
- define xen_callback_t as uint64_t;
- define guest_word_t as uint64_t.
Ian Campbell (1):
arm: add stub hvm/save.h
Stefano Stabellini (6):
arm: compile libxc
arm: compile libxenguest
arm: compile memshr
arm: compile xentrace
arm: compile libxl
libxl: Introduce libxl__arch_domain_create
tools/libxc/Makefile | 13 +- tools/libxc/xc_core.h | 2 + tools/libxc/xc_core_arm.c | 106 +++++++ tools/libxc/xc_core_arm.h | 60 ++++ tools/libxc/xc_dom_arm.c | 49 +++ tools/libxc/xc_hvm_build.c | 511 -------------------------------- tools/libxc/xc_hvm_build_arm.c | 48 +++ tools/libxc/xc_hvm_build_x86.c | 511 ++++++++++++++++++++++++++++++++ tools/libxc/xc_nomigrate.c | 41 +++ tools/libxc/xenctrl.h | 4 + tools/libxl/Makefile | 5 +- tools/libxl/libxl_arch.h | 22 ++ tools/libxl/libxl_cpuid.c | 60 ++++ tools/libxl/libxl_create.c | 12 +- tools/libxl/libxl_internal.h | 2 - tools/libxl/libxl_json.c | 60 ---- tools/libxl/libxl_noarch.c | 8 + tools/libxl/libxl_nocpuid.c | 8 +- tools/libxl/libxl_pci.c | 242 --------------- tools/libxl/libxl_x86.c | 259 ++++++++++++++++ tools/memshr/bidir-hash.c | 31 ++ tools/xentrace/xenctx.c | 12 + xen/include/public/arch-arm/hvm/save.h | 39 +++ xen/include/public/hvm/save.h | 2 + 24 files changed, 1276 insertions(+), 831 deletions(-)
A git tree based on 55a36564fb4f85722c67f16fe508f3ecbd204549, is available here:
git://xenbits.xen.org/people/sstabellini/xen-unstable.git arm-tools-4
Cheers,
Stefano
PATCH v4 1/7 arm: add stub hvm/save.h
From: Ian Campbell <[email protected]>
--- xen/include/public/arch-arm/hvm/save.h | 39 ++++++++++++++++++++++++++++++++ xen/include/public/hvm/save.h | 2 + 2 files changed, 41 insertions(+), 0 deletions(-) create mode 100644 xen/include/public/arch-arm/hvm/save.h
xen/include/public/arch-arm/hvm/save.h new file +39 -0
@@ -0,0 +1,39 @@ +/* +* Structure definitions for HVM state that is held by Xen and must +* be saved along with the domain's memory and device-model state. +* +* Copyright (c) 2012 Citrix Systems Ltd. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to +* deal in the Software without restriction, including without limitation the +* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +* sell copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#ifndef __XEN_PUBLIC_HVM_SAVE_ARM_H__ +#define __XEN_PUBLIC_HVM_SAVE_ARM_H__ + +#endif + +/* +* Local variables: +* mode: C +* c-set-style: "BSD" +* c-basic-offset: 4 +* tab-width: 4 +* indent-tabs-mode: nil +* End: +*/
xen/include/public/hvm/save.h +2 -0
@@ -104,6 +104,8 @@ DECLARE_HVM_SAVE_TYPE(END, 0, struct hvm_save_end);#include "../arch-x86/hvm/save.h" #elif defined(__ia64__)#include "../arch-ia64/hvm/save.h" +#elif defined(__arm__) +#include "../arch-arm/hvm/save.h" #else #error "unsupported architecture"#endif
Signature · 1 line
1.7.2.5
PATCH v4 2/7 arm: compile libxc
In reply to Stefano StabelliniIntroduce an empty implementation of the arch specific ARM functions in xc_core_arm.c and xc_core_arm.h; define barriers on ARM.
--- tools/libxc/Makefile | 1 + tools/libxc/xc_core.h | 2 + tools/libxc/xc_core_arm.c | 106 +++++++++++++++++++++++++++++++++++++++++++++ tools/libxc/xc_core_arm.h | 60 +++++++++++++++++++++++++ tools/libxc/xenctrl.h | 4 ++ 5 files changed, 173 insertions(+), 0 deletions(-) create mode 100644 tools/libxc/xc_core_arm.c create mode 100644 tools/libxc/xc_core_arm.h
tools/libxc/Makefile +1 -0
@@ -8,6 +8,7 @@ CTRL_SRCS-y := CTRL_SRCS-y += xc_core.c CTRL_SRCS-$(CONFIG_X86) += xc_core_x86.c CTRL_SRCS-$(CONFIG_IA64) += xc_core_ia64.c +CTRL_SRCS-$(CONFIG_ARM) += xc_core_arm.c CTRL_SRCS-y += xc_cpupool.c CTRL_SRCS-y += xc_domain.c CTRL_SRCS-y += xc_evtchn.c
tools/libxc/xc_core.h +2 -0
@@ -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
tools/libxc/xc_core_arm.c new file +106 -0
106 lines not on this page · raw message
tools/libxc/xc_core_arm.h new file +60 -0
60 lines not on this page · raw message
tools/libxc/xenctrl.h +4 -0
@@ -83,6 +83,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 ("dmb" : : : "memory") +#define xen_rmb () asm volatile ("dmb" : : : "memory") +#define xen_wmb () asm volatile ("dmb" : : : "memory")#else #error "Define barriers"#endif
Signature · 1 line
1.7.2.5
Re: [PATCH v4 2/7] arm: compile libxc
tools/libxc/xc_core_arm.c line 74
Quoted 9 lines · Stefano Stabellini
(quoted diff) +2
-0+static int +xc_core_arch_map_p2m_rw(xc_interface *xch, struct domain_info_context*dinfo,
xc_dominfo_t*info,
+shared_info_any_t*live_shinfo,xen_pfn_t
**live_p2m,tools/libxc/xc_core_arm.c new file +3
-0+ unsigned long *pfnp, int rw) +{ +return -ENOSYS ;
I only just noticed this: libxc is supposed to set errno and return -1, not return -Efoo.
There's a few of these in this series. I actually noticed it in xc_hvm_build_arm.c but this was the first one I came across when grepping my mail.
Ian.
Re: [PATCH v4 2/7] arm: compile libxc
Quoted 14 lines · Ian Campbell
tools/libxc/xc_core_arm.c line 74
Quoted 9 lines · Stefano Stabellini
(quoted diff) +2
-0+static int +xc_core_arch_map_p2m_rw(xc_interface *xch, struct domain_info_context*dinfo,
xc_dominfo_t*info,
+shared_info_any_t*live_shinfo,xen_pfn_t
**live_p2m,tools/libxc/xc_core_arm.c new file +3
-0+ unsigned long *pfnp, int rw) +{ +return -ENOSYS ;I only just noticed this: libxc is supposed to set errno and return -1, not return -Efoo.
Quoted 3 lines
There's a few of these in this series. I actually noticed it in
xc_hvm_build_arm.cbut this was the first one I came across when grepping my mail.
If you are resending, could you also add the emacs magic comments to the tail of any new files.
Thanks,
Ian.
PATCH v4 3/7 arm: compile libxenguest
In reply to Stefano StabelliniIntroduce an empty implementation of the arch specific ARM functions in xc_dom_arm.c.
Provide empty implementations of xc_domain_save and xc_domain_restore when CONFIG_MIGRATE is not set.
Move xc_hvm_build.c to xc_hvm_build_x86.c because the implementation is x86 specific, introduce xc_hvm_build_arm.c with empty stubs.
Changes in v3:
- rename xc_hvm_build.c to xc_hvm_build_x86.c;
- remove xc_nohvm, introduce xc_hvm_build_arm.c instead;
--- tools/libxc/Makefile | 12 +- tools/libxc/xc_dom_arm.c | 49 ++++ tools/libxc/xc_hvm_build.c | 511 ---------------------------------------- tools/libxc/xc_hvm_build_arm.c | 48 ++++ tools/libxc/xc_hvm_build_x86.c | 511 ++++++++++++++++++++++++++++++++++++++++ tools/libxc/xc_nomigrate.c | 41 ++++ 6 files changed, 658 insertions(+), 514 deletions(-) create mode 100644 tools/libxc/xc_dom_arm.c delete mode 100644 tools/libxc/xc_hvm_build.c create mode 100644 tools/libxc/xc_hvm_build_arm.c create mode 100644 tools/libxc/xc_hvm_build_x86.c create mode 100644 tools/libxc/xc_nomigrate.c
tools/libxc/Makefile +9 -3
@@ -42,9 +42,12 @@ CTRL_SRCS-$(CONFIG_MiniOS) += xc_minios.c GUEST_SRCS-y := GUEST_SRCS-y += xg_private.c xc_suspend.c -GUEST_SRCS-$(CONFIG_MIGRATE) += xc_domain_restore.c xc_domain_save.c -GUEST_SRCS-$(CONFIG_MIGRATE) += xc_offline_page.c xc_compression.c -GUEST_SRCS-$(CONFIG_HVM) += xc_hvm_build.c +ifeq ($(CONFIG_MIGRATE),y) +GUEST_SRCS-y += xc_domain_restore.c xc_domain_save.c +GUEST_SRCS-y += xc_offline_page.c xc_compression.c +else +GUEST_SRCS-y += xc_nomigrate.c +endif vpath %.c ../../xen/common/libelf CFLAGS += -I../../xen/common/libelf
@@ -61,7 +64,10 @@ GUEST_SRCS-y += xc_dom_compat_linux.c GUEST_SRCS-$(CONFIG_X86) += xc_dom_x86.c GUEST_SRCS-$(CONFIG_X86) += xc_cpuid_x86.c +GUEST_SRCS-$(CONFIG_X86) += xc_hvm_build_x86.c GUEST_SRCS-$(CONFIG_IA64) += xc_dom_ia64.c +GUEST_SRCS-$(CONFIG_ARM) += xc_dom_arm.c +GUEST_SRCS-$(CONFIG_ARM) += xc_hvm_build_arm.c OSDEP_SRCS-y += xenctrl_osdep_ENOSYS.c
tools/libxc/xc_dom_arm.c new file +49 -0
49 lines not on this page · raw message
tools/libxc/xc_hvm_build.c deleted +0 -511
511 lines not on this page · raw message
tools/libxc/xc_hvm_build_arm.c new file +48 -0
48 lines not on this page · raw message
tools/libxc/xc_hvm_build_x86.c new file +511 -0
511 lines not on this page · raw message
tools/libxc/xc_nomigrate.c new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
1.7.2.5
Re: [PATCH v4 3/7] arm: compile libxenguest
Quoted 10 lines · Stefano Stabellini
Introduce an empty implementation of the arch specific ARM functions in
xc_dom_arm.c.
Provide empty implementations ofxc_domain_saveandxc_domain_restorewhenCONFIG_MIGRATEis not set.
Movexc_hvm_build.ctoxc_hvm_build_x86.cbecause the implementation is x86 specific, introducexc_hvm_build_arm.cwith empty stubs.Changes in v3:
Quoted 7 lines
- rename
xc_hvm_build.ctoxc_hvm_build_x86.c;- remove
xc_nohvm, introducexc_hvm_build_arm.cinstead;Signed-off-by Stefano Stabellini <[email protected]>
PATCH v4 4/7 arm: compile memshr
In reply to Stefano Stabellini--- tools/memshr/bidir-hash.c | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-)
tools/memshr/bidir-hash.c +31 -0
@@ -109,6 +109,37 @@ static void hash_resize(struct __hash *h); } while (0) static inline void atomic_inc(uint32_t *v) { ia64_fetchadd4_rel(v, 1); }static inline void atomic_dec (uint32_t *v) {ia64_fetchadd4_rel (v,-1 ); } +#elif defined(__arm__) +static inline void atomic_inc (uint32_t *v) +{ +unsigned long tmp; +int result; + + __asm__ __volatile__("@ atomic_add\n" +"1: ldrex %0, [%3]\n" +" add %0, %0, #1\n" +" strex %1, %0, [%3]\n" +" teq %1, #0\n" +" bne 1b" + :"=&r" (result),"=&r" (tmp),"+Qo" (*v) + :"r" (v) + :"cc" ); +} +static inline void atomic_dec (uint32_t *v) +{ +unsigned long tmp; +int result; + + __asm__ __volatile__("@ atomic_sub\n" +"1: ldrex %0, [%3]\n" +" sub %0, %0, #1\n" +" strex %1, %0, [%3]\n" +" teq %1, #0\n" +" bne 1b" + :"=&r" (result),"=&r" (tmp),"+Qo" (*v) + :"r" (v) + :"cc" ); +}#else /* __x86__ */ static inline void atomic_inc (uint32_t *v) {
Signature · 1 line
1.7.2.5
PATCH v4 5/7 arm: compile xentrace
In reply to Stefano Stabellini--- tools/xentrace/xenctx.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
tools/xentrace/xenctx.c +12 -0
@@ -60,6 +60,12 @@ int disp_ar_regs;int disp_br_regs;int disp_bank_regs;int disp_tlb; + +#elif defined(__arm__) +#define NO_TRANSLATION +typedef uint64_t guest_word_t ; +#define FMT_32B_WORD "%08llx" +#define FMT_64B_WORD "%016llx"#endif struct symbol {
@@ -678,6 +684,12 @@ void print_ctx(vcpu_guest_context_any_t *ctx) print_tr(i, &tr->dtrs[i]); } } +#elif defined(__arm__) +static void print_ctx (vcpu_guest_context_any_t *ctx) +{ +/* XXX: properly implement this */ +print_symbol (0 ); +}#endif #ifndef NO_TRANSLATION
Signature · 1 line
1.7.2.5
PATCH v4 6/7 arm: compile libxl
In reply to Stefano Stabellinilibxl_cpuid_destroy has been renamed to libxl_cpuid_dispose; also cpuid functions are only available on x86, so ifdef the new cpuid related function in libxl_json.c.
Changes in v3:
- move libxl_cpuid_policy_list_gen_json to libxl_(no)cpuid.c.
--- tools/libxl/Makefile | 1 + tools/libxl/libxl_cpuid.c | 60 +++++++++++++++++++++++++++++++++++++++++++ tools/libxl/libxl_json.c | 60 ------------------------------------------- tools/libxl/libxl_nocpuid.c | 8 +++++- 4 files changed, 68 insertions(+), 61 deletions(-)
tools/libxl/Makefile +1 -0
@@ -36,6 +36,7 @@ LIBXL_OBJS-y += libxl_noblktap2.o endif LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o LIBXL_OBJS-$(CONFIG_IA64) += libxl_nocpuid.o +LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o ifeq ($(CONFIG_NetBSD),y) LIBXL_OBJS-y += libxl_netbsd.o
tools/libxl/libxl_cpuid.c +60 -0
66 lines not on this page · raw message
tools/libxl/libxl_json.c +0 -60
66 lines not on this page · raw message
tools/libxl/libxl_nocpuid.c +7 -1
@@ -14,7 +14,7 @@#include "libxl_internal.h" -void libxl_cpuid_destroy (libxl_cpuid_policy_list *p_cpuid_list) +void libxl_cpuid_dispose (libxl_cpuid_policy_list *p_cpuid_list) { }
@@ -38,6 +38,12 @@ void libxl_cpuid_set(libxl_ctx *ctx, uint32_t domid, { } +yajl_gen_status libxl_cpuid_policy_list_gen_json (yajl_gen hand, +libxl_cpuid_policy_list *pcpuid) +{ +return 0 ; +} +/* * Local variables: * mode: C
Signature · 1 line
1.7.2.5
PATCH v4 7/7 libxl: Introduce libxl__arch_domain_create
In reply to Stefano StabelliniIntroduce an arch specific internal domain creation function. At the moment only x86 provides an implementation.
--- tools/libxl/Makefile | 6 +- tools/libxl/libxl_arch.h | 22 ++++ tools/libxl/libxl_create.c | 12 +-- tools/libxl/libxl_internal.h | 2 - tools/libxl/libxl_noarch.c | 8 ++ tools/libxl/libxl_pci.c | 242 --------------------------------------- tools/libxl/libxl_x86.c | 259 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 294 insertions(+), 257 deletions(-) create mode 100644 tools/libxl/libxl_arch.h create mode 100644 tools/libxl/libxl_noarch.c create mode 100644 tools/libxl/libxl_x86.c
tools/libxl/Makefile +3 -3
@@ -34,9 +34,9 @@ LIBXL_OBJS-y += libxl_blktap2.o else LIBXL_OBJS-y += libxl_noblktap2.o endif -LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o -LIBXL_OBJS-$(CONFIG_IA64) += libxl_nocpuid.o -LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o +LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o libxl_x86.o +LIBXL_OBJS-$(CONFIG_IA64) += libxl_nocpuid.o libxl_noarch.o +LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o libxl_noarch.o ifeq ($(CONFIG_NetBSD),y) LIBXL_OBJS-y += libxl_netbsd.o
tools/libxl/libxl_arch.h new file +22 -0
@@ -0,0 +1,22 @@ +/* +* Copyright (C) 2012 Citrix Ltd. +* +* This program 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 only. with the special +* exception on linking described in file LICENSE. +* +* 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 Lesser General Public License for more details. +*/ + +#ifndef LIBXL_ARCH_H +#define LIBXL_ARCH_H + +/* arch specific internal domain creation function */ +int libxl__arch_domain_create (libxl__gc *gc,libxl_domain_config *d_config, +uint32_t domid); + +#endif
tools/libxl/libxl_create.c +2 -10
@@ -18,6 +18,7 @@#include "libxl_osdeps.h" /* must come before any other headers */ #include "libxl_internal.h" +#include "libxl_arch.h" #include <xc_dom.h> #include <xenguest.h>
@@ -616,16 +617,7 @@ static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config, goto error_out; } } - -if (d_config->c_info.type ==LIBXL_DOMAIN_TYPE_PV && - d_config->b_info.u.pv.e820_host) { -int rc; - rc =libxl__e820_alloc (gc, domid, d_config); -if (rc) -LIBXL__LOG_ERRNO (ctx,LIBXL__LOG_ERROR , -"Failed while collecting E820 with: %d (errno:%d)\n" , - rc, errno); - } +libxl__arch_domain_create (gc, d_config, domid);if ( cb && (d_config->c_info.type ==LIBXL_DOMAIN_TYPE_HVM || (d_config->c_info.type ==LIBXL_DOMAIN_TYPE_PV && d_config->b_info.u.pv.bootloader ))) {
tools/libxl/libxl_internal.h +0 -2
@@ -975,8 +975,6 @@ _hidden int libxl__error_set(libxl__gc *gc, int code); _hidden int libxl__file_reference_map(libxl_file_reference *f); _hidden int libxl__file_reference_unmap(libxl_file_reference *f); -_hidden int libxl__e820_alloc(libxl__gc *gc, uint32_t domid, libxl_domain_config *d_config); -/* parse the string @s as a sequence of 6 colon separated bytes in to @mac */ _hidden int libxl__parse_mac(const char *s, libxl_mac mac);/* compare mac address @a and @b. 0 if the same, -ve if a<b and +ve if a>b */
tools/libxl/libxl_noarch.c new file +8 -0
@@ -0,0 +1,8 @@ +#include "libxl_internal.h" +#include "libxl_arch.h" + +int libxl__arch_domain_create (libxl__gc *gc,libxl_domain_config *d_config, +uint32_t domid) +{ +return 0 ; +}
tools/libxl/libxl_pci.c +0 -242
248 lines not on this page · raw message
tools/libxl/libxl_x86.c new file +259 -0
259 lines not on this page · raw message
Signature · 1 line
1.7.2.5
Re: [PATCH v4 7/7] libxl: Introduce libxl__arch_domain_create
Quoted 4 lines · Stefano Stabellini
Introduce an arch specific internal domain creation function. At the moment only x86 provides an implementation.
Signed-off-by Stefano Stabellini <[email protected]>
Assuming this really is mostly code motion as it appears then:
Quoted 3 lines · Stefano Stabellini
Hi all,
this patch series allowstools/to compile on ARM, mostly providing an empty implementation for all the arch specific functions that are needed.
I think I've acked (or authored) everything here. Since the majority of the actual meat is changes or movement of non-ARM related code I'll leave it to IanJ to actually commit.
Ian.