i'm studying how virtio works with qemu and kvm. And i have two questions.
我正在研究virtio如何与qemu和kvm一起工作。我有两个问题。
so far, i understood virtio frond-end drivers (in guests) write IO requests in vring(virtqueue) and kick qemu. Then qemu is notified, translate requests in vring and invoke syscalls such as open, write, read, close, and so on.
到目前为止,我理解virtio前端驱动程序(在来宾中)在vring(virtqueue)和kick qemu中编写IO请求。然后通知qemu,在vring中翻译请求,并调用诸如open、write、read、close等的syscalls。
Q1. how to share vring between virtio front-end drivers and qemu? I got some information that memory map is used from http://www.slideshare.net/zenixls2/052-virtio-introduction-17191942. But, I cannot find it in source codes. Please let me know where it is in source code.
Q1。如何在virtio前端驱动程序和qemu之间共享vring ?我从http://www.slideshare.net/zenixls2/052-virtio- -17191942中获得了一些内存映射的信息。但是,我在源代码中找不到它。请告诉我源代码在哪里。
Q2. how to kick qemu? I cannot understand how front-end drivers kick qemu? I think qemu's memory listeners recieve and handle the kick. But i cannot find it in source code.
Q2。如何踢qemu ?我无法理解前端司机如何踢qemu?我认为qemu的记忆听众会接受并处理这个问题。但我在源代码中找不到它。
1 个解决方案
#1
5
Front-end drivers kick QEMU by writing to an I/O port (in the PCI virtio device's I/O BARs; you can find the address with lspci).
前端驱动程序通过写入I/O端口(在PCI virtio设备的I/O小节中)来启动QEMU;你可以找到lspci的地址。
To share memory between the guest and the virtio device, QEMU does "DMA" with address_space_map and address_space_unmap (or cpu_physical_memory_map and cpu_physical_memory_unmap instead depending on the QEMU version).
为了在来宾和virtio设备之间共享内存,QEMU使用address_space_map和address_space_unmap(或cpu_physical_memory_map和cpu_physical_memory_unmap,而不是根据QEMU版本)进行“DMA”。
#1
5
Front-end drivers kick QEMU by writing to an I/O port (in the PCI virtio device's I/O BARs; you can find the address with lspci).
前端驱动程序通过写入I/O端口(在PCI virtio设备的I/O小节中)来启动QEMU;你可以找到lspci的地址。
To share memory between the guest and the virtio device, QEMU does "DMA" with address_space_map and address_space_unmap (or cpu_physical_memory_map and cpu_physical_memory_unmap instead depending on the QEMU version).
为了在来宾和virtio设备之间共享内存,QEMU使用address_space_map和address_space_unmap(或cpu_physical_memory_map和cpu_physical_memory_unmap,而不是根据QEMU版本)进行“DMA”。