[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240716193246.1909697-7-stewart.hildebrand@amd.com>
Date: Tue, 16 Jul 2024 15:32:36 -0400
From: Stewart Hildebrand <stewart.hildebrand@....com>
To: Bjorn Helgaas <bhelgaas@...gle.com>, Michael Ellerman
<mpe@...erman.id.au>, Nicholas Piggin <npiggin@...il.com>, Christophe Leroy
<christophe.leroy@...roup.eu>, "Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>,
Thomas Zimmermann <tzimmermann@...e.de>, Arnd Bergmann <arnd@...db.de>, "Sam
Ravnborg" <sam@...nborg.org>
CC: Stewart Hildebrand <stewart.hildebrand@....com>,
<linux-pci@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linuxppc-dev@...ts.ozlabs.org>
Subject: [PATCH v2 6/8] powerpc/pci: Preserve IORESOURCE_STARTALIGN alignment
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@....com>
---
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.45.2
Powered by blists - more mailing lists