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.
Ian Campbell (4):
arm: add stub hvm/save.h
libxl: do not allocate e820 for non x86 guests.
blktap2/libvhd: Build shared objects using -fPIC.
tools: only compile libfsimage/xfs on X86
Stefano Stabellini (7):
arm: few missing #define
arm: arch_dump_shared_mem_info as a no-op
arm: compile libxc
arm: compile libxenguest
arm: compile libxl
arm: compile memshr
arm: compile xentrace
tools/blktap2/vhd/lib/Makefile | 13 +++-
tools/libfsimage/Makefile | 3 +-
tools/libxc/Makefile | 16 ++++-
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_nohvm.c | 31 +++++++++
tools/libxc/xc_nomigrate.c | 40 ++++++++++++
tools/libxc/xenctrl.h | 4 +
tools/libxl/Makefile | 1 +
tools/libxl/libxl_create.c | 3 +-
tools/libxl/libxl_json.c | 8 +++
tools/libxl/libxl_nocpuid.c | 2 +-
tools/libxl/libxl_pci.c | 2 +
tools/memshr/bidir-hash.c | 31 +++++++++
tools/xentrace/xenctx.c | 12 ++++
xen/arch/arm/mm.c | 4 +
xen/include/public/arch-arm.h | 2 +
xen/include/public/arch-arm/hvm/save.h | 39 ++++++++++++
xen/include/public/hvm/save.h | 2 +
xen/include/public/io/protocols.h | 3 +
22 files changed, 423 insertions(+), 10 deletions(-)
A git tree based on 28b2fd7fcdc735178c509a895e52db07964c7b1b, plus my
previous arm patch series, is available here:
git://xenbits.xen.org/people/sstabellini/xen-unstable.git arm-tools-1
Cheers,
Stefano
Few missing #define are the cause of a compile failure with
XEN_TARGET_ARM=arm and XEN_COMPILE_ARM=arm (for example in the case of a
native compilation). This patch fill the gaps.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
xen/include/public/arch-arm.h | 2 ++
xen/include/public/io/protocols.h | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index c430cf3..e04c4fd 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -110,6 +110,8 @@ typedef struct arch_vcpu_info arch_vcpu_info_t;
struct arch_shared_info { };
typedef struct arch_shared_info arch_shared_info_t;
+typedef unsigned long xen_callback_t;
+
#endif
#endif /* __XEN_PUBLIC_ARCH_ARM_H__ */
diff --git a/xen/include/public/io/protocols.h
b/xen/include/public/io/protocols.h
index 77bd1bd..0b7a2ea 100644
--- a/xen/include/public/io/protocols.h
+++ b/xen/include/public/io/protocols.h
@@ -26,6 +26,7 @@
#define XEN_IO_PROTO_ABI_X86_32 "x86_32-abi"
#define XEN_IO_PROTO_ABI_X86_64 "x86_64-abi"
#define XEN_IO_PROTO_ABI_IA64 "ia64-abi"
+#define XEN_IO_PROTO_ABI_ARM "arm-abi"
#if defined(__i386__)
# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32
@@ -33,6 +34,8 @@
# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_64
#elif defined(__ia64__)
# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_IA64
+#elif defined(__arm__)
+# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_ARM
#else
# error arch fixup needed here
#endif
--
1.7.8.3
From: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Campbell <ian.campbell@citrix.com> --- 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 diff --git a/xen/include/public/arch-arm/hvm/save.h b/xen/include/public/arch-arm/hvm/save.h new file mode 100644 index 0000000..ec61298 --- /dev/null +++ b/xen/include/public/arch-arm/hvm/save.h @@ -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: + */ diff --git a/xen/include/public/hvm/save.h b/xen/include/public/hvm/save.h index d0f2661..58f8433 100644 --- a/xen/include/public/hvm/save.h +++ b/xen/include/public/hvm/save.h @@ -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 -- 1.7.8.3
Stefano Stabellini
2012-Feb-02 16:38 UTC
[PATCH 03/11] arm: arch_dump_shared_mem_info as a no-op
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
xen/arch/arm/mm.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 613d084..7ce9a70 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -311,6 +311,10 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t
pe)
frametable_virt_end = FRAMETABLE_VIRT_START + (nr_pages * sizeof(struct
page_info));
}
+/* Simple no-op */
+void arch_dump_shared_mem_info(void)
+{
+}
/*
* Local variables:
* mode: C
--
1.7.8.3
Stefano Stabellini
2012-Feb-02 16:38 UTC
[PATCH 04/11] libxl: do not allocate e820 for non x86 guests.
From: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
tools/libxl/libxl_create.c | 3 ++-
tools/libxl/libxl_pci.c | 2 ++
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index e1c615f..05c0b67 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -652,7 +652,7 @@ static int do_domain_create(libxl__gc *gc,
libxl_domain_config *d_config,
goto error_out;
}
}
-
+#if defined(__i386__) || defined(__x86_64__)
if (d_config->c_info.type == LIBXL_DOMAIN_TYPE_PV &&
d_config->b_info.u.pv.e820_host) {
int rc;
@@ -662,6 +662,7 @@ static int do_domain_create(libxl__gc *gc,
libxl_domain_config *d_config,
"Failed while collecting E820 with: %d
(errno:%d)\n",
rc, errno);
}
+#endif
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 ))) {
diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
index 99591c2..c545b85 100644
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -1149,6 +1149,7 @@ int libxl__device_pci_destroy_all(libxl__gc *gc, uint32_t
domid)
return 0;
}
+#if defined(__i386__) || defined(__x86_64__)
static const char *e820_names(int type)
{
switch (type) {
@@ -1390,6 +1391,7 @@ int libxl__e820_alloc(libxl__gc *gc, uint32_t domid,
libxl_domain_config *d_conf
}
return 0;
}
+#endif
/*
* Local variables:
--
1.7.8.3
Stefano Stabellini
2012-Feb-02 16:38 UTC
[PATCH 05/11] blktap2/libvhd: Build shared objects using -fPIC.
From: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Campbell <ian.campbell@citrix.com> --- tools/blktap2/vhd/lib/Makefile | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/blktap2/vhd/lib/Makefile b/tools/blktap2/vhd/lib/Makefile index b72e4d9..1acee70 100644 --- a/tools/blktap2/vhd/lib/Makefile +++ b/tools/blktap2/vhd/lib/Makefile @@ -49,27 +49,32 @@ LIB-SRCS += atomicio.c LIB-OBJS = $(patsubst %.c,%.o,$(LIB-SRCS)) LIB-OBJS += $(LVM-UTIL-OBJ) +LIB-PICOBJS = $(patsubst %.o,%.opic,$(LIB-OBJS)) + LIBVHD = libvhd.a libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) all: build -build: $(LIBVHD-BUILD) +build: libvhd.a libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) libvhd.a: $(LIB-OBJS) + $(AR) rc $@ $^ + +libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR): $(LIB-PICOBJS) $(CC) -Wl,$(SONAME_LDFLAG),$(LIBVHD-SONAME) $(SHLIB_LDFLAGS) \ $(LDFLAGS) -o libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) $^ $(LIBS) ln -sf libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) libvhd.so.$(LIBVHD-MAJOR) ln -sf libvhd.so.$(LIBVHD-MAJOR) libvhd.so - $(AR) rc $@ $^ install: all $(INSTALL_DIR) -p $(DESTDIR)$(INST-DIR) - $(INSTALL_PROG) $(LIBVHD) $(DESTDIR)$(INST-DIR) + $(INSTALL_PROG) libvhd.a $(DESTDIR)$(INST-DIR) + $(INSTALL_PROG) libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) $(DESTDIR)$(INST-DIR) ln -sf libvhd.so.$(LIBVHD-MAJOR).$(LIBVHD-MINOR) $(DESTDIR)$(INST-DIR)/libvhd.so.$(LIBVHD-MAJOR) ln -sf libvhd.so.$(LIBVHD-MAJOR) $(DESTDIR)$(INST-DIR)/libvhd.so clean: - rm -rf *.a *.so* *.o *~ $(DEPS) $(LIBVHD) + rm -rf *.a *.so* *.o *.opic *~ $(DEPS) $(LIBVHD) .PHONY: all build clean install libvhd -- 1.7.8.3
Introduce an empty implementation of the arch specific ARM functions in
xc_core_arm.c and xc_core_arm.h; define barriers on ARM.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
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
diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile
index b5e7022..f2e1ba7 100644
--- a/tools/libxc/Makefile
+++ b/tools/libxc/Makefile
@@ -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
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..b1482ec
--- /dev/null
+++ b/tools/libxc/xc_core_arm.c
@@ -0,0 +1,106 @@
+/*
+ * 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) 2011 Citrix Systems
+ *
+ */
+
+#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)
+{
+ /* TODO: memory from DT */
+ if (pfn >= 0x80000 && pfn < 0x88000)
+ return 1;
+ return 0;
+}
+
+
+static int nr_gpfns(xc_interface *xch, domid_t domid)
+{
+ return xc_domain_maximum_gpfn(xch, domid) + 1;
+}
+
+int
+xc_core_arch_auto_translated_physmap(const xc_dominfo_t *info)
+{
+ return 1;
+}
+
+int
+xc_core_arch_memory_map_get(xc_interface *xch, struct xc_core_arch_context
*unused,
+ xc_dominfo_t *info, shared_info_any_t *live_shinfo,
+ xc_core_memory_map_t **mapp,
+ unsigned int *nr_entries)
+{
+ unsigned long p2m_size = nr_gpfns(xch, info->domid);
+ xc_core_memory_map_t *map;
+
+ map = malloc(sizeof(*map));
+ if ( map == NULL )
+ {
+ PERROR("Could not allocate memory");
+ return -1;
+ }
+
+ map->addr = 0;
+ map->size = ((uint64_t)p2m_size) << PAGE_SHIFT;
+
+ *mapp = map;
+ *nr_entries = 1;
+ return 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,
+ unsigned long *pfnp, int rw)
+{
+ return -ENOSYS;
+}
+
+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)
+{
+ struct domain_info_context _dinfo = { .guest_width = guest_width };
+ struct domain_info_context *dinfo = &_dinfo;
+ return xc_core_arch_map_p2m_rw(xch, dinfo, info,
+ live_shinfo, live_p2m, pfnp, 0);
+}
+
+int
+xc_core_arch_map_p2m_writable(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)
+{
+ struct domain_info_context _dinfo = { .guest_width = guest_width };
+ struct domain_info_context *dinfo = &_dinfo;
+ return xc_core_arch_map_p2m_rw(xch, dinfo, info,
+ live_shinfo, live_p2m, pfnp, 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..3a6be2a
--- /dev/null
+++ b/tools/libxc/xc_core_arm.h
@@ -0,0 +1,60 @@
+/*
+ * 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) 2012 Citrix Systems
+ *
+ */
+
+#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)
+{
+ *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 7813331..a8235fb 100644
--- a/tools/libxc/xenctrl.h
+++ b/tools/libxc/xenctrl.h
@@ -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
--
1.7.8.3
Introduce an empty implementation of the arch specific ARM functions in
xc_dom_arm.c.
Also provide empty implementations of xc_domain_save, xc_domain_restore
and xc_hvm_build_target_mem when CONFIG_HVM or CONFIG_MIGRATE are not
set.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
tools/libxc/Makefile | 15 ++++++++++--
tools/libxc/xc_dom_arm.c | 49 ++++++++++++++++++++++++++++++++++++++++++++
tools/libxc/xc_nohvm.c | 31 +++++++++++++++++++++++++++
tools/libxc/xc_nomigrate.c | 40 +++++++++++++++++++++++++++++++++++
4 files changed, 132 insertions(+), 3 deletions(-)
create mode 100644 tools/libxc/xc_dom_arm.c
create mode 100644 tools/libxc/xc_nohvm.c
create mode 100644 tools/libxc/xc_nomigrate.c
diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile
index f2e1ba7..57ceee6 100644
--- a/tools/libxc/Makefile
+++ b/tools/libxc/Makefile
@@ -42,9 +42,17 @@ 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
+ifeq ($(CONFIG_HVM),y)
+GUEST_SRCS-y += xc_hvm_build.c
+else
+GUEST_SRCS-y += xc_nohvm.c
+endif
vpath %.c ../../xen/common/libelf
CFLAGS += -I../../xen/common/libelf
@@ -62,6 +70,7 @@ 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_IA64) += xc_dom_ia64.c
+GUEST_SRCS-$(CONFIG_ARM) += xc_dom_arm.c
OSDEP_SRCS-y += xenctrl_osdep_ENOSYS.c
diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c
new file mode 100644
index 0000000..bdd28e1
--- /dev/null
+++ b/tools/libxc/xc_dom_arm.c
@@ -0,0 +1,49 @@
+/*
+ * Xen domain builder -- ARM
+ *
+ * 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) 2011, Citrix Systems
+ */
+#include <inttypes.h>
+#include <xen/xen.h>
+#include "xg_private.h"
+#include "xc_dom.h"
+
+int arch_setup_meminit(struct xc_dom_image *dom)
+{
+ return -ENOSYS;
+}
+
+int arch_setup_bootearly(struct xc_dom_image *dom)
+{
+ DOMPRINTF("%s: doing nothing", __FUNCTION__);
+ return 0;
+}
+
+int arch_setup_bootlate(struct xc_dom_image *dom)
+{
+ DOMPRINTF("%s: doing nothing", __FUNCTION__);
+ return 0;
+}
+/*
+ * 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_nohvm.c b/tools/libxc/xc_nohvm.c
new file mode 100644
index 0000000..a899f7c
--- /dev/null
+++ b/tools/libxc/xc_nohvm.c
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * 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) 2011, Citrix Systems
+ */
+
+#include <inttypes.h>
+#include <errno.h>
+#include <xenctrl.h>
+#include <xenguest.h>
+
+int xc_hvm_build_target_mem(xc_interface *xch,
+ uint32_t domid,
+ int memsize,
+ int target,
+ const char *image_name)
+{
+ return -ENOSYS;
+}
diff --git a/tools/libxc/xc_nomigrate.c b/tools/libxc/xc_nomigrate.c
new file mode 100644
index 0000000..63090e0
--- /dev/null
+++ b/tools/libxc/xc_nomigrate.c
@@ -0,0 +1,40 @@
+/******************************************************************************
+ * 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) 2011, Citrix Systems
+ */
+
+#include <inttypes.h>
+#include <errno.h>
+#include <xenctrl.h>
+#include <xenguest.h>
+
+int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t
max_iters,
+ uint32_t max_factor, uint32_t flags,
+ struct save_callbacks* callbacks, int hvm,
+ unsigned long vm_generationid_addr)
+{
+ return -ENOSYS;
+}
+
+int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
+ unsigned int store_evtchn, unsigned long *store_mfn,
+ unsigned int console_evtchn, unsigned long *console_mfn,
+ unsigned int hvm, unsigned int pae, int superpages,
+ int no_incr_generationid,
+ unsigned long *vm_generationid_addr)
+{
+ return -ENOSYS;
+}
--
1.7.8.3
libxl_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.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
tools/libxl/Makefile | 1 +
tools/libxl/libxl_json.c | 8 ++++++++
tools/libxl/libxl_nocpuid.c | 2 +-
3 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
index 3c3661b..5dcaa0e 100644
--- a/tools/libxl/Makefile
+++ b/tools/libxl/Makefile
@@ -32,6 +32,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
diff --git a/tools/libxl/libxl_json.c b/tools/libxl/libxl_json.c
index 6ff2910..f35943b 100644
--- a/tools/libxl/libxl_json.c
+++ b/tools/libxl/libxl_json.c
@@ -140,6 +140,7 @@ out:
return s;
}
+#if defined(__i386__) || defined(__x86_64__)
yajl_gen_status libxl_cpuid_policy_list_gen_json(yajl_gen hand,
libxl_cpuid_policy_list *pcpuid)
{
@@ -199,6 +200,13 @@ empty:
out:
return s;
}
+#else
+yajl_gen_status libxl_cpuid_policy_list_gen_json(yajl_gen hand,
+ libxl_cpuid_policy_list *pcpuid)
+{
+ return 0;
+}
+#endif
yajl_gen_status libxl_string_list_gen_json(yajl_gen hand, libxl_string_list
*pl)
{
diff --git a/tools/libxl/libxl_nocpuid.c b/tools/libxl/libxl_nocpuid.c
index 9e52f8d..313d55b 100644
--- a/tools/libxl/libxl_nocpuid.c
+++ b/tools/libxl/libxl_nocpuid.c
@@ -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)
{
}
--
1.7.8.3
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
tools/memshr/bidir-hash.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/tools/memshr/bidir-hash.c b/tools/memshr/bidir-hash.c
index 6c0dc3d..45d473e 100644
--- a/tools/memshr/bidir-hash.c
+++ b/tools/memshr/bidir-hash.c
@@ -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)
{
--
1.7.8.3
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
tools/xentrace/xenctx.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/tools/xentrace/xenctx.c b/tools/xentrace/xenctx.c
index a12cc21..29c70e1 100644
--- a/tools/xentrace/xenctx.c
+++ b/tools/xentrace/xenctx.c
@@ -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 unsigned long long 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
--
1.7.8.3
Stefano Stabellini
2012-Feb-02 16:38 UTC
[PATCH 11/11] tools: only compile libfsimage/xfs on X86
From: Ian Campbell <ian.campbell@citrix.com> xfs is not portable, only compile it on X86 Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> --- tools/libfsimage/Makefile | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/tools/libfsimage/Makefile b/tools/libfsimage/Makefile index 2deb830..bcb8b40 100644 --- a/tools/libfsimage/Makefile +++ b/tools/libfsimage/Makefile @@ -1,7 +1,8 @@ XEN_ROOT = $(CURDIR)/../.. include $(XEN_ROOT)/tools/Rules.mk -SUBDIRS-y = common ufs reiserfs iso9660 fat zfs xfs +SUBDIRS-y = common ufs reiserfs iso9660 fat zfs +SUBDIRS-$(CONFIG_X86) += xfs SUBDIRS-y += $(shell env CC="$(CC)" ./check-libext2fs) .PHONY: all clean install -- 1.7.8.3
At 16:38 +0000 on 02 Feb (1328200680), Stefano Stabellini wrote:> Few missing #define are the cause of a compile failure with > XEN_TARGET_ARM=arm and XEN_COMPILE_ARM=arm (for example in the case of a > native compilation). This patch fill the gaps. > > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > --- > xen/include/public/arch-arm.h | 2 ++ > xen/include/public/io/protocols.h | 3 +++ > 2 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h > index c430cf3..e04c4fd 100644 > --- a/xen/include/public/arch-arm.h > +++ b/xen/include/public/arch-arm.h > @@ -110,6 +110,8 @@ typedef struct arch_vcpu_info arch_vcpu_info_t; > > struct arch_shared_info { }; > typedef struct arch_shared_info arch_shared_info_t; > +typedef unsigned long xen_callback_t;Can we make all new public interfaces explicitly sized, please? Cheers, Tim.
On Thu, 2012-02-02 at 16:41 +0000, Tim Deegan wrote:> At 16:38 +0000 on 02 Feb (1328200680), Stefano Stabellini wrote: > > Few missing #define are the cause of a compile failure with > > XEN_TARGET_ARM=arm and XEN_COMPILE_ARM=arm (for example in the case of a > > native compilation). This patch fill the gaps. > > > > Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> > > --- > > xen/include/public/arch-arm.h | 2 ++ > > xen/include/public/io/protocols.h | 3 +++ > > 2 files changed, 5 insertions(+), 0 deletions(-) > > > > diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h > > index c430cf3..e04c4fd 100644 > > --- a/xen/include/public/arch-arm.h > > +++ b/xen/include/public/arch-arm.h > > @@ -110,6 +110,8 @@ typedef struct arch_vcpu_info arch_vcpu_info_t; > > > > struct arch_shared_info { }; > > typedef struct arch_shared_info arch_shared_info_t; > > +typedef unsigned long xen_callback_t; > > Can we make all new public interfaces explicitly sized, please?Yes please, and explicitly sized in a way which is compatible with 64 bits too (i.e. u64 here rather than u32 even though PC happens to be 32 bits). I''d quite like to do a sweep of the existing interfaces and arrange this to be the case even for existing interfaces when used on new architectures. I expect that will be an enormous amount of churn though -- possibly not worth it. Ian.