diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-07-10 11:10:38 +0100 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2007-07-10 11:10:38 +0100 |
commit | ad69a7e407343a7ba173dd48b1c7a0db18ccbe04 (patch) | |
tree | aa7951cc6b10cf0242fa9e2fa42df6578c3a2034 /xen/arch/x86/e820.c | |
parent | 07f37608884ec519f6b6c77ad8dc38439e5d4629 (diff) | |
download | xen-ad69a7e407343a7ba173dd48b1c7a0db18ccbe04.tar.gz xen-ad69a7e407343a7ba173dd48b1c7a0db18ccbe04.tar.bz2 xen-ad69a7e407343a7ba173dd48b1c7a0db18ccbe04.zip |
Re-factor e820 truncation code and reintroduce clipping for 32-on-64
guests (to 166GB).
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'xen/arch/x86/e820.c')
-rw-r--r-- | xen/arch/x86/e820.c | 65 |
1 files changed, 25 insertions, 40 deletions
diff --git a/xen/arch/x86/e820.c b/xen/arch/x86/e820.c index 54ebd32762..797ccc0a7e 100644 --- a/xen/arch/x86/e820.c +++ b/xen/arch/x86/e820.c @@ -310,23 +310,22 @@ static unsigned long __init find_max_pfn(void) return max_pfn; } -#ifdef __i386__ -static void __init clip_4gb(void) +static void __init clip_to_limit(uint64_t limit, char *warnmsg) { - unsigned long long limit = (1ULL << 30) * MACHPHYS_MBYTES; int i; + char _warnmsg[160]; - /* 32-bit systems restricted to a 4GB physical memory map, - * with PAE to 16 GB (with current memory layout) */ for ( i = 0; i < e820.nr_map; i++ ) { if ( (e820.map[i].addr + e820.map[i].size) <= limit ) continue; - printk("WARNING: Only the first %d GB of the physical memory map " - "can be accessed\n" - " by Xen in 32-bit mode. " - "Truncating the memory map...\n", - MACHPHYS_MBYTES); + if ( warnmsg ) + { + snprintf(_warnmsg, sizeof(_warnmsg), warnmsg, (int)(limit>>30)); + printk("WARNING: %s\n", _warnmsg); + } + printk("Truncating memory map to %lukB\n", + (unsigned long)(limit >> 10)); if ( e820.map[i].addr >= limit ) { e820.nr_map = i; @@ -338,34 +337,6 @@ static void __init clip_4gb(void) } } } -#else -#define clip_4gb() ((void)0) -#endif - -static void __init clip_mem(void) -{ - int i; - - if ( !opt_mem ) - return; - - for ( i = 0; i < e820.nr_map; i++ ) - { - if ( (e820.map[i].addr + e820.map[i].size) <= opt_mem ) - continue; - printk("Truncating memory map to %lukB\n", - (unsigned long)(opt_mem >> 10)); - if ( e820.map[i].addr >= opt_mem ) - { - e820.nr_map = i; - } - else - { - e820.map[i].size = opt_mem - e820.map[i].addr; - e820.nr_map = i + 1; - } - } -} static void __init machine_specific_memory_setup( struct e820entry *raw, int *raw_nr) @@ -374,8 +345,22 @@ static void __init machine_specific_memory_setup( sanitize_e820_map(raw, &nr); *raw_nr = nr; (void)copy_e820_map(raw, nr); - clip_4gb(); - clip_mem(); + + if ( opt_mem ) + clip_to_limit(opt_mem, NULL); + +#ifdef __i386__ + clip_to_limit((1ULL << 30) * MACHPHYS_MBYTES, + "Only the first %u GB of the physical memory map " + "can be accessed by Xen in 32-bit mode."); +#endif + +#ifdef __x86_64__ + clip_to_limit((uint64_t)(MACH2PHYS_COMPAT_VIRT_END - + __HYPERVISOR_COMPAT_VIRT_START) << 10, + "Only the first %u GB of the physical memory map " + "can be accessed by 32-on-64 guests."); +#endif } unsigned long __init init_e820( |