vfio: fix build errors on old Linux

Message ID 20190711022235.2958-1-tyos@jp.ibm.com (mailing list archive)
State Accepted, archived
Headers
Series vfio: fix build errors on old Linux |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply issues
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS

Commit Message

Takeshi Yoshimura July 11, 2019, 2:22 a.m. UTC
  The commit db90b4969e2e ("vfio: retry creating sPAPR DMA window")
introduced a build breakage on old Linux. Linux <4.2 does not define ddw in
struct vfio_iommu_spapr_tce_info. Without ddw, we cannot change window size
and so should give up the creation. I just exculuded the retrying code if
ddw is not supported.

Fixes: db90b4969e2e ("vfio: retry creating sPAPR DMA window")

Signed-off-by: Takeshi Yoshimura <tyos@jp.ibm.com>
---
 lib/librte_eal/linux/eal/eal_vfio.c | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Burakov, Anatoly July 11, 2019, 9:17 a.m. UTC | #1
On 11-Jul-19 3:22 AM, Takeshi Yoshimura wrote:
> The commit db90b4969e2e ("vfio: retry creating sPAPR DMA window")
> introduced a build breakage on old Linux. Linux <4.2 does not define ddw in
> struct vfio_iommu_spapr_tce_info. Without ddw, we cannot change window size
> and so should give up the creation. I just exculuded the retrying code if
> ddw is not supported.
> 
> Fixes: db90b4969e2e ("vfio: retry creating sPAPR DMA window")
> 
> Signed-off-by: Takeshi Yoshimura <tyos@jp.ibm.com>
> ---

Tested-by: Anatoly Burakov <anatoly.burakov@intel.com>
  
Thomas Monjalon July 11, 2019, 9:29 a.m. UTC | #2
11/07/2019 11:17, Burakov, Anatoly:
> On 11-Jul-19 3:22 AM, Takeshi Yoshimura wrote:
> > The commit db90b4969e2e ("vfio: retry creating sPAPR DMA window")
> > introduced a build breakage on old Linux. Linux <4.2 does not define ddw in
> > struct vfio_iommu_spapr_tce_info. Without ddw, we cannot change window size
> > and so should give up the creation. I just exculuded the retrying code if
> > ddw is not supported.
> > 
> > Fixes: db90b4969e2e ("vfio: retry creating sPAPR DMA window")
> > 
> > Signed-off-by: Takeshi Yoshimura <tyos@jp.ibm.com>
> 
> Tested-by: Anatoly Burakov <anatoly.burakov@intel.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_eal/linux/eal/eal_vfio.c b/lib/librte_eal/linux/eal/eal_vfio.c
index 7053ebe7d..fadef427f 100644
--- a/lib/librte_eal/linux/eal/eal_vfio.c
+++ b/lib/librte_eal/linux/eal/eal_vfio.c
@@ -1445,6 +1445,7 @@  vfio_spapr_create_new_dma_window(int vfio_container_fd,
 	/* create new DMA window */
 	ret = ioctl(vfio_container_fd, VFIO_IOMMU_SPAPR_TCE_CREATE, create);
 	if (ret) {
+#ifdef VFIO_IOMMU_SPAPR_INFO_DDW
 		/* try possible page_shift and levels for workaround */
 		uint32_t levels;
 
@@ -1463,6 +1464,7 @@  vfio_spapr_create_new_dma_window(int vfio_container_fd,
 			if (!ret)
 				break;
 		}
+#endif
 		if (ret) {
 			RTE_LOG(ERR, EAL, "  cannot create new DMA window, "
 					"error %i (%s)\n", errno, strerror(errno));