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

[Xen-changelog] [IA64] linux: drivers/xen/util.c for ia64



# HG changeset patch
# User awilliam@xxxxxxxxxxx
# Node ID 5f0bdd0ef9dc97464eccf224a185202292159145
# Parent  e891c49c7bc003755ae8a190a654af7dc958d547
[IA64] linux: drivers/xen/util.c for ia64

xen/ia64 counter part of linux-2.6-xen-sparse/drivers/xen/util.c

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/arch/ia64/xen/Makefile         |    2 
 linux-2.6-xen-sparse/arch/ia64/xen/drivers/Makefile |    2 
 linux-2.6-xen-sparse/arch/ia64/xen/util.c           |  110 ++++++++++++++++++++
 3 files changed, 113 insertions(+), 1 deletion(-)

diff -r e891c49c7bc0 -r 5f0bdd0ef9dc linux-2.6-xen-sparse/arch/ia64/xen/Makefile
--- a/linux-2.6-xen-sparse/arch/ia64/xen/Makefile       Tue May 09 11:44:26 
2006 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/Makefile       Tue May 09 11:46:00 
2006 -0600
@@ -4,5 +4,5 @@
 
 obj-y := hypercall.o xenivt.o xenentry.o xensetup.o xenpal.o xenhpski.o 
xenconsole.o xen_ksyms.o
 
-obj-$(CONFIG_XEN_IA64_DOM0_VP) += hypervisor.o pci-dma-xen.o
+obj-$(CONFIG_XEN_IA64_DOM0_VP) += hypervisor.o pci-dma-xen.o util.o
 pci-dma-xen-$(CONFIG_XEN_IA64_DOM0_VP) := ../../i386/kernel/pci-dma-xen.o
\ No newline at end of file
diff -r e891c49c7bc0 -r 5f0bdd0ef9dc 
linux-2.6-xen-sparse/arch/ia64/xen/drivers/Makefile
--- a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/Makefile       Tue May 09 
11:44:26 2006 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/Makefile       Tue May 09 
11:46:00 2006 -0600
@@ -1,5 +1,7 @@
 
+ifneq ($(CONFIG_XEN_IA64_DOM0_VP),y)
 obj-y   += util.o
+endif
 
 obj-y  += core/
 obj-y  += console/
diff -r e891c49c7bc0 -r 5f0bdd0ef9dc linux-2.6-xen-sparse/arch/ia64/xen/util.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/util.c Tue May 09 11:46:00 2006 -0600
@@ -0,0 +1,110 @@
+/******************************************************************************
+ * arch/ia64/xen/util.c
+ * This file is the ia64 counterpart of drivers/xen/util.c
+ *
+ * Copyright (c) 2006 Isaku Yamahata <yamahata at valinux co jp>
+ *                    VA Linux Systems Japan K.K.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include <linux/config.h>
+#include <linux/mm.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
+#include <asm/uaccess.h>
+#include <xen/driver_util.h>
+
+struct vm_struct *alloc_vm_area(unsigned long size)
+{
+       int order;
+       unsigned long virt;
+       unsigned long nr_pages;
+       struct vm_struct* area;
+       
+       order = get_order(size);
+       virt = __get_free_pages(GFP_KERNEL, order);
+       if (virt == 0) {
+               goto err0;
+       }
+       nr_pages = 1 << order;
+       scrub_pages(virt, nr_pages);
+       
+       area = kmalloc(sizeof(*area), GFP_KERNEL);
+       if (area == NULL) {
+               goto err1;
+       }
+       
+        area->flags = VM_IOREMAP;//XXX
+        area->addr = (void*)virt;
+        area->size = size;
+        area->pages = NULL; //XXX
+        area->nr_pages = nr_pages;
+        area->phys_addr = __pa(virt);
+
+       return area;
+
+err1:
+       free_pages(virt, order);
+err0:
+       return NULL;
+       
+}
+EXPORT_SYMBOL_GPL(alloc_vm_area);
+
+void free_vm_area(struct vm_struct *area)
+{
+       unsigned int order = get_order(area->size);
+       unsigned long i;
+
+       // This area is used for foreign page mappping.
+       // So underlying machine page may not be assigned.
+       for (i = 0; i < (1 << order); i++) {
+               unsigned long error;
+               error = HYPERVISOR_populate_physmap(
+                       (area->phys_addr >> PAGE_SHIFT) + i, 0, 0);
+               if (error) {
+                       BUG();//XXX
+                       return;
+               }
+       }
+       free_pages((unsigned long)area->addr, order);
+       kfree(area);
+}
+EXPORT_SYMBOL_GPL(free_vm_area);
+
+void lock_vm_area(struct vm_struct *area)
+{
+       // nothing
+}
+EXPORT_SYMBOL_GPL(lock_vm_area);
+
+void unlock_vm_area(struct vm_struct *area)
+{
+       // nothing
+}
+EXPORT_SYMBOL_GPL(unlock_vm_area);
+
+/*
+ * Local variables:
+ *  c-file-style: "linux"
+ *  indent-tabs-mode: t
+ *  c-indent-level: 8
+ *  c-basic-offset: 8
+ *  tab-width: 8
+ * End:
+ */

_______________________________________________
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®.