From: Keir Fraser Date: Wed, 31 Oct 2007 09:36:45 +0000 (+0000) Subject: x86, hvm: Allow HAP to be enabled on 32-bit Xen (but still disabled by default). X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14824^2~8 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1c68b1c0774364824fcd3e3da87e4e5bdb6d1933;p=xen.git 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 Signed-off-by: Keir Fraser --- diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 42dd16c72f..dcdcceb841 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -50,9 +50,14 @@ #include #include -/* Xen command-line option to disable hardware-assisted paging */ -static int opt_hap_disabled; -invbool_param("hap", opt_hap_disabled); +/* + * Xen command-line option to allow/disallow hardware-assisted paging. + * Since the phys-to-machine table of AMD NPT is in host format, 32-bit Xen + * could only support guests using NPT with up to a 4GB memory map. Therefore + * we only allow HAP by default on 64-bit Xen. + */ +static int opt_hap_permitted = (BITS_PER_LONG == 8); +boolean_param("hap", opt_hap_permitted); int hvm_enabled __read_mostly; @@ -82,10 +87,10 @@ void hvm_enable(struct hvm_function_table *fns) if ( hvm_funcs.hap_supported ) { - if ( opt_hap_disabled ) + if ( !opt_hap_permitted ) hvm_funcs.hap_supported = 0; - printk("HVM: Hardware Assisted Paging %sabled\n", - hvm_funcs.hap_supported ? "en" : "dis"); + printk("HVM: Hardware Assisted Paging detected %s.\n", + hvm_funcs.hap_supported ? "and enabled" : "but disabled"); } } diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index b5dbe893d2..f23aff266b 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -940,14 +940,7 @@ int start_svm(struct cpuinfo_x86 *c) svm_feature_flags = ((cpuid_eax(0x80000000) >= 0x8000000A) ? cpuid_edx(0x8000000A) : 0); -#ifdef __x86_64__ - /* - * Check CPUID for nested paging support. We support NPT only on 64-bit - * hosts since the phys-to-machine table is in host format. Hence 32-bit - * Xen could only support guests using NPT with up to a 4GB memory map. - */ svm_function_table.hap_supported = cpu_has_svm_npt; -#endif hvm_enable(&svm_function_table);