aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSuresh Siddha <suresh.b.siddha@intel.com>2010-08-27 14:09:49 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2010-09-15 20:36:45 -0400
commit62a92f4c69cd1d9361ad8c16be1dd16e6821bc15 (patch)
tree0e7dc5f29629d69bf93430b675d9d6d39e75c1f2 /arch
parent75e3cfbed6f71a8f151dc6e413b6ce3c390030cb (diff)
x86, intr-remap: Remove IRTE setup duplicate code
Remove IRTE setup duplicate code with prepare_irte(). Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> LKML-Reference: <20100827181049.095067319@sbsiddha-MOBL3.sc.intel.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/include/asm/irq_remapping.h27
-rw-r--r--arch/x86/kernel/apic/io_apic.c27
2 files changed, 29 insertions, 25 deletions
diff --git a/arch/x86/include/asm/irq_remapping.h b/arch/x86/include/asm/irq_remapping.h
index f275e2244505..8d841505344e 100644
--- a/arch/x86/include/asm/irq_remapping.h
+++ b/arch/x86/include/asm/irq_remapping.h
@@ -3,4 +3,31 @@
3 3
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
7static inline void prepare_irte(struct irte *irte, int vector,
8 unsigned int dest)
9{
10 memset(irte, 0, sizeof(*irte));
11
12 irte->present = 1;
13 irte->dst_mode = apic->irq_dest_mode;
14 /*
15 * Trigger mode in the IRTE will always be edge, and for IO-APIC, the
16 * actual level or edge trigger will be setup in the IO-APIC
17 * RTE. This will help simplify level triggered irq migration.
18 * For more details, see the comments (in io_apic.c) explainig IO-APIC
19 * irq migration in the presence of interrupt-remapping.
20 */
21 irte->trigger_mode = 0;
22 irte->dlvry_mode = apic->irq_delivery_mode;
23 irte->vector = vector;
24 irte->dest_id = IRTE_DEST(dest);
25 irte->redir_hint = 1;
26}
27#else
28static void prepare_irte(struct irte *irte, int vector, unsigned int dest)
29{
30}
31#endif
32
6#endif /* _ASM_X86_IRQ_REMAPPING_H */ 33#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 90f8a75f548f..e8c95a22614a 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1377,22 +1377,7 @@ int setup_ioapic_entry(int apic_id, int irq,
1377 if (index < 0) 1377 if (index < 0)
1378 panic("Failed to allocate IRTE for ioapic %d\n", apic_id); 1378 panic("Failed to allocate IRTE for ioapic %d\n", apic_id);
1379 1379
1380 memset(&irte, 0, sizeof(irte)); 1380 prepare_irte(&irte, vector, destination);
1381
1382 irte.present = 1;
1383 irte.dst_mode = apic->irq_dest_mode;
1384 /*
1385 * Trigger mode in the IRTE will always be edge, and the
1386 * actual level or edge trigger will be setup in the IO-APIC
1387 * RTE. This will help simplify level triggered irq migration.
1388 * For more details, see the comments above explainig IO-APIC
1389 * irq migration in the presence of interrupt-remapping.
1390 */
1391 irte.trigger_mode = 0;
1392 irte.dlvry_mode = apic->irq_delivery_mode;
1393 irte.vector = vector;
1394 irte.dest_id = IRTE_DEST(destination);
1395 irte.redir_hint = 1;
1396 1381
1397 /* Set source-id of interrupt request */ 1382 /* Set source-id of interrupt request */
1398 set_ioapic_sid(&irte, apic_id); 1383 set_ioapic_sid(&irte, apic_id);
@@ -3336,15 +3321,7 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq,
3336 ir_index = map_irq_to_irte_handle(irq, &sub_handle); 3321 ir_index = map_irq_to_irte_handle(irq, &sub_handle);
3337 BUG_ON(ir_index == -1); 3322 BUG_ON(ir_index == -1);
3338 3323
3339 memset (&irte, 0, sizeof(irte)); 3324 prepare_irte(&irte, cfg->vector, dest);
3340
3341 irte.present = 1;
3342 irte.dst_mode = apic->irq_dest_mode;
3343 irte.trigger_mode = 0; /* edge */
3344 irte.dlvry_mode = apic->irq_delivery_mode;
3345 irte.vector = cfg->vector;
3346 irte.dest_id = IRTE_DEST(dest);
3347 irte.redir_hint = 1;
3348 3325
3349 /* Set source-id of interrupt request */ 3326 /* Set source-id of interrupt request */
3350 if (pdev) 3327 if (pdev)