xend, vt-d: do not reserve vtd_mem if iommu is not enabled
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 2 Dec 2009 13:43:37 +0000 (13:43 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 2 Dec 2009 13:43:37 +0000 (13:43 +0000)
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
tools/python/xen/xend/XendDomainInfo.py

index 7cbf25ecc0697ac2f4fb0f35a8f448b936fe88ac..db744d7e1db13aab4d9cb2e4b6706f3a0aad0d62 100644 (file)
@@ -2758,10 +2758,13 @@ class XendDomainInfo:
             # set memory limit
             xc.domain_setmaxmem(self.domid, maxmem)
 
-            # Reserve 1 page per MiB of RAM for separate VT-d page table.
-            vtd_mem = 4 * (self.info['memory_static_max'] / 1024 / 1024)
-            # Round vtd_mem up to a multiple of a MiB.
-            vtd_mem = ((vtd_mem + 1023) / 1024) * 1024
+            vtd_mem = 0
+            info = xc.physinfo()
+            if 'hvm_directio' in info['virt_caps']:
+                # Reserve 1 page per MiB of RAM for separate VT-d page table.
+                vtd_mem = 4 * (self.info['memory_static_max'] / 1024 / 1024)
+                # Round vtd_mem up to a multiple of a MiB.
+                vtd_mem = ((vtd_mem + 1023) / 1024) * 1024
 
             self.guest_bitsize = self.image.getBitSize()
             # Make sure there's enough RAM available for the domain