Skip to contentSkip to conversation

Guest device driver for an inter-VM shared memory PCI device that maps a shared file (from /dev/shm) on the devices memory.

PATCH New Cam Macdonell 1 participant 1 message Apr 1, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Guest device driver for an inter-VM shared memory PCI device that maps a shared file (from /dev/shm) on the devices memory.

This driver corresponds to the shared memory PCI device that maps a host file into shared memory on the device.

Accessing the device can be done through creating a device file on the guest

num =cat /proc/devices | grep kvm_ivshmem | awk '{print $1} mknod --mode=666 /dev/ivshmem $num 0

read, write, lseek and mmap are supported, but mmap is the usual usage to get zero-copy communication. The driver contains the initial interrupt support, but I have not yet added the unix domain socket to support interrupts yet.

---
 drivers/char/Kconfig       |    8 +
 drivers/char/Makefile      |    2 +
 drivers/char/kvm_ivshmem.c |  370 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 380 insertions(+), 0 deletions(-)
 create mode 100644 drivers/char/kvm_ivshmem.c
drivers/char/Kconfig +8 -0
index 735bbe2..afa7cb8 100644
@@ -1099,6 +1099,14 @@ config DEVPORT
 	depends on ISA || PCI
 	default y
 
+config KVM_IVSHMEM
+    tristate "Inter-VM Shared Memory Device"
+    depends on PCI
+    default m
+    help
+      This device maps a region of shared memory between the host OS and any
+      number of virtual machines.
+
 source "drivers/s390/char/Kconfig"
 
 endmenu
drivers/char/Makefile +2 -0
index 9caf5b5..021f06b 100644
@@ -111,6 +111,8 @@ obj-$(CONFIG_PS3_FLASH)		+= ps3flash.o
 obj-$(CONFIG_JS_RTC)		+= js-rtc.o
 js-rtc-y = rtc.o
 
+obj-$(CONFIG_KVM_IVSHMEM)		+= kvm_ivshmem.o
+
 # Files generated that shall be removed upon make clean
 clean-files := consolemap_deftbl.c defkeymap.c
 
drivers/char/kvm_ivshmem.c new file +370 -0

370 lines not on this page · raw message

Signature · 1 line
1.6.0.6