[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: start PCI IRQs Xen uses from Dom0-invoked io_apic_set_pci_routing()



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1270026749 -3600
# Node ID 4f796e29987c0db1579787fe0b7d3d5af00963ea
# Parent  589d075ba2953123c1b39ecdbc190689ac6f443c
x86: start PCI IRQs Xen uses from Dom0-invoked io_apic_set_pci_routing()

When using a serial port from an add-in PCI card, and that IRQ is (as
usual) outside of the legacy range (0...15), Xen would never really
enable the IRQ, as at the time setup_irq() runs the handler for the
IRQ still is &no_irq_type. Consequently, once the trigger mode and
polarity of the interrupt become known to Xen, it should start such
IRQ(s) it uses for itself.

The question is whether the same should also be done in
ioapic_guest_write(): Legacy kernels don't use PHYSDEVOP_setup_gsi
(and hence don't trigger the code path modified).

Note however that even when a kernel is using PHYSDEVOP_setup_gsi in
the way the pv-ops kernel currently does, there's still no guarantee
that the call would ever be issued for IRQs Xen may be using, since
this happens only when devices get enabled. For Xen's purposes, this
function should be called for *all* device IRQs, regardless of
whether those would actually be (attempted to be) used by the kernel,
i.e. in a subsys_initcall() from drivers/acpi/pci_irq.c iterating
over all PCI devices and doing mostly what acpi_pci_irq_enable() does
except for calling this function in place of acpi_register_gsi(). The
downside of this approach is that without extra filtering in Xen
(based on a hint from Dom0), vectors will then get up even for IRQs
that are unused by both hypervisor and kernel.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 xen/arch/x86/io_apic.c |    6 ++++++
 1 files changed, 6 insertions(+)

diff -r 589d075ba295 -r 4f796e29987c xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c    Wed Mar 31 10:11:41 2010 +0100
+++ b/xen/arch/x86/io_apic.c    Wed Mar 31 10:12:29 2010 +0100
@@ -2111,6 +2111,7 @@ int __init io_apic_get_redir_entries (in
 
 int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int 
active_high_low)
 {
+    struct irq_desc *desc = irq_to_desc(irq);
     struct IO_APIC_route_entry entry;
     unsigned long flags;
     int vector;
@@ -2163,6 +2164,11 @@ int io_apic_set_pci_routing (int ioapic,
     io_apic_write(ioapic, 0x10+2*pin, *(((int *)&entry)+0));
     set_native_irq_info(irq, TARGET_CPUS);
     spin_unlock_irqrestore(&ioapic_lock, flags);
+
+    spin_lock(&desc->lock);
+    if (!(desc->status & (IRQ_DISABLED | IRQ_GUEST)))
+        desc->handler->startup(irq);
+    spin_unlock(&desc->lock);
 
     return 0;
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.