Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 615
user3089142 Avatar asked Dec 11 '13 01:12

user3089142


People also ask

What is QEMU virtio?

VirtIO is a platform for IO virtualization, common to several hypervisors (and QEMU). The guest operating system needs specialized drivers to handle these devices.

What is virtio drivers in Linux?

In a nutshell, virtio is an abstraction layer over devices in a paravirtualized hypervisor. virtio was developed by Rusty Russell in support of his own virtualization solution called lguest .

What are virtio drivers?

VirtIO Drivers are paravirtualized drivers for kvm/Linux (see http://www.linux-kvm.org/page/Virtio). In short, they enable direct (paravirtualized) access to devices and peripherals for virtual machines using them, instead of slower, emulated, ones.

What is virtio in kvm?

Fedora infrastructure hosts virtIO drivers and additional software agents for Windows virtual machines running on kernel-based virtual machines (KVM). virtIO is a virtualization standard for network and disk device drivers.


1 Answers

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

like image 153
Paolo Bonzini Avatar answered Oct 13 '22 20:10

Paolo Bonzini