svn commit: r279594 - in head/sys/powerpc: aim booke powerpc

Nathan Whitehorn nwhitehorn at FreeBSD.org
Wed Mar 4 16:45:33 UTC 2015


Author: nwhitehorn
Date: Wed Mar  4 16:45:31 2015
New Revision: 279594
URL: https://svnweb.freebsd.org/changeset/base/279594

Log:
  Move Book-E/AIM dependent bits for setting user PMAP during thread switch
  out of cpu_switch() and into pmap_activate() where they belong. This also
  removes all the #ifdef from cpu_switch().

Modified:
  head/sys/powerpc/aim/mmu_oea.c
  head/sys/powerpc/aim/mmu_oea64.c
  head/sys/powerpc/booke/pmap.c
  head/sys/powerpc/powerpc/swtch32.S
  head/sys/powerpc/powerpc/swtch64.S

Modified: head/sys/powerpc/aim/mmu_oea.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea.c	Wed Mar  4 16:19:34 2015	(r279593)
+++ head/sys/powerpc/aim/mmu_oea.c	Wed Mar  4 16:45:31 2015	(r279594)
@@ -986,6 +986,8 @@ moea_activate(mmu_t mmu, struct thread *
 
 	CPU_SET(PCPU_GET(cpuid), &pm->pm_active);
 	PCPU_SET(curpmap, pmr);
+
+	mtsrin(USER_SR << ADDR_SR_SHFT, td->td_pcb->pcb_cpu.aim.usr_vsid);
 }
 
 void

Modified: head/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.c	Wed Mar  4 16:19:34 2015	(r279593)
+++ head/sys/powerpc/aim/mmu_oea64.c	Wed Mar  4 16:45:31 2015	(r279594)
@@ -991,8 +991,11 @@ moea64_activate(mmu_t mmu, struct thread
 
 	#ifdef __powerpc64__
 	PCPU_SET(userslb, pm->pm_slb);
+	__asm __volatile("slbmte %0, %1; isync" ::
+	    "r"(td->td_pcb->pcb_cpu.aim.usr_vsid), "r"(USER_SLB_SLBE));
 	#else
 	PCPU_SET(curpmap, pm->pmap_phys);
+	mtsrin(USER_SR << ADDR_SR_SHFT, td->td_pcb->pcb_cpu.aim.usr_vsid);
 	#endif
 }
 
@@ -1001,6 +1004,8 @@ moea64_deactivate(mmu_t mmu, struct thre
 {
 	pmap_t	pm;
 
+	__asm __volatile("isync; slbie %0" :: "r"(USER_ADDR));
+
 	pm = &td->td_proc->p_vmspace->vm_pmap;
 	CPU_CLR(PCPU_GET(cpuid), &pm->pm_active);
 	#ifdef __powerpc64__

Modified: head/sys/powerpc/booke/pmap.c
==============================================================================
--- head/sys/powerpc/booke/pmap.c	Wed Mar  4 16:19:34 2015	(r279593)
+++ head/sys/powerpc/booke/pmap.c	Wed Mar  4 16:45:31 2015	(r279594)
@@ -1946,6 +1946,8 @@ mmu_booke_activate(mmu_t mmu, struct thr
 	mtspr(SPR_PID0, pmap->pm_tid[cpuid]);
 	__asm __volatile("isync");
 
+	mtspr(SPR_DBCR0, td->td_pcb->pcb_cpu.booke.dbcr0);
+
 	sched_unpin();
 
 	CTR3(KTR_PMAP, "%s: e (tid = %d for '%s')", __func__,
@@ -1965,6 +1967,8 @@ mmu_booke_deactivate(mmu_t mmu, struct t
 	CTR5(KTR_PMAP, "%s: td=%p, proc = '%s', id = %d, pmap = 0x%08x",
 	    __func__, td, td->td_proc->p_comm, td->td_proc->p_pid, pmap);
 
+	td->td_pcb->pcb_cpu.booke.dbcr0 = mfspr(SPR_DBCR0);
+
 	CPU_CLR_ATOMIC(PCPU_GET(cpuid), &pmap->pm_active);
 	PCPU_SET(curpmap, NULL);
 }

Modified: head/sys/powerpc/powerpc/swtch32.S
==============================================================================
--- head/sys/powerpc/powerpc/swtch32.S	Wed Mar  4 16:19:34 2015	(r279593)
+++ head/sys/powerpc/powerpc/swtch32.S	Wed Mar  4 16:45:31 2015	(r279594)
@@ -91,10 +91,6 @@ ENTRY(cpu_switch)
 	stw	%r16,PCB_CR(%r6)
 	mflr	%r16			/* Save the link register */
 	stw	%r16,PCB_LR(%r6)
-#ifdef BOOKE
-	mfspr	%r16,SPR_DBCR0
-	stw	%r16,PCB_BOOKE_DBCR0(%r6)
-#endif
 	stw	%r1,PCB_SP(%r6)		/* Save the stack pointer */
 
 	mr	%r14,%r3		/* Copy the old thread ptr... */
@@ -173,16 +169,6 @@ blocked_loop:
 	mtcr	%r5
 	lwz	%r5,PCB_LR(%r3)		/* Load the link register */
 	mtlr	%r5
-#ifdef AIM
-	lwz	%r5,PCB_AIM_USR_VSID(%r3) /* Load the USER_SR segment reg */
-	isync
-	mtsr	USER_SR,%r5
-	isync
-#endif
-#ifdef BOOKE
-	lwz	%r5,PCB_BOOKE_DBCR0(%r3)
-	mtspr	SPR_DBCR0,%r5
-#endif
 	lwz	%r1,PCB_SP(%r3)		/* Load the stack pointer */
 	/*
 	 * Perform a dummy stwcx. to clear any reservations we may have

Modified: head/sys/powerpc/powerpc/swtch64.S
==============================================================================
--- head/sys/powerpc/powerpc/swtch64.S	Wed Mar  4 16:19:34 2015	(r279593)
+++ head/sys/powerpc/powerpc/swtch64.S	Wed Mar  4 16:45:31 2015	(r279594)
@@ -218,21 +218,6 @@ blocked_loop:
 	ld	%r1,PCB_SP(%r3)		/* Load the stack pointer */
 	ld	%r2,PCB_TOC(%r3)	/* Load the TOC pointer */
 
-	lis	%r5,USER_ADDR at highesta	/* Load the copyin/out segment reg */
-	ori	%r5,%r5,USER_ADDR at highera
-	sldi	%r5,%r5,32
-	oris	%r5,%r5,USER_ADDR at ha
-	isync
-	slbie	%r5
-	lis	%r6,USER_SLB_SLBE at highesta
-	ori	%r6,%r6,USER_SLB_SLBE at highera
-	sldi	%r6,%r6,32
-	oris	%r6,%r6,USER_SLB_SLBE at ha
-	ori	%r6,%r6,USER_SLB_SLBE at l
-	ld	%r5,PCB_AIM_USR_VSID(%r3)
-	slbmte	%r5,%r6
-	isync
-
 	/*
 	 * Perform a dummy stdcx. to clear any reservations we may have
 	 * inherited from the previous thread. It doesn't matter if the


More information about the svn-src-all mailing list