All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hollis Blanchard <hollisb@us.ibm.com>
To: Keir Fraser <keir.fraser@xensource.com>
Cc: xen-devel@lists.xensource.com, xen-ppc-devel@lists.xensource.com
Subject: [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctl conversion for 64-bit kernels
Date: Thu, 05 Jul 2007 17:27:55 -0500	[thread overview]
Message-ID: <3833674b6d561e690b49.1183674475@localhost> (raw)
In-Reply-To: <patchbomb.1183674469@localhost>

5 files changed, 138 insertions(+), 2 deletions(-)
drivers/xen/Makefile                 |    2 
drivers/xen/privcmd/Makefile         |    3 -
drivers/xen/privcmd/compat_privcmd.c |   73 ++++++++++++++++++++++++++++++++++
fs/compat_ioctl.c                    |   17 +++++++
include/xen/compat_ioctl.h           |   45 ++++++++++++++++++++


# HG changeset patch
# User Hollis Blanchard <hollisb@us.ibm.com>
# Date 1183674408 18000
# Node ID 3833674b6d561e690b4963644ced60104f226dbf
# Parent  9def23611685442dc9688ad8f81db9a5031b4b5f
[XEN][LINUX] Add 32-bit privcmd ioctl conversion for 64-bit kernels.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>

diff -r 9def23611685 -r 3833674b6d56 drivers/xen/Makefile
--- a/drivers/xen/Makefile	Thu Jul 05 17:25:47 2007 -0500
+++ b/drivers/xen/Makefile	Thu Jul 05 17:26:48 2007 -0500
@@ -1,7 +1,6 @@ obj-y	+= core/
 obj-y	+= core/
 obj-y	+= console/
 obj-y	+= evtchn/
-obj-y	+= privcmd/
 obj-y	+= xenbus/
 obj-y	+= gntdev/
 obj-y	+= char/
@@ -18,3 +17,4 @@ obj-$(CONFIG_XEN_PCIDEV_FRONTEND)	+= pci
 obj-$(CONFIG_XEN_PCIDEV_FRONTEND)	+= pcifront/
 obj-$(CONFIG_XEN_FRAMEBUFFER)		+= fbfront/
 obj-$(CONFIG_XEN_KEYBOARD)		+= fbfront/
+obj-$(CONFIG_XEN_PRIVCMD)	+= privcmd/
diff -r 9def23611685 -r 3833674b6d56 drivers/xen/privcmd/Makefile
--- a/drivers/xen/privcmd/Makefile	Thu Jul 05 17:25:47 2007 -0500
+++ b/drivers/xen/privcmd/Makefile	Thu Jul 05 17:26:48 2007 -0500
@@ -1,2 +1,3 @@
 
-obj-$(CONFIG_XEN_PRIVCMD)	:= privcmd.o
+obj-y	+= privcmd.o
+obj-$(CONFIG_COMPAT)	+= compat_privcmd.o
diff -r 9def23611685 -r 3833674b6d56 drivers/xen/privcmd/compat_privcmd.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/drivers/xen/privcmd/compat_privcmd.c	Thu Jul 05 17:26:48 2007 -0500
@@ -0,0 +1,73 @@
+/*
+ * 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
+ *
+ * Copyright (C) IBM Corp. 2006
+ *
+ * Authors: Jimi Xenidis <jimix@watson.ibm.com>
+ */
+
+#include <linux/config.h>
+#include <linux/compat.h>
+#include <linux/ioctl.h>
+#include <linux/syscalls.h>
+#include <asm/hypervisor.h>
+#include <asm/uaccess.h>
+#include <xen/public/privcmd.h>
+#include <xen/compat_ioctl.h>
+
+int privcmd_ioctl_32(int fd, unsigned int cmd, unsigned long arg)
+{
+	int ret;
+
+	switch (cmd) {
+	case IOCTL_PRIVCMD_MMAP_32: {
+		struct privcmd_mmap *p;
+		struct privcmd_mmap_32 *p32;
+		struct privcmd_mmap_32 n32;
+
+		p32 = compat_ptr(arg);
+		p = compat_alloc_user_space(sizeof(*p));
+		if (copy_from_user(&n32, p32, sizeof(n32)) ||
+		    put_user(n32.num, &p->num) ||
+		    put_user(n32.dom, &p->dom) ||
+		    put_user(compat_ptr(n32.entry), &p->entry))
+			return -EFAULT;
+		
+		ret = sys_ioctl(fd, IOCTL_PRIVCMD_MMAP, (unsigned long)p);
+	}
+		break;
+	case IOCTL_PRIVCMD_MMAPBATCH_32: {
+		struct privcmd_mmapbatch *p;
+		struct privcmd_mmapbatch_32 *p32;
+		struct privcmd_mmapbatch_32 n32;
+
+		p32 = compat_ptr(arg);
+		p = compat_alloc_user_space(sizeof(*p));
+		if (copy_from_user(&n32, p32, sizeof(n32)) ||
+		    put_user(n32.num, &p->num) ||
+		    put_user(n32.dom, &p->dom) ||
+		    put_user(n32.addr, &p->addr) ||
+		    put_user(compat_ptr(n32.arr), &p->arr))
+			return -EFAULT;
+		
+		ret = sys_ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH, (unsigned long)p);
+	}
+		break;
+	default:
+		ret = -EINVAL;
+		break;
+	}
+	return ret;
+}
diff -r 9def23611685 -r 3833674b6d56 fs/compat_ioctl.c
--- a/fs/compat_ioctl.c	Thu Jul 05 17:25:47 2007 -0500
+++ b/fs/compat_ioctl.c	Thu Jul 05 17:26:48 2007 -0500
@@ -123,6 +123,11 @@
 #include <linux/dvb/frontend.h>
 #include <linux/dvb/video.h>
 #include <linux/lp.h>
+
+#include <xen/interface/xen.h>
+#include <xen/public/evtchn.h>
+#include <xen/public/privcmd.h>
+#include <xen/compat_ioctl.h>
 
 /* Aiee. Someone does not find a difference between int and long */
 #define EXT2_IOC32_GETFLAGS               _IOR('f', 1, int)
@@ -2948,6 +2953,18 @@ COMPATIBLE_IOCTL(LPRESET)
 /*LPGETSTATS not implemented, but no kernels seem to compile it in anyways*/
 COMPATIBLE_IOCTL(LPGETFLAGS)
 HANDLE_IOCTL(LPSETTIMEOUT, lp_timeout_trans)
+
+#ifdef CONFIG_XEN
+HANDLE_IOCTL(IOCTL_PRIVCMD_MMAP_32, privcmd_ioctl_32)
+HANDLE_IOCTL(IOCTL_PRIVCMD_MMAPBATCH_32, privcmd_ioctl_32)
+COMPATIBLE_IOCTL(IOCTL_PRIVCMD_HYPERCALL)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_BIND_VIRQ)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_BIND_INTERDOMAIN)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_BIND_UNBOUND_PORT)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_UNBIND)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_NOTIFY)
+COMPATIBLE_IOCTL(IOCTL_EVTCHN_RESET)
+#endif
 };
 
 int ioctl_table_size = ARRAY_SIZE(ioctl_start);
diff -r 9def23611685 -r 3833674b6d56 include/xen/compat_ioctl.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/xen/compat_ioctl.h	Thu Jul 05 17:26:48 2007 -0500
@@ -0,0 +1,45 @@
+/*
+ * 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, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright IBM Corp. 2007
+ *
+ * Authors: Jimi Xenidis <jimix@watson.ibm.com>
+ *          Hollis Blanchard <hollisb@us.ibm.com>
+ */
+
+#ifndef __LINUX_XEN_COMPAT_H__ 
+#define __LINUX_XEN_COMPAT_H__ 
+
+#include <linux/compat.h>
+
+extern int privcmd_ioctl_32(int fd, unsigned int cmd, unsigned long arg);
+struct privcmd_mmap_32 {
+	int num;
+	domid_t dom;
+	compat_uptr_t entry;
+};
+
+struct privcmd_mmapbatch_32 {
+	int num;     /* number of pages to populate */
+	domid_t dom; /* target domain */
+	__u64 addr;  /* virtual address */
+	compat_uptr_t arr; /* array of mfns - top nibble set on err */
+};
+#define IOCTL_PRIVCMD_MMAP_32                   \
+	_IOC(_IOC_NONE, 'P', 2, sizeof(struct privcmd_mmap_32))
+#define IOCTL_PRIVCMD_MMAPBATCH_32                  \
+	_IOC(_IOC_NONE, 'P', 3, sizeof(struct privcmd_mmapbatch_32))
+
+#endif /* __LINUX_XEN_COMPAT_H__ */

  parent reply	other threads:[~2007-07-05 22:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-05 22:27 [PATCH 0 of 6] PowerPC Linux patches, rev 2 Hollis Blanchard
2007-07-05 22:27 ` [PATCH 1 of 6] [XEN][LINUX] Add Kconfig option for the balloon driver Hollis Blanchard
2007-07-05 22:27 ` [PATCH 2 of 6] [XEN][LINUX] Create Xen-specific interface for xlate_dev_mem_* Hollis Blanchard
2007-07-06  8:01   ` [PATCH 2 of 6] [XEN][LINUX] Create Xen-specificinterface " Jan Beulich
2007-07-05 22:27 ` [PATCH 3 of 6] [XEN][LINUX] Add architecture-generic xencomm infrastructure Hollis Blanchard
2007-07-05 22:27 ` [PATCH 4 of 6] [XEN][LINUX] Invert #ifdef for x86-specific *_vm_area() Hollis Blanchard
2007-07-05 22:27 ` [PATCH 5 of 6] [XEN][LINUX] Refactor grant table allocation into arch-specific code Hollis Blanchard
2007-07-06  8:04   ` [PATCH 5 of 6] [XEN][LINUX] Refactor grant tableallocation " Jan Beulich
2007-07-06 13:16   ` [PATCH 5 of 6] [XEN][LINUX] Refactor grant table allocation " Keir Fraser
2007-07-05 22:27 ` Hollis Blanchard [this message]
2007-07-06  8:09   ` [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctlconversion for 64-bit kernels Jan Beulich
2007-07-06  9:29     ` Keir Fraser
2007-07-06 15:44     ` [XenPPC] " Hollis Blanchard
2007-07-06 16:09       ` [XenPPC] Re: [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctlconversion for 64-b Jan Beulich
2007-07-06 18:17         ` Re: [Xen-devel] " Hollis Blanchard
2007-07-09  9:03           ` [XenPPC] " Jan Beulich
2007-07-09  9:11             ` Keir Fraser
  -- strict thread matches above, loose matches on Subject: below --
2007-07-05 21:08 [PATCH 0 of 6] PowerPC Linux patches Hollis Blanchard
2007-07-05 21:08 ` [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctl conversion for 64-bit kernels Hollis Blanchard
2007-07-05 21:35   ` Keir Fraser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3833674b6d561e690b49.1183674475@localhost \
    --to=hollisb@us.ibm.com \
    --cc=keir.fraser@xensource.com \
    --cc=xen-devel@lists.xensource.com \
    --cc=xen-ppc-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.