diff mbox

[Xen-devel,v2,3/8] tools: arm: move magic pfns out of guest RAM region

Message ID 1398431417.18537.462.camel@kazak.uk.xensource.com
State New
Headers show

Commit Message

Ian Campbell April 25, 2014, 1:10 p.m. UTC
On Fri, 2014-04-25 at 13:22 +0100, Ian Campbell wrote:
> On Fri, 2014-04-25 at 13:09 +0100, Julien Grall wrote:
> > 
> > On 25/04/14 12:22, Ian Campbell wrote:
> > > diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
> > > index dd53c94..a94d16b 100644
> > > --- a/xen/include/public/arch-arm.h
> > > +++ b/xen/include/public/arch-arm.h
> > > @@ -375,6 +375,8 @@ typedef uint64_t xen_callback_t;
> > >   #define GUEST_GNTTAB_BASE 0xb0000000ULL
> > >   #define GUEST_GNTTAB_SIZE 0x00020000ULL
> > >
> > > +#define GUEST_MAGIC_BASE  0xc0000000ULL
> > > +
> > 
> > I'm wondering if we need to move NR_MAGIC_PAGES or add a comment in 
> > arch-arm.h if someone wants to bump the number page magic page.
> > 
> > Or perhaps a BUG_ON in libxc to check at compilation time the hole is 
> > large enought to hold all special pages.
> 
> I'll add GUEST_MAGIC_SIZE and a (BUILD_)BUG_ON to check against it.

Doing that in this patch would require a full repost since it has knock
on effects on other patches. So instead I have tacked on the end:

8<---------------

From f38f5e3e6e5be151e7734ffb114bbee3ce251c81 Mon Sep 17 00:00:00 2001
From: Ian Campbell <ian.campbell@citrix.com>
Date: Fri, 25 Apr 2014 14:07:45 +0100
Subject: [PATCH v3 9/8] tools: arm: make the size of the magic page region explicit

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 tools/libxc/xc_dom_arm.c      |    2 ++
 xen/include/public/arch-arm.h |    1 +
 2 files changed, 3 insertions(+)
diff mbox

Patch

diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c
index 7216d2a..c2f6d27 100644
--- a/tools/libxc/xc_dom_arm.c
+++ b/tools/libxc/xc_dom_arm.c
@@ -62,6 +62,8 @@  static int alloc_magic_pages(struct xc_dom_image *dom)
     const xen_pfn_t base = GUEST_MAGIC_BASE >> PAGE_SHIFT;
     xen_pfn_t p2m[NR_MAGIC_PAGES];
 
+    XC_BUILD_BUG_ON(NR_MAGIC_PAGES > GUEST_MAGIC_SIZE >> XC_PAGE_SHIFT);
+
     DOMPRINTF_CALLED(dom->xch);
 
     for (i = 0; i < NR_MAGIC_PAGES; i++)
diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index 061d59d..31ba44d 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -376,6 +376,7 @@  typedef uint64_t xen_callback_t;
 #define GUEST_GNTTAB_SIZE 0x01000000ULL
 
 #define GUEST_MAGIC_BASE  0x39000000ULL
+#define GUEST_MAGIC_SIZE  0x01000000ULL
 
 #define GUEST_RAM0_BASE   0x40000000ULL /* 3GB of low RAM @ 1GB */
 #define GUEST_RAM0_SIZE   0xc0000000ULL