|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] Grant tables from dom0 userspace?
> 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
|
|
|
|
|