linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/10] LUO: PCI subsystem (phase I)
@ 2025-09-16  7:45 Chris Li
  2025-09-16  7:45 ` [PATCH v2 01/10] PCI/LUO: Register with Liveupdate Orchestrator Chris Li
                   ` (10 more replies)
  0 siblings, 11 replies; 84+ messages in thread
From: Chris Li @ 2025-09-16  7:45 UTC (permalink / raw)
  To: Bjorn Helgaas, Greg Kroah-Hartman, Rafael J. Wysocki,
	Danilo Krummrich, Len Brown, Pasha Tatashin
  Cc: linux-kernel, linux-pci, linux-acpi, David Matlack,
	Pasha Tatashin, Jason Miu, Vipin Sharma, Saeed Mahameed,
	Adithya Jayachandran, Parav Pandit, William Tu, Mike Rapoport,
	Chris Li, Jason Gunthorpe, Leon Romanovsky

This is phase I of the LUO PCI series. It does the minimal set of PCI
device liveupdate which is preserving a bus master bit in the PCI command
register.

The LUO PCI subsystem is based on the LUO V2 series.
https://lore.kernel.org/lkml/20250515182322.117840-1-pasha.tatashin@soleen.com/

It registers the PCI as a LUO subsystem and forwards the liveupdate
callback to the device. The struct dev_liveupdate has been add to struct
device to keep track of the liveupdate related context.

A device can be marked as requested for liveupdate during the normal
state.

In the prepare() callback. The PCI core will build a list of the PCI device
for liveupdate based on the PCI device dependency:
1) The requested device is dependent on the PCI bridge it is on to preserve
   the bridge bus master. All the way to the root bridge. If the bus master
   has been disabled on the bridge, the DMA on the children devices will
   get impacted.

The list of liveupdate devices is used for prepare(), cancel(), freeze()
and finalized() callback.

The PCI subsystem will preserve the driver name for each liveupdate PCI
device and only probe that driver after kexec boot up.

Disclaimer:
The data preservation format is not final. It currently uses C struct
directly. It does not deal with version change on the data format yet. I
do have some idea how to address the versioning of data layout. Those
will be outside the scope of this series.

Testing:
Testing was done with Intel diorite NVMe VF device 8086:1457. Bind the
test device with pci-lu-stub driver.

0000:05:00.1 current driver is
0000:05:00.1 bind new driver pci-lu-stub
[  557.006998] pci-lu-stub 0000:05:00.1: Marking device liveupdate busmaster

Now perform luo prepare, the PCI subsystem builds the liveupdate device
list from the PCI root bridge. The test device will have LU_BUSMASTER
and the PCI bridge will have LU_BUSMASTER_BRIDGE.

[  701.573423] pci-lu-stub 0000:05:00.1: PCI liveupdate: collect liveupdate device: flags 1
[  701.582430] pcieport 0000:04:01.0: PCI liveupdate: collect liveupdate device: flags 2
[  701.590297] pci-lu-stub 0000:05:00.1: pci_lu_stub_prepare(): data: 0x1ac6f4000
[  701.598916] PCI liveupdate: prepare data[1f1d28000]
[  701.603832] luo_core: Switched from [normal] to [prepared] state

After kexec reboot. The liveupdate devices are probed and restores the live
update context.
[    3.622083] pci 0000:04:01.0: PCI liveupdate: liveupdate restore flags 2 driver: pcieport data: [0]
[    4.768060] pci 0000:05:00.1: PCI liveupdate: liveupdate restore flags 1 driver: pci-lu-stub data: [1ac6f4000]

Perform luo finish to convert from update state to normal state. The
reserved folio will be freed.

[  310.359830] PCI liveupdate: finish data[1f1d28000]
[  310.364664] pci-lu-stub 0000:05:00.1: pci_lu_stub_finish(): data: 0x1ac6f4000
[  310.371824] luo_core: Switched from [updated] to [normal] state

Signed-off-by: Chris Li <chrisl@kernel.org>
---
Changes in v2:
- reduce the scope of the series to phase I. Only preserve the bus
  master bit.
- Use finer grain flags to specify which liveupdate feature gets
  preserved.
- Modify the pci-lu-stub driver to set the bus master bit before
  requesting preserving the bus master.
- Add WARN_ON() for the PCI device has LU_BUSMASTER but the bus master
  bit is not set.
- Link to v1: https://lore.kernel.org/r/20250728-luo-pci-v1-0-955b078dd653@kernel.org

---
Chris Li (10):
      PCI/LUO: Register with Liveupdate Orchestrator
      PCI/LUO: Create requested liveupdate device list
      PCI/LUO: Forward prepare()/freeze()/cancel() callbacks to driver
      PCI/LUO: Restore state at PCI enumeration
      PCI/LUO: Forward finish callbacks to drivers
      PCI/LUO: Save and restore driver name
      PCI/LUO: Add liveupdate to pcieport driver
      PCI/LUO: Add pci_liveupdate_get_driver_data()
      PCI/LUO: Avoid write to bus master at boot
      PCI: pci-lu-stub: Add a stub driver for Live Update testing

 MAINTAINERS                    |   4 +
 drivers/pci/Kconfig            |  10 +
 drivers/pci/Makefile           |   2 +
 drivers/pci/liveupdate.c       | 450 +++++++++++++++++++++++++++++++++++++++++
 drivers/pci/pci-lu-stub.c      | 140 +++++++++++++
 drivers/pci/pci.c              |   7 +-
 drivers/pci/pci.h              |   8 +
 drivers/pci/pcie/portdrv.c     |  13 ++
 drivers/pci/probe.c            |   8 +-
 include/linux/dev_liveupdate.h |  69 +++++++
 include/linux/device.h         |  15 ++
 include/linux/device/driver.h  |   6 +
 include/linux/pci.h            |   9 +
 13 files changed, 738 insertions(+), 3 deletions(-)
---
base-commit: 9ab803064e3d1be9673d2829785a69fd0578b24e
change-id: 20250724-luo-pci-1291890b710f

Best regards,
-- 
Chris Li <chrisl@kernel.org>


^ permalink raw reply	[flat|nested] 84+ messages in thread

end of thread, other threads:[~2025-10-14 20:44 UTC | newest]

Thread overview: 84+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-16  7:45 [PATCH v2 00/10] LUO: PCI subsystem (phase I) Chris Li
2025-09-16  7:45 ` [PATCH v2 01/10] PCI/LUO: Register with Liveupdate Orchestrator Chris Li
2025-09-30 15:15   ` Greg Kroah-Hartman
2025-09-30 23:41     ` Chris Li
2025-09-30 15:17   ` Greg Kroah-Hartman
2025-09-30 23:38     ` Chris Li
2025-09-16  7:45 ` [PATCH v2 02/10] PCI/LUO: Create requested liveupdate device list Chris Li
2025-09-29 17:46   ` Jason Gunthorpe
2025-09-30  2:13     ` Chris Li
2025-09-30 16:47       ` Jason Gunthorpe
2025-10-03  7:09         ` Chris Li
2025-10-03  5:33     ` Chris Li
2025-10-03 14:04       ` Jason Gunthorpe
2025-10-03 21:06         ` Chris Li
2025-09-30 15:26   ` Greg Kroah-Hartman
2025-10-03  6:57     ` Chris Li
2025-09-16  7:45 ` [PATCH v2 03/10] PCI/LUO: Forward prepare()/freeze()/cancel() callbacks to driver Chris Li
2025-09-29 17:48   ` Jason Gunthorpe
2025-09-30  2:11     ` Chris Li
2025-09-30 16:38       ` Jason Gunthorpe
2025-10-02 18:54         ` David Matlack
2025-10-02 20:57           ` Chris Li
2025-10-02 21:31             ` David Matlack
2025-10-02 23:21               ` Jason Gunthorpe
2025-10-02 23:42                 ` David Matlack
2025-10-03 12:03                   ` Jason Gunthorpe
2025-10-03 16:03                     ` David Matlack
2025-10-03 16:16                       ` Jason Gunthorpe
2025-10-03 16:28                         ` Pasha Tatashin
2025-10-03 16:56                           ` David Matlack
2025-10-03  5:24                 ` Chris Li
2025-10-03 12:06                   ` Jason Gunthorpe
2025-10-03 16:27                     ` David Matlack
2025-10-03 16:41                       ` Vipin Sharma
2025-10-03 17:44                     ` Chris Li
2025-10-03  5:17               ` Chris Li
2025-10-02 20:44         ` Chris Li
2025-09-30 15:27   ` Greg Kroah-Hartman
2025-10-02 20:38     ` Chris Li
2025-10-03  6:18       ` Greg Kroah-Hartman
2025-10-03  7:26         ` Chris Li
2025-10-03 12:26           ` Greg Kroah-Hartman
2025-10-03 17:49             ` Chris Li
2025-10-03 18:27               ` David Matlack
2025-10-03 21:10                 ` Chris Li
2025-09-16  7:45 ` [PATCH v2 04/10] PCI/LUO: Restore state at PCI enumeration Chris Li
2025-09-16  7:45 ` [PATCH v2 05/10] PCI/LUO: Forward finish callbacks to drivers Chris Li
2025-09-16  7:45 ` [PATCH v2 06/10] PCI/LUO: Save and restore driver name Chris Li
2025-09-29 17:57   ` Jason Gunthorpe
2025-09-30  2:10     ` Chris Li
2025-09-30 13:02       ` Pasha Tatashin
2025-09-30 13:41         ` Greg Kroah-Hartman
2025-09-30 14:53           ` Pasha Tatashin
2025-09-30 15:08             ` Greg Kroah-Hartman
2025-09-30 15:56               ` Pasha Tatashin
2025-10-01  5:06                 ` Greg Kroah-Hartman
2025-10-01 21:03                   ` Pasha Tatashin
2025-10-02  6:09                     ` Greg Kroah-Hartman
2025-10-02 13:23                       ` Jason Gunthorpe
2025-10-02 22:30                       ` Chris Li
2025-09-30 15:41           ` Chris Li
2025-10-01  5:13             ` Greg Kroah-Hartman
2025-10-02 22:05               ` Chris Li
2025-09-30 16:37         ` Jason Gunthorpe
2025-10-02 21:39           ` Chris Li
2025-10-03 14:28             ` Jason Gunthorpe
2025-09-16  7:45 ` [PATCH v2 07/10] PCI/LUO: Add liveupdate to pcieport driver Chris Li
2025-09-16  7:45 ` [PATCH v2 08/10] PCI/LUO: Add pci_liveupdate_get_driver_data() Chris Li
2025-09-16  7:45 ` [PATCH v2 09/10] PCI/LUO: Avoid write to bus master at boot Chris Li
2025-09-29 17:14   ` Bjorn Helgaas
2025-09-16  7:45 ` [PATCH v2 10/10] PCI: pci-lu-stub: Add a stub driver for Live Update testing Chris Li
2025-09-27 17:13 ` [PATCH v2 00/10] LUO: PCI subsystem (phase I) Bjorn Helgaas
2025-09-27 18:05   ` Pasha Tatashin
2025-09-29 15:04     ` Bjorn Helgaas
2025-09-29 18:13       ` Chris Li
2025-10-07 23:32         ` Chris Li
2025-10-08 23:00           ` David Matlack
2025-10-09 17:12             ` Chris Li
2025-10-09 23:21           ` Pratyush Yadav
2025-10-10  4:19             ` Chris Li
2025-10-10 23:49               ` Jason Miu
2025-10-13 13:58                 ` Pratyush Yadav
2025-10-14 16:11                   ` Pratyush Yadav
2025-10-14 20:44                   ` Chris Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).