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

[Xen-changelog] [xen-unstable] x86: stub domains and page ownership for mapping in dom0



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1205856924 0
# Node ID 6ac99b961bffcdf50131fe4f2be1714f51b44db9
# Parent  4b157affc08f75cb0e2d69954357cfb1630e798c
x86: stub domains and page ownership for mapping in dom0

In the case of an ioemu stubdomain with SDL or vnc server running in
dom0, we want to have the stubdomain expose the HVM guest's video RAM
through PVFB.

However, to map the pages from dom0, xenfb uses xc_map_foreign_pages
with the stubdomain ID as domid (since that is what is advertised in
the PVFB protocol, and needed for other parts of the protocol), and
thus get_page_from_l1e() complains because the stubdomain is not the
owner of the pages.  In such case, this patch checks that the
stubdomain has privileges on the actual owner of the pages, and then
accept the mapping.

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
---
 xen/arch/x86/mm.c |   11 +++++++++++
 1 files changed, 11 insertions(+)

diff -r 4b157affc08f -r 6ac99b961bff xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Tue Mar 18 16:05:24 2008 +0000
+++ b/xen/arch/x86/mm.c Tue Mar 18 16:15:24 2008 +0000
@@ -645,6 +645,7 @@ get_page_from_l1e(
     struct page_info *page = mfn_to_page(mfn);
     uint32_t l1f = l1e_get_flags(l1e);
     struct vcpu *curr = current;
+    struct domain *owner = page_get_owner(page);
     int okay;
 
     if ( !(l1f & _PAGE_PRESENT) )
@@ -672,6 +673,16 @@ get_page_from_l1e(
 
         return 1;
     }
+
+    /*
+     * Let privileged domains transfer the right to map their target
+     * domain's pages. This is used to allow stub-domain pvfb export to dom0,
+     * until pvfb supports granted mappings. At that time this minor hack
+     * can go away.
+     */
+    if ( unlikely(d != owner) && (owner != NULL) &&
+         (d != curr->domain) && IS_PRIV_FOR(d, owner) )
+        d = owner;
 
     /* Foreign mappings into guests in shadow external mode don't
      * contribute to writeable mapping refcounts.  (This allows the

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


 


Rackspace

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