ia64/xen-unstable

changeset 7730:5e142e1f41e6

Support dom0_mem parameter at boot option (by Masaki Kanno)
Usage is the likely same as that of x86. ex. append="dom0_mem=768M ..."
(Also dom0_align parameter added by Dan Magenheimer)
Signed-off-by Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Signed-off-by: Dan Magenheimer <dan.magenheimer@hp.com>
author djm@kirby.fc.hp.com
date Mon Nov 14 11:41:41 2005 -0600 (2005-11-14)
parents bd234c9603ce
children ee15a2ae7f24
files xen/arch/ia64/xen/domain.c
line diff
     1.1 --- a/xen/arch/ia64/xen/domain.c	Fri Nov 11 13:23:04 2005 -0600
     1.2 +++ b/xen/arch/ia64/xen/domain.c	Mon Nov 14 11:41:41 2005 -0600
     1.3 @@ -11,6 +11,7 @@
     1.4   */
     1.5  
     1.6  #include <xen/config.h>
     1.7 +#include <xen/init.h>
     1.8  #include <xen/lib.h>
     1.9  #include <xen/errno.h>
    1.10  #include <xen/sched.h>
    1.11 @@ -48,9 +49,8 @@
    1.12  
    1.13  #define CONFIG_DOMAIN0_CONTIGUOUS
    1.14  unsigned long dom0_start = -1L;
    1.15 -unsigned long dom0_size = 512*1024*1024; //FIXME: Should be configurable
    1.16 -//FIXME: alignment should be 256MB, lest Linux use a 256MB page size
    1.17 -unsigned long dom0_align = 256*1024*1024;
    1.18 +unsigned long dom0_size = 512*1024*1024;
    1.19 +unsigned long dom0_align = 64*1024*1024;
    1.20  #ifdef DOMU_BUILD_STAGING
    1.21  unsigned long domU_staging_size = 32*1024*1024; //FIXME: Should be configurable
    1.22  unsigned long domU_staging_start;
    1.23 @@ -1154,3 +1154,54 @@ void sync_vcpu_execstate(struct vcpu *v)
    1.24  	}
    1.25  	// FIXME SMP: Anything else needed here for SMP?
    1.26  }
    1.27 +
    1.28 +// FIXME: It would be nice to print out a nice error message for bad
    1.29 +//  values of these boot-time parameters, but it seems we are too early
    1.30 +//  in the boot and attempts to print freeze the system?
    1.31 +#define abort(x...) do {} while(0)
    1.32 +#define warn(x...) do {} while(0)
    1.33 +
    1.34 +static void parse_dom0_mem(char *s)
    1.35 +{
    1.36 +	unsigned long bytes = parse_size_and_unit(s);
    1.37 +
    1.38 +	if (dom0_size < 4 * 1024 * 1024) {
    1.39 +		abort("parse_dom0_mem: too small, boot aborted"
    1.40 +			" (try e.g. dom0_mem=256M or dom0_mem=65536K)\n");
    1.41 +	}
    1.42 +	if (dom0_size % dom0_align) {
    1.43 +		dom0_size = ((dom0_size / dom0_align) + 1) * dom0_align;
    1.44 +		warn("parse_dom0_mem: dom0_size rounded up from"
    1.45 +			" %lx to %lx bytes, due to dom0_align=%lx\n",
    1.46 +			bytes,dom0_size,dom0_align);
    1.47 +	}
    1.48 +	else dom0_size = bytes;
    1.49 +}
    1.50 +custom_param("dom0_mem", parse_dom0_mem);
    1.51 +
    1.52 +
    1.53 +static void parse_dom0_align(char *s)
    1.54 +{
    1.55 +	unsigned long bytes = parse_size_and_unit(s);
    1.56 +
    1.57 +	if ((bytes - 1) ^ bytes) { /* not a power of two */
    1.58 +		abort("parse_dom0_align: dom0_align must be power of two, "
    1.59 +			"boot aborted"
    1.60 +			" (try e.g. dom0_align=256M or dom0_align=65536K)\n");
    1.61 +	}
    1.62 +	else if (bytes < PAGE_SIZE) {
    1.63 +		abort("parse_dom0_align: dom0_align must be >= %ld, "
    1.64 +			"boot aborted"
    1.65 +			" (try e.g. dom0_align=256M or dom0_align=65536K)\n",
    1.66 +			PAGE_SIZE);
    1.67 +	}
    1.68 +	else dom0_align = bytes;
    1.69 +	if (dom0_size % dom0_align) {
    1.70 +		dom0_size = (dom0_size / dom0_align + 1) * dom0_align;
    1.71 +		warn("parse_dom0_align: dom0_size rounded up from"
    1.72 +			" %ld to %ld bytes, due to dom0_align=%lx\n",
    1.73 +			bytes,dom0_size,dom0_align);
    1.74 +	}
    1.75 +}
    1.76 +custom_param("dom0_align", parse_dom0_align);
    1.77 +