@@ -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
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@linux.vnet.ibm.com> --- drivers/pci/pci.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)