Add read-only debugfs file "tph" to report per-device TPH runtime state: - effective tph_policy mode - virtual TPH capability value - tph_opt-in user enable state Align debugfs comments to include tph_policy and new tph debug entry. Signed-off-by: Chengwen Feng --- drivers/vfio/pci/vfio_pci_core.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c index 318b4f433256..09a209079aac 100644 --- a/drivers/vfio/pci/vfio_pci_core.c +++ b/drivers/vfio/pci/vfio_pci_core.c @@ -130,10 +130,20 @@ static int vfio_pci_core_debugfs_disable_idle_d3(struct seq_file *seq, return 0; } +static int vfio_pci_core_debugfs_tph(struct seq_file *seq, + void *data) +{ + struct vfio_pci_core_device *vdev = vfio_pci_core_debugfs_private(seq); + + seq_printf(seq, "policy=%u cap-virt=0x%x opt-in=%u\n", + vdev->tph_policy, vdev->tph_vcap, vdev->tph_opt_in); + return 0; +} + /* - * disable_idle_d3 and nointxmask are writable module parameters latched - * per device at init, so a device's effective value can differ from the - * current parameter setting. Expose the per-device (read-only) values + * disable_idle_d3, nointxmask and tph_policy are writable module parameters + * latched per device at init, so a device's effective value can differ from + * the current parameter setting. Expose the per-device (read-only) values * here for visibility; read-only parameters can't drift and are omitted. */ static void vfio_pci_core_debugfs_init(struct vfio_pci_core_device *vdev) @@ -149,6 +159,8 @@ static void vfio_pci_core_debugfs_init(struct vfio_pci_core_device *vdev) vfio_pci_core_debugfs_nointxmask); debugfs_create_devm_seqfile(dev, "disable_idle_d3", pci_dir, vfio_pci_core_debugfs_disable_idle_d3); + debugfs_create_devm_seqfile(dev, "tph", pci_dir, + vfio_pci_core_debugfs_tph); } #else static inline void vfio_pci_core_debugfs_init(struct vfio_pci_core_device *vdev) -- 2.17.1