VILLASframework / common

Archived: The libvillas-common library has been integrated into the VILLASnode repo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compilation of VILLASfpga fails due to an error in vfio.cpp

stv0g opened this issue · comments

In GitLab by @hatimak on May 20, 2019, 17:47

Compilation on VILLASfpga fails at vfio.cpp, throwing an error,

error: ‘VFIO_NOIOMMU_IOMMU’ was not declared in this scope.

Hi Hatim,

I believe that this macro constant is defined by the kernel headers (linux/vfio.h or something similar).
The NOIOMMU is a special feature which is not always present and has to be enabled by a special option during kernel compilation.

Can you check if the option is enabled in your kernel?

Btw. I would recommend to start testing the software directly on the acs-villas machine (134.130.169.31) because we will run it there later anyway.
No need to compile / run it on the VMs.

Cheers,
Steffen

In GitLab by @hatimak on May 21, 2019, 04:38

Hi Steffen,

Just to be sure, I can check if the option is enabled in my kernel by looking at the config-$(uname -r) file in /boot/, right? But I'm not sure which IOMMU option to look for there. :slight_frown:

Anyway, since I didn't know which options to look for I grep-ed all IOMMU options on the acs-villas machine and the VM, and both are very similar,

# Ubuntu VM, running 4.4.0-143-generic			      |	# acs-villas machine, running kernel 5.0.9-200.fc29.x86_64
CONFIG_GART_IOMMU=y					      <
CONFIG_CALGARY_IOMMU=y					      <
CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT=y		      <
CONFIG_IOMMU_HELPER=y					      <
CONFIG_VFIO_IOMMU_TYPE1=m					CONFIG_VFIO_IOMMU_TYPE1=m
CONFIG_IOMMU_API=y						CONFIG_IOMMU_API=y
CONFIG_IOMMU_SUPPORT=y						CONFIG_IOMMU_SUPPORT=y
CONFIG_IOMMU_IOVA=y						CONFIG_IOMMU_IOVA=y
CONFIG_AMD_IOMMU=y						CONFIG_AMD_IOMMU=y
CONFIG_AMD_IOMMU_STATS=y				      <
CONFIG_AMD_IOMMU_V2=m						CONFIG_AMD_IOMMU_V2=m
CONFIG_INTEL_IOMMU=y						CONFIG_INTEL_IOMMU=y
CONFIG_INTEL_IOMMU_SVM=y					CONFIG_INTEL_IOMMU_SVM=y
CONFIG_INTEL_IOMMU_FLOPPY_WA=y					CONFIG_INTEL_IOMMU_FLOPPY_WA=y

There is an RT kernel on the acs-villas machine that I see, which is not active. :thinking_face:

Best,
Hatim

But I'm not sure which IOMMU option to look for there. :slight_frown:

We are looking for the VFIO_NOIOMMU option

See also:

By the way. The missing constant should be defined here:
https://github.com/torvalds/linux/blob/master/include/uapi/linux/vfio.h#L43

I assume that we are running an incompatible kernel.

In GitLab by @hatimak on May 21, 2019, 23:32

Thank you for the references. So, all the kernels on the acs-villas machine didn't have the option set.

This is from the /boot/config-* files,

# CONFIG_VFIO_NOIOMMU is not set

So, I'm thinking maybe we should compile the kernel with CONFIG_VFIO_NOIOMMU set and boot acs-villas with it? Or maybe you have another idea?

Btw, the LWN post says that the kernel gets tainted if that option is set. But the acs-villas machine’s kernel is already tainted. Wonder why! 🤔

In GitLab by @hatimak on May 26, 2019, 01:45

Summarising the discussion during meeting,

  • ideally, the constants should be defined in the include file, refer post by @stvogel.
  • if this is not the case, a hot fix is to include the following excerpt in vfio.cpp,
#ifndef VFIO_NOIOMMU_IOMMU
    #define VFIO_NOIOMMU_IOMMU 8
#endif

Then compile the files in the usual way.

Note, include file in acs-villas machine has constants defined, but the acs-ubuntu-vm does not. 😕

In GitLab by @hatimak on May 26, 2019, 01:45

closed