WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Map grant table pages in vmalloc kernel address space in

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Map grant table pages in vmalloc kernel address space instead of fixmap.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 10 Mar 2006 14:52:07 +0000
Delivery-date: Fri, 10 Mar 2006 14:52:56 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID c5286130a96e684545f5ce3a75255eb6b97d3f8e
# Parent  cc303cdf88099ecdae5b1be53b3ef1cadee2df28
Map grant table pages in vmalloc kernel address space instead of fixmap.

Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r cc303cdf8809 -r c5286130a96e 
linux-2.6-xen-sparse/drivers/xen/core/gnttab.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c    Fri Mar 10 10:05:59 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c    Fri Mar 10 13:27:24 2006
@@ -31,6 +31,8 @@
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/mm.h>
+#include <linux/vmalloc.h>
 #include <asm/pgtable.h>
 #include <xen/interface/xen.h>
 #include <asm/fixmap.h>
@@ -77,7 +79,7 @@
 static grant_ref_t gnttab_free_head;
 static spinlock_t gnttab_list_lock = SPIN_LOCK_UNLOCKED;
 
-static grant_entry_t *shared;
+static grant_entry_t *shared = NULL;
 
 static struct gnttab_free_callback *gnttab_free_callback_list = NULL;
 
@@ -354,12 +356,35 @@
        spin_unlock_irqrestore(&gnttab_list_lock, flags);
 }
 
+#ifndef __ia64__
+static int map_pte_fn(pte_t *pte, struct page *pte_page,
+                     unsigned long addr, void *data)
+{
+       unsigned long **frames = (unsigned long **)data;
+
+       set_pte_at(&init_mm, addr, pte, pfn_pte_ma((*frames)[0], PAGE_KERNEL));
+       (*frames)++;
+       return 0;
+}
+
+static int unmap_pte_fn(pte_t *pte, struct page *pte_page,
+                     unsigned long addr, void *data)
+{
+
+       set_pte_at(&init_mm, addr, pte, __pte(0));
+       return 0;
+}
+#endif
+
 int
 gnttab_resume(void)
 {
        gnttab_setup_table_t setup;
-       unsigned long        frames[NR_GRANT_FRAMES];
-       int                  i;
+       unsigned long frames[NR_GRANT_FRAMES];
+#ifndef __ia64__
+       void *pframes = frames;
+       struct vm_struct *area;
+#endif
 
        setup.dom        = DOMID_SELF;
        setup.nr_frames  = NR_GRANT_FRAMES;
@@ -368,12 +393,18 @@
        BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1));
        BUG_ON(setup.status != 0);
 
-#ifdef __ia64__
+#ifndef __ia64__
+       if (shared == NULL) {
+               area = get_vm_area(PAGE_SIZE * NR_GRANT_FRAMES, VM_IOREMAP);
+               BUG_ON(area == NULL);
+               shared = area->addr;
+       }
+       BUG_ON(generic_page_range(&init_mm, (unsigned long)shared,
+                                 PAGE_SIZE * NR_GRANT_FRAMES,
+                                 map_pte_fn, &pframes));
+#else
        shared = __va(frames[0] << PAGE_SHIFT);
        printk("grant table at %p\n", shared);
-#else
-       for (i = 0; i < NR_GRANT_FRAMES; i++)
-               set_fixmap(FIX_GNTTAB_END - i, frames[i] << PAGE_SHIFT);
 #endif
 
        return 0;
@@ -382,10 +413,12 @@
 int
 gnttab_suspend(void)
 {
-       int i;
-
-       for (i = 0; i < NR_GRANT_FRAMES; i++)
-               clear_fixmap(FIX_GNTTAB_END - i);
+
+#ifndef __ia64__
+       generic_page_range(&init_mm, (unsigned long)shared,
+                          PAGE_SIZE * NR_GRANT_FRAMES,
+                          unmap_pte_fn, NULL);
+#endif
 
        return 0;
 }
@@ -399,10 +432,6 @@
                return -ENODEV;
 
        BUG_ON(gnttab_resume());
-
-#ifndef __ia64__
-       shared = (grant_entry_t *)fix_to_virt(FIX_GNTTAB_END);
-#endif
 
        for (i = NR_RESERVED_ENTRIES; i < NR_GRANT_ENTRIES; i++)
                gnttab_list[i] = i + 1;
diff -r cc303cdf8809 -r c5286130a96e 
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h       Fri Mar 
10 10:05:59 2006
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h       Fri Mar 
10 13:27:24 2006
@@ -84,8 +84,6 @@
        FIX_PCIE_MCFG,
 #endif
        FIX_SHARED_INFO,
-       FIX_GNTTAB_BEGIN,
-       FIX_GNTTAB_END = FIX_GNTTAB_BEGIN + NR_GRANT_FRAMES - 1,
 #define NR_FIX_ISAMAPS 256
        FIX_ISAMAP_END,
        FIX_ISAMAP_BEGIN = FIX_ISAMAP_END + NR_FIX_ISAMAPS - 1,
diff -r cc303cdf8809 -r c5286130a96e 
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/fixmap.h
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/fixmap.h     Fri Mar 
10 10:05:59 2006
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/fixmap.h     Fri Mar 
10 13:27:24 2006
@@ -52,8 +52,6 @@
        FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1,
 #endif
        FIX_SHARED_INFO,
-       FIX_GNTTAB_BEGIN,
-       FIX_GNTTAB_END = FIX_GNTTAB_BEGIN + NR_GRANT_FRAMES - 1,
 #define NR_FIX_ISAMAPS 256
        FIX_ISAMAP_END,
        FIX_ISAMAP_BEGIN = FIX_ISAMAP_END + NR_FIX_ISAMAPS - 1,

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Map grant table pages in vmalloc kernel address space instead of fixmap., Xen patchbot -unstable <=