diff mbox series

[v2,7/8] PCI: Don't reassign resources that are already aligned

Message ID 20240716193246.1909697-8-stewart.hildebrand@amd.com (mailing list archive)
State New
Delegated to: Bjorn Helgaas
Headers show
Series PCI: Align small (<4k) BARs | expand

Commit Message

Stewart Hildebrand July 16, 2024, 7:32 p.m. UTC
As a follow-up to commit 0dde1c08d1b9 ("PCI: Don't reassign resources
that are already aligned"), don't reassign already aligned resources
that have requested alignment without resizing.

Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
---
v1->v2:
* capitalize subject text
---
 drivers/pci/pci.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 1ac1435ad91e..6df318beff37 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -6585,6 +6585,9 @@  static bool pci_request_resource_alignment(struct pci_dev *dev, int bar,
 	if (size >= align)
 		return false;
 
+	if (!resize && (r->start > align) && !(r->start & (align - 1)))
+		return false;
+
 	/*
 	 * Increase the alignment of the resource.  There are two ways we
 	 * can do this: