If the firmware or kernel has arranged memory for PCIe devices in a way that doesn't provide enough space for BARs of a new hotplugged device, the kernel can pause the drivers of the "obstructing" devices and move their BARs, so new BARs can fit into the created hole. When a driver is un-paused by the kernel after the PCIe rescan, it should check if its BARs had changed and ioremap() them if needed. BARs are moved not directly, but by releasing bridge resources, then sorting and assigning them back, similarly to the initial PCIe topology scan during system boot (when pci=realloc is passed). Pausing drivers is performed via reset_prepare() and reset_done() callbacks of struct pci_error_handlers. Drivers should pause during rescan not only because of potential movement of their BARs, but also because of possible updating of the bridge windows. This patchset is a part of our work on adding support for hotplugging bridges full of NVME devices (without special requirement such as Hot-Plug Controller, reservation of bus numbers and memory regions by firmware, etc.), should I also add here the patch that adds support of moving BARs to the NVME driver? Sergey Miroshnichenko (4): PCI: hotplug: Add parameter to put devices to reset during rescan PCI: Release and reassign resources from the root during rescan PCI: Invalidate the released BAR resources PCI: Fix writing invalid BARs during pci_restore_state() .../admin-guide/kernel-parameters.txt | 6 ++ drivers/pci/pci.c | 4 +- drivers/pci/pci.h | 8 ++ drivers/pci/probe.c | 78 ++++++++++++++++++- drivers/pci/setup-bus.c | 33 +++++--- include/linux/pci.h | 1 + 6 files changed, 119 insertions(+), 11 deletions(-) -- 2.17.1