From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NohCd-0002fm-Hy for qemu-devel@nongnu.org; Mon, 08 Mar 2010 12:57:15 -0500 Received: from [199.232.76.173] (port=60991 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NohCd-0002fe-4N for qemu-devel@nongnu.org; Mon, 08 Mar 2010 12:57:15 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NohCb-0007x3-5P for qemu-devel@nongnu.org; Mon, 08 Mar 2010 12:57:14 -0500 Received: from mail-iw0-f171.google.com ([209.85.223.171]:51520) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NohCa-0007we-PA for qemu-devel@nongnu.org; Mon, 08 Mar 2010 12:57:12 -0500 Received: by iwn1 with SMTP id 1so342724iwn.22 for ; Mon, 08 Mar 2010 09:57:09 -0800 (PST) MIME-Version: 1.0 Sender: camm@ualberta.ca In-Reply-To: <4B94C9B3.1060904@redhat.com> References: <1267833161-25267-1-git-send-email-cam@cs.ualberta.ca> <1267833161-25267-2-git-send-email-cam@cs.ualberta.ca> <4B94C9B3.1060904@redhat.com> Date: Mon, 8 Mar 2010 10:57:08 -0700 Message-ID: <8286e4ee1003080957v9bb4837x187cebb8477348c2@mail.gmail.com> From: Cam Macdonell Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Re: [PATCH] Inter-VM shared memory PCI device List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org On Mon, Mar 8, 2010 at 2:56 AM, Avi Kivity wrote: > On 03/06/2010 01:52 AM, Cam Macdonell wrote: >> >> Support an inter-vm shared memory device that maps a shared-memory objec= t >> as a PCI device in the guest. =A0This patch also supports interrupts bet= ween >> guest by communicating over a unix domain socket. =A0This patch applies = to >> the >> qemu-kvm repository. >> >> This device now creates a qemu character device and sends 1-bytes messag= es >> to >> trigger interrupts. =A0Writes are trigger by writing to the "Doorbell" >> register >> on the shared memory PCI device. =A0The lower 8-bits of the value writte= n to >> this >> register are sent as the 1-byte message so different meanings of >> interrupts can >> be supported. >> >> Interrupts are supported between multiple VMs by using a shared memory >> server >> >> -ivshmem,[unix:][file] >> >> Interrupts can also be used between host and guest as well by implementi= ng >> a >> listener on the host that talks to shared memory server. =A0The shared >> memory >> server passes file descriptors for the shared memory object and eventfds >> (our >> interrupt mechanism) to the respective qemu instances. >> >> > > Can you provide a spec that describes the device? =A0This would be useful= for > maintaining the code, writing guest drivers, and as a framework for revie= w. I'm not sure if you want the Qemu command-line part as part of the spec here, but I've included for completeness. Device Specification for Inter-VM shared memory device ---------------------------------------------------------------------------= -------- Qemu Command-line ------------------------------- The command-line for inter-vm shared memory is as follows -ivshmem ,[unix:]name the argument specifies the size of the shared memory object. The se= cond option specifies either a unix domain socket (when using the unix: prefix) = or a name for the shared memory object. If a unix domain socket is specified, the guest will receive the shared obj= ect from the shared memory server listening on that socket and will support interrupts with the other guests using that server. Each server only serve= s one memory object. If a name is specified on the command line (without 'unix:'), then the gues= t will open the POSIX shared memory object with that name (in /dev/shm) and t= he specified size. The guest will NOT support interrupts but the shared memor= y object can be shared between multiple guests. The Inter-VM Shared Memory PCI device ----------------------------------------------------------- BARs The device supports two BARs. BAR0 is a 256-byte MMIO region to support registers and BAR1 is used to map the shared memory object from the host. The size o= f BAR1 is specified on the command-line and must be a power of 2 in size. Registers BAR0 currently supports 5 registers of 16-bits each. Registers are used for synchronization between guests sharing the same memory object when interrupts are supported (this requires using the shared memory server). When using interrupts, VMs communicate with a shared memory server that pas= ses the shared memory object file descriptor using SCM_RIGHTS. The server assi= gns each VM an ID number and sends this ID number to the Qemu process along wit= h a series of eventfd file descriptors, one per guest using the shared memory server. These eventfds will be used to send interrupts between guests. Ea= ch guest listens on the eventfd corresponding to their ID and may use the othe= rs for sending interrupts to other guests. enum ivshmem_registers { IntrMask =3D 0, IntrStatus =3D 2, Doorbell =3D 4, IVPosition =3D 6, IVLiveList =3D 8 }; The first two registers are the interrupt mask and status registers. Interrupts are triggered when a message is received on the guest's eventfd = from another VM. Writing to the 'Doorbell' register is how synchronization mess= ages are sent to other VMs. The IVPosition register is read-only and reports the guest's ID number. Th= e IVLiveList register is also read-only and reports a bit vector of currently live VM IDs. The Doorbell register is 16-bits, but is treated as two 8-bit values. The upper 8-bits are used for the destination VM ID. The lower 8-bits are the value which will be written to the destination VM and what the guest status register will be set to when the interrupt is trigger is the destination gu= est. A value of 255 in the upper 8-bits will trigger a broadcast where the messa= ge will be sent to all other guests. Cheers, Cam > > -- > error compiling committee.c: too many arguments to function > >