H. Peter Anvin | 5e1b007 | 2008-10-23 00:20:33 -0700 | [diff] [blame] | 1 | #ifndef _ASM_X86_IRQ_REMAPPING_H |
| 2 | #define _ASM_X86_IRQ_REMAPPING_H |
Suresh Siddha | 89027d3 | 2008-07-10 11:16:56 -0700 | [diff] [blame] | 3 | |
Suresh Siddha | fc1edaf | 2009-04-20 13:02:27 -0700 | [diff] [blame] | 4 | #define IRTE_DEST(dest) ((x2apic_mode) ? dest : dest << 8) |
Suresh Siddha | 89027d3 | 2008-07-10 11:16:56 -0700 | [diff] [blame] | 5 | |
Suresh Siddha | d3f1381 | 2011-08-23 17:05:25 -0700 | [diff] [blame] | 6 | #ifdef CONFIG_IRQ_REMAP |
Suresh Siddha | c39d77f | 2011-08-23 17:05:24 -0700 | [diff] [blame] | 7 | static void irq_remap_modify_chip_defaults(struct irq_chip *chip); |
Suresh Siddha | 62a92f4 | 2010-08-27 11:09:49 -0700 | [diff] [blame] | 8 | static inline void prepare_irte(struct irte *irte, int vector, |
| 9 | unsigned int dest) |
| 10 | { |
| 11 | memset(irte, 0, sizeof(*irte)); |
| 12 | |
| 13 | irte->present = 1; |
| 14 | irte->dst_mode = apic->irq_dest_mode; |
| 15 | /* |
| 16 | * Trigger mode in the IRTE will always be edge, and for IO-APIC, the |
| 17 | * actual level or edge trigger will be setup in the IO-APIC |
| 18 | * RTE. This will help simplify level triggered irq migration. |
| 19 | * For more details, see the comments (in io_apic.c) explainig IO-APIC |
| 20 | * irq migration in the presence of interrupt-remapping. |
| 21 | */ |
| 22 | irte->trigger_mode = 0; |
| 23 | irte->dlvry_mode = apic->irq_delivery_mode; |
| 24 | irte->vector = vector; |
| 25 | irte->dest_id = IRTE_DEST(dest); |
| 26 | irte->redir_hint = 1; |
| 27 | } |
Thomas Gleixner | 1a0730d | 2010-10-11 11:55:37 +0200 | [diff] [blame] | 28 | static inline bool irq_remapped(struct irq_cfg *cfg) |
| 29 | { |
| 30 | return cfg->irq_2_iommu.iommu != NULL; |
| 31 | } |
Suresh Siddha | 62a92f4 | 2010-08-27 11:09:49 -0700 | [diff] [blame] | 32 | #else |
| 33 | static void prepare_irte(struct irte *irte, int vector, unsigned int dest) |
| 34 | { |
| 35 | } |
Thomas Gleixner | 1a0730d | 2010-10-11 11:55:37 +0200 | [diff] [blame] | 36 | static inline bool irq_remapped(struct irq_cfg *cfg) |
| 37 | { |
| 38 | return false; |
| 39 | } |
Suresh Siddha | c39d77f | 2011-08-23 17:05:24 -0700 | [diff] [blame] | 40 | static inline void irq_remap_modify_chip_defaults(struct irq_chip *chip) |
| 41 | { |
| 42 | } |
Suresh Siddha | 62a92f4 | 2010-08-27 11:09:49 -0700 | [diff] [blame] | 43 | #endif |
| 44 | |
H. Peter Anvin | 5e1b007 | 2008-10-23 00:20:33 -0700 | [diff] [blame] | 45 | #endif /* _ASM_X86_IRQ_REMAPPING_H */ |