svn commit: r278855 - head/sys/x86/xen
Roger Pau Monné
royger at FreeBSD.org
Mon Feb 16 16:38:01 UTC 2015
Author: royger
Date: Mon Feb 16 16:37:59 2015
New Revision: 278855
URL: https://svnweb.freebsd.org/changeset/base/278855
Log:
xen/intr: improve handling of legacy IRQs
Devices that use ISA IRQs expect them to be already configured, and don't
call bus_config_intr, which prevents those IRQs from working on Xen. In
order to solve it pre-register all the legacy IRQs with the default values
(edge triggered, low polarity) if no override is found.
While there add a panic if the registration of an interrupt override fails.
Sponsored by: Citrix Systems R&D
Modified:
head/sys/x86/xen/pvcpu_enum.c
Modified: head/sys/x86/xen/pvcpu_enum.c
==============================================================================
--- head/sys/x86/xen/pvcpu_enum.c Mon Feb 16 16:30:42 2015 (r278854)
+++ head/sys/x86/xen/pvcpu_enum.c Mon Feb 16 16:37:59 2015 (r278855)
@@ -81,6 +81,7 @@ madt_parse_interrupt_override(ACPI_MADT_
{
enum intr_trigger trig;
enum intr_polarity pol;
+ int ret;
if (acpi_quirks & ACPI_Q_MADT_IRQ0 && intr->SourceIrq == 0 &&
intr->GlobalIrq == 2) {
@@ -101,7 +102,9 @@ madt_parse_interrupt_override(ACPI_MADT_
acpi_OverrideInterruptLevel(intr->GlobalIrq);
/* Register the IRQ with the polarity and trigger mode found. */
- xen_register_pirq(intr->GlobalIrq, trig, pol);
+ ret = xen_register_pirq(intr->GlobalIrq, trig, pol);
+ if (ret != 0)
+ panic("Unable to register interrupt override");
}
/*
@@ -175,7 +178,7 @@ xenpv_setup_io(void)
{
if (xen_initial_domain()) {
- int i;
+ int i, ret;
/* Map MADT */
madt_physaddr = acpi_find_table(ACPI_SIG_MADT);
@@ -201,8 +204,21 @@ xenpv_setup_io(void)
if (!madt_found_sci_override) {
printf(
"MADT: Forcing active-low polarity and level trigger for SCI\n");
- xen_register_pirq(AcpiGbl_FADT.SciInterrupt,
+ ret = xen_register_pirq(AcpiGbl_FADT.SciInterrupt,
INTR_TRIGGER_LEVEL, INTR_POLARITY_LOW);
+ if (ret != 0)
+ panic("Unable to register SCI IRQ");
+ }
+
+ /* Register legacy ISA IRQs */
+ for (i = 1; i < 16; i++) {
+ if (intr_lookup_source(i) != NULL)
+ continue;
+ ret = xen_register_pirq(i, INTR_TRIGGER_EDGE,
+ INTR_POLARITY_LOW);
+ if (ret != 0 && bootverbose)
+ printf("Unable to register legacy IRQ#%d: %d\n",
+ i, ret);
}
acpi_SetDefaultIntrModel(ACPI_INTR_APIC);
More information about the svn-src-all
mailing list