[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [linux-2.6.18-xen] PCI: sync up the SR-IOV changes between Dom0 and upstream kernel
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1239022083 -3600 # Node ID 711e402bc1419368b6342d380dfc50940b867cbe # Parent 571229e265e2b04e126823f594781592e0e789bd PCI: sync up the SR-IOV changes between Dom0 and upstream kernel The SR-IOV patches for the upstream kernel are finally in-tree. This patch backports some minor changes that appeared in the upstream kernel after the Dom0 patches were checked-in. Signed-off-by: Yu Zhao <yu.zhao@xxxxxxxxx> --- drivers/pci/Kconfig | 8 ++--- drivers/pci/iov.c | 13 ++++----- drivers/pci/quirks.c | 73 ++++++++++++++++++++++----------------------------- 3 files changed, 43 insertions(+), 51 deletions(-) diff -r 571229e265e2 -r 711e402bc141 drivers/pci/Kconfig --- a/drivers/pci/Kconfig Mon Apr 06 13:47:27 2009 +0100 +++ b/drivers/pci/Kconfig Mon Apr 06 13:48:03 2009 +0100 @@ -41,8 +41,8 @@ config PCI_IOV bool "PCI IOV support" depends on PCI help - PCI-SIG I/O Virtualization (IOV) Specifications support. - Single Root IOV: allows the creation of virtual PCI devices - that share the physical resources from a real device. + I/O Virtualization is a PCI feature supported by some devices + which allows them to create virtual devices which share their + physical resources. - When in doubt, say N. + If unsure, say N. diff -r 571229e265e2 -r 711e402bc141 drivers/pci/iov.c --- a/drivers/pci/iov.c Mon Apr 06 13:47:27 2009 +0100 +++ b/drivers/pci/iov.c Mon Apr 06 13:48:03 2009 +0100 @@ -309,16 +309,16 @@ static int sriov_init(struct pci_dev *de if (!total) return 0; + ctrl = 0; list_for_each_entry(pdev, &dev->bus->devices, bus_list) if (pdev->is_physfn) - break; - if (list_empty(&dev->bus->devices) || !pdev->is_physfn) - pdev = NULL; - - ctrl = 0; - if (!pdev && pci_ari_enabled(dev->bus)) + goto found; + + pdev = NULL; + if (pci_ari_enabled(dev->bus)) ctrl |= PCI_SRIOV_CTRL_ARI; +found: pci_write_config_word(dev, pos + PCI_SRIOV_CTRL, ctrl); pci_write_config_word(dev, pos + PCI_SRIOV_NUM_VF, total); pci_read_config_word(dev, pos + PCI_SRIOV_VF_OFFSET, &offset); @@ -507,6 +507,7 @@ int pci_iov_bus_range(struct pci_bus *bu /** * pci_enable_sriov - enable the SR-IOV capability * @dev: the PCI device + * @nr_virtfn: number of Virtual Functions to enable * * Returns 0 on success, or negative on failure. */ diff -r 571229e265e2 -r 711e402bc141 drivers/pci/quirks.c --- a/drivers/pci/quirks.c Mon Apr 06 13:47:27 2009 +0100 +++ b/drivers/pci/quirks.c Mon Apr 06 13:48:03 2009 +0100 @@ -1752,58 +1752,49 @@ EXPORT_SYMBOL(pci_fixup_device); #endif #ifdef CONFIG_PCI_IOV -/* - * If BIOS doesn't allocate resources for SR-IOV BARs, zero Flash BAR - * and program SR-IOV BARs to use the old Flash Memory Space. - * PCI subsystem may try to allocate Memory Space for Flash BAR later, - * that's why we don't clear Flash BAR flags. - */ -static void __devinit intel_82576_quirk(struct pci_dev *dev) -{ - int i, flags; + +/* + * For Intel 82576 SR-IOV NIC, if BIOS doesn't allocate resources for the + * SR-IOV BARs, zero the Flash BAR and program the SR-IOV BARs to use the + * old Flash Memory Space. + */ +static void __devinit quirk_i82576_sriov(struct pci_dev *dev) +{ + int pos, flags; u32 bar, start, size; if (PAGE_SIZE > 0x10000) return; - if (pci_read_config_dword(dev, 0x184, &bar)) - return; - + flags = pci_resource_flags(dev, 0); + if ((flags & PCI_BASE_ADDRESS_SPACE) != + PCI_BASE_ADDRESS_SPACE_MEMORY || + (flags & PCI_BASE_ADDRESS_MEM_TYPE_MASK) != + PCI_BASE_ADDRESS_MEM_TYPE_32) + return; + + pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_SRIOV); + if (!pos) + return; + + pci_read_config_dword(dev, pos + PCI_SRIOV_BAR, &bar); if (bar & PCI_BASE_ADDRESS_MEM_MASK) return; - i = 1; - flags = pci_resource_flags(dev, i); - if ((flags & PCI_BASE_ADDRESS_SPACE) == - PCI_BASE_ADDRESS_SPACE_MEMORY && - (flags & PCI_BASE_ADDRESS_MEM_TYPE_MASK) == - PCI_BASE_ADDRESS_MEM_TYPE_32) - goto found; - - i = 2; - flags = pci_resource_flags(dev, i); - if ((flags & PCI_BASE_ADDRESS_SPACE) == - PCI_BASE_ADDRESS_SPACE_MEMORY && - (flags & PCI_BASE_ADDRESS_MEM_TYPE_MASK) == - PCI_BASE_ADDRESS_MEM_TYPE_64) - goto found; - - return; -found: - start = pci_resource_start(dev, i); - size = pci_resource_len(dev, i); + start = pci_resource_start(dev, 1); + size = pci_resource_len(dev, 1); if (!start || size != 0x400000 || start & (size - 1)) return; - pci_write_config_dword(dev, 0x10 + i * 4, 0); - pci_resource_start(dev, i) = 0; - pci_resource_end(dev, i) = size - 1; - pci_write_config_dword(dev, 0x184, start); - pci_write_config_dword(dev, 0x190, start + size / 2); + pci_resource_flags(dev, 1) = 0; + pci_write_config_dword(dev, PCI_BASE_ADDRESS_1, 0); + pci_write_config_dword(dev, pos + PCI_SRIOV_BAR, start); + pci_write_config_dword(dev, pos + PCI_SRIOV_BAR + 12, start + size / 2); dev_info(&dev->dev, "use Flash Memory Space for SR-IOV BARs\n"); } -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10c9, intel_82576_quirk); -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10e6, intel_82576_quirk); -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10e7, intel_82576_quirk); -#endif /* CONFIG_PCI_IOV */ +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10c9, quirk_i82576_sriov); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10e6, quirk_i82576_sriov); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x10e7, quirk_i82576_sriov); + +#endif /* CONFIG_PCI_IOV */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |