# 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
|