[PATCH v8 03/12] PCI: liveupdate: Track incoming preserved PCI devices
Samiullah Khawaja
skhawaja at google.com
Mon Aug 24 13:13:18 PDT 2026
On Tue, Jul 28, 2026 at 10:09:57PM +0000, David Matlack wrote:
>During PCI enumeration, the previous kernel might have passed state about
>devices that were preserved across kexec. The PCI core needs to fetch
>this state to identify which devices are "incoming" and require special
>handling.
>
>Add pci_liveupdate_setup_device() which is called during device setup
>to fetch the serialized state (struct pci_ser) from the Live Update
>Orchestrator. The first time this happens, pci_flb_retrieve() will run
>and convert the array of pci_dev_ser structs into an xarray so that it
>can be looked up efficiently.
>
>If a device is found in the xarray, the PCI core stores a pointer to its
>state in dev->liveupdate_incoming until pci_liveupdate_finish() is
>called by the driver. This pointer allows the PCI core and drivers to
>apply Live Update-specific logic to incoming devices in subsequent
>commits.
>
>Drivers can check if a device is an incoming preserved device (e.g.
>during probe) by calling pci_liveupdate_is_incoming().
>
>CONFIG_64BIT is now required to enable CONFIG_PCI_LIVEUPDATE so that the
>domain and bdf can be guaranteed to fit in an unsigned long and be used
>as the xarray key.
>
>Reviewed-by: Pranjal Shrivastava <praan at google.com>
>Signed-off-by: David Matlack <dmatlack at google.com>
>---
> MAINTAINERS | 1 +
> drivers/pci/Kconfig | 2 +-
> drivers/pci/liveupdate.c | 256 ++++++++++++++++++++++++++++++++-
> drivers/pci/liveupdate.h | 5 +
> drivers/pci/probe.c | 3 +
> include/linux/pci_liveupdate.h | 13 ++
> 6 files changed, 277 insertions(+), 3 deletions(-)
>
>
[snip]
> static void pci_flb_finish(struct liveupdate_flb_op_args *args)
> {
>+ struct pci_flb_incoming *incoming = args->obj;
>+
> pr_debug("Finished struct pci_ser (0x%llx)\n", args->data);
>- kho_restore_free(args->obj);
>+ pci_check_all_devices_finished(incoming);
This should handle FLB/FD lifecycle nicely. Thanks for adding this.
>+
>+ xa_destroy(&incoming->xa);
>+ kho_block_set_destroy(&incoming->block_set);
>+ kho_restore_free(incoming->ser);
>+ kfree(incoming);
> }
>
Reviewed-by: Samiullah Khawaja <skhawaja at google.com>
More information about the kexec
mailing list