aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2008-08-18 12:45:57 -0400
committerIngo Molnar <mingo@elte.hu>2008-08-18 20:07:16 -0400
commit1b313f4a6d7bee7b2c034b3f1e203bc360a71cca (patch)
treeeaa380aef78b7aff26194ce5e37e23f6d28a66dd
parentc177b0bc03e0e11623e2099db42903fb0caf0fd3 (diff)
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: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/apic_32.c15
-rw-r--r--arch/x86/kernel/apic_64.c41
2 files changed, 47 insertions, 9 deletions
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index 3095bb71eaed..c3a252b1a8be 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -1480,7 +1480,6 @@ void __cpuinit generic_processor_info(int apicid, int version)
1480{ 1480{
1481 int cpu; 1481 int cpu;
1482 cpumask_t tmp_map; 1482 cpumask_t tmp_map;
1483 physid_mask_t phys_cpu;
1484 1483
1485 /* 1484 /*
1486 * Validate version 1485 * Validate version
@@ -1493,9 +1492,6 @@ void __cpuinit generic_processor_info(int apicid, int version)
1493 } 1492 }
1494 apic_version[apicid] = version; 1493 apic_version[apicid] = version;
1495 1494
1496 phys_cpu = apicid_to_cpu_present(apicid);
1497 physids_or(phys_cpu_present_map, phys_cpu_present_map, phys_cpu);
1498
1499 if (num_processors >= NR_CPUS) { 1495 if (num_processors >= NR_CPUS) {
1500 printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached." 1496 printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached."
1501 " Processor ignored.\n", NR_CPUS); 1497 " Processor ignored.\n", NR_CPUS);
@@ -1512,17 +1508,19 @@ void __cpuinit generic_processor_info(int apicid, int version)
1512 cpus_complement(tmp_map, cpu_present_map); 1508 cpus_complement(tmp_map, cpu_present_map);
1513 cpu = first_cpu(tmp_map); 1509 cpu = first_cpu(tmp_map);
1514 1510
1515 if (apicid == boot_cpu_physical_apicid) 1511 physid_set(apicid, phys_cpu_present_map);
1512 if (apicid == boot_cpu_physical_apicid) {
1516 /* 1513 /*
1517 * x86_bios_cpu_apicid is required to have processors listed 1514 * x86_bios_cpu_apicid is required to have processors listed
1518 * in same order as logical cpu numbers. Hence the first 1515 * in same order as logical cpu numbers. Hence the first
1519 * entry is BSP, and so on. 1516 * entry is BSP, and so on.
1520 */ 1517 */
1521 cpu = 0; 1518 cpu = 0;
1522 1519 }
1523 if (apicid > max_physical_apicid) 1520 if (apicid > max_physical_apicid)
1524 max_physical_apicid = apicid; 1521 max_physical_apicid = apicid;
1525 1522
1523#ifdef CONFIG_X86_32
1526 /* 1524 /*
1527 * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y 1525 * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y
1528 * but we need to work other dependencies like SMP_SUSPEND etc 1526 * but we need to work other dependencies like SMP_SUSPEND etc
@@ -1542,7 +1540,9 @@ void __cpuinit generic_processor_info(int apicid, int version)
1542 def_to_bigsmp = 1; 1540 def_to_bigsmp = 1;
1543 } 1541 }
1544 } 1542 }
1545#ifdef CONFIG_SMP 1543#endif
1544
1545#if defined(CONFIG_X86_SMP) || defined(CONFIG_X86_64)
1546 /* are we being called early in kernel startup? */ 1546 /* are we being called early in kernel startup? */
1547 if (early_per_cpu_ptr(x86_cpu_to_apicid)) { 1547 if (early_per_cpu_ptr(x86_cpu_to_apicid)) {
1548 u16 *cpu_to_apicid = early_per_cpu_ptr(x86_cpu_to_apicid); 1548 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)
1555 per_cpu(x86_bios_cpu_apicid, cpu) = apicid; 1555 per_cpu(x86_bios_cpu_apicid, cpu) = apicid;
1556 } 1556 }
1557#endif 1557#endif
1558
1558 cpu_set(cpu, cpu_possible_map); 1559 cpu_set(cpu, cpu_possible_map);
1559 cpu_set(cpu, cpu_present_map); 1560 cpu_set(cpu, cpu_present_map);
1560} 1561}
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 0d969103fce7..76c20773bedf 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -1215,6 +1215,8 @@ void __init init_apic_mappings(void)
1215 * This initializes the IO-APIC and APIC hardware if this is 1215 * This initializes the IO-APIC and APIC hardware if this is
1216 * a UP kernel. 1216 * a UP kernel.
1217 */ 1217 */
1218int apic_version[MAX_APICS];
1219
1218int __init APIC_init_uniprocessor(void) 1220int __init APIC_init_uniprocessor(void)
1219{ 1221{
1220 if (disable_apic) { 1222 if (disable_apic) {
@@ -1409,15 +1411,26 @@ void __cpuinit generic_processor_info(int apicid, int version)
1409 int cpu; 1411 int cpu;
1410 cpumask_t tmp_map; 1412 cpumask_t tmp_map;
1411 1413
1414 /*
1415 * Validate version
1416 */
1417 if (version == 0x0) {
1418 printk(KERN_WARNING "BIOS bug, APIC version is 0 for CPU#%d! "
1419 "fixing up to 0x10. (tell your hw vendor)\n",
1420 version);
1421 version = 0x10;
1422 }
1423 apic_version[apicid] = version;
1424
1412 if (num_processors >= NR_CPUS) { 1425 if (num_processors >= NR_CPUS) {
1413 printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached." 1426 printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached."
1414 " Processor ignored.\n", NR_CPUS); 1427 " Processor ignored.\n", NR_CPUS);
1415 return; 1428 return;
1416 } 1429 }
1417 1430
1418 if (num_processors >= maxcpus) { 1431 if (num_processors >= maxcpus) {
1419 printk(KERN_WARNING "WARNING: maxcpus limit of %i reached." 1432 printk(KERN_WARNING "WARNING: maxcpus limit of %i reached."
1420 " Processor ignored.\n", maxcpus); 1433 " Processor ignored.\n", maxcpus);
1421 return; 1434 return;
1422 } 1435 }
1423 1436
@@ -1437,6 +1450,29 @@ void __cpuinit generic_processor_info(int apicid, int version)
1437 if (apicid > max_physical_apicid) 1450 if (apicid > max_physical_apicid)
1438 max_physical_apicid = apicid; 1451 max_physical_apicid = apicid;
1439 1452
1453#ifdef CONFIG_X86_32
1454 /*
1455 * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y
1456 * but we need to work other dependencies like SMP_SUSPEND etc
1457 * before this can be done without some confusion.
1458 * if (CPU_HOTPLUG_ENABLED || num_processors > 8)
1459 * - Ashok Raj <ashok.raj@intel.com>
1460 */
1461 if (max_physical_apicid >= 8) {
1462 switch (boot_cpu_data.x86_vendor) {
1463 case X86_VENDOR_INTEL:
1464 if (!APIC_XAPIC(version)) {
1465 def_to_bigsmp = 0;
1466 break;
1467 }
1468 /* If P4 and above fall through */
1469 case X86_VENDOR_AMD:
1470 def_to_bigsmp = 1;
1471 }
1472 }
1473#endif
1474
1475#if defined(CONFIG_X86_SMP) || defined(CONFIG_X86_64)
1440 /* are we being called early in kernel startup? */ 1476 /* are we being called early in kernel startup? */
1441 if (early_per_cpu_ptr(x86_cpu_to_apicid)) { 1477 if (early_per_cpu_ptr(x86_cpu_to_apicid)) {
1442 u16 *cpu_to_apicid = early_per_cpu_ptr(x86_cpu_to_apicid); 1478 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)
1448 per_cpu(x86_cpu_to_apicid, cpu) = apicid; 1484 per_cpu(x86_cpu_to_apicid, cpu) = apicid;
1449 per_cpu(x86_bios_cpu_apicid, cpu) = apicid; 1485 per_cpu(x86_bios_cpu_apicid, cpu) = apicid;
1450 } 1486 }
1487#endif
1451 1488
1452 cpu_set(cpu, cpu_possible_map); 1489 cpu_set(cpu, cpu_possible_map);
1453 cpu_set(cpu, cpu_present_map); 1490 cpu_set(cpu, cpu_present_map);