From db4b2ef5a2d64df17a5a584ed96df76fad48b988 Mon Sep 17 00:00:00 2001 From: Attilio Rao Date: Wed, 18 May 2011 16:41:38 +0000 Subject: [PATCH 1/4] Fix newly introduced code. Reported by: sbruno --- sys/powerpc/booke/platform_bare.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/powerpc/booke/platform_bare.c b/sys/powerpc/booke/platform_bare.c index 8e03bd32d46..de26128c49f 100644 --- a/sys/powerpc/booke/platform_bare.c +++ b/sys/powerpc/booke/platform_bare.c @@ -241,7 +241,7 @@ bare_smp_start_cpu(platform_t plat, struct pcpu *pc) int timeout; eebpcr = ccsr_read4(OCP85XX_EEBPCR); - if ((eebpcr & (pc->pc_cpumask << 24)) != 0) { + if ((eebpcr & (1 << (pc->pc_cpuid + 24))) != 0) { printf("%s: CPU=%d already out of hold-off state!\n", __func__, pc->pc_cpuid); return (ENXIO); @@ -259,7 +259,8 @@ bare_smp_start_cpu(platform_t plat, struct pcpu *pc) /* * Release AP from hold-off state */ - eebpcr |= (pc->pc_cpumask << 24); + + eebpcr |= (1 << (pc->pc_cpuid + 24)); ccsr_write4(OCP85XX_EEBPCR, eebpcr); __asm __volatile("isync; msync"); From 1a203896c32f7ee5897cdf63c9906727040ef009 Mon Sep 17 00:00:00 2001 From: Attilio Rao Date: Wed, 18 May 2011 16:42:01 +0000 Subject: [PATCH 2/4] Fix warning spit out. Reported by: sbruno --- sys/powerpc/booke/pmap.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/powerpc/booke/pmap.c b/sys/powerpc/booke/pmap.c index 2fffa3f14b9..11be68efb99 100644 --- a/sys/powerpc/booke/pmap.c +++ b/sys/powerpc/booke/pmap.c @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -1228,7 +1229,7 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_offset_t kernelend) PTE_VALID; } /* Mark kernel_pmap active on all CPUs */ - kernel_pmap->pm_active = ~0; + CPU_FILL(&kernel_pmap->pm_active); /*******************************************************/ /* Final setup */ @@ -1483,7 +1484,7 @@ mmu_booke_pinit(mmu_t mmu, pmap_t pmap) PMAP_LOCK_INIT(pmap); for (i = 0; i < MAXCPU; i++) pmap->pm_tid[i] = TID_NONE; - pmap->pm_active = 0; + CPU_ZERO(&kernel_pmap->pm_active); bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); bzero(&pmap->pm_pdir, sizeof(pte_t *) * PDIR_NENTRIES); TAILQ_INIT(&pmap->pm_ptbl_list); @@ -1838,7 +1839,7 @@ mmu_booke_activate(mmu_t mmu, struct thread *td) mtx_lock_spin(&sched_lock); - atomic_set_int(&pmap->pm_active, PCPU_GET(cpumask)); + CPU_OR_ATOMIC(&pmap->pm_active, PCPU_PTR(cpumask)); PCPU_SET(curpmap, pmap); if (pmap->pm_tid[PCPU_GET(cpuid)] == TID_NONE) @@ -1867,7 +1868,9 @@ mmu_booke_deactivate(mmu_t mmu, struct thread *td) 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); - atomic_clear_int(&pmap->pm_active, PCPU_GET(cpumask)); + sched_pin(); + CPU_NAND_ATOMIC(&pmap->pm_active, PCPU_PTR(cpumask)); + sched_unpin(); PCPU_SET(curpmap, NULL); } From c98b35868fa5649379b0f5e3a7900820fe53f8f6 Mon Sep 17 00:00:00 2001 From: Attilio Rao Date: Wed, 18 May 2011 16:50:13 +0000 Subject: [PATCH 3/4] Revert r222069,222068 as they were intended to be committed to the largeSMP branch. Reported by: pluknet --- sys/powerpc/booke/platform_bare.c | 5 ++--- sys/powerpc/booke/pmap.c | 11 ++++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/sys/powerpc/booke/platform_bare.c b/sys/powerpc/booke/platform_bare.c index de26128c49f..8e03bd32d46 100644 --- a/sys/powerpc/booke/platform_bare.c +++ b/sys/powerpc/booke/platform_bare.c @@ -241,7 +241,7 @@ bare_smp_start_cpu(platform_t plat, struct pcpu *pc) int timeout; eebpcr = ccsr_read4(OCP85XX_EEBPCR); - if ((eebpcr & (1 << (pc->pc_cpuid + 24))) != 0) { + if ((eebpcr & (pc->pc_cpumask << 24)) != 0) { printf("%s: CPU=%d already out of hold-off state!\n", __func__, pc->pc_cpuid); return (ENXIO); @@ -259,8 +259,7 @@ bare_smp_start_cpu(platform_t plat, struct pcpu *pc) /* * Release AP from hold-off state */ - - eebpcr |= (1 << (pc->pc_cpuid + 24)); + eebpcr |= (pc->pc_cpumask << 24); ccsr_write4(OCP85XX_EEBPCR, eebpcr); __asm __volatile("isync; msync"); diff --git a/sys/powerpc/booke/pmap.c b/sys/powerpc/booke/pmap.c index 11be68efb99..2fffa3f14b9 100644 --- a/sys/powerpc/booke/pmap.c +++ b/sys/powerpc/booke/pmap.c @@ -63,7 +63,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -1229,7 +1228,7 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_offset_t kernelend) PTE_VALID; } /* Mark kernel_pmap active on all CPUs */ - CPU_FILL(&kernel_pmap->pm_active); + kernel_pmap->pm_active = ~0; /*******************************************************/ /* Final setup */ @@ -1484,7 +1483,7 @@ mmu_booke_pinit(mmu_t mmu, pmap_t pmap) PMAP_LOCK_INIT(pmap); for (i = 0; i < MAXCPU; i++) pmap->pm_tid[i] = TID_NONE; - CPU_ZERO(&kernel_pmap->pm_active); + pmap->pm_active = 0; bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); bzero(&pmap->pm_pdir, sizeof(pte_t *) * PDIR_NENTRIES); TAILQ_INIT(&pmap->pm_ptbl_list); @@ -1839,7 +1838,7 @@ mmu_booke_activate(mmu_t mmu, struct thread *td) mtx_lock_spin(&sched_lock); - CPU_OR_ATOMIC(&pmap->pm_active, PCPU_PTR(cpumask)); + atomic_set_int(&pmap->pm_active, PCPU_GET(cpumask)); PCPU_SET(curpmap, pmap); if (pmap->pm_tid[PCPU_GET(cpuid)] == TID_NONE) @@ -1868,9 +1867,7 @@ mmu_booke_deactivate(mmu_t mmu, struct thread *td) 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); - sched_pin(); - CPU_NAND_ATOMIC(&pmap->pm_active, PCPU_PTR(cpumask)); - sched_unpin(); + atomic_clear_int(&pmap->pm_active, PCPU_GET(cpumask)); PCPU_SET(curpmap, NULL); } From 4b7e61167509e9e546c6b0a2958734228956c2ca Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Wed, 18 May 2011 17:06:11 +0000 Subject: [PATCH 4/4] Clean up a loose end from the conversion from gnu ar/ranlib to the BSD one. Without this, we don't have ar or randlib in the tool path, leading to much pain for some users. This pain is exposed by the external toolchain enhancements that I'm working on. Submitted by: John Hein (ages ago, and dropped on the floor by me: sorry) --- Makefile.inc1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 4aa53da83d2..1e613affecd 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -1552,7 +1552,8 @@ _xb-build-tools: _xb-cross-tools: .for _tool in \ gnu/usr.bin/binutils \ - gnu/usr.bin/cc + gnu/usr.bin/cc \ + usr.bin/ar ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \ cd ${.CURDIR}/${_tool}; \ ${CDMAKE} DIRPRFX=${_tool}/ obj; \ @@ -1577,7 +1578,8 @@ _xi-cross-tools: @echo "_xi-cross-tools" .for _tool in \ gnu/usr.bin/binutils \ - gnu/usr.bin/cc + gnu/usr.bin/cc \ + usr.bin/ar ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ cd ${.CURDIR}/${_tool}; \ ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}