[PATCH v3 6/8] powerpc/pci: Preserve IORESOURCE_STARTALIGN alignment
Stewart Hildebrand
stewart.hildebrand at amd.com
Thu Aug 8 01:17:15 AEST 2024
There is a corner case in pcibios_allocate_resources()/alloc_resource()
where the IORESOURCE_STARTALIGN alignment of memory BAR resources gets
overwritten. This does not affect bridge resources. Account for
IORESOURCE_STARTALIGN.
Signed-off-by: Stewart Hildebrand <stewart.hildebrand at amd.com>
---
v2->v3:
* no change
v1->v2:
* new patch
---
arch/powerpc/kernel/pci-common.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index eac84d687b53..3f346ad641e0 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1303,8 +1303,10 @@ static inline void alloc_resource(struct pci_dev *dev, int idx)
pr_debug("PCI: parent is %p: %pR\n", pr, pr);
/* We'll assign a new address later */
r->flags |= IORESOURCE_UNSET;
- r->end -= r->start;
- r->start = 0;
+ if (!(r->flags & IORESOURCE_STARTALIGN)) {
+ r->end -= r->start;
+ r->start = 0;
+ }
}
}
--
2.46.0
More information about the Linuxppc-dev
mailing list