diff mbox

compile QEMU with Xen support on ARM

Message ID alpine.DEB.2.02.1407041910450.27641@kaball.uk.xensource.com
State New
Headers show

Commit Message

Stefano Stabellini July 4, 2014, 6:47 p.m. UTC
Fixes to build QEMU with Xen support on ARM and ARM64. Most fixes are
due to the fact that xen_pfn_t is 64-bit sized on arm32, while it is an
unsigned long on x86_32.
Although QEMU can be compiled with full emulation support, on ARM we
only care about the PV backends.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

---

Comments

Peter Maydell July 4, 2014, 11:17 p.m. UTC | #1
On 4 July 2014 19:47, Stefano Stabellini
<stefano.stabellini@eu.citrix.com> wrote:
> Fixes to build QEMU with Xen support on ARM and ARM64. Most fixes are
> due to the fact that xen_pfn_t is 64-bit sized on arm32, while it is an
> unsigned long on x86_32.
> Although QEMU can be compiled with full emulation support, on ARM we
> only care about the PV backends.

Were you hoping to get this into 2.1 ?

> diff --git a/xen-mapcache.c b/xen-mapcache.c
> index eda914a..dde5ae8 100644
> --- a/xen-mapcache.c
> +++ b/xen-mapcache.c
> @@ -33,10 +33,10 @@
>  #  define DPRINTF(fmt, ...) do { } while (0)
>  #endif
>
> -#if defined(__i386__)
> +#if defined(__i386__) ||  defined(__arm__)
>  #  define MCACHE_BUCKET_SHIFT 16
>  #  define MCACHE_MAX_SIZE     (1UL<<31) /* 2GB Cap */
> -#elif defined(__x86_64__)
> +#elif defined(__x86_64__) || defined(__aarch64__)
>  #  define MCACHE_BUCKET_SHIFT 20
>  #  define MCACHE_MAX_SIZE     (1UL<<35) /* 32GB Cap */
>  #endif

This shouldn't be an architecture ifdef ladder, as I pointed out
last time around and you fixed in your previous v2. You want
an #if HOST_LONG_BITS == 32:

http://patchwork.ozlabs.org/patch/303028/

thanks
-- PMM
Stefano Stabellini July 5, 2014, 1:53 a.m. UTC | #2
On Sat, 5 Jul 2014, Peter Maydell wrote:
> On 4 July 2014 19:47, Stefano Stabellini
> <stefano.stabellini@eu.citrix.com> wrote:
> > Fixes to build QEMU with Xen support on ARM and ARM64. Most fixes are
> > due to the fact that xen_pfn_t is 64-bit sized on arm32, while it is an
> > unsigned long on x86_32.
> > Although QEMU can be compiled with full emulation support, on ARM we
> > only care about the PV backends.
> 
> Were you hoping to get this into 2.1 ?

That would be ideal


> > diff --git a/xen-mapcache.c b/xen-mapcache.c
> > index eda914a..dde5ae8 100644
> > --- a/xen-mapcache.c
> > +++ b/xen-mapcache.c
> > @@ -33,10 +33,10 @@
> >  #  define DPRINTF(fmt, ...) do { } while (0)
> >  #endif
> >
> > -#if defined(__i386__)
> > +#if defined(__i386__) ||  defined(__arm__)
> >  #  define MCACHE_BUCKET_SHIFT 16
> >  #  define MCACHE_MAX_SIZE     (1UL<<31) /* 2GB Cap */
> > -#elif defined(__x86_64__)
> > +#elif defined(__x86_64__) || defined(__aarch64__)
> >  #  define MCACHE_BUCKET_SHIFT 20
> >  #  define MCACHE_MAX_SIZE     (1UL<<35) /* 32GB Cap */
> >  #endif
> 
> This shouldn't be an architecture ifdef ladder, as I pointed out
> last time around and you fixed in your previous v2. You want
> an #if HOST_LONG_BITS == 32:
> 
> http://patchwork.ozlabs.org/patch/303028/

I admit that this small series was lost in my mailbox. I had an older
version of the build fixes patch and started from there again.
Are you OK with v2 as per your link? It applies almost as is, except for
the renaming xen-all.c -> xen-hvm.c.
If your are OK with it, I'll rebase and resend with a PULL request?
Peter Maydell July 5, 2014, 11:10 a.m. UTC | #3
On 5 July 2014 02:53, Stefano Stabellini
<stefano.stabellini@eu.citrix.com> wrote:
> I admit that this small series was lost in my mailbox. I had an older
> version of the build fixes patch and started from there again.
> Are you OK with v2 as per your link? It applies almost as is, except for
> the renaming xen-all.c -> xen-hvm.c.
> If your are OK with it, I'll rebase and resend with a PULL request?

Yes, that's fine. You can add my
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
diff mbox

Patch

diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c
index 032eb7a..694e123 100644
--- a/hw/display/xenfb.c
+++ b/hw/display/xenfb.c
@@ -409,7 +409,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 +424,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 +483,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-hvm.c b/xen-hvm.c
index a64486c..8c69b34 100644
--- a/xen-hvm.c
+++ b/xen-hvm.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..dde5ae8 100644
--- a/xen-mapcache.c
+++ b/xen-mapcache.c
@@ -33,10 +33,10 @@ 
 #  define DPRINTF(fmt, ...) do { } while (0)
 #endif
 
-#if defined(__i386__)
+#if defined(__i386__) ||  defined(__arm__)
 #  define MCACHE_BUCKET_SHIFT 16
 #  define MCACHE_MAX_SIZE     (1UL<<31) /* 2GB Cap */
-#elif defined(__x86_64__)
+#elif defined(__x86_64__) || defined(__aarch64__)
 #  define MCACHE_BUCKET_SHIFT 20
 #  define MCACHE_MAX_SIZE     (1UL<<35) /* 32GB Cap */
 #endif