 9d378dfac8
			
		
	
	
	9d378dfac8
	
	
	
		
			
			Previously SPRG3 was marked for use by both VDSO and critical
interrupts (though critical interrupts were not fully implemented).
In commit 8b64a9dfb0 ("powerpc/booke64:
Use SPRG0/3 scratch for bolted TLB miss & crit int"), Mihai Caraman
made an attempt to resolve this conflict by restoring the VDSO value
early in the critical interrupt, but this has some issues:
 - It's incompatible with EXCEPTION_COMMON which restores r13 from the
   by-then-overwritten scratch (this cost me some debugging time).
 - It forces critical exceptions to be a special case handled
   differently from even machine check and debug level exceptions.
 - It didn't occur to me that it was possible to make this work at all
   (by doing a final "ld r13, PACA_EXCRIT+EX_R13(r13)") until after
   I made (most of) this patch. :-)
It might be worth investigating using a load rather than SPRG on return
from all exceptions (except TLB misses where the scratch never leaves
the SPRG) -- it could save a few cycles.  Until then, let's stick with
SPRG for all exceptions.
Since we cannot use SPRG4-7 for scratch without corrupting the state of
a KVM guest, move VDSO to SPRG7 on book3e.  Since neither SPRG4-7 nor
critical interrupts exist on book3s, SPRG3 is still used for VDSO
there.
Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: Mihai Caraman <mihai.caraman@freescale.com>
Cc: Anton Blanchard <anton@samba.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: kvm-ppc@vger.kernel.org
		
	
			
		
			
				
	
	
		
			45 lines
		
	
	
	
		
			1.3 KiB
			
		
	
	
	
		
			ArmAsm
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
	
		
			1.3 KiB
			
		
	
	
	
		
			ArmAsm
		
	
	
	
	
	
| /*
 | |
|  * This program is free software; you can redistribute it and/or modify
 | |
|  * it under the terms of the GNU General Public License as published by
 | |
|  * the Free Software Foundation; either version 2 of the License, or
 | |
|  * (at your option) any later version.
 | |
|  *
 | |
|  * This program is distributed in the hope that it will be useful,
 | |
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | |
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | |
|  * GNU General Public License for more details.
 | |
|  *
 | |
|  * You should have received a copy of the GNU General Public License
 | |
|  * along with this program; if not, write to the Free Software
 | |
|  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 | |
|  *
 | |
|  * Copyright (C) IBM Corporation, 2012
 | |
|  *
 | |
|  * Author: Anton Blanchard <anton@au.ibm.com>
 | |
|  */
 | |
| #include <asm/ppc_asm.h>
 | |
| #include <asm/vdso.h>
 | |
| 
 | |
| 	.text
 | |
| /*
 | |
|  * Exact prototype of getcpu
 | |
|  *
 | |
|  * int __kernel_getcpu(unsigned *cpu, unsigned *node);
 | |
|  *
 | |
|  */
 | |
| V_FUNCTION_BEGIN(__kernel_getcpu)
 | |
|   .cfi_startproc
 | |
| 	mfspr	r5,SPRN_SPRG_VDSO_READ
 | |
| 	cmpdi	cr0,r3,0
 | |
| 	cmpdi	cr1,r4,0
 | |
| 	clrlwi  r6,r5,16
 | |
| 	rlwinm  r7,r5,16,31-15,31-0
 | |
| 	beq	cr0,1f
 | |
| 	stw	r6,0(r3)
 | |
| 1:	beq	cr1,2f
 | |
| 	stw	r7,0(r4)
 | |
| 2:	crclr	cr0*4+so
 | |
| 	li	r3,0			/* always success */
 | |
| 	blr
 | |
|   .cfi_endproc
 | |
| V_FUNCTION_END(__kernel_getcpu)
 |