From: David Marchand <david.marchand@redhat.com>
To: "Burakov, Anatoly" <anatoly.burakov@intel.com>
Cc: dev@dpdk.org, thomas@monjalon.net, maxime.coquelin@redhat.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>,
Tyler Retzlaff <roretzla@linux.microsoft.com>,
Harman Kalra <hkalra@marvell.com>
Subject: Re: [RFC v2 4/9] vfio: remove public wrappers
Date: Thu, 18 Sep 2025 10:38:00 +0200 [thread overview]
Message-ID: <CAJFAV8wRLT=YyDOQKN4cUhbQXhxHoBVUBUfLmMGPabzg3vwffA@mail.gmail.com> (raw)
In-Reply-To: <688448ee-3dcd-4bcb-a16c-0446e3936cf1@intel.com>
Hello Anatoly,
On Tue, 9 Sept 2025 at 17:38, Burakov, Anatoly
<anatoly.burakov@intel.com> wrote:
>
> On 9/3/2025 5:17 PM, David Marchand wrote:
> > The public header defines a number of wrappers that can be removed or
> > hidden internally.
> >
> > Either, those concern old Linux kernel versions that are not supported by
> > dpdk anymore (DPDK now requires Linux v5.4 at least), like:
> > - the request notifier feature, present since Linux v4.0,
> > - the noiommu mode, present since Linux v4.5,
> > - the capability support, present since Linux v4.6,
> > - the msix mapping feature, present since Linux v4.16,
> >
> > Or, those wrappers can be made private as only consumed internally.
> > - VFIO_GET_REGION_IDX() has no equivalent in the Linux uapi, but
> > is only used by the Linux PCI bus code,
> > - VFIO_DEVICE_FEATURE is only used by the CDX bus code,
> > - the various macros around /dev/vfio/ or the noiommu kmod parameter are
> > only used by eal_vfio.c,
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
>
> <snip>
>
> > {
> > - .type_id = RTE_VFIO_NOIOMMU,
> > + .type_id = VFIO_NOIOMMU_IOMMU,
> > .name = "No-IOMMU",
> > .partial_unmap = true,
> > .dma_map_func = &vfio_noiommu_dma_map,
> > @@ -363,8 +363,7 @@ vfio_open_group_fd(int iommu_group_num)
> > /* if primary, try to open the group */
> > if (internal_conf->process_type == RTE_PROC_PRIMARY) {
> > /* try regular group format */
> > - snprintf(filename, sizeof(filename),
> > - VFIO_GROUP_FMT, iommu_group_num);
> > + snprintf(filename, sizeof(filename), "/dev/vfio/%u", iommu_group_num);
> > vfio_group_fd = open(filename, O_RDWR);
> > if (vfio_group_fd < 0) {
> > /* if file not found, it's not an error */
> > @@ -375,9 +374,8 @@ vfio_open_group_fd(int iommu_group_num)
> > }
> >
> > /* special case: try no-IOMMU path as well */
> > - snprintf(filename, sizeof(filename),
> > - VFIO_NOIOMMU_GROUP_FMT,
> > - iommu_group_num);
> > + snprintf(filename, sizeof(filename), "/dev/vfio/noiommu-%u",
> > + iommu_group_num);
> > vfio_group_fd = open(filename, O_RDWR);
> > if (vfio_group_fd < 0) {
> > if (errno != ENOENT) {
> > @@ -1128,7 +1126,7 @@ rte_vfio_enable(const char *modname)
> > }
> >
> > /* VFIO directory might not exist (e.g., unprivileged containers) */
> > - dir = opendir(VFIO_DIR);
> > + dir = opendir("/dev/vfio");
>
> This and similar places: I would rather prefer if we used defines rather
> than repeating the same literals over and over in multiple places.
VFIO_DIR is a bad example, since it is only used here.
Code using such macros never changes.
>
> Other than that,
>
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
But ok, we can keep those macros.
They'll need to be prefixed, polluting the VFIO_ namespace is dangerous.
--
David Marchand
next prev parent reply other threads:[~2025-09-18 8:38 UTC|newest]
Thread overview: 43+ 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-09 14:05 ` Burakov, Anatoly
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-09 15:17 ` Burakov, Anatoly
2025-09-03 15:17 ` [RFC v2 4/9] vfio: remove public wrappers David Marchand
2025-09-09 15:37 ` Burakov, Anatoly
2025-09-18 8:38 ` David Marchand [this message]
2025-09-03 15:17 ` [RFC v2 5/9] eal/linux: remove more internal VFIO macros David Marchand
2025-09-10 12:15 ` Burakov, Anatoly
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 ` [RFC v2 7/9] vfio: stop including Linux kernel header in public and driver API David Marchand
2025-09-17 14:34 ` Burakov, Anatoly
2025-09-03 15:17 ` [RFC v2 8/9] uapi: import VFIO header David Marchand
2025-09-06 4:11 ` Stephen Hemminger
2025-09-18 8:48 ` Thomas Monjalon
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='CAJFAV8wRLT=YyDOQKN4cUhbQXhxHoBVUBUfLmMGPabzg3vwffA@mail.gmail.com' \
--to=david.marchand@redhat.com \
--cc=anatoly.burakov@intel.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=sachin.saxena@nxp.com \
--cc=thomas@monjalon.net \
/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).