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] xen/arm: compile and run libxl/xl
Date: Wed, 16 Jan 2013 18:58:55 +0000 [thread overview]
Message-ID: <1358362736-2870-4-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1301161853130.4978@kaball.uk.xensource.com>
Move tsc, rtc, memmap_limit, localtime and shadow settings from
libxl__build_pre to libxl__arch_domain_create.
Get the console and xenstore pfn's from struct xc_dom_image for
autotranslated guests.
Changes in v2:
- move the xc_dom_gnttab_hvm_seed changes into the libxc patch.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
tools/libxl/libxl_dom.c | 54 ++++++----------------------------------------
tools/libxl/libxl_x86.c | 48 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 47 deletions(-)
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index 7586a6c..c0d6349 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -202,9 +202,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
libxl_domain_build_info *info, libxl__domain_build_state *state)
{
libxl_ctx *ctx = libxl__gc_owner(gc);
- int tsc_mode;
char *xs_domid, *con_domid;
- uint32_t rtc_timeoffset;
xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus);
@@ -233,49 +231,6 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
libxl_set_vcpuaffinity_all(ctx, domid, info->max_vcpus, &info->cpumap);
xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb + LIBXL_MAXMEM_CONSTANT);
- if (info->type == LIBXL_DOMAIN_TYPE_PV)
- xc_domain_set_memmap_limit(ctx->xch, domid,
- (info->max_memkb + info->u.pv.slack_memkb));
- switch (info->tsc_mode) {
- case LIBXL_TSC_MODE_DEFAULT:
- tsc_mode = 0;
- break;
- case LIBXL_TSC_MODE_ALWAYS_EMULATE:
- tsc_mode = 1;
- break;
- case LIBXL_TSC_MODE_NATIVE:
- tsc_mode = 2;
- break;
- case LIBXL_TSC_MODE_NATIVE_PARAVIRT:
- tsc_mode = 3;
- break;
- default:
- abort();
- }
- xc_domain_set_tsc_info(ctx->xch, domid, tsc_mode, 0, 0, 0);
- if (libxl_defbool_val(info->disable_migrate))
- xc_domain_disable_migrate(ctx->xch, domid);
-
- rtc_timeoffset = info->rtc_timeoffset;
- if (libxl_defbool_val(info->localtime)) {
- time_t t;
- struct tm *tm;
-
- t = time(NULL);
- tm = localtime(&t);
-
- rtc_timeoffset += tm->tm_gmtoff;
- }
-
- if (rtc_timeoffset)
- xc_domain_set_time_offset(ctx->xch, domid, rtc_timeoffset);
-
- if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
- unsigned long shadow;
- shadow = (info->shadow_memkb + 1023) / 1024;
- xc_shadow_control(ctx->xch, domid, XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION, NULL, 0, &shadow, 0, NULL);
- }
-
xs_domid = xs_read(ctx->xsh, XBT_NULL, "/tool/xenstored/domid", NULL);
state->store_domid = xs_domid ? atoi(xs_domid) : 0;
free(xs_domid);
@@ -443,8 +398,13 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid,
goto out;
}
- state->console_mfn = xc_dom_p2m_host(dom, dom->console_pfn);
- state->store_mfn = xc_dom_p2m_host(dom, dom->xenstore_pfn);
+ if (xc_dom_feature_translated(dom)) {
+ state->console_mfn = dom->console_pfn;
+ state->store_mfn = dom->xenstore_pfn;
+ } else {
+ state->console_mfn = xc_dom_p2m_host(dom, dom->console_pfn);
+ state->store_mfn = xc_dom_p2m_host(dom, dom->xenstore_pfn);
+ }
libxl__file_reference_unmap(&state->pv_kernel);
libxl__file_reference_unmap(&state->pv_ramdisk);
diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c
index 590e39d..a17f6ae 100644
--- a/tools/libxl/libxl_x86.c
+++ b/tools/libxl/libxl_x86.c
@@ -248,6 +248,54 @@ int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
uint32_t domid)
{
int ret = 0;
+ int tsc_mode;
+ uint32_t rtc_timeoffset;
+ libxl_ctx *ctx = libxl__gc_owner(gc);
+
+ if (d_config->b_info.type == LIBXL_DOMAIN_TYPE_PV)
+ xc_domain_set_memmap_limit(ctx->xch, domid,
+ (d_config->b_info.max_memkb +
+ d_config->b_info.u.pv.slack_memkb));
+
+ switch (d_config->b_info.tsc_mode) {
+ case LIBXL_TSC_MODE_DEFAULT:
+ tsc_mode = 0;
+ break;
+ case LIBXL_TSC_MODE_ALWAYS_EMULATE:
+ tsc_mode = 1;
+ break;
+ case LIBXL_TSC_MODE_NATIVE:
+ tsc_mode = 2;
+ break;
+ case LIBXL_TSC_MODE_NATIVE_PARAVIRT:
+ tsc_mode = 3;
+ break;
+ default:
+ abort();
+ }
+ xc_domain_set_tsc_info(ctx->xch, domid, tsc_mode, 0, 0, 0);
+ if (libxl_defbool_val(d_config->b_info.disable_migrate))
+ xc_domain_disable_migrate(ctx->xch, domid);
+ rtc_timeoffset = d_config->b_info.rtc_timeoffset;
+ if (libxl_defbool_val(d_config->b_info.localtime)) {
+ time_t t;
+ struct tm *tm;
+
+ t = time(NULL);
+ tm = localtime(&t);
+
+ rtc_timeoffset += tm->tm_gmtoff;
+ }
+
+ if (rtc_timeoffset)
+ xc_domain_set_time_offset(ctx->xch, domid, rtc_timeoffset);
+
+ if (d_config->b_info.type == LIBXL_DOMAIN_TYPE_HVM) {
+ unsigned long shadow;
+ shadow = (d_config->b_info.shadow_memkb + 1023) / 1024;
+ xc_shadow_control(ctx->xch, domid, XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION, NULL, 0, &shadow, 0, NULL);
+ }
+
if (d_config->c_info.type == LIBXL_DOMAIN_TYPE_PV &&
libxl_defbool_val(d_config->b_info.u.pv.e820_host)) {
ret = libxl__e820_alloc(gc, domid, d_config);
--
1.7.2.5
next prev parent reply other threads:[~2013-01-16 18:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-16 18:57 [PATCH v2 0/4] xen/arm: compile and run xl Stefano Stabellini
2013-01-16 18:58 ` [PATCH v2 1/4] xen: move XEN_SYSCTL_physinfo, XEN_SYSCTL_numainfo and XEN_SYSCTL_topologyinfo to common code Stefano Stabellini
2013-01-24 17:37 ` Ian Campbell
2013-02-14 11:28 ` Stefano Stabellini
2013-01-16 18:58 ` [PATCH v2 2/4] xen/arm: implement gnttab_create_shared_page and gnttab_shared_gmfn Stefano Stabellini
2013-01-24 17:39 ` Ian Campbell
2013-01-16 18:58 ` [PATCH v2 3/4] libxc: fixes for the ARM platform Stefano Stabellini
2013-01-24 17:40 ` Ian Campbell
2013-02-14 11:44 ` Ian Campbell
2013-01-16 18:58 ` Stefano Stabellini [this message]
2013-01-24 17:43 ` [PATCH v2 4/4] xen/arm: compile and run libxl/xl 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=1358362736-2870-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).