MFi386: mp_topology().
This commit is contained in:
parent
c98bdf5b6a
commit
61ce0b1d90
@ -600,6 +600,10 @@ apic_setup_local(void *dummy __unused)
|
|||||||
if (retval != 0)
|
if (retval != 0)
|
||||||
printf("%s: Failed to setup the local APIC: returned %d\n",
|
printf("%s: Failed to setup the local APIC: returned %d\n",
|
||||||
best_enum->apic_name, retval);
|
best_enum->apic_name, retval);
|
||||||
|
#ifdef SMP
|
||||||
|
/* Last, setup the cpu topology now that we have probed CPUs */
|
||||||
|
mp_topology();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
SYSINIT(apic_setup_local, SI_SUB_CPU, SI_ORDER_FIRST, apic_setup_local, NULL)
|
SYSINIT(apic_setup_local, SI_SUB_CPU, SI_ORDER_FIRST, apic_setup_local, NULL)
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ int boot_cpu_id = -1; /* designated BSP */
|
|||||||
extern int nkpt;
|
extern int nkpt;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CPU topology map datastructures for HTT. (XXX)
|
* CPU topology map datastructures for HTT.
|
||||||
*/
|
*/
|
||||||
struct cpu_group mp_groups[MAXCPU];
|
struct cpu_group mp_groups[MAXCPU];
|
||||||
struct cpu_top mp_top;
|
struct cpu_top mp_top;
|
||||||
@ -141,6 +141,46 @@ static int hlt_logical_cpus;
|
|||||||
static struct sysctl_ctx_list logical_cpu_clist;
|
static struct sysctl_ctx_list logical_cpu_clist;
|
||||||
static u_int bootMP_size;
|
static u_int bootMP_size;
|
||||||
|
|
||||||
|
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.
|
* Calculate usable address in base memory for AP trampoline code.
|
||||||
*/
|
*/
|
||||||
|
@ -60,6 +60,7 @@ void forward_hardclock(void);
|
|||||||
void forwarded_hardclock(struct clockframe frame);
|
void forwarded_hardclock(struct clockframe frame);
|
||||||
u_int mp_bootaddress(u_int);
|
u_int mp_bootaddress(u_int);
|
||||||
int mp_grab_cpu_hlt(void);
|
int mp_grab_cpu_hlt(void);
|
||||||
|
void mp_topology(void);
|
||||||
void smp_invlpg(vm_offset_t addr);
|
void smp_invlpg(vm_offset_t addr);
|
||||||
void smp_masked_invlpg(u_int mask, 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);
|
void smp_invlpg_range(vm_offset_t startva, vm_offset_t endva);
|
||||||
|
Loading…
Reference in New Issue
Block a user