Commit 89027d35 authored by Suresh Siddha's avatar Suresh Siddha Committed by Ingo Molnar

x64, x2apic/intr-remap: IO-APIC support for interrupt-remapping

IO-APIC support in the presence of interrupt-remapping infrastructure.

IO-APIC RTE will be programmed with interrupt-remapping table entry(IRTE)
index and the IRTE will contain information about the vector, cpu destination,
trigger mode etc, which traditionally was present in the IO-APIC RTE.

Introduce a new irq_chip for cleaner irq migration (in the process
context as opposed to the current irq migration in the context of an interrupt.
interrupt-remapping infrastructure will help us achieve this cleanly).

For edge triggered, irq migration is a simple atomic update(of vector
and cpu destination) of IRTE and flush the hardware cache.

For level triggered, we need to modify the io-apic RTE aswell with the update
vector information, along with modifying IRTE with vector and cpu destination.
So irq migration for level triggered is little  bit more complex compared to
edge triggered migration. But the good news is, we use the same algorithm
for level triggered migration as we have today, only difference being,
we now initiate the irq migration from process context instead of the
interrupt context.

In future, when we do a directed EOI (combined with cpu EOI broadcast
suppression) to the IO-APIC, level triggered irq migration will also be
as simple as edge triggered migration and we can do the irq migration
with a simple atomic update to IO-APIC RTE.

TBD: some tests/changes needed in the presence of fixup_irqs() for
level triggered irq migration.
Signed-off-by: default avatarSuresh Siddha <suresh.b.siddha@intel.com>
Cc: akpm@linux-foundation.org
Cc: arjan@linux.intel.com
Cc: andi@firstfloor.org
Cc: ebiederm@xmission.com
Cc: jbarnes@virtuousgeek.org
Cc: steiner@sgi.com
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 5c520a67
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
static int disable_apic_timer __cpuinitdata; static int disable_apic_timer __cpuinitdata;
static int apic_calibrate_pmtmr __initdata; static int apic_calibrate_pmtmr __initdata;
int disable_apic; int disable_apic;
int x2apic;
/* Local APIC timer works in C2 */ /* Local APIC timer works in C2 */
int local_apic_timer_c2_ok; int local_apic_timer_c2_ok;
......
This diff is collapsed.
...@@ -220,6 +220,16 @@ int flush_irte(int irq) ...@@ -220,6 +220,16 @@ int flush_irte(int irq)
return 0; return 0;
} }
struct intel_iommu *map_ioapic_to_ir(int apic)
{
int i;
for (i = 0; i < MAX_IO_APICS; i++)
if (ir_ioapic[i].id == apic)
return ir_ioapic[i].iommu;
return NULL;
}
int free_irte(int irq) int free_irte(int irq)
{ {
int index, i; int index, i;
......
...@@ -134,6 +134,15 @@ extern int get_physical_broadcast(void); ...@@ -134,6 +134,15 @@ extern int get_physical_broadcast(void);
# define apic_write_around(x, y) apic_write_atomic((x), (y)) # define apic_write_around(x, y) apic_write_atomic((x), (y))
#endif #endif
#ifdef CONFIG_X86_64
static inline void ack_x2APIC_irq(void)
{
/* Docs say use 0 for future compatibility */
native_apic_msr_write(APIC_EOI, 0);
}
#endif
static inline void ack_APIC_irq(void) static inline void ack_APIC_irq(void)
{ {
/* /*
......
...@@ -107,6 +107,20 @@ struct IO_APIC_route_entry { ...@@ -107,6 +107,20 @@ struct IO_APIC_route_entry {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct IR_IO_APIC_route_entry {
__u64 vector : 8,
zero : 3,
index2 : 1,
delivery_status : 1,
polarity : 1,
irr : 1,
trigger : 1,
mask : 1,
reserved : 31,
format : 1,
index : 15;
} __attribute__ ((packed));
#ifdef CONFIG_X86_IO_APIC #ifdef CONFIG_X86_IO_APIC
/* /*
......
#ifndef _ASM_IRQ_REMAPPING_H
#define _ASM_IRQ_REMAPPING_H
extern int x2apic;
#define IRTE_DEST(dest) ((x2apic) ? dest : dest << 8)
#endif
...@@ -109,6 +109,7 @@ extern int flush_irte(int irq); ...@@ -109,6 +109,7 @@ extern int flush_irte(int irq);
extern int free_irte(int irq); extern int free_irte(int irq);
extern int irq_remapped(int irq); extern int irq_remapped(int irq);
extern struct intel_iommu *map_ioapic_to_ir(int apic);
#else #else
#define irq_remapped(irq) (0) #define irq_remapped(irq) (0)
#define enable_intr_remapping(mode) (-1) #define enable_intr_remapping(mode) (-1)
......
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