[PATCH v3 0/2] Inter-VM shared memory PCI device

2010-03-25 Thread Cam Macdonell
is written to a guest's Doorbell. Sample programs, init scripts and the shared memory server are available in a git repo here: www.gitorious.org/nahanni Cam Macdonell (2): Support adding a file to qemu's ram allocation Inter-VM shared memory PCI device Makefile.target |3 + cpu

[PATCH v3 1/2] Support adding a file to qemu's ram allocation

2010-03-25 Thread Cam Macdonell
This avoids the need of using qemu_ram_alloc and mmap with MAP_FIXED to map a host file into guest RAM. This function mmaps the opened file anywhere and adds the memory to the ram blocks. Usage is qemu_ram_mmap(fd, size, MAP_SHARED, offset); --- cpu-common.h |1 + exec.c | 33

[PATCH v3 2/2] Inter-VM shared memory PCI device

2010-03-25 Thread Cam Macdonell
. + * + * Author: + * Cam Macdonell c...@cs.ualberta.ca + * + * Based On: cirrus_vga.c and rtl8139.c + * + * This code is licensed under the GNU GPL v2. + */ +#include sys/mman.h +#include sys/types.h +#include sys/socket.h +#include sys/io.h +#include sys/ioctl.h +#include sys/eventfd.h +#include hw.h

[PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Cam Macdonell
+1,235 @@ +/* + * UIO IVShmem Driver + * + * (C) 2009 Cam Macdonell + * based on Hilscher CIF card driver (C) 2007 Hans J. Koch h...@linutronix.de + * + * Licensed under GPL version 2 only. + * + */ + +#include linux/device.h +#include linux/module.h +#include linux/pci.h +#include linux/uio_driver.h

Re: [PATCH v3 0/2] Inter-VM shared memory PCI device

2010-03-25 Thread Cam Macdonell
On Thu, Mar 25, 2010 at 3:21 AM, Michael S. Tsirkin m...@redhat.com wrote: On Thu, Mar 25, 2010 at 11:04:54AM +0200, Avi Kivity wrote: Again, I recommend Rusty's virtio-pci for inspiration. Not just inspiration, how about building on virtio-pci? Virtio was discussed at good length last year

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Cam Macdonell
On Thu, Mar 25, 2010 at 3:15 AM, Michael S. Tsirkin m...@redhat.com wrote: On Thu, Mar 25, 2010 at 12:09:36AM -0600, Cam Macdonell wrote: This patch adds a driver for my shared memory PCI device using the uio_pci interface.  The driver has three memory regions.  The first memory region

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Cam Macdonell
On Thu, Mar 25, 2010 at 3:46 AM, Avi Kivity a...@redhat.com wrote: On 03/25/2010 08:09 AM, Cam Macdonell wrote: This patch adds a driver for my shared memory PCI device using the uio_pci interface.  The driver has three memory regions.  The first memory region is for device registers

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Cam Macdonell
On Thu, Mar 25, 2010 at 3:05 AM, Michael S. Tsirkin m...@redhat.com wrote: On Thu, Mar 25, 2010 at 12:09:36AM -0600, Cam Macdonell wrote: This patch adds a driver for my shared memory PCI device using the uio_pci interface.  The driver has three memory regions.  The first memory region

Re: [PATCH v3 0/2] Inter-VM shared memory PCI device

2010-03-25 Thread Cam Macdonell
On Thu, Mar 25, 2010 at 3:04 AM, Avi Kivity a...@redhat.com wrote: On 03/25/2010 08:08 AM, Cam Macdonell wrote: Support an inter-vm shared memory device that maps a shared-memory object as a PCI device in the guest.  This patch also supports interrupts between guest by communicating over

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-25 Thread Cam Macdonell
On Thu, Mar 25, 2010 at 10:34 AM, Michael S. Tsirkin m...@redhat.com wrote: On Thu, Mar 25, 2010 at 10:30:42AM -0600, Cam Macdonell wrote: On Thu, Mar 25, 2010 at 3:05 AM, Michael S. Tsirkin m...@redhat.com wrote: On Thu, Mar 25, 2010 at 12:09:36AM -0600, Cam Macdonell wrote: This patch adds

Re: [PATCH v3 0/2] Inter-VM shared memory PCI device

2010-03-25 Thread Cam Macdonell
On Thu, Mar 25, 2010 at 11:02 AM, Avi Kivity a...@redhat.com wrote: On 03/25/2010 06:50 PM, Cam Macdonell wrote: Please put the spec somewhere publicly accessible with a permanent URL.  I suggest a new qemu.git directory specs/.  It's more important than the code IMO. Sorry

Re: [PATCH v3 0/2] Inter-VM shared memory PCI device

2010-03-25 Thread Cam Macdonell
On Thu, Mar 25, 2010 at 11:48 AM, Avi Kivity a...@redhat.com wrote: On 03/25/2010 07:35 PM, Cam Macdonell wrote: Ah, I see.  You adjusted for the different behaviours in the driver. Still I recommend dropping the status register: this allows single-msi and PIRQ to behave the same way.  Also

Re: [Qemu-devel] Re: [PATCH v3 0/2] Inter-VM shared memory PCI device

2010-03-26 Thread Cam Macdonell
On Thu, Mar 25, 2010 at 7:32 PM, Jamie Lokier ja...@shareable.org wrote: Cam Macdonell wrote: An irqfd can only trigger a single vector in a guest.  Right now I only have one eventfd per guest.    So ioeventfd/irqfd restricts the current implementation to a single vector that a guest can

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-28 Thread Cam Macdonell
On Sat, Mar 27, 2010 at 11:48 AM, Avi Kivity a...@redhat.com wrote: On 03/26/2010 07:14 PM, Cam Macdonell wrote: I'm not familiar with the uio internals, but for the interface, an ioctl() on the fd to assign an eventfd to an MSI vector.  Similar to ioeventfd, but instead of mapping

Re: [PATCH v3 1/1] Shared memory uio_pci driver

2010-03-30 Thread Cam Macdonell
On Mon, Mar 29, 2010 at 2:59 PM, Avi Kivity a...@redhat.com wrote: On 03/28/2010 10:48 PM, Cam Macdonell wrote: On Sat, Mar 27, 2010 at 11:48 AM, Avi Kivitya...@redhat.com  wrote: On 03/26/2010 07:14 PM, Cam Macdonell wrote: I'm not familiar with the uio internals, but for the interface

device limit for kvm_io_bus

2010-03-30 Thread Cam Macdonell
Hi, I'm trying to use ioeventfds for notification between guests. After assigning a handful of ioeventfds I was getting a no space left on device error. The culprit seems to be that only 6 devices are allowed for a guest on the kvm IO bus. The comment indicates a somewhat low number was

Re: [GSoC 2010][RESEND] Shared memory transport between guest(s) and host

2010-04-07 Thread Cam Macdonell
On Wed, Apr 7, 2010 at 5:30 AM, Mohammed Gamal m.gamal...@gmail.com wrote: Hi, I am interested in the Shared memory transport between guest(s) and host project for GSoC 2010. The description of the project is pretty straightforward, but I am a little bit lost on some parts: 1- Is there any

[PATCH v4 0/3] PCI Shared memory device

2010-04-07 Thread Cam Macdonell
to eventfds. Only values of 1 are now written to ensure correct usage Cam Macdonell (3): Device specification for shared memory PCI device Support adding a file to qemu's ram allocation Inter-VM shared memory PCI device Makefile.target|3 + cpu-common.h

[PATCH v4 1/3] Device specification for shared memory PCI device

2010-04-07 Thread Cam Macdonell
--- docs/specs/ivshmem_device_spec.txt | 85 1 files changed, 85 insertions(+), 0 deletions(-) create mode 100644 docs/specs/ivshmem_device_spec.txt diff --git a/docs/specs/ivshmem_device_spec.txt b/docs/specs/ivshmem_device_spec.txt new file mode 100644

[PATCH v4 2/3] Support adding a file to qemu's ram allocation

2010-04-07 Thread Cam Macdonell
This avoids the need of using qemu_ram_alloc and mmap with MAP_FIXED to map a host file into guest RAM. This function mmaps the opened file anywhere and adds the memory to the ram blocks. Usage is qemu_ram_mmap(fd, size, MAP_SHARED, offset); --- cpu-common.h |1 + exec.c | 33

[PATCH v4 3/3] Inter-VM shared memory PCI device

2010-04-07 Thread Cam Macdonell
+ # Hardware support obj-i386-y = pckbd.o dma.o obj-i386-y += vga.o diff --git a/hw/ivshmem.c b/hw/ivshmem.c new file mode 100644 index 000..2ec6c2c --- /dev/null +++ b/hw/ivshmem.c @@ -0,0 +1,700 @@ +/* + * Inter-VM Shared Memory PCI device. + * + * Author: + * Cam Macdonell c

[PATCH v4] Shared memory uio_pci driver

2010-04-07 Thread Cam Macdonell
/uio_ivshmem.c b/drivers/uio/uio_ivshmem.c new file mode 100644 index 000..42ac9a7 --- /dev/null +++ b/drivers/uio/uio_ivshmem.c @@ -0,0 +1,252 @@ +/* + * UIO IVShmem Driver + * + * (C) 2009 Cam Macdonell + * based on Hilscher CIF card driver (C) 2007 Hans J. Koch h...@linutronix.de + * + * Licensed under

Re: [PATCH v4 1/3] Device specification for shared memory PCI device

2010-04-12 Thread Cam Macdonell
On Mon, Apr 12, 2010 at 3:34 PM, Avi Kivity a...@redhat.com wrote: On 04/08/2010 01:51 AM, Cam Macdonell wrote: (sorry about the late review) + +Regular Interrupts +-- + +If regular interrupts are used (due to either a guest not supporting MSI or the +user specifying

Re: [PATCH v4 3/3] Inter-VM shared memory PCI device

2010-04-14 Thread Cam Macdonell
On Mon, Apr 12, 2010 at 2:56 PM, Avi Kivity a...@redhat.com wrote: On 04/08/2010 01:52 AM, Cam Macdonell wrote: Support an inter-vm shared memory device that maps a shared-memory object as a PCI device in the guest.  This patch also supports interrupts between guest by communicating over

[PATCH v5 2/5] Support adding a file to qemu's ram allocation

2010-04-21 Thread Cam Macdonell
This avoids the need of using qemu_ram_alloc and mmap with MAP_FIXED to map a host file into guest RAM. This function mmaps the opened file anywhere and adds the memory to the ram blocks. Usage is qemu_ram_mmap(fd, size, MAP_SHARED, offset); --- cpu-common.h |2 ++ exec.c | 36

[PATCH v5 1/5] Device specification for shared memory PCI device

2010-04-21 Thread Cam Macdonell
--- docs/specs/ivshmem_device_spec.txt | 91 1 files changed, 91 insertions(+), 0 deletions(-) create mode 100644 docs/specs/ivshmem_device_spec.txt diff --git a/docs/specs/ivshmem_device_spec.txt b/docs/specs/ivshmem_device_spec.txt new file mode 100644

[PATCH v5 0/5] PCI Shared Memory device

2010-04-21 Thread Cam Macdonell
. Only values of 1 are now written to ensure correct usage Cam Macdonell (5): Device specification for shared memory PCI device Support adding a file to qemu's ram allocation Adds two new functions for assigning ioeventfd and irqfds. Inter-VM shared memory PCI device the stand-alone

[PATCH v5 3/5] Add functions for assigning ioeventfd and irqfds.

2010-04-21 Thread Cam Macdonell
Generic functions to assign irqfds and ioeventfds. --- kvm-all.c | 44 kvm.h | 14 ++ 2 files changed, 58 insertions(+), 0 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index fb8d4b8..d5c7775 100644 --- a/kvm-all.c +++

[PATCH v5 4/5] Inter-VM shared memory PCI device

2010-04-21 Thread Cam Macdonell
@@ +/* + * Inter-VM Shared Memory PCI device. + * + * Author: + * Cam Macdonell c...@cs.ualberta.ca + * + * Based On: cirrus_vga.c and rtl8139.c + * + * This code is licensed under the GNU GPL v2. + */ +#include sys/mman.h +#include sys/types.h +#include sys/socket.h +#include sys/io.h +#include sys

[PATCH v5 5/5] shared memory server for inter-VM shared memory

2010-04-21 Thread Cam Macdonell
this code is a standalone server which will pass file descriptors for the shared memory region and eventfds to support interrupts between guests using inter-VM shared memory. --- contrib/ivshmem-server/Makefile | 16 ++ contrib/ivshmem-server/README | 30 +++

[PATCH v5 3/5] RESEND: function for assigning ioeventfds.

2010-04-21 Thread Cam Macdonell
Apologies, I wasn't on the latest KVM HEAD and so missed that Michael had added an irqfd assignment function (and a more correct one at that). So now this patch has just one function. --- kvm-all.c | 26 ++ kvm.h |7 +++ 2 files changed, 33 insertions(+), 0

Re: [PATCH v4] Shared memory uio_pci driver

2010-04-23 Thread Cam Macdonell
On Mon, Apr 12, 2010 at 2:57 PM, Avi Kivity a...@redhat.com wrote: There is work now to bring msi to the generic pci 2.3 driver, perhaps we can use that instead.  From a quick look it looks fine. I'd be interested to follow this development. I can't find anything on LKML, is it being

Re: [PATCH 10/10] introduce qemu_ram_map

2010-04-27 Thread Cam Macdonell
On Mon, Apr 26, 2010 at 12:54 PM, Anthony Liguori anth...@codemonkey.ws wrote: On 04/26/2010 01:49 PM, Marcelo Tosatti wrote: On Mon, Apr 26, 2010 at 01:27:30PM -0500, Anthony Liguori wrote: On 04/26/2010 12:59 PM, Marcelo Tosatti wrote: Which allows drivers to register an mmaped region

Re: [PATCH 10/10] introduce qemu_ram_map

2010-04-27 Thread Cam Macdonell
On Mon, Apr 26, 2010 at 11:59 AM, Marcelo Tosatti mtosa...@redhat.com wrote: Which allows drivers to register an mmaped region into ram block mappings. To be used by device assignment driver. CC: Cam Macdonell c...@cs.ualberta.ca Signed-off-by: Marcelo Tosatti mtosa...@redhat.com ---  cpu

Re: [Qemu-devel] Re: How to map PCI memory into the VM without trapping

2010-05-06 Thread Cam Macdonell
On Wed, May 5, 2010 at 5:20 PM, Frank Berreth frank...@google.com wrote: Hi there, this is just an update if you are interested in the outcome. I turns out that my initial assumption that there would be page faults/trapping on the memory pages was false. The reason the throughput is so low is

Re: [PATCH v5 4/5] Inter-VM shared memory PCI device

2010-05-06 Thread Cam Macdonell
On Thu, May 6, 2010 at 11:32 AM, Anthony Liguori anth...@codemonkey.ws wrote: On 04/21/2010 12:53 PM, Cam Macdonell wrote: Support an inter-vm shared memory device that maps a shared-memory object as a PCI device in the guest.  This patch also supports interrupts between guest

Re: [PATCH v5 4/5] Inter-VM shared memory PCI device

2010-05-10 Thread Cam Macdonell
On Mon, May 10, 2010 at 5:59 AM, Avi Kivity a...@redhat.com wrote: On 04/21/2010 08:53 PM, Cam Macdonell wrote: Support an inter-vm shared memory device that maps a shared-memory object as a PCI device in the guest.  This patch also supports interrupts between guest by communicating over

Re: [PATCH v5 2/5] Support adding a file to qemu's ram allocation

2010-05-10 Thread Cam Macdonell
On Mon, May 10, 2010 at 4:39 AM, Avi Kivity a...@redhat.com wrote: On 04/21/2010 08:53 PM, Cam Macdonell wrote: This avoids the need of using qemu_ram_alloc and mmap with MAP_FIXED to map a host file into guest RAM.  This function mmaps the opened file anywhere and adds the memory

Re: [PATCH v5 4/5] Inter-VM shared memory PCI device

2010-05-10 Thread Cam Macdonell
On Mon, May 10, 2010 at 9:28 AM, Avi Kivity a...@redhat.com wrote: On 05/10/2010 06:22 PM, Cam Macdonell wrote: + +    /* if the position is -1, then it's shared memory region fd */ +    if (incoming_posn == -1) { + +        s-num_eventfds = 0; + +        if (check_shm_size(s

Re: [PATCH v5 4/5] Inter-VM shared memory PCI device

2010-05-10 Thread Cam Macdonell
On Mon, May 10, 2010 at 9:38 AM, Anthony Liguori anth...@codemonkey.ws wrote: On 05/10/2010 10:28 AM, Avi Kivity wrote: On 05/10/2010 06:22 PM, Cam Macdonell wrote: + +    /* if the position is -1, then it's shared memory region fd */ +    if (incoming_posn == -1) { + +        s

Re: [PATCH v5 4/5] Inter-VM shared memory PCI device

2010-05-10 Thread Cam Macdonell
On Mon, May 10, 2010 at 10:40 AM, Avi Kivity a...@redhat.com wrote: On 05/10/2010 06:41 PM, Cam Macdonell wrote: What would happen to any data written to the BAR before the the handshake completed?  I think it would disappear. But, the BAR isn't there until the handshake is completed.  Only

Re: [PATCH v5 4/5] Inter-VM shared memory PCI device

2010-05-10 Thread Cam Macdonell
On Mon, May 10, 2010 at 11:25 AM, Anthony Liguori anth...@codemonkey.ws wrote: On 05/10/2010 11:59 AM, Avi Kivity wrote: On 05/10/2010 06:38 PM, Anthony Liguori wrote: Otherwise, if the BAR is allocated during initialization, I would have to use MAP_FIXED to mmap the memory.  This is what I

Re: [PATCH v5 4/5] Inter-VM shared memory PCI device

2010-05-10 Thread Cam Macdonell
On Mon, May 10, 2010 at 11:52 AM, Anthony Liguori anth...@codemonkey.ws wrote: On 05/10/2010 12:43 PM, Cam Macdonell wrote: On Mon, May 10, 2010 at 11:25 AM, Anthony Liguorianth...@codemonkey.ws  wrote: On 05/10/2010 11:59 AM, Avi Kivity wrote: On 05/10/2010 06:38 PM, Anthony Liguori

Re: [PATCH v5 4/5] Inter-VM shared memory PCI device

2010-05-10 Thread Cam Macdonell
On Mon, May 10, 2010 at 5:59 AM, Avi Kivity a...@redhat.com wrote: On 04/21/2010 08:53 PM, Cam Macdonell wrote: Support an inter-vm shared memory device that maps a shared-memory object as a PCI device in the guest.  This patch also supports interrupts between guest by communicating over

Re: [PATCH v5 4/5] Inter-VM shared memory PCI device

2010-05-11 Thread Cam Macdonell
On Tue, May 11, 2010 at 8:03 AM, Avi Kivity a...@redhat.com wrote: On 05/11/2010 04:10 PM, Anthony Liguori wrote: On 05/11/2010 02:59 AM, Avi Kivity wrote: (Replying again to list) What data structure would you use?  For a lockless ring queue, you can only support a single producer and

Re: [PATCH v5 4/5] Inter-VM shared memory PCI device

2010-05-11 Thread Cam Macdonell
On Tue, May 11, 2010 at 9:51 AM, Anthony Liguori anth...@codemonkey.ws wrote: On 05/11/2010 09:53 AM, Avi Kivity wrote: On 05/11/2010 05:17 PM, Cam Macdonell wrote: The master is the shared memory area.  It's a completely separate entity that is represented by the backing file (or shared

Re: [PATCH v5 4/5] Inter-VM shared memory PCI device

2010-05-11 Thread Cam Macdonell
On Tue, May 11, 2010 at 11:05 AM, Anthony Liguori anth...@codemonkey.ws wrote: On 05/11/2010 11:39 AM, Cam Macdonell wrote: Most of the people I hear from who are using my patch are using a peer model to share data between applications (simulations, JVMs, etc). But guest-to-host applications

Re: [PATCH v5 4/5] Inter-VM shared memory PCI device

2010-05-12 Thread Cam Macdonell
On Tue, May 11, 2010 at 12:13 PM, Avi Kivity a...@redhat.com wrote: On 05/11/2010 08:05 PM, Anthony Liguori wrote: On 05/11/2010 11:39 AM, Cam Macdonell wrote: Most of the people I hear from who are using my patch are using a peer model to share data between applications (simulations, JVMs

Re: [PATCH v5 4/5] Inter-VM shared memory PCI device

2010-05-12 Thread Cam Macdonell
On Wed, May 12, 2010 at 9:49 AM, Avi Kivity a...@redhat.com wrote: On 05/10/2010 07:48 PM, Cam Macdonell wrote: On Mon, May 10, 2010 at 10:40 AM, Avi Kivitya...@redhat.com  wrote: On 05/10/2010 06:41 PM, Cam Macdonell wrote: What would happen to any data written to the BAR before

Re: [PATCH v5 4/5] Inter-VM shared memory PCI device

2010-05-13 Thread Cam Macdonell
On Mon, May 10, 2010 at 5:59 AM, Avi Kivity a...@redhat.com wrote: On 04/21/2010 08:53 PM, Cam Macdonell wrote: + +        /* allocate/initialize space for interrupt handling */ +        s-eventfds = qemu_mallocz(s-nr_alloc_guests * sizeof(int *)); +        s-eventfd_table = qemu_mallocz(s

Re: [PATCH v5 4/5] Inter-VM shared memory PCI device

2010-05-18 Thread Cam Macdonell
On Mon, May 10, 2010 at 10:52 AM, Anthony Liguori anth...@codemonkey.ws wrote: Yes, I think the ack is the way to go, so the guest has to be aware of it.  Would setting a flag in the driver-specific config space be an acceptable ack that the shared region is now mapped? You know it's mapped

[PATCH RFC 1/2] Change phys_ram_dirty to phys_ram_status

2010-05-23 Thread Cam Macdonell
The phys_ram_dirty array consists of 8-bit values for storing 3 dirty bits. Change to more generic phys_ram_flags and use lower 4-bits for dirty status and leave upper 4 for other uses of marking memory pages. One potential use for upper bits is to mark certain device pages to not be migrated.

[PATCH RFC 2/2] Add support for marking memory to not be migrated

2010-05-23 Thread Cam Macdonell
Non-migrated memory is useful for devices that do not want to take memory region data with them on migration. As suggested by Avi, an alternative approach could add a flags parameter to cpu_register_physical_memory() rather than explicityly call cpu_mark_pages_no_migrate(). However, having a

[PATCH v6 2/6] Add function to assign ioeventfd to MMIO.

2010-06-04 Thread Cam Macdonell
--- kvm-all.c | 32 kvm.h |1 + 2 files changed, 33 insertions(+), 0 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 47f58a6..2982631 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1257,6 +1257,38 @@ int kvm_set_signal_mask(CPUState *env, const

[PATCH v6 3/6] Change phys_ram_dirty to phys_ram_status

2010-06-04 Thread Cam Macdonell
phys_ram_dirty are 8-bit values storing 3 dirty bits. Change to more generic phys_ram_flags and use lower 4-bits for dirty status and leave upper 4 for other uses. The names of functions may need to be changed as well, such as c_p_m_get_dirty(). --- cpu-all.h | 16 +--- exec.c

[PATCH v6 0/6] Inter-VM Shared Memory Device with migration support

2010-06-04 Thread Cam Macdonell
: - moved to single Doorbell register and use datamatch to trigger different VMs rather than one register per eventfd - remove writing arbitrary values to eventfds. Only values of 1 are now written to ensure correct usage Cam Macdonell (6): Device specification for shared memory PCI

[PATCH v6 4/6] Add support for marking memory to not be migrated. On migration, memory is checked for the NO_MIGRATION_FLAG.

2010-06-04 Thread Cam Macdonell
This is useful for devices that do not want to take memory regions data with them on migration. --- arch_init.c | 28 cpu-all.h|2 ++ cpu-common.h |2 ++ exec.c | 12 4 files changed, 32 insertions(+), 12 deletions(-) diff --git

[PATCH v6 5/6] Inter-VM shared memory PCI device

2010-06-04 Thread Cam Macdonell
/ivshmem.c @@ -0,0 +1,852 @@ +/* + * Inter-VM Shared Memory PCI device. + * + * Author: + * Cam Macdonell c...@cs.ualberta.ca + * + * Based On: cirrus_vga.c + * Copyright (c) 2004 Fabrice Bellard + * Copyright (c) 2004 Makoto Suzuki (suzu) + * + * and rtl8139.c

[PATCH v6 6/6] the stand-alone shared memory server for inter-VM shared memory

2010-06-04 Thread Cam Macdonell
this code is a standalone server which will pass file descriptors for the shared memory region and eventfds to support interrupts between guests using inter-VM shared memory. --- contrib/ivshmem-server/Makefile | 16 ++ contrib/ivshmem-server/README | 30 +++

[PATCH v6] Shared memory uio_pci driver

2010-06-04 Thread Cam Macdonell
+ * + * (C) 2009 Cam Macdonell + * based on Hilscher CIF card driver (C) 2007 Hans J. Koch h...@linutronix.de + * + * Licensed under GPL version 2 only. + * + */ + +#include linux/device.h +#include linux/module.h +#include linux/pci.h +#include linux/uio_driver.h + +#include asm/io.h + +#define

Re: [Qemu-devel] [PATCH v6 5/6] Inter-VM shared memory PCI device

2010-06-07 Thread Cam Macdonell
On Sat, Jun 5, 2010 at 3:44 AM, Blue Swirl blauwir...@gmail.com wrote: On Fri, Jun 4, 2010 at 9:45 PM, Cam Macdonell c...@cs.ualberta.ca wrote: Support an inter-vm shared memory device that maps a shared-memory object as a PCI device in the guest.  This patch also supports interrupts between

Re: Add a qemu interface for sharing memory between guests.

2009-10-14 Thread Cam Macdonell
On Mon, Oct 12, 2009 at 2:55 AM, Avi Kivity a...@redhat.com wrote: On 10/12/2009 08:53 AM, Sivaram Kannan wrote: Hi all, I am a KVM newbie and I picked up the following task from the TODO of the KVM wiki. Add a qemu interface for sharing memory between guests. Using a pci device to

Re: [Qemu-devel] [RFC PATCH 2/6] ram_blocks: Convert to a QLIST

2010-06-09 Thread Cam Macdonell
On Tue, Jun 8, 2010 at 1:15 PM, Alex Williamson alex.william...@redhat.com wrote: This makes the RAM block list easier to manipulate.  Also incorporate relevant variables into the RAMList struct. Signed-off-by: Alex Williamson alex.william...@redhat.com ---  arch_init.c |   14 ++-  

Re: [PATCH v6 0/6] Inter-VM Shared Memory Device with migration support

2010-06-11 Thread Cam Macdonell
Hi Anthony, Is my implementation of master/peer roles acceptable? I realize with Alex's RAMList changes I may need to modify my patch, but is the approach of marking memory non-migratable an acceptable implementation? Thanks, Cam On Fri, Jun 4, 2010 at 3:45 PM, Cam Macdonell c

Re: [Qemu-devel] [PATCH v6 4/6] Add support for marking memory to not be migrated. On migration, memory is checked for the NO_MIGRATION_FLAG.

2010-06-14 Thread Cam Macdonell
On Mon, Jun 14, 2010 at 9:51 AM, Anthony Liguori anth...@codemonkey.ws wrote: On 06/04/2010 04:45 PM, Cam Macdonell wrote: This is useful for devices that do not want to take memory regions data with them on migration. ---  arch_init.c  |   28  cpu-all.h

Re: [Qemu-devel] [PATCH v6 6/6] the stand-alone shared memory server for inter-VM shared memory

2010-06-14 Thread Cam Macdonell
On Mon, Jun 14, 2010 at 9:53 AM, Anthony Liguori anth...@codemonkey.ws wrote: On 06/04/2010 04:45 PM, Cam Macdonell wrote: this code is a standalone server which will pass file descriptors for the shared memory region and eventfds to support interrupts between guests using inter-VM shared

[PATCH RFC] Mark a device as non-migratable

2010-06-15 Thread Cam Macdonell
How does this look for marking the device as non-migratable? It adds a field 'no_migrate' to the SaveStateEntry and tests for it in vmstate_save. This would replace anything that touches memory. Cam --- hw/hw.h |1 + savevm.c | 32 +--- 2 files changed, 30

[PATCH v7 3/4] Support marking a device as non-migratable

2010-06-15 Thread Cam Macdonell
A non-migratable device should be removed before migration and re-added after. Signed-off-by: Cam Macdonell c...@cs.ualberta.ca --- hw/hw.h |1 + savevm.c | 32 +--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/hw/hw.h b/hw/hw.h index d78d814

[PATCH v7 2/4] Add function to assign ioeventfd to MMIO.

2010-06-15 Thread Cam Macdonell
Signed-off-by: Cam Macdonell c...@cs.ualberta.ca --- kvm-all.c | 32 kvm.h |1 + 2 files changed, 33 insertions(+), 0 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 47f58a6..2982631 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1257,6 +1257,38

[PATCH v7 4/4] Inter-VM shared memory PCI device

2010-06-15 Thread Cam Macdonell
=path,id=id The shared memory server, sample programs and init scripts are in a git repo here: www.gitorious.org/nahanni Signed-off-by: Cam Macdonell c...@cs.ualberta.ca --- Makefile.target |3 + hw/ivshmem.c| 823 +++ qemu-char.c

[PATCH v7 1/4] Device specification for shared memory PCI device

2010-06-15 Thread Cam Macdonell
Signed-off-by: Cam Macdonell c...@cs.ualberta.ca --- docs/specs/ivshmem_device_spec.txt | 96 1 files changed, 96 insertions(+), 0 deletions(-) create mode 100644 docs/specs/ivshmem_device_spec.txt diff --git a/docs/specs/ivshmem_device_spec.txt b/docs

[PATCH v7 0/4] Inter-VM shared memory device

2010-06-15 Thread Cam Macdonell
: - moved to single Doorbell register and use datamatch to trigger different VMs rather than one register per eventfd - remove writing arbitrary values to eventfds. Only values of 1 are now written to ensure correct usage Cam Macdonell (4): Device specification for shared memory PCI

Re: [PATCH RFC] Mark a device as non-migratable

2010-06-15 Thread Cam Macdonell
On Tue, Jun 15, 2010 at 10:32 AM, Anthony Liguori anth...@codemonkey.ws wrote: On 06/15/2010 11:16 AM, Cam Macdonell wrote: How does this look for marking the device as non-migratable?  It adds a field 'no_migrate' to the SaveStateEntry and tests for it in vmstate_save.  This would replace

[PATCH v7 RESEND 4/4] Inter-VM shared memory PCI device

2010-06-23 Thread Cam Macdonell
][,role=peer|master] -chardev socket,path=path,id=id The shared memory server, sample programs and init scripts are in a git repo here: www.gitorious.org/nahanni Signed-off-by: Cam Macdonell c...@cs.ualberta.ca --- Makefile.target |3 + hw/ivshmem.c| 828

Re: [Qemu-devel] KVM call minutes for July 6

2010-07-06 Thread Cam Macdonell
On Tue, Jul 6, 2010 at 8:46 AM, Juan Quintela quint...@redhat.com wrote: Today was a short call as Anthony didn't attend. - Jes reminded people that Linux Plumbers deadline is July 19th - Qemu 0.13 (from the agenda, we didn't discuss it without Anthony). List of patches missing

[PATCH v7 RESEND 4/4] Inter-VM shared memory PCI device

2010-07-08 Thread Cam Macdonell
][,msi=on][,irqfd=on][,vectors=n][,role=peer|master] -chardev socket,path=path,id=id The shared memory server, sample programs and init scripts are in a git repo here: www.gitorious.org/nahanni Signed-off-by: Cam Macdonell c...@cs.ualberta.ca --- Makefile.target |3 + hw/ivshmem.c

Re: [Qemu-devel] [PATCH v7 0/4] Inter-VM shared memory device

2010-07-26 Thread Cam Macdonell
On Mon, Jul 26, 2010 at 7:48 AM, Anthony Liguori anth...@codemonkey.ws wrote: On 06/15/2010 03:23 PM, Cam Macdonell wrote: Latest patch for PCI shared memory device that maps a host shared memory object to be shared between guests Is this against qemu.git or qemu-kvm.git?  It depends

Re: [Qemu-devel] [PATCH v7 0/4] Inter-VM shared memory device

2010-07-26 Thread Cam Macdonell
On Mon, Jul 26, 2010 at 1:51 PM, Avi Kivity a...@redhat.com wrote:  On 07/26/2010 10:01 PM, Cam Macdonell wrote: Is this against qemu.git or qemu-kvm.git?  It depends on functions like qemu_ram_map() which are not present in qemu.git (and are present in qemu-kvm.git). It is against qemu

Re: [Qemu-devel] [PATCH v7 0/4] Inter-VM shared memory device

2010-07-26 Thread Cam Macdonell
On Mon, Jul 26, 2010 at 2:11 PM, Avi Kivity a...@redhat.com wrote:  On 07/26/2010 11:03 PM, Cam Macdonell wrote: Please add qemu_ram_map() as a separate patch to avoid interdependencies.  Try to keep it at the same place etc., that will reduce merge difficulties later. qemu_ram_map() isn't

[PATCH v8 0/5] Inter-VM Shared Memory Device

2010-07-26 Thread Cam Macdonell
arbitrary values to eventfds. Only values of 1 are now written to ensure correct usage Cam Macdonell (5): Provide a function to add an allocated region of memory to the qemu RAM. Device specification for shared memory PCI device Add function to assign ioeventfd to MMIO. Support marking

[PATCH v8 1/5] Add qemu_ram_alloc_from_ptr function

2010-07-26 Thread Cam Macdonell
Provide a function to add an allocated region of memory to the qemu RAM. This patch is copied from Marcelo's qemu_ram_map() in qemu-kvm and given the clearer name qemu_ram_alloc_from_ptr(). Signed-off-by: Cam Macdonell c...@cs.ualberta.ca --- cpu-common.h |2 ++ exec.c | 43

[PATCH v8 3/5] Add function to assign ioeventfd to MMIO.

2010-07-26 Thread Cam Macdonell
Signed-off-by: Cam Macdonell c...@cs.ualberta.ca --- kvm-all.c | 32 kvm.h |1 + 2 files changed, 33 insertions(+), 0 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 7635f2f..d9a5dd0 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1241,6 +1241,38

[PATCH v8 4/5] Support marking a device as non-migratable

2010-07-26 Thread Cam Macdonell
A non-migratable device should be removed before migration and re-added after. Signed-off-by: Cam Macdonell c...@cs.ualberta.ca --- hw/hw.h |2 ++ savevm.c | 44 +--- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/hw/hw.h b/hw/hw.h

[PATCH v8 5/5] Inter-VM shared memory PCI device

2010-07-26 Thread Cam Macdonell
,path=path,id=id The shared memory server, sample programs and init scripts are in a git repo here: www.gitorious.org/nahanni Signed-off-by: Cam Macdonell c...@cs.ualberta.ca --- Makefile.target |3 + hw/ivshmem.c| 834 +++ qemu

[PATCH v8 5/5] RESEND: Inter-VM shared memory PCI device

2010-07-27 Thread Cam Macdonell
=on][,vectors=n][,role=peer|master] -chardev socket,path=path,id=id The shared memory server, sample programs and init scripts are in a git repo here: www.gitorious.org/nahanni Signed-off-by: Cam Macdonell c...@cs.ualberta.ca --- Makefile.target |3 + hw/ivshmem.c| 828

Re: [Qemu-devel] [PATCH v8 5/5] RESEND: Inter-VM shared memory PCI device

2010-08-11 Thread Cam Macdonell
On Wed, Aug 11, 2010 at 4:35 AM, Stefan Weil w...@mail.berlios.de wrote: Am 27.07.2010 18:54, schrieb Cam Macdonell: resend for bug fix related to removal of irqfd Support an inter-vm shared memory device that maps a shared-memory object as a PCI device in the guest. This patch also

[PATCH 2/2] Disable build of ivshmem on non-KVM systems

2010-08-11 Thread Cam Macdonell
--- Makefile.target |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Makefile.target b/Makefile.target index b791492..c8281e9 100644 --- a/Makefile.target +++ b/Makefile.target @@ -191,7 +191,7 @@ obj-y += rtl8139.o obj-y += e1000.o # Inter-VM PCI shared memory -obj-y

[PATCH 1/2] Add kvm_set_ioeventfd_mmio_long definition for non-KVM systems

2010-08-11 Thread Cam Macdonell
--- kvm-stub.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/kvm-stub.c b/kvm-stub.c index 3378bd3..d45f9fa 100644 --- a/kvm-stub.c +++ b/kvm-stub.c @@ -136,3 +136,8 @@ int kvm_set_ioeventfd_pio_word(int fd, uint16_t addr, uint16_t val, bool assign) { return

Re: [Qemu-devel] [PATCH 1/2] Add kvm_set_ioeventfd_mmio_long definition for non-KVM systems

2010-08-11 Thread Cam Macdonell
On Wed, Aug 11, 2010 at 2:28 PM, Stefan Weil w...@mail.berlios.de wrote: Am 11.08.2010 20:16, schrieb Cam Macdonell: --- kvm-stub.c | 5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/kvm-stub.c b/kvm-stub.c index 3378bd3..d45f9fa 100644 --- a/kvm-stub.c +++ b/kvm

[PATCH 1/2] RESEND: Add kvm_set_ioeventfd_mmio_long definition for non-KVM systems

2010-08-14 Thread Cam Macdonell
Signed-off-by: Cam Macdonell c...@cs.ualberta.ca --- kvm-stub.c |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/kvm-stub.c b/kvm-stub.c index 3378bd3..d45f9fa 100644 --- a/kvm-stub.c +++ b/kvm-stub.c @@ -136,3 +136,8 @@ int kvm_set_ioeventfd_pio_word(int fd, uint16_t

[PATCH 2/2] RESEND: Disable build of ivshmem on non-KVM systems

2010-08-14 Thread Cam Macdonell
Signed-off-by: Cam Macdonell c...@cs.ualberta.ca --- Makefile.target |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Makefile.target b/Makefile.target index b791492..c8281e9 100644 --- a/Makefile.target +++ b/Makefile.target @@ -191,7 +191,7 @@ obj-y += rtl8139.o obj-y

Re: [Qemu-devel] [PATCH 1/2] Add kvm_set_ioeventfd_mmio_long definition for non-KVM systems

2010-08-14 Thread Cam Macdonell
On Sat, Aug 14, 2010 at 11:24 AM, Andreas Färber andreas.faer...@web.de wrote: Am 11.08.2010 um 20:16 schrieb Cam Macdonell: --- kvm-stub.c |    5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/kvm-stub.c b/kvm-stub.c index 3378bd3..d45f9fa 100644 --- a/kvm-stub.c

Re: KVM ivshmem enquiry

2010-03-01 Thread Cam Macdonell
Hi Khaled, On Sun, Feb 28, 2010 at 1:20 PM, Khaled Ibrahim kz...@hotmail.com wrote: Cam,I am interested in the shared memory support you developed on  KVM, but the whole process is not very clear to me. I patched the kernel on the  guest OSs and used the samples codes found in

[PATCH] Driver to support shared memory device with inerrupts

2010-03-01 Thread Cam Macdonell
PCI device + * + * Copyright 2009 Cam Macdonell c...@cs.ualberta.ca + * + * Based on cirrusfb.c and 8139cp.c: + * Copyright 1999-2001 Jeff Garzik + * Copyright 2001-2004 Jeff Garzik + * + */ + +#include linux/init.h +#include linux/kernel.h +#include linux/module.h +#include linux

[PATCH] Support an inter-vm shared memory device that maps a shared-memory object

2010-03-01 Thread Cam Macdonell
: + * Cam Macdonell c...@cs.ualberta.ca + * + * Based On: cirrus_vga.c and rtl8139.c + * + * This code is licensed under the GNU GPL v2. + */ + +#include hw.h +#include console.h +#include pc.h +#include pci.h +#include sysemu.h + +#include qemu-common.h +#include sys/mman.h +#include sys/socket.h

Re: IVSHMEM and limits on shared memory

2010-03-03 Thread Cam Macdonell
On Wed, Mar 3, 2010 at 12:06 AM, Khaled Ibrahim kz...@hotmail.com wrote: Hi Cam, I used your patches successfully to support shared memory on KVM and used the test cases successfully, but qemu-kvm crashes when I increased the size of the shared memory.  I applied the ivshmem patch to

Re: IVSHMEM and limits on shared memory

2010-03-03 Thread Cam Macdonell
On Wed, Mar 3, 2010 at 3:38 PM, Khaled Ibrahim kz...@hotmail.com wrote: Date: Wed, 3 Mar 2010 15:09:17 -0700 Subject: Re: IVSHMEM and limits on shared memory From: c...@cs.ualberta.ca To: kz...@hotmail.com CC: kvm@vger.kernel.org On Wed, Mar 3,

Re: IVSHMEM and limits on shared memory

2010-03-04 Thread Cam Macdonell
On Thu, Mar 4, 2010 at 1:12 PM, Khaled Ibrahim kz...@hotmail.com wrote: As a test, I removed anywhere my patch stored the size of the shared memory region and hard coded the size of 512 MB into qemu_ram_alloc and pci_register_bar, so that my patch never writes the size of the memory region

[PATCH] Inter-VM shared memory PCI device

2010-03-05 Thread Cam Macdonell
ide/pci.o ide/piix.o obj-i386-y += pckbd.o $(sound-obj-y) dma.o diff --git a/hw/ivshmem.c b/hw/ivshmem.c new file mode 100644 index 000..aa88c07 --- /dev/null +++ b/hw/ivshmem.c @@ -0,0 +1,561 @@ +/* + * Inter-VM Shared Memory PCI device. + * + * Author: + * Cam Macdonell c

[PATCH] Support adding a file to qemu's ram allocation

2010-03-05 Thread Cam Macdonell
This avoids the need of using qemu_ram_alloc and mmap with MAP_FIXED to map a host file into guest RAM. This function mmaps the opened file anywhere and adds the memory to the ram blocks. Usage is qemu_add_file_to_ram(fd, size, MAP_SHARED); --- cpu-common.h |1 + exec.c | 33

  1   2   >