diff options
author | Yinghai Lu <yinghai@kernel.org> | 2012-09-17 22:22:29 -0700 |
---|---|---|
committer | Yinghai Lu <yinghai@kernel.org> | 2012-09-17 22:22:29 -0700 |
commit | 4d875e00347e0177498a95933cfcf324bfa531c8 (patch) | |
tree | 3b06e68ee57b68cdc26d2b410c551f3f38498586 | |
parent | f2c8eddb404a618470f034ff3f815eb65c3c6610 (diff) | |
download | linux-yinghai-4d875e00347e0177498a95933cfcf324bfa531c8.tar.gz |
x86, irq: Modify irq chip one time when irq remapping is enabled
So we don't need change irq chip during every irq setup.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
-rw-r--r-- | arch/x86/include/asm/io_apic.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/apic/apic.c | 9 | ||||
-rw-r--r-- | arch/x86/kernel/apic/io_apic.c | 23 |
3 files changed, 27 insertions, 7 deletions
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index 73d8c5398ea995..274d991cd9cdbc 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h @@ -193,6 +193,8 @@ static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsigned { x86_io_apic_ops.modify(apic, reg, value); } + +void irq_remap_modify_chips(void); #else /* !CONFIG_X86_IO_APIC */ #define io_apic_assign_pci_irqs 0 diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 24deb308232824..8eb311c13fc1ea 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -1520,6 +1520,8 @@ void enable_x2apic(void) int __init enable_IR(void) { #ifdef CONFIG_IRQ_REMAP + int ret; + if (!irq_remapping_supported()) { pr_debug("intr-remapping not supported\n"); return -1; @@ -1531,7 +1533,12 @@ int __init enable_IR(void) return -1; } - return irq_remapping_enable(); + ret = irq_remapping_enable(); + + if (ret >= 0) + irq_remap_modify_chips(); + + return ret; #endif return -1; } diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index c265593ec2cdc3..49da77868867cd 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c @@ -1310,7 +1310,6 @@ static void ioapic_register_intr(unsigned int irq, struct irq_cfg *cfg, if (irq_remapped(cfg)) { irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); - irq_remap_modify_chip_defaults(chip); fasteoi = trigger != 0; } @@ -2576,6 +2575,8 @@ static void ir_print_prefix(struct irq_data *data, struct seq_file *p) static void irq_remap_modify_chip_defaults(struct irq_chip *chip) { + apic_printk(APIC_DEBUG, KERN_DEBUG "irq_chip: %s ==> IR-%s", + chip->name, chip->name); chip->irq_print_chip = ir_print_prefix; chip->irq_ack = ir_ack_apic_edge; chip->irq_eoi = ir_ack_apic_level; @@ -3158,10 +3159,8 @@ static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int irq) irq_set_msi_desc(irq, msidesc); write_msi_msg(irq, &msg); - if (irq_remapped(irq_get_chip_data(irq))) { + if (irq_remapped(irq_get_chip_data(irq))) irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); - irq_remap_modify_chip_defaults(chip); - } irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge"); @@ -3324,8 +3323,6 @@ int arch_setup_hpet_msi(unsigned int irq, unsigned int id) hpet_msi_write(irq_get_handler_data(irq), &msg); irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); - if (irq_remapped(irq_get_chip_data(irq))) - irq_remap_modify_chip_defaults(chip); irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge"); return 0; @@ -3333,6 +3330,20 @@ int arch_setup_hpet_msi(unsigned int irq, unsigned int id) #endif #endif /* CONFIG_PCI_MSI */ + +void irq_remap_modify_chips(void) +{ +#ifdef CONFIG_IRQ_REMAP + irq_remap_modify_chip_defaults(&ioapic_chip); +# ifdef CONFIG_PCI_MSI + irq_remap_modify_chip_defaults(&msi_chip); +# ifdef CONFIG_HPET_TIMER + irq_remap_modify_chip_defaults(&hpet_msi_type); +# endif +# endif +#endif +} + /* * Hypertransport interrupt support */ |