Skip to contentSkip to conversation

PowerPC Linux patches, rev 2

PATCH New Hollis Blanchard 3 participants 17 messages Jul 5, 2007 – Jul 9, 2007

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

PATCH 1/1 PowerPC Linux patches, rev 2

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 +++++++++
#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 1183672706 18000
# Node ID 5c80ef74d4766742a52623f0adf3edc41f42e5b6 # 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 5c80ef74d476 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 5c80ef74d476 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 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.

drivers/xen/char/mem.c +4 -4
diff -r 5c80ef74d476 -r 848958bf6c7a 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 5c80ef74d476 -r 848958bf6c7a 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 5c80ef74d476 -r 848958bf6c7a 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);
#4 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 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.

drivers/xen/Kconfig +3 -0
diff -r 848958bf6c7a -r d5f91f3fbd83 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 848958bf6c7a -r d5f91f3fbd83 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

#5 lore raw

PATCH 1/1 Invert #ifdef for x86-specific *_vm_area()

In reply to Hollis Blanchard
1 file changed, 2 insertions(+), 6 deletions(-)

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

# HG changeset patch
# User Hollis Blanchard <[email protected]>
# Date 1183672706 18000
# Node ID 790e4d5567dcd8bfb42ae1e67ad1f3dffd29ece1 # Parent d5f91f3fbd833a7dd259a0d9332d6534d1f61c6d [XEN][LINUX] Invert #ifdef for x86-specific *_vm_area().

drivers/xen/util.c +2 -6
diff -r d5f91f3fbd83 -r 790e4d5567dc drivers/xen/util.c
@@ -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 */
#6 lore raw

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

In reply to Hollis Blanchard
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 <[email protected]>
# Date 1183674347 18000
# Node ID 9def23611685442dc9688ad8f81db9a5031b4b5f
# Parent 790e4d5567dcd8bfb42ae1e67ad1f3dffd29ece1 [XEN][LINUX] Refactor grant table allocation into arch-specific code.

arch/ia64/xen/hypervisor.c +5 -0
diff -r 790e4d5567dc -r 9def23611685 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 +20 -18
diff -r 790e4d5567dc -r 9def23611685 drivers/xen/core/gnttab.c
@@ -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);
include/xen/gnttab.h +2 -0
diff -r 790e4d5567dc -r 9def23611685 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)
#9 lore raw

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

In reply to Hollis Blanchard
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 <[email protected]>
# Date 1183674408 18000
# Node ID 3833674b6d561e690b4963644ced60104f226dbf
# Parent 9def23611685442dc9688ad8f81db9a5031b4b5f [XEN][LINUX] Add 32-bit privcmd ioctl conversion for 64-bit kernels.

drivers/xen/Makefile +1 -1
diff -r 9def23611685 -r 3833674b6d56 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 9def23611685 -r 3833674b6d56 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 +73 -0

73 lines not on this page · raw message

fs/compat_ioctl.c +17 -0
diff -r 9def23611685 -r 3833674b6d56 fs/compat_ioctl.c
@@ -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);
include/xen/compat_ioctl.h new file +45 -0

45 lines not on this page · raw message

#3 lore raw

Re: [PATCH 2 of 6] [XEN][LINUX] Create Xen-specificinterface for xlate_dev_mem_*

In reply to Hollis Blanchard

include/asm-i386/mach-xen/asm/io.h line 60

Quoted 13 lines
include/asm-i386/mach-xen/asm/io.h +2 -2
@@ -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

#7 lore raw

Re: [PATCH 5 of 6] [XEN][LINUX] Refactor grant tableallocation into arch-specific code

In reply to Hollis Blanchard

drivers/xen/core/gnttab.c static inline unsigned int max_nr_grant_ · line 436

Quoted 11 lines
drivers/xen/core/gnttab.c +1 -1
@@ -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

#10 lore raw

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

In reply to Hollis Blanchard

fs/compat_ioctl.c COMPATIBLE_IOCTL(LPRESET) · line 2960

Quoted 11 lines
fs/compat_ioctl.c +5 -0
@@ -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?

fs/compat_ioctl.c COMPATIBLE_IOCTL(LPRESET) · line 2970

Quoted 10 lines
fs/compat_ioctl.c +7 -0
+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

#11 lore raw

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

Quoted 5 lines · Jan Beulich
Quoted 5 lines
fs/compat_ioctl.c Thu Jul 05 17:26:48 2007 -0500 renamed from fs/compat_ioctl.c Thu Jul 05 17:25:47 2007 -0500 +0 -0
@@ -2948,6 +2953,18 @@ COMPATIBLE_IOCTL(LPRESET)
 /*LPGETSTATS not implemented, but no kernels seem to compile it in anyways*/
 COMPATIBLE_IOCTL(LPGETFLAGS)
Quoted 8 lines

fs/compat_ioctl.c Thu Jul 05 17:26:48 2007 -0500 COMPATIBLE_IOCTL(LPRESET) · line 2960

Quoted 6 lines
fs/compat_ioctl.c Thu Jul 05 17:26:48 2007 -0500 renamed from fs/compat_ioctl.c Thu Jul 05 17:25:47 2007 -0500 +5 -0
 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

#8 lore raw

Re: [PATCH 5 of 6] [XEN][LINUX] Refactor grant table allocation into arch-specific code

In reply to Hollis Blanchard

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

Quoted 115 lines · Hollis Blanchard
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 <[email protected]>
# Date 1183674347 18000
# Node ID 9def23611685442dc9688ad8f81db9a5031b4b5f
# Parent 790e4d5567dcd8bfb42ae1e67ad1f3dffd29ece1 [XEN][LINUX] Refactor grant table allocation into arch-specific code.

diff -r 790e4d5567dc -r 9def23611685 arch/ia64/xen/hypervisor.c

arch/ia64/xen/hypervisor.c Thu Jul 05 17:25:47 2007 -0500 renamed from arch/ia64/xen/hypervisor.c Thu Jul 05 16:58:26 2007 -0500 +5 -0
@@ -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

drivers/xen/core/gnttab.c Thu Jul 05 17:25:47 2007 -0500 renamed from drivers/xen/core/gnttab.c Thu Jul 05 16:58:26 2007 -0500 +20 -18
@@ -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

include/xen/gnttab.h Thu Jul 05 17:25:47 2007 -0500 renamed from include/xen/gnttab.h Thu Jul 05 16:58:26 2007 -0500 +2 -0
@@ -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
[email protected]
http://lists.xensource.com/xen-devel

#12 lore raw

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

In reply to Jan Beulich
Quoted 5 lines · Jan Beulich

fs/compat_ioctl.c Thu Jul 05 17:26:48 2007 -0500 COMPATIBLE_IOCTL(LPRESET) · line 2953

Quoted 4 lines
fs/compat_ioctl.c Thu Jul 05 17:26:48 2007 -0500 renamed from fs/compat_ioctl.c Thu Jul 05 17:25:47 2007 -0500 +0 -0
@@ -2948,6 +2953,18 @@ COMPATIBLE_IOCTL(LPRESET)
 /*LPGETSTATS not implemented, but no kernels seem to compile it in

anyways*/

Quoted 9 lines

fs/compat_ioctl.c Thu Jul 05 17:26:48 2007 -0500 COMPATIBLE_IOCTL(LPRESET) · line 2960

Quoted 7 lines
fs/compat_ioctl.c Thu Jul 05 17:26:48 2007 -0500 renamed from fs/compat_ioctl.c Thu Jul 05 17:25:47 2007 -0500 +5 -0
 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.

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

Re: [XenPPC] Re: [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctlconversion for 64-b

Quoted 11 lines
Quoted 2 lines
Quoted 1 line

Hollis Blanchard <[email protected]> 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

#14 lore raw

Re: Re: [Xen-devel] [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctlconversion for 64-b

Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 2 lines
Quoted 1 line

Hollis Blanchard <[email protected]> 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 .

Quoted 6 lines
Quoted 1 line

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.

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

Re: [XenPPC] Re: [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctlconversion for 64-b

Quoted 7 lines

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

#16 lore raw

Re: [XenPPC] Re: [PATCH 6 of 6] [XEN][LINUX] Add 32-bit privcmd ioctlconversion for 64-b

Quoted 9 lines · Jan Beulich
Quoted 5 lines

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