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

Revert "core: move configuration of polling mode to parse()"

The changes lead to crashing because intc will not be configured
properly. Also revert removing configDone in ips/dma

This reverts commit 3b8949afe9.

Signed-off-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
This commit is contained in:
Niklas Eiling 2022-12-05 10:05:12 +01:00
parent c77a0d510a
commit 03f8d0782e
7 changed files with 46 additions and 22 deletions

View file

@ -4,7 +4,8 @@
"id": "10ee:7021",
"slot": "0000:88:00.0",
"do_reset": true,
"ips": "etc/vc707-xbar-pcie/vc707-xbar-pcie.json"
"ips": "etc/vc707-xbar-pcie/vc707-xbar-pcie.json",
"polling": false
}
}
}

View file

@ -104,6 +104,7 @@ 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

View file

@ -293,6 +293,11 @@ public:
}
protected:
enum PollingMode {
POLL,
IRQ,
};
Logger getLogger() const
{
return villas::logging.get(getName());
@ -307,6 +312,10 @@ private:
// Create a concrete IP instance
virtual Core* create() = 0;
virtual
void configurePollingMode(Core &, PollingMode)
{ }
virtual
Vlnv getCompatibleVlnv() const = 0;

View file

@ -180,6 +180,12 @@ public:
virtual
void parse(Core& ip, json_t* json) override;
virtual void
configurePollingMode(Core& ip, PollingMode mode) override
{
dynamic_cast<Dma&>(ip).polling = (mode == POLL);
}
};
} /* namespace ip */

View file

@ -38,7 +38,7 @@ using namespace villas;
using namespace villas::fpga;
// Instantiate factory to register
static PCIeCardFactory villas::fpga::PCIeCardFactory;
static PCIeCardFactory PCIeCardFactoryInstance;
static const kernel::pci::Device defaultFilter((kernel::pci::Id(FPGA_PCI_VID_XILINX, FPGA_PCI_PID_VFPGA)));
@ -52,22 +52,24 @@ PCIeCard::List PCIeCardFactory::make(json_t *json, std::shared_ptr<kernel::pci::
json_object_foreach(json, card_name, json_card) {
logger->info("Found config for FPGA card {}", card_name);
json_t *json_ips;
json_t *json_paths = nullptr;
const char *pci_slot = nullptr;
const char *pci_id = nullptr;
int do_reset = 0;
int affinity = 0;
json_t* json_ips = nullptr;
json_t* json_paths = nullptr;
const char* pci_slot = nullptr;
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?: o }",
"ips", &json_ips,
"affinity", &affinity,
"do_reset", &do_reset,
"slot", &pci_slot,
"id", &pci_id,
"paths", &json_paths
);
int ret = json_unpack_ex(json_card, &err, 0, "{ s: o, s?: i, s?: b, s?: s, s?: s, s?: b, s?: o }",
"ips", &json_ips,
"affinity", &affinity,
"do_reset", &do_reset,
"slot", &pci_slot,
"id", &pci_id,
"polling", &polling,
"paths", &json_paths);
if (ret != 0)
throw ConfigError(json_card, err, "", "Failed to parse card");
@ -78,6 +80,7 @@ PCIeCard::List PCIeCardFactory::make(json_t *json, std::shared_ptr<kernel::pci::
card->vfioContainer = vc;
card->affinity = affinity;
card->doReset = do_reset != 0;
card->polling = (polling != 0);
kernel::pci::Device filter = defaultFilter;

View file

@ -249,6 +249,9 @@ 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));
}

View file

@ -178,10 +178,15 @@ void Dma::setupScatterGatherRingTx()
bool Dma::reset()
{
if (xDma.RegBase == 0) {
return true;
}
XAxiDma_IntrDisable(&xDma, XAXIDMA_IRQ_ALL_MASK, XAXIDMA_DMA_TO_DEVICE);
XAxiDma_IntrDisable(&xDma, XAXIDMA_IRQ_ALL_MASK, XAXIDMA_DEVICE_TO_DMA);
XAxiDma_Reset(&xDma);
// Value taken from libxil implementation
int timeout = 500;
@ -641,12 +646,8 @@ 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: 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,
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 } }",
"parameters",
"c_sg_include_stscntrl_strm", &dma.xConfig.HasStsCntrlStrm,
"c_include_mm2s", &dma.xConfig.HasMm2S,
@ -665,5 +666,5 @@ void DmaFactory::parse(Core &ip, json_t *cfg)
if (ret != 0)
throw ConfigError(cfg, err, "", "Failed to parse DMA configuration");
dma.polling = polling != 0;
dma.configDone = true;
}