On Tue, 18 Mar 2025 at 15:29, Cédric Le Goater <c...@redhat.com> wrote:
> The migration core subsytem makes uses of the VFIO migration API to

* subsytem -> subsystem
* uses -> use

> collect statistics on the number of bytes transferred.

* statistics on the bytes transferred  (number of seems redundant)  OR
 statistics of bytes transferred.

> These services are declared in "hw/vfio/vfio-common.h" which also
> contains VFIO internal declarations. Move the migration declarations
> into a new header file "hw/vfio/vfio-migration.h" to reduce the exposure
> of VFIO internals.
>
> Signed-off-by: Cédric Le Goater <c...@redhat.com>
> ---
>  include/hw/vfio/vfio-common.h    |  4 ----
>  include/hw/vfio/vfio-migration.h | 17 +++++++++++++++++
>  hw/vfio/migration-multifd.c      |  1 +
>  hw/vfio/migration.c              |  1 +
>  migration/target.c               |  2 +-
>  5 files changed, 20 insertions(+), 5 deletions(-)
>  create mode 100644 include/hw/vfio/vfio-migration.h
>
> diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
> index 
> 9cfb3fb6931e71395ef1d67b0a743d8bc1433fdc..5fc7ee76573375bc8464baee29ab88974fac3d3b
>  100644
> --- a/include/hw/vfio/vfio-common.h
> +++ b/include/hw/vfio/vfio-common.h
> @@ -290,13 +290,9 @@ extern VFIODeviceList vfio_device_list;
>  extern const MemoryListener vfio_memory_listener;
>  extern int vfio_kvm_device_fd;
>
> -bool vfio_mig_active(void);
>  int vfio_block_multiple_devices_migration(VFIODevice *vbasedev, Error 
> **errp);
>  void vfio_unblock_multiple_devices_migration(void);
>  bool vfio_viommu_preset(VFIODevice *vbasedev);
> -int64_t vfio_mig_bytes_transferred(void);
> -void vfio_mig_reset_bytes_transferred(void);
> -void vfio_mig_add_bytes_transferred(unsigned long val);
>  bool vfio_device_state_is_running(VFIODevice *vbasedev);
>  bool vfio_device_state_is_precopy(VFIODevice *vbasedev);
>
> diff --git a/include/hw/vfio/vfio-migration.h 
> b/include/hw/vfio/vfio-migration.h
> new file mode 100644
> index 
> 0000000000000000000000000000000000000000..259c532f64bdd002d512375df3140f291a0ade85
> --- /dev/null
> +++ b/include/hw/vfio/vfio-migration.h
> @@ -0,0 +1,17 @@
> +/*
> + * VFIO migration interface
> + *
> + * Copyright Red Hat, Inc. 2025
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#ifndef HW_VFIO_VFIO_MIGRATION_H
> +#define HW_VFIO_VFIO_MIGRATION_H
> +
> +bool vfio_mig_active(void);
> +int64_t vfio_mig_bytes_transferred(void);
> +void vfio_mig_reset_bytes_transferred(void);
> +void vfio_mig_add_bytes_transferred(unsigned long val);
> +
> +#endif /* HW_VFIO_VFIO_MIGRATION_H */
> diff --git a/hw/vfio/migration-multifd.c b/hw/vfio/migration-multifd.c
> index 
> 378f6f3bf01f6a4155fb424f8028cb5380f27f02..fe84735ec2c7bd085820d25c06be558761fbe0d5
>  100644
> --- a/hw/vfio/migration-multifd.c
> +++ b/hw/vfio/migration-multifd.c
> @@ -11,6 +11,7 @@
>
>  #include "qemu/osdep.h"
>  #include "hw/vfio/vfio-common.h"
> +#include "hw/vfio/vfio-migration.h"
>  #include "migration/misc.h"
>  #include "qapi/error.h"
>  #include "qemu/bswap.h"
> diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
> index 
> 8bf65b8e11094b8363692dba3084b762362c7dd6..75096377ffecf62b3bab91102a00d723827ea4c7
>  100644
> --- a/hw/vfio/migration.c
> +++ b/hw/vfio/migration.c
> @@ -17,6 +17,7 @@
>
>  #include "system/runstate.h"
>  #include "hw/vfio/vfio-common.h"
> +#include "hw/vfio/vfio-migration.h"
>  #include "migration/misc.h"
>  #include "migration/savevm.h"
>  #include "migration/vmstate.h"
> diff --git a/migration/target.c b/migration/target.c
> index 
> f5d8cfe7c2a3473f4bd3f5068145598c60973c58..e1eacd1db7a471cba51b4e257a834eb7581f9671
>  100644
> --- a/migration/target.c
> +++ b/migration/target.c
> @@ -11,7 +11,7 @@
>  #include CONFIG_DEVICES
>
>  #ifdef CONFIG_VFIO
> -#include "hw/vfio/vfio-common.h"
> +#include "hw/vfio/vfio-migration.h"
>  #endif
>
>  #ifdef CONFIG_VFIO
> --
> 2.48.1

* Looks okay. With above text corrections, reviewed by:  Prasad Pandit
<p...@fedoraproject.org>

Thank you.
---
  - Prasad


Reply via email to