[PATCH for-10.1 05/32] vfio: Make vfio_viommu_preset() static

Cédric Le Goater posted 32 patches 2 weeks, 2 days ago
There is a newer version of this series
[PATCH for-10.1 05/32] vfio: Make vfio_viommu_preset() static
Posted by Cédric Le Goater 2 weeks, 2 days ago
This routine is only used in file "migration.c". Move it there.

Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
 include/hw/vfio/vfio-common.h | 1 -
 hw/vfio/common.c              | 6 ------
 hw/vfio/migration.c           | 5 +++++
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
index 5f082e5a321d97e90066d48cd3c1eaad56912ccb..0aae88131cffda1a90b8ccd0224387133c0fa83a 100644
--- a/include/hw/vfio/vfio-common.h
+++ b/include/hw/vfio/vfio-common.h
@@ -290,7 +290,6 @@ extern VFIODeviceList vfio_device_list;
 extern const MemoryListener vfio_memory_listener;
 extern int vfio_kvm_device_fd;
 
-bool vfio_viommu_preset(VFIODevice *vbasedev);
 bool vfio_device_state_is_running(VFIODevice *vbasedev);
 bool vfio_device_state_is_precopy(VFIODevice *vbasedev);
 
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index ace7a4403bd49f35cf85009015b3ba315f80cd30..0b9b071cd0490867bb6aa4ceb261350ccd6e1125 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -65,12 +65,6 @@ int vfio_kvm_device_fd = -1;
  * Device state interfaces
  */
 
-
-bool vfio_viommu_preset(VFIODevice *vbasedev)
-{
-    return vbasedev->bcontainer->space->as != &address_space_memory;
-}
-
 static void vfio_set_migration_error(int ret)
 {
     if (migration_is_running()) {
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index 951e073a20287c46ca199b1648782b59415d0d2a..a1ba993ce549fce0d2a9a60ba07d4782c87c0c09 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -1141,6 +1141,11 @@ bool vfio_mig_active(void)
     return true;
 }
 
+static bool vfio_viommu_preset(VFIODevice *vbasedev)
+{
+    return vbasedev->bcontainer->space->as != &address_space_memory;
+}
+
 /*
  * Return true when either migration initialized or blocker registered.
  * Currently only return false when adding blocker fails which will
-- 
2.48.1


Re: [PATCH for-10.1 05/32] vfio: Make vfio_viommu_preset() static
Posted by John Levon 2 weeks ago
On Tue, Mar 18, 2025 at 10:53:48AM +0100, Cédric Le Goater wrote:

> This routine is only used in file "migration.c". Move it there.
> 
> Signed-off-by: Cédric Le Goater <clg@redhat.com>

Reviewed-by: John Levon <john.levon@nutanix.com>

regards
john
Re: [PATCH for-10.1 05/32] vfio: Make vfio_viommu_preset() static
Posted by Joao Martins 2 weeks ago
On 18/03/2025 09:53, Cédric Le Goater wrote:
> This routine is only used in file "migration.c". Move it there.
> 
> Signed-off-by: Cédric Le Goater <clg@redhat.com>

Reviewed-by: Joao Martins <joao.m.martins@oracle.com>

> ---
>  include/hw/vfio/vfio-common.h | 1 -
>  hw/vfio/common.c              | 6 ------
>  hw/vfio/migration.c           | 5 +++++
>  3 files changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
> index 5f082e5a321d97e90066d48cd3c1eaad56912ccb..0aae88131cffda1a90b8ccd0224387133c0fa83a 100644
> --- a/include/hw/vfio/vfio-common.h
> +++ b/include/hw/vfio/vfio-common.h
> @@ -290,7 +290,6 @@ extern VFIODeviceList vfio_device_list;
>  extern const MemoryListener vfio_memory_listener;
>  extern int vfio_kvm_device_fd;
>  
> -bool vfio_viommu_preset(VFIODevice *vbasedev);
>  bool vfio_device_state_is_running(VFIODevice *vbasedev);
>  bool vfio_device_state_is_precopy(VFIODevice *vbasedev);
>  
> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
> index ace7a4403bd49f35cf85009015b3ba315f80cd30..0b9b071cd0490867bb6aa4ceb261350ccd6e1125 100644
> --- a/hw/vfio/common.c
> +++ b/hw/vfio/common.c
> @@ -65,12 +65,6 @@ int vfio_kvm_device_fd = -1;
>   * Device state interfaces
>   */
>  
> -
> -bool vfio_viommu_preset(VFIODevice *vbasedev)
> -{
> -    return vbasedev->bcontainer->space->as != &address_space_memory;
> -}
> -
>  static void vfio_set_migration_error(int ret)
>  {
>      if (migration_is_running()) {
> diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
> index 951e073a20287c46ca199b1648782b59415d0d2a..a1ba993ce549fce0d2a9a60ba07d4782c87c0c09 100644
> --- a/hw/vfio/migration.c
> +++ b/hw/vfio/migration.c
> @@ -1141,6 +1141,11 @@ bool vfio_mig_active(void)
>      return true;
>  }
>  
> +static bool vfio_viommu_preset(VFIODevice *vbasedev)
> +{
> +    return vbasedev->bcontainer->space->as != &address_space_memory;
> +}
> +
>  /*
>   * Return true when either migration initialized or blocker registered.
>   * Currently only return false when adding blocker fails which will