[RFC v2 6/9] eal/linux: remove internal VFIO wrappers for old Linux
David Marchand
david.marchand at redhat.com
Wed Sep 3 17:13:23 CEST 2025
DPDK now requires Linux v5.4 at least.
VFIO_SPAPR_TCE_IOMMU is present in Linux since v3.11.
VFIO_SPAPR_TCE_v2_IOMMU is present in Linux since v4.2.
Remove wrappers accordingly.
Signed-off-by: David Marchand <david.marchand at redhat.com>
---
drivers/bus/fslmc/fslmc_vfio.c | 2 +-
lib/eal/linux/eal_vfio.c | 4 +--
lib/eal/linux/eal_vfio.h | 60 ----------------------------------
3 files changed, 3 insertions(+), 63 deletions(-)
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index cc4311989b..c08c316c94 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -449,7 +449,7 @@ fslmc_vfio_check_extensions(int vfio_container_fd)
{
int ret;
uint32_t idx, n_extensions = 0;
- static const int type_id[] = {RTE_VFIO_TYPE1, RTE_VFIO_SPAPR,
+ static const int type_id[] = {VFIO_TYPE1_IOMMU, VFIO_SPAPR_TCE_v2_IOMMU,
VFIO_NOIOMMU_IOMMU};
static const char * const type_id_nm[] = {"Type 1",
"sPAPR", "No-IOMMU"};
diff --git a/lib/eal/linux/eal_vfio.c b/lib/eal/linux/eal_vfio.c
index 1eab90a261..c6aed44946 100644
--- a/lib/eal/linux/eal_vfio.c
+++ b/lib/eal/linux/eal_vfio.c
@@ -69,7 +69,7 @@ static int vfio_dma_mem_map(struct vfio_config *vfio_cfg, uint64_t vaddr,
static const struct vfio_iommu_type iommu_types[] = {
/* x86 IOMMU, otherwise known as type 1 */
{
- .type_id = RTE_VFIO_TYPE1,
+ .type_id = VFIO_TYPE1_IOMMU,
.name = "Type 1",
.partial_unmap = false,
.dma_map_func = &vfio_type1_dma_map,
@@ -77,7 +77,7 @@ static const struct vfio_iommu_type iommu_types[] = {
},
/* ppc64 IOMMU, otherwise known as spapr */
{
- .type_id = RTE_VFIO_SPAPR,
+ .type_id = VFIO_SPAPR_TCE_v2_IOMMU,
.name = "sPAPR",
.partial_unmap = true,
.dma_map_func = &vfio_spapr_dma_map,
diff --git a/lib/eal/linux/eal_vfio.h b/lib/eal/linux/eal_vfio.h
index 413c8f18df..5c5742b429 100644
--- a/lib/eal/linux/eal_vfio.h
+++ b/lib/eal/linux/eal_vfio.h
@@ -8,66 +8,6 @@
#include <rte_common.h>
#include <stdint.h>
-#include <linux/vfio.h>
-
-#define RTE_VFIO_TYPE1 VFIO_TYPE1_IOMMU
-
-#ifndef VFIO_SPAPR_TCE_v2_IOMMU
-#define RTE_VFIO_SPAPR 7
-#define VFIO_IOMMU_SPAPR_REGISTER_MEMORY _IO(VFIO_TYPE, VFIO_BASE + 17)
-#define VFIO_IOMMU_SPAPR_UNREGISTER_MEMORY _IO(VFIO_TYPE, VFIO_BASE + 18)
-#define VFIO_IOMMU_SPAPR_TCE_CREATE _IO(VFIO_TYPE, VFIO_BASE + 19)
-#define VFIO_IOMMU_SPAPR_TCE_REMOVE _IO(VFIO_TYPE, VFIO_BASE + 20)
-
-struct vfio_iommu_spapr_register_memory {
- uint32_t argsz;
- uint32_t flags;
- uint64_t vaddr;
- uint64_t size;
-};
-
-struct vfio_iommu_spapr_tce_create {
- uint32_t argsz;
- uint32_t flags;
- /* in */
- uint32_t page_shift;
- uint32_t __resv1;
- uint64_t window_size;
- uint32_t levels;
- uint32_t __resv2;
- /* out */
- uint64_t start_addr;
-};
-
-struct vfio_iommu_spapr_tce_remove {
- uint32_t argsz;
- uint32_t flags;
- /* in */
- uint64_t start_addr;
-};
-
-struct vfio_iommu_spapr_tce_ddw_info {
- uint64_t pgsizes;
- uint32_t max_dynamic_windows_supported;
- uint32_t levels;
-};
-
-/* SPAPR_v2 is not present, but SPAPR might be */
-#ifndef VFIO_SPAPR_TCE_IOMMU
-#define VFIO_IOMMU_SPAPR_TCE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
-
-struct vfio_iommu_spapr_tce_info {
- uint32_t argsz;
- uint32_t flags;
- uint32_t dma32_window_start;
- uint32_t dma32_window_size;
- struct vfio_iommu_spapr_tce_ddw_info ddw;
-};
-#endif /* VFIO_SPAPR_TCE_IOMMU */
-
-#else /* VFIO_SPAPR_TCE_v2_IOMMU */
-#define RTE_VFIO_SPAPR VFIO_SPAPR_TCE_v2_IOMMU
-#endif
/*
* we don't need to store device fd's anywhere since they can be obtained from
--
2.51.0
More information about the dev
mailing list