1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

kernel/vfio: check if all required kernel modules are loaded

This commit is contained in:
Daniel Krebs 2018-03-26 14:59:05 +02:00
parent e28345b992
commit ce7e6b36d5

View file

@ -72,10 +72,17 @@ namespace villas {
VfioContainer::VfioContainer()
: iova_next(0)
{
/* Load VFIO kernel module */
if (kernel_module_load("vfio") != 0) {
logger->error("Failed to load kernel module: vfio");
throw std::exception();
static constexpr const char* requiredKernelModules[] = {
"vfio", "vfio_pci", "vfio_iommu_type1"
};
for(const char* module : requiredKernelModules) {
if(kernel_module_loaded(module) != 0) {
logger->error("Kernel module '{}' required but not loaded. "
"Please load manually!", module);
throw std::exception();
}
}
/* Open VFIO API */