On 07-Jun-19 3:28 AM, Takeshi Yoshimura wrote:
sPAPR allows only page_shift from VFIO_IOMMU_SPAPR_TCE_GET_INFO ioctl.
However, Linux 4.17 or before returns incorrect page_shift for Power9.
I added the code for retrying creation of sPAPR DMA window.
Signed-off-by: Takeshi Yoshimura <t...@jp.ibm.com>
---
lib/librte_eal/linux/eal/eal_vfio.c | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/lib/librte_eal/linux/eal/eal_vfio.c
b/lib/librte_eal/linux/eal/eal_vfio.c
index 6892a2c14..f16c5c3c0 100644
--- a/lib/librte_eal/linux/eal/eal_vfio.c
+++ b/lib/librte_eal/linux/eal/eal_vfio.c
@@ -1448,9 +1448,29 @@ 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) {
- RTE_LOG(ERR, EAL, " cannot create new DMA window, "
- "error %i (%s)\n", errno, strerror(errno));
- return -1;
+ /* try possible page_shift and levels for workaround */
+ uint32_t levels;
+
+ for (levels = 1; levels <= info.ddw.levels; levels++) {
+ uint32_t pgsizes = info.ddw.pgsizes;
+CC POWER maintainer from MAINTAINERS file.
This is failing compilation on some older distros (Fedora 20, Ubuntu 14.04):
/root/dpdk/lib/librte_eal/linux/eal/eal_vfio.c: In function
‘vfio_spapr_create_new_dma_window’:
/root/dpdk/lib/librte_eal/linux/eal/eal_vfio.c:1451:34: error: ‘struct
vfio_iommu_spapr_tce_info’ has no member named ‘ddw’
for (levels = 1; levels <= info.ddw.levels; levels++) {
^
/root/dpdk/lib/librte_eal/linux/eal/eal_vfio.c:1452:27: error: ‘struct
vfio_iommu_spapr_tce_info’ has no member named ‘ddw’
uint32_t pgsizes = info.ddw.pgsizes;
^
/root/dpdk/lib/librte_eal/linux/eal/eal_vfio.c: At top level:
cc1: error: unrecognized command line option
"-Wno-address-of-packed-member" [-Werror]
cc1: all warnings being treated as errors
make[7]: *** [eal_vfio.o] Error 1
make[7]: *** Waiting for unfinished jobs....
make[6]: *** [eal] Error 2
make[5]: *** [linux] Error 2
make[4]: *** [librte_eal] Error 2
make[3]: *** [lib] Error 2
make[2]: *** [all] Error 2
make[1]: *** [pre_install] Error 2
make: *** [install] Error 2
Looking at the eal_vfio.h we are handling case of missing sPAPR info/ddw
structures, but this isn't simply a case of a missing struct; rather it
is an issue of differing definitions between what recent kernels have,
and what older kernels had.
@Thomas Do we still support these older distros?
--
Thanks,
Anatoly