This patch moves HYPERVISOR_grant_table_op() to hcall.c with all of the
rest of the hypercalls.

Signed-off-by: Jerone Young <[EMAIL PROTECTED]>

# HG changeset patch
# User Jerone Young <[EMAIL PROTECTED]>
# Date 1169625088 21600
# Node ID 4e50bbadde6a6b752de5a35e9684773dbe083410
# Parent  c326865b79895e91ac57e548eda03cda3c4c0dcc
move HYPERVISOR_grant_table_op() to hcall.c

diff -r c326865b7989 -r 4e50bbadde6a arch/powerpc/platforms/xen/gnttab.c
--- a/arch/powerpc/platforms/xen/gnttab.c	Tue Jan 23 22:49:23 2007 -0600
+++ b/arch/powerpc/platforms/xen/gnttab.c	Wed Jan 24 01:51:28 2007 -0600
@@ -4,7 +4,6 @@
 #include <linux/memory_hotplug.h>
 #include <xen/gnttab.h>
 #include <asm/hypervisor.h>
-#include <xen/interface/grant_table.h>
 #include <asm/pgtable.h>
 #include <asm/sections.h>
 #include <asm/io.h>
@@ -159,8 +158,8 @@ static long find_map_slot(ulong ea)
 }
 
 
-static void gnttab_pre_unmap_grant_ref(
-	struct gnttab_unmap_grant_ref *unmap, int count)
+void gnttab_pre_unmap_grant_ref(struct gnttab_unmap_grant_ref *unmap, 
+				int count)
 {
 	long slot;
 	int i;
@@ -196,8 +195,8 @@ static void gnttab_pre_unmap_grant_ref(
 	local_irq_restore(flags);
 }
 
-static void gnttab_post_map_grant_ref(
-	struct gnttab_map_grant_ref *map, int count)
+void gnttab_post_map_grant_ref(struct gnttab_map_grant_ref *map,
+				int count)
 {
 	int i;
 	long slot;
@@ -241,62 +240,6 @@ static void gnttab_post_map_grant_ref(
 	}
 	local_irq_restore(flags);
 }
-
-int HYPERVISOR_grant_table_op(unsigned int cmd, void *op, unsigned int count)
-{
-	void *desc;
-	void *frame_list;
-	int argsize;
-	int ret;
-
-	switch (cmd) {
-	case GNTTABOP_map_grant_ref:
-		argsize = sizeof(struct gnttab_map_grant_ref);
-		break;
-	case GNTTABOP_unmap_grant_ref:
-		gnttab_pre_unmap_grant_ref(op, count);
-		argsize = sizeof(struct gnttab_unmap_grant_ref);
-		break;
-	case GNTTABOP_setup_table: {
-		struct gnttab_setup_table setup;
-
-		memcpy(&setup, op, sizeof(setup));
-		argsize = sizeof(setup);
-
-		frame_list = xencomm_map(
-			xen_guest_handle(setup.frame_list),
-			(sizeof(ulong) * setup.nr_frames));
-
-		set_xen_guest_handle(setup.frame_list, frame_list);
-		memcpy(op, &setup, sizeof(setup));
-		}
-		break;
-	case GNTTABOP_dump_table:
-		argsize = sizeof(struct gnttab_dump_table);
-		break;
-	case GNTTABOP_transfer:
-		BUG();
-		argsize = sizeof(struct gnttab_transfer);
-		break;
-	case GNTTABOP_copy:
-		argsize = sizeof(struct gnttab_transfer);
-		break;
-	default:
-		printk(KERN_EMERG "%s: unknown grant table op %d\n",
-		       __func__, cmd);
-		return -ENOSYS;
-	}
-
-	desc = xencomm_map(op, argsize);
-
-	ret = plpar_hcall_norets(XEN_MARK(__HYPERVISOR_grant_table_op), cmd,
-				 desc, count);
-	if (cmd == GNTTABOP_map_grant_ref)
-		gnttab_post_map_grant_ref(op, count);
-
-	return ret;
-}
-EXPORT_SYMBOL(HYPERVISOR_grant_table_op);
 
 static ulong find_grant_maps(void)
 {
diff -r c326865b7989 -r 4e50bbadde6a arch/powerpc/platforms/xen/hcall.c
--- a/arch/powerpc/platforms/xen/hcall.c	Tue Jan 23 22:49:23 2007 -0600
+++ b/arch/powerpc/platforms/xen/hcall.c	Wed Jan 24 01:51:28 2007 -0600
@@ -630,4 +630,60 @@ int HYPERVISOR_vcpu_op(int cmd, int vcpu
 	(void)argsize;
 	return plpar_hcall_norets(XEN_MARK(hcall), cmd, vcpuid, desc);
 }
+
+int HYPERVISOR_grant_table_op(unsigned int cmd, void *op, unsigned int count)
+{
+	void *desc;
+	void *frame_list;
+	int argsize;
+	int ret;
+
+	switch (cmd) {
+	case GNTTABOP_map_grant_ref:
+		argsize = sizeof(struct gnttab_map_grant_ref);
+		break;
+	case GNTTABOP_unmap_grant_ref:
+		gnttab_pre_unmap_grant_ref(op, count);
+		argsize = sizeof(struct gnttab_unmap_grant_ref);
+		break;
+	case GNTTABOP_setup_table: {
+		struct gnttab_setup_table setup;
+
+		memcpy(&setup, op, sizeof(setup));
+		argsize = sizeof(setup);
+
+		frame_list = xencomm_map(
+			xen_guest_handle(setup.frame_list),
+			(sizeof(ulong) * setup.nr_frames));
+
+		set_xen_guest_handle(setup.frame_list, frame_list);
+		memcpy(op, &setup, sizeof(setup));
+		}
+		break;
+	case GNTTABOP_dump_table:
+		argsize = sizeof(struct gnttab_dump_table);
+		break;
+	case GNTTABOP_transfer:
+		BUG();
+		argsize = sizeof(struct gnttab_transfer);
+		break;
+	case GNTTABOP_copy:
+		argsize = sizeof(struct gnttab_transfer);
+		break;
+	default:
+		printk(KERN_EMERG "%s: unknown grant table op %d\n",
+		       __func__, cmd);
+		return -ENOSYS;
+	}
+
+	desc = xencomm_map(op, argsize);
+
+	ret = plpar_hcall_norets(XEN_MARK(__HYPERVISOR_grant_table_op), cmd,
+				 desc, count);
+	if (cmd == GNTTABOP_map_grant_ref)
+		gnttab_post_map_grant_ref(op, count);
+
+	return ret;
+}
+EXPORT_SYMBOL(HYPERVISOR_grant_table_op);
 	
diff -r c326865b7989 -r 4e50bbadde6a arch/powerpc/platforms/xen/setup.h
--- a/arch/powerpc/platforms/xen/setup.h	Tue Jan 23 22:49:23 2007 -0600
+++ b/arch/powerpc/platforms/xen/setup.h	Wed Jan 24 01:51:28 2007 -0600
@@ -28,3 +28,12 @@ extern void free_foreign_page(struct pag
 
 extern void __init xen_setup_time(struct machdep_calls *host_md);
 extern void xen_setup_smp(void);
+
+/* These function are from gnttab.c The purpose of these functions 
+   being here is so that they can be exposed to
+   HYPERVISOR_grant_table_op() in hcall.c */
+#include <xen/interface/grant_table.h>
+void gnttab_pre_unmap_grant_ref(struct gnttab_unmap_grant_ref *unmap, 
+				int count);
+void gnttab_post_map_grant_ref(struct gnttab_map_grant_ref *map,
+                                int count);
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel

Reply via email to