1 files changed, 16 insertions(+)
arch/powerpc/platforms/xen/setup.c |   16 ++++++++++++++++


# HG changeset patch
# User Ryan Harper <[EMAIL PROTECTED]>
# Date 1174343262 18000
# Node ID e4586f18b81e035f2b60d02f487ee23d01049e66
# Parent  04f6ad5d9232878cbcf8810025bb3ab59cbb62b6
linux: flag mfns when mapping another domain's memory

This patch reads the mfn flag from the devtree, and then when mapping in
guest memory, adds the flag to aid the hypervisor in pfn to mfn
translation.

diff -r 04f6ad5d9232 -r e4586f18b81e arch/powerpc/platforms/xen/setup.c
--- a/arch/powerpc/platforms/xen/setup.c        Mon Mar 05 13:23:38 2007 -0600
+++ b/arch/powerpc/platforms/xen/setup.c        Mon Mar 19 17:27:42 2007 -0500
@@ -39,6 +39,8 @@ extern struct machdep_calls mach_maple_m
 extern struct machdep_calls mach_maple_md;
 extern void maple_pci_init(void);
 
+static unsigned long foreign_mfn_flag;
+
 int direct_remap_pfn_range(struct vm_area_struct *vma,
                unsigned long address, 
                unsigned long mfn,
@@ -48,6 +50,9 @@ int direct_remap_pfn_range(struct vm_are
 {
        int rc;
 
+       /* set flag in mfn to tell xen this is an mfn not an pfn */
+       mfn = mfn | foreign_mfn_flag;
+
        down_write(&vma->vm_mm->mmap_sem);
        rc = remap_pfn_range(vma, address, mfn, size, prot);
        up_write(&vma->vm_mm->mmap_sem);
@@ -89,6 +94,7 @@ static void __init xen_init_early(void)
 static void __init xen_init_early(void)
 {
        struct device_node *xen;
+       u64 *v;
 
        DBG(" -> %s\n", __func__);
 
@@ -147,6 +153,16 @@ static void __init xen_init_early(void)
                xen_reboot_init(&mach_maple_md);
        else
                xen_reboot_init(NULL);
+
+       /* get mfn-base for dom0 to flag guest mfns */
+       v = (u64 *)get_property(xen, "mfn-base", NULL);
+       if (v) {
+               if (is_initial_xendomain()) {
+                       foreign_mfn_flag = (1UL << ((unsigned long) *(v)));
+                       printk("OF: using 0x%lx as foreign mfn flag\n", 
foreign_mfn_flag);
+               } else
+                       printk("OF: /xen/mfn-base must be present it build 
guests\n");
+       }
 
        /* get the domain features */
        setup_xen_features();

_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel

Reply via email to