Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0d514f04 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc-merge:
  powerpc: Fix various syscall/signal/swapcontext bugs
  [PATCH] powerpc: incorrect rmo_top handling in prom_init
  [PATCH] powerpc: Fix incorrect pud_ERROR() message
  [PATCH] powerpc: Expose SMT and L1 icache snoop userland features
  [PATCH] powerpc: Fix windfarm_pm112 not starting all control loops
  [PATCH] powerpc: Fix old g5 issues with windfarm
  powerpc32: Fix timebase synchronization on 32-bit powermacs
  powerpc: Turn off verbose debug output in powermac platform functions
  powerpc: Fix might-sleep warning in program check exception handler
parents 5ee1af9f 1bd79336
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -92,7 +92,6 @@ int main(void)


	DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
	DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
	DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count));
	DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count));
	DEFINE(TI_SIGFRAME, offsetof(struct thread_info, nvgprs_frame));
	DEFINE(TI_TASK, offsetof(struct thread_info, task));
	DEFINE(TI_TASK, offsetof(struct thread_info, task));
#ifdef CONFIG_PPC32
#ifdef CONFIG_PPC32
	DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain));
	DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain));
+6 −3
Original line number Original line Diff line number Diff line
@@ -53,8 +53,10 @@ extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec);
				 PPC_FEATURE_HAS_MMU)
				 PPC_FEATURE_HAS_MMU)
#define COMMON_USER_PPC64	(COMMON_USER | PPC_FEATURE_64)
#define COMMON_USER_PPC64	(COMMON_USER | PPC_FEATURE_64)
#define COMMON_USER_POWER4	(COMMON_USER_PPC64 | PPC_FEATURE_POWER4)
#define COMMON_USER_POWER4	(COMMON_USER_PPC64 | PPC_FEATURE_POWER4)
#define COMMON_USER_POWER5	(COMMON_USER_PPC64 | PPC_FEATURE_POWER5)
#define COMMON_USER_POWER5	(COMMON_USER_PPC64 | PPC_FEATURE_POWER5 |\
#define COMMON_USER_POWER5_PLUS	(COMMON_USER_PPC64 | PPC_FEATURE_POWER5_PLUS)
				 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP)
#define COMMON_USER_POWER5_PLUS	(COMMON_USER_PPC64 | PPC_FEATURE_POWER5_PLUS|\
				 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP)
#define COMMON_USER_BOOKE	(PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \
#define COMMON_USER_BOOKE	(PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \
				 PPC_FEATURE_BOOKE)
				 PPC_FEATURE_BOOKE)


@@ -267,7 +269,8 @@ struct cpu_spec cpu_specs[] = {
		.cpu_name		= "Cell Broadband Engine",
		.cpu_name		= "Cell Broadband Engine",
		.cpu_features		= CPU_FTRS_CELL,
		.cpu_features		= CPU_FTRS_CELL,
		.cpu_user_features	= COMMON_USER_PPC64 |
		.cpu_user_features	= COMMON_USER_PPC64 |
			PPC_FEATURE_CELL | PPC_FEATURE_HAS_ALTIVEC_COMP,
			PPC_FEATURE_CELL | PPC_FEATURE_HAS_ALTIVEC_COMP |
			PPC_FEATURE_SMT,
		.icache_bsize		= 128,
		.icache_bsize		= 128,
		.dcache_bsize		= 128,
		.dcache_bsize		= 128,
		.cpu_setup		= __setup_cpu_be,
		.cpu_setup		= __setup_cpu_be,
+24 −71
Original line number Original line Diff line number Diff line
@@ -227,7 +227,7 @@ ret_from_syscall:
	MTMSRD(r10)
	MTMSRD(r10)
	lwz	r9,TI_FLAGS(r12)
	lwz	r9,TI_FLAGS(r12)
	li	r8,-_LAST_ERRNO
	li	r8,-_LAST_ERRNO
	andi.	r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_RESTOREALL|_TIF_RESTORE_SIGMASK)
	andi.	r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK)
	bne-	syscall_exit_work
	bne-	syscall_exit_work
	cmplw	0,r3,r8
	cmplw	0,r3,r8
	blt+	syscall_exit_cont
	blt+	syscall_exit_cont
@@ -287,8 +287,10 @@ syscall_dotrace:


syscall_exit_work:
syscall_exit_work:
	andi.	r0,r9,_TIF_RESTOREALL
	andi.	r0,r9,_TIF_RESTOREALL
	bne-	2f
	beq+	0f
	cmplw	0,r3,r8
	REST_NVGPRS(r1)
	b	2f
0:	cmplw	0,r3,r8
	blt+	1f
	blt+	1f
	andi.	r0,r9,_TIF_NOERROR
	andi.	r0,r9,_TIF_NOERROR
	bne-	1f
	bne-	1f
@@ -302,9 +304,7 @@ syscall_exit_work:
2:	andi.	r0,r9,(_TIF_PERSYSCALL_MASK)
2:	andi.	r0,r9,(_TIF_PERSYSCALL_MASK)
	beq	4f
	beq	4f


	/* Clear per-syscall TIF flags if any are set, but _leave_
	/* Clear per-syscall TIF flags if any are set.  */
	_TIF_SAVE_NVGPRS set in r9 since we haven't dealt with that
	yet.  */


	li	r11,_TIF_PERSYSCALL_MASK
	li	r11,_TIF_PERSYSCALL_MASK
	addi	r12,r12,TI_FLAGS
	addi	r12,r12,TI_FLAGS
@@ -318,8 +318,13 @@ syscall_exit_work:
	subi	r12,r12,TI_FLAGS
	subi	r12,r12,TI_FLAGS
	
	
4:	/* Anything which requires enabling interrupts? */
4:	/* Anything which requires enabling interrupts? */
	andi.	r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_SAVE_NVGPRS)
	andi.	r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP)
	beq	7f
	beq	ret_from_except

	/* Re-enable interrupts */
	ori	r10,r10,MSR_EE
	SYNC
	MTMSRD(r10)


	/* Save NVGPRS if they're not saved already */
	/* Save NVGPRS if they're not saved already */
	lwz	r4,_TRAP(r1)
	lwz	r4,_TRAP(r1)
@@ -328,70 +333,10 @@ syscall_exit_work:
	SAVE_NVGPRS(r1)
	SAVE_NVGPRS(r1)
	li	r4,0xc00
	li	r4,0xc00
	stw	r4,_TRAP(r1)
	stw	r4,_TRAP(r1)

5:
	/* Re-enable interrupts */
5:	ori	r10,r10,MSR_EE
	SYNC
	MTMSRD(r10)

	andi.	r0,r9,_TIF_SAVE_NVGPRS
	bne	save_user_nvgprs

save_user_nvgprs_cont:
	andi.	r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP)
	beq	7f

	addi	r3,r1,STACK_FRAME_OVERHEAD
	addi	r3,r1,STACK_FRAME_OVERHEAD
	bl	do_syscall_trace_leave
	bl	do_syscall_trace_leave
	REST_NVGPRS(r1)
	b	ret_from_except_full

6:	lwz	r3,GPR3(r1)
	LOAD_MSR_KERNEL(r10,MSR_KERNEL)	/* doesn't include MSR_EE */
	SYNC
	MTMSRD(r10)		/* disable interrupts again */
	rlwinm	r12,r1,0,0,(31-THREAD_SHIFT)	/* current_thread_info() */
	lwz	r9,TI_FLAGS(r12)
7:
	andi.	r0,r9,_TIF_NEED_RESCHED
	bne	8f
	lwz	r5,_MSR(r1)
	andi.	r5,r5,MSR_PR
	beq	ret_from_except
	andi.	r0,r9,_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK
	beq	ret_from_except
	b	do_user_signal
8:
	ori	r10,r10,MSR_EE
	SYNC
	MTMSRD(r10)		/* re-enable interrupts */
	bl	schedule
	b	6b

save_user_nvgprs:
	lwz	r8,TI_SIGFRAME(r12)

.macro savewords start, end
  1:	stw \start,4*(\start)(r8)
	.section __ex_table,"a"
	.align	2
	.long	1b,save_user_nvgprs_fault
	.previous
	.if \end - \start
	savewords "(\start+1)",\end
	.endif
.endm	
	savewords 14,31
	b	save_user_nvgprs_cont

	
save_user_nvgprs_fault:
	li	r3,11		/* SIGSEGV */
	lwz	r4,TI_TASK(r12)
	bl	force_sigsegv

	rlwinm	r12,r1,0,0,(31-THREAD_SHIFT)	/* current_thread_info() */
	lwz	r9,TI_FLAGS(r12)
	b	save_user_nvgprs_cont


#ifdef SHOW_SYSCALLS
#ifdef SHOW_SYSCALLS
do_show_syscall:
do_show_syscall:
@@ -490,6 +435,14 @@ ppc_clone:
	stw	r0,_TRAP(r1)		/* register set saved */
	stw	r0,_TRAP(r1)		/* register set saved */
	b	sys_clone
	b	sys_clone


	.globl	ppc_swapcontext
ppc_swapcontext:
	SAVE_NVGPRS(r1)
	lwz	r0,_TRAP(r1)
	rlwinm	r0,r0,0,0,30		/* clear LSB to indicate full */
	stw	r0,_TRAP(r1)		/* register set saved */
	b	sys_swapcontext

/*
/*
 * Top-level page fault handling.
 * Top-level page fault handling.
 * This is in assembler because if do_page_fault tells us that
 * This is in assembler because if do_page_fault tells us that
@@ -683,7 +636,7 @@ user_exc_return: /* r10 contains MSR_KERNEL here */
	/* Check current_thread_info()->flags */
	/* Check current_thread_info()->flags */
	rlwinm	r9,r1,0,0,(31-THREAD_SHIFT)
	rlwinm	r9,r1,0,0,(31-THREAD_SHIFT)
	lwz	r9,TI_FLAGS(r9)
	lwz	r9,TI_FLAGS(r9)
	andi.	r0,r9,(_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_RESTOREALL|_TIF_RESTORE_SIGMASK)
	andi.	r0,r9,(_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK|_TIF_NEED_RESCHED)
	bne	do_work
	bne	do_work


restore_user:
restore_user:
+21 −73
Original line number Original line Diff line number Diff line
@@ -160,7 +160,7 @@ syscall_exit:
	mtmsrd	r10,1
	mtmsrd	r10,1
	ld	r9,TI_FLAGS(r12)
	ld	r9,TI_FLAGS(r12)
	li	r11,-_LAST_ERRNO
	li	r11,-_LAST_ERRNO
	andi.	r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_RESTOREALL|_TIF_SAVE_NVGPRS|_TIF_NOERROR|_TIF_RESTORE_SIGMASK)
	andi.	r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_USER_WORK_MASK|_TIF_PERSYSCALL_MASK)
	bne-	syscall_exit_work
	bne-	syscall_exit_work
	cmpld	r3,r11
	cmpld	r3,r11
	ld	r5,_CCR(r1)
	ld	r5,_CCR(r1)
@@ -216,8 +216,10 @@ syscall_exit_work:
	 If TIF_NOERROR is set, just save r3 as it is. */
	 If TIF_NOERROR is set, just save r3 as it is. */


	andi.	r0,r9,_TIF_RESTOREALL
	andi.	r0,r9,_TIF_RESTOREALL
	bne-	2f
	beq+	0f
	cmpld	r3,r11		/* r10 is -LAST_ERRNO */
	REST_NVGPRS(r1)
	b	2f
0:	cmpld	r3,r11		/* r10 is -LAST_ERRNO */
	blt+	1f
	blt+	1f
	andi.	r0,r9,_TIF_NOERROR
	andi.	r0,r9,_TIF_NOERROR
	bne-	1f
	bne-	1f
@@ -229,9 +231,7 @@ syscall_exit_work:
2:	andi.	r0,r9,(_TIF_PERSYSCALL_MASK)
2:	andi.	r0,r9,(_TIF_PERSYSCALL_MASK)
	beq	4f
	beq	4f


	/* Clear per-syscall TIF flags if any are set, but _leave_
	/* Clear per-syscall TIF flags if any are set.  */
	_TIF_SAVE_NVGPRS set in r9 since we haven't dealt with that
	yet.  */


	li	r11,_TIF_PERSYSCALL_MASK
	li	r11,_TIF_PERSYSCALL_MASK
	addi	r12,r12,TI_FLAGS
	addi	r12,r12,TI_FLAGS
@@ -241,9 +241,8 @@ syscall_exit_work:
	bne-	3b
	bne-	3b
	subi	r12,r12,TI_FLAGS
	subi	r12,r12,TI_FLAGS


4:	bl	.save_nvgprs
4:	/* Anything else left to do? */
	/* Anything else left to do? */
	andi.	r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP)
	andi.	r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_SAVE_NVGPRS)
	beq	.ret_from_except_lite
	beq	.ret_from_except_lite


	/* Re-enable interrupts */
	/* Re-enable interrupts */
@@ -251,26 +250,10 @@ syscall_exit_work:
	ori	r10,r10,MSR_EE
	ori	r10,r10,MSR_EE
	mtmsrd	r10,1
	mtmsrd	r10,1


	andi.	r0,r9,_TIF_SAVE_NVGPRS
	bl	.save_nvgprs
	bne	save_user_nvgprs

	/* If tracing, re-enable interrupts and do it */
save_user_nvgprs_cont:	
	andi.	r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP)
	beq	5f
	
	addi	r3,r1,STACK_FRAME_OVERHEAD
	addi	r3,r1,STACK_FRAME_OVERHEAD
	bl	.do_syscall_trace_leave
	bl	.do_syscall_trace_leave
	REST_NVGPRS(r1)
	b	.ret_from_except
	clrrdi	r12,r1,THREAD_SHIFT

	/* Disable interrupts again and handle other work if any */
5:	mfmsr	r10
	rldicl	r10,r10,48,1
	rotldi	r10,r10,16
	mtmsrd	r10,1

	b	.ret_from_except_lite


/* Save non-volatile GPRs, if not already saved. */
/* Save non-volatile GPRs, if not already saved. */
_GLOBAL(save_nvgprs)
_GLOBAL(save_nvgprs)
@@ -283,51 +266,6 @@ _GLOBAL(save_nvgprs)
	blr
	blr


	
	
save_user_nvgprs:
	ld	r10,TI_SIGFRAME(r12)
	andi.	r0,r9,_TIF_32BIT
	beq-	save_user_nvgprs_64

	/* 32-bit save to userspace */

.macro savewords start, end
  1:	stw \start,4*(\start)(r10)
	.section __ex_table,"a"
	.align	3
	.llong	1b,save_user_nvgprs_fault
	.previous
	.if \end - \start
	savewords "(\start+1)",\end
	.endif
.endm	
	savewords 14,31
	b	save_user_nvgprs_cont

save_user_nvgprs_64:
	/* 64-bit save to userspace */

.macro savelongs start, end
  1:	std \start,8*(\start)(r10)
	.section __ex_table,"a"
	.align	3
	.llong	1b,save_user_nvgprs_fault
	.previous
	.if \end - \start
	savelongs "(\start+1)",\end
	.endif
.endm	
	savelongs 14,31
	b	save_user_nvgprs_cont

save_user_nvgprs_fault:
	li	r3,11		/* SIGSEGV */
	ld	r4,TI_TASK(r12)
	bl	.force_sigsegv

	clrrdi	r12,r1,THREAD_SHIFT
	ld	r9,TI_FLAGS(r12)
	b	save_user_nvgprs_cont
	
/*
/*
 * The sigsuspend and rt_sigsuspend system calls can call do_signal
 * The sigsuspend and rt_sigsuspend system calls can call do_signal
 * and thus put the process into the stopped state where we might
 * and thus put the process into the stopped state where we might
@@ -352,6 +290,16 @@ _GLOBAL(ppc_clone)
	bl	.sys_clone
	bl	.sys_clone
	b	syscall_exit
	b	syscall_exit


_GLOBAL(ppc32_swapcontext)
	bl	.save_nvgprs
	bl	.compat_sys_swapcontext
	b	syscall_exit

_GLOBAL(ppc64_swapcontext)
	bl	.save_nvgprs
	bl	.sys_swapcontext
	b	syscall_exit

_GLOBAL(ret_from_fork)
_GLOBAL(ret_from_fork)
	bl	.schedule_tail
	bl	.schedule_tail
	REST_NVGPRS(r1)
	REST_NVGPRS(r1)
+1 −1
Original line number Original line Diff line number Diff line
@@ -978,7 +978,7 @@ static void __init prom_init_mem(void)
			if (size == 0)
			if (size == 0)
				continue;
				continue;
			prom_debug("    %x %x\n", base, size);
			prom_debug("    %x %x\n", base, size);
			if (base == 0)
			if (base == 0 && (RELOC(of_platform) & PLATFORM_LPAR))
				RELOC(rmo_top) = size;
				RELOC(rmo_top) = size;
			if ((base + size) > RELOC(ram_top))
			if ((base + size) > RELOC(ram_top))
				RELOC(ram_top) = base + size;
				RELOC(ram_top) = base + size;
Loading