From 74ad0783f6d9ef3e0614bfed456f1e5ba2cd2f88 Mon Sep 17 00:00:00 2001 From: Niklas Eiling Date: Fri, 2 Dec 2022 11:53:40 +0100 Subject: [PATCH] bump common subrepo and use new interface Signed-off-by: Niklas Eiling --- fpga/common | 2 +- fpga/include/villas/fpga/card.hpp | 8 ++++---- fpga/lib/card.cpp | 11 +++++------ fpga/lib/fpgaHelper.cpp | 2 +- fpga/tests/unit/fpga.cpp | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/fpga/common b/fpga/common index 98b9526de..17d22ef51 160000 --- a/fpga/common +++ b/fpga/common @@ -1 +1 @@ -Subproject commit 98b9526deb23afc2d40c58e29d4d00b2408480db +Subproject commit 17d22ef5157c8d92d13bf975b1cd2e481de92e3a diff --git a/fpga/include/villas/fpga/card.hpp b/fpga/include/villas/fpga/card.hpp index 7911bb53d..4b0148d30 100644 --- a/fpga/include/villas/fpga/card.hpp +++ b/fpga/include/villas/fpga/card.hpp @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include @@ -111,10 +111,10 @@ public: // TODO: make this private std::shared_ptr pdev; // PCI device handle // The VFIO container that this card is part of - std::shared_ptr vfioContainer; + kernel::vfio::Container* vfioContainer; // The VFIO device that represents this card - kernel::vfio::Device* vfioDevice; + std::shared_ptr vfioDevice; // Slave address space ID to access the PCIe address space from the FPGA MemoryManager::AddressSpaceId addrSpaceIdDeviceToHost; @@ -137,7 +137,7 @@ class PCIeCardFactory : public plugin::Plugin { public: static Card::List - make(json_t *json, std::shared_ptr pci, std::shared_ptr vc); + make(json_t *json, std::shared_ptr pci, kernel::vfio::Container* vc); static PCIeCard* create() diff --git a/fpga/lib/card.cpp b/fpga/lib/card.cpp index bbec8fded..1d566c3cb 100644 --- a/fpga/lib/card.cpp +++ b/fpga/lib/card.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include @@ -42,7 +42,7 @@ static PCIeCardFactory villas::fpga::PCIeCardFactory; static const kernel::pci::Device defaultFilter((kernel::pci::Id(FPGA_PCI_VID_XILINX, FPGA_PCI_PID_VFPGA))); PCIeCard::List -PCIeCardFactory::make(json_t *json, std::shared_ptr pci, std::shared_ptr vc) +PCIeCardFactory::make(json_t *json, std::shared_ptr pci, kernel::vfio::Container* vc) { PCIeCard::List cards; auto logger = getStaticLogger(); @@ -76,7 +76,7 @@ PCIeCardFactory::make(json_t *json, std::shared_ptr pci // Populate generic properties card->name = std::string(card_name); - card->vfioContainer = std::move(vc); + card->vfioContainer = vc; card->affinity = affinity; card->doReset = do_reset != 0; card->polling = (polling != 0); @@ -225,11 +225,10 @@ PCIeCard::init() logger->info("Initializing FPGA card {}", name); // Attach PCIe card to VFIO container - kernel::vfio::Device &device = vfioContainer->attachDevice(*pdev); - this->vfioDevice = &device; + vfioDevice = vfioContainer->attachDevice(*pdev); // Enable memory access and PCI bus mastering for DMA - if (not device.pciEnable()) { + if (not vfioDevice->pciEnable()) { logger->error("Failed to enable PCI device"); return false; } diff --git a/fpga/lib/fpgaHelper.cpp b/fpga/lib/fpgaHelper.cpp index ebfb5de7c..0e5a80646 100644 --- a/fpga/lib/fpgaHelper.cpp +++ b/fpga/lib/fpgaHelper.cpp @@ -73,7 +73,7 @@ fpga::setupFpgaCard(const std::string &configFile, const std::string &fpgaName) { pciDevices = std::make_shared(); - auto vfioContainer = kernel::vfio::Container::create(); + auto vfioContainer = kernel::vfio::Container::getInstance(); // Parse FPGA configuration FILE* f = fopen(configFile.c_str(), "r"); diff --git a/fpga/tests/unit/fpga.cpp b/fpga/tests/unit/fpga.cpp index 47841bdd9..6263a8577 100644 --- a/fpga/tests/unit/fpga.cpp +++ b/fpga/tests/unit/fpga.cpp @@ -56,7 +56,7 @@ static void init() pciDevices = std::make_shared(); - auto vfioContainer = kernel::vfio::Container::create(); + auto vfioContainer = kernel::vfio::Container::getInstance(); // Parse FPGA configuration char *fn = getenv("TEST_CONFIG");