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-ppc-devel

[XenPPC] [pushed] [ppc] support "version" hcalls, and hcalls from 32-bit

To: xen-ppc-devel <xen-ppc-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [XenPPC] [pushed] [ppc] support "version" hcalls, and hcalls from 32-bit userland
From: Hollis Blanchard <hollisb@xxxxxxxxxx>
Date: Fri, 19 May 2006 15:17:20 -0500
Delivery-date: Fri, 19 May 2006 13:17:40 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: IBM Linux Technology Center
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Hollis Blanchard <hollisb@xxxxxxxxxx>
# Node ID de3e1e3bba227f0f744edc3cb685d478e15bc869
# Parent  11e1dcb7a976f21bc80929aa74bac3216a406a40
[ppc] support "version" hcalls, and hcalls from 32-bit userland
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>

diff -r 11e1dcb7a976 -r de3e1e3bba22 arch/powerpc/platforms/xen/hcall.c
--- a/arch/powerpc/platforms/xen/hcall.c        Tue May 16 17:25:06 2006 -0500
+++ b/arch/powerpc/platforms/xen/hcall.c        Fri May 19 15:08:40 2006 -0500
@@ -6,18 +6,14 @@
 #include <xen/interface/dom0_ops.h>
 #include <xen/interface/memory.h>
 #include <xen/interface/xencomm.h>
+#include <xen/interface/version.h>
 #include <xen/public/privcmd.h>
 #include <asm/hypercall.h>
 #include <asm/page.h>
 #include <asm/uaccess.h>
 #include <asm/hvcall.h>
 
-/*
- * There is some serious guest hande effage heppening in this file so
- * this makes it a little easier to manage 
- */
 #define xen_guest_handle(hnd)  ((hnd).p)
-
 
 /* we need a xencomm descriptor to cover the dom0 op itself, plus one for every
  * pointer to another data structure. */
@@ -213,6 +209,48 @@ out:
        return ret;
 }
 
+static int xenppc_privcmd_version(privcmd_hypercall_t *hypercall)
+{
+       struct xencomm_desc *desc;
+       unsigned int argsize;
+       int ret;
+
+       switch (hypercall->arg[0]) {
+               case XENVER_version:
+                       /* no pointers used, so no xencomm stuff needed */
+                       return plpar_hcall_norets(XEN_MARK(hypercall->op), 
XENVER_version,
+                                       0, 0, 0, 0, 0);
+                       break;
+               case XENVER_extraversion:
+                       argsize = sizeof(xen_extraversion_t);
+                       break;
+               case XENVER_compile_info:
+                       argsize = sizeof(xen_compile_info_t);
+                       break;
+               case XENVER_capabilities:
+                       argsize = sizeof(xen_capabilities_info_t);
+                       break;
+               case XENVER_changeset:
+                       argsize = sizeof(xen_changeset_info_t);
+                       break;
+               case XENVER_platform_parameters:
+                       argsize = sizeof(xen_platform_parameters_t);
+                       break;
+               default:
+                       return -EINVAL;
+       }
+
+       ret = xencomm_create((void *)hypercall->arg[1], argsize, &desc, 
GFP_KERNEL);
+       if (ret)
+               return ret;
+
+       ret = plpar_hcall_norets(XEN_MARK(hypercall->op), hypercall->arg[0],
+                       __pa(desc), 0, 0, 0, 0);
+
+       xencomm_free(desc);
+       return ret;
+}
+
 /* The PowerPC hypervisor runs in a separate address space from Linux
  * kernel/userspace, i.e. real mode. We must therefore translate userspace
  * pointers to something the hypervisor can make sense of. */
@@ -223,6 +261,8 @@ int arch_privcmd_hypercall(privcmd_hyper
                        return xenppc_privcmd_dom0_op(hypercall);
                case __HYPERVISOR_memory_op:
                        return xenppc_privcmd_memory_op(hypercall);
+               case __HYPERVISOR_xen_version:
+                       return xenppc_privcmd_version(hypercall);
                default:
                        printk("%s: unknown hcall (%ld)\n", __func__, 
hypercall->op);
                        return plpar_hcall_norets(XEN_MARK(hypercall->op),
diff -r 11e1dcb7a976 -r de3e1e3bba22 drivers/xen/privcmd/privcmd.c
--- a/drivers/xen/privcmd/privcmd.c     Tue May 16 17:25:06 2006 -0500
+++ b/drivers/xen/privcmd/privcmd.c     Fri May 19 15:08:40 2006 -0500
@@ -37,6 +37,8 @@ static struct proc_dir_entry *capabiliti
 
 #define NR_HYPERCALLS 64
 static DECLARE_BITMAP(hypercall_permission_map, NR_HYPERCALLS);
+
+extern int arch_privcmd_hypercall(privcmd_hypercall_t *hypercall);
 
 static int privcmd_ioctl(struct inode *inode, struct file *file,
                          unsigned int cmd, unsigned long data)
diff -r 11e1dcb7a976 -r de3e1e3bba22 fs/compat_ioctl.c
--- a/fs/compat_ioctl.c Tue May 16 17:25:06 2006 -0500
+++ b/fs/compat_ioctl.c Fri May 19 15:08:40 2006 -0500
@@ -124,6 +124,8 @@
 #include <linux/dvb/frontend.h>
 #include <linux/dvb/video.h>
 #include <linux/lp.h>
+#include <xen/interface/xen.h>
+#include <xen/public/privcmd.h>
 
 /* Aiee. Someone does not find a difference between int and long */
 #define EXT2_IOC32_GETFLAGS               _IOR('f', 1, int)
@@ -2982,6 +2984,8 @@ COMPATIBLE_IOCTL(LPRESET)
 /*LPGETSTATS not implemented, but no kernels seem to compile it in anyways*/
 COMPATIBLE_IOCTL(LPGETFLAGS)
 HANDLE_IOCTL(LPSETTIMEOUT, lp_timeout_trans)
+
+COMPATIBLE_IOCTL(IOCTL_PRIVCMD_HYPERCALL)
 };
 
 int ioctl_table_size = ARRAY_SIZE(ioctl_start);



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