Driver to support shared memory with interrupts with broadcast
Subsystems (2)
RFC PATCH 1/1 Driver to support shared memory with interrupts with broadcast
This driver allows the guest VM to access shared memory between other guest that is a POSIX shared memory object on the host. The driver can also send interrupts by writing to the DoorBell register.
With interrupts, the ioctl must specify the ID of the VM to receive the interrupt or '255' for broadcast to all active VMs. The 'arg' parameter is the destination VM and 'cmd' is the interrupt code. The value written to the register is a bit messy. 32-bits are written to the register, the upper 16 are the destination VM, and the lower 16 are the interrupt 'code' that the destination guest will receive. Implemented codes (see the interrupt handler) either call up on the device's semaphore or wake up on the wait_event queue. These codes' uses are at the discretion of the driver so they could be customized.
For ioctls that read values from the device (such as for getting the global ID of the guest) the arg parameter is unused.
Cam
--- drivers/char/Kconfig | 8 + drivers/char/Makefile | 2 + drivers/char/kvm_ivshmem.c | 447 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 457 insertions(+), 0 deletions(-) create mode 100644 drivers/char/kvm_ivshmem.c
drivers/char/Kconfig +8 -0
@@ -1108,6 +1108,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
@@ -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 +447 -0
447 lines not on this page · raw message
Signature · 1 line
1.6.0.6
Quoted 14 lines · Cam Macdonell
This driver allows the guest VM to access shared memory between other guest that is a POSIX shared memory object on the host. The driver can also send interrupts by writing to the DoorBell register.
With interrupts, the ioctl must specify the ID of the VM to receive the interrupt or '255' for broadcast to all active VMs. The 'arg' parameter is the destination VM and 'cmd' is the interrupt code. The value written to the register is a bit messy. 32-bits are written to the register, the upper 16 are the destination VM, and the lower 16 are the interrupt 'code' that the destination guest will receive. Implemented codes (see the interrupt handler) either call up on the device's semaphore or wake up on the
wait_eventqueue. These codes' uses are at the discretion of the driver so they could be customized.
Quoted 5 lines
For ioctls that read values from the device (such as for getting the global ID of the guest) the arg parameter is unused.
Cam
I think you should just use Michael's uio_pci driver. I don't think we have a need for a new kernel interface.
Regards,
Anthony Liguori
Quoted 15 lines · Anthony Liguori
Quoted 14 lines · Cam Macdonell
This driver allows the guest VM to access shared memory between other guest that is a POSIX shared memory object on the host. The driver can also send interrupts by writing to the DoorBell register.
With interrupts, the ioctl must specify the ID of the VM to receive the interrupt or '255' for broadcast to all active VMs. The 'arg' parameter is the destination VM and 'cmd' is the interrupt code. The value written to the register is a bit messy. 32-bits are written to the register, the upper 16 are the destination VM, and the lower 16 are the interrupt 'code' that the destination guest will receive. Implemented codes (see the interrupt handler) either call up on the device's semaphore or wake up on the
wait_eventqueue. These codes' uses are at the discretion of the driver so they could be customized.
Quoted 8 lines
Quoted 5 lines
For ioctls that read values from the device (such as for getting the global ID of the guest) the arg parameter is unused.
Cam
I think you should just use Michael's
uio_pcidriver. I don't think we have a need for a new kernel interface.
If that's what you want to do, an example device that generates interrupts in response to config writes can be found here:
http://www.archivum.info/[email protected]/2009-07/01548/%5BQemu-devel%5D_%5BPATCH%5D_qemu:_test-irq_device
Quoted 7 lines
Regards,
Anthony Liguori
--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 19 lines · Michael S. Tsirkin
Quoted 18 lines · Anthony Liguori
Quoted 17 lines · Cam Macdonell
This driver allows the guest VM to access shared memory between other guest that is a POSIX shared memory object on the host. The driver can also send interrupts by writing to the DoorBell register.
With interrupts, the ioctl must specify the ID of the VM to receive the interrupt or '255' for broadcast to all active VMs. The 'arg' parameter is the destination VM and 'cmd' is the interrupt code. The value written to the register is a bit messy. 32-bits are written to the register, the upper 16 are the destination VM, and the lower 16 are the interrupt 'code' that the destination guest will receive. Implemented codes (see the interrupt handler) either call up on the device's semaphore or wake up on the
wait_eventqueue. These codes' uses are at the discretion of the driver so they could be customized.For ioctls that read values from the device (such as for getting the global ID of the guest) the arg parameter is unused.
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
Cam
I think you should just use Michael's
uio_pcidriver. I don't think we have a need for a new kernel interface.If that's what you want to do, an example device that generates interrupts in response to config writes can be found here:
http://www.archivum.info/[email protected]/2009-07/01548/%5BQemu-devel%5D_%5BPATCH%5D_qemu:_test-irq_device
Thank you, I'll have a look.