From 3b8949afe9d4536fa1071eba391f1155816c44de Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 11 Nov 2022 06:46:24 -0500 Subject: [PATCH] core: move configuration of polling mode to parse() Signed-off-by: Steffen Vogel --- fpga/etc/fpgas.json | 3 +-- fpga/include/villas/fpga/card.hpp | 1 - fpga/include/villas/fpga/core.hpp | 9 --------- fpga/include/villas/fpga/ips/dma.hpp | 6 ------ fpga/lib/card.cpp | 7 ++----- fpga/lib/core.cpp | 3 --- fpga/lib/ips/dma.cpp | 8 +++++++- 7 files changed, 10 insertions(+), 27 deletions(-) diff --git a/fpga/etc/fpgas.json b/fpga/etc/fpgas.json index c5c471d49..42865c011 100644 --- a/fpga/etc/fpgas.json +++ b/fpga/etc/fpgas.json @@ -4,8 +4,7 @@ "id": "10ee:7021", "slot": "0000:88:00.0", "do_reset": true, - "ips": "etc/vc707-xbar-pcie/vc707-xbar-pcie.json", - "polling": false + "ips": "etc/vc707-xbar-pcie/vc707-xbar-pcie.json" } } } diff --git a/fpga/include/villas/fpga/card.hpp b/fpga/include/villas/fpga/card.hpp index d9574a7f8..f368d2bcc 100644 --- a/fpga/include/villas/fpga/card.hpp +++ b/fpga/include/villas/fpga/card.hpp @@ -104,7 +104,6 @@ public: // TODO: make this private bool doReset; // Reset VILLASfpga during startup? int affinity; // Affinity for MSI interrupts - bool polling; // Poll on interrupts? std::string name; // The name of the FPGA card diff --git a/fpga/include/villas/fpga/core.hpp b/fpga/include/villas/fpga/core.hpp index bc39fd170..3996f732b 100644 --- a/fpga/include/villas/fpga/core.hpp +++ b/fpga/include/villas/fpga/core.hpp @@ -293,11 +293,6 @@ public: } protected: - enum PollingMode { - POLL, - IRQ, - }; - Logger getLogger() const { return villas::logging.get(getName()); @@ -312,10 +307,6 @@ private: // Create a concrete IP instance virtual Core* create() = 0; - virtual - void configurePollingMode(Core &, PollingMode) - { } - virtual Vlnv getCompatibleVlnv() const = 0; diff --git a/fpga/include/villas/fpga/ips/dma.hpp b/fpga/include/villas/fpga/ips/dma.hpp index 86ecdaaa1..cb18ff4e1 100644 --- a/fpga/include/villas/fpga/ips/dma.hpp +++ b/fpga/include/villas/fpga/ips/dma.hpp @@ -176,12 +176,6 @@ public: virtual void parse(Core& ip, json_t* json) override; - - virtual void - configurePollingMode(Core& ip, PollingMode mode) override - { - dynamic_cast(ip).polling = (mode == POLL); - } }; } /* namespace ip */ diff --git a/fpga/lib/card.cpp b/fpga/lib/card.cpp index b8318b3a1..769941ce3 100644 --- a/fpga/lib/card.cpp +++ b/fpga/lib/card.cpp @@ -57,16 +57,14 @@ PCIeCardFactory::make(json_t *json, std::shared_ptr pci const char* pci_id = nullptr; int do_reset = 0; int affinity = 0; - int polling = 0; json_error_t err; - int ret = json_unpack_ex(json_card, &err, 0, "{ s: o, s?: i, s?: b, s?: s, s?: s, s?: b }", + int ret = json_unpack_ex(json_card, &err, 0, "{ s: o, s?: i, s?: b, s?: s, s?: s }", "ips", &json_ips, "affinity", &affinity, "do_reset", &do_reset, "slot", &pci_slot, - "id", &pci_id, - "polling", &polling); + "id", &pci_id); if (ret != 0) throw ConfigError(json_card, err, "", "Failed to parse card"); @@ -78,7 +76,6 @@ PCIeCardFactory::make(json_t *json, std::shared_ptr pci card->vfioContainer = vc; card->affinity = affinity; card->doReset = do_reset != 0; - card->polling = (polling != 0); kernel::pci::Device filter = defaultFilter; diff --git a/fpga/lib/core.cpp b/fpga/lib/core.cpp index 13280bcde..8bddb6564 100644 --- a/fpga/lib/core.cpp +++ b/fpga/lib/core.cpp @@ -247,9 +247,6 @@ CoreFactory::make(PCIeCard* card, json_t *json_ips) // IP-specific setup via JSON config CoreFactory->parse(*ip, json_ip); - // Set polling mode - CoreFactory->configurePollingMode(*ip, (card->polling ? PollingMode::POLL : PollingMode::IRQ)); - // IP has been configured now configuredIps.push_back(std::move(ip)); } diff --git a/fpga/lib/ips/dma.cpp b/fpga/lib/ips/dma.cpp index a90ccaddf..5888c011f 100644 --- a/fpga/lib/ips/dma.cpp +++ b/fpga/lib/ips/dma.cpp @@ -641,8 +641,12 @@ void DmaFactory::parse(Core &ip, json_t *cfg) dma.xConfig.AddrWidth = 32; dma.xConfig.SgLengthWidth = 14; + int polling; + json_error_t err; - int ret = json_unpack_ex(cfg, &err, 0, "{ s: { s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i } }", + int ret = json_unpack_ex(cfg, &err, 0, "{ s: b, s: { s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i } }", + "polling", &polling, + "parameters", "c_sg_include_stscntrl_strm", &dma.xConfig.HasStsCntrlStrm, "c_include_mm2s", &dma.xConfig.HasMm2S, @@ -660,4 +664,6 @@ void DmaFactory::parse(Core &ip, json_t *cfg) ); if (ret != 0) throw ConfigError(cfg, err, "", "Failed to parse DMA configuration"); + + dma.polling = polling != 0; }