Lines Matching refs:iov
82 * Update iov->offset and iov->stride when NumVFs is written.
86 struct pci_sriov *iov = dev->sriov;
88 pci_write_config_word(dev, iov->pos + PCI_SRIOV_NUM_VF, nr_virtfn);
89 pci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_OFFSET, &iov->offset);
90 pci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_STRIDE, &iov->stride);
102 struct pci_sriov *iov = dev->sriov;
105 for (nr_virtfn = iov->total_VFs; nr_virtfn; nr_virtfn--) {
107 if (!iov->offset || (nr_virtfn > 1 && !iov->stride)) {
113 if (busnr > iov->max_VF_buses)
114 iov->max_VF_buses = busnr;
295 struct pci_sriov *iov = dev->sriov;
308 virtfn->device = iov->vf_device;
605 struct pci_sriov *iov = dev->sriov;
612 if (iov->num_VFs)
615 pci_read_config_word(dev, iov->pos + PCI_SRIOV_INITIAL_VF, &initial);
616 if (initial > iov->total_VFs ||
617 (!(iov->cap & PCI_SRIOV_CAP_VFM) && (initial != iov->total_VFs)))
620 if (nr_virtfn < 0 || nr_virtfn > iov->total_VFs ||
621 (!(iov->cap & PCI_SRIOV_CAP_VFM) && (nr_virtfn > initial)))
631 if (nres != iov->nres) {
648 if (iov->link != dev->devfn) {
649 pdev = pci_get_slot(dev->bus, iov->link);
665 iov->initial_VFs = initial;
676 iov->ctrl |= PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE;
678 pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl);
687 iov->num_VFs = nr_virtfn;
692 iov->ctrl &= ~(PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE);
694 pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl);
700 if (iov->link != dev->devfn)
709 struct pci_sriov *iov = dev->sriov;
712 for (i = 0; i < iov->num_VFs; i++)
718 struct pci_sriov *iov = dev->sriov;
720 if (!iov->num_VFs)
724 iov->ctrl &= ~(PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE);
726 pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl);
732 if (iov->link != dev->devfn)
735 iov->num_VFs = 0;
746 struct pci_sriov *iov;
781 iov = kzalloc(sizeof(*iov), GFP_KERNEL);
782 if (!iov)
803 iov->barsz[i] = resource_size(res);
811 iov->pos = pos;
812 iov->nres = nres;
813 iov->ctrl = ctrl;
814 iov->total_VFs = total;
815 iov->driver_max_VFs = total;
816 pci_read_config_word(dev, pos + PCI_SRIOV_VF_DID, &iov->vf_device);
817 iov->pgsz = pgsz;
818 iov->self = dev;
819 iov->drivers_autoprobe = true;
820 pci_read_config_dword(dev, pos + PCI_SRIOV_CAP, &iov->cap);
821 pci_read_config_byte(dev, pos + PCI_SRIOV_FUNC_LINK, &iov->link);
823 iov->link = PCI_DEVFN(PCI_SLOT(dev->devfn), iov->link);
826 iov->dev = pci_dev_get(pdev);
828 iov->dev = dev;
830 dev->sriov = iov;
847 kfree(iov);
866 struct pci_sriov *iov = dev->sriov;
868 pci_read_config_word(dev, iov->pos + PCI_SRIOV_CTRL, &ctrl);
877 ctrl |= iov->ctrl & PCI_SRIOV_CTRL_ARI;
878 pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, ctrl);
883 pci_write_config_dword(dev, iov->pos + PCI_SRIOV_SYS_PGSIZE, iov->pgsz);
884 pci_iov_set_numvfs(dev, iov->num_VFs);
885 pci_write_config_word(dev, iov->pos + PCI_SRIOV_CTRL, iov->ctrl);
886 if (iov->ctrl & PCI_SRIOV_CTRL_VFE)
926 struct pci_sriov *iov = dev->sriov;
931 iov->driver_max_VFs = iov->total_VFs;
932 if (iov->num_VFs)
945 struct pci_sriov *iov = dev->is_physfn ? dev->sriov : NULL;
958 if (!iov)
961 pci_read_config_word(dev, iov->pos + PCI_SRIOV_CTRL, &cmd);
986 reg = iov->pos + PCI_SRIOV_BAR + 4 * vf_bar;