[RFC PATCH 2/3] PCI: Skip reassigning bridge resources if reducing BAR size
From: Alex Williamson
Date: Tue Aug 16 2022 - 15:40:41 EST
More work is probably necessary here, pci_reassign_bridge_resources()
has heavy weight requirements that the aperture windows are unused,
without even testing if the requested resize is possible in the
existing aperture. One case we can clearly skip is when reducing the
size of a BAR.
Cc: Christian König <christian.koenig@xxxxxxx>
Signed-off-by: Alex Williamson <alex.williamson@xxxxxxxxxx>
---
drivers/pci/setup-res.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
index 439ac5f5907a..7a8e1e4f4d33 100644
--- a/drivers/pci/setup-res.c
+++ b/drivers/pci/setup-res.c
@@ -450,7 +450,7 @@ int pci_resize_resource(struct pci_dev *dev, int resno, int size)
res->end = res->start + pci_rebar_size_to_bytes(size) - 1;
/* Check if the new config works by trying to assign everything. */
- if (dev->bus->self) {
+ if (size > old && dev->bus->self) {
ret = pci_reassign_bridge_resources(dev->bus->self, res->flags);
if (ret)
goto error_resize;