From: "Cédric Le Goater" <clg@redhat.com>
To: qemu-devel@nongnu.org, Alex Williamson <alex.williamson@redhat.com>
Cc: "Avihai Horon" <avihaih@nvidia.com>,
"Eric Auger" <eric.auger@redhat.com>,
"Zhenzhong Duan" <zhenzhong.duan@intel.com>,
"John Levon" <john.levon@nutanix.com>,
"Joao Martins" <joao.m.martins@oracle.com>,
"Cédric Le Goater" <clg@redhat.com>,
"Steve Sistare" <steven.sistare@oracle.com>
Subject: [PATCH v3 21/37] vfio: Introduce new files for CPR definitions and declarations
Date: Tue, 22 Apr 2025 18:02:08 +0200 [thread overview]
Message-ID: <20250422160224.199714-22-clg@redhat.com> (raw)
In-Reply-To: <20250422160224.199714-1-clg@redhat.com>
Gather all CPR related declarations into "vfio-cpr.h" to reduce exposure
of VFIO internals in "hw/vfio/vfio-common.h". These were introduced in
commit d9fa4223b30a ("vfio: register container for cpr").
Order file list in meson.build while at it.
Cc: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Steve Sistare <steven.sistare@oracle.com>
Link: https://lore.kernel.org/qemu-devel/20250326075122.1299361-22-clg@redhat.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/vfio/vfio-cpr.h | 15 +++++++++++++++
include/hw/vfio/vfio-common.h | 3 ---
hw/vfio/container.c | 1 +
hw/vfio/cpr.c | 1 +
hw/vfio/iommufd.c | 1 +
hw/vfio/meson.build | 2 +-
6 files changed, 19 insertions(+), 4 deletions(-)
create mode 100644 hw/vfio/vfio-cpr.h
diff --git a/hw/vfio/vfio-cpr.h b/hw/vfio/vfio-cpr.h
new file mode 100644
index 0000000000000000000000000000000000000000..134b83a62461cbe9409bbe42057fb4134d84dcd1
--- /dev/null
+++ b/hw/vfio/vfio-cpr.h
@@ -0,0 +1,15 @@
+/*
+ * VFIO CPR
+ *
+ * Copyright (c) 2025 Oracle and/or its affiliates.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef HW_VFIO_CPR_H
+#define HW_VFIO_CPR_H
+
+bool vfio_cpr_register_container(VFIOContainerBase *bcontainer, Error **errp);
+void vfio_cpr_unregister_container(VFIOContainerBase *bcontainer);
+
+#endif /* HW_VFIO_CPR_H */
diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
index 75c48ebf5c21ea93aa8ac4c3aecc63172b633f0e..c587ed08feabd0c4845d824960dd0799e9ace69b 100644
--- a/include/hw/vfio/vfio-common.h
+++ b/include/hw/vfio/vfio-common.h
@@ -129,9 +129,6 @@ bool vfio_attach_device(char *name, VFIODevice *vbasedev,
void vfio_detach_device(VFIODevice *vbasedev);
VFIODevice *vfio_get_vfio_device(Object *obj);
-bool vfio_cpr_register_container(VFIOContainerBase *bcontainer, Error **errp);
-void vfio_cpr_unregister_container(VFIOContainerBase *bcontainer);
-
typedef QLIST_HEAD(VFIODeviceList, VFIODevice) VFIODeviceList;
extern VFIODeviceList vfio_device_list;
extern const MemoryListener vfio_memory_listener;
diff --git a/hw/vfio/container.c b/hw/vfio/container.c
index 6e9378434377f4b03176a16157c337ab1286c53e..7436388a73a424b11e6bad9ce80b86c3792242dd 100644
--- a/hw/vfio/container.c
+++ b/hw/vfio/container.c
@@ -34,6 +34,7 @@
#include "pci.h"
#include "hw/vfio/vfio-container.h"
#include "vfio-helpers.h"
+#include "vfio-cpr.h"
#define TYPE_HOST_IOMMU_DEVICE_LEGACY_VFIO TYPE_HOST_IOMMU_DEVICE "-legacy-vfio"
diff --git a/hw/vfio/cpr.c b/hw/vfio/cpr.c
index 3d1c8d290a5e6b6d67e244931a9ef8c194a0b574..696987006b853227e76caedb3c7f4e4be31cfa06 100644
--- a/hw/vfio/cpr.c
+++ b/hw/vfio/cpr.c
@@ -10,6 +10,7 @@
#include "migration/misc.h"
#include "qapi/error.h"
#include "system/runstate.h"
+#include "vfio-cpr.h"
static int vfio_cpr_reboot_notifier(NotifierWithReturn *notifier,
MigrationEvent *e, Error **errp)
diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
index 85b5a8146ac401af6be8109c28ea4c7a39e84521..a5bd189a86d70bd11ecb80384ac145a51979322b 100644
--- a/hw/vfio/iommufd.c
+++ b/hw/vfio/iommufd.c
@@ -27,6 +27,7 @@
#include "pci.h"
#include "vfio-iommufd.h"
#include "vfio-helpers.h"
+#include "vfio-cpr.h"
#define TYPE_HOST_IOMMU_DEVICE_IOMMUFD_VFIO \
TYPE_HOST_IOMMU_DEVICE_IOMMUFD "-vfio"
diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
index 60caa366175edee6bc69c0febebaef84e752e346..1f89bd28c13dea55bcfff476ce99d51b453d8533 100644
--- a/hw/vfio/meson.build
+++ b/hw/vfio/meson.build
@@ -20,10 +20,10 @@ system_ss.add(when: 'CONFIG_VFIO_XGMAC', if_true: files('calxeda-xgmac.c'))
system_ss.add(when: 'CONFIG_VFIO_AMD_XGBE', if_true: files('amd-xgbe.c'))
system_ss.add(when: 'CONFIG_VFIO', if_true: files(
'container-base.c',
+ 'cpr.c',
'device.c',
'migration.c',
'migration-multifd.c',
- 'cpr.c',
'region.c',
))
system_ss.add(when: ['CONFIG_VFIO', 'CONFIG_IOMMUFD'], if_true: files(
--
2.49.0
next prev parent reply other threads:[~2025-04-22 16:11 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-22 16:01 [PATCH v3 00/37] vfio: Spring cleanup Cédric Le Goater
2025-04-22 16:01 ` [PATCH v3 01/37] vfio: Move vfio_mig_active() into migration.c Cédric Le Goater
2025-04-22 16:01 ` [PATCH v3 02/37] vfio: Rename vfio_reset_bytes_transferred() Cédric Le Goater
2025-04-22 16:01 ` [PATCH v3 03/37] vfio: Introduce a new header file for external migration services Cédric Le Goater
2025-04-22 16:01 ` [PATCH v3 04/37] vfio: Make vfio_un/block_multiple_devices_migration() static Cédric Le Goater
2025-04-22 16:01 ` [PATCH v3 05/37] vfio: Make vfio_viommu_preset() static Cédric Le Goater
2025-04-22 16:01 ` [PATCH v3 06/37] vfio: Introduce a new header file for internal migration services Cédric Le Goater
2025-04-22 16:01 ` [PATCH v3 07/37] vfio: Move vfio_device_state_is_running/precopy() into migration.c Cédric Le Goater
2025-04-22 16:01 ` [PATCH v3 08/37] vfio: Introduce a new header file for VFIOdisplay declarations Cédric Le Goater
2025-04-22 16:01 ` [PATCH v3 09/37] vfio: Move VFIOHostDMAWindow definition into spapr.c Cédric Le Goater
2025-04-22 16:01 ` [PATCH v3 10/37] vfio: Introduce a new header file for VFIOIOMMUFD declarations Cédric Le Goater
2025-04-22 16:01 ` [PATCH v3 11/37] vfio: Introduce new files for VFIORegion definitions and declarations Cédric Le Goater
2025-04-22 16:01 ` [PATCH v3 12/37] vfio: Introduce a new header file for VFIOcontainer declarations Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 13/37] vfio: Make vfio_group_list static Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 14/37] vfio: Move VFIOAddressSpace helpers into container-base.c Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 15/37] vfio: Move Host IOMMU type declarations into their respective files Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 16/37] vfio: Introduce a new header file for helper services Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 17/37] vfio: Move vfio_get_info_dma_avail() into helpers.c Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 18/37] vfio: Move vfio_kvm_device_add/del_fd() to helpers.c Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 19/37] vfio: Move vfio_get_device_info() " Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 20/37] vfio: Introduce a new file for VFIODevice definitions Cédric Le Goater
2025-04-22 16:02 ` Cédric Le Goater [this message]
2025-04-22 16:02 ` [PATCH v3 22/37] vfio: Move vfio_kvm_device_fd() into helpers.c Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 23/37] vfio: Move vfio_device_list into device.c Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 24/37] vfio: Move vfio_de/attach_device() " Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 25/37] vfio: Move vfio_reset_handler() " Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 26/37] vfio: Move dirty tracking related services into container-base.c Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 27/37] vfio: Make vfio_devices_query_dirty_bitmap() static Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 28/37] vfio: Make vfio_container_query_dirty_bitmap() static Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 29/37] vfio: Rename vfio_devices_all_dirty_tracking_started() Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 30/37] vfio: Rename vfio_devices_all_device_dirty_tracking() Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 31/37] vfio: Rename vfio_get_dirty_bitmap() Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 32/37] vfio: Introduce new files for VFIO MemoryListener Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 33/37] vfio: Rename RAM discard related services Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 34/37] vfio: Introduce vfio_listener_un/register() routines Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 35/37] vfio: Rename vfio-common.h to vfio-device.h Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 36/37] vfio: Rename VFIODevice related services Cédric Le Goater
2025-04-22 16:02 ` [PATCH v3 37/37] vfio: Rename VFIOContainer " Cédric Le Goater
2025-04-22 16:55 ` [PATCH v3 00/37] vfio: Spring cleanup Cédric Le Goater
2025-04-25 7:57 ` Cédric Le Goater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250422160224.199714-22-clg@redhat.com \
--to=clg@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=avihaih@nvidia.com \
--cc=eric.auger@redhat.com \
--cc=joao.m.martins@oracle.com \
--cc=john.levon@nutanix.com \
--cc=qemu-devel@nongnu.org \
--cc=steven.sistare@oracle.com \
--cc=zhenzhong.duan@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).