user3089142
user3089142

Reputation: 61

how virtio front-end drivers to share vring (or virtqueue) with qemu?

i'm studying how virtio works with qemu and kvm. And i have two questions.

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.

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.

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.

Upvotes: 6

Views: 2991

Answers (1)

Paolo Bonzini
Paolo Bonzini

Reputation: 1930

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).

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).

Upvotes: 7

Related Questions