Skip to contentSkip to conversation

powerpc 860 and glibc sysdeps/powerpc/power3/memset.S: CPU15 "dcbX" errata

DISCUSSION Nye Liu 1 participant 1 message Oct 22, 2008 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Nye Liu

author
#1 lore raw
Quoted 33 lines · nyet

I am working on a powerpc 860 toolchain, but I am having problems convincing glibc to not emit code that uses the dcbz instruction (CPU15 dcbX bug). The source of the problem is sysdeps/powerpc/power3/memset.S

in crosstool, we had something like this:

Index: crosstool.sh
===================================================================

crosstool.sh +5 -0
@@ -529,6 +529,11 @@
 	export libc_cv_forced_unwind libc_cv_c_cleanup
    fi
 
+    case ${TARGET} in
+       # remove inline asm powerpc memset, which is broken for 8xx
+        powerpc-8* ) rm -f ${GLIBC_DIR}/sysdeps/powerpc/powerpc32/memset.S ;;
+    esac
+
    BUILD_CC=gcc CFLAGS="$TARGET_CFLAGS $EXTRA_TARGET_CFLAGS" CC="${TARGET}-gcc $GLIBC_EXTRA_CC_ARGS" \
    AR=${TARGET}-ar RANLIB=${TARGET}-ranlib \
        ${GLIBC_DIR}/configure --prefix=/usr \

but i dont know what the proper place is to put the equivalent in crosstool-ng

see also my crosstool patch here

http://sourceware.org/ml/crossgcc/2006-12/msg00057.html

and a discussion of the CPU15 errata here

http://mlblog.osdir.com/linux.ports.ppc.embedded/2005-04/index.shtml

Quoted 9 lines

It is worth noting that according to freescale, dcbi, dcibst, dcbf, and icbi are similarly affected, whch means sysdeps/powerpc/powerpc32/dl-machine.c might also cause problems, since it uses dcbst and icbi.

the glibc maintainers seem aware of the problem, but don't seem to think anybody uses glibc with the 860 series. wolfgang denk is also apparently doing his own workarounds for the toolchains he builds for eldk.

This is what i ended up with. I have no idea if there is a better way; I'd rather fix this up in a glibc patch but the way sysdeps works is beyond my knowledge.

build/libc/glibc.sh +9 -0
Index: scripts/build/libc/glibc.sh
===================================================================
@@ -386,6 +386,15 @@
         echo libc_cv_c_cleanup=yes
     fi >config.cache
 
+    case ${CT_TARGET} in
+	# Remove inline asm powerpc memset, which is broken for FreeScale 8xx
+	# (CPU15 errata)
+	# http://sourceware.org/ml/crossgcc/2006-12/msg00057.html
+	# http://mlblog.osdir.com/linux.ports.ppc.embedded/2005-04/index.shtml
+	# http://ozlabs.org/pipermail/linuxppc-embedded/2005-January/016351.html
+        powerpc-8* ) rm -f ${CT_SRC_DIR}/${CT_LIBC_FILE}/sysdeps/powerpc/powerpc32/memset.S ;;
+    esac
+
     # Configure with --prefix the way we want it on the target...
     # There are a whole lot of settings here.  You'll probably want
     # to read up on what they all mean, and customize a bit, possibly by setting GLIBC_EXTRA_CONFIG
Signature · 7 lines
Nye Liu
[email protected]
(818) 772-6235x248
(818) 772-0576 fax

"Who would be stupid enough to quote a fictitious character?"
	-- Don Quixote