All of lore.kernel.org
 help / color / mirror / Atom feed
* questions regarding grant tables
@ 2005-04-26  4:25 Tzvika Chumash
  2005-04-26 21:04 ` Christopher Clark
  0 siblings, 1 reply; 2+ messages in thread
From: Tzvika Chumash @ 2005-04-26  4:25 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1442 bytes --]

Hi,

I was very happy to see that grant-tables were implemented and even had a nice text file to explain what to do.. however, being new to Xen, i'm missing a few key pieces of information to make it work:

it says that to make it work on the domA side, you have to do the following:

domA:  #include <asm-xen/gnttab.h>
        grant_ref_t gref[BATCH_SIZE];

        for ( i = 0; i < BATCH_SIZE; i++ )
            gref[i] = gnttab_grant_foreign_access( domBid, mfn, (readonly ? 1 : 0) );

1) how do you get domBid ? (i'm assuming it's the same ID that appears in the "xm list"), is there some API that can retrieve it? 

2) mfn -- i've seen people post stuff about virt_to_machine(), but I could not get it to work.. are there any special include files or compiler directives that one needs to add to be able to work with that? also, if this page was previously allocated by kmalloc() is that address considered virtual or physical? what do i need to do to get the mfn from the pointer?

3) to transfer gref to domB, would you use event_channel_op() ? if so, how?

if anyone knows these answers, please point me at some implementation example.. i wish there were some compilable skeleton examples of using the various xen mechanisms...... the documentation seems to contain only an index of the available features, without detailed manual-style explanation of the various include files,parameters,return values, bugs, etc..

Thanks,

Tzvika.

[-- Attachment #1.2: Type: text/html, Size: 2769 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: questions regarding grant tables
  2005-04-26  4:25 questions regarding grant tables Tzvika Chumash
@ 2005-04-26 21:04 ` Christopher Clark
  0 siblings, 0 replies; 2+ messages in thread
From: Christopher Clark @ 2005-04-26 21:04 UTC (permalink / raw)
  To: Tzvika Chumash; +Cc: xen-devel

On 4/25/05, Tzvika Chumash <tzvika@rutgers.edu> wrote:
>   
>  gref[i] = gnttab_grant_foreign_access( domBid, mfn, (readonly ? 1 : 0) );
>  
> 1) how do you get domBid ? (i'm assuming it's the same ID that appears in
> the "xm list"), is there some API that can retrieve it? 

Your ID assumption is correct.

How do you identify the domain you wish to share with? Do you know the
name it has been given? Or an IP address it is using?
I suspect you're looking for a name service and there isn't one at the moment.

xend performs domain id exchange for connecting device driver domains
to their connecting guests. The dom0 op DOM0_GETDOMAININFO might be
useful to you for name<->id conversion, but you'll need to establish a
communication channel to some process in dom0 to do that lookup for
you (I think). hooking a daemon into xcs would be my suggestion.

> 2) mfn -- i've seen people post stuff about virt_to_machine(), but I could
> not get it to work.. are there any special include files or compiler
> directives that one needs to add to be able to work with that?

No.

> also, if this page was previously allocated by kmalloc() is that address
> considered virtual or physical?

virtual, otherwise you couldn't immediately use that pointer.

> what do i need to do to get the mfn from the pointer? 

Don't use kmalloc. __get_free_page is more useful.

eg.
p = __get_free_page(GFP_KERNEL);
machine_address = virt_to_machine(p);
mfn = machine_address >> PAGE_SHIFT;

> 3) to transfer gref to domB, would you use event_channel_op() ? if so, how? 

No. Events are for notifications only; they aren't useful for sending
data. It's used to notify the other domain that you've written
something into the shared frame.

You need an already existing communication channel to domB to send the
reference on.
eg. a tcp connection
Once you have established a single shared page, you can then use that
to transmit grant references. See ring.h for useful macros for using a
shared page between domains.

> if anyone knows these answers, please point me at some implementation
> example..

grep grant linux-2.6.11-xen-sparse/drivers/xen/blkfront/*.c
linux-2.6.11-xen-sparse/drivers/xen/blkback/*.c

> i wish there were some compilable skeleton examples of using the
> various xen mechanisms......
> the documentation seems to contain only an
> index of the available features, without detailed manual-style explanation
> of the various include files,parameters,return values, bugs, etc.. 

...

Christopher

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-04-26 21:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-26  4:25 questions regarding grant tables Tzvika Chumash
2005-04-26 21:04 ` Christopher Clark

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.