Skip to contentSkip to conversation

PowerPC Linux patches

PATCH In review Hollis Blanchard 2 participants 15 messages Jul 5, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PowerPC Linux patches

Hi Keir, we've been maintaining PowerPC Linux patches in our own tree for quite a while. This patch queue brings them into the new linux-2.6.18-xen.hg tree.

These patches reorganize arch-generic Xen Linux code, so I'm sending them by mail for review. If they are acceptable, I will commit them (and the PowerPC code that depends on them) to the PowerPC Linux tree so you can pull from there.

Please review.

16 files changed, 404 insertions(+), 36 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            |   39 +++---
drivers/xen/core/xencomm.c           |  192 ++++++++++++++++++++++++++++++++++
drivers/xen/privcmd/Makefile         |    3 
drivers/xen/privcmd/compat_privcmd.c |   72 ++++++++++++
drivers/xen/util.c                   |   10 -
fs/compat_ioctl.c                    |   16 ++
include/asm-i386/mach-xen/asm/io.h   |    4 
include/asm-ia64/uaccess.h           |    4 
include/xen/gnttab.h                 |    2 
include/xen/public/privcmd.h         |   22 +++
include/xen/xencomm.h                |   51 +++++++++
#1 lore raw

PATCH 1/1 Add Kconfig option for the balloon driver

2 files changed, 5 insertions(+), 1 deletion(-)
drivers/xen/Kconfig  |    4 ++++
drivers/xen/Makefile |    2 +-

# HG changeset patch
# User Hollis Blanchard <[email protected]>
# Date 1183669278 18000
# Node ID c6a37d0c2d4789866bc20c335ccd36c5dfc2481b # Parent cb040341e05af32c804afef4216ec5491dcbf9e3 [XEN][LINUX] Add Kconfig option for the balloon driver. PowerPC Xen does not support ballooning.

drivers/xen/Kconfig +4 -0
diff -r cb040341e05a -r c6a37d0c2d47 drivers/xen/Kconfig
@@ -274,4 +274,8 @@ config XEN_SMPBOOT
 	default y
 	depends on SMP
 
+config XEN_BALLOON
+	bool
+	default y
+
 endif
drivers/xen/Makefile +1 -1
diff -r cb040341e05a -r c6a37d0c2d47 drivers/xen/Makefile
@@ -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/
#2 lore raw

PATCH 1/1 Create Xen-specific interface for xlate_dev_mem_*

In reply to Hollis Blanchard
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 <[email protected]>
# 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.

drivers/xen/char/mem.c +4 -4
diff -r c6a37d0c2d47 -r 001c42f8079e drivers/xen/char/mem.c
@@ -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)
include/asm-i386/mach-xen/asm/io.h +2 -2
diff -r c6a37d0c2d47 -r 001c42f8079e include/asm-i386/mach-xen/asm/io.h
@@ -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
include/asm-ia64/uaccess.h +2 -2
diff -r c6a37d0c2d47 -r 001c42f8079e include/asm-ia64/uaccess.h
@@ -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);
#3 lore raw

PATCH 1/1 Add architecture-generic xencomm infrastructure

In reply to Hollis Blanchard
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 <[email protected]>
# Date 1183669278 18000
# Node ID e2681868041e35f127ee6cb5111317c3a96505e8
# Parent 001c42f8079ec50c0b213049a86db173a928652b
[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.

drivers/xen/Kconfig +3 -0
diff -r 001c42f8079e -r e2681868041e drivers/xen/Kconfig
@@ -278,4 +278,7 @@ config XEN_BALLOON
 	bool
 	default y
 
+config XEN_XENCOMM
+	bool
+
 endif
drivers/xen/core/Makefile +1 -0
diff -r 001c42f8079e -r e2681868041e drivers/xen/core/Makefile
@@ -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
drivers/xen/core/xencomm.c new file +192 -0

192 lines not on this page · raw message

include/xen/xencomm.h new file +51 -0

51 lines not on this page · raw message

#8 lore raw

PATCH 1/1 #ifdef x86-specific alloc_vm_area()

In reply to Hollis Blanchard
1 file changed, 3 insertions(+), 7 deletions(-)

drivers/xen/util.c | 10 +++-------

# HG changeset patch
# User Hollis Blanchard <[email protected]>
# Date 1183669278 18000
# Node ID 4d8b8e9dd58e1de258d7418f5dabf694501b1bd8
# Parent e2681868041e35f127ee6cb5111317c3a96505e8
[XEN][LINUX] #ifdef x86-specific alloc_vm_area().
Since neither IA64 nor PowerPC wants this code, in the future it should really be moved out of drivers/xen/

drivers/xen/util.c +3 -7
diff -r e2681868041e -r 4d8b8e9dd58e drivers/xen/util.c
@@ -22,9 +22,8 @@ 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
+/* Todo: Move these functions into arch-specific code. */
 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 +49,7 @@ struct vm_struct *alloc_vm_area(unsigned
 	}
 
 	/* Map page directories into every address space. */
-#ifdef CONFIG_X86
 	vmalloc_sync_all();
-#endif
 
 	return area;
 }
@@ -66,5 +63,4 @@ void free_vm_area(struct vm_struct *area
 	kfree(area);
 }
 EXPORT_SYMBOL_GPL(free_vm_area);
-
-#endif /* !__ia64__ */
+#endif /* CONFIG_X86 */
#10 lore raw

PATCH 1/1 Refactor grant table allocation into arch-specific code

In reply to Hollis Blanchard
3 files changed, 28 insertions(+), 18 deletions(-)
arch/ia64/xen/hypervisor.c |    5 +++++
drivers/xen/core/gnttab.c  |   39 +++++++++++++++++++++------------------
include/xen/gnttab.h       |    2 ++

# HG changeset patch
# User Hollis Blanchard <[email protected]>
# Date 1183669279 18000
# Node ID 3ece3641ec01362c4333c74688a7f04ae4706ba4
# Parent 4d8b8e9dd58e1de258d7418f5dabf694501b1bd8 [XEN][LINUX] Refactor grant table allocation into arch-specific code. In the future, x86 code should be moved out of drivers/xen/

arch/ia64/xen/hypervisor.c +5 -0
diff -r 4d8b8e9dd58e -r 3ece3641ec01 arch/ia64/xen/hypervisor.c
@@ -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)
drivers/xen/core/gnttab.c +21 -18
diff -r 4d8b8e9dd58e -r 3ece3641ec01 drivers/xen/core/gnttab.c
@@ -430,7 +430,8 @@ static inline unsigned int max_nr_grant_
 
 #ifdef CONFIG_XEN
 
-#ifndef __ia64__
+#ifdef __x86__
+/* XXX Move this code. */
 static int map_pte_fn(pte_t *pte, struct page *pmd_page,
 		      unsigned long addr, void *data)
 {
@@ -448,7 +449,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 +489,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 +626,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);
include/xen/gnttab.h +2 -0
diff -r 4d8b8e9dd58e -r 3ece3641ec01 include/xen/gnttab.h
@@ -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)
#11 lore raw

PATCH 1/1 Add 32-bit privcmd ioctl conversion for 64-bit kernels

In reply to Hollis Blanchard
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 <[email protected]>
# Date 1183669279 18000
# Node ID 7cae4be9db6be7b7d0c91dbb785ae14261c7116d
# Parent 3ece3641ec01362c4333c74688a7f04ae4706ba4 [XEN][LINUX] Add 32-bit privcmd ioctl conversion for 64-bit kernels.

drivers/xen/Makefile +1 -1
diff -r 3ece3641ec01 -r 7cae4be9db6b drivers/xen/Makefile
@@ -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/
drivers/xen/privcmd/Makefile +2 -1
diff -r 3ece3641ec01 -r 7cae4be9db6b drivers/xen/privcmd/Makefile
@@ -1,2 +1,3 @@
 
-obj-$(CONFIG_XEN_PRIVCMD)	:= privcmd.o
+obj-y	+= privcmd.o
+obj-$(CONFIG_COMPAT)	+= compat_privcmd.o
drivers/xen/privcmd/compat_privcmd.c new file +72 -0

72 lines not on this page · raw message

fs/compat_ioctl.c +16 -0
diff -r 3ece3641ec01 -r 7cae4be9db6b fs/compat_ioctl.c
@@ -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);
include/xen/public/privcmd.h +22 -0
diff -r 3ece3641ec01 -r 7cae4be9db6b include/xen/public/privcmd.h
@@ -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
#4 lore raw

Re: [PATCH 3 of 6] [XEN][LINUX] Add architecture-generic xencomm infrastructure

In reply to Hollis Blanchard

drivers/xen/Kconfig Thu Jul 05 16:01:18 2007 -0500

Quoted 10 lines · Hollis Blanchard

diff -r 001c42f8079e -r e2681868041e drivers/xen/Kconfig

drivers/xen/Kconfig Thu Jul 05 16:01:18 2007 -0500 +0 -0
@@ -278,4 +278,7 @@ config XEN_BALLOON

bool
default y

drivers/xen/Kconfig Thu Jul 05 16:01:18 2007 -0500 +3 -0
+config XEN_XENCOMM
+ bool
+

Shouldn't this have a 'depends on', and 'default y'?

-- Keir

#12 lore raw

Re: [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctl conversion for 64-bit kernels

In reply to Hollis Blanchard

CONFIG_COMPAT stuff doesn't belong in include/xen/public/privcmd.h. That header is shared with userspace so it should stay clean. Make a new one in include/xen, or in drivers/xen/privcmd, whichever makes most sense.

-- Keir

Quoted 193 lines · Hollis Blanchard
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 <[email protected]>
# Date 1183669279 18000
# Node ID 7cae4be9db6be7b7d0c91dbb785ae14261c7116d
# Parent 3ece3641ec01362c4333c74688a7f04ae4706ba4 [XEN][LINUX] Add 32-bit privcmd ioctl conversion for 64-bit kernels.

diff -r 3ece3641ec01 -r 7cae4be9db6b drivers/xen/Makefile

drivers/xen/Makefile Thu Jul 05 16:01:19 2007 -0500 +1 -1
@@ -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

drivers/xen/privcmd/Makefile Thu Jul 05 16:01:19 2007 -0500 +2 -1
@@ -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

drivers/xen/privcmd/compat_privcmd.c Thu Jul 05 16:01:19 2007 -0500 renamed from dev/null Thu Jan 01 00:00:00 1970 +0000 +72 -0
@@ -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 <[email protected]>
+ */
+
+#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

fs/compat_ioctl.c Thu Jul 05 16:01:19 2007 -0500 +16 -0
@@ -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

include/xen/public/privcmd.h Thu Jul 05 16:01:19 2007 -0500 +1 -0
@@ -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;

include/xen/public/privcmd.h Thu Jul 05 16:01:19 2007 -0500 +21 -0
+#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

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#5 lore raw

Re: [XenPPC] Re: [PATCH 3 of 6] [XEN][LINUX] Add architecture-generic xencomm infrastructure

In reply to Keir Fraser
Quoted 9 lines · Keir Fraser
Quoted 7 lines · Hollis Blanchard

diff -r 001c42f8079e -r e2681868041e drivers/xen/Kconfig

drivers/xen/Kconfig Thu Jul 05 16:01:18 2007 -0500 +0 -0
@@ -278,4 +278,7 @@ config XEN_BALLOON

bool
default y

Quoted 5 lines

drivers/xen/Kconfig Thu Jul 05 16:01:18 2007 -0500

Quoted 3 lines
drivers/xen/Kconfig Thu Jul 05 16:01:18 2007 -0500 +3 -0
+config XEN_XENCOMM
+ bool
+

Shouldn't this have a 'depends on', and 'default y'?

This will be "selected" by architectures that need it.

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center
#9 lore raw

Re: [PATCH 4 of 6] [XEN][LINUX] #ifdef x86-specific alloc_vm_area()

In reply to Hollis Blanchard
Quoted 4 lines · Hollis Blanchard

[XEN][LINUX] #ifdef x86-specific alloc_vm_area().
Since neither IA64 nor PowerPC wants this code, in the future it should really be moved out of drivers/xen/

The IA64 version will get merged into drivers/xen/util at some point, so the old todo message still applies. x86 will need an ia64-style one for supporting e.g., backend-pv-drivers-on-hvm.

Probably just getting rid of XXX/TODO messages altogether is fine. It's fairly obvious there may be work to be done wherever #ifdef <arch> crops up in driver code.

-- Keir

#13 lore raw
In reply to Hollis Blanchard
Quoted 6 lines · Hollis Blanchard

These patches reorganize arch-generic Xen Linux code, so I'm sending them by mail for review. If they are acceptable, I will commit them (and the PowerPC code that depends on them) to the PowerPC Linux tree so you can pull from there.

Please review.

Done, and three replies sent.

I'll check them in myself. I don't pull in changes to common code from foreign trees as it's too much of a pain to review the changesets. If there are common-code changes in a foreign tree, I don't pull. This has worked fine with ia64 for a long time.

-- Keir

#6 lore raw

Re: [XenPPC] Re: [PATCH 3 of 6] [XEN][LINUX] Add architecture-generic xencomm infrastructure

In reply to Hollis Blanchard
Quoted 7 lines · Hollis Blanchard
Quoted 5 lines

drivers/xen/Kconfig config XEN_BALLOON · line 283

Quoted 3 lines
drivers/xen/Kconfig +3 -0
+config XEN_XENCOMM
+ bool
+

Shouldn't this have a 'depends on', and 'default y'?

This will be "selected" by architectures that need it.

If that means it is automatically be handled by the build system and won't appear in 'make menuconfig' then that's fine.

-- Keir

#7 lore raw

Re: [XenPPC] Re: [PATCH 3 of 6] [XEN][LINUX] Add architecture-generic xencomm infrastructure

Quoted 8 lines · Keir Fraser
Quoted 6 lines · Hollis Blanchard
Quoted 5 lines

drivers/xen/Kconfig config XEN_BALLOON · line 283

Quoted 3 lines
drivers/xen/Kconfig +3 -0
+config XEN_XENCOMM
+ bool
+

Shouldn't this have a 'depends on', and 'default y'?

Quoted 4 lines
Quoted 1 line

This will be "selected" by architectures that need it.

If that means it is automatically be handled by the build system and won't appear in 'make menuconfig' then that's fine.

Yup, that's exactly what will happen.

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center
#14 lore raw
In reply to Keir Fraser
Quoted 7 lines · Keir Fraser
Quoted 5 lines · Hollis Blanchard

These patches reorganize arch-generic Xen Linux code, so I'm sending them by mail for review. If they are acceptable, I will commit them (and the PowerPC code that depends on them) to the PowerPC Linux tree so you can pull from there.

Quoted 8 lines
Quoted 1 line

Please review.

Done, and three replies sent.

I'll check them in myself. I don't pull in changes to common code from foreign trees as it's too much of a pain to review the changesets. If there are common-code changes in a foreign tree, I don't pull. This has worked fine with ia64 for a long time.

Yup, you once asked me to commit common Xen changes to the PPC tree to pull from, but I agree that can make review/revision difficult.

I will resend this patchqueue with the changes you suggested.

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center