diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2011-08-23 20:05:24 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-09-21 04:22:01 -0400 |
commit | c39d77ffa28c6e72702193df4fa53928c1b6f3e6 (patch) | |
tree | 48ba2661d03d3595a08e8ee497ff5e24969b42a3 /arch | |
parent | 13ea20f7a29aec1ed776de05f86bd892dc9ac395 (diff) |
x86, ioapic: Define irq_remap_modify_chip_defaults()
Define irq_remap_modify_chip_defaults() and remove the duplicate
code, cleanup the unnecessary ifdefs.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: yinghai@kernel.org
Cc: youquan.song@intel.com
Cc: joerg.roedel@amd.com
Cc: tony.luck@intel.com
Cc: dwmw2@infradead.org
Link: http://lkml.kernel.org/r/20110824001456.499225692@sbsiddha-desk.sc.intel.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/include/asm/irq_remapping.h | 4 | ||||
-rw-r--r-- | arch/x86/kernel/apic/io_apic.c | 64 |
2 files changed, 23 insertions, 45 deletions
diff --git a/arch/x86/include/asm/irq_remapping.h b/arch/x86/include/asm/irq_remapping.h index 1c23360fb2d8..7000f0f8bf12 100644 --- a/arch/x86/include/asm/irq_remapping.h +++ b/arch/x86/include/asm/irq_remapping.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #define IRTE_DEST(dest) ((x2apic_mode) ? dest : dest << 8) | 4 | #define IRTE_DEST(dest) ((x2apic_mode) ? dest : dest << 8) |
5 | 5 | ||
6 | #ifdef CONFIG_INTR_REMAP | 6 | #ifdef CONFIG_INTR_REMAP |
7 | static void irq_remap_modify_chip_defaults(struct irq_chip *chip); | ||
7 | static inline void prepare_irte(struct irte *irte, int vector, | 8 | static inline void prepare_irte(struct irte *irte, int vector, |
8 | unsigned int dest) | 9 | unsigned int dest) |
9 | { | 10 | { |
@@ -36,6 +37,9 @@ static inline bool irq_remapped(struct irq_cfg *cfg) | |||
36 | { | 37 | { |
37 | return false; | 38 | return false; |
38 | } | 39 | } |
40 | static inline void irq_remap_modify_chip_defaults(struct irq_chip *chip) | ||
41 | { | ||
42 | } | ||
39 | #endif | 43 | #endif |
40 | 44 | ||
41 | #endif /* _ASM_X86_IRQ_REMAPPING_H */ | 45 | #endif /* _ASM_X86_IRQ_REMAPPING_H */ |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index f88af6b037c2..e75d7e2223fe 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 | ||
1204 | static struct irq_chip ioapic_chip; | 1204 | static struct irq_chip ioapic_chip; |
1205 | static struct irq_chip ir_ioapic_chip; | ||
1206 | 1205 | ||
1207 | #ifdef CONFIG_X86_32 | 1206 | #ifdef CONFIG_X86_32 |
1208 | static inline int IO_APIC_irq_trigger(int irq) | 1207 | static 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 | ||
@@ -2572,6 +2571,22 @@ static void ir_ack_apic_level(struct irq_data *data) | |||
2572 | ack_APIC_irq(); | 2571 | ack_APIC_irq(); |
2573 | eoi_ioapic_irq(data->irq, data->chip_data); | 2572 | eoi_ioapic_irq(data->irq, data->chip_data); |
2574 | } | 2573 | } |
2574 | |||
2575 | static void ir_print_prefix(struct irq_data *data, struct seq_file *p) | ||
2576 | { | ||
2577 | seq_printf(p, " IR-%s", data->chip->name); | ||
2578 | } | ||
2579 | |||
2580 | static 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 | } | ||
2575 | #endif /* CONFIG_INTR_REMAP */ | 2590 | #endif /* CONFIG_INTR_REMAP */ |
2576 | 2591 | ||
2577 | static struct irq_chip ioapic_chip __read_mostly = { | 2592 | static struct irq_chip ioapic_chip __read_mostly = { |
@@ -2587,21 +2602,6 @@ static struct irq_chip ioapic_chip __read_mostly = { | |||
2587 | .irq_retrigger = ioapic_retrigger_irq, | 2602 | .irq_retrigger = ioapic_retrigger_irq, |
2588 | }; | 2603 | }; |
2589 | 2604 | ||
2590 | static struct irq_chip ir_ioapic_chip __read_mostly = { | ||
2591 | .name = "IR-IO-APIC", | ||
2592 | .irq_startup = startup_ioapic_irq, | ||
2593 | .irq_mask = mask_ioapic_irq, | ||
2594 | .irq_unmask = unmask_ioapic_irq, | ||
2595 | #ifdef CONFIG_INTR_REMAP | ||
2596 | .irq_ack = ir_ack_apic_edge, | ||
2597 | .irq_eoi = ir_ack_apic_level, | ||
2598 | #ifdef CONFIG_SMP | ||
2599 | .irq_set_affinity = ir_ioapic_set_affinity, | ||
2600 | #endif | ||
2601 | #endif | ||
2602 | .irq_retrigger = ioapic_retrigger_irq, | ||
2603 | }; | ||
2604 | |||
2605 | static inline void init_IO_APIC_traps(void) | 2605 | static inline void init_IO_APIC_traps(void) |
2606 | { | 2606 | { |
2607 | struct irq_cfg *cfg; | 2607 | struct irq_cfg *cfg; |
@@ -3170,19 +3170,6 @@ static struct irq_chip msi_chip = { | |||
3170 | .irq_retrigger = ioapic_retrigger_irq, | 3170 | .irq_retrigger = ioapic_retrigger_irq, |
3171 | }; | 3171 | }; |
3172 | 3172 | ||
3173 | static struct irq_chip msi_ir_chip = { | ||
3174 | .name = "IR-PCI-MSI", | ||
3175 | .irq_unmask = unmask_msi_irq, | ||
3176 | .irq_mask = mask_msi_irq, | ||
3177 | #ifdef CONFIG_INTR_REMAP | ||
3178 | .irq_ack = ir_ack_apic_edge, | ||
3179 | #ifdef CONFIG_SMP | ||
3180 | .irq_set_affinity = ir_ioapic_set_affinity, | ||
3181 | #endif | ||
3182 | #endif | ||
3183 | .irq_retrigger = ioapic_retrigger_irq, | ||
3184 | }; | ||
3185 | |||
3186 | /* | 3173 | /* |
3187 | * Map the PCI dev to the corresponding remapping hardware unit | 3174 | * Map the PCI dev to the corresponding remapping hardware unit |
3188 | * and allocate 'nvec' consecutive interrupt-remapping table entries | 3175 | * and allocate 'nvec' consecutive interrupt-remapping table entries |
@@ -3225,7 +3212,7 @@ static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int irq) | |||
3225 | 3212 | ||
3226 | if (irq_remapped(irq_get_chip_data(irq))) { | 3213 | if (irq_remapped(irq_get_chip_data(irq))) { |
3227 | irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); | 3214 | irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); |
3228 | chip = &msi_ir_chip; | 3215 | irq_remap_modify_chip_defaults(chip); |
3229 | } | 3216 | } |
3230 | 3217 | ||
3231 | 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"); |
@@ -3379,19 +3366,6 @@ static int hpet_msi_set_affinity(struct irq_data *data, | |||
3379 | 3366 | ||
3380 | #endif /* CONFIG_SMP */ | 3367 | #endif /* CONFIG_SMP */ |
3381 | 3368 | ||
3382 | static struct irq_chip ir_hpet_msi_type = { | ||
3383 | .name = "IR-HPET_MSI", | ||
3384 | .irq_unmask = hpet_msi_unmask, | ||
3385 | .irq_mask = hpet_msi_mask, | ||
3386 | #ifdef CONFIG_INTR_REMAP | ||
3387 | .irq_ack = ir_ack_apic_edge, | ||
3388 | #ifdef CONFIG_SMP | ||
3389 | .irq_set_affinity = ir_ioapic_set_affinity, | ||
3390 | #endif | ||
3391 | #endif | ||
3392 | .irq_retrigger = ioapic_retrigger_irq, | ||
3393 | }; | ||
3394 | |||
3395 | static struct irq_chip hpet_msi_type = { | 3369 | static struct irq_chip hpet_msi_type = { |
3396 | .name = "HPET_MSI", | 3370 | .name = "HPET_MSI", |
3397 | .irq_unmask = hpet_msi_unmask, | 3371 | .irq_unmask = hpet_msi_unmask, |
@@ -3428,7 +3402,7 @@ int arch_setup_hpet_msi(unsigned int irq, unsigned int id) | |||
3428 | hpet_msi_write(irq_get_handler_data(irq), &msg); | 3402 | hpet_msi_write(irq_get_handler_data(irq), &msg); |
3429 | irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); | 3403 | irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); |
3430 | if (irq_remapped(irq_get_chip_data(irq))) | 3404 | if (irq_remapped(irq_get_chip_data(irq))) |
3431 | chip = &ir_hpet_msi_type; | 3405 | irq_remap_modify_chip_defaults(chip); |
3432 | 3406 | ||
3433 | 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"); |
3434 | return 0; | 3408 | return 0; |