[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250728-luo-pci-v1-6-955b078dd653@kernel.org>
Date: Mon, 28 Jul 2025 01:24:36 -0700
From: Chris Li <chrisl@...nel.org>
To: Bjorn Helgaas <bhelgaas@...gle.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>, Danilo Krummrich <dakr@...nel.org>,
Len Brown <lenb@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
linux-acpi@...r.kernel.org, David Matlack <dmatlack@...gle.com>,
Pasha Tatashin <tatashin@...gle.com>, Jason Miu <jasonmiu@...gle.com>,
Vipin Sharma <vipinsh@...gle.com>, Saeed Mahameed <saeedm@...dia.com>,
Adithya Jayachandran <ajayachandra@...dia.com>,
Parav Pandit <parav@...dia.com>, William Tu <witu@...dia.com>,
Mike Rapoport <rppt@...nel.org>, Chris Li <chrisl@...nel.org>,
Jason Gunthorpe <jgg@...pe.ca>, Leon Romanovsky <leon@...nel.org>
Subject: [PATCH RFC 06/25] PCI/LUO: Forward finish callbacks to drivers
When PCI receives the LUO finish callback. The PCI subsystem forwards the
finish callback to the driver with restored dev->lu.dev_state->data.
Tested: In qemu, request a virtio net device as requested.
Perform luo prepare then kexec. Verify the new kernel boot up
dmesg shows the requested device has per device live update state
restored. Perform liveupdate finish and see the device finish
callback gets invoked.
Signed-off-by: Chris Li <chrisl@...nel.org>
---
drivers/pci/liveupdate.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/pci/liveupdate.c b/drivers/pci/liveupdate.c
index 4d13071f5edd6520adb64003262f08d1f79e26c4..6b85673f4ec20add7e49b04dc44f1bcd868adbdc 100644
--- a/drivers/pci/liveupdate.c
+++ b/drivers/pci/liveupdate.c
@@ -268,6 +268,29 @@ static int pci_call_freeze(struct pci_ser *pci_state, struct list_head *devlist)
return 0;
}
+static void pci_call_finish(struct list_head *devlist)
+{
+ struct device *dev;
+
+ pci_lock_rescan_remove();
+ down_write(&pci_bus_sem);
+
+ list_for_each_entry(dev, devlist, lu.lu_next) {
+ struct pci_dev_ser *s = dev->lu.dev_state;
+
+ if (!dev->driver)
+ panic("PCI luo finish: dev %s does not have driver", dev_name(dev));
+ if (!dev->driver->lu)
+ panic("PCI luo finish: dev %s does not support liveupdate",
+ dev_name(dev));
+ if (!dev->driver->lu->finish)
+ continue;
+ dev->driver->lu->finish(dev, s->driver_data);
+ }
+ up_write(&pci_bus_sem);
+ pci_unlock_rescan_remove();
+}
+
static int pci_liveupdate_freeze(void *arg, u64 *data)
{
struct pci_ser *pci_state = phys_to_virt(*data);
@@ -301,7 +324,12 @@ static void pci_liveupdate_cancel(void *arg, u64 data)
static void pci_liveupdate_finish(void *arg, u64 data)
{
+ struct pci_ser *pci_state = phys_to_virt(data);
+
pr_info("finish data[%llx]\n", data);
+ pci_call_finish(&probe_devices);
+ cleanup_liveupdate_devices(&probe_devices);
+ cleanup_liveupdate_state(pci_state);
}
struct liveupdate_subsystem pci_liveupdate_ops = {
--
2.50.1.487.gc89ff58d15-goog
Powered by blists - more mailing lists