mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-17 10:26:15 +00:00
- Add the mp_topology() function to mp_machdep.c. This function builds up
the smp_topology structure to reflect the layout of HTT enabled machines. - Add a prototype for mp_topology() in smp.h
This commit is contained in:
parent
a73ff5105c
commit
59f3a8e626
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=123431
@ -154,10 +154,10 @@ int boot_cpu_id = -1; /* designated BSP */
|
||||
extern int nkpt;
|
||||
|
||||
/*
|
||||
* CPU topology map datastructures for HTT. (XXX)
|
||||
* CPU topology map datastructures for HTT.
|
||||
*/
|
||||
struct cpu_group mp_groups[MAXCPU];
|
||||
struct cpu_top mp_top;
|
||||
static struct cpu_group mp_groups[MAXCPU];
|
||||
static struct cpu_top mp_top;
|
||||
struct cpu_top *smp_topology;
|
||||
|
||||
/* AP uses this during bootstrap. Do not staticize. */
|
||||
@ -213,6 +213,46 @@ static int hlt_cpus_mask;
|
||||
static int hlt_logical_cpus;
|
||||
static struct sysctl_ctx_list logical_cpu_clist;
|
||||
|
||||
void
|
||||
mp_topology(void)
|
||||
{
|
||||
struct cpu_group *group;
|
||||
int logical_cpus;
|
||||
int apic_id;
|
||||
int groups;
|
||||
int cpu;
|
||||
|
||||
/* Build the smp_topology map. */
|
||||
/* Nothing to do if there is no HTT support. */
|
||||
if ((cpu_feature & CPUID_HTT) == 0)
|
||||
return;
|
||||
logical_cpus = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
|
||||
if (logical_cpus <= 1)
|
||||
return;
|
||||
group = &mp_groups[0];
|
||||
groups = 1;
|
||||
for (cpu = 0, apic_id = 0; apic_id < MAXCPU; apic_id++) {
|
||||
if (!cpu_info[apic_id].cpu_present)
|
||||
continue;
|
||||
/*
|
||||
* If the current group has members and we're not a logical
|
||||
* cpu, create a new group.
|
||||
*/
|
||||
if (group->cg_count != 0 && (apic_id % logical_cpus) == 0) {
|
||||
group++;
|
||||
groups++;
|
||||
}
|
||||
group->cg_count++;
|
||||
group->cg_mask |= 1 << cpu;
|
||||
cpu++;
|
||||
}
|
||||
|
||||
mp_top.ct_count = groups;
|
||||
mp_top.ct_group = mp_groups;
|
||||
smp_topology = &mp_top;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Calculate usable address in base memory for AP trampoline code.
|
||||
*/
|
||||
|
@ -75,6 +75,7 @@ void forward_hardclock(void);
|
||||
void forwarded_hardclock(struct clockframe frame);
|
||||
u_int mp_bootaddress(u_int);
|
||||
int mp_grab_cpu_hlt(void);
|
||||
void mp_topology(void);
|
||||
void smp_invlpg(vm_offset_t addr);
|
||||
void smp_masked_invlpg(u_int mask, vm_offset_t addr);
|
||||
void smp_invlpg_range(vm_offset_t startva, vm_offset_t endva);
|
||||
|
Loading…
Reference in New Issue
Block a user