From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: tim@xen.org, Ian.Campbell@citrix.com,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH v2 4/4] libxc/arm: allocate xenstore and console pages
Date: Wed, 4 Jul 2012 11:55:49 +0100 [thread overview]
Message-ID: <1341399349-31247-4-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1207041125250.13581@kaball.uk.xensource.com>
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>
---
tools/libxc/xc_dom_arm.c | 36 ++++++++++++++++++++++++++++++------
1 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c
index bb86139..724e7ad 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,33 @@ static int setup_pgtables_arm(struct xc_dom_image *dom)
static int alloc_magic_pages(struct xc_dom_image *dom)
{
+ int rc, i, allocsz;
+ 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;
+
+ for ( i = rc = allocsz = 0;
+ (i < NR_MAGIC_PAGES) && !rc;
+ i += allocsz) {
+ allocsz = NR_MAGIC_PAGES - i;
+ rc = xc_domain_populate_physmap_exact(
+ dom->xch, dom->guest_domid, allocsz,
+ 0, 0, &p2m[i]);
+ }
+
+ 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;
}
--
1.7.2.5
next prev parent reply other threads:[~2012-07-04 10:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-04 10:55 [PATCH v2 0/4] xen/arm: dom1 PV console up and running Stefano Stabellini
2012-07-04 10:55 ` [PATCH v2 1/4] xen/arm: implement do_hvm_op for ARM Stefano Stabellini
2012-07-12 11:43 ` Tim Deegan
2012-07-04 10:55 ` [PATCH v2 2/4] xen/arm: gic and vgic fixes Stefano Stabellini
2012-07-12 11:43 ` Tim Deegan
2012-07-04 10:55 ` [PATCH v2 3/4] xen/arm: disable the event optimization in the gic Stefano Stabellini
2012-07-04 10:55 ` Stefano Stabellini [this message]
2012-07-12 11:46 ` [PATCH v2 4/4] libxc/arm: allocate xenstore and console pages Tim Deegan
2012-07-13 15:32 ` Stefano Stabellini
2012-07-13 17:02 ` Ian Campbell
2012-07-13 17:15 ` Stefano Stabellini
2012-07-17 16:34 ` [PATCH v2 0/4] xen/arm: dom1 PV console up and running Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1341399349-31247-4-git-send-email-stefano.stabellini@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).