Re: [XenPPC] Xencomm on ia64 - The patches

2006-08-21 Thread Tristan Gingold
Le Vendredi 18 Août 2006 23:21, Hollis Blanchard a écrit :
 On Fri, 2006-08-18 at 18:02 +0200, Tristan Gingold wrote:
  these are the patches to port xencomm on ia64.  This is just an RFC.  I
  have to clean-up the code so that it could be shared between ia64 and
  ppc.

 Great! Your patches were a little noisy though; they had some unrelated
 and whitespace changes.

  I have added the xencomm_inline feature which makes (IMHO) hcall.c more
  readable and safer (particularly at boot time).  Wether or not
  xencomm_mini should be deprecated is a question for ppc people
  (xencomm_mini is buggy: the area should be reserved as an array of struct
  xencomm_mini for alignment).

 Good point.

  I have also fixed a few bugs in guest_access.h

 Do you think you could split those out as a diff to
 xen/include/asm-powerpc/guest_access.h, to be applied before we move it?
Ok.

  Many files should be shared between ia64 and ppc.
  In xen:
  * guest_access.h should be the same.  I will propose to put as
  include/xen/xencomm_access.h

 And then xen/include/asm-{powerpc,ia64}/guest_access.h would just
 #include xen/xencomm_access.h? Sounds good to me.
Ok.

  * usercopy.c sould be shared too.  The paddr_to_maddr() function should
  be defined in arch files as xencomm_paddr_to_maddr.  I will propose to
  put this file into xen/common/xencomm.c

 Agreed.

  In linux:
  * drivers/xen/core/xencomm.c should be shared.  We just need to agree on
  xen_pa().  On linux-ia64, __pa() doesn't work for this use. 
  asm/xencomm.h should define this macro/function.

 We got rid of __kern_paddr entirely, so __pa() shouldn't be a problem.
 If you check the current PPC tree (specifically changeset 0b82e0cba7d3),
 you'll find we always use the follow_vma() routine now. Please make sure
 you pull down that changeset, as I'd hate to lose changes because you
 were working from something older.
Ok, I will updated.

  * hcall.c should be shared because it is the biggest and the most boring
  file. This won't be that easy, but it will try to made a proposal soon.

 Sure.

Tristan.

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


Re: [XenPPC] Xencomm on ia64 - The patches

2006-08-21 Thread Tristan Gingold
Le Vendredi 18 Août 2006 23:21, Hollis Blanchard a écrit :
 On Fri, 2006-08-18 at 18:02 +0200, Tristan Gingold wrote:
[...]
  I have also fixed a few bugs in guest_access.h

 Do you think you could split those out as a diff to
 xen/include/asm-powerpc/guest_access.h, to be applied before we move it?
Here is the patch.

Tristan.
# HG changeset patch
# User [EMAIL PROTECTED]
# Node ID 102ff2fdb6db6449ae8402932422039c7b59872e
# Parent  d42e9a6f537883c707ee5f7dd2a2c980881934c8
Bug fix for field macros.
Use _d/_s local variables rather than _x/_y (more readable).

Signed-off-by: Tristan Gingold [EMAIL PROTECTED]

diff -r d42e9a6f5378 -r 102ff2fdb6db xen/include/asm-powerpc/guest_access.h
--- a/xen/include/asm-powerpc/guest_access.h	Fri Aug 18 15:01:04 2006 -0600
+++ b/xen/include/asm-powerpc/guest_access.h	Mon Aug 21 07:45:22 2006 +0200
@@ -16,6 +16,7 @@
  * Copyright (C) IBM Corp. 2006
  *
  * Authors: Hollis Blanchard [EMAIL PROTECTED]
+ *  Tristan Gingold [EMAIL PROTECTED]
  */
 
 #ifndef __PPC_GUEST_ACCESS_H__
@@ -74,29 +75,29 @@ extern int xencomm_handle_is_null(void *
 __copy_field_from_guest(ptr, hnd, field)
 
 #define __copy_to_guest_offset(hnd, idx, ptr, nr) ({\
-const typeof(ptr) _x = (hnd).p; \
-const typeof(ptr) _y = (ptr);   \
-xencomm_copy_to_guest(_x, _y, sizeof(*_x)*(nr), sizeof(*_x)*(idx)); \
+const typeof(ptr) _d = (hnd).p; \
+const typeof(ptr) _s = (ptr);   \
+xencomm_copy_to_guest(_d, _s, sizeof(*_s)*(nr), sizeof(*_s)*(idx)); \
 })
 
 #define __copy_field_to_guest(hnd, ptr, field) ({   \
-const int _off = offsetof(typeof(*ptr), field);  \
-const typeof((ptr)-field) _x = (hnd).p-field;   \
-const typeof((ptr)-field) _y = (ptr)-field; \
-xencomm_copy_to_guest(_x, _y, sizeof(*_x), sizeof(*_x)*(_off)); \
+const int _off = offsetof(typeof(*ptr), field); \
+const typeof(ptr) _d = (hnd).p; \
+const typeof((ptr)-field) _s = (ptr)-field; \
+xencomm_copy_to_guest(_d, _s, sizeof(*_s), _off); \
 })
 
 #define __copy_from_guest_offset(ptr, hnd, idx, nr) ({  \
-const typeof(ptr) _x = (hnd).p; \
-const typeof(ptr) _y = (ptr);   \
-xencomm_copy_from_guest(_y, _x, sizeof(*_x)*(nr), sizeof(*_x)*(idx));  \
+const typeof(ptr) _s = (hnd).p; \
+const typeof(ptr) _d = (ptr);   \
+xencomm_copy_from_guest(_d, _s, sizeof(*_s)*(nr), sizeof(*_s)*(idx));  \
 })
 
 #define __copy_field_from_guest(ptr, hnd, field) ({ \
 const int _off = offsetof(typeof(*ptr), field); \
-const typeof((ptr)-field) _x = (hnd).p-field;   \
-const typeof((ptr)-field) _y = (ptr)-field; \
-xencomm_copy_to_guest(_y, _x, sizeof(*_x), sizeof(*_x)*(_off)); \
+const typeof(ptr) _s = (hnd).p; \
+const typeof((ptr)-field) _d = (ptr)-field; \
+xencomm_copy_from_guest(_d, _s, sizeof(*_d), _off); \
 })
 
 #endif /* __PPC_GUEST_ACCESS_H__ */
___
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel

Re: [XenPPC] Xencomm on ia64 - The patches

2006-08-21 Thread Jimi Xenidis


On Aug 21, 2006, at 3:47 AM, Tristan Gingold wrote:


Le Vendredi 18 Août 2006 23:21, Hollis Blanchard a écrit :

On Fri, 2006-08-18 at 18:02 +0200, Tristan Gingold wrote:

[...]

I have also fixed a few bugs in guest_access.h


Do you think you could split those out as a diff to
xen/include/asm-powerpc/guest_access.h, to be applied before we  
move it?

Here is the patch.


your patch inlined below, does not do anything other than rename  
_x,_y to _d,_s.. am I missing something?

-JX

# HG changeset patch
# User [EMAIL PROTECTED]
# Node ID 102ff2fdb6db6449ae8402932422039c7b59872e
# Parent  d42e9a6f537883c707ee5f7dd2a2c980881934c8
Bug fix for field macros.
Use _d/_s local variables rather than _x/_y (more readable).

Signed-off-by: Tristan Gingold [EMAIL PROTECTED]

diff -r d42e9a6f5378 -r 102ff2fdb6db xen/include/asm-powerpc/ 
guest_access.h
--- a/xen/include/asm-powerpc/guest_access.h	Fri Aug 18 15:01:04  
2006 -0600
+++ b/xen/include/asm-powerpc/guest_access.h	Mon Aug 21 07:45:22  
2006 +0200

@@ -16,6 +16,7 @@
  * Copyright (C) IBM Corp. 2006
  *
  * Authors: Hollis Blanchard [EMAIL PROTECTED]
+ *  Tristan Gingold [EMAIL PROTECTED]
  */
#ifndef __PPC_GUEST_ACCESS_H__
@@ -74,29 +75,29 @@ extern int xencomm_handle_is_null(void *
 __copy_field_from_guest(ptr, hnd, field)
#define __copy_to_guest_offset(hnd, idx, ptr, nr) ({\
-const typeof(ptr) _x = (hnd).p; \
-const typeof(ptr) _y = (ptr);   \
-xencomm_copy_to_guest(_x, _y, sizeof(*_x)*(nr), sizeof(*_x)* 
(idx)); \

+const typeof(ptr) _d = (hnd).p; \
+const typeof(ptr) _s = (ptr);   \
+xencomm_copy_to_guest(_d, _s, sizeof(*_s)*(nr), sizeof(*_s)* 
(idx)); \

})
#define __copy_field_to_guest(hnd, ptr, field) ({   \
-const int _off = offsetof(typeof(*ptr),  
field);  \

-const typeof((ptr)-field) _x = (hnd).p-field;   \
-const typeof((ptr)-field) _y = (ptr)-field; \
-xencomm_copy_to_guest(_x, _y, sizeof(*_x), sizeof(*_x)*(_off)); \
+const int _off = offsetof(typeof(*ptr), field); \
+const typeof(ptr) _d = (hnd).p; \
+const typeof((ptr)-field) _s = (ptr)-field; \
+xencomm_copy_to_guest(_d, _s, sizeof(*_s), _off); \
})
#define __copy_from_guest_offset(ptr, hnd, idx, nr) ({  \
-const typeof(ptr) _x = (hnd).p; \
-const typeof(ptr) _y = (ptr);   \
-xencomm_copy_from_guest(_y, _x, sizeof(*_x)*(nr), sizeof(*_x)* 
(idx));  \

+const typeof(ptr) _s = (hnd).p; \
+const typeof(ptr) _d = (ptr);   \
+xencomm_copy_from_guest(_d, _s, sizeof(*_s)*(nr), sizeof(*_s)* 
(idx));  \

})
#define __copy_field_from_guest(ptr, hnd, field) ({ \
 const int _off = offsetof(typeof(*ptr), field); \
-const typeof((ptr)-field) _x = (hnd).p-field;   \
-const typeof((ptr)-field) _y = (ptr)-field; \
-xencomm_copy_to_guest(_y, _x, sizeof(*_x), sizeof(*_x)*(_off)); \
+const typeof(ptr) _s = (hnd).p; \
+const typeof((ptr)-field) _d = (ptr)-field; \
+xencomm_copy_from_guest(_d, _s, sizeof(*_d), _off); \
})
#endif /* __PPC_GUEST_ACCESS_H__ */



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


Re: [XenPPC] Xencomm on ia64 - The patches

2006-08-21 Thread Tristan Gingold
Le Lundi 21 Août 2006 13:13, Jimi Xenidis a écrit :
 On Aug 21, 2006, at 3:47 AM, Tristan Gingold wrote:
  Le Vendredi 18 Août 2006 23:21, Hollis Blanchard a écrit :
  On Fri, 2006-08-18 at 18:02 +0200, Tristan Gingold wrote:
 
  [...]
 
  I have also fixed a few bugs in guest_access.h
 
  Do you think you could split those out as a diff to
  xen/include/asm-powerpc/guest_access.h, to be applied before we
  move it?
 
  Here is the patch.

 your patch inlined below, does not do anything other than rename
 _x,_y to _d,_s.. am I missing something?
Yes.  See below.

  #define __copy_field_to_guest(hnd, ptr, field) ({   \
  -const int _off = offsetof(typeof(*ptr),
  field);  \
  -const typeof((ptr)-field) _x = (hnd).p-field;   \
  -const typeof((ptr)-field) _y = (ptr)-field; \
  -xencomm_copy_to_guest(_x, _y, sizeof(*_x), sizeof(*_x)*(_off)); \
  +const int _off = offsetof(typeof(*ptr), field); \
  +const typeof(ptr) _d = (hnd).p; \
  +const typeof((ptr)-field) _s = (ptr)-field; \
  +xencomm_copy_to_guest(_d, _s, sizeof(*_s), _off); \
Cf how _x/_d are declared and the parameters of xencomm_copy_to_guest.

  #define __copy_field_from_guest(ptr, hnd, field) ({ \
   const int _off = offsetof(typeof(*ptr), field); \
  -const typeof((ptr)-field) _x = (hnd).p-field;   \
  -const typeof((ptr)-field) _y = (ptr)-field; \
  -xencomm_copy_to_guest(_y, _x, sizeof(*_x), sizeof(*_x)*(_off)); \
  +const typeof(ptr) _s = (hnd).p; \
  +const typeof((ptr)-field) _d = (ptr)-field; \
  +xencomm_copy_from_guest(_d, _s, sizeof(*_d), _off); \
Idem.

Tristan.

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


[XenPPC] Xencomm on ia64 - The patches

2006-08-18 Thread Tristan Gingold
Hi,

these are the patches to port xencomm on ia64.  This is just an RFC.  I have 
to clean-up the code so that it could be shared between ia64 and ppc.

I have added the xencomm_inline feature which makes (IMHO) hcall.c more 
readable and safer (particularly at boot time).  Wether or not xencomm_mini 
should be deprecated is a question for ppc people (xencomm_mini is buggy: the 
area should be reserved as an array of struct xencomm_mini for alignment).

I have also fixed a few bugs in guest_access.h

Many files should be shared between ia64 and ppc.
In xen:
* guest_access.h should be the same.  I will propose to put as 
include/xen/xencomm_access.h
* usercopy.c sould be shared too.  The paddr_to_maddr() function should be 
defined in arch files as xencomm_paddr_to_maddr.  I will propose to put this 
file into xen/common/xencomm.c

In linux:
* drivers/xen/core/xencomm.c should be shared.  We just need to agree on
xen_pa().  On linux-ia64, __pa() doesn't work for this use.  asm/xencomm.h 
should define this macro/function.
* hcall.c should be shared because it is the biggest and the most boring file.  
This won't be that easy, but it will try to made a proposal soon.

Tristan.
diff -r 8c6bb45901e7 linux-2.6-xen-sparse/arch/ia64/Kconfig
--- a/linux-2.6-xen-sparse/arch/ia64/Kconfig	Wed Aug 16 14:28:57 2006 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/Kconfig	Fri Aug 18 14:26:09 2006 +0200
@@ -530,6 +530,9 @@ config XEN_REBOOT
 
 config XEN_SMPBOOT
 	default n
+
+config XEN_XENCOMM
+	default y
 endif
 
 source drivers/xen/Kconfig
diff -r 8c6bb45901e7 linux-2.6-xen-sparse/arch/ia64/kernel/setup.c
--- a/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c	Wed Aug 16 14:28:57 2006 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c	Fri Aug 18 14:26:09 2006 +0200
@@ -433,6 +433,9 @@ setup_arch (char **cmdline_p)
 
 #ifdef CONFIG_XEN
 	if (is_running_on_xen()) {
+		extern unsigned long kernel_start_pa;
+
+		kernel_start_pa = KERNEL_START - ia64_tpa (KERNEL_START);
 		setup_xen_features();
 		/* Register a call for panic conditions. */
 		notifier_chain_register(panic_notifier_list, xen_panic_block);
diff -r 8c6bb45901e7 linux-2.6-xen-sparse/arch/ia64/xen/Makefile
--- a/linux-2.6-xen-sparse/arch/ia64/xen/Makefile	Wed Aug 16 14:28:57 2006 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/Makefile	Fri Aug 18 14:26:09 2006 +0200
@@ -3,6 +3,6 @@
 #
 
 obj-y := hypercall.o xenivt.o xenentry.o xensetup.o xenpal.o xenhpski.o \
-	 hypervisor.o pci-dma-xen.o util.o
+	 hypervisor.o pci-dma-xen.o util.o hcall.o
 
 pci-dma-xen-y := ../../i386/kernel/pci-dma-xen.o
diff -r 8c6bb45901e7 linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c	Wed Aug 16 14:28:57 2006 -0600
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c	Fri Aug 18 14:26:09 2006 +0200
@@ -371,8 +371,6 @@ int
 int
 HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
 {
-	__u64 va1, va2, pa1, pa2;
-
 	if (cmd == GNTTABOP_map_grant_ref) {
 		unsigned int i;
 		for (i = 0; i  count; i++) {
@@ -380,29 +378,7 @@ HYPERVISOR_grant_table_op(unsigned int c
 (struct gnttab_map_grant_ref*)uop + i);
 		}
 	}
-	va1 = (__u64)uop  PAGE_MASK;
-	pa1 = pa2 = 0;
-	if ((REGION_NUMBER(va1) == 5) 
-	((va1 - KERNEL_START) = KERNEL_TR_PAGE_SIZE)) {
-		pa1 = ia64_tpa(va1);
-		if (cmd = GNTTABOP_transfer) {
-			static uint32_t uop_size[GNTTABOP_transfer + 1] = {
-sizeof(struct gnttab_map_grant_ref),
-sizeof(struct gnttab_unmap_grant_ref),
-sizeof(struct gnttab_setup_table),
-sizeof(struct gnttab_dump_table),
-sizeof(struct gnttab_transfer),
-			};
-			va2 = (__u64)uop + (uop_size[cmd] * count) - 1;
-			va2 = PAGE_MASK;
-			if (va1 != va2) {
-/* maximum size of uop is 2pages */
-BUG_ON(va2  va1 + PAGE_SIZE);
-pa2 = ia64_tpa(va2);
-			}
-		}
-	}
-	return HYPERVISOR_grant_table_op(cmd, uop, count, pa1, pa2);
+	return HYPERVISOR_grant_table_op(cmd, uop, count);
 }
 EXPORT_SYMBOL(HYPERVISOR_grant_table_op);
 
diff -r 8c6bb45901e7 linux-2.6-xen-sparse/drivers/xen/Kconfig
--- a/linux-2.6-xen-sparse/drivers/xen/Kconfig	Wed Aug 16 14:28:57 2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/Kconfig	Fri Aug 18 14:26:09 2006 +0200
@@ -257,4 +257,7 @@ config XEN_SMPBOOT
 	default y
 	depends on SMP
 
+config XEN_XENCOMM
+	bool
+	default n
 endif
diff -r 8c6bb45901e7 linux-2.6-xen-sparse/drivers/xen/core/Makefile
--- a/linux-2.6-xen-sparse/drivers/xen/core/Makefile	Wed Aug 16 14:28:57 2006 -0600
+++ b/linux-2.6-xen-sparse/drivers/xen/core/Makefile	Fri Aug 18 14:26:09 2006 +0200
@@ -11,3 +11,4 @@ obj-$(CONFIG_XEN_SKBUFF)	+= skbuff.o
 obj-$(CONFIG_XEN_SKBUFF)	+= skbuff.o
 obj-$(CONFIG_XEN_REBOOT)	+= reboot.o
 obj-$(CONFIG_XEN_SMPBOOT)	+= smpboot.o
+obj-$(CONFIG_XEN_XENCOMM)   += xencomm.o
diff -r 8c6bb45901e7 linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c
--- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Wed Aug 16 14:28:57 2006 -0600
+++