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@xxxxxxxxxx> --- 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