Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86, io_apic: Introduce x86_io_apic_ops.print_entries for debugging

This call-back is used to dump IO-APIC entries for debugging
purposes into the kernel log. VT-d needs a special routine
for this and will overwrite the default.

Signed-off-by: Joerg Roedel <joro@8bytes.org>
Acked-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

+69 -53
+3
arch/x86/include/asm/io_apic.h
··· 180 180 extern void native_io_apic_write(unsigned int apic, unsigned int reg, unsigned int val); 181 181 extern void native_io_apic_modify(unsigned int apic, unsigned int reg, unsigned int val); 182 182 extern void native_disable_io_apic(void); 183 + extern void native_io_apic_print_entries(unsigned int apic, unsigned int nr_entries); 184 + extern void intel_ir_io_apic_print_entries(unsigned int apic, unsigned int nr_entries); 183 185 184 186 static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg) 185 187 { ··· 227 225 #define native_io_apic_write NULL 228 226 #define native_io_apic_modify NULL 229 227 #define native_disable_io_apic NULL 228 + #define native_io_apic_print_entries NULL 230 229 #endif 231 230 232 231 #endif /* _ASM_X86_IO_APIC_H */
+1
arch/x86/include/asm/x86_init.h
··· 195 195 void (*write) (unsigned int apic, unsigned int reg, unsigned int value); 196 196 void (*modify) (unsigned int apic, unsigned int reg, unsigned int value); 197 197 void (*disable)(void); 198 + void (*print_entries)(unsigned int apic, unsigned int nr_entries); 198 199 }; 199 200 200 201 extern struct x86_init_ops x86_init;
+56 -53
arch/x86/kernel/apic/io_apic.c
··· 1513 1513 ioapic_write_entry(ioapic_idx, pin, entry); 1514 1514 } 1515 1515 1516 - __apicdebuginit(void) print_IO_APIC(int ioapic_idx) 1516 + void native_io_apic_print_entries(unsigned int apic, unsigned int nr_entries) 1517 1517 { 1518 1518 int i; 1519 + 1520 + pr_debug(" NR Dst Mask Trig IRR Pol Stat Dmod Deli Vect:\n"); 1521 + 1522 + for (i = 0; i <= nr_entries; i++) { 1523 + struct IO_APIC_route_entry entry; 1524 + 1525 + entry = ioapic_read_entry(apic, i); 1526 + 1527 + pr_debug(" %02x %02X ", i, entry.dest); 1528 + pr_cont("%1d %1d %1d %1d %1d " 1529 + "%1d %1d %02X\n", 1530 + entry.mask, 1531 + entry.trigger, 1532 + entry.irr, 1533 + entry.polarity, 1534 + entry.delivery_status, 1535 + entry.dest_mode, 1536 + entry.delivery_mode, 1537 + entry.vector); 1538 + } 1539 + } 1540 + 1541 + void intel_ir_io_apic_print_entries(unsigned int apic, 1542 + unsigned int nr_entries) 1543 + { 1544 + int i; 1545 + 1546 + pr_debug(" NR Indx Fmt Mask Trig IRR Pol Stat Indx2 Zero Vect:\n"); 1547 + 1548 + for (i = 0; i <= nr_entries; i++) { 1549 + struct IR_IO_APIC_route_entry *ir_entry; 1550 + struct IO_APIC_route_entry entry; 1551 + 1552 + entry = ioapic_read_entry(apic, i); 1553 + 1554 + ir_entry = (struct IR_IO_APIC_route_entry *)&entry; 1555 + 1556 + pr_debug(" %02x %04X ", i, ir_entry->index); 1557 + pr_cont("%1d %1d %1d %1d %1d " 1558 + "%1d %1d %X %02X\n", 1559 + ir_entry->format, 1560 + ir_entry->mask, 1561 + ir_entry->trigger, 1562 + ir_entry->irr, 1563 + ir_entry->polarity, 1564 + ir_entry->delivery_status, 1565 + ir_entry->index2, 1566 + ir_entry->zero, 1567 + ir_entry->vector); 1568 + } 1569 + } 1570 + 1571 + __apicdebuginit(void) print_IO_APIC(int ioapic_idx) 1572 + { 1519 1573 union IO_APIC_reg_00 reg_00; 1520 1574 union IO_APIC_reg_01 reg_01; 1521 1575 union IO_APIC_reg_02 reg_02; ··· 1622 1568 1623 1569 printk(KERN_DEBUG ".... IRQ redirection table:\n"); 1624 1570 1625 - if (irq_remapping_enabled) { 1626 - printk(KERN_DEBUG " NR Indx Fmt Mask Trig IRR" 1627 - " Pol Stat Indx2 Zero Vect:\n"); 1628 - } else { 1629 - printk(KERN_DEBUG " NR Dst Mask Trig IRR Pol" 1630 - " Stat Dmod Deli Vect:\n"); 1631 - } 1632 - 1633 - for (i = 0; i <= reg_01.bits.entries; i++) { 1634 - if (irq_remapping_enabled) { 1635 - struct IO_APIC_route_entry entry; 1636 - struct IR_IO_APIC_route_entry *ir_entry; 1637 - 1638 - entry = ioapic_read_entry(ioapic_idx, i); 1639 - ir_entry = (struct IR_IO_APIC_route_entry *) &entry; 1640 - printk(KERN_DEBUG " %02x %04X ", 1641 - i, 1642 - ir_entry->index 1643 - ); 1644 - pr_cont("%1d %1d %1d %1d %1d " 1645 - "%1d %1d %X %02X\n", 1646 - ir_entry->format, 1647 - ir_entry->mask, 1648 - ir_entry->trigger, 1649 - ir_entry->irr, 1650 - ir_entry->polarity, 1651 - ir_entry->delivery_status, 1652 - ir_entry->index2, 1653 - ir_entry->zero, 1654 - ir_entry->vector 1655 - ); 1656 - } else { 1657 - struct IO_APIC_route_entry entry; 1658 - 1659 - entry = ioapic_read_entry(ioapic_idx, i); 1660 - printk(KERN_DEBUG " %02x %02X ", 1661 - i, 1662 - entry.dest 1663 - ); 1664 - pr_cont("%1d %1d %1d %1d %1d " 1665 - "%1d %1d %02X\n", 1666 - entry.mask, 1667 - entry.trigger, 1668 - entry.irr, 1669 - entry.polarity, 1670 - entry.delivery_status, 1671 - entry.dest_mode, 1672 - entry.delivery_mode, 1673 - entry.vector 1674 - ); 1675 - } 1676 - } 1571 + x86_io_apic_ops.print_entries(ioapic_idx, reg_01.bits.entries); 1677 1572 } 1678 1573 1679 1574 __apicdebuginit(void) print_IO_APICs(void)
+1
arch/x86/kernel/x86_init.c
··· 123 123 .write = native_io_apic_write, 124 124 .modify = native_io_apic_modify, 125 125 .disable = native_disable_io_apic, 126 + .print_entries = native_io_apic_print_entries, 126 127 };
+8
drivers/iommu/intel_irq_remapping.c
··· 617 617 goto error; 618 618 619 619 irq_remapping_enabled = 1; 620 + 621 + /* 622 + * VT-d has a different layout for IO-APIC entries when 623 + * interrupt remapping is enabled. So it needs a special routine 624 + * to print IO-APIC entries for debugging purposes too. 625 + */ 626 + x86_io_apic_ops.print_entries = intel_ir_io_apic_print_entries; 627 + 620 628 pr_info("Enabled IRQ remapping in %s mode\n", eim ? "x2apic" : "xapic"); 621 629 622 630 return eim ? IRQ_REMAP_X2APIC_MODE : IRQ_REMAP_XAPIC_MODE;