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 16:08:45 -0500 [thread overview]
Message-ID: <7cae4be9db6be7b7d0c9.1183669725@localhost> (raw)
In-Reply-To: <patchbomb.1183669719@localhost>
5 files changed, 113 insertions(+), 2 deletions(-)
drivers/xen/Makefile | 2
drivers/xen/privcmd/Makefile | 3 -
drivers/xen/privcmd/compat_privcmd.c | 72 ++++++++++++++++++++++++++++++++++
fs/compat_ioctl.c | 16 +++++++
include/xen/public/privcmd.h | 22 ++++++++++
# HG changeset patch
# User Hollis Blanchard <hollisb@us.ibm.com>
# Date 1183669279 18000
# Node ID 7cae4be9db6be7b7d0c91dbb785ae14261c7116d
# Parent 3ece3641ec01362c4333c74688a7f04ae4706ba4
[XEN][LINUX] Add 32-bit privcmd ioctl conversion for 64-bit kernels.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
diff -r 3ece3641ec01 -r 7cae4be9db6b drivers/xen/Makefile
--- a/drivers/xen/Makefile Thu Jul 05 16:01:19 2007 -0500
+++ b/drivers/xen/Makefile Thu Jul 05 16:01:19 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 3ece3641ec01 -r 7cae4be9db6b drivers/xen/privcmd/Makefile
--- a/drivers/xen/privcmd/Makefile Thu Jul 05 16:01:19 2007 -0500
+++ b/drivers/xen/privcmd/Makefile Thu Jul 05 16:01:19 2007 -0500
@@ -1,2 +1,3 @@
-obj-$(CONFIG_XEN_PRIVCMD) := privcmd.o
+obj-y += privcmd.o
+obj-$(CONFIG_COMPAT) += compat_privcmd.o
diff -r 3ece3641ec01 -r 7cae4be9db6b 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 16:01:19 2007 -0500
@@ -0,0 +1,72 @@
+/*
+ * 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>
+
+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 3ece3641ec01 -r 7cae4be9db6b fs/compat_ioctl.c
--- a/fs/compat_ioctl.c Thu Jul 05 16:01:19 2007 -0500
+++ b/fs/compat_ioctl.c Thu Jul 05 16:01:19 2007 -0500
@@ -123,6 +123,10 @@
#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>
/* Aiee. Someone does not find a difference between int and long */
#define EXT2_IOC32_GETFLAGS _IOR('f', 1, int)
@@ -2948,6 +2952,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 3ece3641ec01 -r 7cae4be9db6b include/xen/public/privcmd.h
--- a/include/xen/public/privcmd.h Thu Jul 05 16:01:19 2007 -0500
+++ b/include/xen/public/privcmd.h Thu Jul 05 16:01:19 2007 -0500
@@ -34,6 +34,7 @@
#define __LINUX_PUBLIC_PRIVCMD_H__
#include <linux/types.h>
+#include <linux/compat.h>
#ifndef __user
#define __user
@@ -64,6 +65,27 @@ typedef struct privcmd_mmapbatch {
xen_pfn_t __user *arr; /* array of mfns - top nibble set on err */
} privcmd_mmapbatch_t;
+#ifdef CONFIG_COMPAT
+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
+
/*
* @cmd: IOCTL_PRIVCMD_HYPERCALL
* @arg: &privcmd_hypercall_t
next prev parent reply other threads:[~2007-07-05 21:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-05 21:08 [PATCH 0 of 6] PowerPC Linux patches Hollis Blanchard
2007-07-05 21:08 ` [PATCH 1 of 6] [XEN][LINUX] Add Kconfig option for the balloon driver Hollis Blanchard
2007-07-05 21:08 ` [PATCH 2 of 6] [XEN][LINUX] Create Xen-specific interface for xlate_dev_mem_* Hollis Blanchard
2007-07-05 21:08 ` [PATCH 3 of 6] [XEN][LINUX] Add architecture-generic xencomm infrastructure Hollis Blanchard
2007-07-05 21:29 ` Keir Fraser
2007-07-05 21:35 ` [XenPPC] " Hollis Blanchard
2007-07-05 21:44 ` Keir Fraser
2007-07-05 21:52 ` Hollis Blanchard
2007-07-05 21:08 ` [PATCH 4 of 6] [XEN][LINUX] #ifdef x86-specific alloc_vm_area() Hollis Blanchard
2007-07-05 21:38 ` Keir Fraser
2007-07-05 21:08 ` [PATCH 5 of 6] [XEN][LINUX] Refactor grant table allocation into arch-specific code Hollis Blanchard
2007-07-05 21:08 ` Hollis Blanchard [this message]
2007-07-05 21:35 ` [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctl conversion for 64-bit kernels Keir Fraser
2007-07-05 21:41 ` [PATCH 0 of 6] PowerPC Linux patches Keir Fraser
2007-07-05 21:54 ` [XenPPC] " Hollis Blanchard
-- strict thread matches above, loose matches on Subject: below --
2007-07-05 22:27 [PATCH 0 of 6] PowerPC Linux patches, rev 2 Hollis Blanchard
2007-07-05 22:27 ` [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctl conversion for 64-bit kernels Hollis Blanchard
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=7cae4be9db6be7b7d0c9.1183669725@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.