[XenPPC] [xenppc-unstable] [XEN][POWERPC] Normalize timbase_freq to a 64bit value

2007-03-22 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Date 1166188616 18000
# Node ID 5a2b3a1b1f632475c8abdce25132e9d3ea767f7f
# Parent  156f2644eb062bc57e42747a745a8bac077e8d7b
[XEN][POWERPC] Normalize timbase_freq to a 64bit value
Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/boot_of.c |7 ---
 xen/arch/powerpc/time.c|2 +-
 xen/include/asm-powerpc/time.h |2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff -r 156f2644eb06 -r 5a2b3a1b1f63 xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.cFri Dec 15 08:36:03 2006 -0500
+++ b/xen/arch/powerpc/boot_of.cFri Dec 15 08:16:56 2006 -0500
@@ -1206,6 +1206,7 @@ static int __init boot_of_cpus(void)
 s32 cpuid;
 u32 cpu_clock[2];
 extern uint cpu_hard_id[NR_CPUS];
+u32 tbf;
 
 /* Look up which CPU we are running on right now and get all info
  * from there */
@@ -1220,12 +1221,12 @@ static int __init boot_of_cpus(void)
 
 cpu_node = bootcpu_node;
 
-result = of_getprop(cpu_node, "timebase-frequency", &timebase_freq,
-sizeof(timebase_freq));
+result = of_getprop(cpu_node, "timebase-frequency", &tbf, sizeof(tbf));
+timebase_freq = tbf;
 if (result == OF_FAILURE) {
 of_panic("Couldn't get timebase frequency!\n");
 }
-of_printf("OF: timebase-frequency = %d Hz\n", timebase_freq);
+of_printf("OF: timebase-frequency = %ld Hz\n", timebase_freq);
 
 result = of_getprop(cpu_node, "clock-frequency",
 &cpu_clock, sizeof(cpu_clock));
diff -r 156f2644eb06 -r 5a2b3a1b1f63 xen/arch/powerpc/time.c
--- a/xen/arch/powerpc/time.c   Fri Dec 15 08:36:03 2006 -0500
+++ b/xen/arch/powerpc/time.c   Fri Dec 15 08:16:56 2006 -0500
@@ -32,7 +32,7 @@ static int cpu_has_hdec = 1;
 static int cpu_has_hdec = 1;
 ulong ticks_per_usec;
 unsigned long cpu_khz;
-unsigned int timebase_freq;
+s64 timebase_freq;
 
 s_time_t get_s_time(void)
 {
diff -r 156f2644eb06 -r 5a2b3a1b1f63 xen/include/asm-powerpc/time.h
--- a/xen/include/asm-powerpc/time.hFri Dec 15 08:36:03 2006 -0500
+++ b/xen/include/asm-powerpc/time.hFri Dec 15 08:16:56 2006 -0500
@@ -27,7 +27,7 @@
 #include 
 #include 
 
-extern unsigned int timebase_freq;
+extern s64 timebase_freq;
 #define CLOCK_TICK_RATE timebase_freq
 
 #define watchdog_disable() ((void)0)

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] workaround for context_switch() bug

2007-03-22 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Date 1166189763 18000
# Node ID 156f2644eb062bc57e42747a745a8bac077e8d7b
# Parent  fdb3c96eba0f8d898dd5e734598ddc671114f1a1
[XEN][POWERPC] workaround for context_switch() bug
 We have a bug in that if we switch domains in schedule() we switch
 right away regardless of whatever else is pending.  This means that
 if the timer goes off while in schedule(), the next domain will be
 preempted by the interval defined below.  So until we fix our
 cotnext_switch(), the follow workaround will make sure that the
 domain we switch to does not run for to long so we can continue to
 service the other timers in the timer queue and that the value is
 long enough to escape this particular timer event.
Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/exceptions.c |   19 +--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff -r fdb3c96eba0f -r 156f2644eb06 xen/arch/powerpc/exceptions.c
--- a/xen/arch/powerpc/exceptions.c Thu Feb 08 07:05:26 2007 -0500
+++ b/xen/arch/powerpc/exceptions.c Fri Dec 15 08:36:03 2006 -0500
@@ -35,7 +35,9 @@ extern ulong ppc_do_softirq(ulong orig_m
 extern ulong ppc_do_softirq(ulong orig_msr);
 extern void do_timer(struct cpu_user_regs *regs);
 extern void do_dec(struct cpu_user_regs *regs);
-extern void program_exception(struct cpu_user_regs *regs, unsigned long 
cookie);
+extern void program_exception(struct cpu_user_regs *regs,
+  unsigned long cookie);
+extern int reprogram_timer(s_time_t timeout); 
 
 int hdec_sample = 0;
 
@@ -43,7 +45,20 @@ void do_timer(struct cpu_user_regs *regs
 {
 /* Set HDEC high so it stops firing and can be reprogrammed by
  * set_preempt() */
-mthdec(INT_MAX);
+/* FIXME! HACK ALERT!
+ *
+ * We have a bug in that if we switch domains in schedule() we
+ * switch right away regardless of whatever else is pending.  This
+ * means that if the timer goes off while in schedule(), the next
+ * domain will be preempted by the interval defined below.  So
+ * until we fix our cotnext_switch(), the follow workaround will
+ * make sure that the domain we switch to does not run for to long
+ * so we can continue to service the other timers in the timer
+ * queue and that the value is long enough to escape this
+ * particular timer event.
+ */
+reprogram_timer(NOW() + MILLISECS(1));
+
 raise_softirq(TIMER_SOFTIRQ);
 }
 

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


[XenPPC] [xenppc-unstable] [XEN] Add arch hook for max_mem domctl.

2007-03-05 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Hollis Blanchard <[EMAIL PROTECTED]>
# Date 1172776731 21600
# Node ID 9f49a53fea30a031d3cc6315cfcbcc330b2464d1
# Parent  6b42b8c08731d7bc1abedac2239707e14ae8599d
[XEN] Add arch hook for max_mem domctl.

This patch introduces an arch hook in the MAX_MEM hcall. In particular, PowerPC
will use this hook to create/update a p2m mapping array. This patch introduces
the hook only and should compile away on all arches.

Signed-off-by: Ryan Harper <[EMAIL PROTECTED]>
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
 xen/common/domctl.c  |4 
 xen/include/asm-ia64/shadow.h|2 ++
 xen/include/asm-powerpc/shadow.h |7 ++-
 xen/include/asm-x86/shadow.h |2 ++
 4 files changed, 14 insertions(+), 1 deletion(-)

diff -r 6b42b8c08731 -r 9f49a53fea30 xen/common/domctl.c
--- a/xen/common/domctl.c   Thu Mar 01 14:32:58 2007 -0600
+++ b/xen/common/domctl.c   Thu Mar 01 13:18:51 2007 -0600
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -608,6 +609,9 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
 spin_lock(&d->page_alloc_lock);
 if ( new_max >= d->tot_pages )
 {
+ret = guest_physmap_max_mem_pages(d, new_max);
+if ( ret != 0 )
+break;
 d->max_pages = new_max;
 ret = 0;
 }
diff -r 6b42b8c08731 -r 9f49a53fea30 xen/include/asm-ia64/shadow.h
--- a/xen/include/asm-ia64/shadow.h Thu Mar 01 14:32:58 2007 -0600
+++ b/xen/include/asm-ia64/shadow.h Thu Mar 01 13:18:51 2007 -0600
@@ -61,6 +61,8 @@ shadow_mark_page_dirty(struct domain *d,
 return 0;
 }
 
+#define guest_physmap_max_mem_pages(d, n) (0)
+
 #endif // _XEN_SHADOW_H
 
 /*
diff -r 6b42b8c08731 -r 9f49a53fea30 xen/include/asm-powerpc/shadow.h
--- a/xen/include/asm-powerpc/shadow.h  Thu Mar 01 14:32:58 2007 -0600
+++ b/xen/include/asm-powerpc/shadow.h  Thu Mar 01 13:18:51 2007 -0600
@@ -13,9 +13,10 @@
  * 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: Hollis Blanchard <[EMAIL PROTECTED]>
+ *  Ryan Harper <[EMAIL PROTECTED]>
  */
 
 #ifndef _ASM_SHADOW_H_
@@ -58,4 +59,8 @@ static inline unsigned int shadow_get_al
 {
 return (1ULL << (d->arch.htab.order + PAGE_SHIFT)) >> 20;
 }
+
+#define guest_physmap_max_mem_pages(d, n) (0)
+
 #endif
+
diff -r 6b42b8c08731 -r 9f49a53fea30 xen/include/asm-x86/shadow.h
--- a/xen/include/asm-x86/shadow.h  Thu Mar 01 14:32:58 2007 -0600
+++ b/xen/include/asm-x86/shadow.h  Thu Mar 01 13:18:51 2007 -0600
@@ -121,6 +121,8 @@ static inline void shadow_remove_all_sha
 sh_remove_shadows(v, gmfn, 0 /* Be thorough */, 1 /* Must succeed */);
 }
 
+#define guest_physmap_max_mem_pages(d, n) (0)
+
 #endif /* _XEN_SHADOW_H */
 
 /*

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


[XenPPC] [xenppc-unstable] [XEN] Add arch hook for max_mem domctl.

2007-03-02 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Hollis Blanchard <[EMAIL PROTECTED]>
# Date 1172776731 21600
# Node ID bd0b97a569fe9f5c99c2015380b6c0f0825f6ca3
# Parent  3629517371f005789b1b038efc93ea49b6d4fa78
[XEN] Add arch hook for max_mem domctl.

This patch introduces an arch hook in the MAX_MEM hcall. In particular, PowerPC
will use this hook to create/update a p2m mapping array. This patch introduces
the hook only and should compile away on all arches.

Signed-off-by: Ryan Harper <[EMAIL PROTECTED]>
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
 xen/common/domctl.c  |4 
 xen/include/asm-ia64/shadow.h|2 ++
 xen/include/asm-powerpc/shadow.h |7 ++-
 xen/include/asm-x86/shadow.h |2 ++
 4 files changed, 14 insertions(+), 1 deletion(-)

diff -r 3629517371f0 -r bd0b97a569fe xen/common/domctl.c
--- a/xen/common/domctl.c   Thu Mar 01 14:32:58 2007 -0600
+++ b/xen/common/domctl.c   Thu Mar 01 13:18:51 2007 -0600
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -614,6 +615,9 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
 spin_lock(&d->page_alloc_lock);
 if ( new_max >= d->tot_pages )
 {
+ret = guest_physmap_max_mem_pages(d, new_max);
+if ( ret != 0 )
+break;
 d->max_pages = new_max;
 ret = 0;
 }
diff -r 3629517371f0 -r bd0b97a569fe xen/include/asm-ia64/shadow.h
--- a/xen/include/asm-ia64/shadow.h Thu Mar 01 14:32:58 2007 -0600
+++ b/xen/include/asm-ia64/shadow.h Thu Mar 01 13:18:51 2007 -0600
@@ -61,6 +61,8 @@ shadow_mark_page_dirty(struct domain *d,
 return 0;
 }
 
+#define guest_physmap_max_mem_pages(d, n) (0)
+
 #endif // _XEN_SHADOW_H
 
 /*
diff -r 3629517371f0 -r bd0b97a569fe xen/include/asm-powerpc/shadow.h
--- a/xen/include/asm-powerpc/shadow.h  Thu Mar 01 14:32:58 2007 -0600
+++ b/xen/include/asm-powerpc/shadow.h  Thu Mar 01 13:18:51 2007 -0600
@@ -13,9 +13,10 @@
  * 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: Hollis Blanchard <[EMAIL PROTECTED]>
+ *  Ryan Harper <[EMAIL PROTECTED]>
  */
 
 #ifndef _ASM_SHADOW_H_
@@ -58,4 +59,8 @@ static inline unsigned int shadow_get_al
 {
 return (1ULL << (d->arch.htab.order + PAGE_SHIFT)) >> 20;
 }
+
+#define guest_physmap_max_mem_pages(d, n) (0)
+
 #endif
+
diff -r 3629517371f0 -r bd0b97a569fe xen/include/asm-x86/shadow.h
--- a/xen/include/asm-x86/shadow.h  Thu Mar 01 14:32:58 2007 -0600
+++ b/xen/include/asm-x86/shadow.h  Thu Mar 01 13:18:51 2007 -0600
@@ -460,6 +460,8 @@ gl1e_to_ml1e(struct domain *d, l1_pgentr
 return l1e;
 }
 
+#define guest_physmap_max_mem_pages(d, n) (0)
+
 #endif /* _XEN_SHADOW_H */
 
 /*

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


[XenPPC] [xenppc-unstable] [XEN][XEND][POWERPC] Don't ignore shadow memory requirement

2007-01-26 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 0980dfbae746805c51704e62a1bc4603cd815041
# Parent  ea0c006faab68d2c2a65750c90ec8881f0e0b003
[XEN][XEND][POWERPC] Don't ignore shadow memory requirement
We don't need a custom buildDomain() anymore but we do need to provide a
shadow memory calculation.

 - Create PPC_LinuxImageHandler class to implement
   getRequiredShadowMemory().
 - Derive prose builder from PPC_LinuxImageHandlerClass.
 - Drop configure() as it is not needed according to Jimi.

Signed-off-by: Ryan Harper <[EMAIL PROTECTED]>
Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 tools/python/xen/xend/image.py |   33 -
 1 files changed, 16 insertions(+), 17 deletions(-)

diff -r ea0c006faab6 -r 0980dfbae746 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.pyTue Jan 23 08:54:41 2007 -0600
+++ b/tools/python/xen/xend/image.pyThu Jan 25 15:55:25 2007 -0500
@@ -214,15 +214,23 @@ class LinuxImageHandler(ImageHandler):
   ramdisk= self.ramdisk,
   features   = self.vm.getFeatures())
 
-
-
-class PPC_ProseImageHandler(LinuxImageHandler):
+class PPC_LinuxImageHandler(LinuxImageHandler):
+
+ostype = "linux"
+
+def getRequiredShadowMemory(self, shadow_mem_kb, maxmem_kb):
+"""@param shadow_mem_kb The configured shadow memory, in KiB.
+@param maxmem_kb The configured maxmem, in KiB.
+@return The corresponding required amount of shadow memory, also in
+KiB.
+PowerPC currently uses "shadow memory" to refer to the hash table."""
+return max(maxmem_kb / 64, shadow_mem_kb)
+
+
+
+class PPC_ProseImageHandler(PPC_LinuxImageHandler):
 
 ostype = "prose"
-
-def configure(self, vmConfig, imageConfig, deviceConfig):
-LinuxImageHandler.configure(self, vmConfig, imageConfig, deviceConfig)
-self.imageConfig = imageConfig
 
 def buildDomain(self):
 store_evtchn = self.vm.getStorePort()
@@ -248,15 +256,6 @@ class PPC_ProseImageHandler(LinuxImageHa
cmdline= self.cmdline,
ramdisk= self.ramdisk,
features   = self.vm.getFeatures())
-
-def getRequiredShadowMemory(self, shadow_mem_kb, maxmem_kb):
-"""@param shadow_mem_kb The configured shadow memory, in KiB.
-@param maxmem_kb The configured maxmem, in KiB.
-@return The corresponding required amount of shadow memory, also in
-KiB.
-PowerPC currently uses "shadow memory" to refer to the hash table."""
-return max(maxmem_kb / 64, shadow_mem_kb)
-
 
 class HVMImageHandler(ImageHandler):
 
@@ -598,7 +597,7 @@ class X86_Linux_ImageHandler(LinuxImageH
 
 _handlers = {
 "powerpc": {
-"linux": LinuxImageHandler,
+"linux": PPC_LinuxImageHandler,
 "prose": PPC_ProseImageHandler,
 },
 "ia64": {

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


Re: [XenPPC] [xenppc-unstable] [XEN][POWERPC] Linker script simplification broke optimized builds.

2007-01-23 Thread Jimi Xenidis


On Jan 23, 2007, at 12:22 PM, Segher Boessenkool wrote:




Again -- do you have a testcase for the failure that made
you revert this patch?



yeah, gcc -O2

just build xen with debug=n, the symptom is that string literals got  
truncated.. LITERALLY!

-JX

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


Re: [XenPPC] [xenppc-unstable] [XEN][POWERPC] Linker script simplification broke optimized builds.

2007-01-23 Thread Segher Boessenkool

the original script came from binutils and we simply adapted it.


Yes, but that script is meant for userspace things and isn't
the right thing for your environment.

I tried to simplify but I was unable to predict all the gcc created  
sections for various gcc flags (esp -O2), so I just put all that  
stuff back.


GCC won't create too many sections, just a few, unless you
do something terribly wrong.


I'll try another pass at another time, when I can test all scenarios.


Good to hear.  I consider this patch reversion to be a
regression though.

There is a huge degree of risk playing here, you can imagine how  
hard an issues from a dropped section would be hard to detect.


I tend to fix such issues, they're not hard to detect at all
(almost all of the time) -- dropped sections lead to hard
crashes really easily ;-)

Figuring out what is wrong is another thing -- often it is
*not* the linker script but something else btw, you just
get lucky with a certain script and a certain binutils
version but unlucky with another combo.


Perhaps ld has options to warn when badness occurs.


Yeah it can do many of those things.


Again -- do you have a testcase for the failure that made
you revert this patch?


Segher


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


Re: [XenPPC] [xenppc-unstable] [XEN][POWERPC] Linker script simplification broke optimized builds.

2007-01-23 Thread Jimi Xenidis

the original script came from binutils and we simply adapted it.
I tried to simplify but I was unable to predict all the gcc created  
sections for various gcc flags (esp -O2), so I just put all that  
stuff back.


I'll try another pass at another time, when I can test all scenarios.
There is a huge degree of risk playing here, you can imagine how hard  
an issues from a dropped section would be hard to detect.  Perhaps ld  
has options to warn when badness occurs.

I got lucky with this one.

-JX
On Jan 23, 2007, at 3:51 AM, Segher Boessenkool wrote:


[XEN][POWERPC] Linker script simplification broke optimized builds.

offending changeset was: changeset:   14126:c759c733f77d
So put it back and just update the symbols like a good little boy.


What, you're replacing one bug by a big bag of other
bugs?  Wouldn't it have been smarter to just fix the
bug you had?  Is there any bug report about the original
problem (I didn't see it)?

+SEARCH_DIR("=/usr/local/lib64"); SEARCH_DIR("=/lib64"); SEARCH_DIR 
("=/usr/lib64"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/ 
lib"); SEARCH_DIR("=/usr/lib");


For example, this obviously is very very wrong.

I don't dare look at the rest of this patch (well I
did, but I don't know where to start commenting on
it ;-) )


Segher


___
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


Re: [XenPPC] [xenppc-unstable] [XEN][POWERPC] Linker script simplification broke optimized builds.

2007-01-23 Thread Segher Boessenkool

[XEN][POWERPC] Linker script simplification broke optimized builds.

offending changeset was: changeset:   14126:c759c733f77d
So put it back and just update the symbols like a good little boy.


What, you're replacing one bug by a big bag of other
bugs?  Wouldn't it have been smarter to just fix the
bug you had?  Is there any bug report about the original
problem (I didn't see it)?

+SEARCH_DIR("=/usr/local/lib64"); SEARCH_DIR("=/lib64"); SEARCH_DIR 
("=/usr/lib64"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/ 
lib"); SEARCH_DIR("=/usr/lib");


For example, this obviously is very very wrong.

I don't dare look at the rest of this patch (well I
did, but I don't know where to start commenting on
it ;-) )


Segher


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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Linker script simplification broke optimized builds.

2007-01-22 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 8b7a8c2e0178f326cfef9fa01a5042a52503dacc
# Parent  d301edbf6ecec86d24573e4be3399fbf3a4bd463
[XEN][POWERPC] Linker script simplification broke optimized builds.

offending changeset was: changeset:   14126:c759c733f77d
So put it back and just update the symbols like a good little boy.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/xen.lds.S |  182 ++---
 1 files changed, 141 insertions(+), 41 deletions(-)

diff -r d301edbf6ece -r 8b7a8c2e0178 xen/arch/powerpc/xen.lds.S
--- a/xen/arch/powerpc/xen.lds.SMon Jan 22 13:01:31 2007 -0500
+++ b/xen/arch/powerpc/xen.lds.SMon Jan 22 15:52:46 2007 -0500
@@ -7,62 +7,113 @@ 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  : { *(.gnu.version_r) }
+  .rel.dyn:
+{
+  *(.rel.init)
+  *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
+  *(.rel.fini)
+  *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
+  *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
+  *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
+  *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
+  *(.rel.ctors)
+  *(.rel.dtors)
+  *(.rel.got)
+  *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
+  *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
+  *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
+  *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
+  *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
+}
+  .rela.dyn   :
+{
+  *(.rela.init)
+  *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
+  *(.rela.fini)
+  *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
+  *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
+  *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
+  *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
+  *(.rela.ctors)
+  *(.rela.dtors)
+  *(.rela.got)
+  *(.rela.toc)
+  *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
+  *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
+  *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
+  *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
+  *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
+}
+  .rel.plt: { *(.rel.plt) }
+  .rela.plt   : { *(.rela.plt) }
+  .rela.tocbss   : { *(.rela.tocbss) }
+  .init   :
+  {
+KEEP (*(.init))
+  } =0x6000
   .text   :
   {
-*(.text)
+*(.text .stub .text.* .gnu.linkonce.t.*)
 /* .gnu.warning sections are handled specially by elf32.em.  */
 *(.gnu.warning)
-  } : text
-  /* end of text */
+*(.sfpr .glink)
+  } =0x6000
+  .fini   :
+  {
+KEEP (*(.fini))
+  } =0x6000
   PROVIDE (__etext = .);
   PROVIDE (_etext = .);
   PROVIDE (etext = .);
-
-  /* read only data */
-  .rodata : { *(.rodata .rodata.*) } : text
-  .rodata1: { *(.rodata1) } : text
-  .sdata2 : { *(.sdata2 .sdata2.*) } : text
-  .sbss2  : { *(.sbss2 .sbss2.*) } : text
-
-  . = ALIGN(64);
-  __start___ex_table = .;
-  __ex_table : { *(__ex_table) } : text
-  __stop___ex_table = .;
-  . = ALIGN(64);
-
+  .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
+  .rodata1: { *(.rodata1) }
+  .sdata2 : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) }
+  .sbss2  : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
+  .eh_frame_hdr : { *(.eh_frame_hdr) }
+  /* Adjust the address for the data segment.  We want to adjust up to
+ the same address within the page on the next page up.  */
+  . = ALIGN (0x1) - ((0x1 - .) & (0x1 - 1)); . = 
DATA_SEGMENT_ALIGN (0x1, 0x1000);
+  /* Ensure the __preinit_array_start label is properly aligned.  We
+ could instead move the label definition inside the section, but
+ the linker would then create the section even if it turns out to
+ be empty, which isn't pretty.  */
+  . = ALIGN(64 / 8);
+  PROVIDE (__preinit_array_start = .);
+  .preinit_array : { *(.preinit_array) }
+  PROVIDE (__preinit_array_end = .);
+  PROVIDE (__init_array_start = .);
+  .init_array : { *(.init_array) }
+  PROVIDE (__init_array_end = .);
+  

[XenPPC] [xenppc-unstable] [XEN][POWERPC] fill in arch_vcpu_reset()

2007-01-22 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID bd937e22541db922863c93ea4062002def26a452
# Parent  bbd2af302fea7fdd704079779753afa74523945d
[XEN][POWERPC] fill in arch_vcpu_reset()
it panics now

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/domain.c |7 +++
 1 files changed, 7 insertions(+)

diff -r bbd2af302fea -r bd937e22541d xen/arch/powerpc/domain.c
--- a/xen/arch/powerpc/domain.c Sun Jan 21 08:58:11 2007 -0500
+++ b/xen/arch/powerpc/domain.c Sun Jan 21 09:12:57 2007 -0500
@@ -173,6 +173,13 @@ int arch_set_info_guest(struct vcpu *v, 
 return 0;
 }
 
+int arch_vcpu_reset(struct vcpu *v)
+{
+panic("%s: called for Dom%d[%d]\n",
+  __func__, v->domain->domain_id, v->vcpu_id);
+return 0;
+}
+
 void dump_pageframe_info(struct domain *d)
 {
 struct page_info *page;

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] remove redundant and confusing restart/halt messages

2007-01-21 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID d7a63be8595e3b7f435ba2fc3352d6089a84a85d
# Parent  40b707df348824b7df499fe79b98289affad2485
[XEN][POWERPC] remove redundant and confusing restart/halt messages

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/domain.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff -r 40b707df3488 -r d7a63be8595e xen/arch/powerpc/domain.c
--- a/xen/arch/powerpc/domain.c Sat Jan 20 19:13:44 2007 -0500
+++ b/xen/arch/powerpc/domain.c Sun Jan 21 07:47:35 2007 -0500
@@ -105,13 +105,13 @@ void arch_domain_destroy(struct domain *
 
 static void machine_fail(const char *s)
 {
-printk("%s failed, manual powercycle required!\n", s);
+printk("%s failed, manual powercycle required!\n"
+   "  spinning\n", s);
 for (;;)
 sleep();
 }
 void machine_halt(void)
 {
-printk("machine_halt called: spinning\n");
 console_start_sync();
 printk("%s called\n", __func__);
 rtas_halt();
@@ -121,7 +121,6 @@ void machine_halt(void)
 
 void machine_restart(char * __unused)
 {
-printk("machine_restart called: spinning\n");
 console_start_sync();
 printk("%s called\n", __func__);
 rtas_reboot();

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Allocate secondary VCPUs for Dom0

2007-01-21 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 1b00e1288e8ca376d2674628b1bfff698443dbf2
# Parent  d7a63be8595e3b7f435ba2fc3352d6089a84a85d
[XEN][POWERPC] Allocate secondary VCPUs for Dom0

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/domain_build.c |   23 +++
 1 files changed, 23 insertions(+)

diff -r d7a63be8595e -r 1b00e1288e8c xen/arch/powerpc/domain_build.c
--- a/xen/arch/powerpc/domain_build.c   Sun Jan 21 07:47:35 2007 -0500
+++ b/xen/arch/powerpc/domain_build.c   Sun Jan 21 07:49:50 2007 -0500
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -120,6 +121,7 @@ int construct_dom0(struct domain *d,
 ulong msr;
 ulong pc;
 ulong r2;
+int vcpu;
 
 /* Sanity! */
 BUG_ON(d->domain_id != 0);
@@ -209,6 +211,27 @@ int construct_dom0(struct domain *d,
 
 /* put stack below everything */
 v->arch.ctxt.gprs[1] = dst - STACK_FRAME_OVERHEAD;
+
+/* startup secondary processors */
+if ( opt_dom0_max_vcpus == 0 )
+opt_dom0_max_vcpus = num_online_cpus();
+if ( opt_dom0_max_vcpus > num_online_cpus() )
+opt_dom0_max_vcpus = num_online_cpus();
+if ( opt_dom0_max_vcpus > MAX_VIRT_CPUS )
+opt_dom0_max_vcpus = MAX_VIRT_CPUS;
+#ifdef BITS_PER_GUEST_LONG
+if ( opt_dom0_max_vcpus > BITS_PER_GUEST_LONG(d) )
+opt_dom0_max_vcpus = BITS_PER_GUEST_LONG(d);
+#endif
+printk("Dom0 has maximum %u VCPUs\n", opt_dom0_max_vcpus);
+
+for (vcpu = 1; vcpu < opt_dom0_max_vcpus; vcpu++) {
+if (NULL == alloc_vcpu(dom0, vcpu, vcpu))
+panic("Error creating domain 0 vcpu %d\n", vcpu);
+/* for now we pin Dom0 VCPUs to their coresponding CPUs */
+if (cpu_isset(vcpu, cpu_online_map))
+dom0->vcpu[vcpu]->cpu_affinity = cpumask_of_cpu(vcpu);
+}
 
 /* copy relative to Xen */
 dst += rma;

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] big lock to protect some TLB operations

2007-01-20 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 0a541b530f6a91b0a4de25db25c0ed33f0779202
# Parent  c16586000525f9d9dfbbe336d9d458dd08b44a0e
[XEN][POWERPC] big lock to protect some TLB operations

970 requires locking around TLB operations, see code comment.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/papr/xlate.c |   17 -
 1 files changed, 16 insertions(+), 1 deletion(-)

diff -r c16586000525 -r 0a541b530f6a xen/arch/powerpc/papr/xlate.c
--- a/xen/arch/powerpc/papr/xlate.c Wed Jan 17 19:37:20 2007 -0500
+++ b/xen/arch/powerpc/papr/xlate.c Sat Jan 20 18:57:15 2007 -0500
@@ -72,6 +72,20 @@ static inline void pte_insert(union pte 
 }
 #endif
 
+/*
+ * POWER Arch 2.03 Sec 4.12.1 (Yes 970 is one)
+ *
+ *   when a tlbsync instruction has been executed by a processor in a
+ *   given partition, a ptesync instruction must be executed by that
+ *   processor before a tlbie or tlbsync instruction is executed by
+ *   another processor in that partition.
+ *
+ * So for now, here is a BFLock to deal with it, the lock should be per-domain.
+ *
+ * XXX Will need to audit all tlb usege soon enough.
+ */
+
+static DEFINE_SPINLOCK(native_tlbie_lock);
 static void pte_tlbie(union pte volatile *pte, ulong ptex)
 {
 ulong va;
@@ -91,6 +105,7 @@ static void pte_tlbie(union pte volatile
 va = (pi << 12) | (vsid << 28);
 va &= ~(0xULL << 48);
 
+spin_lock(&native_tlbie_lock);
 #ifndef FLUSH_THE_WHOLE_THING
 if (pte->bits.l) {
 va |= (pte->bits.rpn & 1);
@@ -114,7 +129,7 @@ static void pte_tlbie(union pte volatile
 }
 }
 #endif
-
+spin_unlock(&native_tlbie_lock);
 }
 
 long pte_enter(ulong flags, ulong ptex, ulong vsid, ulong rpn)

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] more ofd /cpus fixups

2007-01-20 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID ae504a49923cd7d4446022f300498d95271ffbd1
# Parent  0a541b530f6a91b0a4de25db25c0ed33f0779202
[XEN][POWERPC] more ofd /cpus fixups

Correct comment on why we prune secondary processors on the devtree.
Get rid of a particularly annoying non-standard cpu property.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/ofd_fixup.c |   11 ++-
 1 files changed, 10 insertions(+), 1 deletion(-)

diff -r 0a541b530f6a -r ae504a49923c xen/arch/powerpc/ofd_fixup.c
--- a/xen/arch/powerpc/ofd_fixup.c  Sat Jan 20 18:57:15 2007 -0500
+++ b/xen/arch/powerpc/ofd_fixup.c  Sat Jan 20 18:59:32 2007 -0500
@@ -178,11 +178,20 @@ static ofdn_t ofd_cpus_props(void *m, st
 if (ofd_boot_cpu == -1)
 ofd_boot_cpu = c;
 while (c > 0) {
-/* Since we are not MP yet we prune all but the booting cpu */
+/* We do not use the OF tree to identify secondary processors
+ * so we must prune them from the tree */
 if (c == ofd_boot_cpu) {
+ofdn_t p;
+
 ibm_pft_size[1] = d->arch.htab.log_num_ptes + LOG_PTE_SIZE;
 ofd_prop_add(m, c, "ibm,pft-size",
  ibm_pft_size, sizeof (ibm_pft_size));
+
+/* get rid of non-standard properties */
+p = ofd_prop_find(m, c, "cpu#");
+if (p > 0) {
+ofd_prop_remove(m, c, p);
+}
 
 /* FIXME: Check the the "l2-cache" property who's
  * contents is an orphaned phandle? */

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Print DAR and DSISR registers on CPU register dumps

2007-01-20 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID b4b7249f00d6063286d8d7240f4341e08bd2ee91
# Parent  ae504a49923cd7d4446022f300498d95271ffbd1
[XEN][POWERPC] Print DAR and DSISR registers on CPU register dumps

The information from these register can really help track doen
problems.  They are only saved on program exception, so we show what
in the CPU at time of printing as well.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/backtrace.c |1 -
 xen/arch/powerpc/powerpc64/asm-offsets.c |2 ++
 xen/arch/powerpc/powerpc64/exceptions.S  |8 +++-
 xen/arch/powerpc/powerpc64/traps.c   |   10 +-
 xen/include/public/arch-powerpc.h|   11 +++
 5 files changed, 25 insertions(+), 7 deletions(-)

diff -r ae504a49923c -r b4b7249f00d6 xen/arch/powerpc/backtrace.c
--- a/xen/arch/powerpc/backtrace.c  Sat Jan 20 18:59:32 2007 -0500
+++ b/xen/arch/powerpc/backtrace.c  Sat Jan 20 19:05:18 2007 -0500
@@ -198,7 +198,6 @@ void show_backtrace_regs(struct cpu_user
 console_start_sync();
 
 show_registers(regs);
-printk("dar 0x%016lx, dsisr 0x%08x\n", mfdar(), mfdsisr());
 printk("hid4 0x%016lx\n", regs->hid4);
 printk("---[ backtrace ]---\n");
 show_backtrace(regs->gprs[1], regs->lr, regs->pc);
diff -r ae504a49923c -r b4b7249f00d6 xen/arch/powerpc/powerpc64/asm-offsets.c
--- a/xen/arch/powerpc/powerpc64/asm-offsets.c  Sat Jan 20 18:59:32 2007 -0500
+++ b/xen/arch/powerpc/powerpc64/asm-offsets.c  Sat Jan 20 19:05:18 2007 -0500
@@ -48,6 +48,8 @@ void __dummy__(void)
 OFFSET(UREGS_ctr, struct cpu_user_regs, ctr);
 OFFSET(UREGS_xer, struct cpu_user_regs, xer);
 OFFSET(UREGS_hid4, struct cpu_user_regs, hid4);
+OFFSET(UREGS_dar, struct cpu_user_regs, dar);
+OFFSET(UREGS_dsisr, struct cpu_user_regs, dsisr);
 OFFSET(UREGS_cr, struct cpu_user_regs, cr);
 OFFSET(UREGS_fpscr, struct cpu_user_regs, fpscr);
 DEFINE(UREGS_sizeof, sizeof(struct cpu_user_regs));
diff -r ae504a49923c -r b4b7249f00d6 xen/arch/powerpc/powerpc64/exceptions.S
--- a/xen/arch/powerpc/powerpc64/exceptions.S   Sat Jan 20 18:59:32 2007 -0500
+++ b/xen/arch/powerpc/powerpc64/exceptions.S   Sat Jan 20 19:05:18 2007 -0500
@@ -373,9 +373,15 @@ ex_machcheck_continued:
  * a better way, but this works for now. */
 ex_program_continued:
 SAVE_GPRS r14, r31, r1  /* save all the non-volatiles */
-/* save hid4 for debug */
+
+/* save these for debug, no needed for restore */
 mfspr r14, SPRN_HID4
 std r14, UREGS_hid4(r1)
+mfdar r14
+std r14, UREGS_dar(r1)
+mfdsisr r14
+stw r14, UREGS_dsisr(r1)
+
 mr r14, r0
 EXCEPTION_SAVE_STATE r1
 mr r4, r14
diff -r ae504a49923c -r b4b7249f00d6 xen/arch/powerpc/powerpc64/traps.c
--- a/xen/arch/powerpc/powerpc64/traps.cSat Jan 20 18:59:32 2007 -0500
+++ b/xen/arch/powerpc/powerpc64/traps.cSat Jan 20 19:05:18 2007 -0500
@@ -41,7 +41,15 @@ void show_registers(struct cpu_user_regs
regs->pc, regs->msr,
regs->lr, regs->ctr,
regs->srr0, regs->srr1);
-for (i=0; i<32; i+=4) {
+
+/* These come in handy for debugging but are not always saved, so
+ * what is "actually" in the register should be good */
+printk("dar %016lx dsisr %08x *** saved\n"
+   "dar %016lx dsisr %08x *** actual\n",
+   regs->dar, regs->dsisr,
+   mfdar(), mfdsisr());
+
+for (i = 0; i < 32; i += 4) {
 printk("r%02i: %016lx %016lx %016lx %016lx\n", i,
 regs->gprs[i], regs->gprs[i+1], regs->gprs[i+2], regs->gprs[i+3]);
 }
diff -r ae504a49923c -r b4b7249f00d6 xen/include/public/arch-powerpc.h
--- a/xen/include/public/arch-powerpc.h Sat Jan 20 18:59:32 2007 -0500
+++ b/xen/include/public/arch-powerpc.h Sat Jan 20 19:05:18 2007 -0500
@@ -77,8 +77,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
 
 typedef uint64_t xen_ulong_t;
 
-/* User-accessible registers: need to be saved/restored for every nested Xen
- * invocation. */
+/* User-accessible registers: nost of these need to be saved/restored
+ * for every nested Xen invocation. */
 struct cpu_user_regs
 {
 uint64_t gprs[32];
@@ -88,10 +88,13 @@ struct cpu_user_regs
 uint64_t srr1;
 uint64_t pc;
 uint64_t msr;
-uint64_t fpscr;
+uint64_t fpscr; /* XXX Is this necessary */
 uint64_t xer;
-uint64_t hid4;
+uint64_t hid4;  /* debug only */
+uint64_t dar;   /* debug only */
+uint32_t dsisr; /* debug only */
 uint32_t cr;
+uint32_t __pad; /* good spot for another 32bit reg */
 uint32_t entry_vector;
 };
 typedef struct cpu_user_regs cpu_user_regs_t;

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] merge

2007-01-20 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 40b707df348824b7df499fe79b98289affad2485
# Parent  b4b7249f00d6063286d8d7240f4341e08bd2ee91
# Parent  5bcb155e5de57c02ef3b38d4989625ffafe3fcbe
[XEN][POWERPC] merge
---
 xen/arch/powerpc/boot_of.c   |   39 +++
 xen/arch/powerpc/memory.c|  150 ---
 xen/include/asm-powerpc/mm.h |3 
 3 files changed, 98 insertions(+), 94 deletions(-)

diff -r b4b7249f00d6 -r 40b707df3488 xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.cSat Jan 20 19:05:18 2007 -0500
+++ b/xen/arch/powerpc/boot_of.cSat Jan 20 19:13:44 2007 -0500
@@ -43,6 +43,14 @@ static int of_out;
 static int of_out;
 static ulong eomem;
 
+/* Track memory during early boot with a limited per-page bitmap. We need an
+ * allocator to tell us where we can place RTAS, our copy of the device tree.
+ * We could examine the "available" properties in memory nodes, but we
+ * apparently can't depend on firmware to update those when we call "claim". So
+ * we need to track it ourselves.
+ * We can't dynamically allocate the bitmap, because we would need something
+ * to tell us where it's safe to allocate...
+ */
 #define MEM_AVAILABLE_PAGES ((32 << 20) >> PAGE_SHIFT)
 static DECLARE_BITMAP(mem_available_pages, MEM_AVAILABLE_PAGES);
 
@@ -530,6 +538,37 @@ static ulong boot_of_alloc(ulong size)
 
 pos = pos + i;
 }
+}
+
+int boot_of_mem_avail(int pos, ulong *startpage, ulong *endpage)
+{
+ulong freebit;
+ulong usedbit;
+
+if (pos >= MEM_AVAILABLE_PAGES)
+/* Stop iterating. */
+return -1;
+
+/* Find first free page. */
+freebit = find_next_zero_bit(mem_available_pages, MEM_AVAILABLE_PAGES, 
pos);
+if (freebit >= MEM_AVAILABLE_PAGES) {
+/* We know everything after MEM_AVAILABLE_PAGES is still free. */
+*startpage = MEM_AVAILABLE_PAGES << PAGE_SHIFT;
+*endpage = ~0UL;
+return freebit;
+}
+*startpage = freebit << PAGE_SHIFT;
+
+/* Now find first used page after that. */
+usedbit = find_next_bit(mem_available_pages, MEM_AVAILABLE_PAGES, freebit);
+if (usedbit >= MEM_AVAILABLE_PAGES) {
+/* We know everything after MEM_AVAILABLE_PAGES is still free. */
+*endpage = ~0UL;
+return usedbit;
+}
+
+*endpage = usedbit << PAGE_SHIFT;
+return usedbit;
 }
 
 static ulong boot_of_mem_init(void)
diff -r b4b7249f00d6 -r 40b707df3488 xen/arch/powerpc/memory.c
--- a/xen/arch/powerpc/memory.c Sat Jan 20 19:05:18 2007 -0500
+++ b/xen/arch/powerpc/memory.c Sat Jan 20 19:13:44 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. 2006
+ * Copyright IBM Corp. 2006, 2007
  *
  * Authors: Dan Poff <[EMAIL PROTECTED]>
  *  Jimi Xenidis <[EMAIL PROTECTED]>
@@ -25,7 +25,7 @@
 #include "oftree.h"
 #include "rtas.h"
 
-#undef DEBUG
+#define DEBUG
 #ifdef DEBUG
 #define DBG(fmt...) printk(fmt)
 #else
@@ -42,8 +42,6 @@ unsigned long xenheap_phys_end;
 unsigned long xenheap_phys_end;
 static uint nr_pages;
 static ulong xenheap_size;
-static ulong save_start;
-static ulong save_end;
 
 struct membuf {
 ulong start;
@@ -51,30 +49,6 @@ struct membuf {
 };
 
 typedef void (*walk_mem_fn)(struct membuf *, uint);
-
-static ulong free_xenheap(ulong start, ulong end)
-{
-start = ALIGN_UP(start, PAGE_SIZE);
-end = ALIGN_DOWN(end, PAGE_SIZE);
-
-DBG("%s: 0x%lx - 0x%lx\n", __func__, start, end);
-
-/* need to do this better */
-if (save_start <= end && save_start >= start) {
-DBG("%s: Go around the saved area: 0x%lx - 0x%lx\n",
-   __func__, save_start, save_end);
-init_xenheap_pages(start, ALIGN_DOWN(save_start, PAGE_SIZE));
-xenheap_size += ALIGN_DOWN(save_start, PAGE_SIZE) - start;
-
-init_xenheap_pages(ALIGN_UP(save_end, PAGE_SIZE), end);
-xenheap_size += end - ALIGN_UP(save_end, PAGE_SIZE);
-} else {
-init_xenheap_pages(start, end);
-xenheap_size += end - start;
-}
-
-return ALIGN_UP(end, PAGE_SIZE);
-}
 
 static void set_max_page(struct membuf *mb, uint entries)
 {
@@ -113,6 +87,7 @@ static void heap_init(struct membuf *mb,
 start_blk = xenheap_phys_end;
 }
 
+DBG("boot free: %016lx - %016lx\n", start_blk, end_blk);
 init_boot_pages(start_blk, end_blk);
 total_pages += (end_blk - start_blk) >> PAGE_SHIFT;
 }
@@ -141,72 +116,31 @@ static void ofd_walk_mem(void *m, walk_m
 }
 }
 
-static void setup_xenheap(module_t *mod, int mcount)
-{
-int i;
-ulong freemem;
-
-freemem = ALIGN_UP((ulong)_end, PAGE_SIZE);
-
-for (i = 0; i < mcount; i++) {
-u32 s;
-
-if (mod[i].mod_end == mod[i].mod_start)
-continue;
-
-s = ALIGN_DOWN(mod[i].mod_start, PAGE_SIZE);
-
-if (m

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] [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


[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][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] [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] 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] everything is "single core" right now so get cpu_core_map[] correct.

2007-01-15 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 5568efb41da42a55318fa05d3ce0aa73e774e6d1
# Parent  d6481755ade6fbe72d8e519191f12160f92cd517
[XEN][POWERPC] everything is "single core" right now so get cpu_core_map[] 
correct.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/setup.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -r d6481755ade6 -r 5568efb41da4 xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Thu Jan 11 13:39:27 2007 -0600
+++ b/xen/arch/powerpc/setup.c  Mon Jan 15 13:27:20 2007 -0500
@@ -252,7 +252,7 @@ static int kick_secondary_cpus(int maxcp
 cpu_set(i, cpu_sibling_map[cpuid]);
 
 /* For now everything is single core */
-cpu_set(0, cpu_core_map[cpuid]);
+cpu_set(cpuid, cpu_core_map[cpuid]);
 
 numa_set_node(cpuid, 0);
 numa_add_cpu(cpuid);

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] DomU real time clock based off of the real one in Dom0

2006-12-19 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID db52c7d043bb2a7f3dc67f4f2fb4f6498b92e558
# Parent  014c4ef0e124a81a072a92bd4cff17e6214d8897
[XEN][POWERPC] DomU real time clock based off of the real one in Dom0

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/domain.c |   21 -
 xen/arch/powerpc/time.c   |6 --
 xen/include/public/arch-powerpc.h |2 +-
 3 files changed, 13 insertions(+), 16 deletions(-)

diff -r 014c4ef0e124 -r db52c7d043bb xen/arch/powerpc/domain.c
--- a/xen/arch/powerpc/domain.c Sun Dec 17 12:54:30 2006 -0500
+++ b/xen/arch/powerpc/domain.c Tue Dec 19 09:20:58 2006 -0500
@@ -152,17 +152,20 @@ void vcpu_destroy(struct vcpu *v)
 
 int arch_set_info_guest(struct vcpu *v, vcpu_guest_context_t *c)
 { 
+struct domain *d = v->domain;
+
 memcpy(&v->arch.ctxt, &c->user_regs, sizeof(c->user_regs));
 
-printk("Domain[%d].%d: initializing\n",
-   v->domain->domain_id, v->vcpu_id);
-
-if (v->domain->arch.htab.order == 0)
-panic("Page table never allocated for Domain: %d\n",
-  v->domain->domain_id);
-if (v->domain->arch.rma_order == 0)
-panic("RMA never allocated for Domain: %d\n",
-  v->domain->domain_id);
+printk("Domain[%d].%d: initializing\n", d->domain_id, v->vcpu_id);
+
+if (d->arch.htab.order == 0)
+panic("Page table never allocated for Domain: %d\n", d->domain_id);
+if (d->arch.rma_order == 0)
+panic("RMA never allocated for Domain: %d\n", d->domain_id);
+
+d->shared_info->wc_sec = dom0->shared_info->wc_sec;
+d->shared_info->wc_nsec = dom0->shared_info->wc_nsec;
+d->shared_info->arch.boot_timebase = dom0->shared_info->arch.boot_timebase;
 
 set_bit(_VCPUF_initialised, &v->vcpu_flags);
 
diff -r 014c4ef0e124 -r db52c7d043bb xen/arch/powerpc/time.c
--- a/xen/arch/powerpc/time.c   Sun Dec 17 12:54:30 2006 -0500
+++ b/xen/arch/powerpc/time.c   Tue Dec 19 09:20:58 2006 -0500
@@ -85,12 +85,6 @@ void send_timer_event(struct vcpu *v)
 vcpu_unblock(v);
 }
 
-/* Set clock to  after 00:00:00 UTC, 1 January, 1970. */
-void do_settime(unsigned long secs, unsigned long usecs, u64 system_time_base)
-{
-unimplemented();
-}
-
 void update_vcpu_system_time(struct vcpu *v)
 {
 }
diff -r 014c4ef0e124 -r db52c7d043bb xen/include/public/arch-powerpc.h
--- a/xen/include/public/arch-powerpc.h Sun Dec 17 12:54:30 2006 -0500
+++ b/xen/include/public/arch-powerpc.h Tue Dec 19 09:20:58 2006 -0500
@@ -108,7 +108,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_conte
 DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
 
 struct arch_shared_info {
-uint64_t pad[32];
+uint64_t boot_timebase;
 };
 
 struct arch_vcpu_info {

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] use symbol to detect processor version

2006-12-17 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 965d3e42dddaf5971001f7d172d192f925537644
# Parent  6af601c5ebe192a0de72430cdd94da5ba46ff287
[XEN][POWERPC] use symbol to detect processor version

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/powerpc64/ppc970_scom.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff -r 6af601c5ebe1 -r 965d3e42ddda xen/arch/powerpc/powerpc64/ppc970_scom.c
--- a/xen/arch/powerpc/powerpc64/ppc970_scom.c  Fri Dec 15 08:36:03 2006 -0500
+++ b/xen/arch/powerpc/powerpc64/ppc970_scom.c  Sun Dec 17 12:36:31 2006 -0500
@@ -158,7 +158,7 @@ void cpu_scom_init(void)
 {
 #ifdef CONFIG_SCOM
 ulong val;
-if (PVR_REV(mfpvr()) == 0x0300) {
+if (PVR_REV(mfpvr()) == PV_970FX) {
 /* these address are only good for 970FX */
 console_start_sync();
 if (!cpu_scom_read(SCOM_PTSR, &val))
@@ -174,7 +174,7 @@ void cpu_scom_AMCR(void)
 #ifdef CONFIG_SCOM
 ulong val;
 
-if (PVR_REV(mfpvr()) == 0x0300) {
+if (PVR_REV(mfpvr()) == PV_970FX) {
 /* these address are only good for 970FX */
 cpu_scom_read(SCOM_AMC_REG, &val);
 printk("SCOM AMCR: 0x%016lx\n", val);

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] get cpu_*_maps correct so physinfo and affinity is accurate

2006-12-17 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID b04e24db308f2215c6bafaf358d1c10da79f244f
# Parent  965d3e42dddaf5971001f7d172d192f925537644
[XEN][POWERPC] get cpu_*_maps correct so physinfo and affinity is accurate

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/powerpc64/ppc970.c |7 ++-
 xen/arch/powerpc/setup.c|   19 +--
 xen/arch/powerpc/sysctl.c   |   10 +++---
 xen/include/asm-powerpc/processor.h |1 +
 4 files changed, 27 insertions(+), 10 deletions(-)

diff -r 965d3e42ddda -r b04e24db308f xen/arch/powerpc/powerpc64/ppc970.c
--- a/xen/arch/powerpc/powerpc64/ppc970.c   Sun Dec 17 12:36:31 2006 -0500
+++ b/xen/arch/powerpc/powerpc64/ppc970.c   Sun Dec 17 12:40:10 2006 -0500
@@ -129,7 +129,6 @@ unsigned int cpu_extent_order(void)
 return log_large_page_sizes[0] - PAGE_SHIFT;
 }
 
-
 /* This is more a platform thing than a CPU thing, but we only have
  * one platform now */
 int cpu_io_mfn(ulong mfn)
@@ -141,6 +140,12 @@ int cpu_io_mfn(ulong mfn)
 
 return 0;
 }
+
+int cpu_threads(int cpuid)
+{
+return 1;
+}
+
 
 static u64 cpu0_hids[6];
 static u64 cpu0_hior;
diff -r 965d3e42ddda -r b04e24db308f xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Sun Dec 17 12:36:31 2006 -0500
+++ b/xen/arch/powerpc/setup.c  Sun Dec 17 12:40:10 2006 -0500
@@ -179,9 +179,6 @@ static void __init start_of_day(void)
 set_current(idle_domain->vcpu[0]);
 idle_vcpu[0] = current;
 
-/* for some reason we need to set our own bit in the thread map */
-cpu_set(0, cpu_sibling_map[0]);
-
 initialize_keytable();
 /* Register another key that will allow for the the Harware Probe
  * to be contacted, this works with RiscWatch probes and should
@@ -247,6 +244,19 @@ static int kick_secondary_cpus(int maxcp
 int cpuid;
 
 for_each_present_cpu(cpuid) {
+int threads;
+int i;
+
+threads = cpu_threads(cpuid);
+for (i = 0; i < threads; i++)
+cpu_set(i, cpu_sibling_map[cpuid]);
+
+/* For now everything is single core */
+cpu_set(0, cpu_core_map[cpuid]);
+
+numa_set_node(cpuid, 0);
+numa_add_cpu(cpuid);
+
 if (cpuid == 0)
 continue;
 if (cpuid >= maxcpus)
@@ -257,9 +267,6 @@ static int kick_secondary_cpus(int maxcp
 /* wait for it */
 while (!cpu_online(cpuid))
 cpu_relax();
-
-numa_set_node(cpuid, 0);
-numa_add_cpu(cpuid);
 }
 
 return 0;
diff -r 965d3e42ddda -r b04e24db308f xen/arch/powerpc/sysctl.c
--- a/xen/arch/powerpc/sysctl.c Sun Dec 17 12:36:31 2006 -0500
+++ b/xen/arch/powerpc/sysctl.c Sun Dec 17 12:40:10 2006 -0500
@@ -41,9 +41,13 @@ long arch_do_sysctl(struct xen_sysctl *s
 {
 xen_sysctl_physinfo_t *pi = &sysctl->u.physinfo;
 
-pi->threads_per_core = 1;
-pi->cores_per_socket = 1;
-pi->sockets_per_node = 1;
+pi->threads_per_core =
+cpus_weight(cpu_sibling_map[0]);
+pi->cores_per_socket =
+cpus_weight(cpu_core_map[0]) / pi->threads_per_core;
+pi->sockets_per_node = 
+num_online_cpus() / cpus_weight(cpu_core_map[0]);
+
 pi->nr_nodes = 1;
 pi->total_pages  = total_pages;
 pi->free_pages   = avail_domheap_pages();
diff -r 965d3e42ddda -r b04e24db308f xen/include/asm-powerpc/processor.h
--- a/xen/include/asm-powerpc/processor.h   Sun Dec 17 12:36:31 2006 -0500
+++ b/xen/include/asm-powerpc/processor.h   Sun Dec 17 12:40:10 2006 -0500
@@ -125,6 +125,7 @@ extern void cpu_initialize(int cpuid);
 extern void cpu_initialize(int cpuid);
 extern void cpu_init_vcpu(struct vcpu *);
 extern int cpu_io_mfn(ulong mfn);
+extern int cpu_threads(int cpuid);
 extern void save_cpu_sprs(struct vcpu *);
 extern void load_cpu_sprs(struct vcpu *);
 extern void flush_segments(void);

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


[XenPPC] [xenppc-unstable] [XEN] fix xenctl_cpumap translation to handle bitops accessed like arrays

2006-12-17 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 4b07d05c1b4e3492199e118d03f89209caffcad2
# Parent  b04e24db308f2215c6bafaf358d1c10da79f244f
[XEN] fix xenctl_cpumap translation to handle bitops accessed like arrays

Patch submitted upstream:

On PowerPC (and other big endian and/or RISC architectures) bit
offsets in a bitmap are actually represented by a bit-offset from an
element in an array rather than a bit-offset from the base memory
pointer,  see xen/include/asm-powerpc/bitops.h for a complete
explanation.

This complicates the conversion of cpumask_t from/to xenctl_cpumap.

The following patch allows an architecture to declare that bitops are
"by long" rather than "by bit" and use an alternate scheme for
encoding.

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, 43 insertions(+), 4 deletions(-)

diff -r b04e24db308f -r 4b07d05c1b4e xen/common/domctl.c
--- a/xen/common/domctl.c   Sun Dec 17 12:40:10 2006 -0500
+++ b/xen/common/domctl.c   Sun Dec 17 12:53:12 2006 -0500
@@ -30,14 +30,36 @@ void cpumask_to_xenctl_cpumap(
 void cpumask_to_xenctl_cpumap(
 struct xenctl_cpumap *xenctl_cpumap, cpumask_t *cpumask)
 {
-unsigned int guest_bytes, copy_bytes, i;
+unsigned int guest_bytes, copy_bytes, xen_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;
-copy_bytes  = min_t(unsigned int, guest_bytes, (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_to_guest(xenctl_cpumap->bitmap,
   (uint8_t *)cpus_addr(*cpumask),
@@ -50,10 +72,20 @@ void xenctl_cpumap_to_cpumask(
 void xenctl_cpumap_to_cpumask(
 cpumask_t *cpumask, struct xenctl_cpumap *xenctl_cpumap)
 {
-unsigned int guest_bytes, copy_bytes;
+unsigned int guest_bytes, copy_bytes, xen_bytes;
 
 guest_bytes = (xenctl_cpumap->nr_cpus + 7) / 8;
-copy_bytes  = min_t(unsigned int, guest_bytes, (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);
 
 cpus_clear(*cpumask);
 
diff -r b04e24db308f -r 4b07d05c1b4e xen/include/asm-powerpc/bitops.h
--- a/xen/include/asm-powerpc/bitops.h  Sun Dec 17 12:40:10 2006 -0500
+++ b/xen/include/asm-powerpc/bitops.h  Sun Dec 17 12:53:12 2006 -0500
@@ -41,6 +41,9 @@
 #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 b04e24db308f -r 4b07d05c1b4e xen/include/xen/bitops.h
--- a/xen/include/xen/bitops.h  Sun Dec 17 12:40:10 2006 -0500
+++ b/xen/include/xen/bitops.h  Sun Dec 17 12:53:12 2006 -0500
@@ -75,6 +75,10 @@ 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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Normalize timbase_freq to a 64bit value

2006-12-15 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 20bd3b7b7519e01f7b6bfa97c7a655e1dc027f5d
# Parent  887e1cbac6154da0a3a3c2433fbc5b0fc2a1c9b8
[XEN][POWERPC] Normalize timbase_freq to a 64bit value

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/boot_of.c |7 ---
 xen/arch/powerpc/time.c|2 +-
 xen/include/asm-powerpc/time.h |2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff -r 887e1cbac615 -r 20bd3b7b7519 xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.cMon Dec 11 20:50:32 2006 -0500
+++ b/xen/arch/powerpc/boot_of.cFri Dec 15 08:16:56 2006 -0500
@@ -1159,6 +1159,7 @@ static int __init boot_of_cpus(void)
 s32 cpuid;
 u32 cpu_clock[2];
 extern uint cpu_hard_id[NR_CPUS];
+u32 tbf;
 
 /* Look up which CPU we are running on right now and get all info
  * from there */
@@ -1173,12 +1174,12 @@ static int __init boot_of_cpus(void)
 
 cpu_node = bootcpu_node;
 
-result = of_getprop(cpu_node, "timebase-frequency", &timebase_freq,
-sizeof(timebase_freq));
+result = of_getprop(cpu_node, "timebase-frequency", &tbf, sizeof(tbf));
+timebase_freq = tbf;
 if (result == OF_FAILURE) {
 of_panic("Couldn't get timebase frequency!\n");
 }
-of_printf("OF: timebase-frequency = %d Hz\n", timebase_freq);
+of_printf("OF: timebase-frequency = %ld Hz\n", timebase_freq);
 
 result = of_getprop(cpu_node, "clock-frequency",
 &cpu_clock, sizeof(cpu_clock));
diff -r 887e1cbac615 -r 20bd3b7b7519 xen/arch/powerpc/time.c
--- a/xen/arch/powerpc/time.c   Mon Dec 11 20:50:32 2006 -0500
+++ b/xen/arch/powerpc/time.c   Fri Dec 15 08:16:56 2006 -0500
@@ -32,7 +32,7 @@ static int cpu_has_hdec = 1;
 static int cpu_has_hdec = 1;
 ulong ticks_per_usec;
 unsigned long cpu_khz;
-unsigned int timebase_freq;
+s64 timebase_freq;
 
 s_time_t get_s_time(void)
 {
diff -r 887e1cbac615 -r 20bd3b7b7519 xen/include/asm-powerpc/time.h
--- a/xen/include/asm-powerpc/time.hMon Dec 11 20:50:32 2006 -0500
+++ b/xen/include/asm-powerpc/time.hFri Dec 15 08:16:56 2006 -0500
@@ -27,7 +27,7 @@
 #include 
 #include 
 
-extern unsigned int timebase_freq;
+extern s64 timebase_freq;
 #define CLOCK_TICK_RATE timebase_freq
 
 #define watchdog_disable() ((void)0)

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] workaround for context_switch() bug

2006-12-15 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 6af601c5ebe192a0de72430cdd94da5ba46ff287
# Parent  20bd3b7b7519e01f7b6bfa97c7a655e1dc027f5d
[XEN][POWERPC] workaround for context_switch() bug
 We have a bug in that if we switch domains in schedule() we switch
 right away regardless of whatever else is pending.  This means that
 if the timer goes off while in schedule(), the next domain will be
 preempted by the interval defined below.  So until we fix our
 cotnext_switch(), the follow workaround will make sure that the
 domain we switch to does not run for to long so we can continue to
 service the other timers in the timer queue and that the value is
 long enough to escape this particular timer event.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/exceptions.c |   19 +--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff -r 20bd3b7b7519 -r 6af601c5ebe1 xen/arch/powerpc/exceptions.c
--- a/xen/arch/powerpc/exceptions.c Fri Dec 15 08:16:56 2006 -0500
+++ b/xen/arch/powerpc/exceptions.c Fri Dec 15 08:36:03 2006 -0500
@@ -35,7 +35,9 @@ extern ulong ppc_do_softirq(ulong orig_m
 extern ulong ppc_do_softirq(ulong orig_msr);
 extern void do_timer(struct cpu_user_regs *regs);
 extern void do_dec(struct cpu_user_regs *regs);
-extern void program_exception(struct cpu_user_regs *regs, unsigned long 
cookie);
+extern void program_exception(struct cpu_user_regs *regs,
+  unsigned long cookie);
+extern int reprogram_timer(s_time_t timeout); 
 
 int hdec_sample = 0;
 
@@ -43,7 +45,20 @@ void do_timer(struct cpu_user_regs *regs
 {
 /* Set HDEC high so it stops firing and can be reprogrammed by
  * set_preempt() */
-mthdec(INT_MAX);
+/* FIXME! HACK ALERT!
+ *
+ * We have a bug in that if we switch domains in schedule() we
+ * switch right away regardless of whatever else is pending.  This
+ * means that if the timer goes off while in schedule(), the next
+ * domain will be preempted by the interval defined below.  So
+ * until we fix our cotnext_switch(), the follow workaround will
+ * make sure that the domain we switch to does not run for to long
+ * so we can continue to service the other timers in the timer
+ * queue and that the value is long enough to escape this
+ * particular timer event.
+ */
+reprogram_timer(NOW() + MILLISECS(1));
+
 raise_softirq(TIMER_SOFTIRQ);
 }
 

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] boot_of_allocator fixups

2006-12-12 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 887e1cbac6154da0a3a3c2433fbc5b0fc2a1c9b8
# Parent  878ce1f78ad3976f44a657e5386a7f6d619ffac2
[XEN][POWERPC] boot_of_allocator fixups
This patch:
  - print devtree mod size correctly
  - find next_bit rather then test all needed bits to be zero
  - stop pre-allocating memory below image as used

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/boot_of.c |   23 ---
 1 files changed, 4 insertions(+), 19 deletions(-)

diff -r 878ce1f78ad3 -r 887e1cbac615 xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.cMon Dec 11 19:43:18 2006 -0500
+++ b/xen/arch/powerpc/boot_of.cMon Dec 11 20:50:32 2006 -0500
@@ -431,19 +431,8 @@ static void boot_of_alloc_init(int m, ui
 }
 }
 
-/* FW is incorrect in that the space below our image is not safe
- * either */
-start = (ulong)_start >> PAGE_SHIFT;
-pg = 0;
-DBG("%s: marking 0x%x - 0x%lx\n", __func__,
-pg << PAGE_SHIFT, start);
-while (pg < start - 1) {
-set_bit(pg, mem_available_pages);
-++pg;
-}
-
 /* Now make sure we mark our own memory */
-pg = start;
+pg =  (ulong)_start >> PAGE_SHIFT;
 start = (ulong)_end >> PAGE_SHIFT;
 
 DBG("%s: marking 0x%x - 0x%lx\n", __func__,
@@ -521,11 +510,8 @@ static ulong boot_of_alloc(ulong size)
 /* find a set that fits */
 DBG("%s: checking for 0x%lx bits: 0x%lx\n", __func__, bits, pos);
 
-i = 1;
-while (i < bits && !test_bit(pos + i, mem_available_pages))
-++i;
-
-if (i == bits) {
+i = find_next_bit(mem_available_pages, MEM_AVAILABLE_PAGES, pos);  
+if (i - pos >= bits) {
 uint addr = pos << PAGE_SHIFT;
 
 /* make sure OF is happy with our choice */
@@ -1073,7 +1059,7 @@ static void * __init boot_of_devtree(mod
 
 mod->mod_start = (ulong)oft;
 mod->mod_end = mod->mod_start + oft_sz;
-of_printf("%s: devtree mod @ 0x%016x[0x%x]\n", __func__,
+of_printf("%s: devtree mod @ 0x%016x - 0x%016x\n", __func__,
   mod->mod_start, mod->mod_end);
 
 return oft;
@@ -1152,7 +1138,6 @@ static void * __init boot_of_module(ulon
 ++mod;
 
 oft = boot_of_devtree(&mods[mod], mbi);
-of_printf("hello\n");
 if (oft == NULL)
 of_panic("%s: boot_of_devtree failed\n", __func__);
 

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Fix systemsim-gpul failure to boot

2006-12-12 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 878ce1f78ad3976f44a657e5386a7f6d619ffac2
# Parent  7669fca80bfc42aae163b38d4a17cea729c21cf7
[XEN][POWERPC] Fix systemsim-gpul failure to boot

This patch fixes the fencepost error and adds a check for the failure to
initialize the allocator, which would have make Mark's FTB much easier
to debug.

This works for me on the public systemsim-gpul release.
Signed-off-by: Amos Waterland <[EMAIL PROTECTED]>

Also fixes Maple, was just getting luck.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/boot_of.c |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff -r 7669fca80bfc -r 878ce1f78ad3 xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.cMon Dec 04 11:46:53 2006 -0500
+++ b/xen/arch/powerpc/boot_of.cMon Dec 11 19:43:18 2006 -0500
@@ -608,7 +608,7 @@ static ulong boot_of_mem_init(void)
 if (size_cells == 2 && (r < l) )
 size = (size << 32) | reg[r++];
 
-if (r >= l)
+if (r > l)
 break;  /* partial line.  Skip */
 
 boot_of_alloc_init(p, addr_cells, size_cells);
@@ -1290,6 +1290,7 @@ multiboot_info_t __init *boot_of_init(
 {
 static multiboot_info_t mbi;
 void *oft;
+int r;
 
 of_vec = vec;
 of_msr = orig_msr;
@@ -1316,7 +1317,9 @@ multiboot_info_t __init *boot_of_init(
 of_printf("%s: _start %p _end %p 0x%lx\n", __func__, _start, _end, r6);
 
 boot_of_fix_maple();
-boot_of_mem_init();
+r = boot_of_mem_init();
+if (r == 0)
+of_panic("failure to initialize memory allocator");
 boot_of_bootargs(&mbi);
 oft = boot_of_module(r3, r4, &mbi);
 boot_of_cpus();

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Allow DPM but not NAP in powersave

2006-12-04 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 7669fca80bfc42aae163b38d4a17cea729c21cf7
# Parent  0e85b389980ad1a4d135773d807825d91a94ae9c
[XEN][POWERPC] Allow DPM but not NAP in powersave

Thanks to Segher Boessenkool <[EMAIL PROTECTED]> for clarifying.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
Acked-by: Amos Waterland <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/powerpc64/ppc970.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff -r 0e85b389980a -r 7669fca80bfc xen/arch/powerpc/powerpc64/ppc970.c
--- a/xen/arch/powerpc/powerpc64/ppc970.c   Fri Dec 01 19:11:02 2006 -0500
+++ b/xen/arch/powerpc/powerpc64/ppc970.c   Mon Dec 04 11:46:53 2006 -0500
@@ -193,10 +193,10 @@ void cpu_initialize(int cpuid)
 mtdec(timebase_freq);
 mthdec(timebase_freq);
 
-/* FIXME Do not set the NAP and DPM bits in HID0 until we have had a
- * chance to audit the safe halt and idle loop code. */
+/* FIXME Do not set the NAP bit in HID0 until we have had a chance
+ * to audit the safe halt and idle loop code. */
 hid0.bits.nap = 0;  /* NAP */
-hid0.bits.dpm = 0;  /* Dynamic Power Management */
+hid0.bits.dpm = 1;  /* Dynamic Power Management */
 
 hid0.bits.nhr = 1;  /* Not Hard Reset */
 hid0.bits.hdice_en = 1; /* enable HDEC */

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] should comment the Power Managment workaround in the code as well

2006-12-02 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 0e85b389980ad1a4d135773d807825d91a94ae9c
# Parent  4f4b8cbcf3bf22ce2d0ff2b2e6589a054a1840fa
[XEN][POWERPC] should comment the Power Managment workaround in the code as well

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/powerpc64/ppc970.c |3 +++
 1 files changed, 3 insertions(+)

diff -r 4f4b8cbcf3bf -r 0e85b389980a xen/arch/powerpc/powerpc64/ppc970.c
--- a/xen/arch/powerpc/powerpc64/ppc970.c   Fri Dec 01 16:55:19 2006 -0500
+++ b/xen/arch/powerpc/powerpc64/ppc970.c   Fri Dec 01 19:11:02 2006 -0500
@@ -193,8 +193,11 @@ void cpu_initialize(int cpuid)
 mtdec(timebase_freq);
 mthdec(timebase_freq);
 
+/* FIXME Do not set the NAP and DPM bits in HID0 until we have had a
+ * chance to audit the safe halt and idle loop code. */
 hid0.bits.nap = 0;  /* NAP */
 hid0.bits.dpm = 0;  /* Dynamic Power Management */
+
 hid0.bits.nhr = 1;  /* Not Hard Reset */
 hid0.bits.hdice_en = 1; /* enable HDEC */
 hid0.bits.en_therm = 0; /* ! Enable ext thermal ints */

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Disable DPM until code is audited

2006-12-01 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 4f4b8cbcf3bf22ce2d0ff2b2e6589a054a1840fa
# Parent  927f25df51542261c05c31dad5505f6c16315af4
[XEN][POWERPC] Disable DPM until code is audited

Do not set the NAP and DPM bits in HID0 until we have had a chance to
audit the safe halt and idle loop code.  Not setting these bits allows
the model 884241X JS20 blade in TRL to boot correctly, and possibly also
the Maple in YKT.  Thanks to Jimi for his help in this matter.

Signed-off-by: Amos Waterland <[EMAIL PROTECTED]>

Ack on the Maple. SMP is now "completely" stable on it.
Way to go Amos.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/powerpc64/ppc970.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff -r 927f25df5154 -r 4f4b8cbcf3bf xen/arch/powerpc/powerpc64/ppc970.c
--- a/xen/arch/powerpc/powerpc64/ppc970.c   Thu Nov 30 16:21:22 2006 -0500
+++ b/xen/arch/powerpc/powerpc64/ppc970.c   Fri Dec 01 16:55:19 2006 -0500
@@ -193,8 +193,8 @@ void cpu_initialize(int cpuid)
 mtdec(timebase_freq);
 mthdec(timebase_freq);
 
-hid0.bits.nap = 1;  /* NAP */
-hid0.bits.dpm = 1;  /* Dynamic Power Management */
+hid0.bits.nap = 0;  /* NAP */
+hid0.bits.dpm = 0;  /* Dynamic Power Management */
 hid0.bits.nhr = 1;  /* Not Hard Reset */
 hid0.bits.hdice_en = 1; /* enable HDEC */
 hid0.bits.en_therm = 0; /* ! Enable ext thermal ints */

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] forgot spinlock initialzer for recursive locks

2006-12-01 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 927f25df51542261c05c31dad5505f6c16315af4
# Parent  bb5491a55606b88c86f380aae406f7077c3118bc
[XEN][POWERPC] forgot spinlock initialzer for recursive locks

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/include/asm-powerpc/spinlock.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff -r bb5491a55606 -r 927f25df5154 xen/include/asm-powerpc/spinlock.h
--- a/xen/include/asm-powerpc/spinlock.hTue Nov 28 19:01:46 2006 -0500
+++ b/xen/include/asm-powerpc/spinlock.hThu Nov 30 16:21:22 2006 -0500
@@ -72,13 +72,13 @@ cas_u32(volatile u32 *ptr, u32 oval, u32
 
 typedef struct {
 volatile u32 lock;
-u16 recurse_cpu;
+s16 recurse_cpu;
 u16 recurse_cnt;
 } spinlock_t;
 
 #define __UNLOCKED (0U)
 #define __LOCKED (~__UNLOCKED)
-#define SPIN_LOCK_UNLOCKED /*(spinlock_t)*/ { __UNLOCKED }
+#define SPIN_LOCK_UNLOCKED /*(spinlock_t)*/ { __UNLOCKED, -1, 0 }
 static inline void spin_lock_init(spinlock_t *lock)
 {
 *lock = (spinlock_t) SPIN_LOCK_UNLOCKED;

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] cleanup hard tabs

2006-11-28 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID bb5491a55606b88c86f380aae406f7077c3118bc
# Parent  2e909d6f2ab767fe5723a97e2f5413f876167296
[XEN][POWERPC] cleanup hard tabs
allowed in some files in order to track linux lineage
---
 xen/arch/powerpc/bitops.c |  124 +-
 xen/arch/powerpc/external.c   |2 
 xen/arch/powerpc/memory.c |   12 +--
 xen/arch/powerpc/of-devtree.h |   34 -
 xen/arch/powerpc/of_handler/console.c |   12 +--
 xen/arch/powerpc/papr/xlate.c |2 
 xen/arch/powerpc/rtas.c   |   14 +--
 xen/arch/powerpc/shadow.c |4 -
 xen/arch/powerpc/smp.c|   10 +-
 xen/arch/powerpc/smpboot.c|3 
 10 files changed, 108 insertions(+), 109 deletions(-)

diff -r 2e909d6f2ab7 -r bb5491a55606 xen/arch/powerpc/bitops.c
--- a/xen/arch/powerpc/bitops.c Tue Nov 28 18:46:13 2006 -0500
+++ b/xen/arch/powerpc/bitops.c Tue Nov 28 19:01:46 2006 -0500
@@ -12,42 +12,42 @@
  * @size: The maximum size to search
  */
 unsigned long find_next_bit(const unsigned long *addr, unsigned long size,
-   unsigned long offset)
+unsigned long offset)
 {
-   const unsigned long *p = addr + BITOP_WORD(offset);
-   unsigned long result = offset & ~(BITS_PER_LONG-1);
-   unsigned long tmp;
+const unsigned long *p = addr + BITOP_WORD(offset);
+unsigned long result = offset & ~(BITS_PER_LONG-1);
+unsigned long tmp;
 
-   if (offset >= size)
-   return size;
-   size -= result;
-   offset %= BITS_PER_LONG;
-   if (offset) {
-   tmp = *(p++);
-   tmp &= (~0UL << offset);
-   if (size < BITS_PER_LONG)
-   goto found_first;
-   if (tmp)
-   goto found_middle;
-   size -= BITS_PER_LONG;
-   result += BITS_PER_LONG;
-   }
-   while (size & ~(BITS_PER_LONG-1)) {
-   if ((tmp = *(p++)))
-   goto found_middle;
-   result += BITS_PER_LONG;
-   size -= BITS_PER_LONG;
-   }
-   if (!size)
-   return result;
-   tmp = *p;
+if (offset >= size)
+return size;
+size -= result;
+offset %= BITS_PER_LONG;
+if (offset) {
+tmp = *(p++);
+tmp &= (~0UL << offset);
+if (size < BITS_PER_LONG)
+goto found_first;
+if (tmp)
+goto found_middle;
+size -= BITS_PER_LONG;
+result += BITS_PER_LONG;
+}
+while (size & ~(BITS_PER_LONG-1)) {
+if ((tmp = *(p++)))
+goto found_middle;
+result += BITS_PER_LONG;
+size -= BITS_PER_LONG;
+}
+if (!size)
+return result;
+tmp = *p;
 
 found_first:
-   tmp &= (~0UL >> (BITS_PER_LONG - size));
-   if (tmp == 0UL) /* Are any bits set? */
-   return result + size;   /* Nope. */
+tmp &= (~0UL >> (BITS_PER_LONG - size));
+if (tmp == 0UL)/* Are any bits set? */
+return result + size;/* Nope. */
 found_middle:
-   return result + __ffs(tmp);
+return result + __ffs(tmp);
 }
 
 /*
@@ -55,40 +55,40 @@ found_middle:
  * Linus' asm-alpha/bitops.h.
  */
 unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
-unsigned long offset)
+ unsigned long offset)
 {
-   const unsigned long *p = addr + BITOP_WORD(offset);
-   unsigned long result = offset & ~(BITS_PER_LONG-1);
-   unsigned long tmp;
+const unsigned long *p = addr + BITOP_WORD(offset);
+unsigned long result = offset & ~(BITS_PER_LONG-1);
+unsigned long tmp;
 
-   if (offset >= size)
-   return size;
-   size -= result;
-   offset %= BITS_PER_LONG;
-   if (offset) {
-   tmp = *(p++);
-   tmp |= ~0UL >> (BITS_PER_LONG - offset);
-   if (size < BITS_PER_LONG)
-   goto found_first;
-   if (~tmp)
-   goto found_middle;
-   size -= BITS_PER_LONG;
-   result += BITS_PER_LONG;
-   }
-   while (size & ~(BITS_PER_LONG-1)) {
-   if (~(tmp = *(p++)))
-   goto found_middle;
-   result += BITS_PER_LONG;
-   size -= BITS_PER_LONG;
-   }
-   if (!size)
-   return result;
-   tmp = *p;
+if (offset >= size)
+return size;
+size -= result;
+offset %= BITS_PER_LONG;
+if (offset) {
+tmp = *(p++);
+tmp |= ~0UL >> (BITS_PER_LONG - offset);
+if (size < BITS_PER_LONG)
+goto found_first;
+if (~tmp)
+goto found_middle;
+size -= BITS_PER_LONG;
+result += BITS_PER_LONG;
+}
+while (size & ~(BITS_PER_LO

[XenPPC] [xenppc-unstable] [XEN][POWERPC] Fix IPI stall timeout without using timebase_freq

2006-11-28 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 2e909d6f2ab767fe5723a97e2f5413f876167296
# Parent  e01e08ca629b4f154828b0976a58df8767558aec
[XEN][POWERPC] Fix IPI stall timeout without using timebase_freq

When using the register dump feature of Xen, one will sometimes see a
message about an IPI finish stall.  This is because of an int to long
comparison bug, so fix it by doing proper nanosecond based time
accounting with no explicit reference to timebase_freq.

Signed-off-by: Amos Waterland <[EMAIL PROTECTED]>
Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/smp.c |   39 +--
 1 files changed, 25 insertions(+), 14 deletions(-)

diff -r e01e08ca629b -r 2e909d6f2ab7 xen/arch/powerpc/smp.c
--- a/xen/arch/powerpc/smp.cTue Nov 28 17:01:00 2006 -0500
+++ b/xen/arch/powerpc/smp.cTue Nov 28 18:46:13 2006 -0500
@@ -90,7 +90,8 @@ int on_selected_cpus(
 int retry,
 int wait)
 {
-int t, retval = 0, nr_cpus = cpus_weight(selected);
+int retval = 0, nr_cpus = cpus_weight(selected);
+unsigned long start, stall = SECONDS(1);
 
 spin_lock(&call_lock);
 
@@ -104,19 +105,21 @@ int on_selected_cpus(
 send_IPI_mask(selected, CALL_FUNCTION_VECTOR);
 
 /* We always wait for an initiation ACK from remote CPU.  */
-for (t = 0; atomic_read(&call_data.started) != nr_cpus; t++) {
-if (t && t % timebase_freq == 0) {
+for (start = NOW(); atomic_read(&call_data.started) != nr_cpus; ) {
+if (NOW() > start + stall) {
 printk("IPI start stall: %d ACKS to %d SYNS\n", 
atomic_read(&call_data.started), nr_cpus);
+   start = NOW();
 }
 }
 
 /* If told to, we wait for a completion ACK from remote CPU.  */
 if (wait) {
-for (t = 0; atomic_read(&call_data.finished) != nr_cpus; t++) {
-if (t > timebase_freq && t % timebase_freq == 0) {
+for (start = NOW(); atomic_read(&call_data.finished) != nr_cpus; ) {
+if (NOW() > start + stall) {
 printk("IPI finish stall: %d ACKS to %d SYNS\n", 
atomic_read(&call_data.finished), nr_cpus);
+start = NOW();
 }
 }
 }
@@ -168,6 +171,11 @@ void smp_message_recv(int msg, struct cp
 #ifdef DEBUG_IPI
 static void debug_ipi_ack(void *info)
 {
+if (info) {
+   unsigned long start, stall = SECONDS(5);
+   for (start = NOW(); NOW() < start + stall; );
+   printk("IPI recv on cpu #%d: %s\n", smp_processor_id(), (char *)info);
+}
 return;
 }
 
@@ -175,12 +183,12 @@ void ipi_torture_test(void)
 {
 int cpu;
 unsigned long before, after, delta;
-unsigned long min = ~0, max = 0, mean = 0, sum = 0, tick = 0;
+unsigned long min = ~0, max = 0, mean = 0, sum = 0, trials = 0;
 cpumask_t mask;
 
 cpus_clear(mask);
 
-while (tick < 100) {
+while (trials < 100) {
 for_each_online_cpu(cpu) {
 cpu_set(cpu, mask);
 before = mftb();
@@ -192,12 +200,15 @@ void ipi_torture_test(void)
 if (delta > max) max = delta;
 if (delta < min) min = delta;
 sum += delta;
-tick++;
-}
-}
-
-mean = sum / tick;
-
-printk("IPI tb ticks: min = %ld max = %ld mean = %ld\n", min, max, mean);
+trials++;
+}
+}
+
+mean = tb_to_ns(sum / trials);
+
+printk("IPI latency: min = %ld ticks, max = %ld ticks, mean = %ldns\n",
+  min, max, mean);
+
+smp_call_function(debug_ipi_ack, "Hi", 0, 1);
 }
 #endif

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Do not override smp function call wait flag

2006-11-28 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID e01e08ca629b4f154828b0976a58df8767558aec
# Parent  1e1a63408129bea2d87f485c52f1be21ada35ff0
[XEN][POWERPC] Do not override smp function call wait flag
Do not override the caller's wishes regarding waiting for smp function
call completion.  I was being too conservative in this respect: the lock
protects the call_data structure, and the function called is expected to
be threadsafe.

Signed-off-by: Amos Waterland <[EMAIL PROTECTED]>
Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/smp.c |1 -
 1 files changed, 1 deletion(-)

diff -r 1e1a63408129 -r e01e08ca629b xen/arch/powerpc/smp.c
--- a/xen/arch/powerpc/smp.cTue Nov 28 16:56:40 2006 -0500
+++ b/xen/arch/powerpc/smp.cTue Nov 28 17:01:00 2006 -0500
@@ -97,7 +97,6 @@ int on_selected_cpus(
 call_data.func = func;
 call_data.info = info;
 call_data.wait = wait;
-call_data.wait = 1;  /* Until we get RCU around call_data.  */
 atomic_set(&call_data.started, 0);
 atomic_set(&call_data.finished, 0);
 mb();

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Generalized parallel IPI handlers

2006-11-28 Thread Jimi Xenidis


# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 1e1a63408129bea2d87f485c52f1be21ada35ff0
# Parent  a2a4a6bdc5cdedf3fe90626de9b16c9ee898f178
[XEN][POWERPC] Generalized parallel IPI handlers

Our problem with x86 do_IRQ is that it does not respect IRQ_PER_CPU, so
make our logic reflect that generically.  We remove the spin lock in
this case, since the programming convention is to update irq descs
atomically (if at all).  This patch allows read_clocks to work properly.

Signed-off-by: Amos Waterland <[EMAIL PROTECTED]>
Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/external.c   |6 ++
 xen/arch/powerpc/mpic_init.c  |6 --
 xen/include/asm-powerpc/smp.h |1 -
 3 files changed, 2 insertions(+), 11 deletions(-)

diff -r a2a4a6bdc5cd -r 1e1a63408129 xen/arch/powerpc/external.c
--- a/xen/arch/powerpc/external.c   Tue Nov 28 16:43:53 2006 -0500
+++ b/xen/arch/powerpc/external.c   Tue Nov 28 16:56:40 2006 -0500
@@ -82,15 +82,13 @@ void do_external(struct cpu_user_regs *r

 vec = xen_mpic_get_irq(regs);

-if (vector_is_ipi(vec)) {
-/* do_IRQ is fundamentally broken for reliable IPI  
delivery.  */

+if (irq_desc[vec].status & IRQ_PER_CPU) {
+   /* x86 do_IRQ does not respect the per cpu flag.  */
 irq_desc_t *desc = &irq_desc[vec];
 regs->entry_vector = vec;
-spin_lock(&desc->lock);
 desc->handler->ack(vec);
 desc->action->handler(vector_to_irq(vec), desc->action- 
>dev_id, regs);

 desc->handler->end(vec);
-spin_unlock(&desc->lock);
 } else if (vec != -1) {
 DBG("EE:0x%lx isrc: %d\n", regs->msr, vec);
 regs->entry_vector = vec;
diff -r a2a4a6bdc5cd -r 1e1a63408129 xen/arch/powerpc/mpic_init.c
--- a/xen/arch/powerpc/mpic_init.c  Tue Nov 28 16:43:53 2006 -0500
+++ b/xen/arch/powerpc/mpic_init.c  Tue Nov 28 16:56:40 2006 -0500
@@ -448,9 +448,3 @@ int xen_mpic_get_irq(struct cpu_user_reg

return mpic_get_one_irq(mpic, regs);
 }
-
-int vector_is_ipi(int vector)
-{
-BUG_ON(!mpic);
-return (mpic->ipi_offset <= vector) && (vector < mpic- 
>ipi_offset + 4);

-}
diff -r a2a4a6bdc5cd -r 1e1a63408129 xen/include/asm-powerpc/smp.h
--- a/xen/include/asm-powerpc/smp.h Tue Nov 28 16:43:53 2006 -0500
+++ b/xen/include/asm-powerpc/smp.h Tue Nov 28 16:56:40 2006 -0500
@@ -51,7 +51,6 @@ void smp_call_function_interrupt(struct
 void smp_call_function_interrupt(struct cpu_user_regs *regs);
 void smp_event_check_interrupt(void);
 void send_IPI_mask(cpumask_t mask, int vector);
-int vector_is_ipi(int vector);

 #undef DEBUG_IPI
 #ifdef DEBUG_IPI



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


Re: [XenPPC] [xenppc-unstable] [XEN][POWERPC] SMP/IPI/MB combined

2006-11-28 Thread Amos Waterland
On Tue, Nov 28, 2006 at 10:47:31AM -0500, Jimi Xenidis wrote:
> On Nov 28, 2006, at 1:37 AM, Amos Waterland wrote:
> > The compiler is not told that read_clocks_cpumask is volatile, so it
> > is free to turn that loop into an infinite loop, as my gcc 4.1.1
> > cross-compiler does.  I am surprised that other Xen architectures
> > have not seen the same problem.
> 
> Found it, cpu_relax() is supposed to contain barrier() call.
> My fault but it coulda been hollis :)

Excellent, thanks.

> you _always_ have to wait for call_data.started it means that its
> safe to reuse call_data.

Yes, I know :)  I only did that as a crude approximation, the proper
solution (pending your design comments), is not serializing do_external
with a lock (see the next patch I sent).


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


Re: [XenPPC] [xenppc-unstable] [XEN][POWERPC] SMP/IPI/MB combined

2006-11-28 Thread Jimi Xenidis


On Nov 28, 2006, at 1:37 AM, Amos Waterland wrote:


This will have to be reworked and broken up into individual parts for
submission, but here is what is necessary to make 'C-a C-a C-a t' work
properly.

Jimi, when you disassemble xen-syms compiled without this patch, do  
you

see a bogus infinite loop in read_clocks?

looked briefly but did not notice it.


  The compiler is not told that
read_clocks_cpumask is volatile, so it is free to turn that loop  
into an
infinite loop, as my gcc 4.1.1 cross-compiler does.  I am surprised  
that

other Xen architectures have not seen the same problem.


Found it, cpu_relax() is supposed to contain barrier() call.
My fault but it coulda been hollis :)

diff -r cc45282daf3d xen/include/asm-powerpc/processor.h
--- a/xen/include/asm-powerpc/processor.h   Mon Nov 27 17:17:07 2006 -0500
+++ b/xen/include/asm-powerpc/processor.h   Tue Nov 28 10:19:09 2006 -0500
@@ -152,7 +152,7 @@ static inline void nop(void) {
static inline void nop(void) {
 __asm__ __volatile__ ("nop");
}
-#define cpu_relax() nop()
+#define cpu_relax() barrier()
static inline unsigned int mfpir(void)
{

this will solve the volatile issue and am pushing this now.

more below..





 arch/powerpc/smp.c|   18 ++
 common/keyhandler.c   |2 +-
 include/xen/cpumask.h |2 +-
 3 files changed, 12 insertions(+), 10 deletions(-)

diff -r 305751a5281e xen/arch/powerpc/smp.c
--- a/xen/arch/powerpc/smp.cWed Nov 22 16:29:25 2006 -0500
+++ b/xen/arch/powerpc/smp.cTue Nov 28 00:45:24 2006 -0500
@@ -91,31 +91,33 @@ int on_selected_cpus(
 int wait)
 {
 int t, retval = 0, nr_cpus = cpus_weight(selected);
+int stall = timebase_freq * 10;

 spin_lock(&call_lock);

 call_data.func = func;
 call_data.info = info;
 call_data.wait = wait;
-call_data.wait = 1;  /* Until we get RCU around call_data.  */
 atomic_set(&call_data.started, 0);
 atomic_set(&call_data.finished, 0);
 mb();

 send_IPI_mask(selected, CALL_FUNCTION_VECTOR);

-/* We always wait for an initiation ACK from remote CPU.  */
-for (t = 0; atomic_read(&call_data.started) != nr_cpus; t++) {
-if (t && t % timebase_freq == 0) {
-printk("IPI start stall: %d ACKS to %d SYNS\n",
-   atomic_read(&call_data.started), nr_cpus);
-}
+/* If told to, we wait for an initiation ACK from remote CPU.  */
+if (wait) {
+   for (t = 0; atomic_read(&call_data.started) != nr_cpus; t++) {
+   if (t > 0 && t % stall == 0) {
+   printk("IPI start stall: %d ACKS to %d SYNS\n",
+  atomic_read(&call_data.started), nr_cpus);
+   }
+   }


you _always_ have to wait for call_data.started it means that its  
safe to reuse call_data.



 }

 /* If told to, we wait for a completion ACK from remote CPU.  */
 if (wait) {
 for (t = 0; atomic_read(&call_data.finished) != nr_cpus; t+ 
+) {

-if (t > timebase_freq && t % timebase_freq == 0) {
+if (t > 0 && t % stall == 0) {
 printk("IPI finish stall: %d ACKS to %d SYNS\n",
atomic_read(&call_data.finished), nr_cpus);
 }
diff -r 305751a5281e xen/common/keyhandler.c
--- a/xen/common/keyhandler.c   Wed Nov 22 16:29:25 2006 -0500
+++ b/xen/common/keyhandler.c   Tue Nov 28 00:12:14 2006 -0500
@@ -193,7 +193,7 @@ static void dump_domains(unsigned char k
 read_unlock(&domlist_lock);
 }



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


Re: [XenPPC] [xenppc-unstable] [XEN][POWERPC] SMP/IPI/MB combined

2006-11-27 Thread Amos Waterland
This will have to be reworked and broken up into individual parts for
submission, but here is what is necessary to make 'C-a C-a C-a t' work
properly.

Jimi, when you disassemble xen-syms compiled without this patch, do you
see a bogus infinite loop in read_clocks?  The compiler is not told that
read_clocks_cpumask is volatile, so it is free to turn that loop into an
infinite loop, as my gcc 4.1.1 cross-compiler does.  I am surprised that
other Xen architectures have not seen the same problem.

 arch/powerpc/smp.c|   18 ++
 common/keyhandler.c   |2 +-
 include/xen/cpumask.h |2 +-
 3 files changed, 12 insertions(+), 10 deletions(-)

diff -r 305751a5281e xen/arch/powerpc/smp.c
--- a/xen/arch/powerpc/smp.cWed Nov 22 16:29:25 2006 -0500
+++ b/xen/arch/powerpc/smp.cTue Nov 28 00:45:24 2006 -0500
@@ -91,31 +91,33 @@ int on_selected_cpus(
 int wait)
 {
 int t, retval = 0, nr_cpus = cpus_weight(selected);
+int stall = timebase_freq * 10;
 
 spin_lock(&call_lock);
 
 call_data.func = func;
 call_data.info = info;
 call_data.wait = wait;
-call_data.wait = 1;  /* Until we get RCU around call_data.  */
 atomic_set(&call_data.started, 0);
 atomic_set(&call_data.finished, 0);
 mb();
 
 send_IPI_mask(selected, CALL_FUNCTION_VECTOR);
 
-/* We always wait for an initiation ACK from remote CPU.  */
-for (t = 0; atomic_read(&call_data.started) != nr_cpus; t++) {
-if (t && t % timebase_freq == 0) {
-printk("IPI start stall: %d ACKS to %d SYNS\n", 
-   atomic_read(&call_data.started), nr_cpus);
-}
+/* If told to, we wait for an initiation ACK from remote CPU.  */
+if (wait) {
+   for (t = 0; atomic_read(&call_data.started) != nr_cpus; t++) {
+   if (t > 0 && t % stall == 0) {
+   printk("IPI start stall: %d ACKS to %d SYNS\n", 
+  atomic_read(&call_data.started), nr_cpus);
+   }
+   }
 }
 
 /* If told to, we wait for a completion ACK from remote CPU.  */
 if (wait) {
 for (t = 0; atomic_read(&call_data.finished) != nr_cpus; t++) {
-if (t > timebase_freq && t % timebase_freq == 0) {
+if (t > 0 && t % stall == 0) {
 printk("IPI finish stall: %d ACKS to %d SYNS\n", 
atomic_read(&call_data.finished), nr_cpus);
 }
diff -r 305751a5281e xen/common/keyhandler.c
--- a/xen/common/keyhandler.c   Wed Nov 22 16:29:25 2006 -0500
+++ b/xen/common/keyhandler.c   Tue Nov 28 00:12:14 2006 -0500
@@ -193,7 +193,7 @@ static void dump_domains(unsigned char k
 read_unlock(&domlist_lock);
 }
 
-static cpumask_t read_clocks_cpumask = CPU_MASK_NONE;
+static cpumask_t volatile read_clocks_cpumask = CPU_MASK_NONE;
 static s_time_t read_clocks_time[NR_CPUS];
 
 static void read_clocks_slave(void *unused)
diff -r 305751a5281e xen/include/xen/cpumask.h
--- a/xen/include/xen/cpumask.h Wed Nov 22 16:29:25 2006 -0500
+++ b/xen/include/xen/cpumask.h Tue Nov 28 00:12:42 2006 -0500
@@ -177,7 +177,7 @@ static inline int __cpus_subset(const cp
 }
 
 #define cpus_empty(src) __cpus_empty(&(src), NR_CPUS)
-static inline int __cpus_empty(const cpumask_t *srcp, int nbits)
+static inline int __cpus_empty(const cpumask_t volatile *srcp, int nbits)
 {
return bitmap_empty(srcp->bits, nbits);
 }

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] OFD dump prefix screen and hook into keyhandler

2006-11-27 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID cc45282daf3d242fdcf6e858c0b18b7f1086a318
# Parent  02aaaf00a9229b6564e860618f329bd2f9303a1e
[XEN][POWERPC] OFD dump prefix screen and hook into keyhandler

This patch adds the ability to view the devtree from the Xen console.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/boot_of.c|2 +-
 xen/arch/powerpc/of-devtree.h |6 +++---
 xen/arch/powerpc/of-devwalk.c |   14 +++---
 xen/arch/powerpc/ofd_fixup.c  |2 +-
 xen/arch/powerpc/setup.c  |   19 ++-
 5 files changed, 26 insertions(+), 17 deletions(-)

diff -r 02aaaf00a922 -r cc45282daf3d xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.cMon Nov 27 16:14:07 2006 -0500
+++ b/xen/arch/powerpc/boot_of.cMon Nov 27 17:17:07 2006 -0500
@@ -1069,7 +1069,7 @@ static void * __init boot_of_devtree(mod
 if (ofd_size(oft) > oft_sz)
  of_panic("Could not fit all devtree fixups\n");
 
-ofd_walk(oft, OFD_ROOT, /* add_hype_props */ NULL, 2);
+ofd_walk(oft, __func__, OFD_ROOT, /* add_hype_props */ NULL, 2);
 
 mod->mod_start = (ulong)oft;
 mod->mod_end = mod->mod_start + oft_sz;
diff -r 02aaaf00a922 -r cc45282daf3d xen/arch/powerpc/of-devtree.h
--- a/xen/arch/powerpc/of-devtree.h Mon Nov 27 16:14:07 2006 -0500
+++ b/xen/arch/powerpc/of-devtree.h Mon Nov 27 17:17:07 2006 -0500
@@ -115,10 +115,10 @@ extern void ofd_io_close(void *mem, ofdn
 extern void ofd_io_close(void *mem, ofdn_t n);
 
 
-typedef void (*walk_fn)(void *m, ofdn_t p, int arg);
-extern void ofd_dump_props(void *m, ofdn_t p, int dump);
+typedef void (*walk_fn)(void *m, const char *pre, ofdn_t p, int arg);
+extern void ofd_dump_props(void *m, const char *pre, ofdn_t p, int dump);
 
-extern void ofd_walk(void *m, ofdn_t p, walk_fn fn, int arg);
+extern void ofd_walk(void *m, const char *pre, ofdn_t p, walk_fn fn, int arg);
 
 
 /* Recursively look up #address_cells and #size_cells properties */
diff -r 02aaaf00a922 -r cc45282daf3d xen/arch/powerpc/of-devwalk.c
--- a/xen/arch/powerpc/of-devwalk.c Mon Nov 27 16:14:07 2006 -0500
+++ b/xen/arch/powerpc/of-devwalk.c Mon Nov 27 17:17:07 2006 -0500
@@ -80,7 +80,7 @@ void ofd_prop_print(
 #endif
 }
 
-void ofd_dump_props(void *mem, ofdn_t n, int dump)
+void ofd_dump_props(void *mem, const char *pre, ofdn_t n, int dump)
 {
 ofdn_t p;
 char name[128];
@@ -95,7 +95,7 @@ void ofd_dump_props(void *mem, ofdn_t n,
 }
 
 if (dump & OFD_DUMP_NAMES) {
-printk("of_walk: %s: phandle 0x%x\n", path, n);
+printk("%s: %s: phandle 0x%x\n", pre, path, n);
 }
 
 p = ofd_nextprop(mem, n, NULL, name);
@@ -106,30 +106,30 @@ void ofd_dump_props(void *mem, ofdn_t n,
 }
 
 if ( dump & OFD_DUMP_VALUES ) {
-ofd_prop_print("of_walk", path, name, prop, sz);
+ofd_prop_print(pre, path, name, prop, sz);
 }
 
 p = ofd_nextprop(mem, n, name, name);
 }
 }
 
-void ofd_walk(void *m, ofdn_t p, walk_fn fn, int arg)
+void ofd_walk(void *m, const char *pre, ofdn_t p, walk_fn fn, int arg)
 {
 ofdn_t n;
 
 if ( fn != NULL ) {
-(*fn)(m, p, arg);
+(*fn)(m, pre, p, arg);
 }
 
 /* child */
 n = ofd_node_child(m, p);
 if ( n != 0 ) {
-ofd_walk(m, n, fn, arg);
+ofd_walk(m, pre, n, fn, arg);
 }
 
 /* peer */
 n = ofd_node_peer(m, p);
 if ( n != 0 ) {
-ofd_walk(m, n, fn, arg);
+ofd_walk(m, pre, n, fn, arg);
 }
 }
diff -r 02aaaf00a922 -r cc45282daf3d xen/arch/powerpc/ofd_fixup.c
--- a/xen/arch/powerpc/ofd_fixup.c  Mon Nov 27 16:14:07 2006 -0500
+++ b/xen/arch/powerpc/ofd_fixup.c  Mon Nov 27 17:17:07 2006 -0500
@@ -427,7 +427,7 @@ int ofd_dom0_fixup(struct domain *d, ulo
 
 
 #ifdef DEBUG
-ofd_walk(m, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL);
+ofd_walk(m, __func__, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL);
 #endif
 return 1;
 }
diff -r 02aaaf00a922 -r cc45282daf3d xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Mon Nov 27 16:14:07 2006 -0500
+++ b/xen/arch/powerpc/setup.c  Mon Nov 27 17:17:07 2006 -0500
@@ -123,9 +123,17 @@ void noinline __attn(void)
 console_end_sync();
 }
 
-static void hw_probe_attn(unsigned char key, struct cpu_user_regs *regs)
+static void key_hw_probe_attn(unsigned char key)
 {
 __attn();
+}
+
+static void key_ofdump(unsigned char key)
+{
+printk("ofdump:\n");
+/* make sure the OF devtree is good */
+ofd_walk((void *)oftree, "devtree", OFD_ROOT,
+ ofd_dump_props, OFD_DUMP_ALL);
 }
 
 static void percpu_init_areas(void)
@@ -178,7 +186,10 @@ static void __init start_of_day(void)
 /* Register another key that will allow for the the Harware Probe
  * to be contacted, this works with RiscWatch probes and should
  * work with Chronos and FSPs */
-register_irq_keyhandler('^', hw_probe_attn,   "Trap to Hardware Probe");
+register_keyhandler('^

[XenPPC] [xenppc-unstable] [XEN][POWERPC] fix some hard tabs that snuck by

2006-11-22 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 305751a5281e12537a6485d74ac9f53a73ee8816
# Parent  177007615848aa444b0ccb4f5846ba74e67ac003
[XEN][POWERPC] fix some hard tabs that snuck by

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/external.c  |   22 
 xen/arch/powerpc/mpic.c  |  118 +--
 xen/arch/powerpc/mpic_init.c |   24 
 xen/arch/powerpc/setup.c |   12 ++--
 xen/arch/powerpc/smp.c   |   81 ++---
 5 files changed, 129 insertions(+), 128 deletions(-)

diff -r 177007615848 -r 305751a5281e xen/arch/powerpc/external.c
--- a/xen/arch/powerpc/external.c   Wed Nov 22 16:09:28 2006 -0500
+++ b/xen/arch/powerpc/external.c   Wed Nov 22 16:29:25 2006 -0500
@@ -83,14 +83,14 @@ void do_external(struct cpu_user_regs *r
 vec = xen_mpic_get_irq(regs);
 
 if (vector_is_ipi(vec)) {
-   /* do_IRQ is fundamentally broken for reliable IPI delivery.  */
-   irq_desc_t *desc = &irq_desc[vec];
-   regs->entry_vector = vec;
-   spin_lock(&desc->lock);
-   desc->handler->ack(vec);
-   desc->action->handler(vector_to_irq(vec), desc->action->dev_id, regs);
-   desc->handler->end(vec);
-   spin_unlock(&desc->lock);
+/* do_IRQ is fundamentally broken for reliable IPI delivery.  */
+irq_desc_t *desc = &irq_desc[vec];
+regs->entry_vector = vec;
+spin_lock(&desc->lock);
+desc->handler->ack(vec);
+desc->action->handler(vector_to_irq(vec), desc->action->dev_id, regs);
+desc->handler->end(vec);
+spin_unlock(&desc->lock);
 } else if (vec != -1) {
 DBG("EE:0x%lx isrc: %d\n", regs->msr, vec);
 regs->entry_vector = vec;
@@ -271,10 +271,10 @@ void send_IPI_mask(cpumask_t mask, int v
 switch(vector) {
 case CALL_FUNCTION_VECTOR:
 case EVENT_CHECK_VECTOR:
-   break;
+break;
 default:
-   BUG();
-   return;
+BUG();
+return;
 }
 
 BUG_ON(NR_CPUS > bits);
diff -r 177007615848 -r 305751a5281e xen/arch/powerpc/mpic.c
--- a/xen/arch/powerpc/mpic.c   Wed Nov 22 16:09:28 2006 -0500
+++ b/xen/arch/powerpc/mpic.c   Wed Nov 22 16:29:25 2006 -0500
@@ -15,15 +15,15 @@
 /* XXX Xen hacks ... */
 /* make this generic */
 
-#define le32_to_cpu(x) \
-({ \
-   __u32 __x = (x); \
-   ((__u32)( \
-   (((__u32)(__x) & (__u32)0x00ffUL) << 24) | \
-   (((__u32)(__x) & (__u32)0xff00UL) <<  8) | \
-   (((__u32)(__x) & (__u32)0x00ffUL) >>  8) | \
-   (((__u32)(__x) & (__u32)0xff00UL) >> 24) )); \
-})
+#define le32_to_cpu(x)  \
+({  \
+__u32 __x = (x);\
+((__u32)(   \
+ (((__u32)(__x) & (__u32)0x00ffUL) << 24) | \
+ (((__u32)(__x) & (__u32)0xff00UL) <<  8) | \
+ (((__u32)(__x) & (__u32)0x00ffUL) >>  8) | \
+ (((__u32)(__x) & (__u32)0xff00UL) >> 24) ));   \
+})
 
 
 #define alloc_bootmem(x) xmalloc_bytes(x)
@@ -117,7 +117,7 @@ static DEFINE_SPINLOCK(mpic_lock);
 
 
 static inline u32 _mpic_read(unsigned int be, volatile u32 __iomem *base,
-   unsigned int reg)
+ unsigned int reg)
 {
if (be)
return in_be32(base + (reg >> 2));
@@ -126,7 +126,7 @@ static inline u32 _mpic_read(unsigned in
 }
 
 static inline void _mpic_write(unsigned int be, volatile u32 __iomem *base,
- unsigned int reg, u32 value)
+   unsigned int reg, u32 value)
 {
if (be)
out_be32(base + (reg >> 2), value);
@@ -177,17 +177,17 @@ static inline u32 _mpic_irq_read(struct 
unsigned intidx = src_no & mpic->isu_mask;
 
return _mpic_read(mpic->flags & MPIC_BIG_ENDIAN, mpic->isus[isu],
- reg + (idx * MPIC_IRQ_STRIDE));
+  reg + (idx * MPIC_IRQ_STRIDE));
 }
 
 static inline void _mpic_irq_write(struct mpic *mpic, unsigned int src_no,
-  unsigned int reg, u32 value)
+   unsigned int reg, u32 value)
 {
unsigned intisu = src_no >> mpic->isu_shift;
unsigned intidx = src_no & mpic->isu_mask;
 
_mpic_write(mpic->flags & MPIC_BIG_ENDIAN, mpic->isus[isu],
-   reg + (idx * MPIC_IRQ_STRIDE), value);
+reg + (idx * MPIC_IRQ_STRIDE), value);
 }
 
 #define mpic_read(b,r) _mpic_read(mpic->flags & 
MPIC_BIG_ENDIAN,(b),(r))
@@ -252,7 +252,7 @@ static inline void mpic_ht_end_irq(struc
 }
 
 static void mpic_startup_ht_interrupt(struct mpic *mpic, unsigned int source,
- unsign

[XenPPC] [xenppc-unstable] [XEN][POWERPC] Fix Register dumping from ^A^A^A console

2006-11-22 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 177007615848aa444b0ccb4f5846ba74e67ac003
# Parent  ea41ccaa8d77134b8fb55e8b002d358e67c47152
[XEN][POWERPC] Fix Register dumping from ^A^A^A console

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/backtrace.c   |   12 
 xen/include/asm-powerpc/debugger.h |   21 -
 2 files changed, 24 insertions(+), 9 deletions(-)

diff -r ea41ccaa8d77 -r 177007615848 xen/arch/powerpc/backtrace.c
--- a/xen/arch/powerpc/backtrace.c  Wed Nov 22 14:53:13 2006 -0500
+++ b/xen/arch/powerpc/backtrace.c  Wed Nov 22 16:09:28 2006 -0500
@@ -220,3 +220,15 @@ void __warn(char *file, int line)
 
 console_end_sync();
 }
+
+void dump_execution_state(void)
+{
+struct vcpu *v = current;
+struct cpu_user_regs *regs = &v->arch.ctxt;
+
+show_registers(regs);
+if (regs->msr & MSR_HV) {
+printk("In Xen:\n");
+show_backtrace(regs->gprs[1], regs->pc, regs->lr);
+}
+}
diff -r ea41ccaa8d77 -r 177007615848 xen/include/asm-powerpc/debugger.h
--- a/xen/include/asm-powerpc/debugger.hWed Nov 22 14:53:13 2006 -0500
+++ b/xen/include/asm-powerpc/debugger.hWed Nov 22 16:09:28 2006 -0500
@@ -27,11 +27,19 @@ extern void show_backtrace_regs(struct c
 extern void show_backtrace_regs(struct cpu_user_regs *);
 extern void show_backtrace(ulong sp, ulong lr, ulong pc);
 
-static inline void dump_execution_state(void)
+static inline void show_execution_state(struct cpu_user_regs *regs)
+{
+show_registers(regs);
+}
+
+extern void dump_execution_state(void);
+
+static inline void dump_all_execution_state(void)
 {
 ulong sp;
 ulong lr;
 
+dump_execution_state();
 sp = (ulong)__builtin_frame_address(0);
 lr = (ulong)__builtin_return_address(0);
 
@@ -40,13 +48,13 @@ static inline void dump_execution_state(
 
 static inline void __force_crash(void)
 {
-dump_execution_state();
+dump_all_execution_state();
 __builtin_trap();
 }
 
 static inline void debugger_trap_immediate(void)
 {
-dump_execution_state();
+dump_all_execution_state();
 #ifdef CRASH_DEBUG
 __builtin_trap();
 #endif
@@ -55,13 +63,8 @@ static inline void unimplemented(void)
 static inline void unimplemented(void)
 {
 #ifdef VERBOSE
-dump_execution_state();
+dump_all_execution_state();
 #endif
-}
-
-static inline void show_execution_state(struct cpu_user_regs *regs)
-{
-show_registers(regs);
 }
 
 extern void __warn(char *file, int line);

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


Re: [XenPPC] [xenppc-unstable] [XEN][POWERPC] SMP/IPI/MB combined

2006-11-22 Thread Jimi Xenidis


On Nov 22, 2006, at 3:01 PM, Xen patchbot-xenppc-unstable wrote:


# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID ea41ccaa8d77134b8fb55e8b002d358e67c47152
# Parent  ce8c1e26b2aebd64c8a2f02e20ed46d587f42870
[XEN][POWERPC] SMP/IPI/MB combined


After pushing this patch I when to fix/update some ^A^A^A commands  
which I did.

Amos, it seems that:
  (XEN)  key 't' (ascii '74') => display multi-cpu clock info
has problems.

I filed a bug to cover this:
  http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=820

-JX

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Early boot memory avoidance improvemnts

2006-11-22 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID ce8c1e26b2aebd64c8a2f02e20ed46d587f42870
# Parent  7ad4645e7a54ce7ad64ec6fce30ac0f34d8d0fae
[XEN][POWERPC] Early boot memory avoidance improvemnts

This patch add a simple memory allocator that can be used to:
  - repect our loaded image
  - repect firmware suggestions on "availble" memory
  - avoid memory we know to have issues with various different FW

Also cleans up a lot of the previous logic and no longer updates the
multipboot memory map since that is no longer used anyway.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/boot_of.c |  369 +
 xen/arch/powerpc/setup.c   |4 
 2 files changed, 243 insertions(+), 130 deletions(-)

diff -r 7ad4645e7a54 -r ce8c1e26b2ae xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.cTue Nov 21 16:43:04 2006 -0600
+++ b/xen/arch/powerpc/boot_of.cWed Nov 22 14:35:09 2006 -0500
@@ -41,16 +41,27 @@ static ulong of_vec;
 static ulong of_vec;
 static ulong of_msr;
 static int of_out;
+static ulong eomem;
+
+#define MEM_AVAILABLE_PAGES ((32 << 20) >> PAGE_SHIFT)
+static DECLARE_BITMAP(mem_available_pages, MEM_AVAILABLE_PAGES);
 
 extern char builtin_cmdline[];
 extern struct ns16550_defaults ns16550;
 
 #undef OF_DEBUG
+#undef OF_DEBUG_LOW
 
 #ifdef OF_DEBUG
 #define DBG(args...) of_printf(args)
 #else
 #define DBG(args...)
+#endif
+
+#ifdef OF_DEBUG_LOW
+#define DBG_LOW(args...) of_printf(args)
+#else
+#define DBG_LOW(args...)
 #endif
 
 #define of_panic(MSG...) \
@@ -75,7 +86,6 @@ static int __init of_call(
 if (of_vec != 0) {
 va_list args;
 int i;
-
 memset(&s, 0, sizeof (s));
 s.ofs_service = (ulong)service;
 s.ofs_nargs = nargs;
@@ -186,7 +196,7 @@ static int __init of_finddevice(const ch
 DBG("finddevice %s -> FAILURE %d\n",devspec,rets[0]);
 return OF_FAILURE;
 }
-DBG("finddevice %s -> %d\n",devspec, rets[0]);
+DBG_LOW("finddevice %s -> %d\n",devspec, rets[0]);
 return rets[0];
 }
 
@@ -197,11 +207,11 @@ static int __init of_getprop(int ph, con
 of_call("getprop", 4, 1, rets, ph, name, buf, buflen);
 
 if (rets[0] == OF_FAILURE) {
-DBG("getprop 0x%x %s -> FAILURE\n", ph, name);
+DBG_LOW("getprop 0x%x %s -> FAILURE\n", ph, name);
 return OF_FAILURE;
 }
 
-DBG("getprop 0x%x %s -> 0x%x (%s)\n", ph, name, rets[0], (char *)buf);
+DBG_LOW("getprop 0x%x %s -> 0x%x (%s)\n", ph, name, rets[0], (char *)buf);
 return rets[0];
 }
 
@@ -217,7 +227,7 @@ static int __init of_setprop(
 return OF_FAILURE;
 }
 
-DBG("setprop 0x%x %s -> %s\n", ph, name, (char *)buf);
+DBG_LOW("setprop 0x%x %s -> %s\n", ph, name, (char *)buf);
 return rets[0];
 }
 
@@ -229,7 +239,7 @@ static int __init of_getchild(int ph)
 int rets[1] = { OF_FAILURE };
 
 of_call("child", 1, 1, rets, ph);
-DBG("getchild 0x%x -> 0x%x\n", ph, rets[0]);
+DBG_LOW("getchild 0x%x -> 0x%x\n", ph, rets[0]);
 
 return rets[0];
 }
@@ -242,7 +252,7 @@ static int __init of_getpeer(int ph)
 int rets[1] = { OF_FAILURE };
 
 of_call("peer", 1, 1, rets, ph);
-DBG("getpeer 0x%x -> 0x%x\n", ph, rets[0]);
+DBG_LOW("getpeer 0x%x -> 0x%x\n", ph, rets[0]);
 
 return rets[0];
 }
@@ -256,7 +266,7 @@ static int __init of_getproplen(int ph, 
 DBG("getproplen 0x%x %s -> FAILURE\n", ph, name);
 return OF_FAILURE;
 }
-DBG("getproplen 0x%x %s -> 0x%x\n", ph, name, rets[0]);
+DBG_LOW("getproplen 0x%x %s -> 0x%x\n", ph, name, rets[0]);
 return rets[0];
 }
 
@@ -269,7 +279,7 @@ static int __init of_package_to_path(int
 DBG("%s 0x%x -> FAILURE\n", __func__, ph);
 return OF_FAILURE;
 }
-DBG("%s 0x%x %s -> 0x%x\n", __func__, ph, buffer, rets[0]);
+DBG_LOW("%s 0x%x %s -> 0x%x\n", __func__, ph, buffer, rets[0]);
 if (rets[0] <= buflen)
 buffer[rets[0]] = '\0';
 return rets[0];
@@ -286,7 +296,7 @@ static int __init of_nextprop(int ph, co
 return OF_FAILURE;
 }
 
-DBG("nextprop 0x%x %s -> %s\n", ph, name, (char *)buf);
+DBG_LOW("nextprop 0x%x %s -> %s\n", ph, name, (char *)buf);
 return rets[0];
 }
 
@@ -333,7 +343,7 @@ static int __init of_claim(u32 virt, u32
 return OF_FAILURE;
 }
 
-DBG("%s 0x%08x 0x%08x  0x%08x -> 0x%08x\n", __func__, virt, size, align,
+DBG_LOW("%s 0x%08x 0x%08x  0x%08x -> 0x%08x\n", __func__, virt, size, 
align,
 rets[0]);
 return rets[0];
 }
@@ -355,7 +365,7 @@ static int __init of_getparent(int ph)
 
 of_call("parent", 1, 1, rets, ph);
 
-DBG("getparent 0x%x -> 0x%x\n", ph, rets[0]);
+DBG_LOW("getparent 0x%x -> 0x%x\n", ph, rets[0]);
 return rets[0];
 }
 
@@ -367,25 +377,196 @@ static int __init of_open(const char *de
 return rets[0];
 }
 
-static void boot_of_probemem(multiboot_info_t *mbi)
+static void boot_of_alloc_init(int m, uint addr_c

[XenPPC] [xenppc-unstable] [XEN][POWERPC] SMP/IPI/MB combined

2006-11-22 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID ea41ccaa8d77134b8fb55e8b002d358e67c47152
# Parent  ce8c1e26b2aebd64c8a2f02e20ed46d587f42870
[XEN][POWERPC] SMP/IPI/MB combined

This patch rolls up and rebases the following patches for submission
against current tip of tree:

 * Memory barrier after SP store
 * IPI support
 * SMP support

The only changes from the previous submission other than trivial
fast-forward merges are to remove the ERAT flush, since it was comitted
seperately, and to make the status messages about waiting for remote
function completion ACKs only kick in after a full second has passed.

Note that this path REQUIRES that some form of the dom0 Linux patch
titled "Make Linux bail out of IPI vector reset" be applied.

Signed-off-by: Amos Waterland <[EMAIL PROTECTED]>
Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/external.c|   32 
 xen/arch/powerpc/mpic.c|9 -
 xen/arch/powerpc/mpic_init.c   |   48 +++
 xen/arch/powerpc/setup.c   |   50 ---
 xen/arch/powerpc/smp.c |  135 -
 xen/include/asm-powerpc/mach-default/irq_vectors.h |   22 ---
 xen/include/asm-powerpc/smp.h  |   16 ++
 7 files changed, 256 insertions(+), 56 deletions(-)

diff -r ce8c1e26b2ae -r ea41ccaa8d77 xen/arch/powerpc/external.c
--- a/xen/arch/powerpc/external.c   Wed Nov 22 14:35:09 2006 -0500
+++ b/xen/arch/powerpc/external.c   Wed Nov 22 14:53:13 2006 -0500
@@ -82,7 +82,16 @@ void do_external(struct cpu_user_regs *r
 
 vec = xen_mpic_get_irq(regs);
 
-if (vec != -1) {
+if (vector_is_ipi(vec)) {
+   /* do_IRQ is fundamentally broken for reliable IPI delivery.  */
+   irq_desc_t *desc = &irq_desc[vec];
+   regs->entry_vector = vec;
+   spin_lock(&desc->lock);
+   desc->handler->ack(vec);
+   desc->action->handler(vector_to_irq(vec), desc->action->dev_id, regs);
+   desc->handler->end(vec);
+   spin_unlock(&desc->lock);
+} else if (vec != -1) {
 DBG("EE:0x%lx isrc: %d\n", regs->msr, vec);
 regs->entry_vector = vec;
 do_IRQ(regs);
@@ -253,3 +262,24 @@ int ioapic_guest_write(unsigned long phy
 BUG_ON(val != val);
 return 0;
 }
+
+void send_IPI_mask(cpumask_t mask, int vector)
+{
+unsigned int cpus;
+int const bits = 8 * sizeof(cpus);
+
+switch(vector) {
+case CALL_FUNCTION_VECTOR:
+case EVENT_CHECK_VECTOR:
+   break;
+default:
+   BUG();
+   return;
+}
+
+BUG_ON(NR_CPUS > bits);
+BUG_ON(fls(mask.bits[0]) > bits);
+
+cpus = mask.bits[0];
+mpic_send_ipi(vector, cpus);
+}
diff -r ce8c1e26b2ae -r ea41ccaa8d77 xen/arch/powerpc/mpic.c
--- a/xen/arch/powerpc/mpic.c   Wed Nov 22 14:35:09 2006 -0500
+++ b/xen/arch/powerpc/mpic.c   Wed Nov 22 14:53:13 2006 -0500
@@ -27,10 +27,6 @@
 
 
 #define alloc_bootmem(x) xmalloc_bytes(x)
-#define request_irq(irq, handler, f, devname, dev_id) \
-panic("IPI requested: %d: %p: %s: %p\n", irq, handler, devname, dev_id)
-
-typedef int irqreturn_t;
 
 #define IRQ_NONE   (0)
 #define IRQ_HANDLED(1)
@@ -96,11 +92,6 @@ typedef int irqreturn_t;
 #endif
 #include 
 #include 
-
-static inline void smp_message_recv(int msg, struct pt_regs *regs)
-{
-return;
-}
 
 #ifdef DEBUG
 #define DBG(fmt...) printk(fmt)
diff -r ce8c1e26b2ae -r ea41ccaa8d77 xen/arch/powerpc/mpic_init.c
--- a/xen/arch/powerpc/mpic_init.c  Wed Nov 22 14:35:09 2006 -0500
+++ b/xen/arch/powerpc/mpic_init.c  Wed Nov 22 14:53:13 2006 -0500
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "mpic_init.h"
 #include "oftree.h"
 #include "of-devtree.h"
@@ -358,6 +359,42 @@ static struct hw_interrupt_type *share_m
 
 #endif
 
+static unsigned int mpic_startup_ipi(unsigned int irq)
+{
+mpic->hc_ipi.enable(irq);
+return 0;
+}
+
+int request_irq(unsigned int irq,
+   irqreturn_t (*handler)(int, void *, struct cpu_user_regs *),
+   unsigned long irqflags, const char * devname, void *dev_id)
+{
+int retval;
+struct irqaction *action;
+void (*func)(int, void *, struct cpu_user_regs *);
+
+action = xmalloc(struct irqaction);
+if (!action) {
+   BUG();
+   return -ENOMEM;
+}
+
+/* Xen's handler prototype is slightly different than Linux's.  */
+func = (void (*)(int, void *, struct cpu_user_regs *))handler;
+
+action->handler = func;
+action->name = devname;
+action->dev_id = dev_id;
+
+retval = setup_irq(irq, action);
+if (retval) {
+   BUG();
+   xfree(action);
+}
+
+return retval;
+}
+
 struct hw_interrupt_type *xen_mpic_init(struct hw_interrupt_type *xen_irq)
 {
 unsigned int isu_size;
@@ -397,6 +434,11 @@ struct hw_interrupt_type *xen_mpic_init(
 hit = share_mpic(&mpic->hc_irq, xen_irq);
 
 printk("%s: success\n", __func__);
+
+  

[XenPPC] [xenppc-unstable] [XEN][POWERPC] Change license on public/ headers from GPL to BSD.

2006-11-13 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Hollis Blanchard <[EMAIL PROTECTED]>
# Node ID b35682af48d01ddba1d26e6fe2d0c5607a343228
# Parent  e7a54ea1405716153eba36d22a113d76624612be
[XEN][POWERPC] Change license on public/ headers from GPL to BSD.
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
 xen/include/public/arch-powerpc.h |   26 +++---
 xen/include/public/xencomm.h  |   30 +-
 2 files changed, 32 insertions(+), 24 deletions(-)

diff -r e7a54ea14057 -r b35682af48d0 xen/include/public/arch-powerpc.h
--- a/xen/include/public/arch-powerpc.h Mon Nov 13 12:35:17 2006 -0600
+++ b/xen/include/public/arch-powerpc.h Mon Nov 13 14:32:55 2006 -0600
@@ -1,17 +1,21 @@
 /*
- * 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.
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
  *
- * 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.
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
  *
  * Copyright (C) IBM Corp. 2005, 2006
  *
diff -r e7a54ea14057 -r b35682af48d0 xen/include/public/xencomm.h
--- a/xen/include/public/xencomm.h  Mon Nov 13 12:35:17 2006 -0600
+++ b/xen/include/public/xencomm.h  Mon Nov 13 14:32:55 2006 -0600
@@ -1,17 +1,21 @@
 /*
- * 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
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
  *
  * Copyright (C) IBM Corp. 2006
  *

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Turn off the Guard bit for access to the grant table

2006-11-11 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 4589b3dec1fd875096858471ae493c708e7049a3
# Parent  3b1358032f6ad2542e63848681c913a583274fa3
[XEN][POWERPC] Turn off the Guard bit for access to the grant table

Soon, we will not have domains map this page like IO, but for the near
term lets undo all the IO-type PTE bits.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/papr/xlate.c |1 +
 1 files changed, 1 insertion(+)

diff -r 3b1358032f6a -r 4589b3dec1fd xen/arch/powerpc/papr/xlate.c
--- a/xen/arch/powerpc/papr/xlate.c Fri Nov 10 18:42:22 2006 -0500
+++ b/xen/arch/powerpc/papr/xlate.c Sat Nov 11 10:30:07 2006 -0500
@@ -199,6 +199,7 @@ long pte_enter(ulong flags, ulong ptex, 
 DBG("%s: Dom[%d] mapping grant table: 0x%lx\n",
 __func__, d->domain_id, pfn << PAGE_SHIFT);
 pte.bits.i = 0;
+pte.bits.g = 0;
 }
 /* fixup the RPN field of our local PTE copy */
 pte.bits.rpn = mfn | lp_bits;

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Flush the ERAT very early on secondary processors.

2006-11-11 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 3817c84cb7e81647578042d3e725941ee5f24c51
# Parent  4589b3dec1fd875096858471ae493c708e7049a3
[XEN][POWERPC] Flush the ERAT very early on secondary processors.

This patch solves the problem with the "Synchronizing timebase hang"
that both SMP and "nosmp" users have experienced.  It blows away the
ERAT but performing an SLBIA in the seconadry processor "spinup" code.

Signed-off-by: Amos Waterland <[EMAIL PROTECTED]>
Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/powerpc64/exceptions.S |6 +-
 1 files changed, 5 insertions(+), 1 deletion(-)

diff -r 4589b3dec1fd -r 3817c84cb7e8 xen/arch/powerpc/powerpc64/exceptions.S
--- a/xen/arch/powerpc/powerpc64/exceptions.S   Sat Nov 11 10:30:07 2006 -0500
+++ b/xen/arch/powerpc/powerpc64/exceptions.S   Sat Nov 11 12:04:45 2006 -0500
@@ -564,7 +564,11 @@ _GLOBAL(sleep)
  */
 .globl spin_start
 spin_start:
-
+/* We discovered by experiment that the ERAT must be flushed early.  */
+isync
+slbia
+isync
+   
 /* Do a cache flush for our text, in case the loader didn't */
 LOADADDR(r9, _start)
 LOADADDR(r8, _etext)

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] The VIO rewrite

2006-11-03 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID b30cb72ed5e20d4957207145022e648b913c033b
# Parent  9148f7816d00bc45a8795a5119db9949894a3f89
[XEN][POWERPC] The VIO rewrite

Once you figure it all out, its time to do a rewrite, lots of code I
thougth I needed is now removed and less PPC specific code now exists.

This patch uses the MEMORY_HOTPLUG system to add a region to the
Kernel Linear Mapping that will be used exclusively to map in
Granted/Foreign pages.  This creates "struct page" objects in Linux
which are necessary to perform VIO operations.  When one of these
pages are grant_mapped the pfn2mfn() translation in Xen is updated to
reflect the association and the subsequent H_ENTER() from the domain
will contain the correct mapping.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/domain.c |7 +++
 xen/arch/powerpc/mm.c |   24 +++-
 xen/arch/powerpc/ofd_fixup.c  |2 +-
 xen/common/grant_table.c  |2 +-
 xen/include/asm-powerpc/domain.h  |3 +++
 xen/include/asm-powerpc/grant_table.h |4 
 xen/include/xen/grant_table.h |4 
 7 files changed, 35 insertions(+), 11 deletions(-)

diff -r 9148f7816d00 -r b30cb72ed5e2 xen/arch/powerpc/domain.c
--- a/xen/arch/powerpc/domain.c Tue Oct 24 19:11:00 2006 -0400
+++ b/xen/arch/powerpc/domain.c Fri Nov 03 16:53:17 2006 -0500
@@ -88,6 +88,12 @@ int arch_domain_create(struct domain *d)
 
 INIT_LIST_HEAD(&d->arch.extent_list);
 
+d->arch.foreign_mfn_count = 1024;
+d->arch.foreign_mfns = xmalloc_array(uint, d->arch.foreign_mfn_count);
+BUG_ON(d->arch.foreign_mfns == NULL);
+
+memset(d->arch.foreign_mfns, -1, d->arch.foreign_mfn_count * sizeof(uint));
+
 return 0;
 }
 
@@ -292,6 +298,7 @@ void domain_relinquish_resources(struct 
 relinquish_memory(d, &d->xenpage_list);
 relinquish_memory(d, &d->page_list);
 free_extents(d);
+xfree(d->arch.foreign_mfns);
 return;
 }
 
diff -r 9148f7816d00 -r b30cb72ed5e2 xen/arch/powerpc/mm.c
--- a/xen/arch/powerpc/mm.c Tue Oct 24 19:11:00 2006 -0400
+++ b/xen/arch/powerpc/mm.c Fri Nov 03 16:53:17 2006 -0500
@@ -93,6 +93,26 @@ void share_xen_page_with_privileged_gues
 unimplemented();
 }
 
+static ulong foreign_to_mfn(struct domain *d, ulong pfn)
+{
+
+pfn -= 1UL << cpu_foreign_map_order();
+
+BUG_ON(pfn >= d->arch.foreign_mfn_count);
+
+return d->arch.foreign_mfns[pfn];
+}
+
+static int set_foreign(struct domain *d, ulong pfn, ulong mfn)
+{
+pfn -= 1UL << cpu_foreign_map_order();
+
+BUG_ON(pfn >= d->arch.foreign_mfn_count);
+d->arch.foreign_mfns[pfn] = mfn;
+
+return 0;
+}
+
 static int create_grant_va_mapping(
 unsigned long va, unsigned long frame, struct vcpu *v)
 {
@@ -101,6 +121,7 @@ static int create_grant_va_mapping(
 BUG();
 return GNTST_permission_denied;
 }
+set_foreign(v->domain, va >> PAGE_SHIFT, frame);
 return GNTST_okay;
 }
 
@@ -112,6 +133,7 @@ static int destroy_grant_va_mapping(
 BUG();
 return GNTST_permission_denied;
 }
+set_foreign(d, addr >> PAGE_SHIFT, ~0UL);
 return GNTST_okay;
 }
 
@@ -388,7 +410,7 @@ ulong pfn2mfn(struct domain *d, ulong pf
 /* quick tests first */
 if (pfn & foreign_map_pfn) {
 t = PFN_TYPE_FOREIGN;
-mfn = pfn & ~(foreign_map_pfn);
+mfn = foreign_to_mfn(d, pfn);
 } else if (pfn >= max_page && pfn < (max_page + NR_GRANT_FRAMES)) {
 /* Its a grant table access */
 t = PFN_TYPE_GNTTAB;
diff -r 9148f7816d00 -r b30cb72ed5e2 xen/arch/powerpc/ofd_fixup.c
--- a/xen/arch/powerpc/ofd_fixup.c  Tue Oct 24 19:11:00 2006 -0400
+++ b/xen/arch/powerpc/ofd_fixup.c  Fri Nov 03 16:53:17 2006 -0500
@@ -354,7 +354,7 @@ static ofdn_t ofd_xen_props(void *m, str
 
 /* tell dom0 where ranted pages go in the linear map */
 val[0] = cpu_foreign_map_order();
-val[1] = max_page;
+val[1] = d->arch.foreign_mfn_count;
 ofd_prop_add(m, n, "foreign-map", val, sizeof (val));
 
 n = ofd_node_add(m, n, console, sizeof (console));
diff -r 9148f7816d00 -r b30cb72ed5e2 xen/common/grant_table.c
--- a/xen/common/grant_table.c  Tue Oct 24 19:11:00 2006 -0400
+++ b/xen/common/grant_table.c  Fri Nov 03 16:53:17 2006 -0500
@@ -280,7 +280,7 @@ __gnttab_map_grant_ref(
 ld->grant_table->maptrack[handle].ref   = op->ref;
 ld->grant_table->maptrack[handle].flags = op->flags;
 
-op->dev_bus_addr = GNTTAB_DEV_BUS((u64)frame << PAGE_SHIFT);
+op->dev_bus_addr = (u64)frame << PAGE_SHIFT;
 op->handle   = handle;
 op->status   = GNTST_okay;
 
diff -r 9148f7816d00 -r b30cb72ed5e2 xen/include/asm-powerpc/domain.h
--- a/xen/include/asm-powerpc/domain.h  Tue Oct 24 19:11:00 2006 -0400
+++ b/xen/include/asm-powerpc/domain.h  Fri Nov 03 16:53:17 2006 -0500
@@ -40,6 +40,9 @@ struct arch_domain {
 
 /* list of extents bey

[XenPPC] [xenppc-unstable] [XEN][POWERPC] Support your older compilers

2006-10-13 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User [EMAIL PROTECTED]
# Node ID 9372353e3b095cfaf82d09c8b891d9a2b58ca735
# Parent  b53c343b47ae930248f5db194b72d390e4143ccd
[XEN][POWERPC] Support your older compilers

gcc 3.3.x doesn't like some instructions we are using so lets dum them
down a bit.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/powerpc64/exceptions.S |2 +-
 xen/arch/powerpc/setup.c|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff -r b53c343b47ae -r 9372353e3b09 xen/arch/powerpc/powerpc64/exceptions.S
--- a/xen/arch/powerpc/powerpc64/exceptions.S   Wed Oct 11 13:04:07 2006 -0400
+++ b/xen/arch/powerpc/powerpc64/exceptions.S   Thu Oct 12 17:09:19 2006 -0400
@@ -587,7 +587,7 @@ 4:  dcbf r0,r9
 b .
 /* Find our index in the array of processor_area struct pointers.  */
 2:  LOADADDR(r14, global_cpu_table)
-muli r15, r3, 8
+mulli r15, r3, 8
 add r14, r14, r15
 /* Spin until the pointer for our processor goes valid.  */
 1:  ld r15, 0(r14)
diff -r b53c343b47ae -r 9372353e3b09 xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Wed Oct 11 13:04:07 2006 -0400
+++ b/xen/arch/powerpc/setup.c  Thu Oct 12 17:09:19 2006 -0400
@@ -118,7 +118,7 @@ void noinline __attn(void)
  * NOP is there to make sure there is something sane to "step
  * over" to. */
 console_start_sync();
-asm volatile("attn");
+asm volatile(".long 0x200;nop");
 console_end_sync();
 }
 

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


[XenPPC] [xenppc-unstable] [XEN] #include errno.h in gdbstub.c.

2006-10-13 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Hollis Blanchard <[EMAIL PROTECTED]>
# Node ID ff3ab3fc802484087ecf24521f66c4f7ab44849a
# Parent  f67efbf6dfa9dc8ccebf85956ef9c5bc5c5928cc
[XEN] #include errno.h in gdbstub.c.
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
 xen/common/gdbstub.c |1 +
 1 files changed, 1 insertion(+)

diff -r f67efbf6dfa9 -r ff3ab3fc8024 xen/common/gdbstub.c
--- a/xen/common/gdbstub.c  Thu Oct 12 18:22:26 2006 -0500
+++ b/xen/common/gdbstub.c  Thu Oct 12 18:24:50 2006 -0500
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* Printk isn't particularly safe just after we've trapped to the
debugger. so avoid it. */

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


Re: [XenPPC] [xenppc-unstable] [XEN][POWERPC] Remove pfn2mfn() now that it is understood

2006-10-10 Thread Jimi Xenidis


On Oct 10, 2006, at 9:20 AM, Xen patchbot-xenppc-unstable wrote:


# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 7af3636da4b955e556af19af91b03633b565cce2
# Parent  3583d270140501b208f08335e10105d3f05c52d8
[XEN][POWERPC] Remove pfn2mfn() now that it is understood

That should be "Remove pfn2mfn() BUG()..."


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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] New interface ATTN() to conact the HW probe

2006-10-10 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 05c8ce1d697cd7d16adbfb706680adfb95d4490f
# Parent  7af3636da4b955e556af19af91b03633b565cce2
[XEN][POWERPC] New interface ATTN() to conact the HW probe

Sometimes it is useful to have your code contact the HW probe directly
rather than call BUG().

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/setup.c   |   12 ++--
 xen/include/asm-powerpc/debugger.h |3 +++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff -r 7af3636da4b9 -r 05c8ce1d697c xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Tue Oct 10 09:09:38 2006 -0400
+++ b/xen/arch/powerpc/setup.c  Tue Oct 10 09:11:32 2006 -0400
@@ -114,12 +114,20 @@ static void __init do_initcalls(void)
 }
 }
 
-static void hw_probe_attn(unsigned char key, struct cpu_user_regs *regs)
+
+void noinline __attn(void)
 {
 /* To continue the probe will step over the ATTN instruction.  The
  * NOP is there to make sure there is something sane to "step
  * over" to. */
-asm volatile(".long 0x0200; nop");
+console_start_sync();
+asm volatile("attn");
+console_end_sync();
+}
+
+static void hw_probe_attn(unsigned char key, struct cpu_user_regs *regs)
+{
+__attn();
 }
 
 static void percpu_init_areas(void)
diff -r 7af3636da4b9 -r 05c8ce1d697c xen/include/asm-powerpc/debugger.h
--- a/xen/include/asm-powerpc/debugger.hTue Oct 10 09:09:38 2006 -0400
+++ b/xen/include/asm-powerpc/debugger.hTue Oct 10 09:11:32 2006 -0400
@@ -68,6 +68,9 @@ extern void __warn(char *file, int line)
 #define WARN() __warn(__FILE__, __LINE__)
 #define WARN_ON(_p) do { if (_p) WARN(); } while ( 0 )
 
+extern void __attn(void);
+#define ATTN() __attn();
+
 #define FORCE_CRASH() __force_crash()
 
 #ifdef CRASH_DEBUG

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Remove pfn2mfn() now that it is understood

2006-10-10 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 7af3636da4b955e556af19af91b03633b565cce2
# Parent  3583d270140501b208f08335e10105d3f05c52d8
[XEN][POWERPC] Remove pfn2mfn() now that it is understood

It is possible (thank you xm-test) to initiate a grant copy to a page
belonging to a dying domain, the page end up being owned by nobody
which is what the original test asserted.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/mm.c |   13 -
 1 files changed, 12 insertions(+), 1 deletion(-)

diff -r 3583d2701405 -r 7af3636da4b9 xen/arch/powerpc/mm.c
--- a/xen/arch/powerpc/mm.c Sun Oct 08 11:52:28 2006 -0400
+++ b/xen/arch/powerpc/mm.c Tue Oct 10 09:09:38 2006 -0400
@@ -416,7 +416,18 @@ ulong pfn2mfn(struct domain *d, ulong pf
 cur_pfn += pe_pages;
 }
 }
-BUG_ON(t != PFN_TYPE_NONE && page_get_owner(mfn_to_page(mfn)) != d);
+#ifdef DEBUG
+if (t != PFN_TYPE_NONE &&
+(d->domain_flags & DOMF_dying) &&
+page_get_owner(mfn_to_page(mfn)) != d) {
+printk("%s: page type: %d owner Dom[%d]:%p expected Dom[%d]:%p\n",
+   __func__, t,
+   page_get_owner(mfn_to_page(mfn))->domain_id,
+   page_get_owner(mfn_to_page(mfn)),
+   d->domain_id, d);
+BUG();
+}
+#endif
 }
 
 if (t == PFN_TYPE_NONE) {

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Create a Domain Foreign Map space

2006-10-08 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 1849e7806e199e8feecb280605c53c9949541d9b
# Parent  c836899002deb97bb9601d247f6e078d201aeff5
[XEN][POWERPC] Create a Domain Foreign Map space

The following patch creates a Domain Foreign Map space that is uses to
map granted memory into the Linear Map of the domain.  The Linear Map
of Linux is the is the Kernel Virtual address space where VA = PA +
PAGE_OFFSET.

Also:
 - lots of grant_* interfaces work now
 - mm.[ch] cleanups
 - first pass at extracting Page Table operations from PAPR interfaces
 - get_page_type() fix logic bug
 - recognize a grant table mapping by placing its gmfn at the end of
   real memory.
 - grant table usually mapped like an IO page, so force WIMG bits I=0
 - mfn_to_gmfn and pfn2mfn get WAY to complex, need get a simpler model in.
 - communicate the Domain Foreign Map to domains using /xen/foreign-map
 - make sure all bit definitions are UL where possible
 - now that we actually assign Xen heap pages to domains they must be
   relinquished

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/domain.c |2 
 xen/arch/powerpc/mm.c |  163 +-
 xen/arch/powerpc/ofd_fixup.c  |5 +
 xen/arch/powerpc/papr/xlate.c |  130 +++
 xen/include/asm-powerpc/grant_table.h |   16 ++-
 xen/include/asm-powerpc/mm.h  |   76 ---
 xen/include/asm-powerpc/page.h|   37 ---
 7 files changed, 297 insertions(+), 132 deletions(-)

diff -r c836899002de -r 1849e7806e19 xen/arch/powerpc/domain.c
--- a/xen/arch/powerpc/domain.c Sun Oct 08 11:32:53 2006 -0400
+++ b/xen/arch/powerpc/domain.c Sun Oct 08 11:34:24 2006 -0400
@@ -94,6 +94,7 @@ void arch_domain_destroy(struct domain *
 void arch_domain_destroy(struct domain *d)
 {
 shadow_teardown(d);
+/* shared_info is part of the RMA so no need to release it */
 }
 
 static void machine_fail(const char *s)
@@ -288,6 +289,7 @@ static void relinquish_memory(struct dom
 
 void domain_relinquish_resources(struct domain *d)
 {
+relinquish_memory(d, &d->xenpage_list);
 relinquish_memory(d, &d->page_list);
 free_extents(d);
 return;
diff -r c836899002de -r 1849e7806e19 xen/arch/powerpc/mm.c
--- a/xen/arch/powerpc/mm.c Sun Oct 08 11:32:53 2006 -0400
+++ b/xen/arch/powerpc/mm.c Sun Oct 08 11:34:24 2006 -0400
@@ -41,18 +41,107 @@ unsigned long max_page;
 unsigned long max_page;
 unsigned long total_pages;
 
+void __init init_frametable(void)
+{
+unsigned long p;
+unsigned long nr_pages;
+int i;
+
+nr_pages = PFN_UP(max_page * sizeof(struct page_info));
+
+p = alloc_boot_pages(nr_pages, 1);
+if (p == 0)
+panic("Not enough memory for frame table\n");
+
+frame_table = (struct page_info *)(p << PAGE_SHIFT);
+for (i = 0; i < nr_pages; i += 1)
+clear_page((void *)((p + i) << PAGE_SHIFT));
+}
+
+void share_xen_page_with_guest(
+struct page_info *page, struct domain *d, int readonly)
+{
+if ( page_get_owner(page) == d )
+return;
+
+/* this causes us to leak pages in the Domain and reuslts in
+ * Zombie domains, I think we are missing a piece, until we find
+ * it we disable the following code */
+set_gpfn_from_mfn(page_to_mfn(page), INVALID_M2P_ENTRY);
+
+spin_lock(&d->page_alloc_lock);
+
+/* The incremented type count pins as writable or read-only. */
+page->u.inuse.type_info  = (readonly ? PGT_none : PGT_writable_page);
+page->u.inuse.type_info |= PGT_validated | 1;
+
+page_set_owner(page, d);
+wmb(); /* install valid domain ptr before updating refcnt. */
+ASSERT(page->count_info == 0);
+page->count_info |= PGC_allocated | 1;
+
+if ( unlikely(d->xenheap_pages++ == 0) )
+get_knownalive_domain(d);
+list_add_tail(&page->list, &d->xenpage_list);
+
+spin_unlock(&d->page_alloc_lock);
+}
+
+void share_xen_page_with_privileged_guests(
+struct page_info *page, int readonly)
+{
+unimplemented();
+}
+
+static int create_grant_va_mapping(
+unsigned long va, unsigned long frame, struct vcpu *v)
+{
+if (v->domain->domain_id != 0) {
+printk("only Dom0 can map a grant entry\n");
+BUG();
+return GNTST_permission_denied;
+}
+return GNTST_okay;
+}
+
+static int destroy_grant_va_mapping(
+unsigned long addr, unsigned long frame, struct domain *d)
+{
+if (d->domain_id != 0) {
+printk("only Dom0 can map a grant entry\n");
+BUG();
+return GNTST_permission_denied;
+}
+return GNTST_okay;
+}
+
 int create_grant_host_mapping(
 unsigned long addr, unsigned long frame, unsigned int flags)
 {
-panic("%s called\n", __func__);
-return 1;
+if (flags & GNTMAP_application_map) {
+printk("%s: GNTMAP_application_map not supported\n", __func__);
+BUG();
+return GNTST_general_error;
+}
+if (flags & GNTMAP

[XenPPC] [xenppc-unstable] [XEN]

2006-10-08 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID c836899002deb97bb9601d247f6e078d201aeff5
# Parent  e30376a0abc39117f604b0f6cc7817deb3eb9079
[XEN]

The following patch allows for an architecture to decorate the
dev_bus_addr returned by a gnttab mapping.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/common/grant_table.c  |2 +-
 xen/include/xen/grant_table.h |4 
 2 files changed, 5 insertions(+), 1 deletion(-)

diff -r e30376a0abc3 -r c836899002de xen/common/grant_table.c
--- a/xen/common/grant_table.c  Sat Oct 07 16:25:46 2006 -0400
+++ b/xen/common/grant_table.c  Sun Oct 08 11:32:53 2006 -0400
@@ -280,7 +280,7 @@ __gnttab_map_grant_ref(
 ld->grant_table->maptrack[handle].ref   = op->ref;
 ld->grant_table->maptrack[handle].flags = op->flags;
 
-op->dev_bus_addr = (u64)frame << PAGE_SHIFT;
+op->dev_bus_addr = GNTTAB_DEV_BUS((u64)frame << PAGE_SHIFT);
 op->handle   = handle;
 op->status   = GNTST_okay;
 
diff -r e30376a0abc3 -r c836899002de xen/include/xen/grant_table.h
--- a/xen/include/xen/grant_table.h Sat Oct 07 16:25:46 2006 -0400
+++ b/xen/include/xen/grant_table.h Sun Oct 08 11:32:53 2006 -0400
@@ -96,4 +96,8 @@ gnttab_release_mappings(
 gnttab_release_mappings(
 struct domain *d);
 
+#ifndef GNTTAB_DEV_BUS
+#define GNTTAB_DEV_BUS(f) (f)
+#endif
+
 #endif /* __XEN_GRANT_TABLE_H__ */

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Keepin it cool: sleep the processor when halt fails

2006-10-08 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 701c68921ff32370caeaaac17a5e0a25ebc8a83a
# Parent  d1f6d0f820d890ac6075f47ad1ba6e38012167b4
[XEN][POWERPC] Keepin it cool: sleep the processor when halt fails

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/domain.c |6 +++---
 xen/arch/powerpc/exceptions.h |3 +++
 xen/arch/powerpc/setup.c  |2 --
 3 files changed, 6 insertions(+), 5 deletions(-)

diff -r d1f6d0f820d8 -r 701c68921ff3 xen/arch/powerpc/domain.c
--- a/xen/arch/powerpc/domain.c Mon Oct 02 21:43:09 2006 -0400
+++ b/xen/arch/powerpc/domain.c Wed Oct 04 14:06:14 2006 -0400
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include "rtas.h"
+#include "exceptions.h"
 
 #define next_arg(fmt, args) ({  \
 unsigned long __arg;\
@@ -47,7 +48,6 @@
 }   \
 __arg;  \
 })
-extern void idle_loop(void);
 
 unsigned long hypercall_create_continuation(unsigned int op,
 const char *format, ...)
@@ -99,7 +99,8 @@ static void machine_fail(const char *s)
 static void machine_fail(const char *s)
 {
 printf("%s failed, manual powercycle required!\n", s);
-while(1);
+for (;;)
+sleep();
 }
 void machine_halt(void)
 {
@@ -296,7 +297,6 @@ void arch_dump_domain_info(struct domain
 {
 }
 
-extern void sleep(void);
 static void safe_halt(void)
 {
 int cpu = smp_processor_id();
diff -r d1f6d0f820d8 -r 701c68921ff3 xen/arch/powerpc/exceptions.h
--- a/xen/arch/powerpc/exceptions.h Mon Oct 02 21:43:09 2006 -0400
+++ b/xen/arch/powerpc/exceptions.h Wed Oct 04 14:06:14 2006 -0400
@@ -43,8 +43,11 @@ extern void program_exception(
 struct cpu_user_regs *regs, unsigned long cookie);
 
 extern long xen_hvcall_jump(struct cpu_user_regs *regs, ulong address);
+
 extern void *mambo_memset(void *, int, ulong);
 extern void *mambo_memcpy(void *, const void *, ulong);
+extern void sleep(void);
+extern void idle_loop(void);
 
 extern ulong *__hypercall_table[];
 
diff -r d1f6d0f820d8 -r 701c68921ff3 xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Mon Oct 02 21:43:09 2006 -0400
+++ b/xen/arch/powerpc/setup.c  Wed Oct 04 14:06:14 2006 -0400
@@ -199,8 +199,6 @@ static void __init start_of_day(void)
 schedulers_start();
 }
 
-extern void idle_loop(void);
-
 void startup_cpu_idle_loop(void)
 {
 struct vcpu *v = current;

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] An OK spot to flush the I-Cache

2006-10-02 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID d1f6d0f820d890ac6075f47ad1ba6e38012167b4
# Parent  6e451ba8bc03bd6c363058447e70643210b7011b
[XEN][POWERPC] An OK spot to flush the I-Cache

Its not the best, but it will do for now.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/domain.c |1 +
 1 files changed, 1 insertion(+)

diff -r 6e451ba8bc03 -r d1f6d0f820d8 xen/arch/powerpc/domain.c
--- a/xen/arch/powerpc/domain.c Mon Oct 02 21:40:26 2006 -0400
+++ b/xen/arch/powerpc/domain.c Mon Oct 02 21:43:09 2006 -0400
@@ -230,6 +230,7 @@ void context_switch(struct vcpu *prev, s
 
 mtsdr1(next->domain->arch.htab.sdr1);
 local_flush_tlb(); /* XXX maybe flush_tlb_mask? */
+cpu_flush_icache();
 
 if (is_idle_vcpu(next)) {
 reset_stack_and_jump(idle_loop);

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Fixes in cpu_flush_icache()

2006-10-02 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID d1138b71a50937503a6ec5800d7e8f4fd8b062e6
# Parent  02f6e775deb1f6aa21154ee43712351a389681af
[XEN][POWERPC] Fixes in cpu_flush_icache()

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/powerpc64/ppc970.c |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)

diff -r 02f6e775deb1 -r d1138b71a509 xen/arch/powerpc/powerpc64/ppc970.c
--- a/xen/arch/powerpc/powerpc64/ppc970.c   Mon Oct 02 11:07:54 2006 -0400
+++ b/xen/arch/powerpc/powerpc64/ppc970.c   Mon Oct 02 19:55:18 2006 -0400
@@ -50,24 +50,25 @@ void cpu_flush_icache(void)
 {
 union hid1 hid1;
 ulong flags;
-ulong ra;
+ulong ea;
 
 local_irq_save(flags);
 
-/* uses special processor mode that forces a real address match */
+/* uses special processor mode that forces a real address match on
+ * the whole line */
 hid1.word = mfhid1();
 hid1.bits.en_icbi = 1;
 mthid1(hid1.word);
 
-for (ra = 0; ra < cpu_caches.isize; ra += cpu_caches.iline_size)
-icbi(ra);
+for (ea = 0; ea < cpu_caches.isize; ea += cpu_caches.iline_size)
+icbi(ea);
 
 sync();
 
 hid1.bits.en_icbi = 0;
 mthid1(hid1.word);
 
-local_irq_save(flags);
+local_irq_restore(flags);
 }
 
 

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Use gmfn_to_mfn() over pfn2mfn()

2006-10-02 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 6e451ba8bc03bd6c363058447e70643210b7011b
# Parent  d1138b71a50937503a6ec5800d7e8f4fd8b062e6
[XEN][POWERPC] Use gmfn_to_mfn() over pfn2mfn()

Should only use pfn2mfn() if you care about the type of memory.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/iommu.c   |7 +++
 xen/arch/powerpc/usercopy.c|   26 +++---
 xen/include/asm-powerpc/debugger.h |5 -
 xen/include/asm-powerpc/page.h |   19 ++-
 4 files changed, 28 insertions(+), 29 deletions(-)

diff -r d1138b71a509 -r 6e451ba8bc03 xen/arch/powerpc/iommu.c
--- a/xen/arch/powerpc/iommu.c  Mon Oct 02 19:55:18 2006 -0400
+++ b/xen/arch/powerpc/iommu.c  Mon Oct 02 21:40:26 2006 -0400
@@ -46,12 +46,11 @@ int iommu_put(u32 buid, ulong ioba, unio
 struct domain *d = v->domain;
 
 if (buid < iommu_phbs_num && iommu_phbs[buid].iommu_put != NULL) {
-ulong pfn;
+ulong gpfn;
 ulong mfn;
-int mtype;
 
-pfn = tce.tce_bits.tce_rpn;
-mfn = pfn2mfn(d, pfn, &mtype);
+gpfn = tce.tce_bits.tce_rpn;
+mfn = gmfn_to_mfn(d, gpfn);
 if (mfn != INVALID_MFN) {
 #ifdef DEBUG
 printk("%s: ioba=0x%lx pfn=0x%lx mfn=0x%lx\n", __func__,
diff -r d1138b71a509 -r 6e451ba8bc03 xen/arch/powerpc/usercopy.c
--- a/xen/arch/powerpc/usercopy.c   Mon Oct 02 19:55:18 2006 -0400
+++ b/xen/arch/powerpc/usercopy.c   Mon Oct 02 21:40:26 2006 -0400
@@ -29,40 +29,20 @@ unsigned long paddr_to_maddr(unsigned lo
 {
 struct vcpu *v = get_current();
 struct domain *d = v->domain;
-int mtype;
-ulong pfn;
+ulong gpfn;
 ulong offset;
 ulong pa = paddr;
 
 offset = pa & ~PAGE_MASK;
-pfn = pa >> PAGE_SHIFT;
+gpfn = pa >> PAGE_SHIFT;
 
-pa = pfn2mfn(d, pfn, &mtype);
+pa = gmfn_to_mfn(d, gpfn);
 if (pa == INVALID_MFN) {
 printk("%s: Dom:%d bad paddr: 0x%lx\n",
__func__, d->domain_id, paddr);
 return 0;
 }
-switch (mtype) {
-case PFN_TYPE_RMA:
-case PFN_TYPE_LOGICAL:
-break;
 
-case PFN_TYPE_FOREIGN:
-/* I don't think this should ever happen, but I suppose it
- * could be possible */
-printk("%s: Dom:%d paddr: 0x%lx type: FOREIGN\n",
-   __func__, d->domain_id, paddr);
-WARN();
-break;
-
-case PFN_TYPE_IO:
-default:
-printk("%s: Dom:%d paddr: 0x%lx bad type: 0x%x\n",
-   __func__, d->domain_id, paddr, mtype);
-WARN();
-return 0;
-}
 pa <<= PAGE_SHIFT;
 pa |= offset;
 
diff -r d1138b71a509 -r 6e451ba8bc03 xen/include/asm-powerpc/debugger.h
--- a/xen/include/asm-powerpc/debugger.hMon Oct 02 19:55:18 2006 -0400
+++ b/xen/include/asm-powerpc/debugger.hMon Oct 02 21:40:26 2006 -0400
@@ -13,13 +13,16 @@
  * 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 (C) IBM Corp. 2005, 2006
  *
  * Authors: Hollis Blanchard <[EMAIL PROTECTED]>
+ *  Jimi Xenidis <[EMAIL PROTECTED]>
  */
 
 #ifndef _ASM_DEBUGGER_H_
 #define _ASM_DEBUGGER_H_
+
+#include 
 
 extern void show_backtrace_regs(struct cpu_user_regs *);
 extern void show_backtrace(ulong sp, ulong lr, ulong pc);
diff -r d1138b71a509 -r 6e451ba8bc03 xen/include/asm-powerpc/page.h
--- a/xen/include/asm-powerpc/page.hMon Oct 02 19:55:18 2006 -0400
+++ b/xen/include/asm-powerpc/page.hMon Oct 02 21:40:26 2006 -0400
@@ -16,6 +16,7 @@
  * Copyright (C) IBM Corp. 2005, 2006
  *
  * Authors: Hollis Blanchard <[EMAIL PROTECTED]>
+ *  Jimi Xenidis <[EMAIL PROTECTED]>
  */
 
 #ifndef _ASM_PAGE_H
@@ -29,6 +30,7 @@
 
 #include 
 #include 
+#include 
 
 #define PFN_DOWN(x)   ((x) >> PAGE_SHIFT)
 #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
@@ -146,7 +148,22 @@ extern unsigned long paddr_to_maddr(unsi
 
 static inline unsigned long gmfn_to_mfn(struct domain *d, unsigned long gmfn)
 {
-return pfn2mfn(d, gmfn, NULL);
+int mtype;
+ulong mfn;
+
+mfn = pfn2mfn(d, gmfn, &mtype);
+if (mfn != INVALID_MFN) {
+switch (mtype) {
+case PFN_TYPE_RMA:
+case PFN_TYPE_LOGICAL:
+break;
+default:
+WARN();
+mfn = INVALID_MFN;
+break;
+}
+}
+return mfn;
 }
 
 #define mfn_to_gmfn(_d, mfn) (mfn)

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Add Function to completely flush the I-Cache for a processor

2006-10-02 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 02f6e775deb1f6aa21154ee43712351a389681af
# Parent  85c482f30a0ab7e9d8730331e77c9e202d8ea6b1
[XEN][POWERPC] Add Function to completely flush the I-Cache for a processor

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/powerpc64/ppc970.c |   27 +++
 xen/include/asm-powerpc/cache.h |1 +
 2 files changed, 28 insertions(+)

diff -r 85c482f30a0a -r 02f6e775deb1 xen/arch/powerpc/powerpc64/ppc970.c
--- a/xen/arch/powerpc/powerpc64/ppc970.c   Mon Oct 02 11:06:10 2006 -0400
+++ b/xen/arch/powerpc/powerpc64/ppc970.c   Mon Oct 02 11:07:54 2006 -0400
@@ -39,10 +39,37 @@ struct cpu_caches cpu_caches = {
 .dline_size = 0x80,
 .log_dline_size = 7,
 .dlines_per_page = PAGE_SIZE >> 7,
+.isize = (64 << 10),/* 64 KiB */
 .iline_size = 0x80,
 .log_iline_size = 7,
 .ilines_per_page = PAGE_SIZE >> 7,
 };
+
+
+void cpu_flush_icache(void)
+{
+union hid1 hid1;
+ulong flags;
+ulong ra;
+
+local_irq_save(flags);
+
+/* uses special processor mode that forces a real address match */
+hid1.word = mfhid1();
+hid1.bits.en_icbi = 1;
+mthid1(hid1.word);
+
+for (ra = 0; ra < cpu_caches.isize; ra += cpu_caches.iline_size)
+icbi(ra);
+
+sync();
+
+hid1.bits.en_icbi = 0;
+mthid1(hid1.word);
+
+local_irq_save(flags);
+}
+
 
 struct rma_settings {
 int log;
diff -r 85c482f30a0a -r 02f6e775deb1 xen/include/asm-powerpc/cache.h
--- a/xen/include/asm-powerpc/cache.h   Mon Oct 02 11:06:10 2006 -0400
+++ b/xen/include/asm-powerpc/cache.h   Mon Oct 02 11:07:54 2006 -0400
@@ -70,4 +70,5 @@ struct cpu_caches {
 u32 ilines_per_page;
 };
 extern struct cpu_caches cpu_caches;
+extern void cpu_flush_icache(void);
 #endif

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Flush all of text per CPU in case the loader did not

2006-10-02 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 85c482f30a0ab7e9d8730331e77c9e202d8ea6b1
# Parent  276d39822a21da138bc409316105d2fa3838
[XEN][POWERPC] Flush all of text per CPU in case the loader did not

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/powerpc64/exceptions.S |   12 
 1 files changed, 12 insertions(+)

diff -r 276d39822a21 -r 85c482f30a0a xen/arch/powerpc/powerpc64/exceptions.S
--- a/xen/arch/powerpc/powerpc64/exceptions.S   Mon Oct 02 11:04:00 2006 -0400
+++ b/xen/arch/powerpc/powerpc64/exceptions.S   Mon Oct 02 11:06:10 2006 -0400
@@ -564,6 +564,18 @@ _GLOBAL(sleep)
  */
 .globl spin_start
 spin_start:
+
+/* Do a cache flush for our text, in case the loader didn't */
+LOADADDR(r9, _start)
+LOADADDR(r8, _etext)
+4:  dcbf r0,r9
+icbi r0,r9
+addi r9,r9,0x20/* up to a 4 way set per line */
+cmpld cr0,r9,r8
+blt4b
+sync
+isync
+
 /* Write our processor number as an acknowledgment that we're alive.  */
 LOADADDR(r14, __spin_ack)
 stw r3, 0(r14)

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] go ultra conservative on CI IO routines

2006-10-02 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 276d39822a21da138bc409316105d2fa3838
# Parent  77373497916f9e24939bf4d9549ba7c67c02c73f
[XEN][POWERPC] go ultra conservative on CI IO routines

The following patch contains:
 - Code that uses SLBIE for ERAT flush rather than TLBIE.  Erratum #16
   says to use SLBIE bit a TLBIE should do it and is "less
   distruptive".
 - Machine Check issues
   - Track CI mode while cache is still enabled
   - Use r7 to indicate that the IO is still pending while CI is on
 - The right sync for the right reasons

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/powerpc64/io.S |   65 ++--
 1 files changed, 50 insertions(+), 15 deletions(-)

diff -r 77373497916f -r 276d39822a21 xen/arch/powerpc/powerpc64/io.S
--- a/xen/arch/powerpc/powerpc64/io.S   Sun Oct 01 20:40:44 2006 -0400
+++ b/xen/arch/powerpc/powerpc64/io.S   Mon Oct 02 11:04:00 2006 -0400
@@ -23,6 +23,11 @@
 #include 
 #include 
 
+/* There is no reason why I can't use a tlbie, which should be less
+ * "destructive" but useing SLBIE proves to be more stable result.
+ */
+#define INVALIDATE_ERAT_WITH_SLBIE
+
 /* Xen runs in real mode (i.e. untranslated, MMU disabled). This avoids TLB
  * flushes and also makes it easy to access all domains' memory. However, on
  * PowerPC real mode accesses are cacheable, which is good for general
@@ -34,12 +39,14 @@
  * make the access, then re-enable it...
  */
 
+#ifdef INVALIDATE_ERAT_WITH_SLBIE
 /* Not all useful assemblers understand 'tlbiel'.
  * 'addr' is a GPR containing the address being accessed.
  */
 .macro tlbiel addr
.long 0x7c000224 | (\addr << 11)
 .endm
+#endif
 
 .macro DISABLE_DCACHE addr
mfmsr r8
@@ -48,29 +55,53 @@
ori r6, r6, MSR_EE
andc r5, r8, r6
mtmsr r5
+   sync
 
-   /* set HID4.RM_CI */
+#ifdef INVALIDATE_ERAT_WITH_SLBIE 
+   /* create an slbie entry for the io setting a high order bit
+* to avoid any important SLBs */
+   extldi r0, \addr, 36, 0 
+#endif
+   /* setup HID4.RM_CI */
mfspr r9, SPRN_HID4
li r6, 0x100
sldi r6, r6, 32
-   or r5, r9, r6
-   tlbiel \addr /* invalidate the ERAT entry */
-   sync
-   mtspr SPRN_HID4, r5
+   or r10, r9, r6
+
+   /* Mark the processor as "in CI mode" */
+   li r7,0
+   mfspr r5, SPRN_PIR
+   li r6, MCK_CPU_STAT_CI
+   /* store that we are in a CI routine */
+   stb r6, MCK_CPU_STAT_BASE(r5)
+   /* r7 = MCK_CPU_STAT_CI IO in progress */
+   mr r7, r5
+   lwsync
+
+   /* switch modes */
+   mtspr SPRN_HID4, r10
+   /* invalidate the ERAT entry */
+#ifdef INVALIDATE_ERAT_WITH_SLBIE
+   slbie r0
+#else
+   tlbiel \addr
+#endif
isync
 
-   /* Mark the processor as "in CI mode" */
-   mfspr r5, SPRN_PIR
-   li r6, MCK_CPU_STAT_CI
-   stb r6, MCK_CPU_STAT_BASE(r5)
-   sync
 .endm
 
 .macro ENABLE_DCACHE addr
-   /* re-zero HID4.RM_CI */
+   /* r7 = 0, IO is complete */
+   li r7, 0
+   lwsync
+   /* restore HID4.RM_CI */
+   mtspr SPRN_HID4, r9
+   /* invalidate the ERAT entry */
+#ifdef INVALIDATE_ERAT_WITH_SLBIE
+   slbie r0
+#else
tlbiel \addr /* invalidate the ERAT entry */
-   sync
-   mtspr SPRN_HID4, r9
+#endif
isync
 
/* Mark the processor as "out of CI mode" */
@@ -83,9 +114,13 @@
mtmsr r8
 .endm
 
-/* The following assembly cannot use r8 or r9 since they hold original
- * values of msr and hid4 repectively
+/* The following assembly cannot use some registers since they hold original
+ * values of we need to keep
  */
+#undef r0
+#define r0 do_not_use_r0
+#undef r7
+#define r7 do_not_use_r7
 #undef r8
 #define r8 do_not_use_r8
 #undef r9

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] oops on debug build break

2006-10-01 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 77373497916f9e24939bf4d9549ba7c67c02c73f
# Parent  b91cda0fb75535d2008191ef259ecf2441edae23
[XEN][POWERPC] oops on debug build break

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/papr/xlate.c |   14 ++
 1 files changed, 6 insertions(+), 8 deletions(-)

diff -r b91cda0fb755 -r 77373497916f xen/arch/powerpc/papr/xlate.c
--- a/xen/arch/powerpc/papr/xlate.c Sun Oct 01 08:38:38 2006 -0400
+++ b/xen/arch/powerpc/papr/xlate.c Sun Oct 01 20:40:44 2006 -0400
@@ -378,7 +378,6 @@ static void h_protect(struct cpu_user_re
 
 static void h_clear_ref(struct cpu_user_regs *regs)
 {
-ulong flags = regs->gprs[4];
 ulong ptex = regs->gprs[5];
 struct vcpu *v = get_current();
 struct domain *d = v->domain;
@@ -387,13 +386,13 @@ static void h_clear_ref(struct cpu_user_
 union pte lpte;
 
 DBG_LOW("%s: flags: 0x%lx ptex: 0x%lx\n", __func__,
-flags, ptex);
+regs->gprs[4], ptex);
 
 #ifdef DEBUG
-if (flags != 0) {
+if (regs->gprs[4] != 0) {
 DBG("WARNING: %s: "
 "flags are undefined and should be 0: 0x%lx\n",
-__func__, flags);
+__func__, regs->gprs[4]);
 }
 #endif
 
@@ -421,7 +420,6 @@ static void h_clear_ref(struct cpu_user_
 
 static void h_clear_mod(struct cpu_user_regs *regs)
 {
-ulong flags = regs->gprs[4];
 ulong ptex = regs->gprs[5];
 struct vcpu *v = get_current();
 struct domain *d = v->domain;
@@ -430,13 +428,13 @@ static void h_clear_mod(struct cpu_user_
 union pte lpte;
 
 DBG_LOW("%s: flags: 0x%lx ptex: 0x%lx\n", __func__,
-   flags, ptex);
+  regs->gprs[4], ptex);
 
 #ifdef DEBUG
-if (flags != 0) {
+if (regs->gprs[4] != 0) {
 DBG("WARNING: %s: "
 "flags are undefined and should be 0: 0x%lx\n",
-__func__, flags);
+__func__, regs->gprs[4]);
 }
 #endif
 

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Improve the debugging strategy of these hcalls.

2006-10-01 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID b91cda0fb75535d2008191ef259ecf2441edae23
# Parent  7de08aceff6de9569c6723c8283f6a653f1e90ea
[XEN][POWERPC] Improve the debugging strategy of these hcalls.

This patch cleans up all the variaus printk()s.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/papr/xlate.c |  132 +-
 1 files changed, 67 insertions(+), 65 deletions(-)

diff -r 7de08aceff6d -r b91cda0fb755 xen/arch/powerpc/papr/xlate.c
--- a/xen/arch/powerpc/papr/xlate.c Fri Sep 29 19:09:26 2006 -0400
+++ b/xen/arch/powerpc/papr/xlate.c Sun Oct 01 08:38:38 2006 -0400
@@ -19,7 +19,7 @@
  */
 
 #undef DEBUG
-#undef DEBUG_FAIL
+#undef DEBUG_LOW
 
 #include 
 #include 
@@ -29,6 +29,17 @@
 #include 
 #include 
 #include 
+
+#ifdef DEBUG
+#define DBG(fmt...) printk(fmt)
+#else
+#define DBG(fmt...)
+#endif
+#ifdef DEBUG_LOW
+#define DBG_LOW(fmt...) printk(fmt)
+#else
+#define DBG_LOW(fmt...)
+#endif
 
 #ifdef USE_PTE_INSERT
 static inline void pte_insert(union pte volatile *pte,
@@ -129,8 +140,8 @@ static void h_enter(struct cpu_user_regs
 
 htab = &d->arch.htab;
 if (ptex > (1UL << htab->log_num_ptes)) {
-regs->gprs[3] = H_Parameter;
-printk("%s: bad ptex: 0x%lx\n", __func__, ptex);
+DBG("%s: bad ptex: 0x%lx\n", __func__, ptex);
+regs->gprs[3] = H_Parameter;
 return;
 }
 
@@ -150,8 +161,8 @@ static void h_enter(struct cpu_user_regs
 }
 
 if ( lp_size >= d->arch.large_page_sizes ) {
-printk("%s: attempt to use unsupported lp_size %d\n",
-   __func__, lp_size);
+DBG("%s: attempt to use unsupported lp_size %d\n",
+__func__, lp_size);
 regs->gprs[3] = H_Parameter;
 return;
 }
@@ -168,6 +179,7 @@ static void h_enter(struct cpu_user_regs
 
 mfn = pfn2mfn(d, pfn, &mtype);
 if (mfn == INVALID_MFN) {
+DBG("%s: Bad PFN: 0x%lx\n", __func__, pfn);
 regs->gprs[3] =  H_Parameter;
 return;
 }
@@ -175,21 +187,19 @@ static void h_enter(struct cpu_user_regs
 if (mtype == PFN_TYPE_IO) {
 /* only a privilaged dom can access outside IO space */
 if ( !test_bit(_DOMF_privileged, &d->domain_flags) ) {
+DBG("%s: unprivileged access to physical page: 0x%lx\n",
+__func__, pfn);
 regs->gprs[3] =  H_Privilege;
-printk("%s: unprivileged access to physical page: 0x%lx\n",
-   __func__, pfn);
 return;
 }
 
 if ( !((pte.bits.w == 0)
  && (pte.bits.i == 1)
  && (pte.bits.g == 1)) ) {
-#ifdef DEBUG_FAIL
-printk("%s: expecting an IO WIMG "
-   "w=%x i=%d m=%d, g=%d\n word 0x%lx\n", __func__,
-   pte.bits.w, pte.bits.i, pte.bits.m, pte.bits.g,
-   pte.words.rpn);
-#endif
+DBG("%s: expecting an IO WIMG "
+"w=%x i=%d m=%d, g=%d\n word 0x%lx\n", __func__,
+pte.bits.w, pte.bits.i, pte.bits.m, pte.bits.g,
+pte.words.rpn);
 regs->gprs[3] =  H_Parameter;
 return;
 }
@@ -213,11 +223,13 @@ static void h_enter(struct cpu_user_regs
 BUG_ON(f == d);
 
 if (unlikely(!get_domain(f))) {
+DBG("%s: Rescinded, no domain: 0x%lx\n",  __func__, pfn);
 regs->gprs[3] = H_Rescinded;
 return;
 }
 if (unlikely(!get_page(pg, f))) {
 put_domain(f);
+DBG("%s: Rescinded, no page: 0x%lx\n",  __func__, pfn);
 regs->gprs[3] = H_Rescinded;
 return;
 }
@@ -283,10 +295,8 @@ static void h_enter(struct cpu_user_regs
 }
 }
 
-#ifdef DEBUG
 /* If the PTEG is full then no additional values are returned. */
-printk("%s: PTEG FULL\n", __func__);
-#endif
+DBG("%s: PTEG FULL\n", __func__);
 
 if (pg != NULL)
 put_page(pg);
@@ -308,13 +318,11 @@ static void h_protect(struct cpu_user_re
 union pte volatile *ppte;
 union pte lpte;
 
-#ifdef DEBUG
-printk("%s: flags: 0x%lx ptex: 0x%lx avpn: 0x%lx\n", __func__,
-   flags, ptex, avpn);
-#endif
+DBG_LOW("%s: flags: 0x%lx ptex: 0x%lx avpn: 0x%lx\n", __func__,
+flags, ptex, avpn);
 if ( ptex > (1UL << htab->log_num_ptes) ) {
-regs->gprs[3] = H_Parameter;
-printk("%s: bad ptex: 0x%lx\n", __func__, ptex);
+DBG("%s: bad ptex: 0x%lx\n", __func__, ptex);
+regs->gprs[3] = H_Parameter;
 return;
 }
 ppte = &htab->map[ptex];
@@ -324,10 +332,8 @@ static void h_protect(struct cpu_user_re
 
 /* the AVPN param occupies the bit-space of the word */
 if ( (flags & H_AVPN) && lpte.bits.avpn != avpn >> 7 ) {
-#ifdef DEBUG_FAIL
-printk("%s: %p: AVPN check failed: 0x%lx, 0x%lx\n", __func__,
-ppte, lpte.words.vsid, lpte.words

[XenPPC] [xenppc-unstable] [XEN][POWERPC] Conistence with log vs. order

2006-09-30 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 3bf1684f032ebf5ccabda8f0a7cc10757061b0bf
# Parent  2e219f06f9a407d13248ea7a389373a23028c426
[XEN][POWERPC] Conistence with log vs. order

We use "log" for a log2 value, "order" is the log2 of page size, so:
  order = log - PAGE_SHIFT

It is confusing, but more so if we are not consistent.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/domctl.c   |6 ++---
 xen/arch/powerpc/powerpc64/ppc970.c |   37 ++--
 xen/include/asm-powerpc/processor.h |2 -
 3 files changed, 23 insertions(+), 22 deletions(-)

diff -r 2e219f06f9a4 -r 3bf1684f032e xen/arch/powerpc/domctl.c
--- a/xen/arch/powerpc/domctl.c Thu Sep 28 22:31:23 2006 -0400
+++ b/xen/arch/powerpc/domctl.c Fri Sep 29 09:53:39 2006 -0400
@@ -96,14 +96,14 @@ long arch_do_domctl(struct xen_domctl *d
 case XEN_DOMCTL_real_mode_area:
 {
 struct domain *d;
-unsigned int log = domctl->u.real_mode_area.log;
+unsigned int order = domctl->u.real_mode_area.log - PAGE_SHIFT;
 
 ret = -ESRCH;
 d = find_domain_by_id(domctl->domain);
 if (d != NULL) {
 ret = -EINVAL;
-if (cpu_rma_valid(log))
-ret = allocate_rma(d, log - PAGE_SHIFT);
+if (cpu_rma_valid(order))
+ret = allocate_rma(d, order);
 put_domain(d);
 }
 }
diff -r 2e219f06f9a4 -r 3bf1684f032e xen/arch/powerpc/powerpc64/ppc970.c
--- a/xen/arch/powerpc/powerpc64/ppc970.c   Thu Sep 28 22:31:23 2006 -0400
+++ b/xen/arch/powerpc/powerpc64/ppc970.c   Fri Sep 29 09:53:39 2006 -0400
@@ -45,42 +45,43 @@ struct cpu_caches cpu_caches = {
 };
 
 struct rma_settings {
-int order;
+int log;
 int rmlr_0;
 int rmlr_1_2;
 };
 
-static struct rma_settings rma_orders[] = {
-{ .order = 26, .rmlr_0 = 0, .rmlr_1_2 = 3, }, /*  64 MB */
-{ .order = 27, .rmlr_0 = 1, .rmlr_1_2 = 3, }, /* 128 MB */
-{ .order = 28, .rmlr_0 = 1, .rmlr_1_2 = 0, }, /* 256 MB */
-{ .order = 30, .rmlr_0 = 0, .rmlr_1_2 = 2, }, /*   1 GB */
-{ .order = 34, .rmlr_0 = 0, .rmlr_1_2 = 1, }, /*  16 GB */
-{ .order = 38, .rmlr_0 = 0, .rmlr_1_2 = 0, }, /* 256 GB */
+static struct rma_settings rma_logs[] = {
+{ .log = 26, .rmlr_0 = 0, .rmlr_1_2 = 3, }, /*  64 MB */
+{ .log = 27, .rmlr_0 = 1, .rmlr_1_2 = 3, }, /* 128 MB */
+{ .log = 28, .rmlr_0 = 1, .rmlr_1_2 = 0, }, /* 256 MB */
+{ .log = 30, .rmlr_0 = 0, .rmlr_1_2 = 2, }, /*   1 GB */
+{ .log = 34, .rmlr_0 = 0, .rmlr_1_2 = 1, }, /*  16 GB */
+{ .log = 38, .rmlr_0 = 0, .rmlr_1_2 = 0, }, /* 256 GB */
 };
 
 static uint log_large_page_sizes[] = {
 4 + 20, /* (1 << 4) == 16M */
 };
 
-static struct rma_settings *cpu_find_rma(unsigned int order)
+static struct rma_settings *cpu_find_rma(unsigned int log)
 {
 int i;
-for (i = 0; i < ARRAY_SIZE(rma_orders); i++) {
-if (rma_orders[i].order == order)
-return &rma_orders[i];
+
+for (i = 0; i < ARRAY_SIZE(rma_logs); i++) {
+if (rma_logs[i].log == log)
+return &rma_logs[i];
 }
 return NULL;
 }
 
 unsigned int cpu_default_rma_order_pages(void)
 {
-return rma_orders[0].order - PAGE_SHIFT;
-}
-
-int cpu_rma_valid(unsigned int log)
-{
-return cpu_find_rma(log) != NULL;
+return rma_logs[0].log - PAGE_SHIFT;
+}
+
+int cpu_rma_valid(unsigned int order)
+{
+return cpu_find_rma(order + PAGE_SHIFT) != NULL;
 }
 
 unsigned int cpu_large_page_orders(uint *sizes, uint max)
diff -r 2e219f06f9a4 -r 3bf1684f032e xen/include/asm-powerpc/processor.h
--- a/xen/include/asm-powerpc/processor.h   Thu Sep 28 22:31:23 2006 -0400
+++ b/xen/include/asm-powerpc/processor.h   Fri Sep 29 09:53:39 2006 -0400
@@ -120,7 +120,7 @@ extern void show_registers(struct cpu_us
 extern void show_registers(struct cpu_user_regs *);
 extern unsigned int cpu_extent_order(void);
 extern unsigned int cpu_default_rma_order_pages(void);
-extern int cpu_rma_valid(unsigned int log);
+extern int cpu_rma_valid(unsigned int order);
 extern uint cpu_large_page_orders(uint *sizes, uint max);
 extern void cpu_initialize(int cpuid);
 extern void cpu_init_vcpu(struct vcpu *);

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Remove limit on the page frame table

2006-09-30 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 2e219f06f9a407d13248ea7a389373a23028c426
# Parent  c9bf3af5624b6186e665e6d8d783ff92a5b3afce
[XEN][POWERPC] Remove limit on the page frame table

Dunno where the limit came from, but it is the reason we were
asserting in the page allocator.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/mm.c |2 --
 1 files changed, 2 deletions(-)

diff -r c9bf3af5624b -r 2e219f06f9a4 xen/arch/powerpc/mm.c
--- a/xen/arch/powerpc/mm.c Thu Sep 28 12:34:01 2006 -0400
+++ b/xen/arch/powerpc/mm.c Thu Sep 28 22:31:23 2006 -0400
@@ -164,8 +164,6 @@ void __init init_frametable(void)
 int i;
 
 nr_pages = PFN_UP(max_page * sizeof(struct page_info));
-nr_pages = min(nr_pages, (4UL << (20 - PAGE_SHIFT)));
-
 
 p = alloc_boot_pages(nr_pages, 1);
 if (p == 0)

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] compress all extents into a single LMB

2006-09-30 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 7de08aceff6de9569c6723c8283f6a653f1e90ea
# Parent  c7fa7c41b9e60cf90feddea8c15f015f436b
[XEN][POWERPC] compress all extents into a single LMB

Linux prom code has a static limit.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/ofd_fixup_memory.c |   18 ++
 1 files changed, 10 insertions(+), 8 deletions(-)

diff -r c7fa7c41b9e6 -r 7de08aceff6d xen/arch/powerpc/ofd_fixup_memory.c
--- a/xen/arch/powerpc/ofd_fixup_memory.c   Fri Sep 29 14:31:05 2006 -0400
+++ b/xen/arch/powerpc/ofd_fixup_memory.c   Fri Sep 29 19:09:26 2006 -0400
@@ -68,6 +68,8 @@ static ofdn_t ofd_memory_node_create(
 reg.sz = size;
 ofd_prop_add(m, n, "reg", ®, sizeof (reg));
 
+printk("Dom0: %s: %016lx, %016lx\n", path, start, size);
+
 return n;
 }
 
@@ -88,17 +90,17 @@ static void ofd_memory_extent_nodes(void
 struct page_extents *pe;
 ulong cur_pfn = 1UL << d->arch.rma_order;
 
+start = cur_pfn << PAGE_SHIFT;
+size = 0;
 list_for_each_entry (pe, &d->arch.extent_list, pe_list) {
 
-start = cur_pfn << PAGE_SHIFT;
-size = 1UL << (pe->order + PAGE_SHIFT);
-
-n = ofd_memory_node_create(m, OFD_ROOT, "", memory, memory,
-start, size);
-
-BUG_ON(n <= 0);
-cur_pfn += 1UL << pe->order;
+size += 1UL << (pe->order + PAGE_SHIFT);
+if (pe->order != cpu_extent_order())
+panic("we don't handle this yet\n");
 }
+n = ofd_memory_node_create(m, OFD_ROOT, "", memory, memory,
+   start, size);
+BUG_ON(n <= 0);
 }
 
 void ofd_memory_props(void *m, struct domain *d)

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Allocate Xen memory area based on the amount of memory

2006-09-30 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID c7fa7c41b9e60cf90feddea8c15f015f436b
# Parent  dbfb5fc0b9b2ccc2f481710da8cf419d91ae40d6
[XEN][POWERPC] Allocate Xen memory area based on the amount of memory

This will make sure that there is enough memory for large HTABs, as well as:
 - enables "xenheap_megabytes=" cmdline option
 - consistently reports on memory system
 - reduces noise in memory.c

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/domain_build.c |3 
 xen/arch/powerpc/memory.c   |  308 ++--
 xen/arch/powerpc/setup.c|3 
 3 files changed, 172 insertions(+), 142 deletions(-)

diff -r dbfb5fc0b9b2 -r c7fa7c41b9e6 xen/arch/powerpc/domain_build.c
--- a/xen/arch/powerpc/domain_build.c   Fri Sep 29 11:29:32 2006 -0400
+++ b/xen/arch/powerpc/domain_build.c   Fri Sep 29 14:31:05 2006 -0400
@@ -178,8 +178,7 @@ int construct_dom0(struct domain *d,
 shadow_set_allocation(d, opt_dom0_shadow, &preempt);
 } while (preempt);
 if (shadow_get_allocation(d) == 0)
-panic("shadow allocation failed 0x%x < 0x%x\n",
-  shadow_get_allocation(d), opt_dom0_shadow);
+panic("shadow allocation failed: %dMib\n", opt_dom0_shadow);
 
 ASSERT( image_len < rma_sz );
 
diff -r dbfb5fc0b9b2 -r c7fa7c41b9e6 xen/arch/powerpc/memory.c
--- a/xen/arch/powerpc/memory.c Fri Sep 29 11:29:32 2006 -0400
+++ b/xen/arch/powerpc/memory.c Fri Sep 29 14:31:05 2006 -0400
@@ -24,7 +24,26 @@
 #include "oftree.h"
 #include "rtas.h"
 
+#undef DEBUG
+#ifdef DEBUG
+#define DBG(fmt...) printk(fmt)
+#else
+#define DBG(fmt...)
+#endif
+
+/*
+ * opt_xenheap_megabytes: Size of Xen heap in megabytes, excluding the
+ * page_info table and allocation bitmap.
+ */
+static unsigned int opt_xenheap_megabytes = XENHEAP_DEFAULT_MB;
+integer_param("xenheap_megabytes", opt_xenheap_megabytes);
+
 unsigned long xenheap_phys_end;
+static uint nr_pages;
+static ulong xenheap_size;
+static ulong save_start;
+static ulong save_end;
+
 struct membuf {
 ulong start;
 ulong size;
@@ -34,14 +53,143 @@ typedef void (*walk_mem_fn)(struct membu
 
 static ulong free_xenheap(ulong start, ulong end)
 {
-ulong save_start;
-ulong save_end;
-
 start = ALIGN_UP(start, PAGE_SIZE);
 end = ALIGN_DOWN(end, PAGE_SIZE);
 
-printk("%s: 0x%lx - 0x%lx\n", __func__, start, end);
-
+DBG("%s: 0x%lx - 0x%lx\n", __func__, start, end);
+
+/* need to do this better */
+if (save_start <= end && save_start >= start) {
+DBG("%s: Go around the saved area: 0x%lx - 0x%lx\n",
+   __func__, save_start, save_end);
+init_xenheap_pages(start, ALIGN_DOWN(save_start, PAGE_SIZE));
+xenheap_size += ALIGN_DOWN(save_start, PAGE_SIZE) - start;
+
+init_xenheap_pages(ALIGN_UP(save_end, PAGE_SIZE), end);
+xenheap_size += end - ALIGN_UP(save_end, PAGE_SIZE);
+} else {
+init_xenheap_pages(start, end);
+xenheap_size += end - start;
+}
+
+return ALIGN_UP(end, PAGE_SIZE);
+}
+
+static void set_max_page(struct membuf *mb, uint entries)
+{
+int i;
+
+for (i = 0; i < entries; i++) {
+ulong end_page;
+
+printk("  %016lx: %016lx\n", mb[i].start, mb[i].size);
+nr_pages += mb[i].size >> PAGE_SHIFT;
+
+end_page = (mb[i].start + mb[i].size) >> PAGE_SHIFT;
+if (end_page > max_page)
+max_page = end_page;
+}
+}
+
+/* mark all memory from modules onward as unused */
+static void heap_init(struct membuf *mb, uint entries)
+{
+int i;
+ulong start_blk;
+ulong end_blk = 0;
+
+   for (i = 0; i < entries; i++) {
+   start_blk = mb[i].start;
+   end_blk = start_blk + mb[i].size;
+
+   if (start_blk < xenheap_phys_end) {
+if (xenheap_phys_end > end_blk) {
+panic("xenheap spans LMB\n");
+}
+if (xenheap_phys_end == end_blk)
+continue;
+
+start_blk = xenheap_phys_end;
+}
+
+init_boot_pages(start_blk, end_blk);
+total_pages += (end_blk - start_blk) >> PAGE_SHIFT;
+   }
+}
+
+static void ofd_walk_mem(void *m, walk_mem_fn fn)
+{
+ofdn_t n;
+uint p_len;
+struct membuf mb[8];
+static char name[] = "memory";
+
+n = ofd_node_find_by_prop(m, OFD_ROOT, "device_type", name, sizeof(name));
+while (n > 0) {
+
+p_len = ofd_getprop(m, n, "reg", mb, sizeof (mb));
+if (p_len <= 0) {
+panic("ofd_getprop(): failed\n");
+}
+if (p_len > sizeof(mb))
+panic("%s: buffer is not big enuff for this firmware: "
+  "0x%lx < 0x%x\n", __func__, sizeof(mb), p_len);
+
+fn(mb, p_len / sizeof(mb[0]));
+n = ofd_node_find_next(m, n);
+}
+}
+
+static void setup_xenheap(module_t *mod, int mcount)
+{
+int i;
+ulong freemem;
+
+freemem = ALIGN_UP((ulong)_end, PAGE_SIZE);
+
+for (i

Re: [XenPPC] [xenppc-unstable] [XEN][POWERPC] Allow Xen to use RTAS if available

2006-09-28 Thread Jimi Xenidis
If you wish to actually have Xen reboot you will need to set  
crash_debug=n since xen will call out to the debugger if dom0 dies

-JX

On Sep 28, 2006, at 12:40 PM, Xen patchbot-xenppc-unstable wrote:


# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID c9bf3af5624b6186e665e6d8d783ff92a5b3afce
# Parent  2aa9a65408bc10594cd2488f6640574f5ea67549
[XEN][POWERPC] Allow Xen to use RTAS if available

If FW provides an RTAS layer, it will be instantiated and Xen will try
to use it for power control (halt, reboot, power-off, etc).  Xen will
also communicate to Dom0 (using /xen/power-control in the devtree)
when Xen cannot control power and it is hoped that the domain can,
especially useful for Maple boards running non-RTAS versions of PIBS.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/boot_of.c |  210 + 
+---

 xen/arch/powerpc/domain.c  |   17 ++
 xen/arch/powerpc/memory.c  |   26 +++-
 xen/arch/powerpc/ofd_fixup.c   |5
 xen/arch/powerpc/rtas.c|   84 ++
 xen/arch/powerpc/rtas.h|   34 +
 xen/arch/powerpc/setup.c   |   15 +-
 xen/include/asm-powerpc/debugger.h |   10 +
 8 files changed, 321 insertions(+), 80 deletions(-)

diff -r 2aa9a65408bc -r c9bf3af5624b xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.cTue Sep 26 14:01:11 2006 -0400
+++ b/xen/arch/powerpc/boot_of.cThu Sep 28 12:34:01 2006 -0400
@@ -32,6 +32,7 @@
 #include "exceptions.h"
 #include "of-devtree.h"
 #include "oftree.h"
+#include "rtas.h"

 /* Secondary processors use this for handshaking with main  
processor.  */

 volatile unsigned int __spin_ack;
@@ -68,7 +69,6 @@ static int bof_chosen;
 static int bof_chosen;

 static struct of_service s;
-extern s32 prom_call(void *arg, ulong rtas_base, ulong func, ulong  
msr);


 static int __init of_call(
 const char *service, u32 nargs, u32 nrets, s32 rets[], ...)
@@ -359,6 +359,14 @@ static int __init of_getparent(int ph)
 of_call("parent", 1, 1, rets, ph);

 DBG("getparent 0x%x -> 0x%x\n", ph, rets[0]);
+return rets[0];
+}
+
+static int __init of_open(const char *devspec)
+{
+int rets[1] = { OF_FAILURE };
+
+of_call("open", 1, 1, rets, devspec);
 return rets[0];
 }

@@ -500,7 +508,8 @@ static int save_props(void *m, ofdn_t n,
 of_panic("obj array not big enough for 0x%x 
\n", sz);

 }
 actual = of_getprop(pkg, name, obj, sz);
-if (actual > sz) of_panic("obj too small");
+if (actual > sz)
+of_panic("obj too small");
 }

 if (strncmp(name, name_str, sizeof(name_str)) == 0) {
@@ -512,7 +521,8 @@ static int save_props(void *m, ofdn_t n,
 }

 pos = ofd_prop_add(m, n, name, obj, actual);
-if (pos == 0) of_panic("prop_create");
+if (pos == 0)
+of_panic("prop_create");
 }

 result = of_nextprop(pkg, name, name);
@@ -536,10 +546,12 @@ retry:

 if (pnext != 0) {
 sz = of_package_to_path(pnext, path, psz);
-if (sz == OF_FAILURE) of_panic("bad path\n");
+if (sz == OF_FAILURE)
+of_panic("bad path\n");

 nnext = ofd_node_child_create(m, n, path, sz);
-if (nnext == 0) of_panic("out of mem\n");
+if (nnext == 0)
+of_panic("out of mem\n");

 do_pkg(m, nnext, pnext, path, psz);
 }
@@ -551,7 +563,8 @@ retry:
 sz = of_package_to_path(pnext, path, psz);

 nnext = ofd_node_peer_create(m, n, path, sz);
-if (nnext <= 0) of_panic("out of space in OFD tree.\n");
+if (nnext <= 0)
+of_panic("out of space in OFD tree.\n");

 n = nnext;
 p = pnext;
@@ -570,7 +583,8 @@ static int pkg_save(void *mem)

 /* get root */
 root = of_getpeer(0);
-if (root == OF_FAILURE) of_panic("no root package\n");
+if (root == OF_FAILURE)
+of_panic("no root package\n");

 do_pkg(mem, OFD_ROOT, root, path, sizeof(path));

@@ -604,7 +618,8 @@ static int boot_of_fixup_refs(void *mem)
 char ofpath[256];

 path = ofd_node_path(mem, c);
-if (path == NULL) of_panic("no path to found prop: %s 
\n", name);

+if (path == NULL)
+of_panic("no path to found prop: %s\n", name);

 rp = of_finddevice(path);
 if (rp == OF_FAILURE)
@@ -629,13 +644,15 @@ static int boot_of_fixup_refs(void *mem)
  "ref 0x%x\n", name, path, rp, ref);

 dp = ofd_node_find(mem, ofpath);
-if (dp <= 0) of_panic("no ofd node for OF node[0x%x]: % 
s\n",

-  ref, ofpath);
+if (dp <= 0)
+of_panic("no ofd node for OF node[0x%x]: %s\n",
+ ref, ofpath);

 ref = dp;

 upd = ofd_pro

[XenPPC] [xenppc-unstable] [XEN][POWERPC] Allow Xen to use RTAS if available

2006-09-28 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID c9bf3af5624b6186e665e6d8d783ff92a5b3afce
# Parent  2aa9a65408bc10594cd2488f6640574f5ea67549
[XEN][POWERPC] Allow Xen to use RTAS if available

If FW provides an RTAS layer, it will be instantiated and Xen will try
to use it for power control (halt, reboot, power-off, etc).  Xen will
also communicate to Dom0 (using /xen/power-control in the devtree)
when Xen cannot control power and it is hoped that the domain can,
especially useful for Maple boards running non-RTAS versions of PIBS.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/boot_of.c |  210 ++---
 xen/arch/powerpc/domain.c  |   17 ++
 xen/arch/powerpc/memory.c  |   26 +++-
 xen/arch/powerpc/ofd_fixup.c   |5 
 xen/arch/powerpc/rtas.c|   84 ++
 xen/arch/powerpc/rtas.h|   34 +
 xen/arch/powerpc/setup.c   |   15 +-
 xen/include/asm-powerpc/debugger.h |   10 +
 8 files changed, 321 insertions(+), 80 deletions(-)

diff -r 2aa9a65408bc -r c9bf3af5624b xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.cTue Sep 26 14:01:11 2006 -0400
+++ b/xen/arch/powerpc/boot_of.cThu Sep 28 12:34:01 2006 -0400
@@ -32,6 +32,7 @@
 #include "exceptions.h"
 #include "of-devtree.h"
 #include "oftree.h"
+#include "rtas.h"
 
 /* Secondary processors use this for handshaking with main processor.  */
 volatile unsigned int __spin_ack;
@@ -68,7 +69,6 @@ static int bof_chosen;
 static int bof_chosen;
 
 static struct of_service s;
-extern s32 prom_call(void *arg, ulong rtas_base, ulong func, ulong msr);
 
 static int __init of_call(
 const char *service, u32 nargs, u32 nrets, s32 rets[], ...)
@@ -359,6 +359,14 @@ static int __init of_getparent(int ph)
 of_call("parent", 1, 1, rets, ph);
 
 DBG("getparent 0x%x -> 0x%x\n", ph, rets[0]);
+return rets[0];
+}
+
+static int __init of_open(const char *devspec)
+{
+int rets[1] = { OF_FAILURE };
+
+of_call("open", 1, 1, rets, devspec);
 return rets[0];
 }
 
@@ -500,7 +508,8 @@ static int save_props(void *m, ofdn_t n,
 of_panic("obj array not big enough for 0x%x\n", sz);
 }
 actual = of_getprop(pkg, name, obj, sz);
-if (actual > sz) of_panic("obj too small");
+if (actual > sz)
+of_panic("obj too small");
 }
 
 if (strncmp(name, name_str, sizeof(name_str)) == 0) {
@@ -512,7 +521,8 @@ static int save_props(void *m, ofdn_t n,
 }
 
 pos = ofd_prop_add(m, n, name, obj, actual);
-if (pos == 0) of_panic("prop_create");
+if (pos == 0)
+of_panic("prop_create");
 }
 
 result = of_nextprop(pkg, name, name);
@@ -536,10 +546,12 @@ retry:
 
 if (pnext != 0) {
 sz = of_package_to_path(pnext, path, psz);
-if (sz == OF_FAILURE) of_panic("bad path\n");
+if (sz == OF_FAILURE)
+of_panic("bad path\n");
 
 nnext = ofd_node_child_create(m, n, path, sz);
-if (nnext == 0) of_panic("out of mem\n");
+if (nnext == 0)
+of_panic("out of mem\n");
 
 do_pkg(m, nnext, pnext, path, psz);
 }
@@ -551,7 +563,8 @@ retry:
 sz = of_package_to_path(pnext, path, psz);
 
 nnext = ofd_node_peer_create(m, n, path, sz);
-if (nnext <= 0) of_panic("out of space in OFD tree.\n");
+if (nnext <= 0)
+of_panic("out of space in OFD tree.\n");
 
 n = nnext;
 p = pnext;
@@ -570,7 +583,8 @@ static int pkg_save(void *mem)
 
 /* get root */
 root = of_getpeer(0);
-if (root == OF_FAILURE) of_panic("no root package\n");
+if (root == OF_FAILURE)
+of_panic("no root package\n");
 
 do_pkg(mem, OFD_ROOT, root, path, sizeof(path));
 
@@ -604,7 +618,8 @@ static int boot_of_fixup_refs(void *mem)
 char ofpath[256];
 
 path = ofd_node_path(mem, c);
-if (path == NULL) of_panic("no path to found prop: %s\n", name);
+if (path == NULL)
+of_panic("no path to found prop: %s\n", name);
 
 rp = of_finddevice(path);
 if (rp == OF_FAILURE)
@@ -629,13 +644,15 @@ static int boot_of_fixup_refs(void *mem)
  "ref 0x%x\n", name, path, rp, ref);
 
 dp = ofd_node_find(mem, ofpath);
-if (dp <= 0) of_panic("no ofd node for OF node[0x%x]: %s\n",
-  ref, ofpath);
+if (dp <= 0)
+of_panic("no ofd node for OF node[0x%x]: %s\n",
+ ref, ofpath);
 
 ref = dp;
 
 upd = ofd_prop_add(mem, c, name, &ref, sizeof(ref));
-if (upd <= 0) of_panic("update failed: %s\n", name);
+if (upd <= 0)
+of_panic("update failed: %s\n", name);
 
 #ifdef D

[XenPPC] [xenppc-unstable] [XEN][POWERPC] Backoff the SCOM stuff by default

2006-09-26 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID af1380a08804aed15a04f3dd60c5e56011e68d06
# Parent  acfb1ac23f80286c8b532052f5e4b77f33612636
[XEN][POWERPC] Backoff the SCOM stuff by default

Sadly the SCOM stuff is proving to be unstable for various versions of
the chip.  I'm turning it off by default.  Also adding some PVR
decoding logic.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/powerpc64/ppc970_scom.c |   25 +++--
 xen/include/asm-powerpc/processor.h  |   79 +++
 2 files changed, 98 insertions(+), 6 deletions(-)

diff -r acfb1ac23f80 -r af1380a08804 xen/arch/powerpc/powerpc64/ppc970_scom.c
--- a/xen/arch/powerpc/powerpc64/ppc970_scom.c  Mon Sep 25 11:19:55 2006 -0400
+++ b/xen/arch/powerpc/powerpc64/ppc970_scom.c  Tue Sep 26 12:42:33 2006 -0400
@@ -24,7 +24,10 @@
 #include 
 #include 
 #include 
+#include 
 #include "scom.h"
+
+#undef CONFIG_SCOM
 
 #define SPRN_SCOMC 276
 #define SPRN_SCOMD 277
@@ -153,19 +156,29 @@ int cpu_scom_write(uint addr, ulong d)
 
 void cpu_scom_init(void)
 {
+#ifdef CONFIG_SCOM
 ulong val;
-console_start_sync();
-if (!cpu_scom_read(SCOM_PTSR, &val))
-printk("SCOM PTSR: 0x%016lx\n", val);
+if (PVR_REV(mfpvr()) == 0x0300) {
+/* these address are only good for 970FX */
+console_start_sync();
+if (!cpu_scom_read(SCOM_PTSR, &val))
+printk("SCOM PTSR: 0x%016lx\n", val);
 
-console_end_sync();
+console_end_sync();
+}
+#endif
 }
 
 void cpu_scom_AMCR(void)
 {
+#ifdef CONFIG_SCOM
 ulong val;
 
-cpu_scom_read(SCOM_AMC_REG, &val);
-printk("SCOM AMCR: 0x%016lx\n", val);
+if (PVR_REV(mfpvr()) == 0x0300) {
+/* these address are only good for 970FX */
+cpu_scom_read(SCOM_AMC_REG, &val);
+printk("SCOM AMCR: 0x%016lx\n", val);
+}
+#endif
 }
 
diff -r acfb1ac23f80 -r af1380a08804 xen/include/asm-powerpc/processor.h
--- a/xen/include/asm-powerpc/processor.h   Mon Sep 25 11:19:55 2006 -0400
+++ b/xen/include/asm-powerpc/processor.h   Tue Sep 26 12:42:33 2006 -0400
@@ -30,6 +30,85 @@
 
 /* most assembler do not know this instruction */
 #define HRFID .long 0x4c000224
+
+/* Processor Version Register (PVR) field extraction */
+
+#define PVR_VER(pvr)   (((pvr) >>  16) & 0x)   /* Version field */
+#define PVR_REV(pvr)   (((pvr) >>   0) & 0x)   /* Revison field */
+
+#define __is_processor(pv) (PVR_VER(mfspr(SPRN_PVR)) == (pv))
+
+/*
+ * IBM has further subdivided the standard PowerPC 16-bit version and
+ * revision subfields of the PVR for the PowerPC 403s into the following:
+ */
+
+#define PVR_FAM(pvr)   (((pvr) >> 20) & 0xFFF) /* Family field */
+#define PVR_MEM(pvr)   (((pvr) >> 16) & 0xF)   /* Member field */
+#define PVR_CORE(pvr)  (((pvr) >> 12) & 0xF)   /* Core field */
+#define PVR_CFG(pvr)   (((pvr) >>  8) & 0xF)   /* Configuration field */
+#define PVR_MAJ(pvr)   (((pvr) >>  4) & 0xF)   /* Major revision field */
+#define PVR_MIN(pvr)   (((pvr) >>  0) & 0xF)   /* Minor revision field */
+
+/* Processor Version Numbers */
+
+#define PVR_403GA  0x0020
+#define PVR_403GB  0x00200100
+#define PVR_403GC  0x00200200
+#define PVR_403GCX 0x00201400
+#define PVR_405GP  0x4011
+#define PVR_STB03XXX   0x4031
+#define PVR_NP405H 0x4141
+#define PVR_NP405L 0x4161
+#define PVR_6010x0001
+#define PVR_6020x0005
+#define PVR_6030x0003
+#define PVR_603e   0x0006
+#define PVR_603ev  0x0007
+#define PVR_603r   0x00071000
+#define PVR_6040x0004
+#define PVR_604e   0x0009
+#define PVR_604r   0x000A
+#define PVR_6200x0014
+#define PVR_7400x0008
+#define PVR_750PVR_740
+#define PVR_740P   0x1008
+#define PVR_750P   PVR_740P
+#define PVR_7400   0x000C
+#define PVR_7410   0x800C
+#define PVR_7450   0x8000
+#define PVR_8540   0x8020
+#define PVR_8560   0x8020
+/*
+ * For the 8xx processors, all of them report the same PVR family for
+ * the PowerPC core. The various versions of these processors must be
+ * differentiated by the version number in the Communication Processor
+ * Module (CPM).
+ */
+#define PVR_8210x0050
+#define PVR_823PVR_821
+#define PVR_850PVR_821
+#define PVR_860PVR_821
+#define PVR_8240   0x00810100
+#define PVR_8245   0x80811014
+#define PVR_8260   PVR_8240
+
+/* 64-bit processors */
+/* XXX the prefix should be PVR_, we'll do a global sweep to fix it one day */
+#define PV_NORTHSTAR   0x0033
+#define PV_PULSAR  0x0034
+#define PV_POWER4  0x0035
+#define PV_ICESTAR 0x0036
+#define PV_SSTAR   0x0037
+#define PV_POWER4p 0x0038
+#define PV_970 0x0039
+#define PV_POWER5  0x003A
+#define PV_P

[XenPPC] [xenppc-unstable] [XEN][POWERPC] Allocated wrong order for dummy page

2006-09-26 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 2e303eacce32e5fd3f7b16c92ff034b7117e1d5f
# Parent  af1380a08804aed15a04f3dd60c5e56011e68d06
[XEN][POWERPC] Allocated wrong order for dummy page
This patch makes sure that the dummy page is only 4k not 8k.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/dart.c |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff -r af1380a08804 -r 2e303eacce32 xen/arch/powerpc/dart.c
--- a/xen/arch/powerpc/dart.c   Tue Sep 26 12:42:33 2006 -0400
+++ b/xen/arch/powerpc/dart.c   Tue Sep 26 12:44:20 2006 -0400
@@ -60,8 +60,8 @@ union dart_entry {
 u32 de_word;
 struct {
 u32 de_v:1; /* valid */
-u32 de_rp:1; /* read protected*/
-u32 de_wp:1; /* write protected*/
+u32 de_rp:1; /* read protected */
+u32 de_wp:1; /* write protected */
 u32 _de_res:5;
 u32 de_ppn:24; /* 24 bit Physical Page Number
  * representing address [28:51] */
@@ -98,7 +98,6 @@ static u32 dart_encode(int perm, ulong r
 if (perm & DART_WRITE) {
 e.de_bits.de_wp = 0;
 }
-
 return e.de_word;
 }
 
@@ -263,7 +262,7 @@ static int init_dart(void)
 
 /* Linux uses a dummy page, filling "empty" DART entries with a
reference to this page to capture stray DMA's */
-dummy_page = (ulong)alloc_xenheap_pages(1);
+dummy_page = (ulong)alloc_xenheap_pages(0);
 clear_page((void *)dummy_page);
 dummy_page >>= PAGE_SHIFT;
 

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] U4 DART workaround for functionality

2006-09-26 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 2aa9a65408bc10594cd2488f6640574f5ea67549
# Parent  2e303eacce32e5fd3f7b16c92ff034b7117e1d5f
[XEN][POWERPC] U4 DART workaround for functionality

This patch invalidates the whole DART cache rather than the single
entry.  Until we get single entry invalidating we'll have an obvious
performance issue.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/dart_u4.c |7 +++
 1 files changed, 7 insertions(+)

diff -r 2e303eacce32 -r 2aa9a65408bc xen/arch/powerpc/dart_u4.c
--- a/xen/arch/powerpc/dart_u4.cTue Sep 26 12:44:20 2006 -0400
+++ b/xen/arch/powerpc/dart_u4.cTue Sep 26 14:01:11 2006 -0400
@@ -19,6 +19,7 @@
  */
 
 #undef DEBUG
+#define INVALIDATE_ALL
 
 #include 
 #include 
@@ -123,8 +124,13 @@ static void u4_inv_all(void)
 
 static void u4_inv_entry(ulong pgn)
 {
+#ifdef INVALIDATE_ALL
+return u4_inv_all();
+#else
 union dart_ctl dc;
 ulong retries = 0;
+
+return u4_inv_all();
 
 dc.dc_word = in_32(&dart->d_dartcntl.dc_word);
 dc.dc_bits.dc_ilpn = pgn;
@@ -139,6 +145,7 @@ static void u4_inv_entry(ulong pgn)
 if (retries > 100)
 panic("WAY! too long\n");
 } while (dc.dc_bits.dc_ione != 0);
+#endif
 }
 
 static struct dart_ops u4_ops = {

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Fix compile error in gdbstub.c

2006-09-25 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID acfb1ac23f80286c8b532052f5e4b77f33612636
# Parent  0e83ba62a3a5c3b22ae99ebb6b6b7fe604ddb447
[XEN][POWERPC] Fix compile error in gdbstub.c

With crash_debug=y the compiler can't find a prototype for unimplemented(),
where gdb-arch-read_reg is calling it.

Signed-off-by: Amos Waterland <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/gdbstub.c |1 +
 1 files changed, 1 insertion(+)

diff -r 0e83ba62a3a5 -r acfb1ac23f80 xen/arch/powerpc/gdbstub.c
--- a/xen/arch/powerpc/gdbstub.cFri Sep 22 11:51:56 2006 -0400
+++ b/xen/arch/powerpc/gdbstub.cMon Sep 25 11:19:55 2006 -0400
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 asm(".globl trap_instruction\n"

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Be a little smarter with unimplemented()

2006-09-22 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 0e83ba62a3a5c3b22ae99ebb6b6b7fe604ddb447
# Parent  04ed07cd741a27041e52c810e5e0ca66b80ef157
[XEN][POWERPC] Be a little smarter with unimplemented()

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/smp.c |   16 +++-
 xen/arch/powerpc/time.c|1 -
 xen/include/asm-powerpc/debugger.h |8 +++-
 3 files changed, 18 insertions(+), 7 deletions(-)

diff -r 04ed07cd741a -r 0e83ba62a3a5 xen/arch/powerpc/smp.c
--- a/xen/arch/powerpc/smp.cFri Sep 22 11:10:28 2006 -0400
+++ b/xen/arch/powerpc/smp.cFri Sep 22 11:51:56 2006 -0400
@@ -32,16 +32,21 @@ void __flush_tlb_mask(cpumask_t mask, un
 unimplemented();
 }
 
-void smp_send_event_check_mask(cpumask_t cpu_mask)
+void smp_send_event_check_mask(cpumask_t mask)
 {
-unimplemented();
+cpu_clear(smp_processor_id(), mask);
+if (!cpus_empty(mask))
+unimplemented();
 }
 
-int smp_call_function(void (*func) (void *info), void *info, int unused,
+
+int smp_call_function(void (*func) (void *info), void *info, int retry,
 int wait)
 {
-unimplemented();
-return 0;
+cpumask_t allbutself = cpu_online_map;
+cpu_clear(smp_processor_id(), allbutself);
+
+return on_selected_cpus(allbutself, func, info, retry, wait);
 }
 
 void smp_send_stop(void)
@@ -56,5 +61,6 @@ int on_selected_cpus(
 int retry,
 int wait)
 {
+unimplemented();
 return 0;
 }
diff -r 04ed07cd741a -r 0e83ba62a3a5 xen/arch/powerpc/time.c
--- a/xen/arch/powerpc/time.c   Fri Sep 22 11:10:28 2006 -0400
+++ b/xen/arch/powerpc/time.c   Fri Sep 22 11:51:56 2006 -0400
@@ -93,5 +93,4 @@ void do_settime(unsigned long secs, unsi
 
 void update_vcpu_system_time(struct vcpu *v)
 {
-unimplemented();
 }
diff -r 04ed07cd741a -r 0e83ba62a3a5 xen/include/asm-powerpc/debugger.h
--- a/xen/include/asm-powerpc/debugger.hFri Sep 22 11:10:28 2006 -0400
+++ b/xen/include/asm-powerpc/debugger.hFri Sep 22 11:51:56 2006 -0400
@@ -41,6 +41,13 @@ static inline void debugger_trap_immedia
 __builtin_trap();
 }
 
+static inline void unimplemented(void)
+{
+#ifdef VERBOSE
+dump_execution_state();
+#endif
+}
+
 static inline void show_execution_state(struct cpu_user_regs *regs)
 {
 show_registers(regs);
@@ -49,7 +56,6 @@ extern void __warn(char *file, int line)
 extern void __warn(char *file, int line);
 #define WARN() __warn(__FILE__, __LINE__)
 #define WARN_ON(_p) do { if (_p) WARN(); } while ( 0 )
-#define unimplemented() WARN()
 
 #define FORCE_CRASH() debugger_trap_immediate()
 

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Clean up debug/traceback/trapping logic

2006-09-22 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 04ed07cd741a27041e52c810e5e0ca66b80ef157
# Parent  e5b1f6154f3121ad3b4172de17f9618f1acc3e90
[XEN][POWERPC] Clean up debug/traceback/trapping logic

This patch tries to sort out all the debugging mechanisms we have
available to us.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/include/asm-powerpc/misc.h |   33 -
 xen/arch/powerpc/backtrace.c   |   22 ++
 xen/arch/powerpc/exceptions.c  |   34 +
 xen/arch/powerpc/mm.c  |1 
 xen/arch/powerpc/powerpc64/ppc970.c|1 
 xen/arch/powerpc/powerpc64/scom.h  |   39 +
 xen/arch/powerpc/powerpc64/traps.c |4 --
 xen/arch/powerpc/setup.c   |2 -
 xen/arch/powerpc/smp.c |2 -
 xen/arch/powerpc/time.c|2 -
 xen/arch/powerpc/usercopy.c|1 
 xen/include/asm-powerpc/debugger.h |   45 -
 xen/include/asm-powerpc/flushtlb.h |1 
 xen/include/asm-powerpc/mm.h   |1 
 xen/include/asm-powerpc/page.h |1 
 xen/include/asm-powerpc/powerpc64/config.h |7 
 xen/include/asm-powerpc/processor.h|   10 --
 17 files changed, 108 insertions(+), 98 deletions(-)

diff -r e5b1f6154f31 -r 04ed07cd741a xen/arch/powerpc/backtrace.c
--- a/xen/arch/powerpc/backtrace.c  Fri Sep 22 11:08:12 2006 -0400
+++ b/xen/arch/powerpc/backtrace.c  Fri Sep 22 11:10:28 2006 -0400
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static char namebuf[KSYM_NAME_LEN+1];
 
@@ -192,6 +193,19 @@ void show_backtrace(ulong sp, ulong lr, 
 console_end_sync();
 }
 
+void show_backtrace_regs(struct cpu_user_regs *regs)
+{
+console_start_sync();
+
+show_registers(regs);
+printk("dar 0x%016lx, dsisr 0x%08x\n", mfdar(), mfdsisr());
+printk("hid4 0x%016lx\n", regs->hid4);
+printk("---[ backtrace ]---\n");
+show_backtrace(regs->gprs[1], regs->lr, regs->pc);
+
+console_end_sync();
+}
+
 void __warn(char *file, int line)
 {
 ulong sp;
@@ -202,9 +216,7 @@ void __warn(char *file, int line)
 
 sp = (ulong)__builtin_frame_address(0);
 lr = (ulong)__builtin_return_address(0);
-
 backtrace(sp, lr, lr);
-console_end_sync();
-}
-
-
+
+console_end_sync();
+}
diff -r e5b1f6154f31 -r 04ed07cd741a xen/arch/powerpc/exceptions.c
--- a/xen/arch/powerpc/exceptions.c Fri Sep 22 11:08:12 2006 -0400
+++ b/xen/arch/powerpc/exceptions.c Fri Sep 22 11:10:28 2006 -0400
@@ -25,8 +25,10 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 
 #undef DEBUG
 
@@ -56,25 +58,19 @@ void do_dec(struct cpu_user_regs *regs)
 
 void program_exception(struct cpu_user_regs *regs, unsigned long cookie)
 {
+if (cookie == 0x200) {
+if (cpu_machinecheck(regs))
+return;
+
+printk("%s: machine check\n", __func__);
+} else {
 #ifdef CRASH_DEBUG
-__trap_to_gdb(regs, cookie);
-#else /* CRASH_DEBUG */
-int recover = 0;
+if (__trap_to_gdb(regs, cookie) == 0)
+return;
+#endif /* CRASH_DEBUG */
 
-console_start_sync();
-
-show_registers(regs);
-printk("dar 0x%016lx, dsisr 0x%08x\n", mfdar(), mfdsisr());
-printk("hid4 0x%016lx\n", regs->hid4);
-printk("---[ backtrace ]---\n");
-show_backtrace(regs->gprs[1], regs->lr, regs->pc);
-
-if (cookie == 0x200)
-recover = cpu_machinecheck(regs);
-
-if (!recover)
-panic("%s: 0x%lx\n", __func__, cookie);
-
-console_end_sync();
-#endif /* CRASH_DEBUG */
+printk("%s: type: 0x%lx\n", __func__, cookie);
+show_backtrace_regs(regs);
+}
+machine_halt();
 }
diff -r e5b1f6154f31 -r 04ed07cd741a xen/arch/powerpc/mm.c
--- a/xen/arch/powerpc/mm.c Fri Sep 22 11:08:12 2006 -0400
+++ b/xen/arch/powerpc/mm.c Fri Sep 22 11:10:28 2006 -0400
@@ -25,7 +25,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
diff -r e5b1f6154f31 -r 04ed07cd741a xen/arch/powerpc/powerpc64/ppc970.c
--- a/xen/arch/powerpc/powerpc64/ppc970.c   Fri Sep 22 11:08:12 2006 -0400
+++ b/xen/arch/powerpc/powerpc64/ppc970.c   Fri Sep 22 11:10:28 2006 -0400
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include "scom.h"
 
 #undef DEBUG
 #undef SERIALIZE
diff -r e5b1f6154f31 -r 04ed07cd741a xen/arch/powerpc/powerpc64/traps.c
--- a/xen/arch/powerpc/powerpc64/traps.cFri Sep 22 11:08:12 2006 -0400
+++ b/xen/arch/powerpc/powerpc64/traps.cFri Sep 22 11:10:28 2006 -0400
@@ -48,7 +48,3 @@ void show_registers(struct cpu_user_regs
 console_end_sync();
 }
 
-void show_execution_state(struct cpu_user_regs *regs)
-{
-show_registers(regs);
-}
diff -r e5b1f6154f31 -r 04ed07cd741a xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Fri Sep 22 11:08:12 2006 -0400
++

[XenPPC] [xenppc-unstable] [XEN][POWERPC] Machine check now inspects the SCOM for more information

2006-09-22 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID e0bb62683805bc0dcd6ca5198b140f5910dbd358
# Parent  f48cd49f4ee21fc44ef2fd85553c8c2008da8489
[XEN][POWERPC] Machine check now inspects the SCOM for more information

Also fixes suggested by <[EMAIL PROTECTED]>

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/powerpc64/ppc970_machinecheck.c |7 +++
 xen/arch/powerpc/powerpc64/ppc970_scom.c |   41 ++-
 2 files changed, 25 insertions(+), 23 deletions(-)

diff -r f48cd49f4ee2 -r e0bb62683805 
xen/arch/powerpc/powerpc64/ppc970_machinecheck.c
--- a/xen/arch/powerpc/powerpc64/ppc970_machinecheck.c  Thu Sep 21 13:48:24 
2006 -0400
+++ b/xen/arch/powerpc/powerpc64/ppc970_machinecheck.c  Fri Sep 22 11:02:47 
2006 -0400
@@ -24,6 +24,8 @@
 #include 
 #include 
 #include 
+#include 
+#include "scom.h"
 
 #define MCK_SRR1_INSN_FETCH_UNIT0x0020 /* 42 */
 #define MCK_SRR1_LOAD_STORE 0x0010 /* 43 */
@@ -54,6 +56,8 @@ int cpu_machinecheck(struct cpu_user_reg
 if (mck_cpu_stats[mfpir()] != 0)
 printk("While in CI IO\n");
 
+show_backtrace_regs(regs);
+
 printk("SRR1: 0x%016lx\n", regs->msr);
 if (regs->msr & MCK_SRR1_INSN_FETCH_UNIT)
 printk("42: Exception caused by Instruction Fetch Unit (IFU)\n"
@@ -67,6 +71,7 @@ int cpu_machinecheck(struct cpu_user_reg
 case 0:
 printk("0b00: Likely caused by an asynchronous machine check,\n"
"  see SCOM Asynchronous Machine Check Register\n");
+cpu_scom_AMCR();
 break;
 case MCK_SRR1_CAUSE_SLB_PAR:
 printk("0b01: Exception caused by an SLB parity error detected\n"
@@ -116,5 +121,5 @@ int cpu_machinecheck(struct cpu_user_reg
 dump_segments(0);
 }
 
-return 0; /* for now lets not recover; */
+return 0; /* for now lets not recover */
 }
diff -r f48cd49f4ee2 -r e0bb62683805 xen/arch/powerpc/powerpc64/ppc970_scom.c
--- a/xen/arch/powerpc/powerpc64/ppc970_scom.c  Thu Sep 21 13:48:24 2006 -0400
+++ b/xen/arch/powerpc/powerpc64/ppc970_scom.c  Fri Sep 22 11:02:47 2006 -0400
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include "scom.h"
 
 #define SPRN_SCOMC 276
 #define SPRN_SCOMD 277
@@ -48,7 +49,7 @@ union scomc {
 };
 
 
-static inline int read_scom(uint addr, ulong *d)
+int cpu_scom_read(uint addr, ulong *d)
 {
 union scomc c;
 ulong flags;
@@ -56,9 +57,9 @@ static inline int read_scom(uint addr, u
 /* drop the low 8bits (including parity) */
 addr >>= 8;
 
-/* these give iface errors because the address is ambiguous after
- * the above bit dropping */
-BUG_ON(addr == 0x8000);
+/* these give iface errors because the addresses are not software
+ * accessible */
+BUG_ON(addr & 0x8000);
 
 for (;;) {
 c.word = 0;
@@ -100,7 +101,7 @@ static inline int read_scom(uint addr, u
 }
 }
 
-static inline int write_scom(uint addr, ulong d)
+int cpu_scom_write(uint addr, ulong d)
 {
 union scomc c;
 ulong flags;
@@ -108,9 +109,9 @@ static inline int write_scom(uint addr, 
 /* drop the low 8bits (including parity) */
 addr >>= 8;
 
-/* these give iface errors because the address is ambiguous after
- * the above bit dropping */
-BUG_ON(addr == 0x8000);
+/* these give iface errors because the addresses are not software
+ * accessible */
+BUG_ON(addr & 0x8000);
 
 for (;;) {
 c.word = 0;
@@ -150,25 +151,21 @@ static inline int write_scom(uint addr, 
 }
 }
 
-/* SCOMC addresses are 16bit but we are given 24 bits in the
- * books. The low oerder 8 bits are some kinda parity thin and should
- * be ignored */
-#define SCOM_AMCS_REG  0x022601
-#define SCOM_AMCS_AND_MASK 0x022700
-#define SCOM_AMCS_OR_MASK  0x022800
-#define SCOM_CMCE  0x030901
-#define SCOM_PMCR  0x400801
-#define SCOM_PTSR  0x408001
-
-/* cannot access these since only top 16bits are considered */
-#define SCOM_STATUS0x83
-
 void cpu_scom_init(void)
 {
 ulong val;
 console_start_sync();
-if (!read_scom(SCOM_PTSR, &val))
+if (!cpu_scom_read(SCOM_PTSR, &val))
 printk("SCOM PTSR: 0x%016lx\n", val);
 
 console_end_sync();
 }
+
+void cpu_scom_AMCR(void)
+{
+ulong val;
+
+cpu_scom_read(SCOM_AMC_REG, &val);
+printk("SCOM AMCR: 0x%016lx\n", val);
+}
+

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


[XenPPC] [xenppc-unstable] [XEN] __trap_to_gdb should return something different on failure

2006-09-22 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID e5b1f6154f3121ad3b4172de17f9618f1acc3e90
# Parent  e0bb62683805bc0dcd6ca5198b140f5910dbd358
[XEN] __trap_to_gdb should return something different on failure
This patch allows the caller to find out if the gdbstub actually did
anything.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/common/gdbstub.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff -r e0bb62683805 -r e5b1f6154f31 xen/common/gdbstub.c
--- a/xen/common/gdbstub.c  Fri Sep 22 11:02:47 2006 -0400
+++ b/xen/common/gdbstub.c  Fri Sep 22 11:08:12 2006 -0400
@@ -481,7 +481,7 @@ __trap_to_gdb(struct cpu_user_regs *regs
 if ( gdb_ctx->serhnd < 0 )
 {
 dbg_printk("Debugger not ready yet.\n");
-return 0;
+return -1;
 }
 
 /* We rely on our caller to ensure we're only on one processor
@@ -500,7 +500,7 @@ __trap_to_gdb(struct cpu_user_regs *regs
 {
 printk("WARNING WARNING WARNING: Avoiding recursive gdb.\n");
 atomic_inc(&gdb_ctx->running);
-return 0;
+return -1;
 }
 
 if ( !gdb_ctx->connected )

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


Re: [XenPPC] [xenppc-unstable] [XEN][POWERPC] SCOM access is fully known and working

2006-09-22 Thread Jimi Xenidis


On Sep 21, 2006, at 12:21 PM, Segher Boessenkool wrote:

+/* these give iface errors because the address is ambiguous  
after

+ * the above bit dropping */
+BUG_ON(addr == 0x8000);


Anything with the high bit set isn't available via SCOMC/SCOMD,
only via the external interfaces.


Thanks for clarifying that, will fix.



+/* WARNING! older 970s (pre FX) shift the bits right 1  
position */


They also don't have the exact same stuff at the exact same
registers -- SCOM is very CPU-specific, check every one you
want to use.  That is, if you do the fix for the shifted bits,
if not, don't bother ;-)


Just a note-to-self until I get my hands on the early docs.





+if (c.bits.iface_error)
+udelay(10);


Why the udelay()?


This is interesting,  The docs say that you should "retry" on an  
iface error.
When accessing the 0x8000 address above I get an iface error, then an  
immediate retry gives an addr|iface error.
If I wait 10us (a number I made up) before the retry I get only iface  
consistently.
I'm waiting to hear back on the expected behavior, I will adjust at  
that point.





+/* SCOMC addresses are 16bit but we are given 24 bits in the
+ * books. The low oerder 8 bits are some kinda parity thin and  
should

+ * be ignored */


The low bit is the odd parity of the other 23 bits; everything
accessible via SCOMC/SCOMD has bits 16..22 zero.

Interesting thanks for the heads up.



All these comments are pretty minor, congratz on finally having
it working Jimi :-)



yeah.. now for the payoff

-JX

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


Re: [XenPPC] [xenppc-unstable] [XEN][POWERPC] SCOM access is fully known and working

2006-09-21 Thread Segher Boessenkool

+/* these give iface errors because the address is ambiguous after
+ * the above bit dropping */
+BUG_ON(addr == 0x8000);


Anything with the high bit set isn't available via SCOMC/SCOMD,
only via the external interfaces.

+/* WARNING! older 970s (pre FX) shift the bits right 1  
position */


They also don't have the exact same stuff at the exact same
registers -- SCOM is very CPU-specific, check every one you
want to use.  That is, if you do the fix for the shifted bits,
if not, don't bother ;-)


+if (c.bits.iface_error)
+udelay(10);


Why the udelay()?


+/* SCOMC addresses are 16bit but we are given 24 bits in the
+ * books. The low oerder 8 bits are some kinda parity thin and should
+ * be ignored */


The low bit is the odd parity of the other 23 bits; everything
accessible via SCOMC/SCOMD has bits 16..22 zero.


All these comments are pretty minor, congratz on finally having
it working Jimi :-)


Segher


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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Fully inline udelay()

2006-09-21 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID bcb5998a0abc50a36cb800b843ce343952cccb66
# Parent  e22cbd2ea1e4720b7853e4b05a4a9cdda2bff348
[XEN][POWERPC] Fully inline udelay()

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/delay.c|   37 -
 xen/arch/powerpc/Makefile   |1 -
 xen/include/asm-powerpc/delay.h |   17 +++--
 3 files changed, 15 insertions(+), 40 deletions(-)

diff -r e22cbd2ea1e4 -r bcb5998a0abc xen/arch/powerpc/Makefile
--- a/xen/arch/powerpc/Makefile Thu Sep 21 07:36:17 2006 -0400
+++ b/xen/arch/powerpc/Makefile Thu Sep 21 07:37:00 2006 -0400
@@ -12,7 +12,6 @@ obj-y += dart.o
 obj-y += dart.o
 obj-y += dart_u3.o
 obj-y += dart_u4.o
-obj-y += delay.o
 obj-y += domctl.o
 obj-y += domain_build.o
 obj-y += domain.o
diff -r e22cbd2ea1e4 -r bcb5998a0abc xen/include/asm-powerpc/delay.h
--- a/xen/include/asm-powerpc/delay.h   Thu Sep 21 07:36:17 2006 -0400
+++ b/xen/include/asm-powerpc/delay.h   Thu Sep 21 07:37:00 2006 -0400
@@ -13,16 +13,29 @@
  * 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 (C) IBM Corp. 2005, 2006
  *
  * Authors: Hollis Blanchard <[EMAIL PROTECTED]>
+ *  Jimi Xenidis <[EMAIL PROTECTED]>
  */
 
 #ifndef _ASM_DELAY_H_
 #define _ASM_DELAY_H_
 
+#include 
+
 extern unsigned long ticks_per_usec; 
 #define __udelay udelay
-extern void udelay(unsigned long usecs);
+static inline void udelay(unsigned long usecs)
+{
+unsigned long ticks = usecs * ticks_per_usec;
+unsigned long s;
+unsigned long e;
 
+s = get_timebase();
+do {
+asm volatile("or 1,1,1"); /* also puts the thread to low priority */
+e = get_timebase();
+} while ((e-s) < ticks);
+}
 #endif
diff -r e22cbd2ea1e4 -r bcb5998a0abc xen/arch/powerpc/delay.c
--- a/xen/arch/powerpc/delay.c  Thu Sep 21 07:36:17 2006 -0400
+++ /dev/null   Thu Jan 01 00:00:00 1970 +
@@ -1,37 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- * Copyright (C) IBM Corp. 2005
- *
- * Authors: Jimi Xenidis <[EMAIL PROTECTED]>
- */
-
-#include 
-#include 
-#include 
-#include 
-
-void udelay(unsigned long usecs)
-{
-ulong ticks = usecs * ticks_per_usec;
-ulong s;
-ulong e;
-
-s = get_timebase();
-do {
-asm volatile("or 1,1,1"); /* also puts the thread to low priority */
-e = get_timebase();
-} while ((e-s) < ticks);
-}

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] SCOM access is fully known and working

2006-09-21 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID e22cbd2ea1e4720b7853e4b05a4a9cdda2bff348
# Parent  91ee784bc36703985d5e841d18d65a4151666c57
[XEN][POWERPC] SCOM access is fully known and working

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/powerpc64/ppc970_scom.c |  151 +--
 1 files changed, 104 insertions(+), 47 deletions(-)

diff -r 91ee784bc367 -r e22cbd2ea1e4 xen/arch/powerpc/powerpc64/ppc970_scom.c
--- a/xen/arch/powerpc/powerpc64/ppc970_scom.c  Wed Sep 20 15:25:27 2006 -0500
+++ b/xen/arch/powerpc/powerpc64/ppc970_scom.c  Thu Sep 21 07:36:17 2006 -0400
@@ -22,33 +22,13 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #define SPRN_SCOMC 276
 #define SPRN_SCOMD 277
-
-static inline void mtscomc(ulong scomc)
-{
-__asm__ __volatile__ ("mtspr %1, %0" : : "r" (scomc), "i"(SPRN_SCOMC));
-}
-
-static inline ulong mfscomc(void)
-{
-ulong scomc;
-__asm__ __volatile__ ("mfspr %0, %1" : "=r" (scomc): "i"(SPRN_SCOMC));
-return scomc;
-}
-
-static inline void mtscomd(ulong scomd)
-{
-__asm__ __volatile__ ("mtspr %1, %0" : : "r" (scomd), "i"(SPRN_SCOMD));
-}
-
-static inline ulong mfscomd(void)
-{
-ulong scomd;
-__asm__ __volatile__ ("mfspr %0, %1" : "=r" (scomd): "i"(SPRN_SCOMD));
-return scomd;
-}
+#define SCOMC_READ 1
+#define SCOMC_WRITE (!(SCOMC_READ))
 
 union scomc {
 struct scomc_bits {
@@ -68,50 +48,127 @@ union scomc {
 };
 
 
-static inline ulong read_scom(ulong addr)
+static inline int read_scom(uint addr, ulong *d)
 {
 union scomc c;
-ulong d;
+ulong flags;
 
-c.word = 0;
-c.bits.addr = addr;
-c.bits.RW = 0;
+/* drop the low 8bits (including parity) */
+addr >>= 8;
 
-mtscomc(c.word);
-d = mfscomd();
-c.word = mfscomc();
-if (c.bits.failure)
-panic("scom status: 0x%016lx\n", c.word);
+/* these give iface errors because the address is ambiguous after
+ * the above bit dropping */
+BUG_ON(addr == 0x8000);
 
-return d;
+for (;;) {
+c.word = 0;
+c.bits.addr = addr;
+c.bits.RW = SCOMC_READ;
+
+local_irq_save(flags);
+asm volatile (
+"sync \n\t"
+"mtspr %2, %0 \n\t"
+"isync\n\t"
+"mfspr %1, %3 \n\t"
+"isync\n\t"
+"mfspr %0, %2 \n\t"
+"isync\n\t"
+: "+r" (c.word), "=r" (*d)
+: "i"(SPRN_SCOMC), "i"(SPRN_SCOMD));
+
+local_irq_restore(flags);
+/* WARNING! older 970s (pre FX) shift the bits right 1 position */
+
+if (!c.bits.failure)
+return 0;
+
+/* deal with errors */
+/* has SCOM been disabled? */
+if (c.bits.disabled)
+return -ENOSYS;
+
+/* we were passed a bad addr return -1 */
+if (c.bits.addr_error)
+return -EINVAL;
+
+/* this is way bad and we will checkstop soon */
+BUG_ON(c.bits.proto_error);
+
+if (c.bits.iface_error)
+udelay(10);
+}
 }
 
-static inline void write_scom(ulong addr, ulong val)
+static inline int write_scom(uint addr, ulong d)
 {
 union scomc c;
+ulong flags;
 
-c.word = 0;
-c.bits.addr = addr;
-c.bits.RW = 1;
+/* drop the low 8bits (including parity) */
+addr >>= 8;
 
-mtscomd(val);
-mtscomc(c.word);
-c.word = mfscomc();
-if (c.bits.failure)
-panic("scom status: 0x%016lx\n", c.word);
+/* these give iface errors because the address is ambiguous after
+ * the above bit dropping */
+BUG_ON(addr == 0x8000);
+
+for (;;) {
+c.word = 0;
+c.bits.addr = addr;
+c.bits.RW = SCOMC_WRITE;
+
+local_irq_save(flags);
+asm volatile(
+"sync \n\t"
+"mtspr %3, %1 \n\t"
+"isync\n\t"
+"mtspr %2, %0 \n\t"
+"isync\n\t"
+"mfspr %0, %2 \n\t"
+"isync\n\t"
+: "+r" (c.word)
+: "r" (d), "i"(SPRN_SCOMC), "i"(SPRN_SCOMD));
+local_irq_restore(flags);
+
+if (!c.bits.failure)
+return 0;
+
+/* has SCOM been disabled? */
+if (c.bits.disabled)
+return -ENOSYS;
+
+/* we were passed a bad addr return -1 */
+if (c.bits.addr_error)
+return -EINVAL;
+
+/* this is way bad and we will checkstop soon */
+BUG_ON(c.bits.proto_error);
+
+/* check for iface and retry */
+if (c.bits.iface_error)
+udelay(10);
+}
 }
 
+/* SCOMC addresses are 16bit but we are given 24 bits in the
+ * books. The low oerder 8 bits are some kinda parity thin and should
+ * be ignored */
 #define SCOM_AMCS_REG  0x022601
 #define SCOM_AMCS_AND_MASK 0x022700
 #define SCOM_AMCS_OR_MASK  0x022800
 #define SCOM_CMCE  0x030901
 #define SCOM_PMCR  0x400801
+#define 

[XenPPC] [xenppc-unstable] [XEN][POWERPC] support non-RMA memory in domU

2006-09-14 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Hollis Blanchard <[EMAIL PROTECTED]>
# Node ID 14e7c2948115b2f7ba82e37df571447c0428b8e5
# Parent  3d60bf30dff21fec2fdc8a931c725c23508cb94c
[XEN][POWERPC] support non-RMA memory in domU
- domU device tree now gets two /memory nodes; the first is the RMA
- the tools now call increase_reservation() in 16MB increments (hardcoded)
- memory is stored in a linked list of 16MB extents, which will definitely need
  replacing in the future
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
 tools/libxc/powerpc64/xc_linux_build.c  |   30 --
 tools/python/xen/xend/FlatDeviceTree.py |   24 ++--
 tools/python/xen/xend/XendDomainInfo.py |   19 ---
 xen/arch/powerpc/mm.c   |   27 +++
 xen/arch/powerpc/ofd_fixup_memory.c |4 +++-
 xen/arch/powerpc/shadow.c   |3 ---
 xen/common/memory.c |3 +++
 xen/include/asm-ia64/mm.h   |6 ++
 xen/include/asm-powerpc/mm.h|4 +++-
 xen/include/asm-x86/mm.h|6 ++
 10 files changed, 94 insertions(+), 32 deletions(-)

diff -r 3d60bf30dff2 -r 14e7c2948115 tools/libxc/powerpc64/xc_linux_build.c
--- a/tools/libxc/powerpc64/xc_linux_build.cThu Sep 14 14:20:48 2006 -0400
+++ b/tools/libxc/powerpc64/xc_linux_build.cThu Sep 14 14:53:32 2006 -0500
@@ -334,22 +334,39 @@ out:
 return rc;
 }
 
-static unsigned long create_start_info(start_info_t *si,
+static unsigned long create_start_info(void *devtree, start_info_t *si,
 unsigned int console_evtchn, unsigned int store_evtchn,
 unsigned long nr_pages)
 {
+void *rma;
 unsigned long si_addr;
+uint64_t rma_reg[2];
+uint64_t rma_top;
+int rc;
 
 memset(si, 0, sizeof(*si));
 snprintf(si->magic, sizeof(si->magic), "xen-%d.%d-powerpc64HV", 3, 0);
 
+rma = ft_find_node(devtree, "/[EMAIL PROTECTED]");
+if (rma == NULL) {
+DPRINTF("couldn't find /[EMAIL PROTECTED]");
+return ~0UL;
+}
+rc = ft_get_prop(devtree, rma, "reg", rma_reg, sizeof(rma_reg));
+if (rc < 0) {
+DPRINTF("couldn't get /[EMAIL PROTECTED]/reg\n");
+return ~0UL;
+}
+rma_top = rma_reg[0] + rma_reg[1];
+DPRINTF("RMA top = 0x%"PRIX64"\n", rma_top);
+
 si->nr_pages = nr_pages;
-si->shared_info = (nr_pages - 1) << PAGE_SHIFT;
-si->store_mfn = si->nr_pages - 2;
+si->shared_info = rma_top - PAGE_SIZE;
+si->store_mfn = (rma_top >> PAGE_SHIFT) - 2;
 si->store_evtchn = store_evtchn;
-si->console.domU.mfn = si->nr_pages - 3;
+si->console.domU.mfn = (rma_top >> PAGE_SHIFT) - 3;
 si->console.domU.evtchn = console_evtchn;
-si_addr = (si->nr_pages - 4) << PAGE_SHIFT;
+si_addr = rma_top - 4*PAGE_SIZE;
 
 return si_addr;
 }
@@ -434,7 +451,8 @@ int xc_linux_build(int xc_handle,
 }
 
 /* start_info stuff: about to be removed  */
-si_addr = create_start_info(&si, console_evtchn, store_evtchn, nr_pages);
+si_addr = create_start_info(devtree, &si, console_evtchn, store_evtchn,
+nr_pages);
 *console_mfn = page_array[si.console.domU.mfn];
 *store_mfn = page_array[si.store_mfn];
 if (install_image(xc_handle, domid, page_array, &si, si_addr,
diff -r 3d60bf30dff2 -r 14e7c2948115 tools/python/xen/xend/FlatDeviceTree.py
--- a/tools/python/xen/xend/FlatDeviceTree.py   Thu Sep 14 14:20:48 2006 -0400
+++ b/tools/python/xen/xend/FlatDeviceTree.py   Thu Sep 14 14:53:32 2006 -0500
@@ -288,12 +288,24 @@ def build(imghandler):
 xencons = xen.addnode('console')
 xencons.addprop('interrupts', 1, 0)
 
-# XXX split out RMA node
-mem = root.addnode('[EMAIL PROTECTED]')
+# add memory nodes
 totalmem = imghandler.vm.getMemoryTarget() * 1024
-mem.addprop('reg', 0, 0, 0, totalmem)
-mem.addprop('device_type', 'memory\0')
-
+rma_log = imghandler.vm.info.get('rma_log')
+rma_bytes = 1 << rma_log
+
+# RMA node
+rma = root.addnode('[EMAIL PROTECTED]')
+rma.addprop('reg', 0, 0, 0, rma_bytes)
+rma.addprop('device_type', 'memory\0')
+
+# all the rest in a single node
+   remaining = totalmem - rma_bytes
+   if remaining > 0:
+   mem = root.addnode('[EMAIL PROTECTED]')
+   mem.addprop('reg', 0, rma_bytes, 0, remaining)
+   mem.addprop('device_type', 'memory\0')
+
+# add CPU nodes
 cpus = root.addnode('cpus')
 cpus.addprop('smp-enabled')
 cpus.addprop('#size-cells', 0)
@@ -323,7 +335,7 @@ def build(imghandler):
 
 chosen = root.addnode('chosen')
 chosen.addprop('cpu', cpu0.get_phandle())
-chosen.addprop('memory', mem.get_phandle())
+chosen.addprop('memory', rma.get_phandle())
 chosen.addprop('linux,stdout-path', '/xen/console\0')
 chosen.addprop('interrupt-controller', xen.get_phandle())
 chosen.addprop('bootargs', imghandler.cmdline + '\0')
diff -r 3d60bf30dff2 -r 1

[XenPPC] [xenppc-unstable] [XEN][POWERPC] Better whitespace fix.

2006-09-14 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Hollis Blanchard <[EMAIL PROTECTED]>
# Node ID 1eed6129bd9a15d3bf58f9cc88ed2535506c11e2
# Parent  4fd80d78e227877b5319b09e6befe54e0c6906c9
[XEN][POWERPC] Better whitespace fix.
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
 xen/include/asm-powerpc/page.h |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff -r 4fd80d78e227 -r 1eed6129bd9a xen/include/asm-powerpc/page.h
--- a/xen/include/asm-powerpc/page.hThu Sep 14 12:27:01 2006 -0500
+++ b/xen/include/asm-powerpc/page.hThu Sep 14 12:31:52 2006 -0500
@@ -79,9 +79,9 @@ static __inline__ void clear_page(void *
 lines = cpu_caches.dlines_per_page;
 
 __asm__ __volatile__(
-"mtctr  %1  # clear_page\n\
-1:  dcbz0,%0\n\
-add %0,%0,%3\n\
+"mtctr  %1  # clear_page\n\
+1:  dcbz0,%0\n\
+add %0,%0,%3\n\
 bdnz+   1b"
 : "=r" (addr)
 : "r" (lines), "0" (addr), "r" (line_size)

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Whitespace.

2006-09-14 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Hollis Blanchard <[EMAIL PROTECTED]>
# Node ID 4fd80d78e227877b5319b09e6befe54e0c6906c9
# Parent  daa613b3f42362ff97e6712f5318a0bd0a6e1291
[XEN][POWERPC] Whitespace.
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/powerpc64/ppc970.c |8 
 xen/include/asm-powerpc/cache.h |   16 
 xen/include/asm-powerpc/page.h  |   20 ++--
 3 files changed, 22 insertions(+), 22 deletions(-)

diff -r daa613b3f423 -r 4fd80d78e227 xen/arch/powerpc/powerpc64/ppc970.c
--- a/xen/arch/powerpc/powerpc64/ppc970.c   Thu Sep 14 11:13:54 2006 -0500
+++ b/xen/arch/powerpc/powerpc64/ppc970.c   Thu Sep 14 12:27:01 2006 -0500
@@ -35,11 +35,11 @@
 #undef SERIALIZE
 
 struct cpu_caches cpu_caches = {
-   .dline_size = 0x80,
-   .log_dline_size = 7,
+.dline_size = 0x80,
+.log_dline_size = 7,
 .dlines_per_page = PAGE_SIZE >> 7,
-   .iline_size = 0x80,
-   .log_iline_size = 7,
+.iline_size = 0x80,
+.log_iline_size = 7,
 .ilines_per_page = PAGE_SIZE >> 7,
 };
 
diff -r daa613b3f423 -r 4fd80d78e227 xen/include/asm-powerpc/cache.h
--- a/xen/include/asm-powerpc/cache.h   Thu Sep 14 11:13:54 2006 -0500
+++ b/xen/include/asm-powerpc/cache.h   Thu Sep 14 12:27:01 2006 -0500
@@ -60,14 +60,14 @@ static __inline__ void synchronize_cache
 #define __read_mostly
 
 struct cpu_caches {
-   u32 dsize;  /* L1 d-cache size */
-   u32 dline_size; /* L1 d-cache line size */
-   u32 log_dline_size;
-   u32 dlines_per_page;
-   u32 isize;  /* L1 i-cache size */
-   u32 iline_size; /* L1 i-cache line size */
-   u32 log_iline_size;
-   u32 ilines_per_page;
+u32 dsize;  /* L1 d-cache size */
+u32 dline_size; /* L1 d-cache line size */
+u32 log_dline_size;
+u32 dlines_per_page;
+u32 isize;  /* L1 i-cache size */
+u32 iline_size; /* L1 i-cache line size */
+u32 log_iline_size;
+u32 ilines_per_page;
 };
 extern struct cpu_caches cpu_caches;
 #endif
diff -r daa613b3f423 -r 4fd80d78e227 xen/include/asm-powerpc/page.h
--- a/xen/include/asm-powerpc/page.hThu Sep 14 11:13:54 2006 -0500
+++ b/xen/include/asm-powerpc/page.hThu Sep 14 12:27:01 2006 -0500
@@ -73,19 +73,19 @@ typedef struct { unsigned long l1_lo; } 
 
 static __inline__ void clear_page(void *addr)
 {
-   unsigned long lines, line_size;
+unsigned long lines, line_size;
 
-   line_size = cpu_caches.dline_size;
-   lines = cpu_caches.dlines_per_page;
+line_size = cpu_caches.dline_size;
+lines = cpu_caches.dlines_per_page;
 
-   __asm__ __volatile__(
-   "mtctr  %1  # clear_page\n\
-1:  dcbz   0,%0\n\
-   add %0,%0,%3\n\
-   bdnz+   1b"
+__asm__ __volatile__(
+"mtctr  %1  # clear_page\n\
+1:  dcbz0,%0\n\
+add %0,%0,%3\n\
+bdnz+   1b"
 : "=r" (addr)
 : "r" (lines), "0" (addr), "r" (line_size)
-   : "ctr", "memory");
+: "ctr", "memory");
 }
 
 extern void copy_page(void *dp, void *sp);
@@ -147,7 +147,7 @@ extern unsigned long paddr_to_maddr(unsi
 
 static inline unsigned long gmfn_to_mfn(struct domain *d, unsigned long gmfn)
 {
-   return pfn2mfn(d, gmfn, NULL);
+return pfn2mfn(d, gmfn, NULL);
 }
 
 #define mfn_to_gmfn(_d, mfn) (mfn)

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Fix build break.

2006-09-14 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Hollis Blanchard <[EMAIL PROTECTED]>
# Node ID daa613b3f42362ff97e6712f5318a0bd0a6e1291
# Parent  a1beb7b142226b2d00af68806e02cba6100e6aa3
[XEN][POWERPC] Fix build break.
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/of-devtree.h |1 +
 1 files changed, 1 insertion(+)

diff -r a1beb7b14222 -r daa613b3f423 xen/arch/powerpc/of-devtree.h
--- a/xen/arch/powerpc/of-devtree.h Thu Sep 14 11:11:00 2006 -0400
+++ b/xen/arch/powerpc/of-devtree.h Thu Sep 14 11:13:54 2006 -0500
@@ -22,6 +22,7 @@
 #define _OF_DEVTREE_H
 
 #include 
+#include 
 #include 
 
 enum {

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Correct mismerge.

2006-09-12 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Hollis Blanchard <[EMAIL PROTECTED]>
# Node ID 6902fa91b65717f86defc81edd2162c04bfbf972
# Parent  cba69616bda048eb946f06e926694183832298e2
[XEN][POWERPC] Correct mismerge.
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
 xen/include/asm-powerpc/mm.h   |9 -
 xen/include/asm-powerpc/page.h |2 +-
 2 files changed, 1 insertion(+), 10 deletions(-)

diff -r cba69616bda0 -r 6902fa91b657 xen/include/asm-powerpc/mm.h
--- a/xen/include/asm-powerpc/mm.h  Tue Sep 12 12:20:45 2006 -0500
+++ b/xen/include/asm-powerpc/mm.h  Tue Sep 12 14:26:47 2006 -0500
@@ -234,15 +234,6 @@ extern int update_grant_va_mapping(unsig
struct domain *,
struct vcpu *);
 
-#define INVALID_MFN (~0UL)
-#define PFN_TYPE_NONE 0
-#define PFN_TYPE_RMA 1
-#define PFN_TYPE_LOGICAL 2
-#define PFN_TYPE_IO 3
-#define PFN_TYPE_FOREIGN 4
-
-extern ulong pfn2mfn(struct domain *d, ulong pfn, int *type);
-
 /* Arch-specific portion of memory_op hypercall. */
 long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg);
 
diff -r cba69616bda0 -r 6902fa91b657 xen/include/asm-powerpc/page.h
--- a/xen/include/asm-powerpc/page.hTue Sep 12 12:20:45 2006 -0500
+++ b/xen/include/asm-powerpc/page.hTue Sep 12 14:26:47 2006 -0500
@@ -118,7 +118,7 @@ static inline int get_order_from_pages(u
 #define PFN_TYPE_RMA 1
 #define PFN_TYPE_LOGICAL 2
 #define PFN_TYPE_IO 3
-#define PFN_TYPE_REMOTE 4
+#define PFN_TYPE_FOREIGN 4
 
 extern ulong pfn2mfn(struct domain *d, ulong pfn, int *type);
 extern unsigned long paddr_to_maddr(unsigned long paddr);

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Split dom0_ops.c into domctl.c and sysctl.c.

2006-09-12 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Hollis Blanchard <[EMAIL PROTECTED]>
# Node ID 48840bbe607de4472121226de782bdd81db714e4
# Parent  6902fa91b65717f86defc81edd2162c04bfbf972
[XEN][POWERPC] Split dom0_ops.c into domctl.c and sysctl.c.
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/dom0_ops.c |  154 
 xen/arch/powerpc/Makefile   |3 
 xen/arch/powerpc/domctl.c   |  118 +
 xen/arch/powerpc/sysctl.c   |   65 ++
 4 files changed, 185 insertions(+), 155 deletions(-)

diff -r 6902fa91b657 -r 48840bbe607d xen/arch/powerpc/Makefile
--- a/xen/arch/powerpc/Makefile Tue Sep 12 14:26:47 2006 -0500
+++ b/xen/arch/powerpc/Makefile Tue Sep 12 14:28:16 2006 -0500
@@ -13,7 +13,7 @@ obj-y += dart_u3.o
 obj-y += dart_u3.o
 obj-y += dart_u4.o
 obj-y += delay.o
-obj-y += dom0_ops.o
+obj-y += domctl.o
 obj-y += domain_build.o
 obj-y += domain.o
 obj-y += exceptions.o
@@ -37,6 +37,7 @@ obj-y += shadow.o
 obj-y += shadow.o
 obj-y += smp.o
 obj-y += smp-tbsync.o
+obj-y += sysctl.o
 obj-y += time.o
 obj-y += usercopy.o
 
diff -r 6902fa91b657 -r 48840bbe607d xen/arch/powerpc/domctl.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/xen/arch/powerpc/domctl.c Tue Sep 12 14:28:16 2006 -0500
@@ -0,0 +1,118 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright (C) IBM Corp. 2005
+ *
+ * Authors: Jimi Xenidis <[EMAIL PROTECTED]>
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+void arch_getdomaininfo_ctxt(struct vcpu *, vcpu_guest_context_t *);
+void arch_getdomaininfo_ctxt(struct vcpu *v, vcpu_guest_context_t *c)
+{ 
+memcpy(&c->user_regs, &v->arch.ctxt, sizeof(struct cpu_user_regs));
+/* XXX fill in rest of vcpu_guest_context_t */
+}
+
+long arch_do_domctl(struct xen_domctl *domctl,
+XEN_GUEST_HANDLE(xen_domctl_t) u_domctl);
+long arch_do_domctl(struct xen_domctl *domctl,
+XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
+{
+long ret = 0;
+
+switch (domctl->cmd) {
+case XEN_DOMCTL_getmemlist:
+{
+int i;
+struct domain *d = find_domain_by_id(domctl->domain);
+unsigned long max_pfns = domctl->u.getmemlist.max_pfns;
+xen_pfn_t mfn;
+struct list_head *list_ent;
+
+ret = -EINVAL;
+if ( d != NULL )
+{
+ret = 0;
+
+spin_lock(&d->page_alloc_lock);
+list_ent = d->page_list.next;
+for ( i = 0; (i < max_pfns) && (list_ent != &d->page_list); i++ )
+{
+mfn = page_to_mfn(list_entry(
+list_ent, struct page_info, list));
+if ( copy_to_guest_offset(domctl->u.getmemlist.buffer,
+  i, &mfn, 1) )
+{
+ret = -EFAULT;
+break;
+}
+list_ent = mfn_to_page(mfn)->list.next;
+}
+spin_unlock(&d->page_alloc_lock);
+
+domctl->u.getmemlist.num_pfns = i;
+copy_to_guest(u_domctl, domctl, 1);
+
+put_domain(d);
+}
+}
+break;
+case XEN_DOMCTL_shadow_op:
+{
+struct domain *d;
+ret = -ESRCH;
+d = find_domain_by_id(domctl->domain);
+if ( d != NULL )
+{
+ret = shadow_domctl(d, &domctl->u.shadow_op, u_domctl);
+put_domain(d);
+copy_to_guest(u_domctl, domctl, 1);
+} 
+}
+break;
+case XEN_DOMCTL_real_mode_area:
+{
+struct domain *d;
+unsigned int log = domctl->u.real_mode_area.log;
+
+ret = -ESRCH;
+d = find_domain_by_id(domctl->domain);
+if (d != NULL) {
+ret = -EINVAL;
+if (cpu_rma_valid(log))
+ret = allocate_rma(d, log - PAGE_SHIFT);
+put_domain(d);
+}
+}
+break;
+
+default:
+ret = -ENOSYS;
+break;
+}
+
+return ret;
+}
diff -r 6902fa91b657 -r 48840bbe607d xen/arch/powerpc/sysctl.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/xen/arch/powerpc/sysctl.c Tue Sep 12 14:28:16 2006 -0500
@@ -0,0 +1,65 @@
+/*
+ * This program is f

[XenPPC] [xenppc-unstable] [XEN] Move xencomm into generic code and support "inline" handles.

2006-09-12 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Hollis Blanchard <[EMAIL PROTECTED]>
# Node ID b057b940f6ebeec7527c089b5656669025d9a640
# Parent  a79b3252bbe46a13d91586081e7f6be278b07126
[XEN] Move xencomm into generic code and support "inline" handles.
- inline code based on code from Tristan Gingold <[EMAIL PROTECTED]>
- make xencomm_handle_is_null() more thorough (check all addresses)
- delete unused asm-powerpc/uaccess.h
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
 xen/include/asm-powerpc/uaccess.h  |   38 ---
 xen/arch/powerpc/usercopy.c|  214 --
 xen/common/Makefile|1 
 xen/common/xencomm.c   |  316 +
 xen/include/asm-powerpc/guest_access.h |   78 
 xen/include/asm-powerpc/mm.h   |   27 --
 xen/include/asm-powerpc/page.h |   25 ++
 xen/include/public/arch-powerpc.h  |2 
 xen/include/public/xencomm.h   |6 
 xen/include/xen/xencomm.h  |  115 
 10 files changed, 471 insertions(+), 351 deletions(-)

diff -r a79b3252bbe4 -r b057b940f6eb xen/arch/powerpc/usercopy.c
--- a/xen/arch/powerpc/usercopy.c   Fri Sep 08 12:37:27 2006 -0500
+++ b/xen/arch/powerpc/usercopy.c   Tue Sep 12 12:08:04 2006 -0500
@@ -18,23 +18,13 @@
  * Authors: Hollis Blanchard <[EMAIL PROTECTED]>
  */
 
-#include 
-#include 
 #include 
+#include 
 #include 
-#include 
-#include 
-#include 
-
-#undef DEBUG
-#ifdef DEBUG
-static int xencomm_debug = 1; /* extremely verbose */
-#else
-#define xencomm_debug 0
-#endif
+#include 
 
 /* XXX need to return error, not panic, if domain passed a bad pointer */
-static unsigned long paddr_to_maddr(unsigned long paddr)
+unsigned long paddr_to_maddr(unsigned long paddr)
 {
 struct vcpu *v = get_current();
 struct domain *d = v->domain;
@@ -77,201 +67,3 @@ static unsigned long paddr_to_maddr(unsi
 
 return pa;
 }
-
-/**
- * xencomm_copy_from_guest: Copy a block of data from domain space.
- * @to:   Machine address.
- * @from: Physical address to a xencomm buffer descriptor.
- * @n:Number of bytes to copy.
- * @skip: Number of bytes from the start to skip.
- *
- * Copy data from domain to hypervisor.
- *
- * Returns number of bytes that could not be copied.
- * On success, this will be zero.
- */
-unsigned long
-xencomm_copy_from_guest(void *to, const void *from, unsigned int n,
-unsigned int skip)
-{
-struct xencomm_desc *desc;
-unsigned int from_pos = 0;
-unsigned int to_pos = 0;
-unsigned int i = 0;
-
-/* first we need to access the descriptor */
-desc = (struct xencomm_desc *)paddr_to_maddr((unsigned long)from);
-if (desc == NULL)
-return n;
-
-if (desc->magic != XENCOMM_MAGIC) {
-printk("%s: error: %p magic was 0x%x\n",
-   __func__, desc, desc->magic);
-return n;
-}
-
-/* iterate through the descriptor, copying up to a page at a time */
-while ((to_pos < n) && (i < desc->nr_addrs)) {
-unsigned long src_paddr = desc->address[i];
-unsigned int pgoffset;
-unsigned int chunksz;
-unsigned int chunk_skip;
-
-if (src_paddr == XENCOMM_INVALID) {
-i++;
-continue;
-}
-
-pgoffset = src_paddr % PAGE_SIZE;
-chunksz = PAGE_SIZE - pgoffset;
-
-chunk_skip = min(chunksz, skip);
-from_pos += chunk_skip;
-chunksz -= chunk_skip;
-skip -= chunk_skip;
-
-if (skip == 0) {
-unsigned long src_maddr;
-unsigned long dest = (unsigned long)to + to_pos;
-unsigned int bytes = min(chunksz, n - to_pos);
-
-src_maddr = paddr_to_maddr(src_paddr + chunk_skip);
-if (src_maddr == 0)
-return n - to_pos;
-
-if (xencomm_debug)
-printk("%lx[%d] -> %lx\n", src_maddr, bytes, dest);
-memcpy((void *)dest, (void *)src_maddr, bytes);
-from_pos += bytes;
-to_pos += bytes;
-}
-
-i++;
-}
-
-return n - to_pos;
-}
-
-/**
- * xencomm_copy_to_guest: Copy a block of data to domain space.
- * @to: Physical address to xencomm buffer descriptor.
- * @from:   Machine address.
- * @n:  Number of bytes to copy.
- * @skip: Number of bytes from the start to skip.
- *
- * Copy data from hypervisor to domain.
- *
- * Returns number of bytes that could not be copied.
- * On success, this will be zero.
- */
-unsigned long
-xencomm_copy_to_guest(void *to, const void *from, unsigned int n,
-unsigned int skip)
-{
-struct xencomm_desc *desc;
-unsigned int from_pos = 0;
-unsigned int to_pos = 0;
-unsigned int i = 0;
-
-/* first we need to access the descriptor */
-desc = (struct xencomm_desc *)paddr_to_maddr((unsigned long)to);
-if (desc == NULL)
-return n;
-
-if (desc->magic != XENCOMM_MAGIC) {
-printk("%s error: %p magic was 0x%x\n", __func__, 

[XenPPC] [xenppc-unstable] [XEN][POWERPC] fix timebase race in SMP init

2006-09-08 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Hollis Blanchard <[EMAIL PROTECTED]>
# Node ID 0fb10fe89f52ba893200166d28a789f7672c6984
# Parent  d9cda0370e6e268ecacccbbd1c2725ee1c2ddb2c
[XEN][POWERPC] fix timebase race in SMP init

cpuid was being set twice in cpu_online_map, and the first one was causing a
race in the timebase synchronization code.

Signed-off-by: Amos Waterland <[EMAIL PROTECTED]>
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/setup.c |1 -
 1 files changed, 1 deletion(-)

diff -r d9cda0370e6e -r 0fb10fe89f52 xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Fri Sep 08 10:23:56 2006 -0500
+++ b/xen/arch/powerpc/setup.c  Fri Sep 08 12:28:49 2006 -0500
@@ -244,7 +244,6 @@ static int kick_secondary_cpus(int maxcp
 if (cpuid >= maxcpus)
 break;
 init_parea(cpuid);
-cpu_set(cpuid, cpu_online_map);
 smp_generic_give_timebase();
 
 /* wait for it */

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Fix allocation error for xencomm "mini" descriptors.

2006-09-08 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Hollis Blanchard <[EMAIL PROTECTED]>
# Node ID d9cda0370e6e268ecacccbbd1c2725ee1c2ddb2c
# Parent  5c0fb37b2a07fe464d201e7ff857ba3869ff292a
[XEN][POWERPC] Fix allocation error for xencomm "mini" descriptors.

Previous code worked correctly only if the allocated structure fit in the same
page as the base address. If the structure did not fit, the computation for the
allocation was incorrect. Noticed by Kiyokuni KAWACHIYA <[EMAIL PROTECTED]>.

Signed-off-by: Maria Butrico <[EMAIL PROTECTED]>
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/of_handler/xencomm.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff -r 5c0fb37b2a07 -r d9cda0370e6e xen/arch/powerpc/of_handler/xencomm.c
--- a/xen/arch/powerpc/of_handler/xencomm.c Fri Sep 08 10:22:45 2006 -0500
+++ b/xen/arch/powerpc/of_handler/xencomm.c Fri Sep 08 10:23:56 2006 -0500
@@ -50,18 +50,18 @@ static void *__xencomm_alloc_mini(void *
 static void *__xencomm_alloc_mini(void *area, int arealen)
 {
 unsigned long base = (unsigned long)area;
-unsigned int pageoffset;
+unsigned int left_in_page;
 
-pageoffset = base % PAGE_SIZE;
+left_in_page = PAGE_SIZE - base % PAGE_SIZE;
 
 /* we probably fit right at the front of area */
-if ((PAGE_SIZE - pageoffset) >= sizeof(struct xencomm_mini)) {
+if (left_in_page >= sizeof(struct xencomm_mini)) {
 return area;
 }
 
 /* if not, see if area is big enough to advance to the next page */
-if ((arealen - pageoffset) >= sizeof(struct xencomm_mini))
-return (void *)(base + pageoffset);
+if ((arealen - left_in_page) >= sizeof(struct xencomm_mini))
+return (void *)(base + left_in_page);
 
 /* area was too small */
 return NULL;

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] Fix machine check build break.

2006-09-08 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Hollis Blanchard <[EMAIL PROTECTED]>
# Node ID 5c0fb37b2a07fe464d201e7ff857ba3869ff292a
# Parent  715014b9548840332aec42a5bc230818cab05064
[XEN][POWERPC] Fix machine check build break.
Building exceptions.c with CRASH_DEBUG=y produces a build break, because
gcc complains about the unused variable.

Signed-off-by: Amos Waterland <[EMAIL PROTECTED]>
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/exceptions.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff -r 715014b95488 -r 5c0fb37b2a07 xen/arch/powerpc/exceptions.c
--- a/xen/arch/powerpc/exceptions.c Thu Sep 07 22:09:06 2006 -0400
+++ b/xen/arch/powerpc/exceptions.c Fri Sep 08 10:22:45 2006 -0500
@@ -55,11 +55,11 @@ void do_dec(struct cpu_user_regs *regs)
 
 void program_exception(struct cpu_user_regs *regs, unsigned long cookie)
 {
-int recover = 0;
-
 #ifdef CRASH_DEBUG
 __trap_to_gdb(regs, cookie);
 #else /* CRASH_DEBUG */
+int recover = 0;
+
 show_registers(regs);
 printk("dar 0x%016lx, dsisr 0x%08x\n", mfdar(), mfdsisr());
 printk("hid4 0x%016lx\n", regs->hid4);

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] cleanup for (;;);

2006-08-29 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID 5d02e1740961aa13099c3f0f23d9df13223f8456
# Parent  f05a3e9d3e8f67a47afe4f528084d87c2e9d07ce
[XEN][POWERPC] cleanup for (;;);

When the port first started, we didn't even have panic() working
properly so we used "for(;;);" loops to stop execution.  Now that output
is buffered these look like hangs, since you usually do not see the
printk() before.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/dart_u3.c  |8 
 xen/arch/powerpc/external.c |3 +--
 xen/arch/powerpc/papr/tce.c |6 +++---
 3 files changed, 8 insertions(+), 9 deletions(-)

diff -r f05a3e9d3e8f -r 5d02e1740961 xen/arch/powerpc/dart_u3.c
--- a/xen/arch/powerpc/dart_u3.cMon Aug 28 18:35:29 2006 -0500
+++ b/xen/arch/powerpc/dart_u3.cTue Aug 29 06:53:58 2006 -0400
@@ -55,10 +55,10 @@ static void u3_inv_all(void)
 dc.reg.dc_invtlb = 1;
 out_32(dart_ctl_reg, dc.dc_word);
 
-do {
-dc.dc_word = in_32(dart_ctl_reg);
-r++;
-} while ((dc.reg.dc_invtlb == 1) && (r < (1 << l)));
+do {
+dc.dc_word = in_32(dart_ctl_reg);
+r++;
+} while ((dc.reg.dc_invtlb == 1) && (r < (1 << l)));
 
 if (r == (1 << l)) {
 if (l < 4) {
diff -r f05a3e9d3e8f -r 5d02e1740961 xen/arch/powerpc/external.c
--- a/xen/arch/powerpc/external.c   Mon Aug 28 18:35:29 2006 -0500
+++ b/xen/arch/powerpc/external.c   Tue Aug 29 06:53:58 2006 -0400
@@ -175,8 +175,7 @@ void init_IRQ(void)
 
 void ack_APIC_irq(void)
 {
-printk("%s: EOI the whole MPIC?\n", __func__);
-for (;;);
+panic("%s: EOI the whole MPIC?\n", __func__);
 }
 
 void ack_bad_irq(unsigned int irq)
diff -r f05a3e9d3e8f -r 5d02e1740961 xen/arch/powerpc/papr/tce.c
--- a/xen/arch/powerpc/papr/tce.c   Mon Aug 28 18:35:29 2006 -0500
+++ b/xen/arch/powerpc/papr/tce.c   Tue Aug 29 06:53:58 2006 -0400
@@ -47,7 +47,7 @@ static void h_put_tce(struct cpu_user_re
 regs->gprs[3] = H_Success;
 }
 }
-
+
 static void h_get_tce(struct cpu_user_regs *regs)
 {
 u32 liobn = regs->gprs[4];
@@ -57,7 +57,7 @@ static void h_get_tce(struct cpu_user_re
 printk("%s: liobn: 0x%x ioba: 0x%lx \n", __func__, liobn, ioba);
 #endif
 regs->gprs[3] = H_Function;
-for(;;) ;
+BUG();
 }
 
 static void h_stuff_tce(struct cpu_user_regs *regs)
@@ -76,7 +76,7 @@ static void h_stuff_tce(struct cpu_user_
 count);
 #endif
 regs->gprs[3] = H_Function;
-for(;;);
+BUG();
 }

 __init_papr_hcall(H_PUT_TCE, h_put_tce);

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] split out an allocate_rma() function from arch_domain_create()

2006-08-25 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Hollis Blanchard <[EMAIL PROTECTED]>
# Node ID 5fe200a45698143f3614cad2b206d4f285a9d31c
# Parent  e58d85332e0cc2a4696eb14a6adbc9086d427573
[XEN][POWERPC] split out an allocate_rma() function from arch_domain_create()
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/domain.c|   34 ++
 xen/arch/powerpc/mm.c|   23 +++
 xen/include/asm-powerpc/mm.h |2 ++
 3 files changed, 39 insertions(+), 20 deletions(-)

diff -r e58d85332e0c -r 5fe200a45698 xen/arch/powerpc/domain.c
--- a/xen/arch/powerpc/domain.c Fri Aug 25 14:48:07 2006 -0500
+++ b/xen/arch/powerpc/domain.c Fri Aug 25 15:09:36 2006 -0500
@@ -76,8 +76,9 @@ int arch_domain_create(struct domain *d)
 {
 unsigned long rma_base;
 unsigned long rma_sz;
-uint htab_order;
-uint nr_pages;
+uint rma_order_pages;
+uint htab_order_pages;
+int rc;
 
 if (d->domain_id == IDLE_DOMAIN_ID) {
 d->shared_info = (void *)alloc_xenheap_page();
@@ -86,23 +87,16 @@ int arch_domain_create(struct domain *d)
 return 0;
 }
 
-d->arch.rma_order = cpu_default_rma_order_pages();
-rma_sz = rma_size(d->arch.rma_order);
-
 /* allocate the real mode area */
-nr_pages =  1UL << d->arch.rma_order;
-d->max_pages = nr_pages;
+rma_order_pages = cpu_default_rma_order_pages();
+d->max_pages = 1UL << rma_order_pages;
 d->tot_pages = 0;
-d->arch.rma_page = alloc_domheap_pages(d, d->arch.rma_order, 0);
-if (NULL == d->arch.rma_page)
-return 1;
-
+
+rc = allocate_rma(d, rma_order_pages);
+if (rc)
+return rc;
 rma_base = page_to_maddr(d->arch.rma_page);
-
-BUG_ON(rma_base & (rma_sz - 1)); /* check alignment */
-
-printk("clearing RMO: 0x%lx[0x%lx]\n", rma_base, rma_sz);
-memset((void *)rma_base, 0, rma_sz);
+rma_sz = rma_size(rma_order_pages);
 
 d->shared_info = (shared_info_t *)
 (rma_addr(&d->arch, RMA_SHARED_INFO) + rma_base);
@@ -113,12 +107,12 @@ int arch_domain_create(struct domain *d)
 /* FIXME: we need to the the maximum addressible memory for this
  * domain to calculate this correctly. It should probably be set
  * by the managment tools */
-htab_order = d->arch.rma_order - 6; /* (1/64) */
+htab_order_pages = rma_order_pages - 6; /* (1/64) */
 if (test_bit(_DOMF_privileged, &d->domain_flags)) {
 /* bump the htab size of privleged domains */
-++htab_order;
-}
-htab_alloc(d, htab_order);
+++htab_order_pages;
+}
+htab_alloc(d, htab_order_pages);
 
 return 0;
 }
diff -r e58d85332e0c -r 5fe200a45698 xen/arch/powerpc/mm.c
--- a/xen/arch/powerpc/mm.c Fri Aug 25 14:48:07 2006 -0500
+++ b/xen/arch/powerpc/mm.c Fri Aug 25 15:09:36 2006 -0500
@@ -239,6 +239,29 @@ static int mfn_in_hole(ulong mfn)
 return 0;
 }
 
+int allocate_rma(struct domain *d, unsigned int order_pages)
+{
+ulong rma_base;
+ulong rma_sz = rma_size(order_pages);
+
+d->arch.rma_page = alloc_domheap_pages(d, order_pages, 0);
+if (d->arch.rma_page == NULL) {
+DPRINTK("Could not allocate order_pages=%d RMA for domain %u\n",
+order_pages, d->domain_id);
+return -ENOMEM;
+}
+d->arch.rma_order = order_pages;
+
+rma_base = page_to_maddr(d->arch.rma_page);
+BUG_ON(rma_base & (rma_sz - 1)); /* check alignment */
+
+/* XXX */
+printk("clearing RMA: 0x%lx[0x%lx]\n", rma_base, rma_sz);
+memset((void *)rma_base, 0, rma_sz);
+
+return 0;
+}
+
 ulong pfn2mfn(struct domain *d, long pfn, int *type)
 {
 ulong rma_base_mfn = page_to_mfn(d->arch.rma_page);
diff -r e58d85332e0c -r 5fe200a45698 xen/include/asm-powerpc/mm.h
--- a/xen/include/asm-powerpc/mm.h  Fri Aug 25 14:48:07 2006 -0500
+++ b/xen/include/asm-powerpc/mm.h  Fri Aug 25 15:09:36 2006 -0500
@@ -258,6 +258,8 @@ static inline unsigned long gmfn_to_mfn(
 
 #define mfn_to_gmfn(_d, mfn) (mfn)
 
+extern int allocate_rma(struct domain *d, unsigned int order_pages);
+
 extern int steal_page(struct domain *d, struct page_info *page,
 unsigned int memflags);
 

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


[XenPPC] [xenppc-unstable] [XEN][POWERPC] restructure RMA code to allow dom0 tools to allocate in the future

2006-08-25 Thread Xen patchbot-xenppc-unstable
# HG changeset patch
# User Hollis Blanchard <[EMAIL PROTECTED]>
# Node ID e58d85332e0cc2a4696eb14a6adbc9086d427573
# Parent  769ff9efeca25711f0fcc568caa125c1df3d114e
[XEN][POWERPC] restructure RMA code to allow dom0 tools to allocate in the 
future
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/boot_of.c  |2 -
 xen/arch/powerpc/domain.c   |2 -
 xen/arch/powerpc/powerpc64/ppc970.c |   66 ++--
 xen/arch/powerpc/setup.c|2 -
 xen/include/asm-powerpc/processor.h |2 -
 5 files changed, 37 insertions(+), 37 deletions(-)

diff -r 769ff9efeca2 -r e58d85332e0c xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.cFri Aug 25 15:28:48 2006 -0400
+++ b/xen/arch/powerpc/boot_of.cFri Aug 25 14:48:07 2006 -0500
@@ -727,7 +727,7 @@ static ulong find_space(u32 size, u32 al
 __func__, space_base, eomem, size, align);
 base = ALIGN_UP(space_base, PAGE_SIZE);
 
-while ((base + size) < rma_size(cpu_rma_order())) {
+while ((base + size) < rma_size(cpu_default_rma_order_pages())) {
 if (of_claim(base, size, 0) != OF_FAILURE) {
 space_base = base + size;
 return base;
diff -r 769ff9efeca2 -r e58d85332e0c xen/arch/powerpc/domain.c
--- a/xen/arch/powerpc/domain.c Fri Aug 25 15:28:48 2006 -0400
+++ b/xen/arch/powerpc/domain.c Fri Aug 25 14:48:07 2006 -0500
@@ -86,7 +86,7 @@ int arch_domain_create(struct domain *d)
 return 0;
 }
 
-d->arch.rma_order = cpu_rma_order();
+d->arch.rma_order = cpu_default_rma_order_pages();
 rma_sz = rma_size(d->arch.rma_order);
 
 /* allocate the real mode area */
diff -r 769ff9efeca2 -r e58d85332e0c xen/arch/powerpc/powerpc64/ppc970.c
--- a/xen/arch/powerpc/powerpc64/ppc970.c   Fri Aug 25 15:28:48 2006 -0400
+++ b/xen/arch/powerpc/powerpc64/ppc970.c   Fri Aug 25 14:48:07 2006 -0500
@@ -34,11 +34,34 @@
 
 extern volatile struct processor_area * volatile global_cpu_table[];
 
-unsigned int cpu_rma_order(void)
+struct rma_settings {
+int order;
+int rmlr0;
+int rmlr12;
+};
+
+static struct rma_settings rma_orders[] = {
+{ .order = 26, .rmlr0 = 0, .rmlr12 = 3, }, /*  64 MB */
+{ .order = 27, .rmlr0 = 1, .rmlr12 = 3, }, /* 128 MB */
+{ .order = 28, .rmlr0 = 1, .rmlr12 = 0, }, /* 256 MB */
+{ .order = 30, .rmlr0 = 0, .rmlr12 = 2, }, /*   1 GB */
+{ .order = 34, .rmlr0 = 0, .rmlr12 = 1, }, /*  16 GB */
+{ .order = 38, .rmlr0 = 0, .rmlr12 = 0, }, /* 256 GB */
+};
+
+static struct rma_settings *cpu_find_rma(unsigned int order)
 {
-/* XXX what about non-HV mode? */
-uint rma_log_size = 6 + 20; /* (1 << 6) == 64 */
-return rma_log_size - PAGE_SHIFT;
+int i;
+for (i = 0; i < ARRAY_SIZE(rma_orders); i++) {
+if (rma_orders[i].order == order)
+return &rma_orders[i];
+}
+return NULL;
+}
+
+unsigned int cpu_default_rma_order_pages(void)
+{
+return rma_orders[0].order - PAGE_SHIFT;
 }
 
 unsigned int cpu_large_page_orders(uint *sizes, uint max)
@@ -129,45 +152,22 @@ void cpu_init_vcpu(struct vcpu *v)
 {
 struct domain *d = v->domain;
 union hid4 hid4;
-ulong rma_base = page_to_maddr(d->arch.rma_page);
-ulong rma_size = rma_size(d->arch.rma_order);
+struct rma_settings *rma_settings;
 
 hid4.word = mfhid4();
 
 hid4.bits.lpes0 = 0; /* exceptions set MSR_HV=1 */
 hid4.bits.lpes1 = 1; /* RMA applies */
 
-hid4.bits.rmor = rma_base >> 26;
+hid4.bits.rmor = page_to_maddr(d->arch.rma_page) >> 26;
 
 hid4.bits.lpid01 = d->domain_id & 3;
 hid4.bits.lpid25 = (d->domain_id >> 2) & 0xf;
 
-switch (rma_size) {
-case 256ULL << 30:  /* 256 GB */
-hid4.bits.rmlr0 = 0;
-hid4.bits.rmlr12 = 0;
-break;
-case 16ULL << 30:   /* 16 GB */
-hid4.bits.rmlr0 = 0;
-hid4.bits.rmlr12 = 1;
-break;
-case 1ULL << 30:/* 1 GB */
-hid4.bits.rmlr0 = 0;
-hid4.bits.rmlr12 = 2;
-break;
-case 64ULL << 20:   /* 64 MB */
-hid4.bits.rmlr0 = 0;
-hid4.bits.rmlr12 = 3;
-break;
-case 256ULL << 20:  /* 256 MB */
-hid4.bits.rmlr0 = 1;
-hid4.bits.rmlr12 = 0;
-break;
-case 128ULL << 20:  /* 128 MB */
-hid4.bits.rmlr0 = 1;
-hid4.bits.rmlr12 = 3;
-break;
-}
+rma_settings = cpu_find_rma(d->arch.rma_order + PAGE_SHIFT);
+ASSERT(rma_settings != NULL);
+hid4.bits.rmlr0 = rma_settings->rmlr0;
+hid4.bits.rmlr12 = rma_settings->rmlr12;
 
 v->arch.cpu.hid4.word = hid4.word;
 }
diff -r 769ff9efeca2 -r e58d85332e0c xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Fri Aug 25 15:28:48 2006 -0400
+++ b/xen/arch/powerpc/setup.c  Fri Aug 25 14:48:07 2006 -0500
@@ -297,7 +297,7 @@ static void __init __start_xen(multiboot
 #endif
 
 /

  1   2   >