From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: qemu-devel@nongnu.org
Cc: anthony.perard@citrix.com, xen-devel@lists.xensource.com,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [Qemu-devel] [PATCH v2 2/2] xen: build on ARM
Date: Wed, 18 Dec 2013 19:17:32 +0000 [thread overview]
Message-ID: <1387394252-9676-2-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1312181913120.8667@kaball.uk.xensource.com>
Collection of fixes to build QEMU with Xen support on ARM:
- use xenstore_read_fe_uint64 to retrieve the page-ref (xenfb);
- use xen_pfn_t instead of unsigned long in xenfb;
- unsigned long/xenpfn_t in xen_remove_from_physmap;
- in xen-mapcache.c use HOST_LONG_BITS to check for QEMU's address space
size.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
Changes in v2:
- assert mfn == (xen_pfn_t)mfn;
- use HOST_LONG_BITS to check for QEMU's address space size.
---
hw/display/xenfb.c | 18 ++++++++++--------
xen-all.c | 2 +-
xen-mapcache.c | 4 ++--
3 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c
index f0333a0..c757c4f 100644
--- a/hw/display/xenfb.c
+++ b/hw/display/xenfb.c
@@ -93,10 +93,12 @@ struct XenFB {
static int common_bind(struct common *c)
{
- int mfn;
+ uint64_t mfn;
- if (xenstore_read_fe_int(&c->xendev, "page-ref", &mfn) == -1)
+ if (xenstore_read_fe_uint64(&c->xendev, "page-ref", &mfn) == -1)
return -1;
+ assert(mfn == (xen_pfn_t)mfn);
+
if (xenstore_read_fe_int(&c->xendev, "event-channel", &c->xendev.remote_port) == -1)
return -1;
@@ -107,7 +109,7 @@ static int common_bind(struct common *c)
return -1;
xen_be_bind_evtchn(&c->xendev);
- xen_be_printf(&c->xendev, 1, "ring mfn %d, remote-port %d, local-port %d\n",
+ xen_be_printf(&c->xendev, 1, "ring mfn %"PRIx64", remote-port %d, local-port %d\n",
mfn, c->xendev.remote_port, c->xendev.local_port);
return 0;
@@ -409,7 +411,7 @@ static void input_event(struct XenDevice *xendev)
/* -------------------------------------------------------------------- */
-static void xenfb_copy_mfns(int mode, int count, unsigned long *dst, void *src)
+static void xenfb_copy_mfns(int mode, int count, xen_pfn_t *dst, void *src)
{
uint32_t *src32 = src;
uint64_t *src64 = src;
@@ -424,8 +426,8 @@ static int xenfb_map_fb(struct XenFB *xenfb)
struct xenfb_page *page = xenfb->c.page;
char *protocol = xenfb->c.xendev.protocol;
int n_fbdirs;
- unsigned long *pgmfns = NULL;
- unsigned long *fbmfns = NULL;
+ xen_pfn_t *pgmfns = NULL;
+ xen_pfn_t *fbmfns = NULL;
void *map, *pd;
int mode, ret = -1;
@@ -483,8 +485,8 @@ static int xenfb_map_fb(struct XenFB *xenfb)
n_fbdirs = xenfb->fbpages * mode / 8;
n_fbdirs = (n_fbdirs + (XC_PAGE_SIZE - 1)) / XC_PAGE_SIZE;
- pgmfns = g_malloc0(sizeof(unsigned long) * n_fbdirs);
- fbmfns = g_malloc0(sizeof(unsigned long) * xenfb->fbpages);
+ pgmfns = g_malloc0(sizeof(xen_pfn_t) * n_fbdirs);
+ fbmfns = g_malloc0(sizeof(xen_pfn_t) * xenfb->fbpages);
xenfb_copy_mfns(mode, n_fbdirs, pgmfns, pd);
map = xc_map_foreign_pages(xen_xc, xenfb->c.xendev.dom,
diff --git a/xen-all.c b/xen-all.c
index 4a594bd..774c80d 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -376,7 +376,7 @@ static int xen_remove_from_physmap(XenIOState *state,
start_addr >>= TARGET_PAGE_BITS;
phys_offset >>= TARGET_PAGE_BITS;
for (i = 0; i < size; i++) {
- unsigned long idx = start_addr + i;
+ xen_pfn_t idx = start_addr + i;
xen_pfn_t gpfn = phys_offset + i;
rc = xc_domain_add_to_physmap(xen_xc, xen_domid, XENMAPSPACE_gmfn, idx, gpfn);
diff --git a/xen-mapcache.c b/xen-mapcache.c
index eda914a..66da1a6 100644
--- a/xen-mapcache.c
+++ b/xen-mapcache.c
@@ -33,10 +33,10 @@
# define DPRINTF(fmt, ...) do { } while (0)
#endif
-#if defined(__i386__)
+#if HOST_LONG_BITS == 32
# define MCACHE_BUCKET_SHIFT 16
# define MCACHE_MAX_SIZE (1UL<<31) /* 2GB Cap */
-#elif defined(__x86_64__)
+#else
# define MCACHE_BUCKET_SHIFT 20
# define MCACHE_MAX_SIZE (1UL<<35) /* 32GB Cap */
#endif
--
1.7.10.4
next prev parent reply other threads:[~2013-12-18 19:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-18 19:15 [Qemu-devel] [PATCH v2 0/2] build QEMU with Xen support on ARM Stefano Stabellini
2013-12-18 19:17 ` [Qemu-devel] [PATCH v2 1/2] xen_backend: introduce xenstore_read_uint64 and xenstore_read_fe_uint64 Stefano Stabellini
2013-12-18 19:17 ` Stefano Stabellini [this message]
2013-12-18 21:22 ` [Qemu-devel] [Xen-devel] [PATCH v2 0/2] build QEMU with Xen support on ARM Konrad Rzeszutek Wilk
2013-12-20 7:25 ` Fabio Fantoni
2014-01-03 12:55 ` 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=1387394252-9676-2-git-send-email-stefano.stabellini@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=anthony.perard@citrix.com \
--cc=qemu-devel@nongnu.org \
--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).