diff options
author | Yongji Xie <elohimes@gmail.com> | 2017-04-10 13:58:11 +0200 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-04-18 21:47:20 +0200 |
commit | c9c75143a5962c4c26d2f2c99b7a6e06f421f5e1 (patch) | |
tree | 55bd5389c0e603b900ce7fcc317fbae2575543bb /drivers/pci/setup-bus.c | |
parent | PCI: Ignore requested alignment for IOV BARs (diff) | |
download | linux-c9c75143a5962c4c26d2f2c99b7a6e06f421f5e1.tar.xz linux-c9c75143a5962c4c26d2f2c99b7a6e06f421f5e1.zip |
PCI: Fix calculation of bridge window's size and alignment
In case that one device's alignment is greater than its size, we may
get an incorrect size and alignment for its bus's memory window in
pbus_size_mem(). Fix this case.
Signed-off-by: Yongji Xie <elohimes@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/setup-bus.c')
-rw-r--r-- | drivers/pci/setup-bus.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index cb389277df41..958da7db9033 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -1066,10 +1066,10 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, r->flags = 0; continue; } - size += r_size; + size += max(r_size, align); /* Exclude ranges with size > align from calculation of the alignment. */ - if (r_size == align) + if (r_size <= align) aligns[order] += align; if (order > max_order) max_order = order; |