Aurelien Jarno wrote:

It's actually described page 200 of the specifications (page 216 in ACPIspec30.pdf):

  Note: This descriptor is meant for describing interrupts that are connected 
to PIC-compatible
  interrupt controllers, which can only be programmed for 
Active-High-Edge-Triggered or Active-
  Low-Level-Triggered interrupts. Any other combination is illegal. The 
Extended Interrupt
  Descriptor can be used to describe other combinations.


Avi, if you think this anlysis is correct I can provide the patch changing
"Level" to "Edge"...


It looks like the solution is either to describe the IRQ with an "Extended Interrupt Descriptor" or to change this value to one of the two allowed values. In the later case we have to make sure it is
consistent with the way the PIC works.


The attached patch attempts to override the pci irqs (now limited to 5, 9, 10, and 11) to be active high level triggered. Linux boots and parses this correctly. Freebsd still fails.


--
Any sufficiently difficult bug is indistinguishable from a feature.

diff --git a/bios/rombios32.c b/bios/rombios32.c
index 314df94..65d6207 100755
--- a/bios/rombios32.c
+++ b/bios/rombios32.c
@@ -1181,6 +1181,14 @@ struct madt_io_apic
 			  * lines start */
 };
 
+struct madt_interrupt_source_override {
+	APIC_HEADER_DEF
+	uint8_t bus;
+	uint8_t source;
+	uint32_t gsi;
+	uint16_t flags;
+} __attribute__((__packed__));
+
 #include "acpi-dsdt.hex"
 
 static inline uint16_t cpu_to_le16(uint16_t x)
@@ -1273,7 +1281,8 @@ void acpi_bios_init(void)
     madt_addr = addr;
     madt_size = sizeof(*madt) + 
         sizeof(struct madt_processor_apic) * smp_cpus +
-        sizeof(struct madt_io_apic);
+        sizeof(struct madt_io_apic) +
+	sizeof(struct madt_interrupt_source_override) * 4;
     madt = (void *)(addr);
     addr += madt_size;
 
@@ -1335,6 +1344,8 @@ void acpi_bios_init(void)
     {
         struct madt_processor_apic *apic;
         struct madt_io_apic *io_apic;
+        struct madt_interrupt_source_override *iso;
+	static int pci_irq[4] = { 5, 9, 10, 11 };
 
         memset(madt, 0, madt_size);
         madt->local_apic_address = cpu_to_le32(0xfee00000);
@@ -1354,6 +1365,17 @@ void acpi_bios_init(void)
         io_apic->io_apic_id = smp_cpus;
         io_apic->address = cpu_to_le32(0xfec00000);
         io_apic->interrupt = cpu_to_le32(0);
+	io_apic++;
+	iso = (void *)io_apic;
+	for (i = 0; i < 4; ++i) {
+	    iso->type = APIC_XRUPT_OVERRIDE;
+	    iso->length = sizeof(*iso);
+	    iso->bus = 0;
+	    iso->source = pci_irq[i];
+	    iso->gsi = cpu_to_le32(iso->source);
+	    iso->flags = cpu_to_le16(0xd); // active high level trigger
+	    ++iso;
+	}
 
         acpi_build_table_header((struct acpi_table_header *)madt, 
                                 "APIC", madt_size);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to