Re: [XenPPC] [PATCH/RFC] Handshake with secondary processors

2006-08-10 Thread Jimi Xenidis

Good, lets take it a little further.
I know you are are building on my original good enuff loop but lets  
go all the way here.


On Aug 9, 2006, at 11:12 PM, Amos Waterland wrote:



diff -r 058f2e27476d xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.cMon Aug 07 17:49:16 2006 -0500
+++ b/xen/arch/powerpc/boot_of.cWed Aug 09 23:08:03 2006 -0400
@@ -42,6 +42,7 @@ static char builtin_cmdline[COMMAND_LINE
 __attribute__((section(__builtin_cmdline))) = CMDLINE;

 extern struct ns16550_defaults ns16550;
+extern unsigned long __spin_ack;


There really is no need for this to be a long, the ID is an int so we  
could make it an int.
This would also make your assembler 32/64 neutral, tho I'm not too  
worried about that, and the barrier (too come) may not be neutral-able.


 #undef OF_DEBUG


@@ -956,7 +957,37 @@ static int __init boot_of_cpus(void)
 /* FIXME: should not depend on the boot CPU bring the first  
child */


That is correct.
so you need something like the following (psuedo code, bad style):

   of_getprop(bof_chosen, cpu, boot_cpu, sizeof (boot_cpu));

 cpu = of_getpeer(cpu);
 while (cpu  0) {

   if (cpu == boot_cpu)
   continue;


-of_start_cpu(cpu, (ulong)spin_start, 0);
+unsigned int cpuid;
+unsigned long ping, pong, now, then, timeout;
+unsigned long *ack = (unsigned long *)__spin_ack;
+
+result = of_getprop(cpu, reg, cpuid, sizeof(cpuid));
+if (result == OF_FAILURE) of_panic(cpuid lookup failed\n);
+
+of_printf(spinning up secondary processor #%d: , cpuid);
+
+*ack = 0x0;


Set this to ~0, cpuid 0 will cause you problems later.


+ping = *ack;
+of_printf(ping = %lx: , ping);
+
+mb();
+of_start_cpu(cpu, (ulong)spin_start, cpuid);
+
+then = mftb();
+timeout = then + 1024;
+do {
+now = mftb();
+if (now = timeout) {
+of_printf(SKIPPING: );
+pong = ~0x0;
+break;
+}
+
+mb();
+pong = *ack;
+} while (pong == ping);
+of_printf(pong = %lx\n, pong);
+
 cpu = of_getpeer(cpu);
 }
 return 1;
diff -r 058f2e27476d xen/arch/powerpc/powerpc64/exceptions.S
--- a/xen/arch/powerpc/powerpc64/exceptions.S	Mon Aug 07 17:49:16  
2006 -0500
+++ b/xen/arch/powerpc/powerpc64/exceptions.S	Wed Aug 09 21:41:16  
2006 -0400

@@ -178,6 +178,25 @@ zero:
 li r0, 0x0 /* exception vector for GDB stub */
 bctr



The space at the beginning of text is precious, please but this back  
to the end of this file.
Extra credit: As you add more code here for the barrier I would not  
discourage a unique file here that is not 64bit specific and may end  
up in the __init section so it can be released.



+/* Begin secondary processor spin and ack logic.  */
+.globl __spin_ack
+__spin_ack:
+.llong 0x0

'.long' here is plenty.
BTW: I can think of no reason this cannot be allocated in C rather  
than assembler, it would be easier to find with cscope. :)



+   
+.globl spin_start
+spin_start:
I almost tricked myself here, so a comment about how we do _not_ use  
_GLOBAL() because we desire a function entry point rather than a  
function descriptor, would be nice.



+/* Our physical cpu number is passed in r3.  */
+mr r24, r3
+lis r25, [EMAIL PROTECTED]
+ori r25, r25, [EMAIL PROTECTED]
+rldicr r25, r25, 32, 31
+oris r25, r25, [EMAIL PROTECTED]
+ori r25, r25, [EMAIL PROTECTED]
+stdu r24, 0(r25)


The above assembler can be replaced by:
   LOADADDR(r4, __spin_ack)
   stw r3, 0(r4)

I use r4 because it really doesn't matter what register you use, so  
you have 31 to chose from :)



+sync
+b .
+
+/* Begin exception handlers.  */   
 . = 0x100 # System Reset
 ex_reset:
 /* XXX thread initialization */
@@ -513,7 +532,3 @@ _GLOBAL(sleep)
 isync
 mtmsrd r3
 blr
-
-.globl spin_start
-spin_start:
-b .

___
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] Re: [RFC] consolidated libdt proposal

2006-08-10 Thread Milton Miller
On Tue Aug  8 2006 01:04:08 PM CDT, Mark A. Greer wrote:
 If we're going to allow cmdline editing in the bootwrapper, we would
 need to extend the size of a property.  We've never really talked about
 cmdline editing in the powerpc branch but I assume that its a good
 thing(tm).  I know I would like to have it so, IMHO, I think we should
 add it (and therefore require extending a property).

We already have replace the command line merged (it's why my patches
don't apply).

milton

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


Re: [XenPPC] [linux-ppc-2.6] [POWERPC] add HYPERVISOR_xen_version(XENVER_get_features)

2006-08-10 Thread Hollis Blanchard
On Wed, 2006-08-09 at 23:02 +, Xen patchbot-linux-ppc-2.6 wrote:
 -   rc = xencomm_create(arg, argsize, desc, GFP_KERNEL);
 +   if (!slab) {
 +   slab = slab_is_available();
 +   }
 +   if (slab)
 +   rc = xencomm_create(arg, argsize, desc, GFP_KERNEL);
 +   else
 +   rc = xencomm_create_mini(xc_area, XENCOMM_MINI_AREA,
 +arg, argsize, desc);

Why bother? If you have to use _mini() once, why not just use it all the
time?

-- 
Hollis Blanchard
IBM Linux Technology Center


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


Re: [XenPPC] xencomm_create_mini() w/ user buffers

2006-08-10 Thread Hollis Blanchard
On Thu, 2006-08-10 at 13:51 -0400, Jimi Xenidis wrote:
 On Aug 10, 2006, at 1:45 PM, Hollis Blanchard wrote:
 
  On Wed, 2006-08-09 at 23:02 +, Xen patchbot-linux-ppc-2.6 wrote:
  -   rc = xencomm_create(arg, argsize, desc, GFP_KERNEL);
  +   if (!slab) {
  +   slab = slab_is_available();
  +   }
  +   if (slab)
  +   rc = xencomm_create(arg, argsize, desc, GFP_KERNEL);
  +   else
  +   rc = xencomm_create_mini(xc_area, XENCOMM_MINI_AREA,
  +arg, argsize, desc);
 
  Why bother? If you have to use _mini() once, why not just use it  
  all the
  time?
 
 Because _mini() is for kernel space only, and this routine services  
 user-level pointers as well, I did not think that changing _mini()  
 was worth it.

Would xencomm_create_mini() work just as well using __vaddr_to_paddr? It
looks like we could remove __kern_paddr entirely.

 Actually, instead of slab_is_available() we could have use something  
 like have started init() but I know of no such function.

The real question is can we call get_free_page()? Having started init
seems as coincidentally related to that as slab_is_available()...

-- 
Hollis Blanchard
IBM Linux Technology Center


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


[XenPPC] Re: [Xen-devel] [PATCH] architecture-specific stuff in xend

2006-08-10 Thread John Levon
On Thu, Aug 10, 2006 at 04:12:37PM -0500, Hollis Blanchard wrote:

 John, would you extend this scheme to cover host OS differences? I think

I think it makes sense to use a parallel scheme of xen/xend/host/ for
those parameters. That is, the way you've done this looks good to me.

 tools/python/xen/util/Brctl.py, wouldn't it make more sense to replace
 that file entirely depending on the host OS?

Yes. As it is, it's only used for the vnet stuff, which only exists on
Linux, so it's not a super-big problem right now.

thanks
john

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


[XenPPC] [linux-ppc-2.6] [POWERPC] get the UDB delay correct

2006-08-10 Thread Xen patchbot-linux-ppc-2 . 6
# HG changeset patch
# User Jimi Xenidis [EMAIL PROTECTED]
# Node ID 584e21f08d0c092170a6879892b43efe860e2a9c
# Parent  8a5663668eed06e69bf09f67a5d37f6e1d4bbc80
[POWERPC] get the UDB delay correct

This patch makes sure that an absolute time is used to set the timer.

Signed-off-by: Jimi Xenidis [EMAIL PROTECTED]
---
 arch/powerpc/platforms/xen/setup.c|5 -
 arch/powerpc/platforms/xen/setup.h|   10 ++
 arch/powerpc/platforms/xen/udbg_xen.c |   10 +++---
 3 files changed, 17 insertions(+), 8 deletions(-)

diff -r 8a5663668eed -r 584e21f08d0c arch/powerpc/platforms/xen/setup.c
--- a/arch/powerpc/platforms/xen/setup.cThu Aug 10 15:43:50 2006 -0400
+++ b/arch/powerpc/platforms/xen/setup.cThu Aug 10 16:36:39 2006 -0400
@@ -155,11 +155,6 @@ static u64 jiffies_to_ns(unsigned long j
 static u64 jiffies_to_ns(unsigned long j) 
 {
return j * (10UL / HZ);
-}
-
-static u64 tb_to_ns(u64 tb)
-{
-   return tb * (10UL / tb_ticks_per_sec);
 }
 
 static void xen_idle(void)
diff -r 8a5663668eed -r 584e21f08d0c arch/powerpc/platforms/xen/setup.h
--- a/arch/powerpc/platforms/xen/setup.hThu Aug 10 15:43:50 2006 -0400
+++ b/arch/powerpc/platforms/xen/setup.hThu Aug 10 16:36:39 2006 -0400
@@ -1,6 +1,16 @@
+
+#include asm/machdep.h
 
 extern void evtchn_init_IRQ(void);
 extern void xen_init_IRQ(void);
 extern void xen_reboot_init(struct machdep_calls *);
 extern void xen_maple_init_IRQ(void);
 extern int xen_get_irq(struct pt_regs *regs);
+
+static inline u64 tb_to_ns(u64 tb)
+{
+   if (likely(tb_ticks_per_sec)) {
+   return tb * (10UL / tb_ticks_per_sec);
+   }
+   return 0;
+}
diff -r 8a5663668eed -r 584e21f08d0c arch/powerpc/platforms/xen/udbg_xen.c
--- a/arch/powerpc/platforms/xen/udbg_xen.c Thu Aug 10 15:43:50 2006 -0400
+++ b/arch/powerpc/platforms/xen/udbg_xen.c Thu Aug 10 16:36:39 2006 -0400
@@ -4,6 +4,7 @@
 #include xen/evtchn.h
 #include asm/udbg.h
 #include asm/hypervisor.h
+#include setup.h
 
 static void udbg_putc_dom0_xen(char c)
 {
@@ -52,9 +53,12 @@ static int udbg_getc_dom0_xen(void)
for (;;) {
ch = udbg_getc_poll_dom0_xen();
if (ch == -1) {
-   /* nano seconds */
-   HYPERVISOR_set_timer_op(1);
-   HYPERVISOR_sched_op(SCHEDOP_block, NULL);
+   u64 now_ns = tb_to_ns(get_tb());
+   if (now_ns  0) {
+   u64 offset_ns = 1; /* 100ms */
+   HYPERVISOR_set_timer_op(now_ns + offset_ns);
+   HYPERVISOR_sched_op(SCHEDOP_block, NULL);
+   }
} else {
return ch;
}

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