Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b864736 authored by Yinghai Lu's avatar Yinghai Lu Committed by Ingo Molnar
Browse files

x86: add srat_detect_node for amd64



separate that from amd_detect_cmp()

Signed-off-by: default avatarYinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent c58606ad
Loading
Loading
Loading
Loading
+12 −7
Original line number Original line Diff line number Diff line
@@ -36,19 +36,23 @@ static void __cpuinit amd_detect_cmp(struct cpuinfo_x86 *c)
{
{
#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
	unsigned bits;
	unsigned bits;
#ifdef CONFIG_NUMA

	int cpu = smp_processor_id();
	int node = 0;
	unsigned apicid = hard_smp_processor_id();
#endif
	bits = c->x86_coreid_bits;
	bits = c->x86_coreid_bits;


	/* Low order bits define the core id (index of core in socket) */
	/* Low order bits define the core id (index of core in socket) */
	c->cpu_core_id = c->initial_apicid & ((1 << bits)-1);
	c->cpu_core_id = c->initial_apicid & ((1 << bits)-1);
	/* Convert the initial APIC ID into the socket ID */
	/* Convert the initial APIC ID into the socket ID */
	c->phys_proc_id = c->initial_apicid >> bits;
	c->phys_proc_id = c->initial_apicid >> bits;
#endif
}


static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c)
{
#ifdef CONFIG_NUMA
#ifdef CONFIG_NUMA
	int cpu = smp_processor_id();
	int node;
	unsigned apicid = hard_smp_processor_id();

	node = c->phys_proc_id;
	node = c->phys_proc_id;
	if (apicid_to_node[apicid] != NUMA_NO_NODE)
	if (apicid_to_node[apicid] != NUMA_NO_NODE)
		node = apicid_to_node[apicid];
		node = apicid_to_node[apicid];
@@ -76,7 +80,6 @@ static void __cpuinit amd_detect_cmp(struct cpuinfo_x86 *c)


	printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node);
	printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node);
#endif
#endif
#endif
}
}


static void __cpuinit early_init_amd_mc(struct cpuinfo_x86 *c)
static void __cpuinit early_init_amd_mc(struct cpuinfo_x86 *c)
@@ -169,8 +172,10 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
	display_cacheinfo(c);
	display_cacheinfo(c);


	/* Multi core CPU? */
	/* Multi core CPU? */
	if (c->extended_cpuid_level >= 0x80000008)
	if (c->extended_cpuid_level >= 0x80000008) {
		amd_detect_cmp(c);
		amd_detect_cmp(c);
		srat_detect_node(c);
	}


	if (c->extended_cpuid_level >= 0x80000006) {
	if (c->extended_cpuid_level >= 0x80000006) {
		if ((c->x86 >= 0x0f) && (cpuid_edx(0x80000006) & 0xf000))
		if ((c->x86 >= 0x0f) && (cpuid_edx(0x80000006) & 0xf000))