Message ID | 1398424967-9306-3-git-send-email-ian.campbell@citrix.com |
---|---|
State | New |
Headers | show |
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.
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. Ian.
diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c index 46dfc36..5760bb1 100644 --- a/tools/libxc/xc_dom_arm.c +++ b/tools/libxc/xc_dom_arm.c @@ -58,12 +58,13 @@ static int setup_pgtables_arm(struct xc_dom_image *dom) static int alloc_magic_pages(struct xc_dom_image *dom) { int rc, i; + const xen_pfn_t base = GUEST_MAGIC_BASE >> PAGE_SHIFT; xen_pfn_t p2m[NR_MAGIC_PAGES]; DOMPRINTF_CALLED(dom->xch); for (i = 0; i < NR_MAGIC_PAGES; i++) - p2m[i] = dom->rambase_pfn + dom->total_pages + i; + p2m[i] = base + i; rc = xc_domain_populate_physmap_exact( dom->xch, dom->guest_domid, NR_MAGIC_PAGES, @@ -71,8 +72,8 @@ static int alloc_magic_pages(struct xc_dom_image *dom) if ( rc < 0 ) return rc; - dom->console_pfn = dom->rambase_pfn + dom->total_pages + CONSOLE_PFN_OFFSET; - dom->xenstore_pfn = dom->rambase_pfn + dom->total_pages + XENSTORE_PFN_OFFSET; + dom->console_pfn = base + CONSOLE_PFN_OFFSET; + dom->xenstore_pfn = base + XENSTORE_PFN_OFFSET; xc_clear_domain_page(dom->xch, dom->guest_domid, dom->console_pfn); xc_clear_domain_page(dom->xch, dom->guest_domid, dom->xenstore_pfn); @@ -272,12 +273,11 @@ int arch_setup_meminit(struct xc_dom_image *dom) return -1; } - if ( ramsize > GUEST_RAM_SIZE - NR_MAGIC_PAGES*XC_PAGE_SIZE ) + if ( ramsize > GUEST_RAM_SIZE ) { DOMPRINTF("%s: ram size is too large for guest address space: " "%"PRIx64" > %"PRIx64, - __FUNCTION__, ramsize, - GUEST_RAM_SIZE - NR_MAGIC_PAGES*XC_PAGE_SIZE); + __FUNCTION__, ramsize, GUEST_RAM_SIZE); return -1; } 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 + /* Interrupts */ #define GUEST_TIMER_VIRT_PPI 27 #define GUEST_TIMER_PHYS_S_PPI 29