[PATCH 09/10] PCI: liveupdate: Don't realign resources of incoming devices
From: David Matlack
Date: Mon Oct 19 2026 - 17:32:17 EST
Skip pci_reassigndev_resource_alignment() for incoming preserved devices
and log a warning instead.
When the "pci=resource_alignment=" kernel parameter matches a device,
pci_reassigndev_resource_alignment() disables Memory Space Enable, marks
the device's BARs as unassigned so they get reassigned, and disables
bridge windows. Doing this to a device preserved across Live Update
would disrupt any memory transactions targeting the device and change
the addresses of its BARs out from under anything still accessing them,
such as its driver, peers performing P2PDMA to it, or VMs whose vCPUs
keep running during kexec.
Assisted-by: LLM
Signed-off-by: David Matlack <dmatlack@xxxxxxxxxx>
---
drivers/pci/pci.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index e5b960ca26e6..853c84a2c782 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -6750,6 +6750,16 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev)
return;
}
+ /*
+ * Reassigning resources disables decoding and moves BARs and bridge
+ * windows, which would break devices preserved across Live Update that
+ * are still performing memory transactions.
+ */
+ if (pci_liveupdate_is_incoming(dev)) {
+ pci_warn(dev, "Can't reassign resources of device preserved across Live Update\n");
+ return;
+ }
+
pci_read_config_word(dev, PCI_COMMAND, &command);
command &= ~PCI_COMMAND_MEMORY;
pci_write_config_word(dev, PCI_COMMAND, command);
--
2.56.0.212.g129ede20d9-goog