Example #1
0
    def pciinfo(self):
        from xen.xend.server.pciif import get_all_assigned_pci_devices
        assigned_devs = get_all_assigned_pci_devices()

        # Each element of dev_list is a PciDevice
        dev_list = PciUtil.find_all_assignable_devices()
        if dev_list is None:
            return None
 
        # Each element of devs_list is a list of PciDevice
        devs_list = PciUtil.check_FLR_capability(dev_list)
 
        devs_list = PciUtil.check_mmio_bar(devs_list)
 
        # Check if the devices have been assigned to guests.
        final_devs_list = []
        for dev_list in devs_list:
            available = True
            for d in dev_list:
                if d.name in assigned_devs:
                    available = False
                    break
            if available:
                final_devs_list = final_devs_list + [dev_list]

        pci_sxp_list = []
        for dev_list in final_devs_list:
            for d in dev_list:
                pci_sxp = ['dev', ['domain', '0x%04x' % d.domain],
                                  ['bus', '0x%02x' % d.bus],
                                  ['slot', '0x%02x' % d.slot],
                                  ['func', '0x%x' % d.func]]
                pci_sxp_list.append(pci_sxp)

        return pci_sxp_list
Example #2
0
    def pciinfo(self):
        # Each element of dev_list is a PciDevice
        dev_list = PciUtil.find_all_devices_owned_by_pciback()
 
        # Each element of devs_list is a list of PciDevice
        devs_list = PciUtil.check_FLR_capability(dev_list)
 
        devs_list = PciUtil.check_mmio_bar(devs_list)
 
        # Check if the devices have been assigned to guests.
        final_devs_list = []
        for dev_list in devs_list:
            available = True
            for d in dev_list:
                pci_str = '0x%x,0x%x,0x%x,0x%x' %(d.domain, d.bus, d.slot, d.func)
                # Xen doesn't care what the domid is, so we pass 0 here...
                domid = 0
                bdf = self.xc.test_assign_device(domid, pci_str)
                if bdf != 0:
                    available = False
                    break
            if available:
                final_devs_list = final_devs_list + [dev_list]

        pci_sxp_list = []
        for dev_list in final_devs_list:
            for d in dev_list:
                pci_sxp = ['dev', ['domain', '0x%04x' % d.domain],
                                  ['bus', '0x%02x' % d.bus],
                                  ['slot', '0x%02x' % d.slot],
                                  ['func', '0x%x' % d.func]]
                pci_sxp_list.append(pci_sxp)

        return pci_sxp_list
Example #3
0
    def pciinfo(self):
        # Each element of dev_list is a PciDevice
        dev_list = PciUtil.find_all_assignable_devices()

        # Each element of devs_list is a list of PciDevice
        devs_list = PciUtil.check_FLR_capability(dev_list)

        devs_list = PciUtil.check_mmio_bar(devs_list)

        # Check if the devices have been assigned to guests.
        final_devs_list = []
        for dev_list in devs_list:
            available = True
            for d in dev_list:
                pci_str = '0x%x,0x%x,0x%x,0x%x' % (d.domain, d.bus, d.slot,
                                                   d.func)
                # Xen doesn't care what the domid is, so we pass 0 here...
                domid = 0
                bdf = self.xc.test_assign_device(domid, pci_str)
                if bdf != 0:
                    available = False
                    break
            if available:
                final_devs_list = final_devs_list + [dev_list]

        pci_sxp_list = []
        for dev_list in final_devs_list:
            for d in dev_list:
                pci_sxp = [
                    'dev', ['domain', '0x%04x' % d.domain],
                    ['bus', '0x%02x' % d.bus], ['slot',
                                                '0x%02x' % d.slot],
                    ['func', '0x%x' % d.func]
                ]
                pci_sxp_list.append(pci_sxp)

        return pci_sxp_list
Example #4
0
    def pciinfo(self):
        from xen.xend.server.pciif import get_all_assigned_pci_devices
        assigned_devs = get_all_assigned_pci_devices()

        # Each element of dev_list is a PciDevice
        dev_list = PciUtil.find_all_assignable_devices()
        if dev_list is None:
            return None

        # Each element of devs_list is a list of PciDevice
        devs_list = PciUtil.check_FLR_capability(dev_list)

        devs_list = PciUtil.check_mmio_bar(devs_list)

        # Check if the devices have been assigned to guests.
        final_devs_list = []
        for dev_list in devs_list:
            available = True
            for d in dev_list:
                if d.name in assigned_devs:
                    available = False
                    break
            if available:
                final_devs_list = final_devs_list + [dev_list]

        pci_sxp_list = []
        for dev_list in final_devs_list:
            for d in dev_list:
                pci_sxp = [
                    'dev', ['domain', '0x%04x' % d.domain],
                    ['bus', '0x%02x' % d.bus], ['slot',
                                                '0x%02x' % d.slot],
                    ['func', '0x%x' % d.func]
                ]
                pci_sxp_list.append(pci_sxp)

        return pci_sxp_list