xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xensource.com, xen-arm@lists.xensource.com
Cc: stefano.stabellini@citrix.com, Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH 2/5] arm: allow libxc to build (untested)
Date: Mon, 16 Jan 2012 12:16:07 +0000	[thread overview]
Message-ID: <1326716171-4298-2-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1326716171-4298-1-git-send-email-ian.campbell@citrix.com>

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 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)
+{
+    *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
-- 
1.7.8.3

  reply	other threads:[~2012-01-16 12:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-16 12:02 [PATCH 0/5] ARM: Start working on tools Ian Campbell
2012-01-16 12:15 ` [XenARM] " Ian Campbell
2012-01-16 12:16 ` [PATCH 1/5] arm: add stub hvm/save.h Ian Campbell
2012-01-16 12:16   ` Ian Campbell [this message]
2012-01-16 18:01     ` [PATCH 2/5] arm: allow libxc to build (untested) Stefano Stabellini
2012-01-16 12:16   ` [PATCH 3/5] libxl: do not allocate e820 for non x86 guests Ian Campbell
2012-01-16 12:16   ` [PATCH 4/5] blktap2/libvhd: Build shared objects using -fPIC Ian Campbell
2012-01-16 12:16   ` [PATCH 5/5] DO-NOT-APPLY: Hackily remove bits which don't (yet) build on ARM Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1326716171-4298-2-git-send-email-ian.campbell@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=stefano.stabellini@citrix.com \
    --cc=xen-arm@lists.xensource.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).