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

card: don't try to create a VFIO mapping if IOMMU is disabled

In this case, VFIO cannot create DMA mappings.
This commit is contained in:
Daniel Krebs 2018-05-15 17:52:03 +02:00
parent f644a9faa8
commit f823dde0f4

View file

@ -165,6 +165,11 @@ PCIeCard::lookupIp(const Vlnv& vlnv) const
bool
PCIeCard::mapMemoryBlock(const MemoryBlock& block)
{
if(not vfioContainer->isIommuEnabled()) {
logger->warn("VFIO mapping not supported without IOMMU");
return false;
}
auto& mm = MemoryManager::get();
const auto& addrSpaceId = block.getAddrSpaceId();
@ -175,7 +180,6 @@ PCIeCard::mapMemoryBlock(const MemoryBlock& block)
logger->debug("Create VFIO mapping for {}", addrSpaceId);
}
auto translationFromProcess = mm.getTranslationFromProcess(addrSpaceId);
uintptr_t processBaseAddr = translationFromProcess.getLocalAddr(0);
uintptr_t iovaAddr = vfioContainer->memoryMap(processBaseAddr,
@ -188,10 +192,8 @@ PCIeCard::mapMemoryBlock(const MemoryBlock& block)
return false;
}
mm.createMapping(iovaAddr, 0, block.getSize(),
"vfio",
"VFIO-D2H",
this->addrSpaceIdDeviceToHost,
addrSpaceId);