#include <public/version.h>
#include <public/memory.h>
-/* 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;
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");
}
}
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);