On Thu, Sep 03, 2015 at 03:05:21PM +1000, David Gibson wrote: > On Thu, Sep 03, 2015 at 01:24:21PM +1000, Sam Bobroff wrote: > > PAPR only says SPRGs 0 to 3 are for software use, but the kernel (see > > arch/powerpc/include/asm/reg.h) defines SPRG2 as an exception scratch > > register > > so it should be the right one to use here. > > Uh.. no. If 0..3 are for software (i.e. OS) use, then this needs to > use a different one, since it's being used as a firmware resource > here. Linux might treat SPRG2 as scratch, but another OS would be > within its rights to use it for something persistent.
PAPR says in requirement R1-14.1.2-3 "To avoid conflict with the platform’s hypervisor, the OS must be prepared to share use of SPRG2 as the interrupt scratch register whenever an hcall() is made, or a machine check or reset interrupt is taken." So, SPRG2 is the one to use here. Paul.