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 4/5] libxc/arm: allocate xenstore and console pages
Date: Fri, 22 Jun 2012 17:09:32 +0100 [thread overview]
Message-ID: <1340381373-22177-4-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <1340381373-22177-1-git-send-email-stefano.stabellini@eu.citrix.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 | 32 ++++++++++++++++++++++----------
1 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c
index bb86139..df2eefe 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
@@ -47,12 +51,6 @@ static int setup_pgtables_arm(struct xc_dom_image *dom)
static int alloc_magic_pages(struct xc_dom_image *dom)
{
DOMPRINTF_CALLED(dom->xch);
- /* XXX
- * dom->p2m_guest
- * dom->start_info_pfn
- * dom->xenstore_pfn
- * dom->console_pfn
- */
return 0;
}
@@ -127,18 +125,19 @@ int arch_setup_meminit(struct xc_dom_image *dom)
{
int rc;
xen_pfn_t pfn, allocsz, i;
+ xen_pfn_t store_pfn, console_pfn;
fprintf(stderr, "%s: tot pages %"PRI_xen_pfn" rambase %"PRI_xen_pfn"\n", __func__,
dom->total_pages, dom->rambase_pfn);
dom->shadow_enabled = 1;
- dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages);
+ dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * (dom->total_pages + NR_MAGIC_PAGES));
fprintf(stderr, "%s: setup p2m from %"PRI_xen_pfn" for %"PRI_xen_pfn" pages\n", __func__,
dom->rambase_pfn, dom->total_pages );
/* setup initial p2m */
- for ( pfn = 0; pfn < dom->total_pages; pfn++ )
+ for ( pfn = 0; pfn < (dom->total_pages + NR_MAGIC_PAGES); pfn++ )
dom->p2m_host[pfn] = pfn + dom->rambase_pfn;
fprintf(stderr, "%s: init'd p2m_host[0] = %"PRI_xen_pfn"\n", __func__, dom->p2m_host[0]);
@@ -148,10 +147,10 @@ int arch_setup_meminit(struct xc_dom_image *dom)
/* allocate guest memory */
for ( i = rc = allocsz = 0;
- (i < dom->total_pages) && !rc;
+ (i < dom->total_pages + NR_MAGIC_PAGES) && !rc;
i += allocsz )
{
- allocsz = dom->total_pages - i;
+ allocsz = (dom->total_pages + NR_MAGIC_PAGES) - i;
if ( allocsz > 1024*1024 )
allocsz = 1024*1024;
fprintf(stderr, "alloc %"PRI_xen_pfn" at offset %"PRI_xen_pfn" which is %"PRI_xen_pfn"\n",
@@ -168,6 +167,19 @@ int arch_setup_meminit(struct xc_dom_image *dom)
fprintf(stderr, "%s: popl'd p2m_host[%"PRI_xen_pfn"] = %"PRI_xen_pfn"\n",
__func__, dom->total_pages-1, dom->p2m_host[dom->total_pages-1]);
+ 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);
+
+ fprintf(stderr, "%s: console_pfn=%"PRI_xen_pfn" xenstore_pfn=%"PRI_xen_pfn"\n",
+ __func__, console_pfn, store_pfn);
+
return 0;
}
--
1.7.2.5
next prev parent reply other threads:[~2012-06-22 16:09 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-22 16:08 [PATCH 0/5] xen/arm: dom1 PV console up and running Stefano Stabellini
2012-06-22 16:09 ` [PATCH 1/5] xen/arm: implement do_hvm_op for ARM Stefano Stabellini
2012-06-22 16:09 ` [PATCH 2/5] xen/arm: gic and vgic fixes Stefano Stabellini
2012-06-26 14:28 ` Ian Campbell
2012-06-26 17:23 ` Stefano Stabellini
2012-06-22 16:09 ` [PATCH 3/5] xen/arm: disable the event optimization in the gic Stefano Stabellini
2012-06-26 14:29 ` Ian Campbell
2012-06-22 16:09 ` Stefano Stabellini [this message]
2012-06-26 14:34 ` [PATCH 4/5] libxc/arm: allocate xenstore and console pages Ian Campbell
2012-06-26 18:05 ` Stefano Stabellini
2012-06-27 8:59 ` Ian Campbell
2012-06-27 12:42 ` Stefano Stabellini
2012-06-22 16:09 ` [PATCH 5/5] xcbuild: add console and xenstore support Stefano Stabellini
2012-06-26 13:50 ` Ian Campbell
2012-06-26 17:58 ` Stefano Stabellini
2012-06-27 8:55 ` Ian Campbell
2012-06-27 11:02 ` Stefano Stabellini
2012-06-26 14:27 ` [PATCH 1/5] xen/arm: implement do_hvm_op for ARM Ian Campbell
2012-06-26 18:29 ` Stefano Stabellini
2012-06-27 9:02 ` Ian Campbell
2012-06-27 11:04 ` Stefano Stabellini
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=1340381373-22177-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).