Skip to contentSkip to conversation

Use of XEN_GUEST_HANDLE

DISCUSSION sandesh 3 participants 3 messages May 24, 2008

lore
Share & tools
lore

sandesh

author
#0 lore raw

Hi all,
I have recently started to go through xen source. I want to know the
usage of XEN_GUEST_HANDLE.
I see thats its just a macro which will prefix each data type with
__guest_handle_ . And DEFINE_XEN_GUEST_HANDLE(name) will just typedefs '__guest_handle_name' to be a pointer to a data type 'name ' .

What is the reason for such abstraction?

And how this XEN_GUEST_HANDLE different from 'guest_xc' field of 'struct xc_dom_image', which gets initialized with xc_handle.

I have serached the net extensively for answers, but unable to get any. So any info or pointers would be highly appriciated.

Thanks
-Sandesh

Signature · 2 lines
View this message in context: http://www.nabble.com/Use-of-XEN_GUEST_HANDLE-tp17357081p17357081.html
Sent from the Xen - Dev mailing list archive at Nabble.com.
#1 lore raw
Quoted 5 lines

I have recently started to go through xen source. I want to know the
usage of XEN_GUEST_HANDLE.
I see thats its just a macro which will prefix each data type with
__guest_handle_ . And DEFINE_XEN_GUEST_HANDLE(name) will just typedefs '__guest_handle_name' to be a pointer to a data type 'name ' .

I think this was introduced for use on non-x86 architectures where it wouldn't necessarily be possible to simply pass a virtual address to a data structure down to Xen. I'm not clear on the details but you can search for the discussion on the xen-devel list, it happened quite a long time ago but if you look for threads mentioning guest handles, Keir Fraser and Hollis Blanchard that should help you narrow it down ;-)

Quoted 1 line

What is the reason for such abstraction?

On x86, Xen lives at the top of the process address space, so it's possible to pass virtual address pointers to structures in the guest's application memory space (in practice, these are in the address space of the dom0 control processes) directly down to Xen. On other architectures such as PPC (which is not supported anymore, anyhow) Xen ran in physical addressing mode and so couldn't access virtual addresses directly at all.

The guest handle abstraction was put in place to allow PPC (and potentially other) ports to implement a different way of addressing structures that assumed less x86-like architecture behaviour.

I'm afraid I'm not familiar with the details, although if you look back in the hg history to before the PPC port was removed a few weeks ago you might be able to see some more examples of it being used. The IA64 port may use it too, I'm not sure...

Quoted 2 lines

And how this XEN_GUEST_HANDLE different from 'guest_xc' field of 'struct xc_dom_image', which gets initialized with xc_handle.

That's a completely different thing, actually. The xc_handle is just a file descriptor pointing to the privcmd interface in dom0. The control tools open the privcmd virtual file and then they call the integer file descriptor the "xc handle".

I'm not sure exactly why xc_handle values would be stored in guest_xc rather than elsewhere. Maybe that's just an easy way of keeping track of things.

Quoted 2 lines

I have serached the net extensively for answers, but unable to get any. So any info or pointers would be highly appriciated.

Hope this info helps. Also, since it's now in the mailing list archives I hope that anybody searching for this in future will find more useful information :-)

Cheers,
Mark

Signature · 1 line
Push Me Pull You - Distributed SCM tool (http://www.cl.cam.ac.uk/~maw48/pmpu/)
#2 lore raw
Quoted 2 lines · Mark Williamson

The guest handle abstraction was put in place to allow PPC (and potentially other) ports to implement a different way of addressing structures that assumed less x86-like architecture behaviour.

ia64 is a current user of this stuff. They just put it all back into paravirt-ops...

J