debuggers.hg

changeset 20883:d1efaaee441b

xend: Dis-allow device assignment if PoD is enabled.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jan 21 14:40:05 2010 +0000 (2010-01-21)
parents cec57fd4565e
children ba6a71530fc6
files tools/python/xen/xend/XendDomainInfo.py
line diff
     1.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Thu Jan 21 11:27:11 2010 +0000
     1.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Thu Jan 21 14:40:05 2010 +0000
     1.3 @@ -390,6 +390,14 @@ class XendDomainInfo:
     1.4              self.domid = domid
     1.5          self.guest_bitsize = None
     1.6          self.alloc_mem = None
     1.7 +
     1.8 +        maxmem = self.info.get('memory_static_max', 0)
     1.9 +        memory = self.info.get('memory_dynamic_max', 0)
    1.10 +
    1.11 +        if maxmem > memory:
    1.12 +            self.pod_enabled = True
    1.13 +        else:
    1.14 +            self.pod_enabled = False
    1.15          
    1.16          #REMOVE: uuid is now generated in XendConfig
    1.17          #if not self._infoIsSet('uuid'):
    1.18 @@ -694,11 +702,18 @@ class XendDomainInfo:
    1.19  
    1.20          return self.hvm_pci_device_insert_dev(new_dev)
    1.21  
    1.22 +    def iommu_check_pod_mode(self):
    1.23 +        """ Disallow PCI device assignment if pod is enabled. """
    1.24 +        if self.pod_enabled:
    1.25 +            raise VmError("failed to assign device since pod is enabled")
    1.26 +
    1.27      def pci_dev_check_assignability_and_do_FLR(self, config):
    1.28          """ In the case of static device assignment(i.e., the 'pci' string in
    1.29          guest config file), we check if the device(s) specified in the 'pci'
    1.30          can be  assigned to guest or not; if yes, we do_FLR the device(s).
    1.31          """
    1.32 +
    1.33 +        self.iommu_check_pod_mode()
    1.34          pci_dev_ctrl = self.getDeviceController('pci')
    1.35          return pci_dev_ctrl.dev_check_assignability_and_do_FLR(config)
    1.36  
    1.37 @@ -708,6 +723,8 @@ class XendDomainInfo:
    1.38          the device.
    1.39          """
    1.40  
    1.41 +        self.iommu_check_pod_mode()
    1.42 +
    1.43          # Test whether the devices can be assigned
    1.44  
    1.45          pci_name = pci_dict_to_bdf_str(new_dev)