[PATCH v6 3/4] PCI: Don't change resources' size when using resource_alignment
Yongji Xie
xyjxie at linux.vnet.ibm.com
Thu Sep 29 16:46:20 AEST 2016
When using resource_alignment kernel parameter, the current
implement reassigns the alignment by changing resources' size
which can potentially break some drivers. For example, the driver
uses the size to locate some register whose length is related
to the size.
This patch tries to use IORESOURCE_STARTALIGN to specify the
alignment instead of IORESOURCE_SIZEALIGN. Thus, we can
reassign the alignment without changing resources's size.
Signed-off-by: Yongji Xie <xyjxie at linux.vnet.ibm.com>
---
drivers/pci/pci.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index b8357d7..d867c90 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5086,15 +5086,10 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev)
}
size = resource_size(r);
- if (size < align) {
- size = align;
- dev_info(&dev->dev,
- "Rounding up size of resource #%d to %#llx.\n",
- i, (unsigned long long)size);
- }
- r->flags |= IORESOURCE_UNSET;
- r->end = size - 1;
- r->start = 0;
+ r->flags &= ~IORESOURCE_SIZEALIGN;
+ r->flags |= IORESOURCE_STARTALIGN | IORESOURCE_UNSET;
+ r->start = max(align, size);
+ r->end = r->start + size - 1;
}
/* Need to disable bridge's resource window,
* to enable the kernel to reassign new resource
--
1.7.9.5
More information about the Linuxppc-dev
mailing list