Skip to content

Commit 729e3a6

Browse files
ardbiesheuvelbjorn-helgaas
authored andcommitted
PCI: Decline to resize resources if boot config must be preserved
The _DSM #5 method in the ACPI host bridge object tells us whether the OS must preserve the resource assignments done by firmware. If this is the case, we should not permit drivers to resize BARs on the fly. Make pci_resize_resource() take this into account. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Cc: [email protected] # v5.4+
1 parent 7c53f6b commit 729e3a6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/pci/setup-res.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,16 @@ EXPORT_SYMBOL(pci_release_resource);
410410
int pci_resize_resource(struct pci_dev *dev, int resno, int size)
411411
{
412412
struct resource *res = dev->resource + resno;
413+
struct pci_host_bridge *host;
413414
int old, ret;
414415
u32 sizes;
415416
u16 cmd;
416417

418+
/* Check if we must preserve the firmware's resource assignment */
419+
host = pci_find_host_bridge(dev->bus);
420+
if (host->preserve_config)
421+
return -ENOTSUPP;
422+
417423
/* Make sure the resource isn't assigned before resizing it. */
418424
if (!(res->flags & IORESOURCE_UNSET))
419425
return -EBUSY;

0 commit comments

Comments
 (0)