Skip to contentSkip to conversation

build QEMU with Xen support on ARM

GIT PULL Applied Stefano Stabellini 2 participants 4 messages Jul 7, 2014

lore
Share & tools
lore
#0 lore raw

The following changes since commit 9d9de254c2b81b68cd48f2324cc753a570a4cdd8:

MAINTAINERS: seccomp: change email contact for Eduardo Otubo (2014-07-03 12:36:15 +0100)

are available in the git repository at:

git://xenbits.xen.org/people/sstabellini/qemu-dm.git xen_arm_20140707

for you to fetch changes up to 643f59322432d77165329dfabe2d040d7e30dae8:

xen: build on ARM (2014-07-07 10:37:40 +0000)

----------------------------------------------------------------
Stefano Stabellini (2):
xen_backend: introduce xenstore_read_uint64 and xenstore_read_fe_uint64
xen: build on ARM

 hw/display/xenfb.c           |   18 ++++++++++--------
 hw/xen/xen_backend.c         |   18 ++++++++++++++++++
 include/hw/xen/xen_backend.h |    2 ++
 xen-hvm.c                    |    2 +-
 xen-mapcache.c               |    4 ++--
 5 files changed, 33 insertions(+), 11 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 1/2] xen_backend: introduce xenstore_read_uint64 and xenstore_read_fe_uint64

---
 hw/xen/xen_backend.c         |   18 ++++++++++++++++++
 include/hw/xen/xen_backend.h |    2 ++
 2 files changed, 20 insertions(+)
hw/xen/xen_backend.c +18 -0
index 3cd45b4..b2cb22b 100644
@@ -111,6 +111,19 @@ int xenstore_read_int(const char *base, const char *node, int *ival)
     return rc;
 }
 
+int xenstore_read_uint64(const char *base, const char *node, uint64_t *uval)
+{
+    char *val;
+    int rc = -1;
+
+    val = xenstore_read_str(base, node);
+    if (val && 1 == sscanf(val, "%"SCNu64, uval)) {
+        rc = 0;
+    }
+    g_free(val);
+    return rc;
+}
+
 int xenstore_write_be_str(struct XenDevice *xendev, const char *node, const char *val)
 {
     return xenstore_write_str(xendev->be, node, val);
@@ -146,6 +159,11 @@ int xenstore_read_fe_int(struct XenDevice *xendev, const char *node, int *ival)
     return xenstore_read_int(xendev->fe, node, ival);
 }
 
+int xenstore_read_fe_uint64(struct XenDevice *xendev, const char *node, uint64_t *uval)
+{
+    return xenstore_read_uint64(xendev->fe, node, uval);
+}
+
 /* ------------------------------------------------------------- */
 
 const char *xenbus_strstate(enum xenbus_state state)
include/hw/xen/xen_backend.h +2 -0
index 3b7d96d..3b4125e 100644
@@ -74,6 +74,8 @@ char *xenstore_read_be_str(struct XenDevice *xendev, const char *node);
 int xenstore_read_be_int(struct XenDevice *xendev, const char *node, int *ival);
 char *xenstore_read_fe_str(struct XenDevice *xendev, const char *node);
 int xenstore_read_fe_int(struct XenDevice *xendev, const char *node, int *ival);
+int xenstore_read_uint64(const char *base, const char *node, uint64_t *uval);
+int xenstore_read_fe_uint64(struct XenDevice *xendev, const char *node, uint64_t *uval);
 
 const char *xenbus_strstate(enum xenbus_state state);
 struct XenDevice *xen_be_find_xendev(const char *type, int dom, int dev);
Signature · 1 line
1.7.10.4
#2 lore raw

[Qemu-devel] [PULL 2/2] xen: build on ARM

In reply to Stefano Stabellini

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.

---
 hw/display/xenfb.c |   18 ++++++++++--------
 xen-hvm.c          |    2 +-
 xen-mapcache.c     |    4 ++--
 3 files changed, 13 insertions(+), 11 deletions(-)
hw/display/xenfb.c +10 -8
index 032eb7a..07ddc9d 100644
@@ -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,
xen-hvm.c +1 -1
index bafdf12..c928b36 100644
@@ -390,7 +390,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);
xen-mapcache.c +2 -2
index eda914a..66da1a6 100644
@@ -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
Signature · 1 line
1.7.10.4
#3 lore raw
In reply to Stefano Stabellini
Quoted 8 lines · Stefano Stabellini

The following changes since commit 9d9de254c2b81b68cd48f2324cc753a570a4cdd8:

MAINTAINERS: seccomp: change email contact for Eduardo Otubo (2014-07-03 12:36:15 +0100)

are available in the git repository at:

git://xenbits.xen.org/people/sstabellini/qemu-dm.git xen_arm_20140707

Quoted 8 lines

for you to fetch changes up to 643f59322432d77165329dfabe2d040d7e30dae8:

xen: build on ARM (2014-07-07 10:37:40 +0000)

----------------------------------------------------------------
Stefano Stabellini (2):
xen_backend: introduce xenstore_read_uint64 and xenstore_read_fe_uint64
xen: build on ARM

Applied, thanks.

-- PMM