* [PATCH 2 of 6] [XEN][LINUX] Create Xen-specific interface for xlate_dev_mem_*
2007-07-05 21:08 [PATCH 0 of 6] PowerPC Linux patches Hollis Blanchard
@ 2007-07-05 21:08 ` Hollis Blanchard
0 siblings, 0 replies; 18+ messages in thread
From: Hollis Blanchard @ 2007-07-05 21:08 UTC (permalink / raw)
To: Keir Fraser; +Cc: xen-devel, xen-ppc-devel
3 files changed, 8 insertions(+), 8 deletions(-)
drivers/xen/char/mem.c | 8 ++++----
include/asm-i386/mach-xen/asm/io.h | 4 ++--
include/asm-ia64/uaccess.h | 4 ++--
# HG changeset patch
# User Hollis Blanchard <hollisb@us.ibm.com>
# Date 1183669278 18000
# Node ID 001c42f8079ec50c0b213049a86db173a928652b
# Parent c6a37d0c2d4789866bc20c335ccd36c5dfc2481b
[XEN][LINUX] Create Xen-specific interface for xlate_dev_mem_*
PowerPC builds both drivers/char/mem.c and drivers/xen/char/mem.c at once, so
we cannot hijack the xlate_dev_mem_ptr() interface.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
diff -r c6a37d0c2d47 -r 001c42f8079e drivers/xen/char/mem.c
--- a/drivers/xen/char/mem.c Thu Jul 05 16:01:18 2007 -0500
+++ b/drivers/xen/char/mem.c Thu Jul 05 16:01:18 2007 -0500
@@ -58,7 +58,7 @@ static ssize_t read_mem(struct file * fi
sz = min_t(unsigned long, sz, count);
- v = xlate_dev_mem_ptr(p, sz);
+ v = xen_xlate_dev_mem_ptr(p, sz);
if (IS_ERR(v) || v == NULL) {
/*
* Some programs (e.g., dmidecode) groove off into
@@ -75,7 +75,7 @@ static ssize_t read_mem(struct file * fi
}
ignored = copy_to_user(buf, v, sz);
- xlate_dev_mem_ptr_unmap(v);
+ xen_xlate_dev_mem_ptr_unmap(v);
if (ignored)
return -EFAULT;
buf += sz;
@@ -109,7 +109,7 @@ static ssize_t write_mem(struct file * f
sz = min_t(unsigned long, sz, count);
- v = xlate_dev_mem_ptr(p, sz);
+ v = xen_xlate_dev_mem_ptr(p, sz);
if (v == NULL)
break;
if (IS_ERR(v)) {
@@ -119,7 +119,7 @@ static ssize_t write_mem(struct file * f
}
ignored = copy_from_user(v, buf, sz);
- xlate_dev_mem_ptr_unmap(v);
+ xen_xlate_dev_mem_ptr_unmap(v);
if (ignored) {
written += sz - ignored;
if (written)
diff -r c6a37d0c2d47 -r 001c42f8079e include/asm-i386/mach-xen/asm/io.h
--- a/include/asm-i386/mach-xen/asm/io.h Thu Jul 05 16:01:18 2007 -0500
+++ b/include/asm-i386/mach-xen/asm/io.h Thu Jul 05 16:01:18 2007 -0500
@@ -53,8 +53,8 @@
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
* access
*/
-#define xlate_dev_mem_ptr(p, sz) ioremap(p, sz)
-#define xlate_dev_mem_ptr_unmap(p) iounmap(p)
+#define xen_xlate_dev_mem_ptr(p, sz) ioremap(p, sz)
+#define xen_xlate_dev_mem_ptr_unmap(p) iounmap(p)
/*
* Convert a virtual cached pointer to an uncached pointer
diff -r c6a37d0c2d47 -r 001c42f8079e include/asm-ia64/uaccess.h
--- a/include/asm-ia64/uaccess.h Thu Jul 05 16:01:18 2007 -0500
+++ b/include/asm-ia64/uaccess.h Thu Jul 05 16:01:18 2007 -0500
@@ -382,7 +382,7 @@ xlate_dev_mem_ptr (unsigned long p)
}
#else
static __inline__ char *
-xlate_dev_mem_ptr (unsigned long p, ssize_t sz)
+xen_xlate_dev_mem_ptr (unsigned long p, ssize_t sz)
{
unsigned long pfn = p >> PAGE_SHIFT;
@@ -393,7 +393,7 @@ xlate_dev_mem_ptr (unsigned long p, ssiz
}
static __inline__ void
-xlate_dev_mem_ptr_unmap (char* v)
+xen_xlate_dev_mem_ptr_unmap (char* v)
{
if (REGION_NUMBER(v) == RGN_UNCACHED)
iounmap(v);
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 0 of 6] PowerPC Linux patches, rev 2
@ 2007-07-05 22:27 Hollis Blanchard
2007-07-05 22:27 ` [PATCH 1 of 6] [XEN][LINUX] Add Kconfig option for the balloon driver Hollis Blanchard
` (5 more replies)
0 siblings, 6 replies; 18+ messages in thread
From: Hollis Blanchard @ 2007-07-05 22:27 UTC (permalink / raw)
To: Keir Fraser; +Cc: xen-devel, xen-ppc-devel
Hi Keir, I believe I've addressed all your comments on these patches. Please
apply.
16 files changed, 427 insertions(+), 35 deletions(-)
arch/ia64/xen/hypervisor.c | 5
drivers/xen/Kconfig | 7 +
drivers/xen/Makefile | 4
drivers/xen/char/mem.c | 8 -
drivers/xen/core/Makefile | 1
drivers/xen/core/gnttab.c | 38 +++---
drivers/xen/core/xencomm.c | 192 ++++++++++++++++++++++++++++++++++
drivers/xen/privcmd/Makefile | 3
drivers/xen/privcmd/compat_privcmd.c | 73 ++++++++++++
drivers/xen/util.c | 8 -
fs/compat_ioctl.c | 17 +++
include/asm-i386/mach-xen/asm/io.h | 4
include/asm-ia64/uaccess.h | 4
include/xen/compat_ioctl.h | 45 +++++++
include/xen/gnttab.h | 2
include/xen/xencomm.h | 51 +++++++++
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1 of 6] [XEN][LINUX] Add Kconfig option for the balloon driver
2007-07-05 22:27 [PATCH 0 of 6] PowerPC Linux patches, rev 2 Hollis Blanchard
@ 2007-07-05 22:27 ` Hollis Blanchard
2007-07-05 22:27 ` [PATCH 2 of 6] [XEN][LINUX] Create Xen-specific interface for xlate_dev_mem_* Hollis Blanchard
` (4 subsequent siblings)
5 siblings, 0 replies; 18+ messages in thread
From: Hollis Blanchard @ 2007-07-05 22:27 UTC (permalink / raw)
To: Keir Fraser; +Cc: xen-devel, xen-ppc-devel
2 files changed, 5 insertions(+), 1 deletion(-)
drivers/xen/Kconfig | 4 ++++
drivers/xen/Makefile | 2 +-
# HG changeset patch
# User Hollis Blanchard <hollisb@us.ibm.com>
# Date 1183672706 18000
# Node ID 5c80ef74d4766742a52623f0adf3edc41f42e5b6
# Parent cb040341e05af32c804afef4216ec5491dcbf9e3
[XEN][LINUX] Add Kconfig option for the balloon driver.
PowerPC Xen does not support ballooning.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
diff -r cb040341e05a -r 5c80ef74d476 drivers/xen/Kconfig
--- a/drivers/xen/Kconfig Mon Jul 02 17:19:24 2007 +0100
+++ b/drivers/xen/Kconfig Thu Jul 05 16:58:26 2007 -0500
@@ -274,4 +274,8 @@ config XEN_SMPBOOT
default y
depends on SMP
+config XEN_BALLOON
+ bool
+ default y
+
endif
diff -r cb040341e05a -r 5c80ef74d476 drivers/xen/Makefile
--- a/drivers/xen/Makefile Mon Jul 02 17:19:24 2007 +0100
+++ b/drivers/xen/Makefile Thu Jul 05 16:58:26 2007 -0500
@@ -4,10 +4,10 @@ obj-y += privcmd/
obj-y += privcmd/
obj-y += xenbus/
obj-y += gntdev/
-obj-y += balloon/
obj-y += char/
obj-y += util.o
+obj-$(CONFIG_XEN_BALLOON) += balloon/
obj-$(CONFIG_XEN_BLKDEV_BACKEND) += blkback/
obj-$(CONFIG_XEN_BLKDEV_TAP) += blktap/
obj-$(CONFIG_XEN_NETDEV_BACKEND) += netback/
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 2 of 6] [XEN][LINUX] Create Xen-specific interface for xlate_dev_mem_*
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 ` 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
` (3 subsequent siblings)
5 siblings, 1 reply; 18+ messages in thread
From: Hollis Blanchard @ 2007-07-05 22:27 UTC (permalink / raw)
To: Keir Fraser; +Cc: xen-devel, xen-ppc-devel
3 files changed, 8 insertions(+), 8 deletions(-)
drivers/xen/char/mem.c | 8 ++++----
include/asm-i386/mach-xen/asm/io.h | 4 ++--
include/asm-ia64/uaccess.h | 4 ++--
# HG changeset patch
# User Hollis Blanchard <hollisb@us.ibm.com>
# Date 1183672706 18000
# Node ID 848958bf6c7a2d3be6d7d108367c4e1f3e2f7b65
# Parent 5c80ef74d4766742a52623f0adf3edc41f42e5b6
[XEN][LINUX] Create Xen-specific interface for xlate_dev_mem_*
PowerPC builds both drivers/char/mem.c and drivers/xen/char/mem.c at once, so
we cannot hijack the xlate_dev_mem_ptr() interface.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
diff -r 5c80ef74d476 -r 848958bf6c7a drivers/xen/char/mem.c
--- a/drivers/xen/char/mem.c Thu Jul 05 16:58:26 2007 -0500
+++ b/drivers/xen/char/mem.c Thu Jul 05 16:58:26 2007 -0500
@@ -58,7 +58,7 @@ static ssize_t read_mem(struct file * fi
sz = min_t(unsigned long, sz, count);
- v = xlate_dev_mem_ptr(p, sz);
+ v = xen_xlate_dev_mem_ptr(p, sz);
if (IS_ERR(v) || v == NULL) {
/*
* Some programs (e.g., dmidecode) groove off into
@@ -75,7 +75,7 @@ static ssize_t read_mem(struct file * fi
}
ignored = copy_to_user(buf, v, sz);
- xlate_dev_mem_ptr_unmap(v);
+ xen_xlate_dev_mem_ptr_unmap(v);
if (ignored)
return -EFAULT;
buf += sz;
@@ -109,7 +109,7 @@ static ssize_t write_mem(struct file * f
sz = min_t(unsigned long, sz, count);
- v = xlate_dev_mem_ptr(p, sz);
+ v = xen_xlate_dev_mem_ptr(p, sz);
if (v == NULL)
break;
if (IS_ERR(v)) {
@@ -119,7 +119,7 @@ static ssize_t write_mem(struct file * f
}
ignored = copy_from_user(v, buf, sz);
- xlate_dev_mem_ptr_unmap(v);
+ xen_xlate_dev_mem_ptr_unmap(v);
if (ignored) {
written += sz - ignored;
if (written)
diff -r 5c80ef74d476 -r 848958bf6c7a include/asm-i386/mach-xen/asm/io.h
--- a/include/asm-i386/mach-xen/asm/io.h Thu Jul 05 16:58:26 2007 -0500
+++ b/include/asm-i386/mach-xen/asm/io.h Thu Jul 05 16:58:26 2007 -0500
@@ -53,8 +53,8 @@
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
* access
*/
-#define xlate_dev_mem_ptr(p, sz) ioremap(p, sz)
-#define xlate_dev_mem_ptr_unmap(p) iounmap(p)
+#define xen_xlate_dev_mem_ptr(p, sz) ioremap(p, sz)
+#define xen_xlate_dev_mem_ptr_unmap(p) iounmap(p)
/*
* Convert a virtual cached pointer to an uncached pointer
diff -r 5c80ef74d476 -r 848958bf6c7a include/asm-ia64/uaccess.h
--- a/include/asm-ia64/uaccess.h Thu Jul 05 16:58:26 2007 -0500
+++ b/include/asm-ia64/uaccess.h Thu Jul 05 16:58:26 2007 -0500
@@ -382,7 +382,7 @@ xlate_dev_mem_ptr (unsigned long p)
}
#else
static __inline__ char *
-xlate_dev_mem_ptr (unsigned long p, ssize_t sz)
+xen_xlate_dev_mem_ptr (unsigned long p, ssize_t sz)
{
unsigned long pfn = p >> PAGE_SHIFT;
@@ -393,7 +393,7 @@ xlate_dev_mem_ptr (unsigned long p, ssiz
}
static __inline__ void
-xlate_dev_mem_ptr_unmap (char* v)
+xen_xlate_dev_mem_ptr_unmap (char* v)
{
if (REGION_NUMBER(v) == RGN_UNCACHED)
iounmap(v);
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 3 of 6] [XEN][LINUX] Add architecture-generic xencomm infrastructure
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-05 22:27 ` Hollis Blanchard
2007-07-05 22:27 ` [PATCH 4 of 6] [XEN][LINUX] Invert #ifdef for x86-specific *_vm_area() Hollis Blanchard
` (2 subsequent siblings)
5 siblings, 0 replies; 18+ messages in thread
From: Hollis Blanchard @ 2007-07-05 22:27 UTC (permalink / raw)
To: Keir Fraser; +Cc: xen-devel, xen-ppc-devel
4 files changed, 247 insertions(+)
drivers/xen/Kconfig | 3
drivers/xen/core/Makefile | 1
drivers/xen/core/xencomm.c | 192 ++++++++++++++++++++++++++++++++++++++++++++
include/xen/xencomm.h | 51 +++++++++++
# HG changeset patch
# User Hollis Blanchard <hollisb@us.ibm.com>
# Date 1183672706 18000
# Node ID d5f91f3fbd833a7dd259a0d9332d6534d1f61c6d
# Parent 848958bf6c7a2d3be6d7d108367c4e1f3e2f7b65
[XEN][LINUX] Add architecture-generic xencomm infrastructure.
Xencomm is the mechanism by which userspace can pass virtual addresses to Xen
on architectures that cannot perform page table walks in software, including
PowerPC and IA64.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
diff -r 848958bf6c7a -r d5f91f3fbd83 drivers/xen/Kconfig
--- a/drivers/xen/Kconfig Thu Jul 05 16:58:26 2007 -0500
+++ b/drivers/xen/Kconfig Thu Jul 05 16:58:26 2007 -0500
@@ -278,4 +278,7 @@ config XEN_BALLOON
bool
default y
+config XEN_XENCOMM
+ bool
+
endif
diff -r 848958bf6c7a -r d5f91f3fbd83 drivers/xen/core/Makefile
--- a/drivers/xen/core/Makefile Thu Jul 05 16:58:26 2007 -0500
+++ b/drivers/xen/core/Makefile Thu Jul 05 16:58:26 2007 -0500
@@ -10,3 +10,4 @@ obj-$(CONFIG_XEN_SYSFS) += xen_sysfs.o
obj-$(CONFIG_XEN_SYSFS) += xen_sysfs.o
obj-$(CONFIG_XEN_SMPBOOT) += smpboot.o
obj-$(CONFIG_KEXEC) += machine_kexec.o
+obj-$(CONFIG_XEN_XENCOMM) += xencomm.o
diff -r 848958bf6c7a -r d5f91f3fbd83 drivers/xen/core/xencomm.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/drivers/xen/core/xencomm.c Thu Jul 05 16:58:26 2007 -0500
@@ -0,0 +1,192 @@
+/*
+ * 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: Hollis Blanchard <hollisb@us.ibm.com>
+ */
+
+#include <linux/gfp.h>
+#include <linux/mm.h>
+#include <asm/page.h>
+#include <xen/xencomm.h>
+#include <xen/interface/xen.h>
+
+static int xencomm_init(struct xencomm_desc *desc,
+ void *buffer, unsigned long bytes)
+{
+ unsigned long recorded = 0;
+ int i = 0;
+
+ while ((recorded < bytes) && (i < desc->nr_addrs)) {
+ unsigned long vaddr = (unsigned long)buffer + recorded;
+ unsigned long paddr;
+ int offset;
+ int chunksz;
+
+ offset = vaddr % PAGE_SIZE; /* handle partial pages */
+ chunksz = min(PAGE_SIZE - offset, bytes - recorded);
+
+ paddr = xencomm_vtop(vaddr);
+ if (paddr == ~0UL) {
+ printk("%s: couldn't translate vaddr %lx\n",
+ __func__, vaddr);
+ return -EINVAL;
+ }
+
+ desc->address[i++] = paddr;
+ recorded += chunksz;
+ }
+
+ if (recorded < bytes) {
+ printk("%s: could only translate %ld of %ld bytes\n",
+ __func__, recorded, bytes);
+ return -ENOSPC;
+ }
+
+ /* mark remaining addresses invalid (just for safety) */
+ while (i < desc->nr_addrs)
+ desc->address[i++] = XENCOMM_INVALID;
+
+ desc->magic = XENCOMM_MAGIC;
+
+ return 0;
+}
+
+/* XXX use slab allocator */
+static struct xencomm_desc *xencomm_alloc(gfp_t gfp_mask)
+{
+ struct xencomm_desc *desc;
+
+ desc = (struct xencomm_desc *)__get_free_page(gfp_mask);
+ if (desc == NULL)
+ return NULL;
+
+ desc->nr_addrs = (PAGE_SIZE - sizeof(struct xencomm_desc)) /
+ sizeof(*desc->address);
+
+ return desc;
+}
+
+void xencomm_free(void *desc)
+{
+ if (desc && !((ulong)desc & XENCOMM_INLINE_FLAG))
+ free_page((unsigned long)__va(desc));
+}
+
+static int xencomm_create(void *buffer, unsigned long bytes, struct xencomm_desc **ret, gfp_t gfp_mask)
+{
+ struct xencomm_desc *desc;
+ int rc;
+
+ pr_debug("%s: %p[%ld]\n", __func__, buffer, bytes);
+
+ if (bytes == 0) {
+ /* don't create a descriptor; Xen recognizes NULL. */
+ BUG_ON(buffer != NULL);
+ *ret = NULL;
+ return 0;
+ }
+
+ BUG_ON(buffer == NULL); /* 'bytes' is non-zero */
+
+ desc = xencomm_alloc(gfp_mask);
+ if (!desc) {
+ printk("%s failure\n", "xencomm_alloc");
+ return -ENOMEM;
+ }
+
+ rc = xencomm_init(desc, buffer, bytes);
+ if (rc) {
+ printk("%s failure: %d\n", "xencomm_init", rc);
+ xencomm_free(desc);
+ return rc;
+ }
+
+ *ret = desc;
+ return 0;
+}
+
+/* check if memory address is within VMALLOC region */
+static int is_phys_contiguous(unsigned long addr)
+{
+ if (!is_kernel_addr(addr))
+ return 0;
+
+ return (addr < VMALLOC_START) || (addr >= VMALLOC_END);
+}
+
+static void *xencomm_create_inline(void *ptr)
+{
+ unsigned long paddr;
+
+ BUG_ON(!is_phys_contiguous((unsigned long)ptr));
+
+ paddr = (unsigned long)xencomm_pa(ptr);
+ BUG_ON(paddr & XENCOMM_INLINE_FLAG);
+ return (void *)(paddr | XENCOMM_INLINE_FLAG);
+}
+
+/* "mini" routine, for stack-based communications: */
+static int xencomm_create_mini(void *buffer,
+ unsigned long bytes, struct xencomm_mini *xc_desc,
+ struct xencomm_desc **ret)
+{
+ int rc = 0;
+ struct xencomm_desc *desc;
+
+ desc = (void *)xc_desc;
+
+ desc->nr_addrs = XENCOMM_MINI_ADDRS;
+
+ if (!(rc = xencomm_init(desc, buffer, bytes)))
+ *ret = desc;
+
+ return rc;
+}
+
+void *xencomm_map(void *ptr, unsigned long bytes)
+{
+ int rc;
+ struct xencomm_desc *desc;
+
+ if (is_phys_contiguous((unsigned long)ptr))
+ return xencomm_create_inline(ptr);
+
+ rc = xencomm_create(ptr, bytes, &desc, GFP_KERNEL);
+
+ if (rc || desc == NULL)
+ return NULL;
+
+ return (void *)__pa(desc);
+}
+
+void *__xencomm_map_no_alloc(void *ptr, unsigned long bytes,
+ struct xencomm_mini *xc_desc)
+{
+ int rc;
+ struct xencomm_desc *desc = NULL;
+
+ if (is_phys_contiguous((unsigned long)ptr))
+ return xencomm_create_inline(ptr);
+
+ rc = xencomm_create_mini(ptr, bytes, xc_desc,
+ &desc);
+
+ if (rc)
+ return NULL;
+
+ return (void *)__pa(desc);
+}
diff -r 848958bf6c7a -r d5f91f3fbd83 include/xen/xencomm.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/include/xen/xencomm.h Thu Jul 05 16:58:26 2007 -0500
@@ -0,0 +1,51 @@
+/*
+ * 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: Hollis Blanchard <hollisb@us.ibm.com>
+ * Jerone Young <jyoung5@us.ibm.com>
+ */
+
+#ifndef _LINUX_XENCOMM_H_
+#define _LINUX_XENCOMM_H_
+
+#include <xen/interface/xencomm.h>
+
+#define XENCOMM_MINI_ADDRS 3
+struct xencomm_mini {
+ struct xencomm_desc _desc;
+ uint64_t address[XENCOMM_MINI_ADDRS];
+};
+
+extern void xencomm_free(void *desc);
+extern void *xencomm_map(void *ptr, unsigned long bytes);
+extern void *__xencomm_map_no_alloc(void *ptr, unsigned long bytes,
+ struct xencomm_mini *xc_area);
+
+#define xencomm_map_no_alloc(ptr, bytes) \
+ ({struct xencomm_mini xc_desc\
+ __attribute__((__aligned__(sizeof(struct xencomm_mini))));\
+ __xencomm_map_no_alloc(ptr, bytes, &xc_desc);})
+
+/* provided by architecture code: */
+extern unsigned long xencomm_vtop(unsigned long vaddr);
+
+static inline void *xencomm_pa(void *ptr)
+{
+ return (void *)xencomm_vtop((unsigned long)ptr);
+}
+
+#endif /* _LINUX_XENCOMM_H_ */
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 4 of 6] [XEN][LINUX] Invert #ifdef for x86-specific *_vm_area()
2007-07-05 22:27 [PATCH 0 of 6] PowerPC Linux patches, rev 2 Hollis Blanchard
` (2 preceding siblings ...)
2007-07-05 22:27 ` [PATCH 3 of 6] [XEN][LINUX] Add architecture-generic xencomm infrastructure Hollis Blanchard
@ 2007-07-05 22:27 ` 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-05 22:27 ` [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctl conversion for 64-bit kernels Hollis Blanchard
5 siblings, 0 replies; 18+ messages in thread
From: Hollis Blanchard @ 2007-07-05 22:27 UTC (permalink / raw)
To: Keir Fraser; +Cc: xen-devel, xen-ppc-devel
1 file changed, 2 insertions(+), 6 deletions(-)
drivers/xen/util.c | 8 ++------
# HG changeset patch
# User Hollis Blanchard <hollisb@us.ibm.com>
# Date 1183672706 18000
# Node ID 790e4d5567dcd8bfb42ae1e67ad1f3dffd29ece1
# Parent d5f91f3fbd833a7dd259a0d9332d6534d1f61c6d
[XEN][LINUX] Invert #ifdef for x86-specific *_vm_area().
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
diff -r d5f91f3fbd83 -r 790e4d5567dc drivers/xen/util.c
--- a/drivers/xen/util.c Thu Jul 05 16:58:26 2007 -0500
+++ b/drivers/xen/util.c Thu Jul 05 16:58:26 2007 -0500
@@ -22,9 +22,7 @@ struct class *get_xen_class(void)
}
EXPORT_SYMBOL_GPL(get_xen_class);
-/* Todo: merge ia64 ('auto-translate physmap') versions of these functions. */
-#ifndef __ia64__
-
+#ifdef CONFIG_X86
static int f(pte_t *pte, struct page *pmd_page, unsigned long addr, void *data)
{
/* apply_to_page_range() does all the hard work. */
@@ -50,9 +48,7 @@ struct vm_struct *alloc_vm_area(unsigned
}
/* Map page directories into every address space. */
-#ifdef CONFIG_X86
vmalloc_sync_all();
-#endif
return area;
}
@@ -67,4 +63,4 @@ void free_vm_area(struct vm_struct *area
}
EXPORT_SYMBOL_GPL(free_vm_area);
-#endif /* !__ia64__ */
+#endif /* CONFIG_X86 */
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 5 of 6] [XEN][LINUX] Refactor grant table allocation into arch-specific code
2007-07-05 22:27 [PATCH 0 of 6] PowerPC Linux patches, rev 2 Hollis Blanchard
` (3 preceding siblings ...)
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 ` 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 ` [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctl conversion for 64-bit kernels Hollis Blanchard
5 siblings, 2 replies; 18+ messages in thread
From: Hollis Blanchard @ 2007-07-05 22:27 UTC (permalink / raw)
To: Keir Fraser; +Cc: xen-devel, xen-ppc-devel
3 files changed, 27 insertions(+), 18 deletions(-)
arch/ia64/xen/hypervisor.c | 5 +++++
drivers/xen/core/gnttab.c | 38 ++++++++++++++++++++------------------
include/xen/gnttab.h | 2 ++
# HG changeset patch
# User Hollis Blanchard <hollisb@us.ibm.com>
# Date 1183674347 18000
# Node ID 9def23611685442dc9688ad8f81db9a5031b4b5f
# Parent 790e4d5567dcd8bfb42ae1e67ad1f3dffd29ece1
[XEN][LINUX] Refactor grant table allocation into arch-specific code.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
diff -r 790e4d5567dc -r 9def23611685 arch/ia64/xen/hypervisor.c
--- a/arch/ia64/xen/hypervisor.c Thu Jul 05 16:58:26 2007 -0500
+++ b/arch/ia64/xen/hypervisor.c Thu Jul 05 17:25:47 2007 -0500
@@ -408,6 +408,11 @@ __xen_destroy_contiguous_region(unsigned
#include <linux/mm.h>
#include <xen/interface/xen.h>
#include <xen/gnttab.h>
+
+void *arch_gnttab_alloc_shared(unsigned long *frames)
+{
+ return __va(frames[0] << PAGE_SHIFT);
+}
static void
gnttab_map_grant_ref_pre(struct gnttab_map_grant_ref *uop)
diff -r 790e4d5567dc -r 9def23611685 drivers/xen/core/gnttab.c
--- a/drivers/xen/core/gnttab.c Thu Jul 05 16:58:26 2007 -0500
+++ b/drivers/xen/core/gnttab.c Thu Jul 05 17:25:47 2007 -0500
@@ -430,7 +430,7 @@ static inline unsigned int max_nr_grant_
#ifdef CONFIG_XEN
-#ifndef __ia64__
+#ifdef __x86__
static int map_pte_fn(pte_t *pte, struct page *pmd_page,
unsigned long addr, void *data)
{
@@ -448,7 +448,22 @@ static int unmap_pte_fn(pte_t *pte, stru
set_pte_at(&init_mm, addr, pte, __pte(0));
return 0;
}
-#endif
+
+void *arch_gnttab_alloc_shared(unsigned long *frames)
+{
+ unsigned long *_frames = frames;
+ struct vm_struct *area;
+
+ area = alloc_vm_area(PAGE_SIZE * max_nr_grant_frames());
+ BUG_ON(area == NULL);
+
+ rc = apply_to_page_range(&init_mm, (unsigned long)area->addr,
+ PAGE_SIZE * nr_gframes,
+ map_pte_fn, &_frames);
+ BUG_ON(rc);
+ return area->addr;
+}
+#endif /* __x86__ */
static int gnttab_map(unsigned int start_idx, unsigned int end_idx)
{
@@ -473,21 +488,8 @@ static int gnttab_map(unsigned int start
BUG_ON(rc || setup.status);
-#ifndef __ia64__
- if (shared == NULL) {
- struct vm_struct *area;
- area = alloc_vm_area(PAGE_SIZE * max_nr_grant_frames());
- BUG_ON(area == NULL);
- shared = area->addr;
- }
- rc = apply_to_page_range(&init_mm, (unsigned long)shared,
- PAGE_SIZE * nr_gframes,
- map_pte_fn, &frames);
- BUG_ON(rc);
- frames -= nr_gframes; /* adjust after map_pte_fn() */
-#else
- shared = __va(frames[0] << PAGE_SHIFT);
-#endif
+ if (shared == NULL)
+ shared = arch_gnttab_alloc_shared(frames);
kfree(frames);
@@ -623,7 +625,7 @@ int gnttab_resume(void)
int gnttab_suspend(void)
{
-#ifndef __ia64__
+#ifdef CONFIG_X86
apply_to_page_range(&init_mm, (unsigned long)shared,
PAGE_SIZE * nr_grant_frames,
unmap_pte_fn, NULL);
diff -r 790e4d5567dc -r 9def23611685 include/xen/gnttab.h
--- a/include/xen/gnttab.h Thu Jul 05 16:58:26 2007 -0500
+++ b/include/xen/gnttab.h Thu Jul 05 17:25:47 2007 -0500
@@ -117,6 +117,8 @@ int gnttab_suspend(void);
int gnttab_suspend(void);
int gnttab_resume(void);
+void *arch_gnttab_alloc_shared(unsigned long *frames);
+
static inline void
gnttab_set_map_op(struct gnttab_map_grant_ref *map, maddr_t addr,
uint32_t flags, grant_ref_t ref, domid_t domid)
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctl conversion for 64-bit kernels
2007-07-05 22:27 [PATCH 0 of 6] PowerPC Linux patches, rev 2 Hollis Blanchard
` (4 preceding siblings ...)
2007-07-05 22:27 ` [PATCH 5 of 6] [XEN][LINUX] Refactor grant table allocation into arch-specific code Hollis Blanchard
@ 2007-07-05 22:27 ` Hollis Blanchard
2007-07-06 8:09 ` [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctlconversion " Jan Beulich
5 siblings, 1 reply; 18+ messages in thread
From: Hollis Blanchard @ 2007-07-05 22:27 UTC (permalink / raw)
To: Keir Fraser; +Cc: xen-devel, xen-ppc-devel
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__ */
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2 of 6] [XEN][LINUX] Create Xen-specificinterface for xlate_dev_mem_*
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 ` Jan Beulich
0 siblings, 0 replies; 18+ messages in thread
From: Jan Beulich @ 2007-07-06 8:01 UTC (permalink / raw)
To: Hollis Blanchard, Keir Fraser; +Cc: xen-devel, xen-ppc-devel
>--- a/include/asm-i386/mach-xen/asm/io.h Thu Jul 05 16:58:26 2007 -0500
>+++ b/include/asm-i386/mach-xen/asm/io.h Thu Jul 05 16:58:26 2007 -0500
>@@ -53,8 +53,8 @@
> * Convert a physical pointer to a virtual kernel pointer for /dev/mem
> * access
> */
>-#define xlate_dev_mem_ptr(p, sz) ioremap(p, sz)
>-#define xlate_dev_mem_ptr_unmap(p) iounmap(p)
>+#define xen_xlate_dev_mem_ptr(p, sz) ioremap(p, sz)
>+#define xen_xlate_dev_mem_ptr_unmap(p) iounmap(p)
>
> /*
> * Convert a virtual cached pointer to an uncached pointer
Isn't the same adjustment needed to include/asm-x86_64/mach-xen/asm/io.h?
Jan
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 5 of 6] [XEN][LINUX] Refactor grant tableallocation into arch-specific code
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 ` Jan Beulich
2007-07-06 13:16 ` [PATCH 5 of 6] [XEN][LINUX] Refactor grant table allocation " Keir Fraser
1 sibling, 0 replies; 18+ messages in thread
From: Jan Beulich @ 2007-07-06 8:04 UTC (permalink / raw)
To: Hollis Blanchard, Keir Fraser; +Cc: xen-devel, xen-ppc-devel
>--- a/drivers/xen/core/gnttab.c Thu Jul 05 16:58:26 2007 -0500
>+++ b/drivers/xen/core/gnttab.c Thu Jul 05 17:25:47 2007 -0500
>@@ -430,7 +430,7 @@ static inline unsigned int max_nr_grant_
>
> #ifdef CONFIG_XEN
>
>-#ifndef __ia64__
>+#ifdef __x86__
> static int map_pte_fn(pte_t *pte, struct page *pmd_page,
> unsigned long addr, void *data)
> {
#ifdef CONFIG_X86, just like you did one or two hunks later?
Jan
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctlconversion for 64-bit kernels
2007-07-05 22:27 ` [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctl conversion for 64-bit kernels Hollis Blanchard
@ 2007-07-06 8:09 ` Jan Beulich
2007-07-06 9:29 ` Keir Fraser
2007-07-06 15:44 ` [XenPPC] " Hollis Blanchard
0 siblings, 2 replies; 18+ messages in thread
From: Jan Beulich @ 2007-07-06 8:09 UTC (permalink / raw)
To: Hollis Blanchard, Keir Fraser; +Cc: xen-devel, xen-ppc-devel
>--- 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
>@@ -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)
Where does the hypercall argument translation happen?
>+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);
Jan
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctlconversion for 64-bit kernels
2007-07-06 8:09 ` [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctlconversion " Jan Beulich
@ 2007-07-06 9:29 ` Keir Fraser
2007-07-06 15:44 ` [XenPPC] " Hollis Blanchard
1 sibling, 0 replies; 18+ messages in thread
From: Keir Fraser @ 2007-07-06 9:29 UTC (permalink / raw)
To: Jan Beulich, Hollis Blanchard; +Cc: xen-devel, xen-ppc-devel
On 6/7/07 09:09, "Jan Beulich" <jbeulich@novell.com> wrote:
>> --- 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
>> @@ -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)
>
> Where does the hypercall argument translation happen?
I'll check in patches 1-5 now, addressing Jan's minor comments. Sounds like
this one needs at least an email response, or maybe another iteration.
-- Keir
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 5 of 6] [XEN][LINUX] Refactor grant table allocation into arch-specific code
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 ` Keir Fraser
1 sibling, 0 replies; 18+ messages in thread
From: Keir Fraser @ 2007-07-06 13:16 UTC (permalink / raw)
To: Hollis Blanchard; +Cc: xen-devel, xen-ppc-devel
Patches 1 thru 4 are applied. This one (patch 5) breaks the x86 build and
even if that is fixed breaks the semantics of gnttab_map()
(apply_to_page_range() is invoked on every call, not just when
shared==NULL).
-- Keir
On 5/7/07 23:27, "Hollis Blanchard" <hollisb@us.ibm.com> wrote:
> 3 files changed, 27 insertions(+), 18 deletions(-)
> arch/ia64/xen/hypervisor.c | 5 +++++
> drivers/xen/core/gnttab.c | 38 ++++++++++++++++++++------------------
> include/xen/gnttab.h | 2 ++
>
>
> # HG changeset patch
> # User Hollis Blanchard <hollisb@us.ibm.com>
> # Date 1183674347 18000
> # Node ID 9def23611685442dc9688ad8f81db9a5031b4b5f
> # Parent 790e4d5567dcd8bfb42ae1e67ad1f3dffd29ece1
> [XEN][LINUX] Refactor grant table allocation into arch-specific code.
> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
>
> diff -r 790e4d5567dc -r 9def23611685 arch/ia64/xen/hypervisor.c
> --- a/arch/ia64/xen/hypervisor.c Thu Jul 05 16:58:26 2007 -0500
> +++ b/arch/ia64/xen/hypervisor.c Thu Jul 05 17:25:47 2007 -0500
> @@ -408,6 +408,11 @@ __xen_destroy_contiguous_region(unsigned
> #include <linux/mm.h>
> #include <xen/interface/xen.h>
> #include <xen/gnttab.h>
> +
> +void *arch_gnttab_alloc_shared(unsigned long *frames)
> +{
> + return __va(frames[0] << PAGE_SHIFT);
> +}
>
> static void
> gnttab_map_grant_ref_pre(struct gnttab_map_grant_ref *uop)
> diff -r 790e4d5567dc -r 9def23611685 drivers/xen/core/gnttab.c
> --- a/drivers/xen/core/gnttab.c Thu Jul 05 16:58:26 2007 -0500
> +++ b/drivers/xen/core/gnttab.c Thu Jul 05 17:25:47 2007 -0500
> @@ -430,7 +430,7 @@ static inline unsigned int max_nr_grant_
>
> #ifdef CONFIG_XEN
>
> -#ifndef __ia64__
> +#ifdef __x86__
> static int map_pte_fn(pte_t *pte, struct page *pmd_page,
> unsigned long addr, void *data)
> {
> @@ -448,7 +448,22 @@ static int unmap_pte_fn(pte_t *pte, stru
> set_pte_at(&init_mm, addr, pte, __pte(0));
> return 0;
> }
> -#endif
> +
> +void *arch_gnttab_alloc_shared(unsigned long *frames)
> +{
> + unsigned long *_frames = frames;
> + struct vm_struct *area;
> +
> + area = alloc_vm_area(PAGE_SIZE * max_nr_grant_frames());
> + BUG_ON(area == NULL);
> +
> + rc = apply_to_page_range(&init_mm, (unsigned long)area->addr,
> + PAGE_SIZE * nr_gframes,
> + map_pte_fn, &_frames);
> + BUG_ON(rc);
> + return area->addr;
> +}
> +#endif /* __x86__ */
>
> static int gnttab_map(unsigned int start_idx, unsigned int end_idx)
> {
> @@ -473,21 +488,8 @@ static int gnttab_map(unsigned int start
>
> BUG_ON(rc || setup.status);
>
> -#ifndef __ia64__
> - if (shared == NULL) {
> - struct vm_struct *area;
> - area = alloc_vm_area(PAGE_SIZE * max_nr_grant_frames());
> - BUG_ON(area == NULL);
> - shared = area->addr;
> - }
> - rc = apply_to_page_range(&init_mm, (unsigned long)shared,
> - PAGE_SIZE * nr_gframes,
> - map_pte_fn, &frames);
> - BUG_ON(rc);
> - frames -= nr_gframes; /* adjust after map_pte_fn() */
> -#else
> - shared = __va(frames[0] << PAGE_SHIFT);
> -#endif
> + if (shared == NULL)
> + shared = arch_gnttab_alloc_shared(frames);
>
> kfree(frames);
>
> @@ -623,7 +625,7 @@ int gnttab_resume(void)
>
> int gnttab_suspend(void)
> {
> -#ifndef __ia64__
> +#ifdef CONFIG_X86
> apply_to_page_range(&init_mm, (unsigned long)shared,
> PAGE_SIZE * nr_grant_frames,
> unmap_pte_fn, NULL);
> diff -r 790e4d5567dc -r 9def23611685 include/xen/gnttab.h
> --- a/include/xen/gnttab.h Thu Jul 05 16:58:26 2007 -0500
> +++ b/include/xen/gnttab.h Thu Jul 05 17:25:47 2007 -0500
> @@ -117,6 +117,8 @@ int gnttab_suspend(void);
> int gnttab_suspend(void);
> int gnttab_resume(void);
>
> +void *arch_gnttab_alloc_shared(unsigned long *frames);
> +
> static inline void
> gnttab_set_map_op(struct gnttab_map_grant_ref *map, maddr_t addr,
> uint32_t flags, grant_ref_t ref, domid_t domid)
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [XenPPC] Re: [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctlconversion for 64-bit kernels
2007-07-06 8:09 ` [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctlconversion " Jan Beulich
2007-07-06 9:29 ` Keir Fraser
@ 2007-07-06 15:44 ` 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
1 sibling, 1 reply; 18+ messages in thread
From: Hollis Blanchard @ 2007-07-06 15:44 UTC (permalink / raw)
To: Jan Beulich; +Cc: xen-devel, Keir Fraser, xen-ppc-devel
On Fri, 2007-07-06 at 09:09 +0100, Jan Beulich wrote:
> >--- 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
> >@@ -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)
>
> Where does the hypercall argument translation happen?
It happens inside privcmd_hypercall(). See
http://xenbits.xensource.com/ext/linux-ppc-2.6.hg?file/04f6ad5d9232/arch/powerpc/platforms/xen/hcall.c
(In that tree, the function is named "arch_privcmd_hypercall".) IA64 and
PPC both implement this function now; only x86 is left with #ifdefs in
drivers/xen/privcmd/privcmd.c .
COMPATIBLE_IOCTL is just about the ioctl itself, not the sub-structures.
--
Hollis Blanchard
IBM Linux Technology Center
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [XenPPC] Re: [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctlconversion for 64-b
2007-07-06 15:44 ` [XenPPC] " Hollis Blanchard
@ 2007-07-06 16:09 ` Jan Beulich
2007-07-06 18:17 ` Re: [Xen-devel] " Hollis Blanchard
0 siblings, 1 reply; 18+ messages in thread
From: Jan Beulich @ 2007-07-06 16:09 UTC (permalink / raw)
To: Hollis Blanchard; +Cc: xen-devel, Keir Fraser, xen-ppc-devel
>>> Hollis Blanchard <hollisb@us.ibm.com> 06.07.07 17:44 >>>
>> Where does the hypercall argument translation happen?
>
>It happens inside privcmd_hypercall(). See
>http://xenbits.xensource.com/ext/linux-ppc-2.6.hg?file/04f6ad5d9232/arch/powerpc/platforms/xen/hcall.c
>
>(In that tree, the function is named "arch_privcmd_hypercall".) IA64 and
>PPC both implement this function now; only x86 is left with #ifdefs in
>drivers/xen/privcmd/privcmd.c .
>
>COMPATIBLE_IOCTL is just about the ioctl itself, not the sub-structures.
Hmm, I can't really see any structures being translated there, all I see is
guest handles getting dereferenced. So I'm still unclear where you do the
32-bit layout to 64-bit layout conversion, but obviously I must be missing
something.
Jan
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: Re: [Xen-devel] [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctlconversion for 64-b
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 ` Hollis Blanchard
2007-07-09 9:03 ` [XenPPC] " Jan Beulich
0 siblings, 1 reply; 18+ messages in thread
From: Hollis Blanchard @ 2007-07-06 18:17 UTC (permalink / raw)
To: Jan Beulich; +Cc: xen-devel, Keir Fraser, xen-ppc-devel
On Fri, 2007-07-06 at 17:09 +0100, Jan Beulich wrote:
> >>> Hollis Blanchard <hollisb@us.ibm.com> 06.07.07 17:44 >>>
> >> Where does the hypercall argument translation happen?
> >
> >It happens inside privcmd_hypercall(). See
> >http://xenbits.xensource.com/ext/linux-ppc-2.6.hg?file/04f6ad5d9232/arch/powerpc/platforms/xen/hcall.c
> >
> >(In that tree, the function is named "arch_privcmd_hypercall".) IA64 and
> >PPC both implement this function now; only x86 is left with #ifdefs in
> >drivers/xen/privcmd/privcmd.c .
> >
> >COMPATIBLE_IOCTL is just about the ioctl itself, not the sub-structures.
>
> Hmm, I can't really see any structures being translated there, all I see is
> guest handles getting dereferenced. So I'm still unclear where you do the
> 32-bit layout to 64-bit layout conversion, but obviously I must be missing
> something.
Which structures do you think need further conversion?
We've already fixed all the shared structures (e.g. sysctl) to use
explicitly-sized types, so the PowerPC port has always had proper
interfaces. For example, look at the definition of xen_ulong_t on the
different architectures. The x86 interfaces were frozen too early,
cementing this problem for you.
--
Hollis Blanchard
IBM Linux Technology Center
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [XenPPC] Re: [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctlconversion for 64-b
2007-07-06 18:17 ` Re: [Xen-devel] " Hollis Blanchard
@ 2007-07-09 9:03 ` Jan Beulich
2007-07-09 9:11 ` Keir Fraser
0 siblings, 1 reply; 18+ messages in thread
From: Jan Beulich @ 2007-07-09 9:03 UTC (permalink / raw)
To: Hollis Blanchard; +Cc: xen-devel, Keir Fraser, xen-ppc-devel
>Which structures do you think need further conversion?
>
>We've already fixed all the shared structures (e.g. sysctl) to use
>explicitly-sized types, so the PowerPC port has always had proper
>interfaces. For example, look at the definition of xen_ulong_t on the
>different architectures. The x86 interfaces were frozen too early,
>cementing this problem for you.
Oh, sorry, I forgot that you had this taken care of implicitly on PPC.
I had hoped we could leverage the code you are adding for x86, but -
no luck.
Jan
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [XenPPC] Re: [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctlconversion for 64-b
2007-07-09 9:03 ` [XenPPC] " Jan Beulich
@ 2007-07-09 9:11 ` Keir Fraser
0 siblings, 0 replies; 18+ messages in thread
From: Keir Fraser @ 2007-07-09 9:11 UTC (permalink / raw)
To: Jan Beulich, Hollis Blanchard; +Cc: xen-devel, Keir Fraser, xen-ppc-devel
On 9/7/07 10:03, "Jan Beulich" <jbeulich@novell.com> wrote:
>> We've already fixed all the shared structures (e.g. sysctl) to use
>> explicitly-sized types, so the PowerPC port has always had proper
>> interfaces. For example, look at the definition of xen_ulong_t on the
>> different architectures. The x86 interfaces were frozen too early,
>> cementing this problem for you.
>
> Oh, sorry, I forgot that you had this taken care of implicitly on PPC.
> I had hoped we could leverage the code you are adding for x86, but -
> no luck.
I think the only structure that actually needs conversion is the xen_pfn_t
array in privcmd_mmapbatch. So it's not as bad as it first appears.
-- Keir
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2007-07-09 9:11 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctl conversion for 64-bit kernels Hollis Blanchard
2007-07-06 8:09 ` [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctlconversion " 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 2 of 6] [XEN][LINUX] Create Xen-specific interface for xlate_dev_mem_* Hollis Blanchard
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.