[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] About sharing pages between Xen and guest kernel

  • To: "xen-devel@xxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxx>
  • From: "Amaro, Emmanuel" <amaro@xxxxxxxxxx>
  • Date: Wed, 12 Nov 2014 23:52:00 +0000
  • Accept-language: en-US
  • Delivery-date: Wed, 12 Nov 2014 23:52:24 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>
  • Thread-index: AQHP/tOmjBjc4qz+eE2pZyw+Z209KQ==
  • Thread-topic: About sharing pages between Xen and guest kernel


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, 
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,
Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.