DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, maxime.coquelin@redhat.com,
	anatoly.burakov@intel.com, Rosen Xu <rosen.xu@altera.com>,
	Nipun Gupta <nipun.gupta@amd.com>,
	Nikhil Agarwal <nikhil.agarwal@amd.com>,
	Hemant Agrawal <hemant.agrawal@nxp.com>,
	Sachin Saxena <sachin.saxena@nxp.com>,
	Chenbo Xia <chenbox@nvidia.com>,
	Tomasz Duszynski <tduszynski@marvell.com>,
	Ajit Khaparde <ajit.khaparde@broadcom.com>,
	Vikas Gupta <vikas.gupta@broadcom.com>,
	Chaoyong He <chaoyong.he@corigine.com>,
	Vijay Kumar Srivastava <vsrivast@xilinx.com>,
	Tyler Retzlaff <roretzla@linux.microsoft.com>,
	Harman Kalra <hkalra@marvell.com>
Subject: [RFC v2 7/9] vfio: stop including Linux kernel header in public and driver API
Date: Wed,  3 Sep 2025 17:17:57 +0200	[thread overview]
Message-ID: <20250903151800.1965006-8-david.marchand@redhat.com> (raw)
In-Reply-To: <20250903151800.1965006-1-david.marchand@redhat.com>

The DPDK API is not dependent on the VFIO API itself.
Remove inclusion in rte_vfio.h (and bus_fslmc_driver.h) and add explicit
inclusion where needed.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Rosen Xu <rosen.xu@altera.com>
---
 drivers/bus/cdx/cdx_vfio.c                 | 3 +++
 drivers/bus/fslmc/bus_fslmc_driver.h       | 3 ++-
 drivers/bus/fslmc/fslmc_bus.c              | 1 +
 drivers/bus/fslmc/fslmc_vfio.c             | 2 ++
 drivers/bus/fslmc/fslmc_vfio.h             | 1 -
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c   | 1 +
 drivers/bus/pci/linux/pci_vfio.c           | 2 ++
 drivers/bus/platform/platform.c            | 2 ++
 drivers/crypto/bcmfs/bcmfs_vfio.c          | 2 ++
 drivers/raw/ifpga/afu_pmd_n3000.c          | 3 ++-
 drivers/raw/ifpga/base/ifpga_feature_dev.c | 2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c              | 2 ++
 drivers/vdpa/nfp/nfp_vdpa.c                | 2 ++
 drivers/vdpa/sfc/sfc_vdpa_ops.c            | 3 ++-
 lib/eal/include/rte_vfio.h                 | 8 --------
 lib/eal/linux/eal_interrupts.c             | 3 ++-
 lib/eal/linux/eal_vfio.c                   | 1 +
 17 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/drivers/bus/cdx/cdx_vfio.c b/drivers/bus/cdx/cdx_vfio.c
index 03d156388e..576718a659 100644
--- a/drivers/bus/cdx/cdx_vfio.c
+++ b/drivers/bus/cdx/cdx_vfio.c
@@ -17,6 +17,9 @@
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
+
+#include <linux/vfio.h>
+
 #include <eal_export.h>
 #include <rte_eal_paging.h>
 #include <rte_malloc.h>
diff --git a/drivers/bus/fslmc/bus_fslmc_driver.h b/drivers/bus/fslmc/bus_fslmc_driver.h
index 442de1a3fb..74ce7381d7 100644
--- a/drivers/bus/fslmc/bus_fslmc_driver.h
+++ b/drivers/bus/fslmc/bus_fslmc_driver.h
@@ -20,7 +20,6 @@
 #include <sys/queue.h>
 #include <stdint.h>
 #include <inttypes.h>
-#include <linux/vfio.h>
 
 #include <rte_compat.h>
 #include <rte_debug.h>
@@ -37,6 +36,8 @@
 extern "C" {
 #endif
 
+struct vfio_device_info;
+
 #define FSLMC_OBJECT_MAX_LEN 32   /**< Length of each device on bus */
 
 #define DPAA2_INVALID_MBUF_SEQN        0
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 20458d5030..49c61c9d2d 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -17,6 +17,7 @@
 #include <rte_memcpy.h>
 #include <ethdev_driver.h>
 #include <rte_mbuf_dyn.h>
+#include <rte_vfio.h>
 
 #include "private.h"
 #include <fslmc_vfio.h>
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index c08c316c94..3f041f447c 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -20,6 +20,7 @@
 #include <dirent.h>
 #include <sys/eventfd.h>
 #include <ctype.h>
+#include <linux/vfio.h>
 
 #include <eal_export.h>
 #include <eal_filesystem.h>
@@ -32,6 +33,7 @@
 #include <rte_kvargs.h>
 #include <dev_driver.h>
 #include <rte_eal_memconfig.h>
+#include <rte_vfio.h>
 #include <eal_vfio.h>
 
 #include "private.h"
diff --git a/drivers/bus/fslmc/fslmc_vfio.h b/drivers/bus/fslmc/fslmc_vfio.h
index 815970ec38..c995fd67b8 100644
--- a/drivers/bus/fslmc/fslmc_vfio.h
+++ b/drivers/bus/fslmc/fslmc_vfio.h
@@ -9,7 +9,6 @@
 #define _FSLMC_VFIO_H_
 
 #include <rte_compat.h>
-#include <rte_vfio.h>
 
 /* Pathname of FSL-MC devices directory. */
 #define SYSFS_FSL_MC_DEVICES	"/sys/bus/fsl-mc/devices"
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index e32471d8b5..cffbf3c28a 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -22,6 +22,7 @@
 #include <sys/epoll.h>
 #include <sys/eventfd.h>
 #include <sys/syscall.h>
+#include <linux/vfio.h>
 
 #include <eal_export.h>
 #include <rte_mbuf.h>
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index 9e5776ce3c..46b87c7c38 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -11,6 +11,8 @@
 #include <sys/mman.h>
 #include <stdbool.h>
 
+#include <linux/vfio.h>
+
 #include <rte_log.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c
index 90524fd961..149cba81a7 100644
--- a/drivers/bus/platform/platform.c
+++ b/drivers/bus/platform/platform.c
@@ -11,6 +11,8 @@
 #include <sys/queue.h>
 #include <unistd.h>
 
+#include <linux/vfio.h>
+
 #include <bus_driver.h>
 #include <bus_platform_driver.h>
 #include <eal_export.h>
diff --git a/drivers/crypto/bcmfs/bcmfs_vfio.c b/drivers/crypto/bcmfs/bcmfs_vfio.c
index 9138f96eb0..e747bef924 100644
--- a/drivers/crypto/bcmfs/bcmfs_vfio.c
+++ b/drivers/crypto/bcmfs/bcmfs_vfio.c
@@ -7,6 +7,8 @@
 #include <sys/mman.h>
 #include <sys/ioctl.h>
 
+#include <linux/vfio.h>
+
 #include <rte_vfio.h>
 
 #include "bcmfs_device.h"
diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c
index 0882a27701..ec2fdd46df 100644
--- a/drivers/raw/ifpga/afu_pmd_n3000.c
+++ b/drivers/raw/ifpga/afu_pmd_n3000.c
@@ -13,11 +13,12 @@
 #include <sys/eventfd.h>
 #include <sys/ioctl.h>
 
+#include <linux/vfio.h>
+
 #include <rte_eal.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_io.h>
-#include <rte_vfio.h>
 #include <bus_pci_driver.h>
 #include <bus_ifpga_driver.h>
 #include <rte_rawdev.h>
diff --git a/drivers/raw/ifpga/base/ifpga_feature_dev.c b/drivers/raw/ifpga/base/ifpga_feature_dev.c
index 0a00af1b6b..3402ad97e4 100644
--- a/drivers/raw/ifpga/base/ifpga_feature_dev.c
+++ b/drivers/raw/ifpga/base/ifpga_feature_dev.c
@@ -3,7 +3,7 @@
  */
 
 #include <sys/ioctl.h>
-#include <rte_vfio.h>
+#include <linux/vfio.h>
 
 #include "ifpga_feature_dev.h"
 
diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index 65de383b95..c8e47e41c1 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -11,6 +11,8 @@
 #include <linux/virtio_net.h>
 #include <stdbool.h>
 
+#include <linux/vfio.h>
+
 #include <rte_eal_paging.h>
 #include <rte_malloc.h>
 #include <rte_memory.h>
diff --git a/drivers/vdpa/nfp/nfp_vdpa.c b/drivers/vdpa/nfp/nfp_vdpa.c
index 7f2f21ec6c..c1ffbd1f91 100644
--- a/drivers/vdpa/nfp/nfp_vdpa.c
+++ b/drivers/vdpa/nfp/nfp_vdpa.c
@@ -8,6 +8,8 @@
 #include <sys/ioctl.h>
 #include <unistd.h>
 
+#include <linux/vfio.h>
+
 #include <nfp_common_pci.h>
 #include <nfp_dev.h>
 #include <rte_vfio.h>
diff --git a/drivers/vdpa/sfc/sfc_vdpa_ops.c b/drivers/vdpa/sfc/sfc_vdpa_ops.c
index 00f9a4b04c..1ece47d373 100644
--- a/drivers/vdpa/sfc/sfc_vdpa_ops.c
+++ b/drivers/vdpa/sfc/sfc_vdpa_ops.c
@@ -6,10 +6,11 @@
 #include <unistd.h>
 #include <sys/ioctl.h>
 
+#include <linux/vfio.h>
+
 #include <rte_errno.h>
 #include <rte_malloc.h>
 #include <rte_vdpa.h>
-#include <rte_vfio.h>
 #include <rte_vhost.h>
 
 #include <vdpa_driver.h>
diff --git a/lib/eal/include/rte_vfio.h b/lib/eal/include/rte_vfio.h
index 509ffec80c..683affa933 100644
--- a/lib/eal/include/rte_vfio.h
+++ b/lib/eal/include/rte_vfio.h
@@ -19,17 +19,9 @@
 extern "C" {
 #endif
 
-#ifdef RTE_EXEC_ENV_LINUX
-
-#include <linux/vfio.h>
-
-#else /* ! RTE_EXEC_ENV_LINUX */
-
 /* we don't need an actual definition, only pointer is used */
 struct vfio_device_info;
 
-#endif /* RTE_EXEC_ENV_LINUX */
-
 #define RTE_VFIO_DEFAULT_CONTAINER_FD (-1)
 
 /**
diff --git a/lib/eal/linux/eal_interrupts.c b/lib/eal/linux/eal_interrupts.c
index 43e05c86a2..d1789cbda2 100644
--- a/lib/eal/linux/eal_interrupts.c
+++ b/lib/eal/linux/eal_interrupts.c
@@ -15,6 +15,8 @@
 #include <assert.h>
 #include <stdbool.h>
 
+#include <linux/vfio.h>
+
 #include <eal_export.h>
 #include <eal_trace_internal.h>
 #include <rte_common.h>
@@ -28,7 +30,6 @@
 #include <rte_errno.h>
 #include <rte_spinlock.h>
 #include <rte_pause.h>
-#include <rte_vfio.h>
 
 #include "eal_private.h"
 
diff --git a/lib/eal/linux/eal_vfio.c b/lib/eal/linux/eal_vfio.c
index c6aed44946..62f9d05e63 100644
--- a/lib/eal/linux/eal_vfio.c
+++ b/lib/eal/linux/eal_vfio.c
@@ -8,6 +8,7 @@
 #include <unistd.h>
 #include <sys/ioctl.h>
 #include <dirent.h>
+#include <linux/vfio.h>
 
 #include <rte_errno.h>
 #include <rte_log.h>
-- 
2.51.0


  parent reply	other threads:[~2025-09-03 15:19 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-03  7:28 [RFC 0/8] Cleanup VFIO API and import Linux uAPI header David Marchand
2025-09-03  7:28 ` [RFC 1/8] vfio: remove confusing check on VFIO presence David Marchand
2025-09-03  9:38   ` Xu, Rosen
2025-09-03  7:28 ` [RFC 2/8] vfio: assume VFIO is always and only present on Linux David Marchand
2025-09-03  7:28 ` [RFC 3/8] vfio: remove public wrappers David Marchand
2025-09-03  7:28 ` [RFC 4/8] eal/linux: remove more internal VFIO macros David Marchand
2025-09-03  7:28 ` [RFC 5/8] eal/linux: remove internal VFIO wrappers for old Linux David Marchand
2025-09-03  7:28 ` [RFC 6/8] vfio: stop including Linux kernel header in public and driver API David Marchand
2025-09-03  9:38   ` Xu, Rosen
2025-09-03  7:28 ` [RFC 7/8] uapi: import VFIO header David Marchand
2025-09-03  7:28 ` [RFC 8/8] vfio: use imported uAPI header David Marchand
2025-09-03  9:38   ` Xu, Rosen
2025-09-03  7:50 ` [RFC 0/8] Cleanup VFIO API and import Linux " David Marchand
2025-09-03  9:29 ` Burakov, Anatoly
2025-09-03  9:52   ` David Marchand
2025-09-03 14:25     ` Burakov, Anatoly
2025-09-03 15:13 ` [RFC v2 0/9] " David Marchand
2025-09-03 15:13   ` [RFC v2 1/9] drivers: remove unneeded VFIO header inclusion David Marchand
2025-09-03 15:13   ` [RFC v2 2/9] vfio: remove confusing check on VFIO presence David Marchand
2025-09-03 15:13   ` [RFC v2 3/9] vfio: assume VFIO is always and only present on Linux David Marchand
2025-09-03 15:13   ` [RFC v2 4/9] vfio: remove public wrappers David Marchand
2025-09-03 15:13   ` [RFC v2 5/9] eal/linux: remove more internal VFIO macros David Marchand
2025-09-03 15:13   ` [RFC v2 6/9] eal/linux: remove internal VFIO wrappers for old Linux David Marchand
2025-09-03 15:22   ` [RFC v2 0/9] Cleanup VFIO API and import Linux uAPI header David Marchand
2025-09-03 15:17 ` David Marchand
2025-09-03 15:17   ` [RFC v2 1/9] drivers: remove unneeded VFIO header inclusion David Marchand
2025-09-03 15:17   ` [RFC v2 2/9] vfio: remove confusing check on VFIO presence David Marchand
2025-09-03 15:17   ` [RFC v2 3/9] vfio: assume VFIO is always and only present on Linux David Marchand
2025-09-03 15:17   ` [RFC v2 4/9] vfio: remove public wrappers David Marchand
2025-09-03 15:17   ` [RFC v2 5/9] eal/linux: remove more internal VFIO macros David Marchand
2025-09-03 15:17   ` [RFC v2 6/9] eal/linux: remove internal VFIO wrappers for old Linux David Marchand
2025-09-03 15:17   ` David Marchand [this message]
2025-09-03 15:17   ` [RFC v2 8/9] uapi: import VFIO header David Marchand
2025-09-03 15:17   ` [RFC v2 9/9] vfio: use imported uAPI header David Marchand
2025-09-04  7:08   ` [RFC v2 0/9] Cleanup VFIO API and import Linux " David Marchand

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=20250903151800.1965006-8-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=anatoly.burakov@intel.com \
    --cc=chaoyong.he@corigine.com \
    --cc=chenbox@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=hkalra@marvell.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=nikhil.agarwal@amd.com \
    --cc=nipun.gupta@amd.com \
    --cc=roretzla@linux.microsoft.com \
    --cc=rosen.xu@altera.com \
    --cc=sachin.saxena@nxp.com \
    --cc=tduszynski@marvell.com \
    --cc=thomas@monjalon.net \
    --cc=vikas.gupta@broadcom.com \
    --cc=vsrivast@xilinx.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).