|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2/5] x86/ioapic: introduce helper to fetch triggering mode of GSI
This helper is used in order to fetch the triggering mode of a GSI. This is
needed in order to figure out if a GSI can be bound with the shared attribute
or not (only level triggered interrupts should be shared).
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
xen/arch/x86/io_apic.c | 22 ++++++++++++++++++++++
xen/include/asm-x86/io_apic.h | 1 +
2 files changed, 23 insertions(+)
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index d18046067c..df5bc52392 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -2261,6 +2261,28 @@ int io_apic_set_pci_routing (int ioapic, int pin, int
irq, int edge_level, int a
return 0;
}
+unsigned int io_apic_get_gsi_trigger(unsigned int gsi)
+{
+ struct IO_APIC_route_entry entry;
+ unsigned int ioapic, base_gsi;
+
+ ASSERT(gsi < nr_irqs_gsi);
+
+ /* For GSI type find if the GSI is level or edge triggered */
+ for ( ioapic = 0; ioapic < nr_ioapics; ioapic++ )
+ {
+ base_gsi = io_apic_gsi_base(ioapic);
+
+ if ( gsi >= base_gsi && gsi < base_gsi + nr_ioapic_entries[ioapic] )
+ break;
+ }
+ ASSERT(ioapic < nr_ioapics);
+
+ entry = ioapic_read_entry(ioapic, gsi - base_gsi, 0);
+
+ return entry.trigger;
+}
+
static int ioapic_physbase_to_id(unsigned long physbase)
{
int apic;
diff --git a/xen/include/asm-x86/io_apic.h b/xen/include/asm-x86/io_apic.h
index 8029c8f400..43bcb656ee 100644
--- a/xen/include/asm-x86/io_apic.h
+++ b/xen/include/asm-x86/io_apic.h
@@ -179,6 +179,7 @@ extern int io_apic_get_unique_id (int ioapic, int apic_id);
extern int io_apic_get_version (int ioapic);
extern int io_apic_get_redir_entries (int ioapic);
extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int
edge_level, int active_high_low);
+extern unsigned int io_apic_get_gsi_trigger(unsigned int gsi);
extern void init_ioapic_mappings(void);
--
2.12.1
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |