Skip to contentSkip to conversation

vfio: fix build errors on old Linux

PATCH Applied Takeshi Yoshimura 3 participants 3 messages Jul 11, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfio: fix build errors on old Linux

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")
---
 lib/librte_eal/linux/eal/eal_vfio.c | 2 ++
 1 file changed, 2 insertions(+)
lib/librte_eal/linux/eal/eal_vfio.c +2 -0
index 7053ebe7d..fadef427f 100644
@@ -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));
Signature · 1 line
2.17.2 (Apple Git-113)
Tested-by on v1 1/1
#1 lore raw
Quoted 10 lines · Takeshi Yoshimura

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")

---

Signature · 2 lines
Thanks,
Anatoly
#2 lore raw

11/07/2019 11:17, Burakov, Anatoly:

Quoted 7 lines · Takeshi Yoshimura
Quoted 6 lines

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.

Quoted 5 lines
Quoted 3 lines
Fixes db90b4969e2e ("vfio: retry creating sPAPR DMA window")

Applied, thanks