[Cbe-oss-dev] cell reset exception

Benjamin Herrenschmidt benh at kernel.crashing.org
Tue May 2 14:47:53 EST 2006


Hi !

While working on adding support for some of the cell specific
exceptions, I noticed this bit from your DD2 workaround patch:

#define RES_EXCEPTION_PSERIES(n, label)			\
	. = n;						\
	.globl label##_pSeries;				\
label##_pSeries:					\
	mtspr   SPRN_SPRG2,r20;		/* use SPRG2 as scratch reg */ \
	mtspr   SPRN_SPRG1,r21;		/* use SPRN_SPRG1 as scratch reg */ \
	mfspr   r20,SPRN_SPRG3;		/* get paca virtual address */ \
	cmpdi   r20,0x0;                /* if SPRG3 zero,thread  */    \
	bne     20f;			/* shouldn't run */ \
18:					/* Stop current Thread */ \
	andi.	 r21,0,0;					 \
	mtspr    SPRN_CTRLT,r21;					 \
19:								\
	b	 19b;		 	/* Thread should be stopped */	 \
20:							\
	HMT_MEDIUM;					\
	mtspr	SPRN_SPRG1,r13;		/* save r13 */	\
	EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common)

Looks like you are saving r20/r21 to SPRG1/2 but never actually restoring them. That means that
you are clobbering whatever those registers contained in the idle loop. Not nice ...

Did I miss something ?

Cheers,
Ben.





More information about the cbe-oss-dev mailing list