aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2010-10-11 05:55:37 -0400
committerThomas Gleixner <tglx@linutronix.de>2010-10-12 10:53:42 -0400
commit1a0730d6649113c820217387a011a17dd4aff3ad (patch)
tree3b5240cb87605a72179885d1503f8f7297e4e224
parentd585d060b42bd36f6f0b23ff327d3b91f80c7139 (diff)
x86: Speed up the irq_remapped check in hot pathes
irq_2_iommu is in struct irq_cfg, so we can do the irq_remapped check based on irq_cfg instead of going through a lookup function. That's especially interesting in the eoi_ioapic_irq() hotpath. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Ingo Molnar <mingo@elte.hu> Acked-by: Suresh Siddha <suresh.b.siddha@intel.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
-rw-r--r--arch/x86/include/asm/irq_remapping.h8
-rw-r--r--arch/x86/kernel/apic/io_apic.c12
-rw-r--r--drivers/pci/intr_remapping.c7
-rw-r--r--include/linux/dmar.h2
4 files changed, 14 insertions, 15 deletions
diff --git a/arch/x86/include/asm/irq_remapping.h b/arch/x86/include/asm/irq_remapping.h
index 8d841505344..1c23360fb2d 100644
--- a/arch/x86/include/asm/irq_remapping.h
+++ b/arch/x86/include/asm/irq_remapping.h
@@ -24,10 +24,18 @@ static inline void prepare_irte(struct irte *irte, int vector,
24 irte->dest_id = IRTE_DEST(dest); 24 irte->dest_id = IRTE_DEST(dest);
25 irte->redir_hint = 1; 25 irte->redir_hint = 1;
26} 26}
27static inline bool irq_remapped(struct irq_cfg *cfg)
28{
29 return cfg->irq_2_iommu.iommu != NULL;
30}
27#else 31#else
28static void prepare_irte(struct irte *irte, int vector, unsigned int dest) 32static void prepare_irte(struct irte *irte, int vector, unsigned int dest)
29{ 33{
30} 34}
35static inline bool irq_remapped(struct irq_cfg *cfg)
36{
37 return false;
38}
31#endif 39#endif
32 40
33#endif /* _ASM_X86_IRQ_REMAPPING_H */ 41#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 6ff6bb883c5..1b8e8a10612 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1237,7 +1237,7 @@ static void ioapic_register_intr(unsigned int irq, unsigned long trigger)
1237 else 1237 else
1238 irq_clear_status_flags(irq, IRQ_LEVEL); 1238 irq_clear_status_flags(irq, IRQ_LEVEL);
1239 1239
1240 if (irq_remapped(irq)) { 1240 if (irq_remapped(get_irq_chip_data(irq))) {
1241 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); 1241 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
1242 if (trigger) 1242 if (trigger)
1243 set_irq_chip_and_handler_name(irq, &ir_ioapic_chip, 1243 set_irq_chip_and_handler_name(irq, &ir_ioapic_chip,
@@ -2183,7 +2183,7 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, struct irq
2183 * With interrupt-remapping, destination information comes 2183 * With interrupt-remapping, destination information comes
2184 * from interrupt-remapping table entry. 2184 * from interrupt-remapping table entry.
2185 */ 2185 */
2186 if (!irq_remapped(irq)) 2186 if (!irq_remapped(cfg))
2187 io_apic_write(apic, 0x11 + pin*2, dest); 2187 io_apic_write(apic, 0x11 + pin*2, dest);
2188 reg = io_apic_read(apic, 0x10 + pin*2); 2188 reg = io_apic_read(apic, 0x10 + pin*2);
2189 reg &= ~IO_APIC_REDIR_VECTOR_MASK; 2189 reg &= ~IO_APIC_REDIR_VECTOR_MASK;
@@ -2415,7 +2415,7 @@ static void eoi_ioapic_irq(unsigned int irq, struct irq_cfg *cfg)
2415 * intr-remapping table entry. Hence for the io-apic 2415 * intr-remapping table entry. Hence for the io-apic
2416 * EOI we use the pin number. 2416 * EOI we use the pin number.
2417 */ 2417 */
2418 if (irq_remapped(irq)) 2418 if (irq_remapped(cfg))
2419 io_apic_eoi(entry->apic, entry->pin); 2419 io_apic_eoi(entry->apic, entry->pin);
2420 else 2420 else
2421 io_apic_eoi(entry->apic, cfg->vector); 2421 io_apic_eoi(entry->apic, cfg->vector);
@@ -3139,7 +3139,7 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq,
3139 3139
3140 dest = apic->cpu_mask_to_apicid_and(cfg->domain, apic->target_cpus()); 3140 dest = apic->cpu_mask_to_apicid_and(cfg->domain, apic->target_cpus());
3141 3141
3142 if (irq_remapped(irq)) { 3142 if (irq_remapped(get_irq_chip_data(irq))) {
3143 struct irte irte; 3143 struct irte irte;
3144 int ir_index; 3144 int ir_index;
3145 u16 sub_handle; 3145 u16 sub_handle;
@@ -3321,7 +3321,7 @@ static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int irq)
3321 set_irq_msi(irq, msidesc); 3321 set_irq_msi(irq, msidesc);
3322 write_msi_msg(irq, &msg); 3322 write_msi_msg(irq, &msg);
3323 3323
3324 if (irq_remapped(irq)) { 3324 if (irq_remapped(get_irq_chip_data(irq))) {
3325 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); 3325 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
3326 set_irq_chip_and_handler_name(irq, &msi_ir_chip, handle_edge_irq, "edge"); 3326 set_irq_chip_and_handler_name(irq, &msi_ir_chip, handle_edge_irq, "edge");
3327 } else 3327 } else
@@ -3522,7 +3522,7 @@ int arch_setup_hpet_msi(unsigned int irq, unsigned int id)
3522 3522
3523 hpet_msi_write(get_irq_data(irq), &msg); 3523 hpet_msi_write(get_irq_data(irq), &msg);
3524 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); 3524 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
3525 if (irq_remapped(irq)) 3525 if (irq_remapped(get_irq_chip_data(irq)))
3526 set_irq_chip_and_handler_name(irq, &ir_hpet_msi_type, 3526 set_irq_chip_and_handler_name(irq, &ir_hpet_msi_type,
3527 handle_edge_irq, "edge"); 3527 handle_edge_irq, "edge");
3528 else 3528 else
diff --git a/drivers/pci/intr_remapping.c b/drivers/pci/intr_remapping.c
index a620b8bd8f4..ec87cd66f3e 100644
--- a/drivers/pci/intr_remapping.c
+++ b/drivers/pci/intr_remapping.c
@@ -54,13 +54,6 @@ static struct irq_2_iommu *irq_2_iommu(unsigned int irq)
54 return cfg ? &cfg->irq_2_iommu : NULL; 54 return cfg ? &cfg->irq_2_iommu : NULL;
55} 55}
56 56
57int irq_remapped(int irq)
58{
59 struct irq_2_iommu *irq_iommu = irq_2_iommu(irq);
60
61 return irq_iommu ? irq_iommu->iommu != NULL : 0;
62}
63
64int get_irte(int irq, struct irte *entry) 57int get_irte(int irq, struct irte *entry)
65{ 58{
66 struct irq_2_iommu *irq_iommu = irq_2_iommu(irq); 59 struct irq_2_iommu *irq_iommu = irq_2_iommu(irq);
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index 4475f8cf7a6..51651b76d40 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -122,7 +122,6 @@ extern int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index,
122extern int map_irq_to_irte_handle(int irq, u16 *sub_handle); 122extern int map_irq_to_irte_handle(int irq, u16 *sub_handle);
123extern int free_irte(int irq); 123extern int free_irte(int irq);
124 124
125extern int irq_remapped(int irq);
126extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev); 125extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev);
127extern struct intel_iommu *map_ioapic_to_ir(int apic); 126extern struct intel_iommu *map_ioapic_to_ir(int apic);
128extern struct intel_iommu *map_hpet_to_ir(u8 id); 127extern struct intel_iommu *map_hpet_to_ir(u8 id);
@@ -176,7 +175,6 @@ static inline int set_msi_sid(struct irte *irte, struct pci_dev *dev)
176 return 0; 175 return 0;
177} 176}
178 177
179#define irq_remapped(irq) (0)
180#define enable_intr_remapping(mode) (-1) 178#define enable_intr_remapping(mode) (-1)
181#define disable_intr_remapping() (0) 179#define disable_intr_remapping() (0)
182#define reenable_intr_remapping(mode) (0) 180#define reenable_intr_remapping(mode) (0)