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

Commit 2759c328 authored by Yinghai Lu's avatar Yinghai Lu Committed by Ingo Molnar
Browse files

x86: don't call read_apic_id if !cpu_has_apic



should not call that if apic is disabled.

[ Impact: fix crash on certain UP configs ]

Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
LKML-Reference: <4A09CCBB.2000306@kernel.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent e5198075
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -161,7 +161,7 @@ static int flat_apic_id_registered(void)


static int flat_phys_pkg_id(int initial_apic_id, int index_msb)
static int flat_phys_pkg_id(int initial_apic_id, int index_msb)
{
{
	return hard_smp_processor_id() >> index_msb;
	return initial_apic_id >> index_msb;
}
}


struct apic apic_flat =  {
struct apic apic_flat =  {
+1 −1
Original line number Original line Diff line number Diff line
@@ -272,7 +272,7 @@ static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c)
#if defined(CONFIG_NUMA) && defined(CONFIG_X86_64)
#if defined(CONFIG_NUMA) && defined(CONFIG_X86_64)
	int cpu = smp_processor_id();
	int cpu = smp_processor_id();
	int node;
	int node;
	unsigned apicid = hard_smp_processor_id();
	unsigned apicid = cpu_has_apic ? hard_smp_processor_id() : c->apicid;


	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)
+6 −0
Original line number Original line Diff line number Diff line
@@ -761,6 +761,12 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
	if (this_cpu->c_identify)
	if (this_cpu->c_identify)
		this_cpu->c_identify(c);
		this_cpu->c_identify(c);


	/* Clear/Set all flags overriden by options, after probe */
	for (i = 0; i < NCAPINTS; i++) {
		c->x86_capability[i] &= ~cpu_caps_cleared[i];
		c->x86_capability[i] |= cpu_caps_set[i];
	}

#ifdef CONFIG_X86_64
#ifdef CONFIG_X86_64
	c->apicid = apic->phys_pkg_id(c->initial_apicid, 0);
	c->apicid = apic->phys_pkg_id(c->initial_apicid, 0);
#endif
#endif
+3 −3
Original line number Original line Diff line number Diff line
@@ -229,12 +229,12 @@ static void __cpuinit intel_workarounds(struct cpuinfo_x86 *c)
}
}
#endif
#endif


static void __cpuinit srat_detect_node(void)
static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c)
{
{
#if defined(CONFIG_NUMA) && defined(CONFIG_X86_64)
#if defined(CONFIG_NUMA) && defined(CONFIG_X86_64)
	unsigned node;
	unsigned node;
	int cpu = smp_processor_id();
	int cpu = smp_processor_id();
	int apicid = hard_smp_processor_id();
	int apicid = cpu_has_apic ? hard_smp_processor_id() : c->apicid;


	/* Don't do the funky fallback heuristics the AMD version employs
	/* Don't do the funky fallback heuristics the AMD version employs
	   for now. */
	   for now. */
@@ -400,7 +400,7 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
	}
	}


	/* Work around errata */
	/* Work around errata */
	srat_detect_node();
	srat_detect_node(c);


	if (cpu_has(c, X86_FEATURE_VMX))
	if (cpu_has(c, X86_FEATURE_VMX))
		detect_vmx_virtcap(c);
		detect_vmx_virtcap(c);