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: call stop on all ips when destructor is called

Signed-off-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
This commit is contained in:
Niklas Eiling 2024-02-10 16:20:31 +01:00 committed by Niklas Eiling
parent c730412e98
commit b0ccbddc6f

View file

@ -15,21 +15,25 @@ using namespace villas::fpga;
Card::~Card()
{
// Ensure IP destructors are called before memory is unmapped
ips.clear();
for (auto ip = ips.rbegin(); ip != ips.rend(); ++ip){
(*ip)->stop();
}
// Ensure IP destructors are called before memory is unmapped
ips.clear();
auto &mm = MemoryManager::get();
auto &mm = MemoryManager::get();
// Unmap all memory blocks
for (auto &mappedMemoryBlock : memoryBlocksMapped) {
auto translation = mm.getTranslation(addrSpaceIdDeviceToHost, mappedMemoryBlock.first);
// Unmap all memory blocks
for (auto &mappedMemoryBlock : memoryBlocksMapped) {
auto translation =
mm.getTranslation(addrSpaceIdDeviceToHost, mappedMemoryBlock.first);
const uintptr_t iova = translation.getLocalAddr(0);
const size_t size = translation.getSize();
const uintptr_t iova = translation.getLocalAddr(0);
const size_t size = translation.getSize();
logger->debug("Unmap block {} at IOVA {:#x} of size {:#x}",
mappedMemoryBlock.first, iova, size);
vfioContainer->memoryUnmap(iova, size);
logger->debug("Unmap block {} at IOVA {:#x} of size {:#x}",
mappedMemoryBlock.first, iova, size);
vfioContainer->memoryUnmap(iova, size);
}
}