v5 2026-07-24

VFIO PCI 设备热更新支持 · v5

VFIO PCI设备热更新支持,通过KHO/LUO保留cdev FD并冻结设备状态。

原始补丁链接

子 Patch(20)

1/20
vfio/pci: Factor out the reset logic in VFIO PCI device close path
从 vfio_pci_core_disable() 中提取设备重置逻辑为 vfio_pci_core_try_reset() 辅助函数,为 VFIO Liveupdate 功能复用。
2/20
vfio: Export various helpers from VFIO
导出 VFIO 内部辅助函数和变量,移除 static 声明并添加到头文件,供 VFIO live update 模块使用。
3/20
vfio/pci: Export vfio_pci_dma_buf_move for vfio-pci module
VFIO Live update during freeze needs to reset the device before handing over to next kernel. Export DMA revoke function which VFIO Live Update will call in its freeze before reset so that P2P DMA doe
4/20
liveupdate: Export symbols needed by modules
Export liveupdate_register_file_handler() and liveupdate_unregister_file_handler(). All of these will be used by vfio-pci in a subsequent commit, which can be built as a module. Reviewed-by: Samiulla
5/20
vfio/pci: Register a file handler with Live Update Orchestrator
Register a live update file handler for vfio-pci device files. Add stub implementations of all required callbacks so that registration does not fail (i.e. to avoid breaking git-bisect). Register it wi
6/20
vfio/pci: Preserve vfio-pci device files across Live Update
Implement the Live Update file handler callbacks to preserve a vfio-pci device across a Live Update. Subsequent commits will enable userspace to then retrieve this file after the Live Update. State a
7/20
vfio: Introduce vfio_find_device() helper
Introduce vfio_find_device() to discover a registered vfio_device from vfio_device_class matching user-provided criteria. To ensure safe lifecycle handling, vfio_find_device() acquires a registration
8/20
vfio: Refactor vfio_device_fops_cdev_open()
Refactor vfio_device_fops_cdev_open() to use a static helper vfio_device_cdev_open(). This helper will be used in subsequent patches to support opening the device file during Live Update restore. No
9/20
vfio: Add API to open cdev device for Live Update restore
During Live Update restore, VFIO PCI driver needs to recreate the device file context that was preserved before kexec and return it to the user. Provide an API for VFIO Live Update to get VFIO device
10/20
vfio/pci: Retrieve preserved device files after Live Update
Enable userspace to retrieve preserved VFIO device files from VFIO after a Live Update by implementing the retrieve(), can_finish() and finish() file handler callbacks. During retrieve, find the VFIO
11/20
vfio: Enforce preserved devices are retrieved via LIVEUPDATE_SESSION_RETRIEVE_FD
From: David Matlack dmatlack@google.com Enforce that files for incoming (preserved by previous kernel) VFIO devices are retrieved via LIVEUPDATE_SESSION_RETRIEVE_FD rather than by opening the corre
12/20
docs: liveupdate: Add documentation for VFIO PCI
From: David Matlack dmatlack@google.com Add documentation for preserving VFIO device files across a Live Update, generated from the kernel-doc comments in the code. Signed-off-by: David Matlack <d
13/20
vfio: selftests: Build liveupdate library in VFIO selftests
Import and build liveupdate selftest library in VFIO selftests. It allows using liveupdate ioctls in VFIO selftests Co-developed-by: David Matlack dmatlack@google.com Signed-off-by: David Matlack
14/20
vfio: selftests: Add vfio_pci_liveupdate_uapi_test
From: David Matlack dmatlack@google.com Add a selftest to exercise preserving various VFIO files through /dev/liveupdate. Ensure that VFIO cdev device files can be preserved and everything else (gr
15/20
vfio: selftests: Initialize vfio_pci_device using a VFIO cdev FD
Use the given VFIO cdev FD to initialize vfio_pci_device in VFIO selftests. Add the assertion to make sure that passed cdev FD is not used with legacy VFIO APIs. If VFIO cdev FD is provided then do no
16/20
vfio: selftests: Add Makefile support for TEST_GEN_PROGS_EXTENDED
From: David Matlack dmatlack@google.com Add Makefile support for TEST_GEN_PROGS_EXTENDED targets. These tests are not run by default. TEST_GEN_PROGS_EXTENDED will be used for Live Update selftests
17/20
vfio: selftests: Add vfio_pci_liveupdate_kexec_test
Add a selftest to exercise preserving a vfio-pci device across a Live Update. For now the test is extremely simple and just verifies that the device file can be preserved and retrieved. In the future
18/20
vfio: selftests: Expose iommu_modes to tests
From: David Matlack dmatlack@google.com Expose the list of iommu_modes to enable tests that want to iterate through all possible iommu modes. Signed-off-by: David Matlack dmatlack@google.com Sig
19/20
vfio: selftests: Verify that opening VFIO device fails during Live Update
From: David Matlack dmatlack@google.com Verify that opening a VFIO device through its cdev file and via VFIO_GROUP_GET_DEVICE_FD both fail with -EBUSY if the device was preserved across a Live Upda
20/20
vfio: selftests: Add continuous DMA to vfio_pci_liveupdate_kexec_test
From: David Matlack dmatlack@google.com Add a long-running DMA memcpy operation to vfio_pci_liveupdate_kexec_test so that the device attempts to perform DMAs continuously during the Live Update. A