Hello,

I am trying to set up a shared page between the hypervisor and a Linux guest 
kernel. In Xen I am doing:

void *ptr = alloc_xenheap_page();
share_xen_page_with_guest(virt_to_page(ptr), current->domain, 
XENSHARE_writable);
unsigned int mfn = virt_to_mfn(ptr);

And my plan was to pass the mfn to the guest kernel and retrieve the pfn with 
mfn_to_pfn(). However, this returned ~0. 

So I took a look at share_xen_page_with_guest() and I noticed it calls 
set_gpfn_from_mfn(mfn, INVALID_M2P_ENTRY), 
where INVALID_M2P_ENTRY = ~0.

My questions are:
        1. Do I have to call set_gpfn_from_mfn() after calling 
share_xen_page_with_guest() in the hypervisor?
        2. If yes, what gpfn should I use? I am thinking I could allocate a 
page in the guest, and retrieve the pfn with page_to_pfn(), 
        and then pass that to the hypervisor. But I don’t know if I am 
overcomplicating things.

Thank you for your help,
Emmanuel
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to