Commit 1a0730d6 authored by Thomas Gleixner's avatar Thomas Gleixner

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: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarIngo Molnar <mingo@elte.hu>
Acked-by: default avatarSuresh Siddha <suresh.b.siddha@intel.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
parent d585d060
...@@ -24,10 +24,18 @@ static inline void prepare_irte(struct irte *irte, int vector, ...@@ -24,10 +24,18 @@ static inline void prepare_irte(struct irte *irte, int vector,
irte->dest_id = IRTE_DEST(dest); irte->dest_id = IRTE_DEST(dest);
irte->redir_hint = 1; irte->redir_hint = 1;
} }
static inline bool irq_remapped(struct irq_cfg *cfg)
{
return cfg->irq_2_iommu.iommu != NULL;
}
#else #else
static void prepare_irte(struct irte *irte, int vector, unsigned int dest) static void prepare_irte(struct irte *irte, int vector, unsigned int dest)
{ {
} }
static inline bool irq_remapped(struct irq_cfg *cfg)
{
return false;
}
#endif #endif
#endif /* _ASM_X86_IRQ_REMAPPING_H */ #endif /* _ASM_X86_IRQ_REMAPPING_H */
...@@ -1237,7 +1237,7 @@ static void ioapic_register_intr(unsigned int irq, unsigned long trigger) ...@@ -1237,7 +1237,7 @@ static void ioapic_register_intr(unsigned int irq, unsigned long trigger)
else else
irq_clear_status_flags(irq, IRQ_LEVEL); irq_clear_status_flags(irq, IRQ_LEVEL);
if (irq_remapped(irq)) { if (irq_remapped(get_irq_chip_data(irq))) {
irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
if (trigger) if (trigger)
set_irq_chip_and_handler_name(irq, &ir_ioapic_chip, 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,7 +2183,7 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, struct irq
* With interrupt-remapping, destination information comes * With interrupt-remapping, destination information comes
* from interrupt-remapping table entry. * from interrupt-remapping table entry.
*/ */
if (!irq_remapped(irq)) if (!irq_remapped(cfg))
io_apic_write(apic, 0x11 + pin*2, dest); io_apic_write(apic, 0x11 + pin*2, dest);
reg = io_apic_read(apic, 0x10 + pin*2); reg = io_apic_read(apic, 0x10 + pin*2);
reg &= ~IO_APIC_REDIR_VECTOR_MASK; reg &= ~IO_APIC_REDIR_VECTOR_MASK;
...@@ -2415,7 +2415,7 @@ static void eoi_ioapic_irq(unsigned int irq, struct irq_cfg *cfg) ...@@ -2415,7 +2415,7 @@ static void eoi_ioapic_irq(unsigned int irq, struct irq_cfg *cfg)
* intr-remapping table entry. Hence for the io-apic * intr-remapping table entry. Hence for the io-apic
* EOI we use the pin number. * EOI we use the pin number.
*/ */
if (irq_remapped(irq)) if (irq_remapped(cfg))
io_apic_eoi(entry->apic, entry->pin); io_apic_eoi(entry->apic, entry->pin);
else else
io_apic_eoi(entry->apic, cfg->vector); io_apic_eoi(entry->apic, cfg->vector);
...@@ -3139,7 +3139,7 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, ...@@ -3139,7 +3139,7 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq,
dest = apic->cpu_mask_to_apicid_and(cfg->domain, apic->target_cpus()); dest = apic->cpu_mask_to_apicid_and(cfg->domain, apic->target_cpus());
if (irq_remapped(irq)) { if (irq_remapped(get_irq_chip_data(irq))) {
struct irte irte; struct irte irte;
int ir_index; int ir_index;
u16 sub_handle; u16 sub_handle;
...@@ -3321,7 +3321,7 @@ static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int irq) ...@@ -3321,7 +3321,7 @@ static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int irq)
set_irq_msi(irq, msidesc); set_irq_msi(irq, msidesc);
write_msi_msg(irq, &msg); write_msi_msg(irq, &msg);
if (irq_remapped(irq)) { if (irq_remapped(get_irq_chip_data(irq))) {
irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
set_irq_chip_and_handler_name(irq, &msi_ir_chip, handle_edge_irq, "edge"); set_irq_chip_and_handler_name(irq, &msi_ir_chip, handle_edge_irq, "edge");
} else } else
...@@ -3522,7 +3522,7 @@ int arch_setup_hpet_msi(unsigned int irq, unsigned int id) ...@@ -3522,7 +3522,7 @@ int arch_setup_hpet_msi(unsigned int irq, unsigned int id)
hpet_msi_write(get_irq_data(irq), &msg); hpet_msi_write(get_irq_data(irq), &msg);
irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
if (irq_remapped(irq)) if (irq_remapped(get_irq_chip_data(irq)))
set_irq_chip_and_handler_name(irq, &ir_hpet_msi_type, set_irq_chip_and_handler_name(irq, &ir_hpet_msi_type,
handle_edge_irq, "edge"); handle_edge_irq, "edge");
else else
......
...@@ -54,13 +54,6 @@ static struct irq_2_iommu *irq_2_iommu(unsigned int irq) ...@@ -54,13 +54,6 @@ static struct irq_2_iommu *irq_2_iommu(unsigned int irq)
return cfg ? &cfg->irq_2_iommu : NULL; return cfg ? &cfg->irq_2_iommu : NULL;
} }
int irq_remapped(int irq)
{
struct irq_2_iommu *irq_iommu = irq_2_iommu(irq);
return irq_iommu ? irq_iommu->iommu != NULL : 0;
}
int get_irte(int irq, struct irte *entry) int get_irte(int irq, struct irte *entry)
{ {
struct irq_2_iommu *irq_iommu = irq_2_iommu(irq); struct irq_2_iommu *irq_iommu = irq_2_iommu(irq);
......
...@@ -122,7 +122,6 @@ extern int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index, ...@@ -122,7 +122,6 @@ extern int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index,
extern int map_irq_to_irte_handle(int irq, u16 *sub_handle); extern int map_irq_to_irte_handle(int irq, u16 *sub_handle);
extern int free_irte(int irq); extern int free_irte(int irq);
extern int irq_remapped(int irq);
extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev); extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev);
extern struct intel_iommu *map_ioapic_to_ir(int apic); extern struct intel_iommu *map_ioapic_to_ir(int apic);
extern struct intel_iommu *map_hpet_to_ir(u8 id); extern 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,7 +175,6 @@ static inline int set_msi_sid(struct irte *irte, struct pci_dev *dev)
return 0; return 0;
} }
#define irq_remapped(irq) (0)
#define enable_intr_remapping(mode) (-1) #define enable_intr_remapping(mode) (-1)
#define disable_intr_remapping() (0) #define disable_intr_remapping() (0)
#define reenable_intr_remapping(mode) (0) #define reenable_intr_remapping(mode) (0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment