€•D¬Œsphinx.addnodes”Œdocument”“”)�”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)�”}”(hhh]”(hŒ pending_xref”“”)�”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…”�”}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ,/translations/zh_CN/driver-api/virtio/virtio”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)�”}”(hhh]”hŒChinese (Traditional)”…”�”}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ,/translations/zh_TW/driver-api/virtio/virtio”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ,/translations/it_IT/driver-api/virtio/virtio”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ,/translations/ja_JP/driver-api/virtio/virtio”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ,/translations/ko_KR/driver-api/virtio/virtio”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒPortuguese (Brazilian)”…”�”}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ,/translations/pt_BR/driver-api/virtio/virtio”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒSpanish”…”�”}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ,/translations/sp_SP/driver-api/virtio/virtio”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)�”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…”�”}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒF/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio.rst”h´KubhŒtarget”“”)�”}”(hŒ .. _virtio:”h]”h}”(h]”h ]”h"]”h$]”h&]”Œrefid”Œvirtio”uh1hÈh´Khhh²hh³hÇubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒVirtio on Linux”h]”hŒVirtio on Linux”…”�”}”(hhÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhhØh²hh³hÇh´Kubh×)�”}”(hhh]”(hÜ)�”}”(hŒ Introduction”h]”hŒ Introduction”…”�”}”(hhîh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhhëh²hh³hÇh´K ubhŒ paragraph”“”)�”}”(hX_Virtio is an open standard that defines a protocol for communication between drivers and devices of different types, see Chapter 5 ("Device Types") of the virtio spec (`[1]`_). Originally developed as a standard for paravirtualized devices implemented by a hypervisor, it can be used to interface any compliant device (real or emulated) with a driver.”h]”(hŒ¬Virtio is an open standard that defines a protocol for communication between drivers and devices of different types, see Chapter 5 (“Device Typesâ€�) of the virtio spec (”…”�”}”(hhþh²hh³Nh´NubhŒ reference”“”)�”}”(hŒ`[1]`_”h]”hŒ[1]”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œ[1]”hÔŒid2”uh1jhhþŒresolved”KubhŒ±). Originally developed as a standard for paravirtualized devices implemented by a hypervisor, it can be used to interface any compliant device (real or emulated) with a driver.”…”�”}”(hhþh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K hhëh²hubhý)�”}”(hŒýFor illustrative purposes, this document will focus on the common case of a Linux kernel running in a virtual machine and using paravirtualized devices provided by the hypervisor, which exposes them as virtio devices via standard mechanisms such as PCI.”h]”hŒýFor illustrative purposes, this document will focus on the common case of a Linux kernel running in a virtual machine and using paravirtualized devices provided by the hypervisor, which exposes them as virtio devices via standard mechanisms such as PCI.”…”�”}”(hj$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Khhëh²hubeh}”(h]”Œ introduction”ah ]”h"]”Œ introduction”ah$]”h&]”uh1hÖhhØh²hh³hÇh´K ubh×)�”}”(hhh]”(hÜ)�”}”(hŒ)Device - Driver communication: virtqueues”h]”hŒ)Device - Driver communication: virtqueues”…”�”}”(hj=h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj:h²hh³hÇh´Kubhý)�”}”(hXiAlthough the virtio devices are really an abstraction layer in the hypervisor, they're exposed to the guest as if they are physical devices using a specific transport method -- PCI, MMIO or CCW -- that is orthogonal to the device itself. The virtio spec defines these transport methods in detail, including device discovery, capabilities and interrupt handling.”h]”hXkAlthough the virtio devices are really an abstraction layer in the hypervisor, they’re exposed to the guest as if they are physical devices using a specific transport method -- PCI, MMIO or CCW -- that is orthogonal to the device itself. The virtio spec defines these transport methods in detail, including device discovery, capabilities and interrupt handling.”…”�”}”(hjKh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Khj:h²hubhý)�”}”(hXCThe communication between the driver in the guest OS and the device in the hypervisor is done through shared memory (that's what makes virtio devices so efficient) using specialized data structures called virtqueues, which are actually ring buffers [#f1]_ of buffer descriptors similar to the ones used in a network device:”h]”(hŒûThe communication between the driver in the guest OS and the device in the hypervisor is done through shared memory (that’s what makes virtio devices so efficient) using specialized data structures called virtqueues, which are actually ring buffers ”…”�”}”(hjYh²hh³Nh´NubhŒfootnote_reference”“”)�”}”(hŒ[#f1]_”h]”hŒ1”…”�”}”(hjch²hh³Nh´Nubah}”(h]”Œid1”ah ]”h"]”h$]”h&]”Œauto”KhÔŒf1”Œdocname”Œdriver-api/virtio/virtio”uh1jahjYjKubhŒD of buffer descriptors similar to the ones used in a network device:”…”�”}”(hjYh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K"hj:h²hubhŒindex”“”)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œentries”]”(Œsingle”Œvring_desc (C struct)”Œ c.vring_desc”hNt”auh1j€hj:h²hh³Nh´NubhŒdesc”“”)�”}”(hhh]”(hŒdesc_signature”“”)�”}”(hŒ vring_desc”h]”hŒdesc_signature_line”“”)�”}”(hŒstruct vring_desc”h]”(hŒdesc_sig_keyword”“”)�”}”(hŒstruct”h]”hŒstruct”…”�”}”(hj¤h²hh³Nh´Nubah}”(h]”h ]”Œk”ah"]”h$]”h&]”uh1j¢hjžh²hh³Œi/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:40: ./include/uapi/linux/virtio_ring.h”h´KubhŒdesc_sig_space”“”)�”}”(hŒ ”h]”hŒ ”…”�”}”(hj¶h²hh³Nh´Nubah}”(h]”h ]”Œw”ah"]”h$]”h&]”uh1j´hjžh²hh³j³h´KubhŒ desc_name”“”)�”}”(hŒ vring_desc”h]”hŒ desc_sig_name”“”)�”}”(hjšh]”hŒ vring_desc”…”�”}”(hjÍh²hh³Nh´Nubah}”(h]”h ]”Œn”ah"]”h$]”h&]”uh1jËhjÇubah}”(h]”h ]”(Œsig-name”Œdescname”eh"]”h$]”h&]”hÅhÆuh1jÅhjžh²hh³j³h´Kubeh}”(h]”h ]”h"]”h$]”h&]”hÅhÆŒ add_permalink”ˆuh1jœŒsphinx_line_type”Œ declarator”hj˜h²hh³j³h´Kubah}”(h]”j�ah ]”(Œsig”Œ sig-object”eh"]”h$]”h&]”Œ is_multiline”ˆŒ _toc_parts”)Œ _toc_name”huh1j–h³j³h´Khj“h²hubhŒ desc_content”“”)�”}”(hhh]”hý)�”}”(hŒNVirtio ring descriptors, 16 bytes long. These can chain together via **next**.”h]”(hŒEVirtio ring descriptors, 16 bytes long. These can chain together via ”…”�”}”(hjüh²hh³Nh´NubhŒstrong”“”)�”}”(hŒ**next**”h]”hŒnext”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjüubhŒ.”…”�”}”(hjüh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³Œi/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:40: ./include/uapi/linux/virtio_ring.h”h´K^hjùh²hubah}”(h]”h ]”h"]”h$]”h&]”uh1j÷hj“h²hh³j³h´Kubeh}”(h]”h ]”(Œc”Œstruct”eh"]”h$]”h&]”Œdomain”j(Œobjtype”j)Œdesctype”j)Œnoindex”‰Œ noindexentry”‰Œnocontentsentry”‰uh1j‘h²hhj:h³Nh´NubhŒ container”“”)�”}”(hX„**Definition**:: struct vring_desc { __virtio64 addr; __virtio32 len; __virtio16 flags; __virtio16 next; }; **Members** ``addr`` buffer address (guest-physical) ``len`` buffer length ``flags`` descriptor flags ``next`` index of the next descriptor in the chain, if the VRING_DESC_F_NEXT flag is set. We chain unused descriptors via this, too.”h]”(hý)�”}”(hŒ**Definition**::”h]”(j)�”}”(hŒ**Definition**”h]”hŒ Definition”…”�”}”(hj=h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj9ubhŒ:”…”�”}”(hj9h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³Œi/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:40: ./include/uapi/linux/virtio_ring.h”h´Kbhj5ubhŒ literal_block”“”)�”}”(hŒjstruct vring_desc { __virtio64 addr; __virtio32 len; __virtio16 flags; __virtio16 next; };”h]”hŒjstruct vring_desc { __virtio64 addr; __virtio32 len; __virtio16 flags; __virtio16 next; };”…”�”}”hjXsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jVh³Œi/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:40: ./include/uapi/linux/virtio_ring.h”h´Kdhj5ubhý)�”}”(hŒ **Members**”h]”j)�”}”(hjih]”hŒMembers”…”�”}”(hjkh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjgubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³Œi/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:40: ./include/uapi/linux/virtio_ring.h”h´Kkhj5ubhŒdefinition_list”“”)�”}”(hhh]”(hŒdefinition_list_item”“”)�”}”(hŒ)``addr`` buffer address (guest-physical) ”h]”(hŒterm”“”)�”}”(hŒ``addr``”h]”hŒliteral”“”)�”}”(hjŽh]”hŒaddr”…”�”}”(hj’h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hjŒubah}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³Œi/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:40: ./include/uapi/linux/virtio_ring.h”h´Kbhj†ubhŒ definition”“”)�”}”(hhh]”hý)�”}”(hŒbuffer address (guest-physical)”h]”hŒbuffer address (guest-physical)”…”�”}”(hj«h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³j¥h´Kbhj¨ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hj†ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j„h³j¥h´Kbhj�ubj…)�”}”(hŒ``len`` buffer length ”h]”(j‹)�”}”(hŒ``len``”h]”j‘)�”}”(hjËh]”hŒlen”…”�”}”(hjÍh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hjÉubah}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³Œi/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:40: ./include/uapi/linux/virtio_ring.h”h´KchjÅubj§)�”}”(hhh]”hý)�”}”(hŒ buffer length”h]”hŒ buffer length”…”�”}”(hjäh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³jàh´Kchjáubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hjÅubeh}”(h]”h ]”h"]”h$]”h&]”uh1j„h³jàh´Kchj�ubj…)�”}”(hŒ``flags`` descriptor flags ”h]”(j‹)�”}”(hŒ ``flags``”h]”j‘)�”}”(hjh]”hŒflags”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³Œi/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:40: ./include/uapi/linux/virtio_ring.h”h´Kdhjþubj§)�”}”(hhh]”hý)�”}”(hŒdescriptor flags”h]”hŒdescriptor flags”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³jh´Kdhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hjþubeh}”(h]”h ]”h"]”h$]”h&]”uh1j„h³jh´Kdhj�ubj…)�”}”(hŒ„``next`` index of the next descriptor in the chain, if the VRING_DESC_F_NEXT flag is set. We chain unused descriptors via this, too.”h]”(j‹)�”}”(hŒ``next``”h]”j‘)�”}”(hj=h]”hŒnext”…”�”}”(hj?h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hj;ubah}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³Œi/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:40: ./include/uapi/linux/virtio_ring.h”h´Kfhj7ubj§)�”}”(hhh]”hý)�”}”(hŒ{index of the next descriptor in the chain, if the VRING_DESC_F_NEXT flag is set. We chain unused descriptors via this, too.”h]”hŒ{index of the next descriptor in the chain, if the VRING_DESC_F_NEXT flag is set. We chain unused descriptors via this, too.”…”�”}”(hjVh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³Œi/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:40: ./include/uapi/linux/virtio_ring.h”h´KehjSubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hj7ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j„h³jRh´Kfhj�ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhj5ubeh}”(h]”h ]”Œ kernelindent”ah"]”h$]”h&]”uh1j3hj:h²hh³Nh´Nubhý)�”}”(hŒŒAll the buffers the descriptors point to are allocated by the guest and used by the host either for reading or for writing but not for both.”h]”hŒŒAll the buffers the descriptors point to are allocated by the guest and used by the host either for reading or for writing but not for both.”…”�”}”(hj~h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K+hj:h²hubhý)�”}”(hX Refer to Chapter 2.5 ("Virtqueues") of the virtio spec (`[1]`_) for the reference definitions of virtqueues and "Virtqueues and virtio ring: How the data travels" blog post (`[2]`_) for an illustrated overview of how the host device and the guest driver communicate.”h]”(hŒubah}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³Œ_/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:56: ./include/linux/virtio.h”h´Khj:ubj§)�”}”(hhh]”hý)�”}”(hŒ7the maximum number of elements supported by the device.”h]”hŒ7the maximum number of elements supported by the device.”…”�”}”(hjYh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³jUh´KhjVubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hj:ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j„h³jUh´Khjáubj…)�”}”(hŒ'``reset`` vq is in reset state or not. ”h]”(j‹)�”}”(hŒ ``reset``”h]”j‘)�”}”(hjyh]”hŒreset”…”�”}”(hj{h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hjwubah}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³Œ_/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:56: ./include/linux/virtio.h”h´Khjsubj§)�”}”(hhh]”hý)�”}”(hŒvq is in reset state or not.”h]”hŒvq is in reset state or not.”…”�”}”(hj’h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³jŽh´Khj�ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hjsubeh}”(h]”h ]”h"]”h$]”h&]”uh1j„h³jŽh´Khjáubj…)�”}”(hŒ;``priv`` a pointer for the virtqueue implementation to use.”h]”(j‹)�”}”(hŒ``priv``”h]”j‘)�”}”(hj²h]”hŒpriv”…”�”}”(hj´h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hj°ubah}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³Œ_/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:56: ./include/linux/virtio.h”h´Khj¬ubj§)�”}”(hhh]”hý)�”}”(hŒ2a pointer for the virtqueue implementation to use.”h]”hŒ2a pointer for the virtqueue implementation to use.”…”�”}”(hjËh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³Œ_/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:56: ./include/linux/virtio.h”h´KhjÈubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hj¬ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j„h³jÇh´Khjáubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhj™ubeh}”(h]”h ]”Œ kernelindent”ah"]”h$]”h&]”uh1j3hj:h²hh³j/h´Nubhý)�”}”(hŒ**Description**”h]”j)�”}”(hjõh]”hŒ Description”…”�”}”(hj÷h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjóubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³Œ_/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:56: ./include/linux/virtio.h”h´Khj:h²hubhý)�”}”(hŒ“A note on **num_free**: with indirect buffers, each buffer needs one element in the queue, otherwise a buffer will need one element per sg element.”h]”(hŒ A note on ”…”�”}”(hj h²hh³Nh´Nubj)�”}”(hŒ **num_free**”h]”hŒnum_free”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj ubhŒ}: with indirect buffers, each buffer needs one element in the queue, otherwise a buffer will need one element per sg element.”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³Œ_/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:56: ./include/linux/virtio.h”h´Khj:h²hubhý)�”}”(hXSThe callback function pointed by this struct is triggered when the device has consumed the buffers provided by the driver. More specifically, the trigger will be an interrupt issued by the hypervisor (see vring_interrupt()). Interrupt request handlers are registered for a virtqueue during the virtqueue setup process (transport-specific).”h]”hXSThe callback function pointed by this struct is triggered when the device has consumed the buffers provided by the driver. More specifically, the trigger will be an interrupt issued by the hypervisor (see vring_interrupt()). Interrupt request handlers are registered for a virtqueue during the virtqueue setup process (transport-specific).”…”�”}”(hj,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K;hj:h²hubj�)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œentries”]”(j�Œvring_interrupt (C function)”Œc.vring_interrupt”hNt”auh1j€hj:h²hh³Nh´Nubj’)�”}”(hhh]”(j—)�”}”(hŒ0irqreturn_t vring_interrupt (int irq, void *_vq)”h]”j�)�”}”(hŒ/irqreturn_t vring_interrupt(int irq, void *_vq)”h]”(h)�”}”(hhh]”jÌ)�”}”(hŒ irqreturn_t”h]”hŒ irqreturn_t”…”�”}”(hjVh²hh³Nh´Nubah}”(h]”h ]”j×ah"]”h$]”h&]”uh1jËhjSubah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”j(Œreftype”Œ identifier”Œ reftarget”jXŒmodname”NŒ classname”Njêjí)�”}”jð]”jëŒ ASTIdentifier”“”)�”}”jlŒvring_interrupt”sbŒc.vring_interrupt”†”asbuh1hhjOh²hh³Œe/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:65: ./drivers/virtio/virtio_ring.c”h´Mç ubjµ)�”}”(hŒ ”h]”hŒ ”…”�”}”(hj{h²hh³Nh´Nubah}”(h]”h ]”jÁah"]”h$]”h&]”uh1j´hjOh²hh³jzh´Mç ubjÆ)�”}”(hŒvring_interrupt”h]”jÌ)�”}”(hjwh]”hŒvring_interrupt”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”j×ah"]”h$]”h&]”uh1jËhj‰ubah}”(h]”h ]”(jÞjßeh"]”h$]”h&]”hÅhÆuh1jÅhjOh²hh³jzh´Mç ubhŒdesc_parameterlist”“”)�”}”(hŒ(int irq, void *_vq)”h]”(hŒdesc_parameter”“”)�”}”(hŒint irq”h]”(hŒdesc_sig_keyword_type”“”)�”}”(hŒint”h]”hŒint”…”�”}”(hj®h²hh³Nh´Nubah}”(h]”h ]”Œkt”ah"]”h$]”h&]”uh1j¬hj¨ubjµ)�”}”(hŒ ”h]”hŒ ”…”�”}”(hj½h²hh³Nh´Nubah}”(h]”h ]”jÁah"]”h$]”h&]”uh1j´hj¨ubjÌ)�”}”(hŒirq”h]”hŒirq”…”�”}”(hjËh²hh³Nh´Nubah}”(h]”h ]”j×ah"]”h$]”h&]”uh1jËhj¨ubeh}”(h]”h ]”h"]”h$]”h&]”Œnoemph”ˆhÅhÆuh1j¦hj¢ubj§)�”}”(hŒ void *_vq”h]”(j­)�”}”(hŒvoid”h]”hŒvoid”…”�”}”(hjäh²hh³Nh´Nubah}”(h]”h ]”j¹ah"]”h$]”h&]”uh1j¬hjàubjµ)�”}”(hŒ ”h]”hŒ ”…”�”}”(hjòh²hh³Nh´Nubah}”(h]”h ]”jÁah"]”h$]”h&]”uh1j´hjàubhŒdesc_sig_punctuation”“”)�”}”(hŒ*”h]”hŒ*”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”Œp”ah"]”h$]”h&]”uh1jhjàubjÌ)�”}”(hŒ_vq”h]”hŒ_vq”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”j×ah"]”h$]”h&]”uh1jËhjàubeh}”(h]”h ]”h"]”h$]”h&]”Œnoemph”ˆhÅhÆuh1j¦hj¢ubeh}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j hjOh²hh³jzh´Mç ubeh}”(h]”h ]”h"]”h$]”h&]”hÅhÆjéˆuh1jœjêjëhjKh²hh³jzh´Mç ubah}”(h]”jFah ]”(jïjðeh"]”h$]”h&]”jôˆjõ)jöhuh1j–h³jzh´Mç hjHh²hubjø)�”}”(hhh]”hý)�”}”(hŒ"notify a virtqueue on an interrupt”h]”hŒ"notify a virtqueue on an interrupt”…”�”}”(hj;h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³Œe/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:65: ./drivers/virtio/virtio_ring.c”h´Mç hj8h²hubah}”(h]”h ]”h"]”h$]”h&]”uh1j÷hjHh²hh³jzh´Mç ubeh}”(h]”h ]”(j(Œfunction”eh"]”h$]”h&]”j-j(j.jSj/jSj0‰j1‰j2‰uh1j‘h²hhj:h³Nh´Nubj4)�”}”(hŒÆ**Parameters** ``int irq`` the IRQ number (ignored) ``void *_vq`` the struct virtqueue to notify **Description** Calls the callback function of **_vq** to process the virtqueue notification.”h]”(hý)�”}”(hŒ**Parameters**”h]”j)�”}”(hj]h]”hŒ Parameters”…”�”}”(hj_h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj[ubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³Œe/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:65: ./drivers/virtio/virtio_ring.c”h´Më hjWubj€)�”}”(hhh]”(j…)�”}”(hŒ%``int irq`` the IRQ number (ignored) ”h]”(j‹)�”}”(hŒ ``int irq``”h]”j‘)�”}”(hj|h]”hŒint irq”…”�”}”(hj~h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hjzubah}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³Œe/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:65: ./drivers/virtio/virtio_ring.c”h´Mè hjvubj§)�”}”(hhh]”hý)�”}”(hŒthe IRQ number (ignored)”h]”hŒthe IRQ number (ignored)”…”�”}”(hj•h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³j‘h´Mè hj’ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hjvubeh}”(h]”h ]”h"]”h$]”h&]”uh1j„h³j‘h´Mè hjsubj…)�”}”(hŒ-``void *_vq`` the struct virtqueue to notify ”h]”(j‹)�”}”(hŒ ``void *_vq``”h]”j‘)�”}”(hjµh]”hŒ void *_vq”…”�”}”(hj·h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hj³ubah}”(h]”h ]”h"]”h$]”h&]”uh1jŠh³Œe/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:65: ./drivers/virtio/virtio_ring.c”h´Mé hj¯ubj§)�”}”(hhh]”hý)�”}”(hŒthe struct virtqueue to notify”h]”hŒthe struct virtqueue to notify”…”�”}”(hjÎh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³jÊh´Mé hjËubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hj¯ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j„h³jÊh´Mé hjsubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhjWubhý)�”}”(hŒ**Description**”h]”j)�”}”(hjðh]”hŒ Description”…”�”}”(hjòh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjîubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³Œe/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:65: ./drivers/virtio/virtio_ring.c”h´Më hjWubhý)�”}”(hŒMCalls the callback function of **_vq** to process the virtqueue notification.”h]”(hŒCalls the callback function of ”…”�”}”(hj h²hh³Nh´Nubj)�”}”(hŒ**_vq**”h]”hŒ_vq”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj ubhŒ' to process the virtqueue notification.”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³Œe/var/lib/git/docbuild/linux/Documentation/driver-api/virtio/virtio:65: ./drivers/virtio/virtio_ring.c”h´Mê hjWubeh}”(h]”h ]”Œ kernelindent”ah"]”h$]”h&]”uh1j3hj:h²hh³Nh´Nubeh}”(h]”Œ&device-driver-communication-virtqueues”ah ]”h"]”Œ)device - driver communication: virtqueues”ah$]”h&]”uh1hÖhhØh²hh³hÇh´Kubh×)�”}”(hhh]”(hÜ)�”}”(hŒDevice discovery and probing”h]”hŒDevice discovery and probing”…”�”}”(hj9 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj6 h²hh³hÇh´KFubhý)�”}”(hŒòIn the kernel, the virtio core contains the virtio bus driver and transport-specific drivers like `virtio-pci` and `virtio-mmio`. Then there are individual virtio drivers for specific device types that are registered to the virtio bus driver.”h]”(hŒbIn the kernel, the virtio core contains the virtio bus driver and transport-specific drivers like ”…”�”}”(hjG h²hh³Nh´NubhŒtitle_reference”“”)�”}”(hŒ `virtio-pci`”h]”hŒ virtio-pci”…”�”}”(hjQ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jO hjG ubhŒ and ”…”�”}”(hjG h²hh³Nh´NubjP )�”}”(hŒ `virtio-mmio`”h]”hŒ virtio-mmio”…”�”}”(hjc h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jO hjG ubhŒr. Then there are individual virtio drivers for specific device types that are registered to the virtio bus driver.”…”�”}”(hjG h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KHhj6 h²hubhý)�”}”(hXçHow a virtio device is found and configured by the kernel depends on how the hypervisor defines it. Taking the `QEMU virtio-console `__ device as an example. When using PCI as a transport method, the device will present itself on the PCI bus with vendor 0x1af4 (Red Hat, Inc.) and device id 0x1003 (virtio console), as defined in the spec, so the kernel will detect it as it would do with any other PCI device.”h]”(hŒoHow a virtio device is found and configured by the kernel depends on how the hypervisor defines it. Taking the ”…”�”}”(hj{ h²hh³Nh´Nubj)�”}”(hŒe`QEMU virtio-console `__”h]”hŒQEMU virtio-console”…”�”}”(hjƒ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”ŒQEMU virtio-console”Œrefuri”ŒKhttps://gitlab.com/qemu-project/qemu/-/blob/master/hw/char/virtio-console.c”uh1jhj{ ubhX device as an example. When using PCI as a transport method, the device will present itself on the PCI bus with vendor 0x1af4 (Red Hat, Inc.) and device id 0x1003 (virtio console), as defined in the spec, so the kernel will detect it as it would do with any other PCI device.”…”�”}”(hj{ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KMhj6 h²hubhý)�”}”(hŒ¬During the PCI enumeration process, if a device is found to match the virtio-pci driver (according to the virtio-pci device table, any PCI device with vendor id = 0x1af4)::”h]”hŒ«During the PCI enumeration process, if a device is found to match the virtio-pci driver (according to the virtio-pci device table, any PCI device with vendor id = 0x1af4):”…”�”}”(hjŸ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KUhj6 h²hubjW)�”}”(hŒÖ/* Qumranet donated their vendor ID for devices 0x1000 thru 0x10FF. */ static const struct pci_device_id virtio_pci_id_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_REDHAT_QUMRANET, PCI_ANY_ID) }, { 0 } };”h]”hŒÖ/* Qumranet donated their vendor ID for devices 0x1000 thru 0x10FF. */ static const struct pci_device_id virtio_pci_id_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_REDHAT_QUMRANET, PCI_ANY_ID) }, { 0 } };”…”�”}”hj­ sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jVh³hÇh´KYhj6 h²hubhý)�”}”(hŒpthen the virtio-pci driver is probed and, if the probing goes well, the device is registered to the virtio bus::”h]”hŒothen the virtio-pci driver is probed and, if the probing goes well, the device is registered to the virtio bus:”…”�”}”(hj» h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K_hj6 h²hubjW)�”}”(hXstatic int virtio_pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) { ... if (force_legacy) { rc = virtio_pci_legacy_probe(vp_dev); /* Also try modern mode if we can't map BAR0 (no IO space). */ if (rc == -ENODEV || rc == -ENOMEM) rc = virtio_pci_modern_probe(vp_dev); if (rc) goto err_probe; } else { rc = virtio_pci_modern_probe(vp_dev); if (rc == -ENODEV) rc = virtio_pci_legacy_probe(vp_dev); if (rc) goto err_probe; } ... rc = register_virtio_device(&vp_dev->vdev);”h]”hXstatic int virtio_pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id) { ... if (force_legacy) { rc = virtio_pci_legacy_probe(vp_dev); /* Also try modern mode if we can't map BAR0 (no IO space). */ if (rc == -ENODEV || rc == -ENOMEM) rc = virtio_pci_modern_probe(vp_dev); if (rc) goto err_probe; } else { rc = virtio_pci_modern_probe(vp_dev); if (rc == -ENODEV) rc = virtio_pci_legacy_probe(vp_dev); if (rc) goto err_probe; } ... rc = register_virtio_device(&vp_dev->vdev);”…”�”}”hjÉ sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1jVh³hÇh´Kbhj6 h²hubhý)�”}”(hŒ When the device is registered to the virtio bus the kernel will look for a driver in the bus that can handle the device and call that driver's ``probe`` method.”h]”(hŒ‘When the device is registered to the virtio bus the kernel will look for a driver in the bus that can handle the device and call that driver’s ”…”�”}”(hj× h²hh³Nh´Nubj‘)�”}”(hŒ ``probe``”h]”hŒprobe”…”�”}”(hjß h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hj× ubhŒ method.”…”�”}”(hj× h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´Kzhj6 h²hubhý)�”}”(hŒôAt this point, the virtqueues will be allocated and configured by calling the appropriate ``virtio_find`` helper function, such as virtio_find_single_vq() or virtio_find_vqs(), which will end up calling a transport-specific ``find_vqs`` method.”h]”(hŒZAt this point, the virtqueues will be allocated and configured by calling the appropriate ”…”�”}”(hj÷ h²hh³Nh´Nubj‘)�”}”(hŒ``virtio_find``”h]”hŒ virtio_find”…”�”}”(hjÿ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hj÷ ubhŒw helper function, such as virtio_find_single_vq() or virtio_find_vqs(), which will end up calling a transport-specific ”…”�”}”(hj÷ h²hh³Nh´Nubj‘)�”}”(hŒ ``find_vqs``”h]”hŒfind_vqs”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j�hj÷ ubhŒ method.”…”�”}”(hj÷ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K~hj6 h²hubeh}”(h]”Œdevice-discovery-and-probing”ah ]”h"]”Œdevice discovery and probing”ah$]”h&]”uh1hÖhhØh²hh³hÇh´KFubh×)�”}”(hhh]”(hÜ)�”}”(hŒ References”h]”hŒ References”…”�”}”(hj4 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj1 h²hh³hÇh´K…ubhý)�”}”(hŒX_`[1]` Virtio Spec v1.2: https://docs.oasis-open.org/virtio/virtio/v1.2/virtio-v1.2.html”h]”(hÉ)�”}”(hŒ_`[1]`”h]”hŒ[1]”…”�”}”(hjF h²hh³Nh´Nubah}”(h]”jah ]”h"]”Œ[1]”ah$]”h&]”uh1hÈhjB Œ referenced”KubhŒ Virtio Spec v1.2: ”…”�”}”(hjB h²hh³Nh´Nubj)�”}”(hŒ?https://docs.oasis-open.org/virtio/virtio/v1.2/virtio-v1.2.html”h]”hŒ?https://docs.oasis-open.org/virtio/virtio/v1.2/virtio-v1.2.html”…”�”}”(hjZ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j\ uh1jhjB ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K‡hj1 h²hubh¶)�”}”(hŒ-Check for later versions of the spec as well.”h]”hŒ-Check for later versions of the spec as well.”…”�”}”hjo sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1hµhj1 h²hh³hÇh´K‹ubhý)�”}”(hŒ‚_`[2]` Virtqueues and virtio ring: How the data travels https://www.redhat.com/en/blog/virtqueues-and-virtio-ring-how-data-travels”h]”(hÉ)�”}”(hŒ_`[2]`”h]”hŒ[2]”…”�”}”(hj� h²hh³Nh´Nubah}”(h]”j¸ah ]”h"]”Œ[2]”ah$]”h&]”uh1hÈhj} jU KubhŒ2 Virtqueues and virtio ring: How the data travels ”…”�”}”(hj} h²hh³Nh´Nubj)�”}”(hŒJhttps://www.redhat.com/en/blog/virtqueues-and-virtio-ring-how-data-travels”h]”hŒJhttps://www.redhat.com/en/blog/virtqueues-and-virtio-ring-how-data-travels”…”�”}”(hj” h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j– uh1jhj} ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´KŒhj1 h²hubhŒrubric”“”)�”}”(hŒ Footnotes”h]”hŒ Footnotes”…”�”}”(hj« h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j© hj1 h²hh³hÇh´K�ubhŒfootnote”“”)�”}”(hŒ5that's why they may be also referred to as virtrings.”h]”(hŒlabel”“”)�”}”(hhh]”hŒ1”…”�”}”(hjÁ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¿ hj» h²hh³Nh´Nubhý)�”}”(hj½ h]”hŒ7that’s why they may be also referred to as virtrings.”…”�”}”(hjÎ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hüh³hÇh´K‘hj» ubeh}”(h]”jsah ]”h"]”Œf1”ah$]”h&]”jmajrKjtjuuh1j¹ h³hÇh´K‘hj1 h²hubeh}”(h]”Œ references”ah ]”h"]”Œ references”ah$]”h&]”uh1hÖhhØh²hh³hÇh´K…ubeh}”(h]”(Œvirtio-on-linux”hÕeh ]”h"]”(Œvirtio on linux”Œvirtio”eh$]”h&]”uh1hÖhhh²hh³hÇh´KŒexpect_referenced_by_name”}”jð hÊsŒexpect_referenced_by_id”}”hÕhÊsubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÇuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)�”}”(hÛNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”j Œerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÇŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”(Œ[1]”]”(jj”eŒf1”]”jcaŒ[2]”]”j¨auŒrefids”}”(hÕ]”hÊajs]”jcauŒnameids”}”(jð hÕjï jì j7j4j3 j0 j. j+ jç jä jR jj� j¸jß jsuŒ nametypes”}”(jð ˆjï ‰j7‰j3 ‰j. ‰jç ‰jR ˆj� ˆjß ˆuh}”(hÕhØjì hØj4hëj0 j:jmjcj�j˜j-j3jFjKj+ j6 jä j1 jjF j¸j� jsj» uŒ footnote_refs”}”j\ ]”jcasŒ citation_refs”}”Œ autofootnotes”]”j» aŒautofootnote_refs”]”jcaŒsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”j( Ks…”R”Œparse_messages”]”Œtransform_messages”]”hŒsystem_message”“”)�”}”(hhh]”hý)�”}”(hhh]”hŒ,Hyperlink target "virtio" is not referenced.”…”�”}”hjŒ sbah}”(h]”h ]”h"]”h$]”h&]”uh1hühj‰ ubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”ŒINFO”Œsource”hÇŒline”Kuh1j‡ ubaŒ transformer”NŒ include_log”]”Œ decoration”Nh²hub.