aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_dom_arm.c
diff options
context:
space:
mode:
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>2012-10-09 15:05:35 +0100
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>2012-10-09 15:05:35 +0100
commitc34ed4d464b44694fd9bf9781f8e454b80151114 (patch)
tree6c78907d105b730c5e41f2319080bb037709ce58 /tools/libxc/xc_dom_arm.c
parente26fbaf024eeec712ecdfe453258b6d2436ea4d9 (diff)
downloadxen-c34ed4d464b44694fd9bf9781f8e454b80151114.tar.gz
xen-c34ed4d464b44694fd9bf9781f8e454b80151114.tar.bz2
xen-c34ed4d464b44694fd9bf9781f8e454b80151114.zip
libxc/arm: allocate xenstore and console pages
Allocate two additional pages at the end of the guest physical memory for xenstore and console. Set HVM_PARAM_STORE_PFN and HVM_PARAM_CONSOLE_PFN to the corresponding values. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> [ ijc -- pass correct p2m array to populate physmap in alloc_magic_pages ] Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxc/xc_dom_arm.c')
-rw-r--r--tools/libxc/xc_dom_arm.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c
index 65dafe8bed..b743a6c32c 100644
--- a/tools/libxc/xc_dom_arm.c
+++ b/tools/libxc/xc_dom_arm.c
@@ -25,6 +25,10 @@
#include "xg_private.h"
#include "xc_dom.h"
+#define NR_MAGIC_PAGES 2
+#define CONSOLE_PFN_OFFSET 0
+#define XENSTORE_PFN_OFFSET 1
+
/* ------------------------------------------------------------------------ */
/*
* arm guests are hybrid and start off with paging disabled, therefore no
@@ -46,13 +50,30 @@ static int setup_pgtables_arm(struct xc_dom_image *dom)
static int alloc_magic_pages(struct xc_dom_image *dom)
{
+ int rc, i;
+ xen_pfn_t store_pfn, console_pfn, p2m[NR_MAGIC_PAGES];
+
DOMPRINTF_CALLED(dom->xch);
- /* XXX
- * dom->p2m_guest
- * dom->start_info_pfn
- * dom->xenstore_pfn
- * dom->console_pfn
- */
+
+ for (i = 0; i < NR_MAGIC_PAGES; i++)
+ p2m[i] = dom->rambase_pfn + dom->total_pages + i;
+
+ rc = xc_domain_populate_physmap_exact(
+ dom->xch, dom->guest_domid, NR_MAGIC_PAGES,
+ 0, 0, p2m);
+ if ( rc < 0 )
+ return rc;
+
+ console_pfn = dom->rambase_pfn + dom->total_pages + CONSOLE_PFN_OFFSET;
+ store_pfn = dom->rambase_pfn + dom->total_pages + XENSTORE_PFN_OFFSET;
+
+ xc_clear_domain_page(dom->xch, dom->guest_domid, console_pfn);
+ xc_clear_domain_page(dom->xch, dom->guest_domid, store_pfn);
+ xc_set_hvm_param(dom->xch, dom->guest_domid, HVM_PARAM_CONSOLE_PFN,
+ console_pfn);
+ xc_set_hvm_param(dom->xch, dom->guest_domid, HVM_PARAM_STORE_PFN,
+ store_pfn);
+
return 0;
}