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

Commit 1b313f4a authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Ingo Molnar
Browse files

x86: apic - generic_processor_info



- use physid_set instead of phys_cpu and physids_or
- set phys_cpu_present_map bit AFTER check for allowed
  number of processors
- add checking for APIC valid version in 64bit mode
  (mostly not needed but added for merging purpose)
- add apic_version definition for 64bit mode which
  is used now

Signed-off-by: default avatarCyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent c177b0bc
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -1480,7 +1480,6 @@ void __cpuinit generic_processor_info(int apicid, int version)
{
	int cpu;
	cpumask_t tmp_map;
	physid_mask_t phys_cpu;

	/*
	 * Validate version
@@ -1493,9 +1492,6 @@ void __cpuinit generic_processor_info(int apicid, int version)
	}
	apic_version[apicid] = version;

	phys_cpu = apicid_to_cpu_present(apicid);
	physids_or(phys_cpu_present_map, phys_cpu_present_map, phys_cpu);

	if (num_processors >= NR_CPUS) {
		printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached."
			"  Processor ignored.\n", NR_CPUS);
@@ -1512,17 +1508,19 @@ void __cpuinit generic_processor_info(int apicid, int version)
	cpus_complement(tmp_map, cpu_present_map);
	cpu = first_cpu(tmp_map);

	if (apicid == boot_cpu_physical_apicid)
	physid_set(apicid, phys_cpu_present_map);
	if (apicid == boot_cpu_physical_apicid) {
		/*
		 * x86_bios_cpu_apicid is required to have processors listed
		 * in same order as logical cpu numbers. Hence the first
		 * entry is BSP, and so on.
		 */
		cpu = 0;

	}
	if (apicid > max_physical_apicid)
		max_physical_apicid = apicid;

#ifdef CONFIG_X86_32
	/*
	 * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y
	 * but we need to work other dependencies like SMP_SUSPEND etc
@@ -1542,7 +1540,9 @@ void __cpuinit generic_processor_info(int apicid, int version)
			def_to_bigsmp = 1;
		}
	}
#ifdef CONFIG_SMP
#endif

#if defined(CONFIG_X86_SMP) || defined(CONFIG_X86_64)
	/* are we being called early in kernel startup? */
	if (early_per_cpu_ptr(x86_cpu_to_apicid)) {
		u16 *cpu_to_apicid = early_per_cpu_ptr(x86_cpu_to_apicid);
@@ -1555,6 +1555,7 @@ void __cpuinit generic_processor_info(int apicid, int version)
		per_cpu(x86_bios_cpu_apicid, cpu) = apicid;
	}
#endif

	cpu_set(cpu, cpu_possible_map);
	cpu_set(cpu, cpu_present_map);
}
+39 −2
Original line number Diff line number Diff line
@@ -1215,6 +1215,8 @@ void __init init_apic_mappings(void)
 * This initializes the IO-APIC and APIC hardware if this is
 * a UP kernel.
 */
int apic_version[MAX_APICS];

int __init APIC_init_uniprocessor(void)
{
	if (disable_apic) {
@@ -1409,6 +1411,17 @@ void __cpuinit generic_processor_info(int apicid, int version)
	int cpu;
	cpumask_t tmp_map;

	/*
	 * Validate version
	 */
	if (version == 0x0) {
		printk(KERN_WARNING "BIOS bug, APIC version is 0 for CPU#%d! "
				"fixing up to 0x10. (tell your hw vendor)\n",
				version);
		version = 0x10;
	}
	apic_version[apicid] = version;

	if (num_processors >= NR_CPUS) {
		printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached."
			"  Processor ignored.\n", NR_CPUS);
@@ -1437,6 +1450,29 @@ void __cpuinit generic_processor_info(int apicid, int version)
	if (apicid > max_physical_apicid)
		max_physical_apicid = apicid;

#ifdef CONFIG_X86_32
	/*
	 * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y
	 * but we need to work other dependencies like SMP_SUSPEND etc
	 * before this can be done without some confusion.
	 * if (CPU_HOTPLUG_ENABLED || num_processors > 8)
	 *       - Ashok Raj <ashok.raj@intel.com>
	 */
	if (max_physical_apicid >= 8) {
		switch (boot_cpu_data.x86_vendor) {
		case X86_VENDOR_INTEL:
			if (!APIC_XAPIC(version)) {
				def_to_bigsmp = 0;
				break;
			}
			/* If P4 and above fall through */
		case X86_VENDOR_AMD:
			def_to_bigsmp = 1;
		}
	}
#endif

#if defined(CONFIG_X86_SMP) || defined(CONFIG_X86_64)
	/* are we being called early in kernel startup? */
	if (early_per_cpu_ptr(x86_cpu_to_apicid)) {
		u16 *cpu_to_apicid = early_per_cpu_ptr(x86_cpu_to_apicid);
@@ -1448,6 +1484,7 @@ void __cpuinit generic_processor_info(int apicid, int version)
		per_cpu(x86_cpu_to_apicid, cpu) = apicid;
		per_cpu(x86_bios_cpu_apicid, cpu) = apicid;
	}
#endif

	cpu_set(cpu, cpu_possible_map);
	cpu_set(cpu, cpu_present_map);