[v3,1/4] vfio: drop fallback Linux implementation

Message ID b2382197250fe4a359a7eb2e7e4c1d12cd959500.1635430513.git.anatoly.burakov@intel.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series [v3,1/4] vfio: drop fallback Linux implementation |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Anatoly Burakov Oct. 28, 2021, 2:15 p.m. UTC
  Currently, VFIO support for Linux is compiled unconditionally, and
supported kernel versions start with 4.4, so VFIO is assumed to always
be enabled. There is no way of disabling VFIO support at compile time
anyway, so just drop the "VFIO not available" fallback code altogether.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/eal/linux/eal_vfio.c | 110 ---------------------------------------
 1 file changed, 110 deletions(-)
  

Comments

Chenbo Xia Nov. 1, 2021, 6:27 a.m. UTC | #1
Hi Anatoly,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Anatoly Burakov
> Sent: Thursday, October 28, 2021 10:15 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v3 1/4] vfio: drop fallback Linux implementation
> 
> Currently, VFIO support for Linux is compiled unconditionally, and
> supported kernel versions start with 4.4, so VFIO is assumed to always
> be enabled. There is no way of disabling VFIO support at compile time
> anyway, so just drop the "VFIO not available" fallback code altogether.
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
>  lib/eal/linux/eal_vfio.c | 110 ---------------------------------------
>  1 file changed, 110 deletions(-)
> 

If we make the 'kernel >= 4.4' assumption, should other 'VFIO_PRESENT' in eal
and drivers be deleted as well? It seems strange to me as eal_vfio already
assumes it supports vfio but drivers and other eal components still have the
check.

Thanks,
Chenbo
  
Anatoly Burakov Nov. 1, 2021, 1:57 p.m. UTC | #2
On 01-Nov-21 6:27 AM, Xia, Chenbo wrote:
> Hi Anatoly,
> 
>> -----Original Message-----
>> From: dev <dev-bounces@dpdk.org> On Behalf Of Anatoly Burakov
>> Sent: Thursday, October 28, 2021 10:15 PM
>> To: dev@dpdk.org
>> Subject: [dpdk-dev] [PATCH v3 1/4] vfio: drop fallback Linux implementation
>>
>> Currently, VFIO support for Linux is compiled unconditionally, and
>> supported kernel versions start with 4.4, so VFIO is assumed to always
>> be enabled. There is no way of disabling VFIO support at compile time
>> anyway, so just drop the "VFIO not available" fallback code altogether.
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
>> ---
>>   lib/eal/linux/eal_vfio.c | 110 ---------------------------------------
>>   1 file changed, 110 deletions(-)
>>
> 
> If we make the 'kernel >= 4.4' assumption, should other 'VFIO_PRESENT' in eal
> and drivers be deleted as well? It seems strange to me as eal_vfio already
> assumes it supports vfio but drivers and other eal components still have the
> check.

We still need those checks because those drivers are also compiled on 
FreeBSD etc. - so we're not removing the VFIO check, we're just removing 
the fallback implementation for Linux that was, at one point, possible, 
but now isn't.

> 
> Thanks,
> Chenbo
>
  
Chenbo Xia Nov. 5, 2021, 2:48 a.m. UTC | #3
> -----Original Message-----
> From: Burakov, Anatoly <anatoly.burakov@intel.com>
> Sent: Monday, November 1, 2021 9:57 PM
> To: Xia, Chenbo <chenbo.xia@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v3 1/4] vfio: drop fallback Linux
> implementation
> 
> On 01-Nov-21 6:27 AM, Xia, Chenbo wrote:
> > Hi Anatoly,
> >
> >> -----Original Message-----
> >> From: dev <dev-bounces@dpdk.org> On Behalf Of Anatoly Burakov
> >> Sent: Thursday, October 28, 2021 10:15 PM
> >> To: dev@dpdk.org
> >> Subject: [dpdk-dev] [PATCH v3 1/4] vfio: drop fallback Linux implementation
> >>
> >> Currently, VFIO support for Linux is compiled unconditionally, and
> >> supported kernel versions start with 4.4, so VFIO is assumed to always
> >> be enabled. There is no way of disabling VFIO support at compile time
> >> anyway, so just drop the "VFIO not available" fallback code altogether.
> >>
> >> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> >> ---
> >>   lib/eal/linux/eal_vfio.c | 110 ---------------------------------------
> >>   1 file changed, 110 deletions(-)
> >>
> >
> > If we make the 'kernel >= 4.4' assumption, should other 'VFIO_PRESENT' in
> eal
> > and drivers be deleted as well? It seems strange to me as eal_vfio already
> > assumes it supports vfio but drivers and other eal components still have the
> > check.
> 
> We still need those checks because those drivers are also compiled on
> FreeBSD etc. - so we're not removing the VFIO check, we're just removing
> the fallback implementation for Linux that was, at one point, possible,
> but now isn't.

Make sense to me.

Acked-by: Chenbo Xia <chenbo.xia@intel.com>

> 
> >
> > Thanks,
> > Chenbo
> >
> 
> 
> --
> Thanks,
> Anatoly
  

Patch

diff --git a/lib/eal/linux/eal_vfio.c b/lib/eal/linux/eal_vfio.c
index aa2087a2da..549b86ae1d 100644
--- a/lib/eal/linux/eal_vfio.c
+++ b/lib/eal/linux/eal_vfio.c
@@ -20,8 +20,6 @@ 
 #include "eal_private.h"
 #include "eal_internal_cfg.h"
 
-#ifdef VFIO_PRESENT
-
 #define VFIO_MEM_EVENT_CLB_NAME "vfio_mem_event_clb"
 
 /* hot plug/unplug of VFIO groups may cause all DMA maps to be dropped. we can
@@ -2201,111 +2199,3 @@  rte_vfio_container_dma_unmap(int container_fd, uint64_t vaddr, uint64_t iova,
 
 	return container_dma_unmap(vfio_cfg, vaddr, iova, len);
 }
-
-#else
-
-int
-rte_vfio_setup_device(__rte_unused const char *sysfs_base,
-		__rte_unused const char *dev_addr,
-		__rte_unused int *vfio_dev_fd,
-		__rte_unused struct vfio_device_info *device_info)
-{
-	return -1;
-}
-
-int
-rte_vfio_release_device(__rte_unused const char *sysfs_base,
-		__rte_unused const char *dev_addr, __rte_unused int fd)
-{
-	return -1;
-}
-
-int
-rte_vfio_enable(__rte_unused const char *modname)
-{
-	return -1;
-}
-
-int
-rte_vfio_is_enabled(__rte_unused const char *modname)
-{
-	return -1;
-}
-
-int
-rte_vfio_noiommu_is_enabled(void)
-{
-	return -1;
-}
-
-int
-rte_vfio_clear_group(__rte_unused int vfio_group_fd)
-{
-	return -1;
-}
-
-int
-rte_vfio_get_group_num(__rte_unused const char *sysfs_base,
-		__rte_unused const char *dev_addr,
-		__rte_unused int *iommu_group_num)
-{
-	return -1;
-}
-
-int
-rte_vfio_get_container_fd(void)
-{
-	return -1;
-}
-
-int
-rte_vfio_get_group_fd(__rte_unused int iommu_group_num)
-{
-	return -1;
-}
-
-int
-rte_vfio_container_create(void)
-{
-	return -1;
-}
-
-int
-rte_vfio_container_destroy(__rte_unused int container_fd)
-{
-	return -1;
-}
-
-int
-rte_vfio_container_group_bind(__rte_unused int container_fd,
-		__rte_unused int iommu_group_num)
-{
-	return -1;
-}
-
-int
-rte_vfio_container_group_unbind(__rte_unused int container_fd,
-		__rte_unused int iommu_group_num)
-{
-	return -1;
-}
-
-int
-rte_vfio_container_dma_map(__rte_unused int container_fd,
-		__rte_unused uint64_t vaddr,
-		__rte_unused uint64_t iova,
-		__rte_unused uint64_t len)
-{
-	return -1;
-}
-
-int
-rte_vfio_container_dma_unmap(__rte_unused int container_fd,
-		__rte_unused uint64_t vaddr,
-		__rte_unused uint64_t iova,
-		__rte_unused uint64_t len)
-{
-	return -1;
-}
-
-#endif /* VFIO_PRESENT */