Skip to content

Commit 451bb96

Browse files
legoaterAlex Williamson
authored andcommitted
vfio: Dump migration features under debugfs
A debugfs directory was recently added for VFIO devices. Add a new "features" file under the migration sub-directory to expose which features the device supports. Signed-off-by: Cédric Le Goater <clg@redhat.com> Link: https://lore.kernel.org/r/20250918121928.1921871-1-clg@redhat.com Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
1 parent d14de5b commit 451bb96

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

Documentation/ABI/testing/debugfs-vfio

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,9 @@ Contact: Longfang Liu <liulongfang@huawei.com>
2323
Description: Read the live migration status of the vfio device.
2424
The contents of the state file reflects the migration state
2525
relative to those defined in the vfio_device_mig_state enum
26+
27+
What: /sys/kernel/debug/vfio/<device>/migration/features
28+
Date: Oct 2025
29+
KernelVersion: 6.18
30+
Contact: Cédric Le Goater <clg@redhat.com>
31+
Description: Read the migration features of the vfio device.

drivers/vfio/debugfs.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,23 @@ static int vfio_device_state_read(struct seq_file *seq, void *data)
5858
return 0;
5959
}
6060

61+
static int vfio_device_features_read(struct seq_file *seq, void *data)
62+
{
63+
struct device *vf_dev = seq->private;
64+
struct vfio_device *vdev = container_of(vf_dev, struct vfio_device, device);
65+
66+
if (vdev->migration_flags & VFIO_MIGRATION_STOP_COPY)
67+
seq_puts(seq, "stop-copy\n");
68+
if (vdev->migration_flags & VFIO_MIGRATION_P2P)
69+
seq_puts(seq, "p2p\n");
70+
if (vdev->migration_flags & VFIO_MIGRATION_PRE_COPY)
71+
seq_puts(seq, "pre-copy\n");
72+
if (vdev->log_ops)
73+
seq_puts(seq, "dirty-tracking\n");
74+
75+
return 0;
76+
}
77+
6178
void vfio_device_debugfs_init(struct vfio_device *vdev)
6279
{
6380
struct device *dev = &vdev->device;
@@ -72,6 +89,8 @@ void vfio_device_debugfs_init(struct vfio_device *vdev)
7289
vdev->debug_root);
7390
debugfs_create_devm_seqfile(dev, "state", vfio_dev_migration,
7491
vfio_device_state_read);
92+
debugfs_create_devm_seqfile(dev, "features", vfio_dev_migration,
93+
vfio_device_features_read);
7594
}
7695
}
7796

0 commit comments

Comments
 (0)