Skip to contentSkip to conversation

Trying to get Xenomai on P1010RDB

Xenomai Charles Retailleau 5 participants 10 messages Aug 16, 2012 – Aug 17, 2012

lore
Share & tools
lore
#0 lore raw

Hi all,
The patching/compilation/installation steps seem fine. But at the end I cannot have any Xenomai software running on the P1010RDB (I tried most of the provided test SW).

I focused on latency and tried to debug it. I get that:

Program received signal SIGILL, Illegal instruction. 0x0ffde120 in __xn_rdtsc () from ....xenomai/lib/libnative.so.3

It appears that the 'mftb/mftbu' instructions
are in cause (cf. the small test in attachment, the 1st part works but not the mftb test).
Furthermore when I check the core e500 ref manual
http://cache.freescale.com/files/32bit/doc/ref_manual/E500CORERM.pdf
MFTB appears has NOT being part of the instruction list.

Yet, Xenomai seems to work on P1020RDB which has the same core, so I'm confused...
What did I do wrong ?

I'm using
Xenomai 2.6.1,
linux 3.2.21 configured with mpc85xx_defconfig (default options for
the rest of it),
Freescale's SDK 1.1.2 (that's the main difference between me and
Lukasz Zemla's config on P1020RDB, so I'm trying to get the latest 1.2)

Thanks for your help.
Charles,
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: testMFTB.c
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20120816/d22f48c2/attachment.c>

#1 lore raw
Quoted 21 lines · Charles Retailleau

Hi all,
The patching/compilation/installation steps seem fine. But at the end I cannot have any Xenomai software running on the P1010RDB (I tried most of the provided test SW).

I focused on latency and tried to debug it. I get that:

Program received signal SIGILL, Illegal instruction. 0x0ffde120 in __xn_rdtsc () from ....xenomai/lib/libnative.so.3

It appears that the 'mftb/mftbu' instructions
are in cause (cf. the small test in attachment, the 1st part works but not the mftb test).
Furthermore when I check the core e500 ref manual
http://cache.freescale.com/files/32bit/doc/ref_manual/E500CORERM.pdf
MFTB appears has NOT being part of the instruction list.

Yet, Xenomai seems to work on P1020RDB which has the same core, so I'm confused...
What did I do wrong ?

Quoted 6 lines

I'm using
Xenomai 2.6.1,
linux 3.2.21 configured with mpc85xx_defconfig (default options for
the rest of it),
Freescale's SDK 1.1.2 (that's the main difference between me and
Lukasz Zemla's config on P1020RDB, so I'm trying to get the latest 1.2)

mftb is a phased out instruction according to the powerpc 2.06 rev B documentation. mfspr is the prefered instruction to use instead on everything other than the old 603 and POWER3 CPUs.

It is quite possible the e500 hence doesn't support it. According to
http://cache.freescale.com/files/32bit/doc/app_note/AN3445.pdf it specificly does NOT have mftb. Neither does the e300 core which is what we are using with xenomai (MPC8360e specificly).

Signature · 1 line
Len Sorensen
#2 lore raw
Quoted 29 lines · Lennart Sorensen
Quoted 21 lines · Charles Retailleau

Hi all,
The patching/compilation/installation steps seem fine. But at the end I cannot have any Xenomai software running on the P1010RDB (I tried most of the provided test SW).

I focused on latency and tried to debug it. I get that:

Program received signal SIGILL, Illegal instruction. 0x0ffde120 in __xn_rdtsc () from ....xenomai/lib/libnative.so.3

It appears that the 'mftb/mftbu' instructions
are in cause (cf. the small test in attachment, the 1st part works but not the mftb test).
Furthermore when I check the core e500 ref manual
http://cache.freescale.com/files/32bit/doc/ref_manual/E500CORERM.pdf
MFTB appears has NOT being part of the instruction list.

Yet, Xenomai seems to work on P1020RDB which has the same core, so I'm confused...
What did I do wrong ?

Quoted 6 lines

I'm using
Xenomai 2.6.1,
linux 3.2.21 configured with mpc85xx_defconfig (default options for
the rest of it),
Freescale's SDK 1.1.2 (that's the main difference between me and
Lukasz Zemla's config on P1020RDB, so I'm trying to get the latest 1.2)

Quoted 8 lines

mftb is a phased out instruction according to the powerpc 2.06 rev B documentation. mfspr is the prefered instruction to use instead on everything other than the old 603 and POWER3 CPUs.

It is quite possible the e500 hence doesn't support it. According to
http://cache.freescale.com/files/32bit/doc/app_note/AN3445.pdf it specificly does NOT have mftb. Neither does the e300 core which is what we are using with xenomai (MPC8360e specificly).

It uses an e500v2 core. I use the ELDK 5.2.1 "powerpc-e500v2" for the P2020.

Wolfgang.

#3 lore raw
In reply to Lennart Sorensen

Thanks Lennart that was very useful, it now works.
Here is the little patch I made, yet I couldn't find a switch to force it for core e500/e500xx only...

--- ./xenomai-2.6.1.orig/include/asm-powerpc/syscall.h 2011-11-09
13:21:36.000000000 +0100
+++ ./xenomai-2.6.1.mine/./include/asm-powerpc/syscall.h 2012-08-17
15:47:28.387435909 +0200
@@ -167,9 +167,9 @@
} u;
unsigned long __tbu;

- __asm__ __volatile__("1: mftbu %0\n"
- "mftb %1\n"
- "mftbu %2\n"
+ __asm__ __volatile__("1: mfspr %0,269\n"
+ "mfspr %1,268\n"
+ "mfspr %2,269\n"
"cmpw %2,%0\n" "bne- 1b\n":"=r"(u.v[0]), "=r"(u.v[1]), "=r"(__tbu));
Thanks to all for your help
Charles,

Quoted 11 lines · Lennart Sorensen
Quoted 9 lines · Charles Retailleau

Hi all, The patching/compilation/installation steps seem fine. But at the end I cannot have any Xenomai software running on the P1010RDB (I tried most of the provided test SW).

I focused on latency and tried to debug it. I get that:

Program received signal SIGILL, Illegal instruction. 0x0ffde120 in __xn_rdtsc () from ....xenomai/lib/libnative.so.3

Quoted 6 lines
Quoted 6 lines

It appears that the 'mftb/mftbu' instructions are in cause (cf. the small test in attachment, the 1st part works but not the mftb test). Furthermore when I check the core e500 ref manual
http://cache.freescale.com/files/32bit/doc/ref_manual/E500CORERM.pdf

MFTB appears has NOT being part of the instruction list.

Quoted 19 lines
Quoted 9 lines

Yet, Xenomai seems to work on P1020RDB which has the same core, so I'm confused... What did I do wrong ?

I'm using Xenomai 2.6.1, linux 3.2.21 configured with mpc85xx_defconfig (default options for the rest of it), Freescale's SDK 1.1.2 (that's the main difference between me and Lukasz Zemla's config on P1020RDB, so I'm trying to get the latest 1.2)

mftb is a phased out instruction according to the powerpc 2.06 rev B documentation. mfspr is the prefered instruction to use instead on everything other than the old 603 and POWER3 CPUs.

It is quite possible the e500 hence doesn't support it. According to http://cache.freescale.com/files/32bit/doc/app_note/AN3445.pdf
it specificly does NOT have mftb. Neither does the e300 core which is what we are using with xenomai (MPC8360e specificly).

#4 lore raw
Quoted 22 lines · Charles Retailleau

Thanks Lennart that was very useful, it now works.
Here is the little patch I made, yet I couldn't find a switch to force it for core e500/e500xx only...

--- ./xenomai-2.6.1.orig/include/asm-powerpc/syscall.h 2011-11-09
13:21:36.000000000 +0100
+++ ./xenomai-2.6.1.mine/./include/asm-powerpc/syscall.h 2012-08-17
15:47:28.387435909 +0200

(quoted diff) +3 -3
@@ -167,9 +167,9 @@
 	} u;
 	unsigned long __tbu;
 
-	__asm__ __volatile__("1: mftbu %0\n"
-			     "mftb %1\n"
-			     "mftbu %2\n"
+	__asm__ __volatile__("1: mfspr %0,269\n"
+			     "mfspr %1,268\n"
+			     "mfspr %2,269\n"
 			     "cmpw %2,%0\n"
 			     "bne- 1b\n":"=r"(u.v[0]),
 			     "=r"(u.v[1]), "=r"(__tbu));
Quoted 2 lines

Thanks to all for your help
Charles,

If I understand correctly, this patch breaks old powerpcs. So, do we have a compilation constant allowing to know whether we are compiling for an old or new powerpc?

Signature · 1 line
					    Gilles.
#5 lore raw
Quoted 14 lines · Gilles Chanteperdrix
Quoted 13 lines · Charles Retailleau

Thanks Lennart that was very useful, it now works.
Here is the little patch I made, yet I couldn't find a switch to force it for core e500/e500xx only...

--- ./xenomai-2.6.1.orig/include/asm-powerpc/syscall.h 2011-11-09
13:21:36.000000000 +0100
+++ ./xenomai-2.6.1.mine/./include/asm-powerpc/syscall.h 2012-08-17
15:47:28.387435909 +0200

(quoted diff) +0 -0
@@ -167,9 +167,9 @@
  	} u;
  	unsigned long __tbu;
 
Quoted 16 lines
Quoted 11 lines
(quoted diff) +3 -3
-	__asm__ __volatile__("1: mftbu %0\n"
-			     "mftb %1\n"
-			     "mftbu %2\n"
+	__asm__ __volatile__("1: mfspr %0,269\n"
+			     "mfspr %1,268\n"
+			     "mfspr %2,269\n"
  			     "cmpw %2,%0\n"
  			     "bne- 1b\n":"=r"(u.v[0]),
  			     "=r"(u.v[1]), "=r"(__tbu));

Thanks to all for your help
Charles,

If I understand correctly, this patch breaks old powerpcs. So, do we have a compilation constant allowing to know whether we are compiling for an old or new powerpc?

For the sake of completeness, we could condition mftb to CONFIG_POWER3, all others we care for (i.e. >= ISA 2.01) do support mfspr 268.

Signature · 1 line
Philippe.
#6 lore raw
Quoted 32 lines · Philippe Gerum
Quoted 14 lines · Gilles Chanteperdrix
Quoted 13 lines · Charles Retailleau

Thanks Lennart that was very useful, it now works.
Here is the little patch I made, yet I couldn't find a switch to force it for core e500/e500xx only...

--- ./xenomai-2.6.1.orig/include/asm-powerpc/syscall.h 2011-11-09
13:21:36.000000000 +0100
+++ ./xenomai-2.6.1.mine/./include/asm-powerpc/syscall.h 2012-08-17
15:47:28.387435909 +0200

(quoted diff) +0 -0
@@ -167,9 +167,9 @@
  	} u;
  	unsigned long __tbu;
 
Quoted 16 lines
Quoted 11 lines
(quoted diff) +3 -3
-	__asm__ __volatile__("1: mftbu %0\n"
-			     "mftb %1\n"
-			     "mftbu %2\n"
+	__asm__ __volatile__("1: mfspr %0,269\n"
+			     "mfspr %1,268\n"
+			     "mfspr %2,269\n"
  			     "cmpw %2,%0\n"
  			     "bne- 1b\n":"=r"(u.v[0]),
  			     "=r"(u.v[1]), "=r"(__tbu));

Thanks to all for your help
Charles,

If I understand correctly, this patch breaks old powerpcs. So, do we have a compilation constant allowing to know whether we are compiling for an old or new powerpc?

Quoted 3 lines

For the sake of completeness, we could condition mftb to CONFIG_POWER3, all others we care for (i.e. >= ISA 2.01) do support mfspr 268.

is CONFIG_POWER3 available when configuring user-space support?

Signature · 1 line
					    Gilles.
#7 lore raw
Quoted 33 lines · Gilles Chanteperdrix
Quoted 32 lines · Philippe Gerum
Quoted 30 lines · Gilles Chanteperdrix
Quoted 22 lines · Charles Retailleau

Thanks Lennart that was very useful, it now works.
Here is the little patch I made, yet I couldn't find a switch to force it for core e500/e500xx only...

--- ./xenomai-2.6.1.orig/include/asm-powerpc/syscall.h 2011-11-09
13:21:36.000000000 +0100
+++ ./xenomai-2.6.1.mine/./include/asm-powerpc/syscall.h 2012-08-17
15:47:28.387435909 +0200

(quoted diff) +3 -3
@@ -167,9 +167,9 @@
   	} u;
   	unsigned long __tbu;
 
-	__asm__ __volatile__("1: mftbu %0\n"
-			     "mftb %1\n"
-			     "mftbu %2\n"
+	__asm__ __volatile__("1: mfspr %0,269\n"
+			     "mfspr %1,268\n"
+			     "mfspr %2,269\n"
   			     "cmpw %2,%0\n"
   			     "bne- 1b\n":"=r"(u.v[0]),
   			     "=r"(u.v[1]), "=r"(__tbu));
Quoted 2 lines

Thanks to all for your help
Charles,

If I understand correctly, this patch breaks old powerpcs. So, do we have a compilation constant allowing to know whether we are compiling for an old or new powerpc?

Quoted 6 lines
Quoted 3 lines

For the sake of completeness, we could condition mftb to CONFIG_POWER3, all others we care for (i.e. >= ISA 2.01) do support mfspr 268.

is CONFIG_POWER3 available when configuring user-space support?

No, but actually, I never ported Xenomai to power3 and will likely never do this. It's the early 64bit server architecture; we won't officially support any 64bit platform which does not comply with ISA 2.04 at least anyway. Best effort would be to depend on a gcc define built-in for mcpu=power3 if any.

Signature · 1 line
Philippe.
#8 lore raw
Quoted 38 lines · Philippe Gerum
Quoted 37 lines · Gilles Chanteperdrix
Quoted 35 lines · Philippe Gerum
Quoted 14 lines · Gilles Chanteperdrix
Quoted 13 lines · Charles Retailleau

Thanks Lennart that was very useful, it now works.
Here is the little patch I made, yet I couldn't find a switch to force it for core e500/e500xx only...

--- ./xenomai-2.6.1.orig/include/asm-powerpc/syscall.h 2011-11-09
13:21:36.000000000 +0100
+++ ./xenomai-2.6.1.mine/./include/asm-powerpc/syscall.h 2012-08-17
15:47:28.387435909 +0200

(quoted diff) +0 -0
@@ -167,9 +167,9 @@
   	} u;
   	unsigned long __tbu;
 
Quoted 16 lines
Quoted 11 lines
(quoted diff) +3 -3
-	__asm__ __volatile__("1: mftbu %0\n"
-			     "mftb %1\n"
-			     "mftbu %2\n"
+	__asm__ __volatile__("1: mfspr %0,269\n"
+			     "mfspr %1,268\n"
+			     "mfspr %2,269\n"
   			     "cmpw %2,%0\n"
   			     "bne- 1b\n":"=r"(u.v[0]),
   			     "=r"(u.v[1]), "=r"(__tbu));

Thanks to all for your help
Charles,

If I understand correctly, this patch breaks old powerpcs. So, do we have a compilation constant allowing to know whether we are compiling for an old or new powerpc?

For the sake of completeness, we could condition mftb to CONFIG_POWER3, all others we care for (i.e. >= ISA 2.01) do support mfspr 268.

Quoted 9 lines
Quoted 2 lines

is CONFIG_POWER3 available when configuring user-space support?

No, but actually, I never ported Xenomai to power3 and will likely never do this. It's the early 64bit server architecture; we won't officially support any 64bit platform which does not comply with ISA 2.04 at least anyway. Best effort would be to depend on a gcc define built-in for mcpu=power3 if any.

Ok. According to ppc64-linux-gcc from ELDK 4.2, all architectures above power4 have _ARCH_PWR4 defined.

Signature · 1 line
					    Gilles.
#9 lore raw
In reply to Charles Retailleau
Quoted 22 lines · Charles Retailleau

Thanks Lennart that was very useful, it now works.
Here is the little patch I made, yet I couldn't find a switch to force it for core e500/e500xx only...

--- ./xenomai-2.6.1.orig/include/asm-powerpc/syscall.h 2011-11-09
13:21:36.000000000 +0100
+++ ./xenomai-2.6.1.mine/./include/asm-powerpc/syscall.h 2012-08-17
15:47:28.387435909 +0200

(quoted diff) +3 -3
@@ -167,9 +167,9 @@
 	} u;
 	unsigned long __tbu;
 
-	__asm__ __volatile__("1: mftbu %0\n"
-			     "mftb %1\n"
-			     "mftbu %2\n"
+	__asm__ __volatile__("1: mfspr %0,269\n"
+			     "mfspr %1,268\n"
+			     "mfspr %2,269\n"
 			     "cmpw %2,%0\n"
 			     "bne- 1b\n":"=r"(u.v[0]),
 			     "=r"(u.v[1]), "=r"(__tbu));
Quoted 2 lines

Thanks to all for your help
Charles,

Merged. Thanks.

Signature · 1 line
                                                                Gilles.