[XenPPC] Interesting warnings while compiling Xen modules

2007-01-17 Thread Jerone Young
I was compiling the Xen block & network as modules when I saw the
following warnings during compile:

WARNING: "xen_start_info" [drivers/xen/netfront/xennet.ko] undefined!
WARNING: ".is_running_on_xen" [drivers/xen/netfront/xennet.ko] undefined!
WARNING: ".is_running_on_xen" [drivers/xen/blkfront/xenblk.ko] undefined!

I haven't looked into it yet. But I figured sending an email whould be
good reminder for myself and any interested parties.



___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


[XenPPC] [PATCH] Export symbol xen_start_info for modules

2007-01-17 Thread Jerone Young
Not sure exactly why this was not exported. But here is a patch to
export "xen_start_info" symbol for modules.

Signed-off-by: Jerone Young <[EMAIL PROTECTED]>

# HG changeset patch
# User [EMAIL PROTECTED]
# Date 1169050609 21600
# Node ID a9acbe8fa5d711786082856aefa9f8c92af30b83
# Parent  d450e2b2a85a7640643ecf7b2fddff2faa6dbcd4
export symbol xen_start_info for modules

diff -r d450e2b2a85a -r a9acbe8fa5d7 arch/powerpc/platforms/xen/setup.c
--- a/arch/powerpc/platforms/xen/setup.cTue Jan 16 00:12:50 2007 -0600
+++ b/arch/powerpc/platforms/xen/setup.cWed Jan 17 10:16:49 2007 -0600
@@ -33,6 +33,7 @@ EXPORT_SYMBOL(HYPERVISOR_shared_info);
 
 /* Raw start-of-day parameters from the hypervisor. */
 start_info_t *xen_start_info;
+EXPORT_SYMBOL(xen_start_info);
 
 extern struct machdep_calls mach_maple_md;
 extern void maple_pci_init(void);



___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


[XenPPC] [PATCH] Export symbol is_xen_running for modules

2007-01-17 Thread Jerone Young
This patch will export the symbol is_xen_running for modules.

Signed-off-by: Jerone Young <[EMAIL PROTECTED]>

# HG changeset patch
# User [EMAIL PROTECTED]
# Date 1169051130 21600
# Node ID e5962db179663fbae33a627f36e0a0c288c5fbdb
# Parent  a9acbe8fa5d711786082856aefa9f8c92af30b83
Export symbol is_running_on_xen for modules

diff -r a9acbe8fa5d7 -r e5962db17966 arch/powerpc/platforms/xen/setup.c
--- a/arch/powerpc/platforms/xen/setup.cWed Jan 17 10:16:49 2007 -0600
+++ b/arch/powerpc/platforms/xen/setup.cWed Jan 17 10:25:30 2007 -0600
@@ -151,6 +151,7 @@ int is_running_on_xen(void)
 {
return running_on_xen;
 }
+EXPORT_SYMBOL(is_running_on_xen);
 
 static void xen_power_save(void)
 {



___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


[XenPPC] [xenppc-unstable] [XEN][POWERPC] add asm/nmi.h

2007-01-17 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 5327f212fc83dc0d8785b00e7aa74270e89a8061
# Parent  3f6a2745b3a3b40bcdd51f9111b0993bad2c7ec6
[XEN][POWERPC] add asm/nmi.h
Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/include/asm-powerpc/nmi.h |6 ++
 1 files changed, 6 insertions(+)

diff -r 3f6a2745b3a3 -r 5327f212fc83 xen/include/asm-powerpc/nmi.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/xen/include/asm-powerpc/nmi.h Wed Jan 17 13:16:55 2007 -0500
@@ -0,0 +1,6 @@
+#ifndef ASM_NMI_H
+#define ASM_NMI_H
+
+#include 
+
+#endif /* ASM_NMI_H */

___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Fix arch_set_info_guest() from upstream interface change

2007-01-17 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 6a86727a3afe85751d916700c1c6db2c75e7bd27
# Parent  5327f212fc83dc0d8785b00e7aa74270e89a8061
[XEN][POWERPC] Fix arch_set_info_guest() from upstream interface change
Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/domain.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff -r 5327f212fc83 -r 6a86727a3afe xen/arch/powerpc/domain.c
--- a/xen/arch/powerpc/domain.c Wed Jan 17 13:16:55 2007 -0500
+++ b/xen/arch/powerpc/domain.c Wed Jan 17 13:18:02 2007 -0500
@@ -13,7 +13,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
- * Copyright (C) IBM Corp. 2005, 2006
+ * Copyright IBM Corp. 2005, 2006, 2007
  *
  * Authors: Jimi Xenidis <[EMAIL PROTECTED]>
  */
@@ -151,7 +151,9 @@ void vcpu_destroy(struct vcpu *v)
 }
 
 int arch_set_info_guest(struct vcpu *v, vcpu_guest_context_u c)
-{ 
+{
+struct domain *d = v->domain;
+
 memcpy(&v->arch.ctxt, &c.nat->user_regs, sizeof(c.nat->user_regs));
 
 printk("Domain[%d].%d: initializing\n", d->domain_id, v->vcpu_id);

___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Update linker symbols and scripts

2007-01-17 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID c759c733f77d5edaa21620f37206521399842023
# Parent  6a86727a3afe85751d916700c1c6db2c75e7bd27
[XEN][POWERPC] Update linker symbols and scripts

The following patch:
  - updates linker symbols and interfaces that use them
  - clean up of dynamically registered PAPR hcalls
  - Way simpler linker script

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/Makefile|2 
 xen/arch/powerpc/boot_of.c   |4 
 xen/arch/powerpc/hcalls.c|6 -
 xen/arch/powerpc/of-devtree.h|3 
 xen/arch/powerpc/xen.lds.S   |  206 ++-
 xen/include/asm-powerpc/config.h |5 
 xen/include/asm-powerpc/init.h   |   10 -
 7 files changed, 72 insertions(+), 164 deletions(-)

diff -r 6a86727a3afe -r c759c733f77d xen/arch/powerpc/Makefile
--- a/xen/arch/powerpc/Makefile Wed Jan 17 13:18:02 2007 -0500
+++ b/xen/arch/powerpc/Makefile Wed Jan 17 14:12:08 2007 -0500
@@ -64,7 +64,7 @@ CFLAGS += $(PPC_C_WARNINGS)
 # objects into a single ELF segment and to not link in any additional
 # objects that gcc would normally like to
 #
-OMAGIC = -N -nodefaultlibs -nostartfiles
+OMAGIC = -nodefaultlibs -nostartfiles
 
 firmware: of_handler/built_in.o $(TARGET_SUBARCH)/memcpy.o of-devtree.o
$(CC) $(CFLAGS) $(OMAGIC) -e __ofh_start -Wl,-Ttext,0x0 $^ -o $@
diff -r 6a86727a3afe -r c759c733f77d xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.cWed Jan 17 13:18:02 2007 -0500
+++ b/xen/arch/powerpc/boot_of.cWed Jan 17 14:12:08 2007 -0500
@@ -13,7 +13,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
- * Copyright (C) IBM Corp. 2005, 2006
+ * Copyright IBM Corp. 2005, 2006, 2007
  *
  * Authors: Jimi Xenidis <[EMAIL PROTECTED]>
  *  Hollis Blanchard <[EMAIL PROTECTED]>
@@ -1303,7 +1303,7 @@ multiboot_info_t __init *boot_of_init(
 __func__,
 r3, r4, vec, r6, r7, orig_msr);
 
-if ((vec >= (ulong)_start) && (vec <= (ulong)_end)) {
+if (is_kernel(vec)) {
 of_panic("Hmm.. OF[0x%lx] seems to have stepped on our image "
 "that ranges: %p .. %p.\n",
 vec, _start, _end);
diff -r 6a86727a3afe -r c759c733f77d xen/arch/powerpc/hcalls.c
--- a/xen/arch/powerpc/hcalls.c Wed Jan 17 13:18:02 2007 -0500
+++ b/xen/arch/powerpc/hcalls.c Wed Jan 17 14:12:08 2007 -0500
@@ -13,7 +13,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
- * Copyright (C) IBM Corp. 2005
+ * Copyright IBM Corp. 2005, 2006, 2007
  *
  * Authors: Hollis Blanchard <[EMAIL PROTECTED]>
  */
@@ -130,7 +130,7 @@ static void register_papr_hcall(ulong nu
 
 static void init_papr_hcalls(void)
 {
-inithcall_t *hcall;
+init_hcall_t *hcall;
 int i;
 
 /* initialize PAPR hcall table */
@@ -140,7 +140,7 @@ static void init_papr_hcalls(void)
 register_papr_hcall(i, do_ni_papr_hypercall);
 
 /* register the PAPR hcalls */
-for (hcall = &__inithcall_start; hcall < &__inithcall_end; hcall++) {
+for (hcall = &__init_hcall_start; hcall < &__init_hcall_end; hcall++) {
 register_papr_hcall(hcall->number, hcall->handler);
 }
 }
diff -r 6a86727a3afe -r c759c733f77d xen/arch/powerpc/of-devtree.h
--- a/xen/arch/powerpc/of-devtree.h Wed Jan 17 13:18:02 2007 -0500
+++ b/xen/arch/powerpc/of-devtree.h Wed Jan 17 14:12:08 2007 -0500
@@ -13,7 +13,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
- * Copyright (C) IBM Corp. 2005
+ * Copyright IBM Corp. 2005, 2006, 2007
  *
  * Authors: Jimi Xenidis <[EMAIL PROTECTED]>
  */
@@ -23,6 +23,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 enum {
diff -r 6a86727a3afe -r c759c733f77d xen/arch/powerpc/xen.lds.S
--- a/xen/arch/powerpc/xen.lds.SWed Jan 17 13:18:02 2007 -0500
+++ b/xen/arch/powerpc/xen.lds.SWed Jan 17 14:12:08 2007 -0500
@@ -7,202 +7,112 @@ OUTPUT_FORMAT("elf64-powerpc", "elf64-po
  "elf64-powerpc")
 OUTPUT_ARCH(powerpc:common64)
 ENTRY(_start)
-SEARCH_DIR("=/usr/local/lib64"); SEARCH_DIR("=/lib64"); 
SEARCH_DIR("=/usr/lib64"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); 
SEARCH_DIR("=/usr/lib");
-/* Do we need any of these for elf?
-   __DYNAMIC = 0;*/
 PHDRS
 {
   text PT_LOAD;
 }   
 SECTIONS
 {
+  /* This is the address that we are linking at */ 
   . = 0x0040;
   PROVIDE(_text = .);
+  PROVIDE(_stext = .);
   /* Read-only sections, merged into text segment: */
-  .interp : { *(.interp) } :text
-  .hash   : { *(.hash) }
-  .dynsym : { *(.dynsym) }
-  .dynstr : { *(.dynstr) }
-  .gnu.version: { *(.gnu.version) }
-  .gnu.version_d  : { *(.gnu.version_d) }
-  .gnu.version_r  :

[XenPPC] [PATCH 0/3] Converting from various data types to byte-stream bitmaps.

2007-01-17 Thread Jimi Xenidis

The following patches handle endian issues with converstion to
byte-stream bitmaps from: uint32_t, unint64_t, and long arrays.

Tried to be Solaris/Sun friendly

Build tested on x86.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>


___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


[XenPPC] [PATCH 1/3] [XEN] Convert from bytestream to BITMAP_ARRAY and back

2007-01-17 Thread Jimi Xenidis


Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>

---

diff -r 58d6c9cb95c6 xen/common/bitmap.c
--- a/xen/common/bitmap.c   Wed Jan 17 14:57:04 2007 -0500
+++ b/xen/common/bitmap.c   Wed Jan 17 15:09:23 2007 -0500
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /*
  * bitmaps provide an array of bits, implemented using an an
@@ -467,3 +468,77 @@ int bitmap_allocate_region(unsigned long
return 0;
 }
 EXPORT_SYMBOL(bitmap_allocate_region);
+
+static inline ulong ulong_to_le(ulong l)
+{
+#if BITS_PER_LONG == 32
+return cpu_to_le32(l);
+#else
+return cpu_to_le64(l);
+#endif
+
+}
+
+static inline ulong le_to_ulong(ulong l)
+{
+#if BITS_PER_LONG == 32
+return le32_to_cpu(l);
+#else
+return le64_to_cpu(l);
+#endif
+}
+
+void *bitmap_long_to_byte(uint8_t *bp, const ulong *lp, size_t n)
+{
+#ifdef __BIG_ENDIAN
+ulong l;
+int i = 0;
+int b = 0;
+
+for (;;) {
+l = ulong_to_le(lp[i]);
+
+if (n < sizeof (l))
+break;
+
+((ulong *)bp)[b] = l;
+++i;
+n -= sizeof (l);
+b += sizeof (l);
+}
+/* don't call memcpy for 0 */
+if (n > 0)
+memcpy(&bp[b], &l, n);
+#else
+memcpy(bp, lp, n);
+#endif
+
+return bp;
+}
+EXPORT_SYMBOL(bitmap_long_to_byte);
+
+void *bitmap_byte_to_long(ulong *lp, const uint8_t *bp, size_t n)
+{
+#ifdef __BIG_ENDIAN
+ulong l;
+int i = 0;
+int b = 0;
+
+while (n > sizeof (l)) {
+l = ((ulong *)bp)[b];
+lp[i] = le_to_ulong(l);
+++i;
+n -= sizeof (l);
+b += sizeof (l);
+}
+if (n > 0) {
+l = 0;
+memcpy(&l, &bp[b], n);
+lp[i] = le_to_ulong(l);
+}
+#else
+memcpy(lp, bp, n);
+#endif
+return lp;
+}
+EXPORT_SYMBOL(bitmap_byte_to_long);
diff -r 58d6c9cb95c6 xen/common/domctl.c
--- a/xen/common/domctl.c   Wed Jan 17 14:57:04 2007 -0500
+++ b/xen/common/domctl.c   Wed Jan 17 15:37:35 2007 -0500
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #ifdef CONFIG_COMPAT
 #include 
 #endif
@@ -40,6 +41,7 @@ void cpumask_to_xenctl_cpumap(
 {
 unsigned int guest_bytes, copy_bytes, i;
 uint8_t zero = 0;
+uint8_t local[sizeof (*cpumask)];
 
 if ( guest_handle_is_null(xenctl_cpumap->bitmap) )
 return;
@@ -47,9 +49,9 @@ void cpumask_to_xenctl_cpumap(
 guest_bytes = (xenctl_cpumap->nr_cpus + 7) / 8;
 copy_bytes  = min_t(unsigned int, guest_bytes, (NR_CPUS + 7) / 8);
 
-copy_to_guest(xenctl_cpumap->bitmap,
-  (uint8_t *)cpus_addr(*cpumask),
-  copy_bytes);
+bitmap_long_to_byte(local, cpus_addr(*cpumask), copy_bytes);
+
+copy_to_guest(xenctl_cpumap->bitmap, &local[0], copy_bytes);
 
 for ( i = copy_bytes; i < guest_bytes; i++ )
 copy_to_guest_offset(xenctl_cpumap->bitmap, i, &zero, 1);
@@ -59,6 +61,7 @@ void xenctl_cpumap_to_cpumask(
 cpumask_t *cpumask, struct xenctl_cpumap *xenctl_cpumap)
 {
 unsigned int guest_bytes, copy_bytes;
+uint8_t local[sizeof (*cpumask)];
 
 guest_bytes = (xenctl_cpumap->nr_cpus + 7) / 8;
 copy_bytes  = min_t(unsigned int, guest_bytes, (NR_CPUS + 7) / 8);
@@ -68,9 +71,9 @@ void xenctl_cpumap_to_cpumask(
 if ( guest_handle_is_null(xenctl_cpumap->bitmap) )
 return;
 
-copy_from_guest((uint8_t *)cpus_addr(*cpumask),
-xenctl_cpumap->bitmap,
-copy_bytes);
+copy_from_guest(&local[0], xenctl_cpumap->bitmap, copy_bytes);
+
+bitmap_byte_to_long(cpus_addr(*cpumask), local, copy_bytes);
 }
 
 #endif /* COMPAT */
diff -r 58d6c9cb95c6 xen/include/xen/bitmap.h
--- a/xen/include/xen/bitmap.h  Wed Jan 17 14:57:04 2007 -0500
+++ b/xen/include/xen/bitmap.h  Wed Jan 17 15:06:33 2007 -0500
@@ -251,6 +251,9 @@ static inline void bitmap_shift_left(uns
__bitmap_shift_left(dst, src, n, nbits);
 }
 
+extern void *bitmap_long_to_byte(uint8_t *bp, const ulong *lp, size_t n);
+extern void *bitmap_byte_to_long(ulong *lp, const uint8_t *bp, size_t n);
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __XEN_BITMAP_H */

___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


[XenPPC] [PATCH 2/3] [XEN][LIBXC] Convert from bytestream to uint64_t and back

2007-01-17 Thread Jimi Xenidis

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>

---

diff -r 58d6c9cb95c6 tools/libxc/xc_byteorder.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/tools/libxc/xc_byteorder.hWed Jan 17 16:42:03 2007 -0500
@@ -0,0 +1,33 @@
+#ifdef __sun__
+#include 
+#define bswap_8  BSWAP_8
+#define bswap_16 BSWAP_16
+#define bswap_32 BSWAP_32
+#define bswap_64 BSWAP_64
+#else
+#include 
+#include 
+#endif
+
+/*
+ * define as needed
+ */
+
+#if (__BYTE_ORDER == __BIG_ENDIAN) || defined(_BIG_ENDIAN)
+#define XC_BIG_ENDIAN
+
+#define cpu_to_le64(x) bswap_64(x)
+#define le64_to_cpu(x) bswap_64(x)
+#define cpu_to_le32(x) bswap_32(x)
+#define le32_to_cpu(x) bswap_32(x)
+
+#elif (__BYTE_ORDER == __LITTLE_ENDIAN) || defined(_LITTLE_ENDIAN)
+
+#define XC_LITTLE_ENDIAN
+
+#define cpu_to_le64(x) (x)
+#define le64_to_cpu(x) (x)
+#define cpu_to_le32(x) (x)
+#define le32_to_cpu(x) (x)
+
+#endif
diff -r 58d6c9cb95c6 tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c   Wed Jan 17 14:57:04 2007 -0500
+++ b/tools/libxc/xc_domain.c   Wed Jan 17 16:52:25 2007 -0500
@@ -96,16 +96,19 @@ int xc_vcpu_setaffinity(int xc_handle,
 {
 DECLARE_DOMCTL;
 int ret = -1;
+uint8_t local[sizeof (cpumap)];
 
 domctl.cmd = XEN_DOMCTL_setvcpuaffinity;
 domctl.domain = (domid_t)domid;
 domctl.u.vcpuaffinity.vcpu= vcpu;
 
-set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap,
- (uint8_t *)&cpumap);
+bitmap_64_to_byte(local, &cpumap, sizeof (cpumap));
+
+set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap, local);
+
 domctl.u.vcpuaffinity.cpumap.nr_cpus = sizeof(cpumap) * 8;
 
-if ( lock_pages(&cpumap, sizeof(cpumap)) != 0 )
+if ( lock_pages(local, sizeof(local)) != 0 )
 {
 PERROR("Could not lock memory for Xen hypercall");
 goto out;
@@ -113,7 +116,7 @@ int xc_vcpu_setaffinity(int xc_handle,
 
 ret = do_domctl(xc_handle, &domctl);
 
-unlock_pages(&cpumap, sizeof(cpumap));
+unlock_pages(local, sizeof(local));
 
  out:
 return ret;
@@ -127,16 +130,16 @@ int xc_vcpu_getaffinity(int xc_handle,
 {
 DECLARE_DOMCTL;
 int ret = -1;
+uint8_t local[sizeof (cpumap)];
 
 domctl.cmd = XEN_DOMCTL_getvcpuaffinity;
 domctl.domain = (domid_t)domid;
 domctl.u.vcpuaffinity.vcpu = vcpu;
 
-set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap,
- (uint8_t *)cpumap);
-domctl.u.vcpuaffinity.cpumap.nr_cpus = sizeof(*cpumap) * 8;
+set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap, local);
+domctl.u.vcpuaffinity.cpumap.nr_cpus = sizeof(cpumap) * 8;
 
-if ( lock_pages(cpumap, sizeof(*cpumap)) != 0 )
+if ( lock_pages(local, sizeof(local)) != 0 )
 {
 PERROR("Could not lock memory for Xen hypercall");
 goto out;
@@ -144,8 +147,8 @@ int xc_vcpu_getaffinity(int xc_handle,
 
 ret = do_domctl(xc_handle, &domctl);
 
-unlock_pages(cpumap, sizeof(*cpumap));
-
+unlock_pages(local, sizeof (local));
+bitmap_byte_to_64(cpumap, local, sizeof (local));
  out:
 return ret;
 }
diff -r 58d6c9cb95c6 tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c  Wed Jan 17 14:57:04 2007 -0500
+++ b/tools/libxc/xc_private.c  Wed Jan 17 17:08:08 2007 -0500
@@ -9,6 +9,7 @@
 #include "xg_private.h"
 #include 
 #include 
+#include "xc_byteorder.h"
 
 static __thread xc_error last_error = { XC_ERROR_NONE, ""};
 #if DEBUG
@@ -502,6 +503,59 @@ char *safe_strerror(int errcode)
 return errbuf;
 }
 
+void *bitmap_64_to_byte(uint8_t *bp, const uint64_t *lp, size_t n)
+{
+#ifdef XC_BIG_ENDIAN
+uint64_t l;
+int i = 0;
+int b = 0;
+
+for (;;) {
+l = cpu_to_le64(lp[i]);
+
+if (n < sizeof (l))
+break;
+
+((uint64_t *)bp)[b] = l;
+++i;
+n -= sizeof (l);
+b += sizeof (l);
+}
+/* don't call memcpy for 0 */
+if (n > 0)
+memcpy(&bp[b], &l, n);
+#else
+memcpy(bp, lp, n);
+#endif
+
+return bp;
+}
+
+void *bitmap_byte_to_64(uint64_t *lp, const uint8_t *bp, size_t n)
+{
+#ifdef XC_BIG_ENDIAN
+uint64_t l;
+int i = 0;
+int b = 0;
+
+while (n > sizeof (l)) {
+l = ((uint64_t *)bp)[b];
+lp[i] = le64_to_cpu(l);
+++i;
+n -= sizeof (l);
+b += sizeof (l);
+}
+if (n > 0) {
+l = 0;
+memcpy(&l, &bp[b], n);
+lp[i] = le64_to_cpu(l);
+}
+#else
+memcpy(lp, bp, n);
+#endif
+return lp;
+}
+
 /*
  * Local variables:
  * mode: C
diff -r 58d6c9cb95c6 tools/libxc/xc_private.h
--- a/tools/libxc/xc_private.h  Wed Jan 17 14:57:04 2007 -0500
+++ b/tools/libxc/xc_private.h  Wed Jan 17 16:50:54 2007 -0500
@@ -157,4 +157,7 @@ int xc_waitdomain_core(int xc_handle, in
 int xc_waitdomain_core(int xc_handle, int domain, int *status,
 int options, vcpu_guest_context_t *ctxt);
 
+extern void *bitmap_64_to_byte(uint8_t *bp, const uint64_t *lp, size_t n);
+extern void *bitmap_byte_to_64(uint64_t *lp, con

[XenPPC] [PATCH 3/3] [XEN] Handle the uint32_t in the tbuf

2007-01-17 Thread Jimi Xenidis

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>

---

diff -r 58d6c9cb95c6 tools/libxc/xc_tbuf.c
--- a/tools/libxc/xc_tbuf.c Wed Jan 17 14:57:04 2007 -0500
+++ b/tools/libxc/xc_tbuf.c Wed Jan 17 17:13:10 2007 -0500
@@ -96,15 +96,25 @@ int xc_tbuf_set_cpu_mask(int xc_handle, 
 {
 DECLARE_SYSCTL;
 int ret = -1;
+uint64_t mask64;
+uint8_t local[sizeof (mask64)];
 
 sysctl.cmd = XEN_SYSCTL_tbuf_op;
 sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION;
 sysctl.u.tbuf_op.cmd  = XEN_SYSCTL_TBUFOP_set_cpu_mask;
 
-set_xen_guest_handle(sysctl.u.tbuf_op.cpu_mask.bitmap, (uint8_t *)&mask);
-sysctl.u.tbuf_op.cpu_mask.nr_cpus = sizeof(mask) * 8;
+#ifdef XC_BIG_ENDIAN
+mask64 = mask;
+#else
+mask64 = (uint64_t)mask << 32;
+#endif
 
-if ( lock_pages(&mask, sizeof(mask)) != 0 )
+bitmap_64_to_byte(local, &mask64, sizeof (mask64));
+
+set_xen_guest_handle(sysctl.u.tbuf_op.cpu_mask.bitmap, local);
+sysctl.u.tbuf_op.cpu_mask.nr_cpus = sizeof(local) * 8;
+
+if ( lock_pages(&local, sizeof(local)) != 0 )
 {
 PERROR("Could not lock memory for Xen hypercall");
 goto out;
@@ -112,7 +122,7 @@ int xc_tbuf_set_cpu_mask(int xc_handle, 
 
 ret = do_sysctl(xc_handle, &sysctl);
 
-unlock_pages(&mask, sizeof(mask));
+unlock_pages(&local, sizeof(local));
 
  out:
 return ret;

___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


[XenPPC] [xenppc-unstable] [XEN] only build xencomm.o if configed to do so.

2007-01-17 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID fa3a95fd876c75a48582db2916b915f985cd52ca
# Parent  58d6c9cb95c65e7583c838d0bbfc4412f518195c
[XEN] only build xencomm.o if configed to do so.
Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/common/Makefile |1 -
 1 files changed, 1 deletion(-)

diff -r 58d6c9cb95c6 -r fa3a95fd876c xen/common/Makefile
--- a/xen/common/Makefile   Wed Jan 17 14:57:04 2007 -0500
+++ b/xen/common/Makefile   Wed Jan 17 17:42:39 2007 -0500
@@ -27,7 +27,6 @@ obj-y += trace.o
 obj-y += trace.o
 obj-y += version.o
 obj-y += vsprintf.o
-obj-y += xencomm.o
 obj-y += xmalloc.o
 
 obj-$(perfc)   += perfc.o

___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


[XenPPC] [xenppc-unstable] [XEN] Undo changset 13191 to make way for better patch

2007-01-17 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 02c6bf903a8e0824e0c5ac07b7f85b9669316c45
# Parent  c759c733f77d5edaa21620f37206521399842023
[XEN] Undo changset 13191 to make way for better patch

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/common/domctl.c  |   40 +++
 xen/include/asm-powerpc/bitops.h |3 --
 xen/include/xen/bitops.h |4 ---
 3 files changed, 4 insertions(+), 43 deletions(-)

diff -r c759c733f77d -r 02c6bf903a8e xen/common/domctl.c
--- a/xen/common/domctl.c   Wed Jan 17 14:12:08 2007 -0500
+++ b/xen/common/domctl.c   Wed Jan 17 14:17:31 2007 -0500
@@ -38,36 +38,14 @@ void cpumask_to_xenctl_cpumap(
 void cpumask_to_xenctl_cpumap(
 struct xenctl_cpumap *xenctl_cpumap, cpumask_t *cpumask)
 {
-unsigned int guest_bytes, copy_bytes, xen_bytes, i;
+unsigned int guest_bytes, copy_bytes, i;
 uint8_t zero = 0;
-cpumask_t local;
 
 if ( guest_handle_is_null(xenctl_cpumap->bitmap) )
 return;
 
 guest_bytes = (xenctl_cpumap->nr_cpus + 7) / 8;
-
-xen_bytes = (NR_CPUS + 7) / 8;
-if (bitmap_by_long) {
-if (((guest_bytes * 8) % BITS_PER_LONG) != 0) {
-printk("%s: Unable to translate bitmap\n", __func__);
-return;
-}
-
-/* local copy */
-memcpy(cpus_addr(local), cpus_addr(*cpumask), sizeof (local));
-
-/* clear unused bits */
-for (i = NR_CPUS; i < sizeof(local) * 8; i++) {
-/* non-atomic version */
-__clear_bit(i, cpus_addr(local));
-}
-
-xen_bytes = sizeof(local);
-cpumask = &local;
-}
-
-copy_bytes  = min_t(unsigned int, guest_bytes, xen_bytes);
+copy_bytes  = min_t(unsigned int, guest_bytes, (NR_CPUS + 7) / 8);
 
 copy_to_guest(xenctl_cpumap->bitmap,
   (uint8_t *)cpus_addr(*cpumask),
@@ -80,20 +58,10 @@ void xenctl_cpumap_to_cpumask(
 void xenctl_cpumap_to_cpumask(
 cpumask_t *cpumask, struct xenctl_cpumap *xenctl_cpumap)
 {
-unsigned int guest_bytes, copy_bytes, xen_bytes;
+unsigned int guest_bytes, copy_bytes;
 
 guest_bytes = (xenctl_cpumap->nr_cpus + 7) / 8;
-xen_bytes = (NR_CPUS + 7) / 8;
-
-if (bitmap_by_long) {
-if (((guest_bytes * 8) % BITS_PER_LONG) != 0) {
-printk("%s: Unable to translate bitmap\n", __func__);
-return;
-}
-xen_bytes = sizeof(*cpumask);
-}
-
-copy_bytes  = min_t(unsigned int, guest_bytes, xen_bytes);
+copy_bytes  = min_t(unsigned int, guest_bytes, (NR_CPUS + 7) / 8);
 
 cpus_clear(*cpumask);
 
diff -r c759c733f77d -r 02c6bf903a8e xen/include/asm-powerpc/bitops.h
--- a/xen/include/asm-powerpc/bitops.h  Wed Jan 17 14:12:08 2007 -0500
+++ b/xen/include/asm-powerpc/bitops.h  Wed Jan 17 14:17:31 2007 -0500
@@ -41,9 +41,6 @@
 #define _PPC64_BITOPS_H
 
 #include 
-
-/* The following indicates that bitops are implemented as described above */
-#define bitmap_by_long (1)
 
 /*
  * clear_bit doesn't imply a memory barrier
diff -r c759c733f77d -r 02c6bf903a8e xen/include/xen/bitops.h
--- a/xen/include/xen/bitops.h  Wed Jan 17 14:12:08 2007 -0500
+++ b/xen/include/xen/bitops.h  Wed Jan 17 14:17:31 2007 -0500
@@ -75,10 +75,6 @@ static __inline__ int generic_fls(int x)
  * scope
  */
 #include 
-
-#ifndef bitmap_by_long
-#define bitmap_by_long (0)
-#endif
 
 
 static inline int generic_fls64(__u64 x)

___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


Re: [XenPPC] [xenppc-unstable] [XEN] only build xencomm.o if configed to do so.

2007-01-17 Thread Jimi Xenidis
This broke the x86 build, I usually build x86 just to make sure it  
does build but I guess I haven't since september.


-JX

On Jan 17, 2007, at 5:50 PM, Xen patchbot-xenppc-unstable wrote:


# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID fa3a95fd876c75a48582db2916b915f985cd52ca
# Parent  58d6c9cb95c65e7583c838d0bbfc4412f518195c
[XEN] only build xencomm.o if configed to do so.
Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/common/Makefile |1 -
 1 files changed, 1 deletion(-)

diff -r 58d6c9cb95c6 -r fa3a95fd876c xen/common/Makefile
--- a/xen/common/Makefile   Wed Jan 17 14:57:04 2007 -0500
+++ b/xen/common/Makefile   Wed Jan 17 17:42:39 2007 -0500
@@ -27,7 +27,6 @@ obj-y += trace.o
 obj-y += trace.o
 obj-y += version.o
 obj-y += vsprintf.o
-obj-y += xencomm.o
 obj-y += xmalloc.o

 obj-$(perfc)   += perfc.o

___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel



___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


[XenPPC] [xenppc-unstable] Converting from various data types to byte-stream bitmaps.

2007-01-17 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID cae803af2d571e7d44001207da361327db71ced4
# Parent  fa3a95fd876c75a48582db2916b915f985cd52ca
Converting from various data types to byte-stream bitmaps.

Note: this patch was submitted upstream.

The following patches handle endian issues with converstion to
byte-stream bitmaps from: uint32_t, unint64_t, and long arrays.

Tried to be Solaris/Sun friendly

Build tested on x86.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 tools/libxc/xc_byteorder.h |   33 +++
 tools/libxc/xc_domain.c|   23 +++--
 tools/libxc/xc_private.c   |   54 
 tools/libxc/xc_private.h   |3 +
 tools/libxc/xc_tbuf.c  |   18 --
 xen/common/bitmap.c|   75 +
 xen/common/domctl.c|   15 +
 xen/include/xen/bitmap.h   |3 +
 8 files changed, 204 insertions(+), 20 deletions(-)

diff -r fa3a95fd876c -r cae803af2d57 tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c   Wed Jan 17 17:42:39 2007 -0500
+++ b/tools/libxc/xc_domain.c   Wed Jan 17 19:28:29 2007 -0500
@@ -96,16 +96,19 @@ int xc_vcpu_setaffinity(int xc_handle,
 {
 DECLARE_DOMCTL;
 int ret = -1;
+uint8_t local[sizeof (cpumap)];
 
 domctl.cmd = XEN_DOMCTL_setvcpuaffinity;
 domctl.domain = (domid_t)domid;
 domctl.u.vcpuaffinity.vcpu= vcpu;
 
-set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap,
- (uint8_t *)&cpumap);
+bitmap_64_to_byte(local, &cpumap, sizeof (cpumap));
+
+set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap, local);
+
 domctl.u.vcpuaffinity.cpumap.nr_cpus = sizeof(cpumap) * 8;
 
-if ( lock_pages(&cpumap, sizeof(cpumap)) != 0 )
+if ( lock_pages(local, sizeof(local)) != 0 )
 {
 PERROR("Could not lock memory for Xen hypercall");
 goto out;
@@ -113,7 +116,7 @@ int xc_vcpu_setaffinity(int xc_handle,
 
 ret = do_domctl(xc_handle, &domctl);
 
-unlock_pages(&cpumap, sizeof(cpumap));
+unlock_pages(local, sizeof(local));
 
  out:
 return ret;
@@ -127,16 +130,16 @@ int xc_vcpu_getaffinity(int xc_handle,
 {
 DECLARE_DOMCTL;
 int ret = -1;
+uint8_t local[sizeof (cpumap)];
 
 domctl.cmd = XEN_DOMCTL_getvcpuaffinity;
 domctl.domain = (domid_t)domid;
 domctl.u.vcpuaffinity.vcpu = vcpu;
 
-set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap,
- (uint8_t *)cpumap);
-domctl.u.vcpuaffinity.cpumap.nr_cpus = sizeof(*cpumap) * 8;
+set_xen_guest_handle(domctl.u.vcpuaffinity.cpumap.bitmap, local);
+domctl.u.vcpuaffinity.cpumap.nr_cpus = sizeof(cpumap) * 8;
 
-if ( lock_pages(cpumap, sizeof(*cpumap)) != 0 )
+if ( lock_pages(local, sizeof(local)) != 0 )
 {
 PERROR("Could not lock memory for Xen hypercall");
 goto out;
@@ -144,8 +147,8 @@ int xc_vcpu_getaffinity(int xc_handle,
 
 ret = do_domctl(xc_handle, &domctl);
 
-unlock_pages(cpumap, sizeof(*cpumap));
-
+unlock_pages(local, sizeof (local));
+bitmap_byte_to_64(cpumap, local, sizeof (local));
  out:
 return ret;
 }
diff -r fa3a95fd876c -r cae803af2d57 tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c  Wed Jan 17 17:42:39 2007 -0500
+++ b/tools/libxc/xc_private.c  Wed Jan 17 19:28:29 2007 -0500
@@ -9,6 +9,7 @@
 #include "xg_private.h"
 #include 
 #include 
+#include "xc_byteorder.h"
 
 static __thread xc_error last_error = { XC_ERROR_NONE, ""};
 #if DEBUG
@@ -502,6 +503,59 @@ char *safe_strerror(int errcode)
 return errbuf;
 }
 
+void *bitmap_64_to_byte(uint8_t *bp, const uint64_t *lp, size_t n)
+{
+#ifdef XC_BIG_ENDIAN
+uint64_t l;
+int i = 0;
+int b = 0;
+
+for (;;) {
+l = cpu_to_le64(lp[i]);
+
+if (n < sizeof (l))
+break;
+
+((uint64_t *)bp)[b] = l;
+++i;
+n -= sizeof (l);
+b += sizeof (l);
+}
+/* don't call memcpy for 0 */
+if (n > 0)
+memcpy(&bp[b], &l, n);
+#else
+memcpy(bp, lp, n);
+#endif
+
+return bp;
+}
+
+void *bitmap_byte_to_64(uint64_t *lp, const uint8_t *bp, size_t n)
+{
+#ifdef XC_BIG_ENDIAN
+uint64_t l;
+int i = 0;
+int b = 0;
+
+while (n > sizeof (l)) {
+l = ((uint64_t *)bp)[b];
+lp[i] = le64_to_cpu(l);
+++i;
+n -= sizeof (l);
+b += sizeof (l);
+}
+if (n > 0) {
+l = 0;
+memcpy(&l, &bp[b], n);
+lp[i] = le64_to_cpu(l);
+}
+#else
+memcpy(lp, bp, n);
+#endif
+return lp;
+}
+
 /*
  * Local variables:
  * mode: C
diff -r fa3a95fd876c -r cae803af2d57 tools/libxc/xc_private.h
--- a/tools/libxc/xc_private.h  Wed Jan 17 17:42:39 2007 -0500
+++ b/tools/libxc/xc_private.h  Wed Jan 17 19:28:29 2007 -0500
@@ -157,4 +157,7 @@ int xc_waitdomain_core(int xc_handle, in
 int xc_waitdomain_core(int xc_handle, int domain, int *status,
 int options, vcpu_guest_context_t *ctxt);

Re: [XenPPC] [PATCH] fix prose builder

2007-01-17 Thread Jimi Xenidis

Thanks Maria.. pushed.

On Jan 16, 2007, at 8:58 PM, Maria Butrico wrote:


Summary:  fix for the prose builder.

Minor fixed for the prose builder.

Signed-off-by: Maria Butrico <[EMAIL PROTECTED]>



___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


[XenPPC] [xenppc-unstable] [TOOLS][POWERPC] fixes for the prose builder.

2007-01-17 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID c16586000525f9d9dfbbe336d9d458dd08b44a0e
# Parent  cae803af2d571e7d44001207da361327db71ced4
[TOOLS][POWERPC] fixes for the prose builder.

Signed-off-by: Maria Butrico <[EMAIL PROTECTED]>
Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 tools/python/xen/lowlevel/xc/xc.c |2 +-
 tools/python/xen/xend/image.py|6 +-
 2 files changed, 2 insertions(+), 6 deletions(-)

diff -r cae803af2d57 -r c16586000525 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Wed Jan 17 19:28:29 2007 -0500
+++ b/tools/python/xen/lowlevel/xc/xc.c Wed Jan 17 19:37:20 2007 -0500
@@ -954,7 +954,7 @@ static PyObject *pyxc_prose_build(XcObje
 int unused;
 
 static char *kwd_list[] = { "dom", "store_evtchn",
-"console_evtchn", "image",
+"console_evtchn", "image", "memsize",
 /* optional */
 "ramdisk", "cmdline", "flags",
 "features", "arch_args", NULL };
diff -r cae803af2d57 -r c16586000525 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.pyWed Jan 17 19:28:29 2007 -0500
+++ b/tools/python/xen/xend/image.pyWed Jan 17 19:37:20 2007 -0500
@@ -260,13 +260,9 @@ class PPC_LinuxImageHandler(LinuxImageHa
 return max(maxmem_kb / 64, shadow_mem_kb)
 
 
-class PPC_ProseImageHandler(LinuxImageHandler):
+class PPC_ProseImageHandler(PPC_LinuxImageHandler):
 
 ostype = "prose"
-
-def configure(self, imageConfig, deviceConfig):
-LinuxImageHandler.configure(self, imageConfig, deviceConfig)
-self.imageConfig = imageConfig
 
 def buildDomain(self):
 store_evtchn = self.vm.getStorePort()

___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel


[XenPPC] [PATCH] [RFC] Xencomm patch to fix modules

2007-01-17 Thread Jerone Young
I haven't had a chance to fully test this patch. As I have been having
problems with my blade today. But here is the code for review. I'll get
back to the list once it is fully tested.

Signed-off-by: Jerone Young <[EMAIL PROTECTED]>

diff -r e5962db17966 arch/powerpc/platforms/xen/gnttab.c
--- a/arch/powerpc/platforms/xen/gnttab.c   Wed Jan 17 10:25:30 2007 -0600
+++ b/arch/powerpc/platforms/xen/gnttab.c   Tue Jan 16 23:50:28 2007 -0600
@@ -263,8 +263,9 @@ int HYPERVISOR_grant_table_op(unsigned i
memcpy(&setup, op, sizeof(setup));
argsize = sizeof(setup);
 
-   frame_list = xencomm_create_inline(
-   xen_guest_handle(setup.frame_list));
+   frame_list = xencomm_map(
+   xen_guest_handle(setup.frame_list),
+   (sizeof(ulong) * setup.nr_frames));
 
set_xen_guest_handle(setup.frame_list, frame_list);
memcpy(op, &setup, sizeof(setup));
@@ -286,7 +287,7 @@ int HYPERVISOR_grant_table_op(unsigned i
return -ENOSYS;
}
 
-   desc = xencomm_create_inline(op);
+   desc = xencomm_map(op, argsize);
 
ret = plpar_hcall_norets(XEN_MARK(__HYPERVISOR_grant_table_op), cmd,
 desc, count);
diff -r e5962db17966 arch/powerpc/platforms/xen/hcall.c
--- a/arch/powerpc/platforms/xen/hcall.cWed Jan 17 10:25:30 2007 -0600
+++ b/arch/powerpc/platforms/xen/hcall.cWed Jan 17 00:17:17 2007 -0600
@@ -50,11 +50,16 @@
  * In general, we need a xencomm descriptor to cover the top-level data
  * structure (e.g. the domctl op), plus another for every embedded
pointer to
  * another data structure (i.e. for every GUEST_HANDLE).
+ *
+ * Some hypercalls are made before the memory subsystem is up, so
instead of
+ * calling xencomm_create(), we allocate XENCOMM_MINI_AREA bytes from
the stack
+ * to hold the xencomm descriptor.
  */
 
 int HYPERVISOR_console_io(int cmd, int count, char *str)
 {
-   void *desc = xencomm_create_inline(str);
+
+   void *desc = xencomm_map_early(str, count);
 
return plpar_hcall_norets(XEN_MARK(__HYPERVISOR_console_io),
  cmd, count, desc);
@@ -63,7 +68,8 @@ EXPORT_SYMBOL(HYPERVISOR_console_io);
 
 int HYPERVISOR_event_channel_op(int cmd, void *op)
 {
-   void *desc = xencomm_create_inline(op);
+
+   void *desc = xencomm_map_early(op, sizeof(evtchn_op_t));
 
return plpar_hcall_norets(XEN_MARK(__HYPERVISOR_event_channel_op),
cmd, desc);
@@ -120,8 +126,8 @@ EXPORT_SYMBOL(HYPERVISOR_xen_version);
 
 int HYPERVISOR_xen_version(int cmd, void *arg)
 {
-   if (is_kernel_addr((unsigned long)arg)) {
-   void *desc = xencomm_create_inline(arg);
+   if (is_phys_contiguous((unsigned long)arg)) {
+   void *desc = xencomm_map_early(arg, sizeof(__u64));
return plpar_hcall_norets(XEN_MARK(__HYPERVISOR_xen_version), 
cmd,
desc);
}
return HYPERVISOR_xen_version_userspace(cmd, arg);
@@ -129,7 +135,7 @@ int HYPERVISOR_xen_version(int cmd, void
 
 int HYPERVISOR_physdev_op(int cmd, void *op)
 {
-   void *desc = xencomm_create_inline(op);
+   void *desc = xencomm_map(op, sizeof(physdev_op_t));
 
return plpar_hcall_norets(XEN_MARK(__HYPERVISOR_physdev_op),
cmd, desc);
@@ -139,6 +145,7 @@ int HYPERVISOR_sched_op(int cmd, void *a
 int HYPERVISOR_sched_op(int cmd, void *arg)
 {
struct xencomm_desc *desc;
+   int argsize = 0;
 
switch (cmd) {
case SCHEDOP_yield:
@@ -151,24 +158,29 @@ int HYPERVISOR_sched_op(int cmd, void *a
evtchn_port_t *ports;
struct sched_poll sched_poll;
 
+   argsize = sizeof(struct sched_poll);
+
memcpy(&sched_poll, arg, sizeof(sched_poll));
 
-   ports = xencomm_create_inline(
-   xen_guest_handle(sched_poll.ports));
+   ports = xencomm_map(
+   xen_guest_handle(sched_poll.ports),
+   (sizeof(evtchn_port_t) * sched_poll.nr_ports));
set_xen_guest_handle(sched_poll.ports, ports);
memcpy(arg, &sched_poll, sizeof(sched_poll));
-   
+
}
break;
case SCHEDOP_shutdown:
+   argsize = sizeof(struct sched_shutdown);
case SCHEDOP_remote_shutdown:
+   argsize = sizeof(struct sched_remote_shutdown);
break;
default:
printk(KERN_ERR "%s: unknown sched op %d\n", __func__, cmd);
return -ENOSYS;
}
 
-   desc = xencomm_create_inline(arg);
+   desc = xencomm_map(arg, argsize);
 
return plpar_hcall_norets(XEN_MARK(__HYPERVISOR_sched_op),
cmd, desc);
diff -r e5962db17966 drivers/xen/core/xencomm.c
--- a/drivers/xen/co