From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: david.vrabel@citrix.com, Ian.Campbell@citrix.com,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Tim.Deegan@citrix.com
Subject: [PATCH v2 05/10] arm: compile libxc
Date: Fri, 10 Feb 2012 12:02:43 +0000 [thread overview]
Message-ID: <1328875368-9608-5-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1202101154320.7456@kaball-desktop>
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 e6fd488..3ee8c59 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
next prev parent reply other threads:[~2012-02-10 12:02 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-10 12:01 [PATCH v2 00/10] arm: compile tools Stefano Stabellini
2012-02-10 12:02 ` [PATCH v2 01/10] arm: few missing #define Stefano Stabellini
2012-02-13 13:49 ` Ian Campbell
2012-02-14 15:11 ` Stefano Stabellini
2012-02-15 12:27 ` Ian Campbell
2012-02-13 15:37 ` Ian Campbell
2012-02-10 12:02 ` [PATCH v2 02/10] arm: add stub hvm/save.h Stefano Stabellini
2012-02-13 12:21 ` Ian Campbell
2012-02-14 19:47 ` Stefano Stabellini
2012-02-10 12:02 ` [PATCH v2 03/10] libxl: do not allocate e820 for non x86 guests Stefano Stabellini
2012-02-13 17:28 ` Ian Jackson
2012-02-14 19:16 ` Stefano Stabellini
2012-02-10 12:02 ` [PATCH v2 04/10] blktap2/libvhd: Build shared objects using -fPIC Stefano Stabellini
2012-02-13 17:29 ` Ian Jackson
2012-02-10 12:02 ` Stefano Stabellini [this message]
2012-02-13 15:56 ` [PATCH v2 05/10] arm: compile libxc Ian Campbell
2012-02-13 17:38 ` Ian Jackson
2012-02-10 12:02 ` [PATCH v2 06/10] arm: compile libxenguest Stefano Stabellini
2012-02-13 16:10 ` Ian Campbell
2012-02-14 19:11 ` Stefano Stabellini
2012-02-10 12:02 ` [PATCH v2 07/10] arm: compile libxl Stefano Stabellini
2012-02-13 16:11 ` Ian Campbell
2012-02-13 17:35 ` Ian Jackson
2012-02-14 19:16 ` Stefano Stabellini
2012-02-10 12:02 ` [PATCH v2 08/10] arm: compile memshr Stefano Stabellini
2012-02-13 16:15 ` Ian Campbell
2012-02-10 12:02 ` [PATCH v2 09/10] arm: compile xentrace Stefano Stabellini
2012-02-13 16:16 ` Ian Campbell
2012-02-10 12:02 ` [PATCH v2 10/10] tools: only compile libfsimage/xfs on X86 Stefano Stabellini
2012-02-13 17:32 ` Ian Jackson
2012-02-13 16:18 ` [PATCH v2 00/10] arm: compile tools Ian Campbell
2012-02-13 17:39 ` Ian Jackson
2012-02-14 19:17 ` Stefano Stabellini
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=1328875368-9608-5-git-send-email-stefano.stabellini@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=Tim.Deegan@citrix.com \
--cc=david.vrabel@citrix.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).