Gregory Haskins wrote:
> Hi All,
>   I am working on some PV stuff and had some questions about the ability
> to share memory across the Guest/Host boundary.
>
> It seems that most examples of how to do this always involve starting
> with a *page, converting it to a gfn via page_to_gfn(), and using that
> as a gpa to pass across the boundary.
>   

Do you mean page_to_pfn?  I assume you're talking about a page within 
the guest right?

> I understand that this method avoids a software traipse through the
> page-walker, so it's nice.  What I can't quite figure out is what are
> the other types of memory (if any) that can be passed across.
>
> For instance, is a pointer from kmalloc() considered a gpa, a gva,
> neither?

gpa = guest physical address.  It's a pa or a pfn << PAGE_SHIFT.

gva = guest virtual address.  It's returned from pretty much anything 
that allocates memory (kmalloc for instance).  This is all within the 
guest of course.

>   Or are gva's only pointers that come from guest-userspace,
> etc.  Is it possible to pass something like a skb->data pointer (I
> understand that I may have to run the page-walker for some of these)?
>   

Yes, you can pass through any gva.  There are couple of things to be 
aware of though.  When passing a gva, you have to be sure that the gva 
is actually mapped in memory as KVM cannot cause Linux to fault in a 
page.  Also, for something like skb->data, you should probably just pass 
the gpa since they'll usually fall within a single page anyway.

> If so, how would I do this:  E.g. can I just pass the pointer, and then
> do gva_to_hpa() on the host?  Or do I need to prep the pointer before
> sending it?
>   

There's no need to prep provided that you know the va is mapped into 
memory in the guest.

Regards,

Anthony Liguori

> TIA
> -Greg
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> kvm-devel mailing list
> kvm-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/kvm-devel
>
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to