# HG changeset patch
# User Hollis Blanchard <hollisb@xxxxxxxxxx>
# Node ID cf43edb4abe5691e0214d7ca354591cdede8c3a4
# Parent f77f8c43a9091dc9db869f927eb348f5bde1f165
[ppc] implement HYPERVISOR_grant_table_op()
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
diff -r f77f8c43a909 -r cf43edb4abe5 arch/powerpc/platforms/xen/hcall.c
--- a/arch/powerpc/platforms/xen/hcall.c Wed May 24 13:17:46 2006 -0500
+++ b/arch/powerpc/platforms/xen/hcall.c Wed May 24 15:00:05 2006 -0500
@@ -11,6 +11,7 @@
#include <xen/interface/sched.h>
#include <xen/interface/event_channel.h>
#include <xen/interface/physdev.h>
+#include <xen/interface/grant_table.h>
#include <xen/public/privcmd.h>
#include <asm/hypercall.h>
#include <asm/page.h>
@@ -122,6 +123,62 @@ int HYPERVISOR_physdev_op(int cmd, void
return rc;
}
EXPORT_SYMBOL(HYPERVISOR_physdev_op);
+
+int HYPERVISOR_grant_table_op(unsigned int cmd, void *op, unsigned int count)
+{
+ struct xencomm_desc *desc;
+ struct xencomm_desc *frame_list;
+ long rc;
+ int argsize;
+
+ switch (cmd) {
+ case GNTTABOP_map_grant_ref:
+ argsize = sizeof(struct gnttab_map_grant_ref);
+ break;
+ case GNTTABOP_unmap_grant_ref:
+ 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);
+
+ rc = xencomm_create(xen_guest_handle(setup.frame_list),
+ setup.nr_frames *
sizeof(*xen_guest_handle(setup.frame_list)),
+ &frame_list, GFP_KERNEL);
+ if (rc)
+ return rc;
+
+ set_xen_guest_handle(setup.frame_list, (void
*)__pa(frame_list));
+ op = &setup;
+ }
+ break;
+ case GNTTABOP_dump_table:
+ argsize = sizeof(struct gnttab_dump_table);
+ break;
+ case GNTTABOP_transfer:
+ argsize = sizeof(struct gnttab_transfer);
+ break;
+ default:
+ printk("%s: unknown grant table op %d\n", __func__, cmd);
+ return -ENOSYS;
+ }
+
+ rc = xencomm_create(op, argsize, &desc, GFP_KERNEL);
+ if (rc)
+ return rc;
+
+ rc = plpar_hcall_norets(XEN_MARK(__HYPERVISOR_grant_table_op), cmd,
+ __pa(desc), count);
+
+ if (cmd == GNTTABOP_setup_table)
+ xencomm_free(frame_list);
+ xencomm_free(desc);
+
+ return rc;
+}
+EXPORT_SYMBOL(HYPERVISOR_grant_table_op);
static int xenppc_privcmd_dom0_op(privcmd_hypercall_t *hypercall)
{
diff -r f77f8c43a909 -r cf43edb4abe5 include/asm-powerpc/xen/asm/hypercall.h
--- a/include/asm-powerpc/xen/asm/hypercall.h Wed May 24 13:17:46 2006 -0500
+++ b/include/asm-powerpc/xen/asm/hypercall.h Wed May 24 15:00:05 2006 -0500
@@ -41,6 +41,8 @@ extern int HYPERVISOR_event_channel_op(i
extern int HYPERVISOR_event_channel_op(int cmd, void *op);
extern int HYPERVISOR_xen_version(int cmd, void *arg);
extern int HYPERVISOR_physdev_op(int cmd, void *op);
+extern int HYPERVISOR_grant_table_op(unsigned int cmd, void *uop,
+ unsigned int count);
static inline int HYPERVISOR_sched_op(int cmd, unsigned long arg)
{
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel
|