From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: Mapping Data between Dom0 and DomU Date: Thu, 08 Jan 2015 02:01:36 +0000 Message-ID: <54ADE500.4080003@citrix.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Christian Refvik , "xen-devel@lists.xenproject.org" , "win-pv-devel@lists.xenproject.org" List-Id: xen-devel@lists.xenproject.org On 08/01/2015 01:22, Christian Refvik wrote: > Hello, > > My name is Christian and I am new to Xen development, and I've been struggling a bit. I'm trying to develop a device driver so that a Windows 2012 Server VM has a way to send about 10MB of data to a CentOS VM. There is no real device on the backend, I just need a way to constantly send a large buffer between DomU and Dom0 using a zero copy solution. > > I wrote a Linux device driver (simple char device) in Dom0 which allocates the memory and reserves the pages. However, I'm not sure how to offer these pages to the Windows VM. I also have a Windows device driver that I've installed in the Windows VM, but again I'm not sure how to connect the two drivers. > > I've been browsing the QEMU source code, the Windows PV source code, the Xen source code, and the "Definitive Guide to the Xen Hypervisor" for answers. Unfortunately, I am a bit lost. I'm hoping someone with some experience with shared data communication between Dom0 and DomU can point me at some source files to study in order to figure out how to implement what I'm trying to do. A tutorial, sample code, and/or general direction would be great. > > Thanks for your help, > Christian You will want to use grants, and in particular grant mappings, which is the Xen interface for creating shared memory between VMs. The basic premise is that domain A nominates some of its pages to be grantable. Domain A gives the grant references to domain B (usually negotiated via xenstore), which allows domain B to make a mapping of domain A's nominated pages. A relevant bit of code to look at would be tools/libvchan/ , which as far as I am aware does pretty much what you describe (but without the windows support). ~Andrew