]> xenbits.xensource.com Git - xen.git/commitdiff
x86, hvm: Allow HAP to be enabled on 32-bit Xen (but still disabled by default).
authorKeir Fraser <keir@xensource.com>
Wed, 31 Oct 2007 09:36:45 +0000 (09:36 +0000)
committerKeir Fraser <keir@xensource.com>
Wed, 31 Oct 2007 09:36:45 +0000 (09:36 +0000)
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>
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/svm/svm.c

index 42dd16c72ff62e126bf0d04cc06a497b53e195e5..dcdcceb8415ab50cf7446af64fd13f94ceb7ea0a 100644 (file)
 #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;
 
@@ -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");
     }
 }
 
index b5dbe893d2fd912ef4e303507230a88dd498e4da..f23aff266bf7d253e1caa85474e6106301502099 100644 (file)
@@ -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);