ia64/xen-unstable

changeset 16290:c7d5d229f191

x86, hvm: Allow HAP to be enabled on 32-bit Xen (but still disabled by default).

HAP remains disabled on 32-bit Xen by default because AMD NPT
restrictions mean that guests are restricted to a 4GB pseudophysical
memory map with AMD NPT on 32-bit host.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Wed Oct 31 09:36:45 2007 +0000 (2007-10-31)
parents eaa8014ef779
children 2717128cbdd1
files xen/arch/x86/hvm/hvm.c xen/arch/x86/hvm/svm/svm.c
line diff
     1.1 --- a/xen/arch/x86/hvm/hvm.c	Wed Oct 31 09:14:49 2007 +0000
     1.2 +++ b/xen/arch/x86/hvm/hvm.c	Wed Oct 31 09:36:45 2007 +0000
     1.3 @@ -50,9 +50,14 @@
     1.4  #include <public/version.h>
     1.5  #include <public/memory.h>
     1.6  
     1.7 -/* Xen command-line option to disable hardware-assisted paging */
     1.8 -static int opt_hap_disabled;
     1.9 -invbool_param("hap", opt_hap_disabled);
    1.10 +/*
    1.11 + * Xen command-line option to allow/disallow hardware-assisted paging.
    1.12 + * Since the phys-to-machine table of AMD NPT is in host format, 32-bit Xen
    1.13 + * could only support guests using NPT with up to a 4GB memory map. Therefore
    1.14 + * we only allow HAP by default on 64-bit Xen.
    1.15 + */
    1.16 +static int opt_hap_permitted = (BITS_PER_LONG == 8);
    1.17 +boolean_param("hap", opt_hap_permitted);
    1.18  
    1.19  int hvm_enabled __read_mostly;
    1.20  
    1.21 @@ -82,10 +87,10 @@ void hvm_enable(struct hvm_function_tabl
    1.22  
    1.23      if ( hvm_funcs.hap_supported )
    1.24      {
    1.25 -        if ( opt_hap_disabled )
    1.26 +        if ( !opt_hap_permitted )
    1.27              hvm_funcs.hap_supported = 0;
    1.28 -        printk("HVM: Hardware Assisted Paging %sabled\n",
    1.29 -               hvm_funcs.hap_supported ? "en" : "dis");
    1.30 +        printk("HVM: Hardware Assisted Paging detected %s.\n",
    1.31 +               hvm_funcs.hap_supported ? "and enabled" : "but disabled");
    1.32      }
    1.33  }
    1.34  
     2.1 --- a/xen/arch/x86/hvm/svm/svm.c	Wed Oct 31 09:14:49 2007 +0000
     2.2 +++ b/xen/arch/x86/hvm/svm/svm.c	Wed Oct 31 09:36:45 2007 +0000
     2.3 @@ -940,14 +940,7 @@ int start_svm(struct cpuinfo_x86 *c)
     2.4      svm_feature_flags = ((cpuid_eax(0x80000000) >= 0x8000000A) ?
     2.5                           cpuid_edx(0x8000000A) : 0);
     2.6  
     2.7 -#ifdef __x86_64__
     2.8 -    /*
     2.9 -     * Check CPUID for nested paging support. We support NPT only on 64-bit
    2.10 -     * hosts since the phys-to-machine table is in host format. Hence 32-bit
    2.11 -     * Xen could only support guests using NPT with up to a 4GB memory map.
    2.12 -     */
    2.13      svm_function_table.hap_supported = cpu_has_svm_npt;
    2.14 -#endif
    2.15  
    2.16      hvm_enable(&svm_function_table);
    2.17