[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [linux-2.6.18-xen] Add 32-bit privcmd ioctl conversion for 64-bit kernels.
# HG changeset patch # User kfraser@xxxxxxxxxxxxxxxxxxxxx # Date 1183739753 -3600 # Node ID e5f633c330254ac744c3e7447c156f63ad453363 # Parent 22c388bfd719d291482f81859e12f29aefc96a98 Add 32-bit privcmd ioctl conversion for 64-bit kernels. Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx> --- 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 +++++++++++++++++++++ 5 files changed, 138 insertions(+), 2 deletions(-) diff -r 22c388bfd719 -r e5f633c33025 drivers/xen/Makefile --- a/drivers/xen/Makefile Fri Jul 06 17:33:03 2007 +0100 +++ b/drivers/xen/Makefile Fri Jul 06 17:35:53 2007 +0100 @@ -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 22c388bfd719 -r e5f633c33025 drivers/xen/privcmd/Makefile --- a/drivers/xen/privcmd/Makefile Fri Jul 06 17:33:03 2007 +0100 +++ b/drivers/xen/privcmd/Makefile Fri Jul 06 17:35:53 2007 +0100 @@ -1,2 +1,3 @@ -obj-$(CONFIG_XEN_PRIVCMD) := privcmd.o +obj-y += privcmd.o +obj-$(CONFIG_COMPAT) += compat_privcmd.o diff -r 22c388bfd719 -r e5f633c33025 drivers/xen/privcmd/compat_privcmd.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/xen/privcmd/compat_privcmd.c Fri Jul 06 17:35:53 2007 +0100 @@ -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@xxxxxxxxxxxxxx> + */ + +#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 22c388bfd719 -r e5f633c33025 fs/compat_ioctl.c --- a/fs/compat_ioctl.c Fri Jul 06 17:33:03 2007 +0100 +++ b/fs/compat_ioctl.c Fri Jul 06 17:35:53 2007 +0100 @@ -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 22c388bfd719 -r e5f633c33025 include/xen/compat_ioctl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/xen/compat_ioctl.h Fri Jul 06 17:35:53 2007 +0100 @@ -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@xxxxxxxxxxxxxx> + * Hollis Blanchard <hollisb@xxxxxxxxxx> + */ + +#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__ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |