linux/drivers/vfio
Longfang Liu b398f91779 hisi_acc_vfio_pci: register debugfs for hisilicon migration driver
On the debugfs framework of VFIO, if the CONFIG_VFIO_DEBUGFS macro is
enabled, the debug function is registered for the live migration driver
of the HiSilicon accelerator device.

After registering the HiSilicon accelerator device on the debugfs
framework of live migration of vfio, a directory file "hisi_acc"
of debugfs is created, and then three debug function files are
created in this directory:

   vfio
    |
    +---<dev_name1>
    |    +---migration
    |        +--state
    |        +--hisi_acc
    |            +--dev_data
    |            +--migf_data
    |            +--cmd_state
    |
    +---<dev_name2>
         +---migration
             +--state
             +--hisi_acc
                 +--dev_data
                 +--migf_data
                 +--cmd_state

dev_data file: read device data that needs to be migrated from the
current device in real time
migf_data file: read the migration data of the last live migration
from the current driver.
cmd_state: used to get the cmd channel state for the device.

+----------------+        +--------------+       +---------------+
| migration dev  |        |   src  dev   |       |   dst  dev    |
+-------+--------+        +------+-------+       +-------+-------+
        |                        |                       |
        |                 +------v-------+       +-------v-------+
        |                 |  saving_migf |       | resuming_migf |
  read  |                 |     file     |       |     file      |
        |                 +------+-------+       +-------+-------+
        |                        |          copy         |
        |                        +------------+----------+
        |                                     |
+-------v--------+                    +-------v--------+
|   data buffer  |                    |   debug_migf   |
+-------+--------+                    +-------+--------+
        |                                     |
   cat  |                                 cat |
+-------v--------+                    +-------v--------+
|   dev_data     |                    |   migf_data    |
+----------------+                    +----------------+

When accessing debugfs, user can obtain the most recent status data
of the device through the "dev_data" file. It can read recent
complete status data of the device. If the current device is being
migrated, it will wait for it to complete.
The data for the last completed migration function will be stored
in debug_migf. Users can read it via "migf_data".

Signed-off-by: Longfang Liu <liulongfang@huawei.com>
Reviewed-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Link: https://lore.kernel.org/r/20241112073322.54550-4-liulongfang@huawei.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2024-11-13 14:58:47 -07:00
..
cdx vfio/cdx: add interrupt support 2024-04-23 14:31:38 -06:00
fsl-mc vfio/fsl-mc: Remove unused variable 'hwirq' 2024-09-03 08:42:06 -06:00
mdev vfio/mdev: Constify struct kobj_type 2024-09-06 08:20:52 -06:00
pci hisi_acc_vfio_pci: register debugfs for hisilicon migration driver 2024-11-13 14:58:47 -07:00
platform ARM: 9370/1: vfio: amba: drop owner assignment 2024-04-18 12:09:21 +01:00
container.c VFIO updates for v6.3-rc1 2023-02-25 11:52:57 -08:00
debugfs.c vfio/migration: Add debugfs to live migration driver 2023-12-04 14:29:08 -07:00
device_cdev.c vfio: Create vfio_fs_type with inode per device 2024-05-31 15:15:51 -06:00
group.c introduce fd_file(), convert all accessors to it. 2024-08-12 22:00:43 -04:00
iommufd.c vfio: Support IO page table replacement 2023-07-28 13:31:24 -03:00
Kconfig vfio/migration: Add debugfs to live migration driver 2023-12-04 14:29:08 -07:00
Makefile vfio/migration: Add debugfs to live migration driver 2023-12-04 14:29:08 -07:00
vfio_iommu_spapr_tce.c vfio/spapr: Always clear TCEs before unsetting the window 2024-06-28 17:03:39 +10:00
vfio_iommu_type1.c vfio: use the new follow_pfnmap API 2024-09-17 01:06:59 -07:00
vfio_main.c vfio: Create vfio_fs_type with inode per device 2024-05-31 15:15:51 -06:00
vfio.h vfio: replace CONFIG_HAVE_KVM with IS_ENABLED(CONFIG_KVM) 2024-02-08 08:45:35 -05:00
virqfd.c introduce fd_file(), convert all accessors to it. 2024-08-12 22:00:43 -04:00