WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Grant tables from dom0 userspace?

To: "Keir Fraser" <Keir.Fraser@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] Grant tables from dom0 userspace?
From: "Andrew Warfield" <andrew.warfield@xxxxxxxxxxxx>
Date: Thu, 9 Mar 2006 10:30:44 -0800
Cc: xen-devel Devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Jacob Gorm Hansen <jacobg@xxxxxxx>
Delivery-date: Thu, 09 Mar 2006 18:31:32 +0000
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=eojdx8Wwf16/Vis5Jlw0L8t537et8OPOlFNuA1kCBL/ULg+raKsYnnOjI9whTPIjt/MlTECEYT0UsFcYMJtr3pfKJdEBH/j9snP7PylFYKlYszklsDgyaSUyJG78yHLZiFqDviy3x5vp2btz5mE28uyihL3s2+5viaVKk/8cu2s=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <7fdff686d4d5e2619fb843154f88b882@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <e08041f30603090959q6ef7954epe2944f2dd9d58acf@xxxxxxxxxxxxxx> <7fdff686d4d5e2619fb843154f88b882@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
> I think blktap gives an example how to do this, but it might be
> specific to aio right now. You could probably use some of the same
> hooks to provide a device file that you could mmap(), passing grant
> refs to map. I cc'ed Andy Warfield in case he has any ideas...

The blktap code in unstable is a bit out of date at the moment, but
should have sufficient examples to do what you want.  Because of AIO,
the code in there arranges for parallel user and kernel mappings, and
then annotates the vm area so that get_user_pages can find the
appropriate page_struct when AIO requests are decoded down into BIOs. 
If you just want to mmap some memory from another domain into user
through a char device, then you can trim a lot of that code out.

In linux/drivers/xen/blktap/blktap.c:

dispatch_rw_block_io() -- decodes a batch of block requests, and maps
the grants to kernel and user.  As I say, you should be able to leave
out all the kernel mappings and vm area updates.

blktap_read_ufe_ring() -- does the associated unmappings.

There's a bunch of code at the top to set up the device node and
manage the mmap area.

The code is a bit dated, but maybe it's helpful...

a.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel