Forum Discussion
MehmetFide
New Contributor
3 years agoHello @AlexGo
I started testing drivers.
I had problems to receive MSI interrupts by the driver. It basically hangs at xfer_rw() function if MSI interrupts are not received.
To make it work, I added init_arria_msi() function and called it in your init_interrupts() function as suggested by @OlegT here
static void init_arria_msi(struct pci_dev *pci_dev) { u32 conf_reg; // set interrupt disable for legacy pci_read_config_dword(pci_dev, 0x04, &conf_reg); dev_info(&pci_dev->dev, "previous conf_reg = %08llx", (u64)conf_reg); conf_reg |= (1 << 10); pci_write_config_dword(pci_dev, 0x04, conf_reg); //Set bit[1] (Memory space) and bit[2] conf_reg |= 0x06; pci_write_config_dword(pci_dev, 0x04, conf_reg); dev_info(&pci_dev->dev, "after conf_reg = %08llx", (u64)conf_reg); // set msi Ena pci_read_config_dword(pci_dev, 0x50, &conf_reg); dev_info(&pci_dev->dev, "previous msi Ena = %08llx", (u64)conf_reg); conf_reg |= (1 << 16); pci_write_config_dword(pci_dev, 0x50, conf_reg); dev_info(&pci_dev->dev, "after msi Ena = %08llx", (u64)conf_reg); } static int init_interrupts(struct pci_dev *pci_dev) { int ret; init_arria_msi(pci_dev); ret = pci_alloc_irq_vectors(pci_dev, PCI_MSI_COUNT, PCI_MSI_COUNT, PCI_IRQ_MSI); if (ret < 0) { goto msi_err; } else if (ret != PCI_MSI_COUNT) { ret = -ENOSPC; goto nr_msi_err; } ret = pci_irq_vector(pci_dev, PCI_MSI_VECTOR); if (ret < 0) goto vec_err; return ret; vec_err: nr_msi_err: pci_disable_msi(pci_dev); msi_err: return ret; }
After the modification, it seems I can complete dma transfers for writing and reading successfully. I will do couple of performance tests and let you know.
Thank you.