summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2010-11-30 19:30:17 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2010-11-30 19:30:17 +0000
commit8abf2d4b6d86fdcfebde3540aae75743bc2951f0 (patch)
tree2e8731e32807cf7f0cbad05003fcb9583198ab5a /sys/arch
parenta233cec951a14657ccf8cd10282e1578f76376e4 (diff)
Extend bitmasks to 64-bit such that we can support up to 64 CPU cores.
tested by dlg@, ok jsing@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amd64/amd64/pmap.c27
-rw-r--r--sys/arch/amd64/include/pmap.h4
2 files changed, 15 insertions, 16 deletions
diff --git a/sys/arch/amd64/amd64/pmap.c b/sys/arch/amd64/amd64/pmap.c
index b2a068d58ae..ddfe6b2fb32 100644
--- a/sys/arch/amd64/amd64/pmap.c
+++ b/sys/arch/amd64/amd64/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.59 2010/11/20 20:33:23 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.60 2010/11/30 19:30:16 kettenis Exp $ */
/* $NetBSD: pmap.c,v 1.3 2003/05/08 18:13:13 thorpej Exp $ */
/*
@@ -351,7 +351,7 @@ static __inline boolean_t
pmap_is_active(struct pmap *pmap, int cpu_id)
{
return (pmap == pmap_kernel() ||
- (pmap->pm_cpus & (1U << cpu_id)) != 0);
+ (pmap->pm_cpus & (1ULL << cpu_id)) != 0);
}
static __inline u_int
@@ -1127,7 +1127,7 @@ pmap_activate(struct proc *p)
/*
* mark the pmap in use by this processor.
*/
- x86_atomic_setbits_ul(&pmap->pm_cpus, (1U << cpu_number()));
+ x86_atomic_setbits_u64(&pmap->pm_cpus, (1ULL << cpu_number()));
}
}
@@ -1143,8 +1143,7 @@ pmap_deactivate(struct proc *p)
/*
* mark the pmap no longer in use by this processor.
*/
- x86_atomic_clearbits_ul(&pmap->pm_cpus, (1U << cpu_number()));
-
+ x86_atomic_clearbits_u64(&pmap->pm_cpus, (1ULL << cpu_number()));
}
/*
@@ -2457,13 +2456,13 @@ pmap_tlb_shootpage(struct pmap *pm, vaddr_t va)
struct cpu_info *ci, *self = curcpu();
CPU_INFO_ITERATOR cii;
long wait = 0;
- int mask = 0;
+ u_int64_t mask = 0;
CPU_INFO_FOREACH(cii, ci) {
if (ci == self || !pmap_is_active(pm, ci->ci_cpuid) ||
!(ci->ci_flags & CPUF_RUNNING))
continue;
- mask |= 1 << ci->ci_cpuid;
+ mask |= (1ULL << ci->ci_cpuid);
wait++;
}
@@ -2476,7 +2475,7 @@ pmap_tlb_shootpage(struct pmap *pm, vaddr_t va)
}
tlb_shoot_addr1 = va;
CPU_INFO_FOREACH(cii, ci) {
- if ((mask & 1 << ci->ci_cpuid) == 0)
+ if ((mask & (1ULL << ci->ci_cpuid)) == 0)
continue;
if (x86_fast_ipi(ci, LAPIC_IPI_INVLPG) != 0)
panic("pmap_tlb_shootpage: ipi failed");
@@ -2494,14 +2493,14 @@ pmap_tlb_shootrange(struct pmap *pm, vaddr_t sva, vaddr_t eva)
struct cpu_info *ci, *self = curcpu();
CPU_INFO_ITERATOR cii;
long wait = 0;
- int mask = 0;
+ u_int64_t mask = 0;
vaddr_t va;
CPU_INFO_FOREACH(cii, ci) {
if (ci == self || !pmap_is_active(pm, ci->ci_cpuid) ||
!(ci->ci_flags & CPUF_RUNNING))
continue;
- mask |= 1 << ci->ci_cpuid;
+ mask |= (1ULL << ci->ci_cpuid);
wait++;
}
@@ -2515,7 +2514,7 @@ pmap_tlb_shootrange(struct pmap *pm, vaddr_t sva, vaddr_t eva)
tlb_shoot_addr1 = sva;
tlb_shoot_addr2 = eva;
CPU_INFO_FOREACH(cii, ci) {
- if ((mask & 1 << ci->ci_cpuid) == 0)
+ if ((mask & (1ULL << ci->ci_cpuid)) == 0)
continue;
if (x86_fast_ipi(ci, LAPIC_IPI_INVLRANGE) != 0)
panic("pmap_tlb_shootrange: ipi failed");
@@ -2534,12 +2533,12 @@ pmap_tlb_shoottlb(void)
struct cpu_info *ci, *self = curcpu();
CPU_INFO_ITERATOR cii;
long wait = 0;
- int mask = 0;
+ u_int64_t mask = 0;
CPU_INFO_FOREACH(cii, ci) {
if (ci == self || !(ci->ci_flags & CPUF_RUNNING))
continue;
- mask |= 1 << ci->ci_cpuid;
+ mask |= (1ULL << ci->ci_cpuid);
wait++;
}
@@ -2552,7 +2551,7 @@ pmap_tlb_shoottlb(void)
}
CPU_INFO_FOREACH(cii, ci) {
- if ((mask & 1 << ci->ci_cpuid) == 0)
+ if ((mask & (1ULL << ci->ci_cpuid)) == 0)
continue;
if (x86_fast_ipi(ci, LAPIC_IPI_INVLTLB) != 0)
panic("pmap_tlb_shoottlb: ipi failed");
diff --git a/sys/arch/amd64/include/pmap.h b/sys/arch/amd64/include/pmap.h
index 48390617221..4be7f724eec 100644
--- a/sys/arch/amd64/include/pmap.h
+++ b/sys/arch/amd64/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.35 2010/10/26 05:49:10 guenther Exp $ */
+/* $OpenBSD: pmap.h,v 1.36 2010/11/30 19:30:16 kettenis Exp $ */
/* $NetBSD: pmap.h,v 1.1 2003/04/26 18:39:46 fvdl Exp $ */
/*
@@ -318,7 +318,7 @@ struct pmap {
/* pointer to a PTP in our pmap */
struct pmap_statistics pm_stats; /* pmap stats (lck by object lock) */
- u_int32_t pm_cpus; /* mask of CPUs using pmap */
+ u_int64_t pm_cpus; /* mask of CPUs using pmap */
};
/*