diff options
author | jeff <jeff@FreeBSD.org> | 2003-06-28 22:07:42 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2003-06-28 22:07:42 +0000 |
commit | a92e8f57c562ebd59ca08e2d351ce32b5dbb9a64 (patch) | |
tree | 46c4758717d752649282c3be65583e44ec304005 /sys/amd64/include/mptable.h | |
parent | 3e2b03aa95a36aa57a94472d29c92f807d12df3e (diff) | |
download | FreeBSD-src-a92e8f57c562ebd59ca08e2d351ce32b5dbb9a64.zip FreeBSD-src-a92e8f57c562ebd59ca08e2d351ce32b5dbb9a64.tar.gz |
- Construct a cpu topology map for Hyper Threading systems so that ULE may
take advantage of them.
Diffstat (limited to 'sys/amd64/include/mptable.h')
-rw-r--r-- | sys/amd64/include/mptable.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sys/amd64/include/mptable.h b/sys/amd64/include/mptable.h index a58d3b4..9701476 100644 --- a/sys/amd64/include/mptable.h +++ b/sys/amd64/include/mptable.h @@ -282,6 +282,13 @@ int cpu_num_to_apic_id[NAPICID]; int io_num_to_apic_id[NAPICID]; int apic_id_to_logical[NAPICID]; +/* + * CPU topology map datastructures for HTT. + */ +struct cpu_group mp_groups[NAPICID]; +struct cpu_top mp_top; +struct cpu_top *smp_topology; + /* AP uses this during bootstrap. Do not staticize. */ char *bootSTK; @@ -1069,6 +1076,7 @@ static void mptable_hyperthread_fixup(u_int id_mask) { u_int i, id; + int logical; /* Nothing to do if there is no HTT support. */ if ((cpu_feature & CPUID_HTT) == 0) @@ -1101,6 +1109,29 @@ mptable_hyperthread_fixup(u_int id_mask) need_hyperthreading_fixup = 1; mp_maxid *= logical_cpus; mp_naps *= logical_cpus; + + /* + * Now setup the cpu topology map. + */ + mp_top.ct_count = mp_naps / logical_cpus; + mp_top.ct_group = mp_groups; + + /* + * The first logical id is directly after the last valid physical id. + */ + logical = mp_top.ct_count + 1; + + for (i = 0; i < mp_top.ct_count; i++) { + int j; + + mp_groups[i].cg_mask = (1 << i); + for (j = 1; j < logical_cpus; j++) + mp_groups[i].cg_mask |= (1 << logical++); + mp_groups[i].cg_count = logical_cpus; + mp_groups[i].cg_children = 0; + } + + smp_topology = &mp_top; } void |