On Fri, 22 May 2026 20:23:59 +0000, David Matlack <[email protected]> wrote: > diff --git a/MAINTAINERS b/MAINTAINERS > index 2fb1c75afd16..6c618830cf61 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -20530,6 +20530,16 @@ L: [email protected] > S: Supported > F: Documentation/PCI/pci-error-recovery.rst > > +PCI LIVE UPDATE > +M: David Matlack <[email protected]>
Please add Pratyush, Mike, and myself so we are notified directly of incoming patches, the same as with other areas where the liveupdate/ tree is specified. > > diff --git a/drivers/pci/liveupdate.c b/drivers/pci/liveupdate.c > new file mode 100644 > index 000000000000..737e7b9366db > --- /dev/null > +++ b/drivers/pci/liveupdate.c > @@ -0,0 +1,145 @@ > +// SPDX-License-Identifier: GPL-2.0 > + > +/* > + * Copyright (c) 2026, Google LLC. > + * David Matlack <[email protected]> > + */ > + > +/** > + * DOC: PCI Live Update > + * > + * The PCI subsystem participates in the Live Update process to enable > drivers > + * to preserve their PCI devices across kexec. > + * > + * File-Lifecycle-Bound (FLB) Data > + * =============================== ... > + * > + * PCI device preservation across Live Update is built on top of the Live > Update > + * Orchestrator's (LUO) support for file preservation across kexec. Drivers I prefer to just use acronyms FLB, and LUO, but have links to the actual documentations about them. So, something like this: * :ref:`FLB <flb>` Data * ===================== * * PCI device preservation across Live Update is built on top of the * :ref:`LUO <luo>` support for file preservation across kexec. Drivers And also add _luo and _flb to Documentation/core-api/liveupdate.rst .. _luo: ======================== Live Update Orchestrator ======================== .. _flb: LUO File Lifecycle Bound Global Data ==================================== > [ ... skip 17 lines ... ] > + * > + * * ``pci_liveupdate_register_flb(driver_file_handler)`` > + * * ``pci_liveupdate_unregister_flb(driver_file_handler)`` > + */ > + > +#define pr_fmt(fmt) "PCI: liveupdate: " fmt Nit, may be: > + > +#include <linux/io.h> > +#include <linux/kexec_handover.h> > +#include <linux/kho/abi/pci.h> > +#include <linux/liveupdate.h> > +#include <linux/mutex.h> > +#include <linux/mm.h> Please sort alphabetically. > [ ... skip 12 lines ... ] > + * future to increase the chances that there is enough room to preserve > + * devices that are not yet present on the system (e.g. VFs, hot-plugged > + * devices). > + */ > + for_each_pci_dev(dev) > + max_nr_devices++; I think, we want to use kho_block [1] (it is in liveupdate/next branch) to allow number of supported devices to be dynamic. To support this, we would redefine the ABI and tracking structures like so: /* include/linux/kho/abi/pci.h */ struct pci_ser { u64 devices; /* Phys address of the first block header of kho_block_set */ u64 nr_devices; /* Total count of active preserved devices */ } __packed; /* drivers/pci/liveupdate.c */ struct pci_flb_outgoing { struct pci_ser *ser; /* Points to the FDT/KHO-allocated ABI struct */ struct kho_block_set block_set; /* Controls the active blocks on the fly */ }; In __pci_liveupdate_preserve_device() , we would search for and reuse any inactive pci_dev_ser slot first, and only call kho_block_set_grow() to expand if no inactive slots are available. In pci_liveupdate_unpreserve_device(), we would simply mark the pci_dev_ser as inactive. > > diff --git a/include/linux/pci_liveupdate.h b/include/linux/pci_liveupdate.h > new file mode 100644 > index 000000000000..8ec98beefcb4 > --- /dev/null > +++ b/include/linux/pci_liveupdate.h > @@ -0,0 +1,30 @@ > [ ... skip 24 lines ... ] > +static inline void pci_liveupdate_unregister_flb(struct > liveupdate_file_handler *fh) > +{ > +} > +#endif > + > +#endif /* LINUX_PCI_LIVEUPDATE_H */ [1] https://lore.kernel.org/all/[email protected]/ Preserving: In __pci_liveupdate_preserve_device() , we would search for Unpreserving: In pci_liveupdate_unpreserve_device(), we would simply Preserving: In __pci_liveupdate_preserve_device() , we would search for Unpreserving: In pci_liveupdate_unpreserve_device(), we would simply -- Pasha Tatashin <[email protected]>
