summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2003-06-28 22:07:42 +0000
committerjeff <jeff@FreeBSD.org>2003-06-28 22:07:42 +0000
commita92e8f57c562ebd59ca08e2d351ce32b5dbb9a64 (patch)
tree46c4758717d752649282c3be65583e44ec304005
parent3e2b03aa95a36aa57a94472d29c92f807d12df3e (diff)
downloadFreeBSD-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.
-rw-r--r--sys/amd64/amd64/mp_machdep.c31
-rw-r--r--sys/amd64/amd64/mptable.c31
-rw-r--r--sys/amd64/include/mptable.h31
-rw-r--r--sys/i386/i386/mp_machdep.c31
-rw-r--r--sys/i386/i386/mptable.c31
-rw-r--r--sys/i386/include/mptable.h31
6 files changed, 186 insertions, 0 deletions
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index a58d3b4..9701476 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -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
diff --git a/sys/amd64/amd64/mptable.c b/sys/amd64/amd64/mptable.c
index a58d3b4..9701476 100644
--- a/sys/amd64/amd64/mptable.c
+++ b/sys/amd64/amd64/mptable.c
@@ -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
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
diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c
index a58d3b4..9701476 100644
--- a/sys/i386/i386/mp_machdep.c
+++ b/sys/i386/i386/mp_machdep.c
@@ -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
diff --git a/sys/i386/i386/mptable.c b/sys/i386/i386/mptable.c
index a58d3b4..9701476 100644
--- a/sys/i386/i386/mptable.c
+++ b/sys/i386/i386/mptable.c
@@ -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
diff --git a/sys/i386/include/mptable.h b/sys/i386/include/mptable.h
index a58d3b4..9701476 100644
--- a/sys/i386/include/mptable.h
+++ b/sys/i386/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
OpenPOWER on IntegriCloud