コード例 #1
0
ファイル: pciif.py プロジェクト: CrazyXen/XEN_CODE
        except Exception, e:
            raise VmError("pci: failed to locate device and "+
                    "parse its resources - "+str(e))

        if dev.driver!='pciback' and dev.driver!='pci-stub':
            raise VmError(("pci: PCI Backend and pci-stub don't own "+ \
                    "device %s") %(dev.name))

        self.CheckSiblingDevices(fe_domid, dev)

        if dev.driver == 'pciback':
            PCIQuirk(dev)

        if not self.vm.info.is_hvm() and not self.vm.info.is_stubdom() :
            # Setup IOMMU device assignment
            bdf = xc.assign_device(fe_domid, pci_dict_to_xc_str(pci_dev))
            pci_str = pci_dict_to_bdf_str(pci_dev)
            if bdf > 0:
                raise VmError("Failed to assign device to IOMMU (%s)" % pci_str)
            log.debug("pci: assign device %s" % pci_str)

        for (start, size) in dev.ioports:
            log.debug('pci: enabling ioport 0x%x/0x%x'%(start,size))
            rc = xc.domain_ioport_permission(domid = fe_domid, first_port = start,
                    nr_ports = size, allow_access = True)
            if rc<0:
                raise VmError(('pci: failed to configure I/O ports on device '+
                            '%s - errno=%d')%(dev.name,rc))
            
        for (start, size) in dev.iomem:
            # Convert start/size from bytes to page frame sizes
コード例 #2
0
ファイル: pciif.py プロジェクト: jeffchao/xen-3.3-tcg
        self.CheckSiblingDevices(fe_domid, dev)

        # We don't do FLR when we create domain and hotplug device into guest,
        # namely, we only do FLR when we destroy domain or hotplug device from
        # guest. This is mainly to work around the race condition in hotplug code
        # paths. See the changeset's description for details.
        # if arch.type != "ia64":
        #    dev.do_FLR()

        PCIQuirk(dev.vendor, dev.device, dev.subvendor, dev.subdevice, domain, 
                bus, slot, func)

        if not self.vm.info.is_hvm():
            # Setup IOMMU device assignment
            pci_str = "0x%x, 0x%x, 0x%x, 0x%x" % (domain, bus, slot, func)
            bdf = xc.assign_device(fe_domid, pci_str)
            if bdf > 0:
                raise VmError("Failed to assign device to IOMMU (%x:%x.%x)"
                              % (bus, slot, func))
            log.debug("pci: assign device %x:%x.%x" % (bus, slot, func))

        for (start, size) in dev.ioports:
            log.debug('pci: enabling ioport 0x%x/0x%x'%(start,size))
            rc = xc.domain_ioport_permission(domid = fe_domid, first_port = start,
                    nr_ports = size, allow_access = True)
            if rc<0:
                raise VmError(('pci: failed to configure I/O ports on device '+
                            '%s - errno=%d')%(dev.name,rc))
            
        for (start, size) in dev.iomem:
            # Convert start/size from bytes to page frame sizes
コード例 #3
0
        except Exception, e:
            raise VmError("pci: failed to locate device and " +
                          "parse its resources - " + str(e))

        if dev.driver != 'pciback' and dev.driver != 'pci-stub':
            raise VmError(("pci: PCI Backend and pci-stub don't own "+ \
                    "device %s") %(dev.name))

        self.CheckSiblingDevices(fe_domid, dev)

        if dev.driver == 'pciback':
            PCIQuirk(dev)

        if not self.vm.info.is_hvm() and not self.vm.info.is_stubdom():
            # Setup IOMMU device assignment
            bdf = xc.assign_device(fe_domid, pci_dict_to_xc_str(pci_dev))
            pci_str = pci_dict_to_bdf_str(pci_dev)
            if bdf > 0:
                raise VmError("Failed to assign device to IOMMU (%s)" %
                              pci_str)
            log.debug("pci: assign device %s" % pci_str)

        for (start, size) in dev.ioports:
            log.debug('pci: enabling ioport 0x%x/0x%x' % (start, size))
            rc = xc.domain_ioport_permission(domid=fe_domid,
                                             first_port=start,
                                             nr_ports=size,
                                             allow_access=True)
            if rc < 0:
                raise VmError(
                    ('pci: failed to configure I/O ports on device ' +
コード例 #4
0
        self.CheckSiblingDevices(fe_domid, dev)

        # We don't do FLR when we create domain and hotplug device into guest,
        # namely, we only do FLR when we destroy domain or hotplug device from
        # guest. This is mainly to work around the race condition in hotplug code
        # paths. See the changeset's description for details.
        # if arch.type != "ia64":
        #    dev.do_FLR()

        PCIQuirk(dev.vendor, dev.device, dev.subvendor, dev.subdevice, domain,
                 bus, slot, func)

        if not self.vm.info.is_hvm():
            # Setup IOMMU device assignment
            pci_str = "0x%x, 0x%x, 0x%x, 0x%x" % (domain, bus, slot, func)
            bdf = xc.assign_device(fe_domid, pci_str)
            if bdf > 0:
                raise VmError("Failed to assign device to IOMMU (%x:%x.%x)" %
                              (bus, slot, func))
            log.debug("pci: assign device %x:%x.%x" % (bus, slot, func))

        for (start, size) in dev.ioports:
            log.debug('pci: enabling ioport 0x%x/0x%x' % (start, size))
            rc = xc.domain_ioport_permission(domid=fe_domid,
                                             first_port=start,
                                             nr_ports=size,
                                             allow_access=True)
            if rc < 0:
                raise VmError(
                    ('pci: failed to configure I/O ports on device ' +
                     '%s - errno=%d') % (dev.name, rc))