linux/drivers/pci
Chris Wright 6faf17f6f1 PCI SR-IOV: correct broken resource alignment calculations
An SR-IOV capable device includes an SR-IOV PCIe capability which
describes the Virtual Function (VF) BAR requirements.  A typical SR-IOV
device can support multiple VFs whose BARs must be in a contiguous region,
effectively an array of VF BARs.  The BAR reports the size requirement
for a single VF.  We calculate the full range needed by simply multiplying
the VF BAR size with the number of possible VFs and create a resource
spanning the full range.

This all seems sane enough except it artificially inflates the alignment
requirement for the VF BAR.  The VF BAR need only be aligned to the size
of a single BAR not the contiguous range of VF BARs.  This can cause us
to fail to allocate resources for the BAR despite the fact that we
actually have enough space.

This patch adds a thin PCI specific layer over the generic
resource_alignment() function which is aware of the special nature of
VF BARs and does sorting and allocation based on the smaller alignment
requirement.

I recognize that while resource_alignment is generic, it's basically a
PCI helper.  An alternative to this patch is to add PCI VF BAR specific
information to struct resource.  I opted for the extra layer rather than
adding such PCI specific information to struct resource.  This does
have the slight downside that we don't cache the BAR size and re-read
for each alignment query (happens a small handful of times during boot
for each VF BAR).

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: Yu Zhao <yu.zhao@intel.com>
Cc: stable@kernel.org
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-08-30 08:37:25 -07:00
..
hotplug PCI hotplug: SGI hotplug: do not use hotplug_slot_attr 2009-08-07 10:36:27 -07:00
pcie
.gitignore
access.c
bus.c
dmar.c
hotplug-pci.c
hotplug.c
htirq.c
intel-iommu.c intel-iommu: Fix enabling snooping feature by mistake 2009-08-06 11:35:50 +01:00
intr_remapping.c
intr_remapping.h
iov.c PCI SR-IOV: correct broken resource alignment calculations 2009-08-30 08:37:25 -07:00
iova.c
irq.c
Kconfig
Makefile
msi.c
msi.h
pci-acpi.c
pci-driver.c PCI: check saved state before restore 2009-08-20 09:08:45 -07:00
pci-stub.c
pci-sysfs.c
pci.c PCI: check saved state before restore 2009-08-20 09:08:45 -07:00
pci.h PCI SR-IOV: correct broken resource alignment calculations 2009-08-30 08:37:25 -07:00
probe.c
proc.c
quirks.c
remove.c
rom.c
search.c
setup-bus.c PCI SR-IOV: correct broken resource alignment calculations 2009-08-30 08:37:25 -07:00
setup-irq.c
setup-res.c PCI SR-IOV: correct broken resource alignment calculations 2009-08-30 08:37:25 -07:00
slot.c
syscall.c headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00