Skip to content

Commit 4a3ae40

Browse files
ardbiesheuvelksacilotto
authored andcommitted
PCI: Decline to resize resources if boot config must be preserved
BugLink: https://bugs.launchpad.net/bugs/1918974 commit 729e3a6 upstream. 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+ Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Kamal Mostafa <[email protected]> Signed-off-by: Kelsey Skunberg <[email protected]>
1 parent 579e390 commit 4a3ae40

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
@@ -409,10 +409,16 @@ EXPORT_SYMBOL(pci_release_resource);
409409
int pci_resize_resource(struct pci_dev *dev, int resno, int size)
410410
{
411411
struct resource *res = dev->resource + resno;
412+
struct pci_host_bridge *host;
412413
int old, ret;
413414
u32 sizes;
414415
u16 cmd;
415416

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

0 commit comments

Comments
 (0)