4

I am working on an emulated QEMU device to simulate an FPGA PCIe interface. I am using the lev-pci device as a base template:

https://github.com/levex/kernel-qemu-pci/blob/master/qemu/hw/char/lev-pci.c

My device uses MSI interrupts to communicate. The kernel driver module is capable of enabling the MSI interrupts and receiving them. I have modified lev-pci.c to add

msi_init(dev, 0x70, 1, false, false);

to the initialization and then

msi_notify(pci_dev,0);

to the "pci_levdev_read" function as a basic test. I can trace that the msi interrupt is being generated in the debugger but I am not receiving the interrupt on the host. Am I missing a step to enable the MSI interrupts?

John
  • 791
  • 1
  • 6
  • 22

1 Answers1

3

The solution was to enable DMA in the kernel module.

pci_set_dma_mask(pdev, DMA_BIT_MASK(32))
pci_set_master(pdev)
John
  • 791
  • 1
  • 6
  • 22
  • If the question is solved, please mark your own question as answered. – randrade86 Jan 04 '16 at 23:17
  • Your answer gives a LOT LOT help, which saves me from hell. This problem blocks for a couple of days last week. I posted a this problem to QEMU-devel mail list, but there is no reply. – Douglas Su Oct 26 '20 at 03:58
  • Glad it was useful. I had this problem because my old testbench didn't have an IOMMU so it worked on hardware but not QEMU. Drove me crazy for about a week. – John Oct 28 '20 at 05:43