diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2016-10-03 10:43:21 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2016-10-03 10:43:21 -0400 |
commit | e15194d2a726b7201878d17ee87fa80d89aaabf4 (patch) | |
tree | 12590cdff35e271df867ef42a88c72aa687b89a7 | |
parent | 3f4f35678fb83da2f9ef17ddaa7507a45c2f7049 (diff) | |
parent | 62d9a78f32d9a1b0f6fdae70751deeae6335e74b (diff) |
Merge branch 'pci/resource' into next
* pci/resource:
PCI: Ignore requested alignment for VF BARs
PCI: Ignore requested alignment for PROBE_ONLY and fixed resources
-rw-r--r-- | drivers/pci/pci.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index b2be8957a290..2537d86ad634 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -4977,6 +4977,13 @@ static resource_size_t pci_specified_resource_alignment(struct pci_dev *dev) | |||
4977 | 4977 | ||
4978 | spin_lock(&resource_alignment_lock); | 4978 | spin_lock(&resource_alignment_lock); |
4979 | p = resource_alignment_param; | 4979 | p = resource_alignment_param; |
4980 | if (!*p) | ||
4981 | goto out; | ||
4982 | if (pci_has_flag(PCI_PROBE_ONLY)) { | ||
4983 | pr_info_once("PCI: Ignoring requested alignments (PCI_PROBE_ONLY)\n"); | ||
4984 | goto out; | ||
4985 | } | ||
4986 | |||
4980 | while (*p) { | 4987 | while (*p) { |
4981 | count = 0; | 4988 | count = 0; |
4982 | if (sscanf(p, "%d%n", &align_order, &count) == 1 && | 4989 | if (sscanf(p, "%d%n", &align_order, &count) == 1 && |
@@ -5041,6 +5048,7 @@ static resource_size_t pci_specified_resource_alignment(struct pci_dev *dev) | |||
5041 | } | 5048 | } |
5042 | p++; | 5049 | p++; |
5043 | } | 5050 | } |
5051 | out: | ||
5044 | spin_unlock(&resource_alignment_lock); | 5052 | spin_unlock(&resource_alignment_lock); |
5045 | return align; | 5053 | return align; |
5046 | } | 5054 | } |
@@ -5059,6 +5067,15 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev) | |||
5059 | resource_size_t align, size; | 5067 | resource_size_t align, size; |
5060 | u16 command; | 5068 | u16 command; |
5061 | 5069 | ||
5070 | /* | ||
5071 | * VF BARs are read-only zero according to SR-IOV spec r1.1, sec | ||
5072 | * 3.4.1.11. Their resources are allocated from the space | ||
5073 | * described by the VF BARx register in the PF's SR-IOV capability. | ||
5074 | * We can't influence their alignment here. | ||
5075 | */ | ||
5076 | if (dev->is_virtfn) | ||
5077 | return; | ||
5078 | |||
5062 | /* check if specified PCI is target device to reassign */ | 5079 | /* check if specified PCI is target device to reassign */ |
5063 | align = pci_specified_resource_alignment(dev); | 5080 | align = pci_specified_resource_alignment(dev); |
5064 | if (!align) | 5081 | if (!align) |
@@ -5081,6 +5098,12 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev) | |||
5081 | r = &dev->resource[i]; | 5098 | r = &dev->resource[i]; |
5082 | if (!(r->flags & IORESOURCE_MEM)) | 5099 | if (!(r->flags & IORESOURCE_MEM)) |
5083 | continue; | 5100 | continue; |
5101 | if (r->flags & IORESOURCE_PCI_FIXED) { | ||
5102 | dev_info(&dev->dev, "Ignoring requested alignment for BAR%d: %pR\n", | ||
5103 | i, r); | ||
5104 | continue; | ||
5105 | } | ||
5106 | |||
5084 | size = resource_size(r); | 5107 | size = resource_size(r); |
5085 | if (size < align) { | 5108 | if (size < align) { |
5086 | size = align; | 5109 | size = align; |