Remove pc_cpumask and pc_other_cpus from MIPS support.
Tested by: gonzo
This commit is contained in:
parent
c0757daf1f
commit
9a981857cf
@ -75,8 +75,11 @@ ipi_send(struct pcpu *pc, int ipi)
|
||||
void
|
||||
ipi_all_but_self(int ipi)
|
||||
{
|
||||
cpuset_t other_cpus;
|
||||
|
||||
ipi_selected(PCPU_GET(other_cpus), ipi);
|
||||
other_cpus = all_cpus;
|
||||
CPU_CLR(PCPU_GET(cpuid), &other_cpus);
|
||||
ipi_selected(other_cpus, ipi);
|
||||
}
|
||||
|
||||
/* Send an IPI to a set of cpus. */
|
||||
@ -86,7 +89,7 @@ ipi_selected(cpuset_t cpus, int ipi)
|
||||
struct pcpu *pc;
|
||||
|
||||
STAILQ_FOREACH(pc, &cpuhead, pc_allcpu) {
|
||||
if (CPU_OVERLAP(&cpus, &pc->pc_cpumask)) {
|
||||
if (CPU_ISSET(pc->pc_cpuid, &cpus)) {
|
||||
CTR3(KTR_SMP, "%s: pc: %p, ipi: %x\n", __func__, pc,
|
||||
ipi);
|
||||
ipi_send(pc, ipi);
|
||||
@ -109,13 +112,10 @@ ipi_cpu(int cpu, u_int ipi)
|
||||
static int
|
||||
mips_ipi_handler(void *arg)
|
||||
{
|
||||
int cpu;
|
||||
cpuset_t cpumask;
|
||||
u_int ipi, ipi_bitmap;
|
||||
u_int cpu, ipi, ipi_bitmap;
|
||||
int bit;
|
||||
|
||||
cpu = PCPU_GET(cpuid);
|
||||
cpumask = PCPU_GET(cpumask);
|
||||
|
||||
platform_ipi_clear(); /* quiesce the pending ipi interrupt */
|
||||
|
||||
@ -150,14 +150,14 @@ mips_ipi_handler(void *arg)
|
||||
tlb_save();
|
||||
|
||||
/* Indicate we are stopped */
|
||||
CPU_OR_ATOMIC(&stopped_cpus, &cpumask);
|
||||
CPU_SET_ATOMIC(cpu, &stopped_cpus);
|
||||
|
||||
/* Wait for restart */
|
||||
while (!CPU_OVERLAP(&started_cpus, &cpumask))
|
||||
while (!CPU_ISSET(cpu, &started_cpus))
|
||||
cpu_spinwait();
|
||||
|
||||
CPU_NAND_ATOMIC(&started_cpus, &cpumask);
|
||||
CPU_NAND_ATOMIC(&stopped_cpus, &cpumask);
|
||||
CPU_CLR_ATOMIC(cpu, &started_cpus);
|
||||
CPU_CLR_ATOMIC(cpu, &stopped_cpus);
|
||||
CTR0(KTR_SMP, "IPI_STOP (restart)");
|
||||
break;
|
||||
case IPI_PREEMPT:
|
||||
@ -243,7 +243,7 @@ void
|
||||
cpu_mp_start(void)
|
||||
{
|
||||
int error, cpuid;
|
||||
cpuset_t cpumask, ocpus;
|
||||
cpuset_t cpumask;
|
||||
|
||||
mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN);
|
||||
|
||||
@ -269,16 +269,11 @@ cpu_mp_start(void)
|
||||
}
|
||||
CPU_SET(cpuid, &all_cpus);
|
||||
}
|
||||
|
||||
ocpus = all_cpus;
|
||||
CPU_CLR(PCPU_GET(cpuid), &ocpus);
|
||||
PCPU_SET(other_cpus, ocpus);
|
||||
}
|
||||
|
||||
void
|
||||
smp_init_secondary(u_int32_t cpuid)
|
||||
{
|
||||
cpuset_t ocpus;
|
||||
|
||||
/* TLB */
|
||||
mips_wr_wired(0);
|
||||
@ -316,11 +311,6 @@ smp_init_secondary(u_int32_t cpuid)
|
||||
|
||||
CTR1(KTR_SMP, "SMP: AP CPU #%d launched", PCPU_GET(cpuid));
|
||||
|
||||
/* Build our map of 'other' CPUs. */
|
||||
ocpus = all_cpus;
|
||||
CPU_CLR(PCPU_GET(cpuid), &ocpus);
|
||||
PCPU_SET(other_cpus, ocpus);
|
||||
|
||||
if (bootverbose)
|
||||
printf("SMP: AP CPU #%d launched.\n", PCPU_GET(cpuid));
|
||||
|
||||
|
@ -625,19 +625,18 @@ pmap_init(void)
|
||||
static __inline void
|
||||
pmap_invalidate_all_local(pmap_t pmap)
|
||||
{
|
||||
u_int cpuid;
|
||||
|
||||
cpuid = PCPU_GET(cpuid);
|
||||
|
||||
if (pmap == kernel_pmap) {
|
||||
tlb_invalidate_all();
|
||||
return;
|
||||
}
|
||||
sched_pin();
|
||||
if (CPU_OVERLAP(&pmap->pm_active, PCPU_PTR(cpumask))) {
|
||||
sched_unpin();
|
||||
if (CPU_ISSET(cpuid, &pmap->pm_active))
|
||||
tlb_invalidate_all_user(pmap);
|
||||
} else {
|
||||
sched_unpin();
|
||||
pmap->pm_asid[PCPU_GET(cpuid)].gen = 0;
|
||||
}
|
||||
else
|
||||
pmap->pm_asid[cpuid].gen = 0;
|
||||
}
|
||||
|
||||
#ifdef SMP
|
||||
@ -666,21 +665,20 @@ pmap_invalidate_all(pmap_t pmap)
|
||||
static __inline void
|
||||
pmap_invalidate_page_local(pmap_t pmap, vm_offset_t va)
|
||||
{
|
||||
u_int cpuid;
|
||||
|
||||
cpuid = PCPU_GET(cpuid);
|
||||
|
||||
if (is_kernel_pmap(pmap)) {
|
||||
tlb_invalidate_address(pmap, va);
|
||||
return;
|
||||
}
|
||||
sched_pin();
|
||||
if (pmap->pm_asid[PCPU_GET(cpuid)].gen != PCPU_GET(asid_generation)) {
|
||||
sched_unpin();
|
||||
if (pmap->pm_asid[cpuid].gen != PCPU_GET(asid_generation))
|
||||
return;
|
||||
} else if (!CPU_OVERLAP(&pmap->pm_active, PCPU_PTR(cpumask))) {
|
||||
pmap->pm_asid[PCPU_GET(cpuid)].gen = 0;
|
||||
sched_unpin();
|
||||
else if (!CPU_ISSET(cpuid, &pmap->pm_active)) {
|
||||
pmap->pm_asid[cpuid].gen = 0;
|
||||
return;
|
||||
}
|
||||
sched_unpin();
|
||||
tlb_invalidate_address(pmap, va);
|
||||
}
|
||||
|
||||
@ -719,21 +717,20 @@ pmap_invalidate_page(pmap_t pmap, vm_offset_t va)
|
||||
static __inline void
|
||||
pmap_update_page_local(pmap_t pmap, vm_offset_t va, pt_entry_t pte)
|
||||
{
|
||||
u_int cpuid;
|
||||
|
||||
cpuid = PCPU_GET(cpuid);
|
||||
|
||||
if (is_kernel_pmap(pmap)) {
|
||||
tlb_update(pmap, va, pte);
|
||||
return;
|
||||
}
|
||||
sched_pin();
|
||||
if (pmap->pm_asid[PCPU_GET(cpuid)].gen != PCPU_GET(asid_generation)) {
|
||||
sched_unpin();
|
||||
if (pmap->pm_asid[cpuid].gen != PCPU_GET(asid_generation))
|
||||
return;
|
||||
} else if (!CPU_OVERLAP(&pmap->pm_active, PCPU_PTR(cpumask))) {
|
||||
pmap->pm_asid[PCPU_GET(cpuid)].gen = 0;
|
||||
sched_unpin();
|
||||
else if (!CPU_ISSET(cpuid, &pmap->pm_active)) {
|
||||
pmap->pm_asid[cpuid].gen = 0;
|
||||
return;
|
||||
}
|
||||
sched_unpin();
|
||||
tlb_update(pmap, va, pte);
|
||||
}
|
||||
|
||||
@ -2953,19 +2950,21 @@ pmap_activate(struct thread *td)
|
||||
{
|
||||
pmap_t pmap, oldpmap;
|
||||
struct proc *p = td->td_proc;
|
||||
u_int cpuid;
|
||||
|
||||
critical_enter();
|
||||
|
||||
pmap = vmspace_pmap(p->p_vmspace);
|
||||
oldpmap = PCPU_GET(curpmap);
|
||||
cpuid = PCPU_GET(cpuid);
|
||||
|
||||
if (oldpmap)
|
||||
CPU_NAND_ATOMIC(&oldpmap->pm_active, PCPU_PTR(cpumask));
|
||||
CPU_OR_ATOMIC(&pmap->pm_active, PCPU_PTR(cpumask));
|
||||
CPU_CLR_ATOMIC(cpuid, &oldpmap->pm_active);
|
||||
CPU_SET_ATOMIC(cpuid, &pmap->pm_active);
|
||||
pmap_asid_alloc(pmap);
|
||||
if (td == curthread) {
|
||||
PCPU_SET(segbase, pmap->pm_segtab);
|
||||
mips_wr_entryhi(pmap->pm_asid[PCPU_GET(cpuid)].asid);
|
||||
mips_wr_entryhi(pmap->pm_asid[cpuid].asid);
|
||||
}
|
||||
|
||||
PCPU_SET(curpmap, pmap);
|
||||
|
Loading…
x
Reference in New Issue
Block a user