aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/apic
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/apic')
-rw-r--r--arch/x86/kernel/apic/apic.c62
-rw-r--r--arch/x86/kernel/apic/bigsmp_32.c20
-rw-r--r--arch/x86/kernel/apic/es7000_32.c2
-rw-r--r--arch/x86/kernel/apic/io_apic.c213
-rw-r--r--arch/x86/kernel/apic/probe_32.c10
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c8
6 files changed, 163 insertions, 152 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index b9338b8cf42..a2fd72e0ab3 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -27,6 +27,7 @@
27#include <linux/syscore_ops.h> 27#include <linux/syscore_ops.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/timex.h> 29#include <linux/timex.h>
30#include <linux/i8253.h>
30#include <linux/dmar.h> 31#include <linux/dmar.h>
31#include <linux/init.h> 32#include <linux/init.h>
32#include <linux/cpu.h> 33#include <linux/cpu.h>
@@ -37,9 +38,8 @@
37#include <asm/perf_event.h> 38#include <asm/perf_event.h>
38#include <asm/x86_init.h> 39#include <asm/x86_init.h>
39#include <asm/pgalloc.h> 40#include <asm/pgalloc.h>
40#include <asm/atomic.h> 41#include <linux/atomic.h>
41#include <asm/mpspec.h> 42#include <asm/mpspec.h>
42#include <asm/i8253.h>
43#include <asm/i8259.h> 43#include <asm/i8259.h>
44#include <asm/proto.h> 44#include <asm/proto.h>
45#include <asm/apic.h> 45#include <asm/apic.h>
@@ -48,6 +48,7 @@
48#include <asm/hpet.h> 48#include <asm/hpet.h>
49#include <asm/idle.h> 49#include <asm/idle.h>
50#include <asm/mtrr.h> 50#include <asm/mtrr.h>
51#include <asm/time.h>
51#include <asm/smp.h> 52#include <asm/smp.h>
52#include <asm/mce.h> 53#include <asm/mce.h>
53#include <asm/tsc.h> 54#include <asm/tsc.h>
@@ -1429,34 +1430,28 @@ void enable_x2apic(void)
1429 rdmsr(MSR_IA32_APICBASE, msr, msr2); 1430 rdmsr(MSR_IA32_APICBASE, msr, msr2);
1430 if (!(msr & X2APIC_ENABLE)) { 1431 if (!(msr & X2APIC_ENABLE)) {
1431 printk_once(KERN_INFO "Enabling x2apic\n"); 1432 printk_once(KERN_INFO "Enabling x2apic\n");
1432 wrmsr(MSR_IA32_APICBASE, msr | X2APIC_ENABLE, 0); 1433 wrmsr(MSR_IA32_APICBASE, msr | X2APIC_ENABLE, msr2);
1433 } 1434 }
1434} 1435}
1435#endif /* CONFIG_X86_X2APIC */ 1436#endif /* CONFIG_X86_X2APIC */
1436 1437
1437int __init enable_IR(void) 1438int __init enable_IR(void)
1438{ 1439{
1439#ifdef CONFIG_INTR_REMAP 1440#ifdef CONFIG_IRQ_REMAP
1440 if (!intr_remapping_supported()) { 1441 if (!intr_remapping_supported()) {
1441 pr_debug("intr-remapping not supported\n"); 1442 pr_debug("intr-remapping not supported\n");
1442 return 0; 1443 return -1;
1443 } 1444 }
1444 1445
1445 if (!x2apic_preenabled && skip_ioapic_setup) { 1446 if (!x2apic_preenabled && skip_ioapic_setup) {
1446 pr_info("Skipped enabling intr-remap because of skipping " 1447 pr_info("Skipped enabling intr-remap because of skipping "
1447 "io-apic setup\n"); 1448 "io-apic setup\n");
1448 return 0; 1449 return -1;
1449 } 1450 }
1450 1451
1451 if (enable_intr_remapping(x2apic_supported())) 1452 return enable_intr_remapping();
1452 return 0;
1453
1454 pr_info("Enabled Interrupt-remapping\n");
1455
1456 return 1;
1457
1458#endif 1453#endif
1459 return 0; 1454 return -1;
1460} 1455}
1461 1456
1462void __init enable_IR_x2apic(void) 1457void __init enable_IR_x2apic(void)
@@ -1480,11 +1475,11 @@ void __init enable_IR_x2apic(void)
1480 mask_ioapic_entries(); 1475 mask_ioapic_entries();
1481 1476
1482 if (dmar_table_init_ret) 1477 if (dmar_table_init_ret)
1483 ret = 0; 1478 ret = -1;
1484 else 1479 else
1485 ret = enable_IR(); 1480 ret = enable_IR();
1486 1481
1487 if (!ret) { 1482 if (ret < 0) {
1488 /* IR is required if there is APIC ID > 255 even when running 1483 /* IR is required if there is APIC ID > 255 even when running
1489 * under KVM 1484 * under KVM
1490 */ 1485 */
@@ -1498,6 +1493,9 @@ void __init enable_IR_x2apic(void)
1498 x2apic_force_phys(); 1493 x2apic_force_phys();
1499 } 1494 }
1500 1495
1496 if (ret == IRQ_REMAP_XAPIC_MODE)
1497 goto nox2apic;
1498
1501 x2apic_enabled = 1; 1499 x2apic_enabled = 1;
1502 1500
1503 if (x2apic_supported() && !x2apic_mode) { 1501 if (x2apic_supported() && !x2apic_mode) {
@@ -1507,19 +1505,21 @@ void __init enable_IR_x2apic(void)
1507 } 1505 }
1508 1506
1509nox2apic: 1507nox2apic:
1510 if (!ret) /* IR enabling failed */ 1508 if (ret < 0) /* IR enabling failed */
1511 restore_ioapic_entries(); 1509 restore_ioapic_entries();
1512 legacy_pic->restore_mask(); 1510 legacy_pic->restore_mask();
1513 local_irq_restore(flags); 1511 local_irq_restore(flags);
1514 1512
1515out: 1513out:
1516 if (x2apic_enabled) 1514 if (x2apic_enabled || !x2apic_supported())
1517 return; 1515 return;
1518 1516
1519 if (x2apic_preenabled) 1517 if (x2apic_preenabled)
1520 panic("x2apic: enabled by BIOS but kernel init failed."); 1518 panic("x2apic: enabled by BIOS but kernel init failed.");
1521 else if (cpu_has_x2apic) 1519 else if (ret == IRQ_REMAP_XAPIC_MODE)
1522 pr_info("Not enabling x2apic, Intr-remapping init failed.\n"); 1520 pr_info("x2apic not enabled, IRQ remapping is in xapic mode\n");
1521 else if (ret < 0)
1522 pr_info("x2apic not enabled, IRQ remapping init failed\n");
1523} 1523}
1524 1524
1525#ifdef CONFIG_X86_64 1525#ifdef CONFIG_X86_64
@@ -1943,10 +1943,28 @@ void disconnect_bsp_APIC(int virt_wire_setup)
1943 1943
1944void __cpuinit generic_processor_info(int apicid, int version) 1944void __cpuinit generic_processor_info(int apicid, int version)
1945{ 1945{
1946 int cpu; 1946 int cpu, max = nr_cpu_ids;
1947 bool boot_cpu_detected = physid_isset(boot_cpu_physical_apicid,
1948 phys_cpu_present_map);
1949
1950 /*
1951 * If boot cpu has not been detected yet, then only allow upto
1952 * nr_cpu_ids - 1 processors and keep one slot free for boot cpu
1953 */
1954 if (!boot_cpu_detected && num_processors >= nr_cpu_ids - 1 &&
1955 apicid != boot_cpu_physical_apicid) {
1956 int thiscpu = max + disabled_cpus - 1;
1957
1958 pr_warning(
1959 "ACPI: NR_CPUS/possible_cpus limit of %i almost"
1960 " reached. Keeping one slot for boot cpu."
1961 " Processor %d/0x%x ignored.\n", max, thiscpu, apicid);
1962
1963 disabled_cpus++;
1964 return;
1965 }
1947 1966
1948 if (num_processors >= nr_cpu_ids) { 1967 if (num_processors >= nr_cpu_ids) {
1949 int max = nr_cpu_ids;
1950 int thiscpu = max + disabled_cpus; 1968 int thiscpu = max + disabled_cpus;
1951 1969
1952 pr_warning( 1970 pr_warning(
diff --git a/arch/x86/kernel/apic/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c
index efd737e827f..521bead0113 100644
--- a/arch/x86/kernel/apic/bigsmp_32.c
+++ b/arch/x86/kernel/apic/bigsmp_32.c
@@ -255,12 +255,24 @@ static struct apic apic_bigsmp = {
255 .x86_32_early_logical_apicid = bigsmp_early_logical_apicid, 255 .x86_32_early_logical_apicid = bigsmp_early_logical_apicid,
256}; 256};
257 257
258struct apic * __init generic_bigsmp_probe(void) 258void __init generic_bigsmp_probe(void)
259{ 259{
260 if (probe_bigsmp()) 260 unsigned int cpu;
261 return &apic_bigsmp;
262 261
263 return NULL; 262 if (!probe_bigsmp())
263 return;
264
265 apic = &apic_bigsmp;
266
267 for_each_possible_cpu(cpu) {
268 if (early_per_cpu(x86_cpu_to_logical_apicid,
269 cpu) == BAD_APICID)
270 continue;
271 early_per_cpu(x86_cpu_to_logical_apicid, cpu) =
272 bigsmp_early_logical_apicid(cpu);
273 }
274
275 pr_info("Overriding APIC driver with %s\n", apic_bigsmp.name);
264} 276}
265 277
266apic_driver(apic_bigsmp); 278apic_driver(apic_bigsmp);
diff --git a/arch/x86/kernel/apic/es7000_32.c b/arch/x86/kernel/apic/es7000_32.c
index 9536b3fe43f..5d513bc47b6 100644
--- a/arch/x86/kernel/apic/es7000_32.c
+++ b/arch/x86/kernel/apic/es7000_32.c
@@ -48,7 +48,7 @@
48#include <linux/io.h> 48#include <linux/io.h>
49 49
50#include <asm/apicdef.h> 50#include <asm/apicdef.h>
51#include <asm/atomic.h> 51#include <linux/atomic.h>
52#include <asm/fixmap.h> 52#include <asm/fixmap.h>
53#include <asm/mpspec.h> 53#include <asm/mpspec.h>
54#include <asm/setup.h> 54#include <asm/setup.h>
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index e5293394b54..620da6fed6b 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1202,7 +1202,6 @@ void __setup_vector_irq(int cpu)
1202} 1202}
1203 1203
1204static struct irq_chip ioapic_chip; 1204static struct irq_chip ioapic_chip;
1205static struct irq_chip ir_ioapic_chip;
1206 1205
1207#ifdef CONFIG_X86_32 1206#ifdef CONFIG_X86_32
1208static inline int IO_APIC_irq_trigger(int irq) 1207static inline int IO_APIC_irq_trigger(int irq)
@@ -1246,7 +1245,7 @@ static void ioapic_register_intr(unsigned int irq, struct irq_cfg *cfg,
1246 1245
1247 if (irq_remapped(cfg)) { 1246 if (irq_remapped(cfg)) {
1248 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); 1247 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
1249 chip = &ir_ioapic_chip; 1248 irq_remap_modify_chip_defaults(chip);
1250 fasteoi = trigger != 0; 1249 fasteoi = trigger != 0;
1251 } 1250 }
1252 1251
@@ -1295,6 +1294,16 @@ static int setup_ioapic_entry(int apic_id, int irq,
1295 * irq handler will do the explicit EOI to the io-apic. 1294 * irq handler will do the explicit EOI to the io-apic.
1296 */ 1295 */
1297 ir_entry->vector = pin; 1296 ir_entry->vector = pin;
1297
1298 apic_printk(APIC_VERBOSE, KERN_DEBUG "IOAPIC[%d]: "
1299 "Set IRTE entry (P:%d FPD:%d Dst_Mode:%d "
1300 "Redir_hint:%d Trig_Mode:%d Dlvry_Mode:%X "
1301 "Avail:%X Vector:%02X Dest:%08X "
1302 "SID:%04X SQ:%X SVT:%X)\n",
1303 apic_id, irte.present, irte.fpd, irte.dst_mode,
1304 irte.redir_hint, irte.trigger_mode, irte.dlvry_mode,
1305 irte.avail, irte.vector, irte.dest_id,
1306 irte.sid, irte.sq, irte.svt);
1298 } else { 1307 } else {
1299 entry->delivery_mode = apic->irq_delivery_mode; 1308 entry->delivery_mode = apic->irq_delivery_mode;
1300 entry->dest_mode = apic->irq_dest_mode; 1309 entry->dest_mode = apic->irq_dest_mode;
@@ -1337,9 +1346,9 @@ static void setup_ioapic_irq(int apic_id, int pin, unsigned int irq,
1337 1346
1338 apic_printk(APIC_VERBOSE,KERN_DEBUG 1347 apic_printk(APIC_VERBOSE,KERN_DEBUG
1339 "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> " 1348 "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> "
1340 "IRQ %d Mode:%i Active:%i)\n", 1349 "IRQ %d Mode:%i Active:%i Dest:%d)\n",
1341 apic_id, mpc_ioapic_id(apic_id), pin, cfg->vector, 1350 apic_id, mpc_ioapic_id(apic_id), pin, cfg->vector,
1342 irq, trigger, polarity); 1351 irq, trigger, polarity, dest);
1343 1352
1344 1353
1345 if (setup_ioapic_entry(mpc_ioapic_id(apic_id), irq, &entry, 1354 if (setup_ioapic_entry(mpc_ioapic_id(apic_id), irq, &entry,
@@ -1522,10 +1531,12 @@ __apicdebuginit(void) print_IO_APIC(void)
1522 printk(KERN_DEBUG "....... : LTS : %X\n", reg_00.bits.LTS); 1531 printk(KERN_DEBUG "....... : LTS : %X\n", reg_00.bits.LTS);
1523 1532
1524 printk(KERN_DEBUG ".... register #01: %08X\n", *(int *)&reg_01); 1533 printk(KERN_DEBUG ".... register #01: %08X\n", *(int *)&reg_01);
1525 printk(KERN_DEBUG "....... : max redirection entries: %04X\n", reg_01.bits.entries); 1534 printk(KERN_DEBUG "....... : max redirection entries: %02X\n",
1535 reg_01.bits.entries);
1526 1536
1527 printk(KERN_DEBUG "....... : PRQ implemented: %X\n", reg_01.bits.PRQ); 1537 printk(KERN_DEBUG "....... : PRQ implemented: %X\n", reg_01.bits.PRQ);
1528 printk(KERN_DEBUG "....... : IO APIC version: %04X\n", reg_01.bits.version); 1538 printk(KERN_DEBUG "....... : IO APIC version: %02X\n",
1539 reg_01.bits.version);
1529 1540
1530 /* 1541 /*
1531 * Some Intel chipsets with IO APIC VERSION of 0x1? don't have reg_02, 1542 * Some Intel chipsets with IO APIC VERSION of 0x1? don't have reg_02,
@@ -1550,31 +1561,60 @@ __apicdebuginit(void) print_IO_APIC(void)
1550 1561
1551 printk(KERN_DEBUG ".... IRQ redirection table:\n"); 1562 printk(KERN_DEBUG ".... IRQ redirection table:\n");
1552 1563
1553 printk(KERN_DEBUG " NR Dst Mask Trig IRR Pol" 1564 if (intr_remapping_enabled) {
1554 " Stat Dmod Deli Vect:\n"); 1565 printk(KERN_DEBUG " NR Indx Fmt Mask Trig IRR"
1566 " Pol Stat Indx2 Zero Vect:\n");
1567 } else {
1568 printk(KERN_DEBUG " NR Dst Mask Trig IRR Pol"
1569 " Stat Dmod Deli Vect:\n");
1570 }
1555 1571
1556 for (i = 0; i <= reg_01.bits.entries; i++) { 1572 for (i = 0; i <= reg_01.bits.entries; i++) {
1557 struct IO_APIC_route_entry entry; 1573 if (intr_remapping_enabled) {
1558 1574 struct IO_APIC_route_entry entry;
1559 entry = ioapic_read_entry(apic, i); 1575 struct IR_IO_APIC_route_entry *ir_entry;
1560 1576
1561 printk(KERN_DEBUG " %02x %03X ", 1577 entry = ioapic_read_entry(apic, i);
1562 i, 1578 ir_entry = (struct IR_IO_APIC_route_entry *) &entry;
1563 entry.dest 1579 printk(KERN_DEBUG " %02x %04X ",
1564 ); 1580 i,
1581 ir_entry->index
1582 );
1583 printk("%1d %1d %1d %1d %1d "
1584 "%1d %1d %X %02X\n",
1585 ir_entry->format,
1586 ir_entry->mask,
1587 ir_entry->trigger,
1588 ir_entry->irr,
1589 ir_entry->polarity,
1590 ir_entry->delivery_status,
1591 ir_entry->index2,
1592 ir_entry->zero,
1593 ir_entry->vector
1594 );
1595 } else {
1596 struct IO_APIC_route_entry entry;
1565 1597
1566 printk("%1d %1d %1d %1d %1d %1d %1d %02X\n", 1598 entry = ioapic_read_entry(apic, i);
1567 entry.mask, 1599 printk(KERN_DEBUG " %02x %02X ",
1568 entry.trigger, 1600 i,
1569 entry.irr, 1601 entry.dest
1570 entry.polarity, 1602 );
1571 entry.delivery_status, 1603 printk("%1d %1d %1d %1d %1d "
1572 entry.dest_mode, 1604 "%1d %1d %02X\n",
1573 entry.delivery_mode, 1605 entry.mask,
1574 entry.vector 1606 entry.trigger,
1575 ); 1607 entry.irr,
1608 entry.polarity,
1609 entry.delivery_status,
1610 entry.dest_mode,
1611 entry.delivery_mode,
1612 entry.vector
1613 );
1614 }
1576 } 1615 }
1577 } 1616 }
1617
1578 printk(KERN_DEBUG "IRQ to pin mappings:\n"); 1618 printk(KERN_DEBUG "IRQ to pin mappings:\n");
1579 for_each_active_irq(irq) { 1619 for_each_active_irq(irq) {
1580 struct irq_pin_list *entry; 1620 struct irq_pin_list *entry;
@@ -1792,7 +1832,7 @@ __apicdebuginit(int) print_ICs(void)
1792 return 0; 1832 return 0;
1793} 1833}
1794 1834
1795fs_initcall(print_ICs); 1835late_initcall(print_ICs);
1796 1836
1797 1837
1798/* Where if anywhere is the i8259 connect in external int mode */ 1838/* Where if anywhere is the i8259 connect in external int mode */
@@ -2214,7 +2254,7 @@ ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
2214 return ret; 2254 return ret;
2215} 2255}
2216 2256
2217#ifdef CONFIG_INTR_REMAP 2257#ifdef CONFIG_IRQ_REMAP
2218 2258
2219/* 2259/*
2220 * Migrate the IO-APIC irq in the presence of intr-remapping. 2260 * Migrate the IO-APIC irq in the presence of intr-remapping.
@@ -2226,6 +2266,9 @@ ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
2226 * updated vector information), by using a virtual vector (io-apic pin number). 2266 * updated vector information), by using a virtual vector (io-apic pin number).
2227 * Real vector that is used for interrupting cpu will be coming from 2267 * Real vector that is used for interrupting cpu will be coming from
2228 * the interrupt-remapping table entry. 2268 * the interrupt-remapping table entry.
2269 *
2270 * As the migration is a simple atomic update of IRTE, the same mechanism
2271 * is used to migrate MSI irq's in the presence of interrupt-remapping.
2229 */ 2272 */
2230static int 2273static int
2231ir_ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask, 2274ir_ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
@@ -2250,10 +2293,16 @@ ir_ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
2250 irte.dest_id = IRTE_DEST(dest); 2293 irte.dest_id = IRTE_DEST(dest);
2251 2294
2252 /* 2295 /*
2253 * Modified the IRTE and flushes the Interrupt entry cache. 2296 * Atomically updates the IRTE with the new destination, vector
2297 * and flushes the interrupt entry cache.
2254 */ 2298 */
2255 modify_irte(irq, &irte); 2299 modify_irte(irq, &irte);
2256 2300
2301 /*
2302 * After this point, all the interrupts will start arriving
2303 * at the new destination. So, time to cleanup the previous
2304 * vector allocation.
2305 */
2257 if (cfg->move_in_progress) 2306 if (cfg->move_in_progress)
2258 send_cleanup_vector(cfg); 2307 send_cleanup_vector(cfg);
2259 2308
@@ -2511,7 +2560,7 @@ static void ack_apic_level(struct irq_data *data)
2511 } 2560 }
2512} 2561}
2513 2562
2514#ifdef CONFIG_INTR_REMAP 2563#ifdef CONFIG_IRQ_REMAP
2515static void ir_ack_apic_edge(struct irq_data *data) 2564static void ir_ack_apic_edge(struct irq_data *data)
2516{ 2565{
2517 ack_APIC_irq(); 2566 ack_APIC_irq();
@@ -2522,7 +2571,23 @@ static void ir_ack_apic_level(struct irq_data *data)
2522 ack_APIC_irq(); 2571 ack_APIC_irq();
2523 eoi_ioapic_irq(data->irq, data->chip_data); 2572 eoi_ioapic_irq(data->irq, data->chip_data);
2524} 2573}
2525#endif /* CONFIG_INTR_REMAP */ 2574
2575static void ir_print_prefix(struct irq_data *data, struct seq_file *p)
2576{
2577 seq_printf(p, " IR-%s", data->chip->name);
2578}
2579
2580static void irq_remap_modify_chip_defaults(struct irq_chip *chip)
2581{
2582 chip->irq_print_chip = ir_print_prefix;
2583 chip->irq_ack = ir_ack_apic_edge;
2584 chip->irq_eoi = ir_ack_apic_level;
2585
2586#ifdef CONFIG_SMP
2587 chip->irq_set_affinity = ir_ioapic_set_affinity;
2588#endif
2589}
2590#endif /* CONFIG_IRQ_REMAP */
2526 2591
2527static struct irq_chip ioapic_chip __read_mostly = { 2592static struct irq_chip ioapic_chip __read_mostly = {
2528 .name = "IO-APIC", 2593 .name = "IO-APIC",
@@ -2537,21 +2602,6 @@ static struct irq_chip ioapic_chip __read_mostly = {
2537 .irq_retrigger = ioapic_retrigger_irq, 2602 .irq_retrigger = ioapic_retrigger_irq,
2538}; 2603};
2539 2604
2540static struct irq_chip ir_ioapic_chip __read_mostly = {
2541 .name = "IR-IO-APIC",
2542 .irq_startup = startup_ioapic_irq,
2543 .irq_mask = mask_ioapic_irq,
2544 .irq_unmask = unmask_ioapic_irq,
2545#ifdef CONFIG_INTR_REMAP
2546 .irq_ack = ir_ack_apic_edge,
2547 .irq_eoi = ir_ack_apic_level,
2548#ifdef CONFIG_SMP
2549 .irq_set_affinity = ir_ioapic_set_affinity,
2550#endif
2551#endif
2552 .irq_retrigger = ioapic_retrigger_irq,
2553};
2554
2555static inline void init_IO_APIC_traps(void) 2605static inline void init_IO_APIC_traps(void)
2556{ 2606{
2557 struct irq_cfg *cfg; 2607 struct irq_cfg *cfg;
@@ -3103,45 +3153,6 @@ msi_set_affinity(struct irq_data *data, const struct cpumask *mask, bool force)
3103 3153
3104 return 0; 3154 return 0;
3105} 3155}
3106#ifdef CONFIG_INTR_REMAP
3107/*
3108 * Migrate the MSI irq to another cpumask. This migration is
3109 * done in the process context using interrupt-remapping hardware.
3110 */
3111static int
3112ir_msi_set_affinity(struct irq_data *data, const struct cpumask *mask,
3113 bool force)
3114{
3115 struct irq_cfg *cfg = data->chip_data;
3116 unsigned int dest, irq = data->irq;
3117 struct irte irte;
3118
3119 if (get_irte(irq, &irte))
3120 return -1;
3121
3122 if (__ioapic_set_affinity(data, mask, &dest))
3123 return -1;
3124
3125 irte.vector = cfg->vector;
3126 irte.dest_id = IRTE_DEST(dest);
3127
3128 /*
3129 * atomically update the IRTE with the new destination and vector.
3130 */
3131 modify_irte(irq, &irte);
3132
3133 /*
3134 * After this point, all the interrupts will start arriving
3135 * at the new destination. So, time to cleanup the previous
3136 * vector allocation.
3137 */
3138 if (cfg->move_in_progress)
3139 send_cleanup_vector(cfg);
3140
3141 return 0;
3142}
3143
3144#endif
3145#endif /* CONFIG_SMP */ 3156#endif /* CONFIG_SMP */
3146 3157
3147/* 3158/*
@@ -3159,19 +3170,6 @@ static struct irq_chip msi_chip = {
3159 .irq_retrigger = ioapic_retrigger_irq, 3170 .irq_retrigger = ioapic_retrigger_irq,
3160}; 3171};
3161 3172
3162static struct irq_chip msi_ir_chip = {
3163 .name = "IR-PCI-MSI",
3164 .irq_unmask = unmask_msi_irq,
3165 .irq_mask = mask_msi_irq,
3166#ifdef CONFIG_INTR_REMAP
3167 .irq_ack = ir_ack_apic_edge,
3168#ifdef CONFIG_SMP
3169 .irq_set_affinity = ir_msi_set_affinity,
3170#endif
3171#endif
3172 .irq_retrigger = ioapic_retrigger_irq,
3173};
3174
3175/* 3173/*
3176 * Map the PCI dev to the corresponding remapping hardware unit 3174 * Map the PCI dev to the corresponding remapping hardware unit
3177 * and allocate 'nvec' consecutive interrupt-remapping table entries 3175 * and allocate 'nvec' consecutive interrupt-remapping table entries
@@ -3214,7 +3212,7 @@ static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int irq)
3214 3212
3215 if (irq_remapped(irq_get_chip_data(irq))) { 3213 if (irq_remapped(irq_get_chip_data(irq))) {
3216 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); 3214 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
3217 chip = &msi_ir_chip; 3215 irq_remap_modify_chip_defaults(chip);
3218 } 3216 }
3219 3217
3220 irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge"); 3218 irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge");
@@ -3287,7 +3285,7 @@ void native_teardown_msi_irq(unsigned int irq)
3287 destroy_irq(irq); 3285 destroy_irq(irq);
3288} 3286}
3289 3287
3290#if defined (CONFIG_DMAR) || defined (CONFIG_INTR_REMAP) 3288#ifdef CONFIG_DMAR_TABLE
3291#ifdef CONFIG_SMP 3289#ifdef CONFIG_SMP
3292static int 3290static int
3293dmar_msi_set_affinity(struct irq_data *data, const struct cpumask *mask, 3291dmar_msi_set_affinity(struct irq_data *data, const struct cpumask *mask,
@@ -3368,19 +3366,6 @@ static int hpet_msi_set_affinity(struct irq_data *data,
3368 3366
3369#endif /* CONFIG_SMP */ 3367#endif /* CONFIG_SMP */
3370 3368
3371static struct irq_chip ir_hpet_msi_type = {
3372 .name = "IR-HPET_MSI",
3373 .irq_unmask = hpet_msi_unmask,
3374 .irq_mask = hpet_msi_mask,
3375#ifdef CONFIG_INTR_REMAP
3376 .irq_ack = ir_ack_apic_edge,
3377#ifdef CONFIG_SMP
3378 .irq_set_affinity = ir_msi_set_affinity,
3379#endif
3380#endif
3381 .irq_retrigger = ioapic_retrigger_irq,
3382};
3383
3384static struct irq_chip hpet_msi_type = { 3369static struct irq_chip hpet_msi_type = {
3385 .name = "HPET_MSI", 3370 .name = "HPET_MSI",
3386 .irq_unmask = hpet_msi_unmask, 3371 .irq_unmask = hpet_msi_unmask,
@@ -3417,7 +3402,7 @@ int arch_setup_hpet_msi(unsigned int irq, unsigned int id)
3417 hpet_msi_write(irq_get_handler_data(irq), &msg); 3402 hpet_msi_write(irq_get_handler_data(irq), &msg);
3418 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); 3403 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
3419 if (irq_remapped(irq_get_chip_data(irq))) 3404 if (irq_remapped(irq_get_chip_data(irq)))
3420 chip = &ir_hpet_msi_type; 3405 irq_remap_modify_chip_defaults(chip);
3421 3406
3422 irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge"); 3407 irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge");
3423 return 0; 3408 return 0;
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c
index b5254ad044a..0787bb3412f 100644
--- a/arch/x86/kernel/apic/probe_32.c
+++ b/arch/x86/kernel/apic/probe_32.c
@@ -200,14 +200,8 @@ void __init default_setup_apic_routing(void)
200 * - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support 200 * - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support
201 */ 201 */
202 202
203 if (!cmdline_apic && apic == &apic_default) { 203 if (!cmdline_apic && apic == &apic_default)
204 struct apic *bigsmp = generic_bigsmp_probe(); 204 generic_bigsmp_probe();
205 if (bigsmp) {
206 apic = bigsmp;
207 printk(KERN_INFO "Overriding APIC driver with %s\n",
208 apic->name);
209 }
210 }
211#endif 205#endif
212 206
213 if (apic->setup_apic_routing) 207 if (apic->setup_apic_routing)
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index adc66c3a1fe..cfeb978f49f 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -207,7 +207,6 @@ static int __cpuinit uv_wakeup_secondary(int phys_apicid, unsigned long start_ri
207 ((start_rip << UVH_IPI_INT_VECTOR_SHFT) >> 12) | 207 ((start_rip << UVH_IPI_INT_VECTOR_SHFT) >> 12) |
208 APIC_DM_INIT; 208 APIC_DM_INIT;
209 uv_write_global_mmr64(pnode, UVH_IPI_INT, val); 209 uv_write_global_mmr64(pnode, UVH_IPI_INT, val);
210 mdelay(10);
211 210
212 val = (1UL << UVH_IPI_INT_SEND_SHFT) | 211 val = (1UL << UVH_IPI_INT_SEND_SHFT) |
213 (phys_apicid << UVH_IPI_INT_APIC_ID_SHFT) | 212 (phys_apicid << UVH_IPI_INT_APIC_ID_SHFT) |
@@ -833,6 +832,10 @@ void __init uv_system_init(void)
833 uv_cpu_hub_info(cpu)->apic_pnode_shift = uvh_apicid.s.pnode_shift; 832 uv_cpu_hub_info(cpu)->apic_pnode_shift = uvh_apicid.s.pnode_shift;
834 uv_cpu_hub_info(cpu)->hub_revision = uv_hub_info->hub_revision; 833 uv_cpu_hub_info(cpu)->hub_revision = uv_hub_info->hub_revision;
835 834
835 uv_cpu_hub_info(cpu)->m_shift = 64 - m_val;
836 uv_cpu_hub_info(cpu)->n_lshift = is_uv2_1_hub() ?
837 (m_val == 40 ? 40 : 39) : m_val;
838
836 pnode = uv_apicid_to_pnode(apicid); 839 pnode = uv_apicid_to_pnode(apicid);
837 blade = boot_pnode_to_blade(pnode); 840 blade = boot_pnode_to_blade(pnode);
838 lcpu = uv_blade_info[blade].nr_possible_cpus; 841 lcpu = uv_blade_info[blade].nr_possible_cpus;
@@ -863,8 +866,7 @@ void __init uv_system_init(void)
863 if (uv_node_to_blade[nid] >= 0) 866 if (uv_node_to_blade[nid] >= 0)
864 continue; 867 continue;
865 paddr = node_start_pfn(nid) << PAGE_SHIFT; 868 paddr = node_start_pfn(nid) << PAGE_SHIFT;
866 paddr = uv_soc_phys_ram_to_gpa(paddr); 869 pnode = uv_gpa_to_pnode(uv_soc_phys_ram_to_gpa(paddr));
867 pnode = (paddr >> m_val) & pnode_mask;
868 blade = boot_pnode_to_blade(pnode); 870 blade = boot_pnode_to_blade(pnode);
869 uv_node_to_blade[nid] = blade; 871 uv_node_to_blade[nid] = blade;
870 } 872 }