引用

https://www.ibm.com/developerworks/community/blogs/5144904d-5d75-45ed-9d2b-cf1754ee936a/entry/vfio?lang=en

https://ggaaooppeenngg.github.io/zh-CN/2017/06/05/VFIO-%E2%80%94%E2%80%94%E5%B0%86-DMA-%E6%98%A0%E5%B0%84%E6%9A%B4%E9%9C%B2%E7%BB%99%E7%94%A8%E6%88%B7%E6%80%81/

https://www.kernel.org/doc/Documentation/vfio.txt

https://kernelgo.org/vfio-insight.html

https://kernelgo.org/vfio-introduction.html

https://blog.csdn.net/RichardYSteven/article/details/55116816

http://www.qingpingshan.com/m/view.php?aid=305414

通过eventfd通知用户态(比如dpdk)

DPDK side

rte_intr_enable

|- vfio_enable_msix

|— irq_set->flags = VFIO_IRQ_SET_DATA_EVENTFD | VFIO_IRQ_SET_ACTION_TRIGGER;

|— irq_set->index = VFIO_PCI_MSIX_IRQ_INDEX;

|— ioctl(intr_handle->vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set);

kernel side

vfio_pci_ioctl

|- else if (cmd == VFIO_DEVICE_SET_IRQS)

|— vfio_pci_set_irqs_ioctl

|—- case VFIO_PCI_MSIX_IRQ_INDEX && case VFIO_IRQ_SET_ACTION_TRIGGER:

|—— vfio_pci_set_msi_trigger

|——- vfio_msi_set_block

|——— vfio_msi_set_vector_signal

|———- trigger = eventfd_ctx_fdget(fd);

|———- request_irq(irq, vfio_msihandler, 0, vdev->ctx[vector].name, trigger);

其中,

vfio_msihandler

|- eventfd_signal(trigger, 1);

|— wake_up_locked_poll(&ctx->wqh, POLLIN);

qemu/kvm

https://stackoverflow.com/questions/29461518/interrupt-handling-for-assigned-device-through-vfio