aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorThanos Makatos <thanos.makatos@nutanix.com>2022-07-04 12:16:08 +0100
committerGitHub <noreply@github.com>2022-07-04 12:16:08 +0100
commit36beb63be45ad1412562a98d9373a4c0bd91ab3d (patch)
tree61bb44f0befc0055292b120909251c0fc2d27b0e /docs
parent1c274027bb4f9d68eee846036e8d50dcde2fd7e9 (diff)
downloadlibvfio-user-36beb63be45ad1412562a98d9373a4c0bd91ab3d.zip
libvfio-user-36beb63be45ad1412562a98d9373a4c0bd91ab3d.tar.gz
libvfio-user-36beb63be45ad1412562a98d9373a4c0bd91ab3d.tar.bz2
support for shadow ioeventfd (#698)
When an ioeventfd is written to, KVM discards the value since it has no memory to write it to, and simply kicks the eventfd. This a problem for devices such a NVMe controllers that need the value (e.g. doorbells on BAR0). This patch allows the vfio-user server to pass a file descriptor that can be mmap'ed and KVM can write the ioeventfd value to this _shadow_ memory instead of discarding it. This shadow memory is not exposed to the guest. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com> Change-Id: Iad849c94076ffa5988e034c8bf7ec312d01f095f
Diffstat (limited to 'docs')
-rw-r--r--docs/ioregionfd.md25
1 files changed, 25 insertions, 0 deletions
diff --git a/docs/ioregionfd.md b/docs/ioregionfd.md
new file mode 100644
index 0000000..c09b077
--- /dev/null
+++ b/docs/ioregionfd.md
@@ -0,0 +1,25 @@
+# ioregionfd
+
+ioregionfd is a mechanism that speeds up ioeventfds:
+https://lore.kernel.org/kvm/cover.1613828726.git.eafanasova@gmail.com/. In the
+author's original words: "ioregionfd is a KVM dispatch mechanism which can be
+used for handling MMIO/PIO accesses over file descriptors without returning
+from ioctl(KVM_RUN).".
+
+libvfio-user currently supports an experimental variant of this mechanism
+called shadow ioeventfd. A shadow ioeventfd is a normal ioeventfd where the
+vfio-user server passes another piece of memory (called the _shadow_ memory)
+via an additional file descriptor when configuring the ioregionfd, which then
+QEMU memory maps and passes this address to KVM. This shadow memory is never
+exposed to the guest. When the guest writes to the trapped memory, KVM writes
+the value to the shadow memory instread of discarding it, and then proceeds
+kicking the eventfd as normal.
+
+To use shadow ioeventfd, the kernel and QEMU need to be patched. The QEMU patch
+is designed specifically for SPDK's doorbells (one ioregionfd of 4K in BAR0);
+it should be trivial to extend.
+
+The list of patches:
+* kernel: https://gist.github.com/tmakatos/532afd092a8df2175120d3dbfcd719ef
+* QEMU: https://gist.github.com/tmakatos/57755d2a37a6d53c9ff392e7c34470f6
+* SPDK: https://gist.github.com/tmakatos/f6c10fdaff59c9d629f94bd8e44a53bc