qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
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>,
	"Yi Liu" <yi.l.liu@intel.com>
Subject: [PATCH v3 10/37] vfio: Introduce a new header file for VFIOIOMMUFD declarations
Date: Tue, 22 Apr 2025 18:01:57 +0200	[thread overview]
Message-ID: <20250422160224.199714-11-clg@redhat.com> (raw)
In-Reply-To: <20250422160224.199714-1-clg@redhat.com>

Gather all VFIOIOMMUFD related declarations introduced by commits
5ee3dc7af785 ("vfio/iommufd: Implement the iommufd backend") and
5b1e96e65403 ("vfio/iommufd: Introduce auto domain creation") into
"vfio-iommufd.h". This to reduce exposure of VFIO internals in
"hw/vfio/vfio-common.h".

Cc: Joao Martins <joao.m.martins@oracle.com>
Cc: Yi Liu <yi.l.liu@intel.com>
Reviewed-by: John Levon <john.levon@nutanix.com>
Link: https://lore.kernel.org/qemu-devel/20250318095415.670319-10-clg@redhat.com
Reviewed-by: Joao Martins <joao.m.martins@oracle.com>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Link: https://lore.kernel.org/qemu-devel/20250326075122.1299361-11-clg@redhat.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
 hw/vfio/vfio-iommufd.h        | 34 ++++++++++++++++++++++++++++++++++
 include/hw/vfio/vfio-common.h | 21 +++------------------
 hw/vfio/iommufd.c             |  1 +
 3 files changed, 38 insertions(+), 18 deletions(-)
 create mode 100644 hw/vfio/vfio-iommufd.h

diff --git a/hw/vfio/vfio-iommufd.h b/hw/vfio/vfio-iommufd.h
new file mode 100644
index 0000000000000000000000000000000000000000..07ea0f43049645a5f3782048117fd9bf22083053
--- /dev/null
+++ b/hw/vfio/vfio-iommufd.h
@@ -0,0 +1,34 @@
+/*
+ * VFIO iommufd
+ *
+ * Copyright Red Hat, Inc. 2025
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef HW_VFIO_VFIO_IOMMUFD_H
+#define HW_VFIO_VFIO_IOMMUFD_H
+
+#include "hw/vfio/vfio-container-base.h"
+
+typedef struct VFIODevice VFIODevice;
+
+typedef struct VFIOIOASHwpt {
+    uint32_t hwpt_id;
+    uint32_t hwpt_flags;
+    QLIST_HEAD(, VFIODevice) device_list;
+    QLIST_ENTRY(VFIOIOASHwpt) next;
+} VFIOIOASHwpt;
+
+typedef struct IOMMUFDBackend IOMMUFDBackend;
+
+typedef struct VFIOIOMMUFDContainer {
+    VFIOContainerBase bcontainer;
+    IOMMUFDBackend *be;
+    uint32_t ioas_id;
+    QLIST_HEAD(, VFIOIOASHwpt) hwpt_list;
+} VFIOIOMMUFDContainer;
+
+OBJECT_DECLARE_SIMPLE_TYPE(VFIOIOMMUFDContainer, VFIO_IOMMU_IOMMUFD);
+
+#endif /* HW_VFIO_VFIO_IOMMUFD_H */
diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
index 3355c2d4e57569d7bb01b4d9378fb49a807335e8..8d48f5300a791d8858fe29d1bb905f814ef11990 100644
--- a/include/hw/vfio/vfio-common.h
+++ b/include/hw/vfio/vfio-common.h
@@ -69,27 +69,12 @@ typedef struct VFIOContainer {
 
 OBJECT_DECLARE_SIMPLE_TYPE(VFIOContainer, VFIO_IOMMU_LEGACY);
 
-typedef struct IOMMUFDBackend IOMMUFDBackend;
-
-typedef struct VFIOIOASHwpt {
-    uint32_t hwpt_id;
-    uint32_t hwpt_flags;
-    QLIST_HEAD(, VFIODevice) device_list;
-    QLIST_ENTRY(VFIOIOASHwpt) next;
-} VFIOIOASHwpt;
-
-typedef struct VFIOIOMMUFDContainer {
-    VFIOContainerBase bcontainer;
-    IOMMUFDBackend *be;
-    uint32_t ioas_id;
-    QLIST_HEAD(, VFIOIOASHwpt) hwpt_list;
-} VFIOIOMMUFDContainer;
-
-OBJECT_DECLARE_SIMPLE_TYPE(VFIOIOMMUFDContainer, VFIO_IOMMU_IOMMUFD);
-
 typedef struct VFIODeviceOps VFIODeviceOps;
 typedef struct VFIOMigration VFIOMigration;
 
+typedef struct IOMMUFDBackend IOMMUFDBackend;
+typedef struct VFIOIOASHwpt VFIOIOASHwpt;
+
 typedef struct VFIODevice {
     QLIST_ENTRY(VFIODevice) next;
     QLIST_ENTRY(VFIODevice) container_next;
diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c
index 42c8412bbf50724dddb43f9b19a3aa40c8bc311d..7196c4080125674ec58b1ebf02dad84b4387c355 100644
--- a/hw/vfio/iommufd.c
+++ b/hw/vfio/iommufd.c
@@ -25,6 +25,7 @@
 #include "qemu/cutils.h"
 #include "qemu/chardev_open.h"
 #include "pci.h"
+#include "vfio-iommufd.h"
 
 static int iommufd_cdev_map(const VFIOContainerBase *bcontainer, hwaddr iova,
                             ram_addr_t size, void *vaddr, bool readonly)
-- 
2.49.0



  parent reply	other threads:[~2025-04-22 16:13 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 ` Cédric Le Goater [this message]
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 ` [PATCH v3 21/37] vfio: Introduce new files for CPR definitions and declarations Cédric Le Goater
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-11-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=yi.l.liu@intel.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).