06/11/2020 23:16, David Christensen: > On 11/4/20 11:12 PM, Thomas Monjalon wrote: > > 04/11/2020 23:25, David Christensen: > >> On 11/4/20 1:02 PM, Thomas Monjalon wrote: > >>> 04/11/2020 22:00, David Christensen: > >>>> On 11/4/20 11:43 AM, Thomas Monjalon wrote: > >>>>>> Signed-off-by: David Christensen <d...@linux.vnet.ibm.com> > >>>>>> Acked-by: Anatoly Burakov <anatoly.bura...@intel.com> > >>>>>> --- > >>>>>> -#ifdef VFIO_IOMMU_SPAPR_INFO_DDW > >>>>>> - /* try possible page_shift and levels for workaround */ > >>>>>> + /* if at first we don't succeed, try more levels */ > >>>>>> uint32_t levels; > >>>>>> > >>>>>> - for (levels = create->levels + 1; > >>>>>> + for (levels = create.levels + 1; > >>>>>> ret && levels <= info.ddw.levels; levels++) { > >>>>> > >>>>> There is a compilation failure with ppc64le-power8-linux-gcc: > >>>>> error: ‘struct vfio_iommu_spapr_tce_info’ has no member named ‘ddw’ > >>>> > >>>> How did you find that error? It builds locally for me on a POWER system > >>>> with Meson/gcc and there were no build failures on Travis > >>>> (https://travis-ci.com/github/drchristensen/dpdk/builds/198047029) when > >>>> I checked it against AMD64/ARM systems. The code is PPC specific but it > >>>> will build on all architectures (there are no IFDEFs around it). > >>> > >>> Remember, I cross-build with test-meson-builds.sh > >>> Is it an issue of my toolchain? > >> > >> What distro/gcc version are you using? I'll try it locally on an x86. > > > > I am using powerpc64le-power8--glibc--stable-2018.11-1 from > > https://toolchains.bootlin.com/releases_powerpc64le-power8.html > > Here's what I found: > > - Builds correctly on a RHEL 8.2 POWER9 host with gcc (GCC) 8.3.1 > 20191121 (Red Hat 8.3.1-5) and kernel 4.18.0 > - Builds correctly on an Ubuntu 18.04.5 POWER9 host with gcc (Ubuntu > 7.5.0-3ubuntu1~18.04) 7.5.0 and kernel 4.15.0. > - Build fails on an Ubuntu 18.04.5 AMD64 host with your POWER8 toolchain > and the devtools/test-meson-builds.sh script. > > It appears that the VFIO header file in your toolchain: > > powerpc64le-buildroot-linux-gnu/sysroot/usr/include/linux/vfio.h > > is from the 4.1.49 kernel, but the sPAPR v2 IOMMU support wasn't added > until the 4.2.0 kernel (https://lkml.org/lkml/2015/4/25/56). The update > added the ddw member to the vfio_iommu_spapr_tce_info structure. I'll > submit a new patch which skips testing additional levels unless kernel > 4.2.0 or later is used.
Instead of testing kernel version, which is fragile with backports, can you test the presence of the feature itself? If no macro (usable with #ifdef) is defined with the feature, checking the kernel version is acceptable.