简体   繁体   English

QEMU MSI仿真

[英]QEMU msi emulation

I am working on an emulated QEMU device to simulate an FPGA PCIe interface. 我正在仿真QEMU设备上模拟FPGA PCIe接口。 I am using the lev-pci device as a base template: 我将lev-pci设备用作基本模板:

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

My device uses MSI interrupts to communicate. 我的设备使用MSI中断进行通信。 The kernel driver module is capable of enabling the MSI interrupts and receiving them. 内核驱动程序模块能够启用MSI中断并接收它们。 I have modified lev-pci.c to add 我修改了lev-pci.c添加

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. 作为“ pci_levdev_read”功能的基本测试。 I can trace that the msi interrupt is being generated in the debugger but I am not receiving the interrupt on the host. 我可以跟踪到调试器中正在生成msi中断,但是我没有在主机上收到该中断。 Am I missing a step to enable the MSI interrupts? 我是否缺少启用MSI中断的步骤?

The solution was to enable DMA in the kernel module. 解决方案是在内核模块中启用DMA。

pci_set_dma_mask(pdev, DMA_BIT_MASK(32))
pci_set_master(pdev)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM